Cleaned up the Font System to properly save to the character.
Also expanded @itemlist to support costume item types.
This commit is contained in:
parent
704f4f2d9a
commit
6afcdeb613
@ -519,7 +519,25 @@
|
||||
// @auction
|
||||
517: Auction System is disabled.
|
||||
|
||||
//518~534: free
|
||||
// @itemlist -- continued
|
||||
518: Lower Costume Head,
|
||||
519: Top Costume Head,
|
||||
520: Top/Lower Costume Head,
|
||||
521: Mid Costume Head,
|
||||
522: Mid/Lower Costume Head,
|
||||
523: Top/Mid/Lower Costume Head,
|
||||
524: Costume Robe,
|
||||
525: Costume Floor,
|
||||
526: Ammo,
|
||||
527: Shadow Body,
|
||||
528: Shadow Right Hand,
|
||||
529: Shadow Left Hand,
|
||||
530: Shadow Both Hands,
|
||||
531: Shadow Shoes,
|
||||
532: Shadow Right Accessory,
|
||||
533: Shadow Left Accessory,
|
||||
|
||||
//534: // Free
|
||||
|
||||
// Bot detect messages (currently unused)
|
||||
535: Possible use of BOT (99%% of chance) or modified client by '%s' (account: %d, char_id: %d). This player ask your name when you are hidden.
|
||||
@ -1366,21 +1384,21 @@
|
||||
|
||||
// @itemlist
|
||||
1332: ------ %s items list of '%s' ------
|
||||
1333: | equipped:
|
||||
1334: garment,
|
||||
1335: left accessory,
|
||||
1336: body/armor,
|
||||
1337: right hand,
|
||||
1338: left hand,
|
||||
1339: both hands,
|
||||
1340: feet,
|
||||
1341: right accessory,
|
||||
1342: lower head,
|
||||
1343: top head,
|
||||
1344: lower/top head,
|
||||
1345: mid head,
|
||||
1346: lower/mid head,
|
||||
1347: lower/mid/top head,
|
||||
1333: | Equipped:
|
||||
1334: Garment,
|
||||
1335: Left Accessory,
|
||||
1336: Body/Armor,
|
||||
1337: Right Hand,
|
||||
1338: Left Hand,
|
||||
1339: Both Hands,
|
||||
1340: Feet,
|
||||
1341: Right Accessory,
|
||||
1342: Lower Head,
|
||||
1343: Top Head,
|
||||
1344: Top/Lower Head,
|
||||
1345: Mid Head,
|
||||
1346: Mid/Lower Head,
|
||||
1347: Top/Mid/Lower Head,
|
||||
1348: -> (pet egg, pet id: %u, named)
|
||||
1349: -> (pet egg, pet id: %u, unnamed)
|
||||
1350: -> (crafted item, creator id: %u, star crumbs %d, element %d)
|
||||
|
@ -185,6 +185,32 @@ struct item {
|
||||
uint64 unique_id;
|
||||
};
|
||||
|
||||
//Equip position constants
|
||||
enum equip_pos {
|
||||
EQP_HEAD_LOW = 0x000001,
|
||||
EQP_HEAD_MID = 0x000200, // 512
|
||||
EQP_HEAD_TOP = 0x000100, // 256
|
||||
EQP_HAND_R = 0x000002, // 2
|
||||
EQP_HAND_L = 0x000020, // 32
|
||||
EQP_ARMOR = 0x000010, // 16
|
||||
EQP_SHOES = 0x000040, // 64
|
||||
EQP_GARMENT = 0x000004, // 4
|
||||
EQP_ACC_L = 0x000008, // 8
|
||||
EQP_ACC_R = 0x000080, // 128
|
||||
EQP_COSTUME_HEAD_TOP = 0x000400, // 1024
|
||||
EQP_COSTUME_HEAD_MID = 0x000800, // 2048
|
||||
EQP_COSTUME_HEAD_LOW = 0x001000, // 4096
|
||||
EQP_COSTUME_GARMENT = 0x002000, // 8192
|
||||
//EQP_COSTUME_FLOOR = 0x004000, // 16384
|
||||
EQP_AMMO = 0x008000, // 32768
|
||||
EQP_SHADOW_ARMOR = 0x010000, // 65536
|
||||
EQP_SHADOW_WEAPON = 0x020000, // 131072
|
||||
EQP_SHADOW_SHIELD = 0x040000, // 262144
|
||||
EQP_SHADOW_SHOES = 0x080000, // 524288
|
||||
EQP_SHADOW_ACC_R = 0x100000, // 1048576
|
||||
EQP_SHADOW_ACC_L = 0x200000, // 2097152
|
||||
};
|
||||
|
||||
struct point {
|
||||
unsigned short map;
|
||||
short x,y;
|
||||
@ -389,6 +415,8 @@ struct mmo_charstatus {
|
||||
// Char server addon system
|
||||
unsigned int character_moves;
|
||||
|
||||
unsigned char font;
|
||||
|
||||
bool cashshop_sent; // Whether the player has received the CashShop list
|
||||
};
|
||||
|
||||
|
@ -8412,35 +8412,26 @@ ACMD_FUNC(itemlist)
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
|
||||
if( strcmp(command+1, "storagelist") == 0 )
|
||||
{
|
||||
if( strcmp(command+1, "storagelist") == 0 ) {
|
||||
location = "storage";
|
||||
items = sd->status.storage.items;
|
||||
size = sd->storage_size;
|
||||
}
|
||||
else
|
||||
if( strcmp(command+1, "cartlist") == 0 )
|
||||
{
|
||||
} else if( strcmp(command+1, "cartlist") == 0 ) {
|
||||
location = "cart";
|
||||
items = sd->status.cart;
|
||||
size = MAX_CART;
|
||||
}
|
||||
else
|
||||
if( strcmp(command+1, "itemlist") == 0 )
|
||||
{
|
||||
} else if( strcmp(command+1, "itemlist") == 0 ) {
|
||||
location = "inventory";
|
||||
items = sd->status.inventory;
|
||||
size = MAX_INVENTORY;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return 1;
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
|
||||
count = 0; // total slots occupied
|
||||
counter = 0; // total items found
|
||||
for( i = 0; i < size; ++i )
|
||||
{
|
||||
for( i = 0; i < size; ++i ) {
|
||||
const struct item* it = &items[i];
|
||||
struct item_data* itd;
|
||||
|
||||
@ -8450,8 +8441,7 @@ ACMD_FUNC(itemlist)
|
||||
counter += it->amount;
|
||||
count++;
|
||||
|
||||
if( count == 1 )
|
||||
{
|
||||
if( count == 1 ) {
|
||||
StringBuf_Printf(&buf, msg_txt(sd,1332), location, sd->status.name); // ------ %s items list of '%s' ------
|
||||
clif_displaymessage(fd, StringBuf_Value(&buf));
|
||||
StringBuf_Clear(&buf);
|
||||
@ -8462,38 +8452,70 @@ ACMD_FUNC(itemlist)
|
||||
else
|
||||
StringBuf_Printf(&buf, "%d %s (%s, id: %d)", it->amount, itd->jname, itd->name, it->nameid);
|
||||
|
||||
if( it->equip )
|
||||
{
|
||||
if( it->equip ) {
|
||||
char equipstr[CHAT_SIZE_MAX];
|
||||
strcpy(equipstr, msg_txt(sd,1333)); // | equipped:
|
||||
if( it->equip & EQP_GARMENT )
|
||||
strcat(equipstr, msg_txt(sd,1334)); // garment,
|
||||
if( it->equip & EQP_ACC_L )
|
||||
strcat(equipstr, msg_txt(sd,1335)); // left accessory,
|
||||
if( it->equip & EQP_ARMOR )
|
||||
strcat(equipstr, msg_txt(sd,1336)); // body/armor,
|
||||
if( (it->equip & EQP_ARMS) == EQP_HAND_R )
|
||||
strcat(equipstr, msg_txt(sd,1337)); // right hand,
|
||||
if( (it->equip & EQP_ARMS) == EQP_HAND_L )
|
||||
strcat(equipstr, msg_txt(sd,1338)); // left hand,
|
||||
if( (it->equip & EQP_ARMS) == EQP_ARMS )
|
||||
strcat(equipstr, msg_txt(sd,1339)); // both hands,
|
||||
if( it->equip & EQP_SHOES )
|
||||
strcat(equipstr, msg_txt(sd,1340)); // feet,
|
||||
if( it->equip & EQP_ACC_R )
|
||||
strcat(equipstr, msg_txt(sd,1341)); // right accessory,
|
||||
if( (it->equip & EQP_HELM) == EQP_HEAD_LOW )
|
||||
strcat(equipstr, msg_txt(sd,1342)); // lower head,
|
||||
if( (it->equip & EQP_HELM) == EQP_HEAD_TOP )
|
||||
strcat(equipstr, msg_txt(sd,1343)); // top head,
|
||||
if( (it->equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_TOP) )
|
||||
strcat(equipstr, msg_txt(sd,1344)); // lower/top head,
|
||||
if( (it->equip & EQP_HELM) == EQP_HEAD_MID )
|
||||
strcat(equipstr, msg_txt(sd,1345)); // mid head,
|
||||
if( (it->equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_MID) )
|
||||
strcat(equipstr, msg_txt(sd,1346)); // lower/mid head,
|
||||
if( (it->equip & EQP_HELM) == EQP_HELM )
|
||||
strcat(equipstr, msg_txt(sd,1347)); // lower/mid/top head,
|
||||
|
||||
strcpy(equipstr, msg_txt(sd,1333)); // | Equipped:
|
||||
if( it->equip&EQP_GARMENT )
|
||||
strcat(equipstr, msg_txt(sd,1334)); // Robe,
|
||||
if( it->equip&EQP_ACC_L )
|
||||
strcat(equipstr, msg_txt(sd,1335)); // Left Accessory,
|
||||
if( it->equip&EQP_ARMOR )
|
||||
strcat(equipstr, msg_txt(sd,1336)); // Body/Armor,
|
||||
if( (it->equip&EQP_ARMS) == EQP_HAND_R )
|
||||
strcat(equipstr, msg_txt(sd,1337)); // Right Hand,
|
||||
if( (it->equip&EQP_ARMS) == EQP_HAND_L )
|
||||
strcat(equipstr, msg_txt(sd,1338)); // Left Hand,
|
||||
if( (it->equip&EQP_ARMS) == EQP_ARMS )
|
||||
strcat(equipstr, msg_txt(sd,1339)); // Both Hands,
|
||||
if( it->equip&EQP_SHOES )
|
||||
strcat(equipstr, msg_txt(sd,1340)); // Shoes,
|
||||
if( it->equip&EQP_ACC_R )
|
||||
strcat(equipstr, msg_txt(sd,1341)); // Right Accessory,
|
||||
if( (it->equip&EQP_HELM) == EQP_HEAD_LOW )
|
||||
strcat(equipstr, msg_txt(sd,1342)); // Lower Head,
|
||||
if( (it->equip&EQP_HELM) == EQP_HEAD_TOP )
|
||||
strcat(equipstr, msg_txt(sd,1343)); // Top Head,
|
||||
if( (it->equip&EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_TOP) )
|
||||
strcat(equipstr, msg_txt(sd,1344)); // Top/Lower Head,
|
||||
if( (it->equip&EQP_HELM) == EQP_HEAD_MID )
|
||||
strcat(equipstr, msg_txt(sd,1345)); // Mid Head,
|
||||
if( (it->equip&EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_MID) )
|
||||
strcat(equipstr, msg_txt(sd,1346)); // Mid/Lower Head,
|
||||
if( (it->equip&EQP_HELM) == EQP_HELM )
|
||||
strcat(equipstr, msg_txt(sd,1347)); // Top/Mid/Lower Head,
|
||||
if( (it->equip&EQP_COSTUME_HELM) == EQP_COSTUME_HEAD_LOW )
|
||||
strcat(equipstr, msg_txt(sd,518));
|
||||
if( (it->equip&EQP_COSTUME_HELM) == EQP_COSTUME_HEAD_TOP )
|
||||
strcat(equipstr, msg_txt(sd,519));
|
||||
if( (it->equip&EQP_COSTUME_HELM) == (EQP_COSTUME_HEAD_LOW|EQP_COSTUME_HEAD_TOP) )
|
||||
strcat(equipstr, msg_txt(sd,520));
|
||||
if( (it->equip&EQP_COSTUME_HELM) == EQP_COSTUME_HEAD_MID )
|
||||
strcat(equipstr, msg_txt(sd,521));
|
||||
if( (it->equip&EQP_COSTUME_HELM) == (EQP_COSTUME_HEAD_LOW|EQP_COSTUME_HEAD_MID) )
|
||||
strcat(equipstr, msg_txt(sd,522));
|
||||
if( (it->equip&EQP_COSTUME_HELM) == EQP_COSTUME_HELM )
|
||||
strcat(equipstr, msg_txt(sd,523));
|
||||
if( it->equip&EQP_COSTUME_GARMENT )
|
||||
strcat(equipstr, msg_txt(sd,524));
|
||||
//if( it->equip&EQP_COSTUME_FLOOR )
|
||||
//strcat(equipstr, msg_txt(sd,525));
|
||||
if( it->equip&EQP_AMMO )
|
||||
strcat(equipstr, msg_txt(sd,526));
|
||||
if( it->equip&EQP_SHADOW_ARMOR )
|
||||
strcat(equipstr, msg_txt(sd,527));
|
||||
if( (it->equip&EQP_SHADOW_ARMS) == EQP_SHADOW_WEAPON )
|
||||
strcat(equipstr, msg_txt(sd,528));
|
||||
if( (it->equip&EQP_SHADOW_ARMS) == EQP_SHADOW_SHIELD )
|
||||
strcat(equipstr, msg_txt(sd,529));
|
||||
if( (it->equip&EQP_SHADOW_ARMS) == EQP_SHADOW_ARMS )
|
||||
strcat(equipstr, msg_txt(sd,530));
|
||||
if( it->equip&EQP_SHADOW_SHOES )
|
||||
strcat(equipstr, msg_txt(sd,531));
|
||||
if( it->equip&EQP_SHADOW_ACC_R )
|
||||
strcat(equipstr, msg_txt(sd,532));
|
||||
if( it->equip&EQP_SHADOW_ACC_L )
|
||||
strcat(equipstr, msg_txt(sd,533));
|
||||
// remove final ', '
|
||||
equipstr[strlen(equipstr) - 2] = '\0';
|
||||
StringBuf_AppendStr(&buf, equipstr);
|
||||
@ -8502,29 +8524,19 @@ ACMD_FUNC(itemlist)
|
||||
clif_displaymessage(fd, StringBuf_Value(&buf));
|
||||
StringBuf_Clear(&buf);
|
||||
|
||||
if( it->card[0] == CARD0_PET )
|
||||
{// pet egg
|
||||
if( it->card[0] == CARD0_PET ) { // pet egg
|
||||
if (it->card[3])
|
||||
StringBuf_Printf(&buf, msg_txt(sd,1348), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, named)
|
||||
else
|
||||
StringBuf_Printf(&buf, msg_txt(sd,1349), (unsigned int)MakeDWord(it->card[1], it->card[2])); // -> (pet egg, pet id: %u, unnamed)
|
||||
}
|
||||
else
|
||||
if(it->card[0] == CARD0_FORGE)
|
||||
{// forged item
|
||||
} else if(it->card[0] == CARD0_FORGE) { // forged item
|
||||
StringBuf_Printf(&buf, msg_txt(sd,1350), (unsigned int)MakeDWord(it->card[2], it->card[3]), it->card[1]>>8, it->card[1]&0x0f); // -> (crafted item, creator id: %u, star crumbs %d, element %d)
|
||||
}
|
||||
else
|
||||
if(it->card[0] == CARD0_CREATE)
|
||||
{// created item
|
||||
} else if(it->card[0] == CARD0_CREATE) { // created item
|
||||
StringBuf_Printf(&buf, msg_txt(sd,1351), (unsigned int)MakeDWord(it->card[2], it->card[3])); // -> (produced item, creator id: %u)
|
||||
}
|
||||
else
|
||||
{// normal item
|
||||
} else { // normal item
|
||||
int counter2 = 0;
|
||||
|
||||
for( j = 0; j < itd->slot; ++j )
|
||||
{
|
||||
for( j = 0; j < itd->slot; ++j ) {
|
||||
struct item_data* card;
|
||||
|
||||
if( it->card[j] == 0 || (card = itemdb_exists(it->card[j])) == NULL )
|
||||
@ -8698,29 +8710,22 @@ ACMD_FUNC(font)
|
||||
nullpo_retr(-1,sd);
|
||||
|
||||
font_id = atoi(message);
|
||||
if( font_id == 0 )
|
||||
{
|
||||
if( sd->user_font )
|
||||
{
|
||||
sd->user_font = 0;
|
||||
if( font_id == 0 ) {
|
||||
if( sd->status.font ) {
|
||||
sd->status.font = 0;
|
||||
clif_displaymessage(fd, msg_txt(sd,1356)); // Returning to normal font.
|
||||
clif_font(sd);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
clif_displaymessage(fd, msg_txt(sd,1357)); // Use @font <1-9> to change your message font.
|
||||
clif_displaymessage(fd, msg_txt(sd,1358)); // Use 0 or no parameter to return to normal font.
|
||||
}
|
||||
}
|
||||
else if( font_id < 0 || font_id > 9 )
|
||||
} else if( font_id < 0 || font_id > 9 )
|
||||
clif_displaymessage(fd, msg_txt(sd,1359)); // Invalid font. Use a value from 0 to 9.
|
||||
else if( font_id != sd->user_font )
|
||||
{
|
||||
sd->user_font = font_id;
|
||||
else if( font_id != sd->status.font ) {
|
||||
sd->status.font = font_id;
|
||||
clif_font(sd);
|
||||
clif_displaymessage(fd, msg_txt(sd,1360)); // Font changed.
|
||||
}
|
||||
else
|
||||
} else
|
||||
clif_displaymessage(fd, msg_txt(sd,1361)); // Already using this font.
|
||||
|
||||
return 0;
|
||||
|
@ -1372,11 +1372,14 @@ int chrif_load_scdata(int fd) {
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
struct status_change_data *data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data));
|
||||
|
||||
status_change_start(NULL,&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 1|2|4|8);
|
||||
}
|
||||
|
||||
pc_scdata_received(sd);
|
||||
#endif
|
||||
|
||||
if( sd->state.autotrade ){
|
||||
if( sd->state.autotrade ) {
|
||||
buyingstore_reopen( sd );
|
||||
vending_reopen( sd );
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ void clif_authok(struct map_session_data *sd)
|
||||
WFIFOB(fd, 9) = 5; // ignored
|
||||
WFIFOB(fd,10) = 5; // ignored
|
||||
#if PACKETVER >= 20080102
|
||||
WFIFOW(fd,11) = sd->user_font; // FIXME: Font is currently not saved.
|
||||
WFIFOW(fd,11) = sd->status.font;
|
||||
#endif
|
||||
WFIFOSET(fd,packet_len(cmd));
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
|
||||
return packet_len(WBUFW(buffer,0));
|
||||
#endif
|
||||
#if PACKETVER >= 20080102
|
||||
WBUFW(buf,53) = sd?sd->user_font:0;
|
||||
WBUFW(buf,53) = (sd ? sd->status.font : 0);
|
||||
#endif
|
||||
#if PACKETVER >= 20091103
|
||||
memcpy((char*)WBUFP(buf,55), name, NAME_LENGTH);
|
||||
@ -1183,7 +1183,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
|
||||
WBUFB(buf,57) = (sd)? 5 : 0;
|
||||
WBUFW(buf,58) = clif_setlevel(bl);
|
||||
#if PACKETVER >= 20080102
|
||||
WBUFW(buf,60) = sd?sd->user_font:0;
|
||||
WBUFW(buf,60) = (sd ? sd->status.font : 0);
|
||||
#endif
|
||||
#if PACKETVER >= 20091103
|
||||
memcpy((char*)WBUFP(buf,62), name, NAME_LENGTH);
|
||||
@ -15879,7 +15879,7 @@ void clif_font(struct map_session_data *sd)
|
||||
nullpo_retv(sd);
|
||||
WBUFW(buf,0) = 0x2ef;
|
||||
WBUFL(buf,2) = sd->bl.id;
|
||||
WBUFW(buf,6) = sd->user_font;
|
||||
WBUFW(buf,6) = sd->status.font;
|
||||
clif_send(buf, packet_len(0x2ef), &sd->bl, AREA);
|
||||
#endif
|
||||
}
|
||||
|
@ -1709,9 +1709,10 @@ void itemdb_reload(void) {
|
||||
int i,d,k;
|
||||
|
||||
// clear the previous itemdb data
|
||||
for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i )
|
||||
for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) {
|
||||
if( itemdb_array[i] )
|
||||
destroy_item_data(itemdb_array[i], true);
|
||||
}
|
||||
|
||||
itemdb_group->clear(itemdb_group, itemdb_group_free);
|
||||
itemdb_other->clear(itemdb_other, itemdb_final_sub);
|
||||
|
@ -93,6 +93,15 @@ enum item_itemid {
|
||||
ITEMID_M_AWAKENING_POTION = 12242,
|
||||
ITEMID_M_BERSERK_POTION = 12243,
|
||||
ITEMID_COMP_BATTLE_MANUAL = 12263,
|
||||
ITEMID_LOVE_ANGEL = 12287,
|
||||
ITEMID_SQUIRREL = 12288,
|
||||
ITEMID_GOGO = 12289,
|
||||
ITEMID_PICTURE_DIARY = 12304,
|
||||
ITEMID_MINI_HEART = 12305,
|
||||
ITEMID_NEWCOMER = 12306,
|
||||
ITEMID_KID = 12307,
|
||||
ITEMID_MAGIC_CASTLE = 12308,
|
||||
ITEMID_BULGING_HEAD = 12309,
|
||||
ITEMID_THICK_BATTLE_MANUAL = 12312,
|
||||
ITEMID_ANCILLA = 12333,
|
||||
ITEMID_DUN_TELE_SCROLL3 = 12352,
|
||||
|
142
src/map/pc.c
142
src/map/pc.c
@ -437,10 +437,10 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
|
||||
static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t data)
|
||||
{
|
||||
struct map_session_data *sd = map_id2sd(id);
|
||||
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
if( tid != sd->rental_timer )
|
||||
{
|
||||
if( tid != sd->rental_timer ) {
|
||||
ShowError("pc_inventory_rental_end: invalid timer id.\n");
|
||||
return 0;
|
||||
}
|
||||
@ -451,8 +451,7 @@ static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t
|
||||
|
||||
int pc_inventory_rental_clear(struct map_session_data *sd)
|
||||
{
|
||||
if( sd->rental_timer != INVALID_TIMER )
|
||||
{
|
||||
if( sd->rental_timer != INVALID_TIMER ) {
|
||||
delete_timer(sd->rental_timer, pc_inventory_rental_end);
|
||||
sd->rental_timer = INVALID_TIMER;
|
||||
}
|
||||
@ -460,24 +459,89 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Assumes I is valid (from default areas where it is called, it is) */
|
||||
void pc_rental_expire(struct map_session_data *sd, int i)
|
||||
{
|
||||
short nameid = sd->status.inventory[i].nameid;
|
||||
|
||||
/* Soon to be dropped, we got plans to integrate it with item db */
|
||||
switch( nameid ) {
|
||||
case ITEMID_REINS_OF_MOUNT:
|
||||
if( &sd->sc && sd->sc.data[SC_ALL_RIDING] )
|
||||
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
|
||||
break;
|
||||
case ITEMID_LOVE_ANGEL:
|
||||
if( sd->status.font == 1 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_SQUIRREL:
|
||||
if( sd->status.font == 2 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_GOGO:
|
||||
if( sd->status.font == 3 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_PICTURE_DIARY:
|
||||
if( sd->status.font == 4 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_MINI_HEART:
|
||||
if( sd->status.font == 5 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_NEWCOMER:
|
||||
if( sd->status.font == 6 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_KID:
|
||||
if( sd->status.font == 7 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_MAGIC_CASTLE:
|
||||
if( sd->status.font == 8 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
case ITEMID_BULGING_HEAD:
|
||||
if( sd->status.font == 9 ) {
|
||||
sd->status.font = 0;
|
||||
clif_font(sd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
clif_rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
|
||||
pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
|
||||
}
|
||||
|
||||
void pc_inventory_rentals(struct map_session_data *sd)
|
||||
{
|
||||
int i, c = 0;
|
||||
unsigned int expire_tick, next_tick = UINT_MAX;
|
||||
|
||||
for( i = 0; i < MAX_INVENTORY; i++ )
|
||||
{ // Check for Rentals on Inventory
|
||||
for( i = 0; i < MAX_INVENTORY; i++ ) { // Check for Rentals on Inventory
|
||||
if( sd->status.inventory[i].nameid == 0 )
|
||||
continue; // Nothing here
|
||||
if( sd->status.inventory[i].expire_time == 0 )
|
||||
continue;
|
||||
|
||||
if( sd->status.inventory[i].expire_time <= time(NULL) ) {
|
||||
if( sd->status.inventory[i].nameid == ITEMID_REINS_OF_MOUNT && &sd->sc && sd->sc.data[SC_ALL_RIDING] )
|
||||
status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER);
|
||||
clif_rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
|
||||
pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
|
||||
} else {
|
||||
if( sd->status.inventory[i].expire_time <= time(NULL) )
|
||||
pc_rental_expire(sd, i);
|
||||
else {
|
||||
expire_tick = (unsigned int)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
|
||||
clif_rental_time(sd->fd, sd->status.inventory[i].nameid, (int)(expire_tick / 1000));
|
||||
next_tick = min(expire_tick, next_tick);
|
||||
@ -498,17 +562,15 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds)
|
||||
if( sd == NULL )
|
||||
return;
|
||||
|
||||
if( sd->rental_timer != INVALID_TIMER )
|
||||
{
|
||||
if( sd->rental_timer != INVALID_TIMER ) {
|
||||
const struct TimerData * td;
|
||||
|
||||
td = get_timer(sd->rental_timer);
|
||||
if( DIFF_TICK(td->tick, gettick()) > tick )
|
||||
{ // Update Timer as this one ends first than the current one
|
||||
if( DIFF_TICK(td->tick, gettick()) > tick ) { // Update Timer as this one ends first than the current one
|
||||
pc_inventory_rental_clear(sd);
|
||||
sd->rental_timer = add_timer(gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
sd->rental_timer = add_timer(gettick() + min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
|
||||
}
|
||||
|
||||
@ -545,8 +607,7 @@ int pc_makesavestatus(struct map_session_data *sd)
|
||||
#else
|
||||
sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR);
|
||||
#endif
|
||||
if (sd->sc.data[SC_JAILED])
|
||||
{ //When Jailed, do not move last point.
|
||||
if (sd->sc.data[SC_JAILED]) { //When Jailed, do not move last point.
|
||||
if(pc_isdead(sd)){
|
||||
pc_setrestartvalue(sd,0);
|
||||
} else {
|
||||
@ -1253,9 +1314,9 @@ int pc_reg_received(struct map_session_data *sd)
|
||||
}
|
||||
|
||||
//SG map and mob read [Komurka]
|
||||
for(i=0;i<MAX_PC_FEELHATE;i++) //for now - someone need to make reading from txt/sql
|
||||
{
|
||||
for(i=0;i<MAX_PC_FEELHATE;i++) { //for now - someone need to make reading from txt/sql
|
||||
uint16 j;
|
||||
|
||||
if ((j = pc_readglobalreg(sd,sg_info[i].feel_var))!=0) {
|
||||
sd->feel_map[i].index = j;
|
||||
sd->feel_map[i].m = map_mapindex2mapid(j);
|
||||
@ -1327,7 +1388,7 @@ int pc_reg_received(struct map_session_data *sd)
|
||||
sd->vip.time = 0;
|
||||
sd->vip.enabled = 0;
|
||||
chrif_req_login_operation(sd->status.account_id, sd->status.name, 6, 0, 1, 0); // request VIP informations
|
||||
#endif
|
||||
#endif
|
||||
intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
|
||||
intif_request_questlog(sd);
|
||||
|
||||
@ -1336,8 +1397,6 @@ int pc_reg_received(struct map_session_data *sd)
|
||||
clif_parse_LoadEndAck(sd->fd, sd);
|
||||
}
|
||||
|
||||
pc_inventory_rentals(sd);
|
||||
|
||||
if( sd->sc.option&OPTION_INVISIBLE ) {
|
||||
sd->vd.class_ = INVISIBLE_CLASS;
|
||||
clif_displaymessage( sd->fd, msg_txt( sd, 11 ) ); // Invisible: On
|
||||
@ -1352,19 +1411,9 @@ int pc_reg_received(struct map_session_data *sd)
|
||||
|
||||
clif_changeoption( &sd->bl );
|
||||
}
|
||||
|
||||
if( sd->state.autotrade ){
|
||||
|
||||
if( sd->state.autotrade )
|
||||
clif_parse_LoadEndAck(sd->fd, sd);
|
||||
}
|
||||
|
||||
if (sd->expiration_time != 0) { // don't display if it's unlimited or an unknown value
|
||||
time_t exp_time = sd->expiration_time;
|
||||
char tmpstr[1024];
|
||||
strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(sd,501), localtime(&exp_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
|
||||
clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
|
||||
|
||||
pc_expire_check(sd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -10562,6 +10611,21 @@ void pc_damage_log_clear(struct map_session_data *sd, int id)
|
||||
}
|
||||
}
|
||||
|
||||
/* Status change data arrived from char-server */
|
||||
void pc_scdata_received(struct map_session_data *sd) {
|
||||
pc_inventory_rentals(sd);
|
||||
|
||||
if( sd->expiration_time != 0 ) { //Don't display if it's unlimited or unknow value
|
||||
time_t exp_time = sd->expiration_time;
|
||||
char tmpstr[1024];
|
||||
|
||||
strftime(tmpstr,sizeof(tmpstr) - 1,msg_txt(sd,501),localtime(&exp_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
|
||||
clif_wis_message(sd->fd,wisp_server_name,tmpstr,strlen(tmpstr) + 1);
|
||||
|
||||
pc_expire_check(sd);
|
||||
}
|
||||
}
|
||||
|
||||
int pc_expiration_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
||||
struct map_session_data *sd = map_id2sd(id);
|
||||
|
||||
@ -10619,7 +10683,7 @@ void pc_expire_check(struct map_session_data *sd) {
|
||||
**/
|
||||
enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(struct map_session_data *sd, int money) {
|
||||
unsigned int limit_check = money+sd->status.bank_vault;
|
||||
|
||||
|
||||
if( money <= 0 || limit_check > MAX_BANK_ZENY ) {
|
||||
return BDA_OVERFLOW;
|
||||
} else if ( money > sd->status.zeny ) {
|
||||
|
33
src/map/pc.h
33
src/map/pc.h
@ -526,7 +526,6 @@ struct map_session_data {
|
||||
const char* debug_func;
|
||||
|
||||
unsigned int bg_id;
|
||||
unsigned short user_font;
|
||||
|
||||
#ifdef SECURE_NPCTIMEOUT
|
||||
/**
|
||||
@ -564,7 +563,7 @@ struct map_session_data {
|
||||
unsigned char channel_count;
|
||||
struct Channel *gcbind;
|
||||
bool stealth;
|
||||
unsigned char fontcolor; /* debug-only */
|
||||
unsigned char fontcolor;
|
||||
unsigned int channel_tick;
|
||||
|
||||
/* [Ind] */
|
||||
@ -662,32 +661,6 @@ enum ammo_type {
|
||||
A_THROWWEAPON //9
|
||||
};
|
||||
|
||||
//Equip position constants
|
||||
enum equip_pos {
|
||||
EQP_HEAD_LOW = 0x000001,
|
||||
EQP_HEAD_MID = 0x000200, // 512
|
||||
EQP_HEAD_TOP = 0x000100, // 256
|
||||
EQP_HAND_R = 0x000002, // 2
|
||||
EQP_HAND_L = 0x000020, // 32
|
||||
EQP_ARMOR = 0x000010, // 16
|
||||
EQP_SHOES = 0x000040, // 64
|
||||
EQP_GARMENT = 0x000004, // 4
|
||||
EQP_ACC_L = 0x000008, // 8
|
||||
EQP_ACC_R = 0x000080, // 128
|
||||
EQP_COSTUME_HEAD_TOP = 0x000400, // 1024
|
||||
EQP_COSTUME_HEAD_MID = 0x000800, // 2048
|
||||
EQP_COSTUME_HEAD_LOW = 0x001000, // 4096
|
||||
EQP_COSTUME_GARMENT = 0x002000, // 8192
|
||||
//EQP_COSTUME_FLOOR = 0x004000, // 16384
|
||||
EQP_AMMO = 0x008000, // 32768
|
||||
EQP_SHADOW_ARMOR = 0x010000, // 65536
|
||||
EQP_SHADOW_WEAPON = 0x020000, // 131072
|
||||
EQP_SHADOW_SHIELD = 0x040000, // 262144
|
||||
EQP_SHADOW_SHOES = 0x080000, // 524288
|
||||
EQP_SHADOW_ACC_R = 0x100000, // 1048576
|
||||
EQP_SHADOW_ACC_L = 0x200000, // 2097152
|
||||
};
|
||||
|
||||
struct {
|
||||
unsigned int base_hp[MAX_LEVEL], base_sp[MAX_LEVEL]; //Storage for the first calculation with hp/sp factor and multiplicator
|
||||
int hp_factor, hp_multiplicator, sp_factor;
|
||||
@ -711,8 +684,10 @@ struct {
|
||||
#define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
|
||||
#define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
|
||||
#define EQP_COSTUME (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)
|
||||
#define EQP_COSTUME_HELM (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW)
|
||||
#define EQP_SHADOW_GEAR (EQP_SHADOW_ARMOR|EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD|EQP_SHADOW_SHOES|EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
|
||||
#define EQP_SHADOW_ACC (EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
|
||||
#define EQP_SHADOW_ARMS (EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD)
|
||||
|
||||
/// Equip positions that use a visible sprite
|
||||
#if PACKETVER < 20110111
|
||||
@ -857,6 +832,7 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id);
|
||||
short pc_checkequip(struct map_session_data *sd,int pos);
|
||||
bool pc_checkequip2(struct map_session_data *sd,int nameid,int min, int max);
|
||||
|
||||
void pc_scdata_received(struct map_session_data *sd);
|
||||
int pc_expiration_timer(int tid, unsigned int tick, int id, intptr_t data);
|
||||
int pc_global_expiration_timer(int tid, unsigned tick, int id, intptr_t data);
|
||||
void pc_expire_check(struct map_session_data *sd);
|
||||
@ -1081,6 +1057,7 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr_t data); // by [y
|
||||
void pc_inventory_rentals(struct map_session_data *sd);
|
||||
int pc_inventory_rental_clear(struct map_session_data *sd);
|
||||
void pc_inventory_rental_add(struct map_session_data *sd, int seconds);
|
||||
void pc_rental_expire(struct map_session_data *sd, int i);
|
||||
|
||||
int pc_read_motd(void); // [Valaris]
|
||||
int pc_disguise(struct map_session_data *sd, int class_);
|
||||
|
@ -17384,13 +17384,14 @@ BUILDIN_FUNC(setfont)
|
||||
{
|
||||
struct map_session_data *sd = script_rid2sd(st);
|
||||
int font = script_getnum(st,2);
|
||||
|
||||
if( sd == NULL )
|
||||
return 0;
|
||||
|
||||
if( sd->user_font != font )
|
||||
sd->user_font = font;
|
||||
if( sd->status.font != font )
|
||||
sd->status.font = font;
|
||||
else
|
||||
sd->user_font = 0;
|
||||
sd->status.font = 0;
|
||||
|
||||
clif_font(sd);
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
@ -17401,8 +17402,8 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
|
||||
TBL_MOB* md = (TBL_MOB*)bl;
|
||||
struct block_list *tbl;
|
||||
int mobid = va_arg(ap,int);
|
||||
uint16 skill_id = va_arg(ap,int);
|
||||
uint16 skill_lv = va_arg(ap,int);
|
||||
uint16 skill_id = va_arg(ap,int);
|
||||
uint16 skill_lv = va_arg(ap,int);
|
||||
int casttime = va_arg(ap,int);
|
||||
int cancel = va_arg(ap,int);
|
||||
int emotion = va_arg(ap,int);
|
||||
@ -17412,8 +17413,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
|
||||
return 0;
|
||||
|
||||
// 0:self, 1:target, 2:master, default:random
|
||||
switch( target )
|
||||
{
|
||||
switch( target ) {
|
||||
case 0: tbl = map_id2bl(md->bl.id); break;
|
||||
case 1: tbl = map_id2bl(md->target_id); break;
|
||||
case 2: tbl = map_id2bl(md->master_id); break;
|
||||
@ -17435,6 +17435,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
|
||||
|
||||
return SCRIPT_CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* areamobuseskill "Map Name",<x>,<y>,<range>,<Mob ID>,"Skill Name"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>;
|
||||
*------------------------------------------*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user