diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 8 | ||||
-rw-r--r-- | src/map/clif.c | 73 | ||||
-rw-r--r-- | src/map/itemdb.h | 9 | ||||
-rw-r--r-- | src/map/packets_struct.h | 14 | ||||
-rw-r--r-- | src/map/pc.c | 56 | ||||
-rw-r--r-- | src/map/pc.h | 3 | ||||
-rw-r--r-- | src/map/script.c | 6 |
7 files changed, 120 insertions, 49 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7ec589956..146159c63 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8111,9 +8111,9 @@ ACMD(font) { font_id = atoi(message); if( font_id == 0 ) { - if( sd->user_font ) + if( sd->status.font ) { - sd->user_font = 0; + sd->status.font = 0; clif->message(fd, msg_txt(1356)); // Returning to normal font. clif->font(sd); } @@ -8125,9 +8125,9 @@ ACMD(font) { } else if( font_id < 0 || font_id > 9 ) clif->message(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9. - else if( font_id != sd->user_font ) + else if( font_id != sd->status.font ) { - sd->user_font = font_id; + sd->status.font = font_id; clif->font(sd); clif->message(fd, msg_txt(1360)); // Font changed. } diff --git a/src/map/clif.c b/src/map/clif.c index 414884394..c1e7cb1c9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -611,7 +611,7 @@ void clif_authok(struct map_session_data *sd) p.xSize = p.ySize = 5; /* not-used */ #if PACKETVER >= 20080102 - p.font = sd->user_font; // FIXME: Font is currently not saved. + p.font = sd->status.font; #endif clif->send(&p,sizeof(p),&sd->bl,SELF); @@ -982,7 +982,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu p.state = vd->dead_sit; p.clevel = clif_setlevel(bl); #if PACKETVER >= 20080102 - p.font = (sd) ? sd->user_font : 0; + p.font = (sd) ? sd->status.font : 0; #endif #if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { @@ -1110,7 +1110,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { p.xSize = p.ySize = (sd) ? 5 : 0; p.clevel = clif_setlevel(bl); #if PACKETVER >= 20080102 - p.font = (sd) ? sd->user_font : 0; + p.font = (sd) ? sd->status.font : 0; #endif #if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { @@ -1188,7 +1188,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.xSize = p.ySize = (sd) ? 5 : 0; p.clevel = clif_setlevel(bl); #if PACKETVER >= 20080102 - p.font = (sd) ? sd->user_font : 0; + p.font = (sd) ? sd->status.font : 0; #endif #if PACKETVER >= 20140000 //actual 20120221 if( bl->type == BL_MOB ) { @@ -2459,40 +2459,49 @@ void clif_equiplist(struct map_session_data *sd) { } void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { - int i, normal = 0, equip = 0; + int i = 0; struct item_data *id; - for( i = 0; i < items_length; i++ ) { - - if( items[i].nameid <= 0 ) - continue; - - id = itemdb->search(items[i].nameid); - if( !itemdb->isstackable2(id) ) //Non-stackable (Equippable) - clif_item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); - else //Stackable (Normal) - clif_item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); - } + do { + int normal = 0, equip = 0, k = 0; + + for( ; i < items_length && k < 500; i++, k++ ) { + + if( items[i].nameid <= 0 ) + continue; + + id = itemdb->search(items[i].nameid); + + if( !itemdb->isstackable2(id) ) //Non-stackable (Equippable) + clif_item_equip(i+1,&storelist_equip.list[equip++],&items[i],id,id->equip); + else //Stackable (Normal) + clif_item_normal(i+1,&storelist_normal.list[normal++],&items[i],id); + } - if( normal ) { - storelist_normal.PacketType = storagelistnormalType; - storelist_normal.PacketLength = ( sizeof( storelist_normal ) - ARRAYLENGTH( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + if( normal ) { + storelist_normal.PacketType = storagelistnormalType; + storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); + #if PACKETVER >= 20120925 - safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH); -#endif - clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); - } - - if( equip ) { - storelist_equip.PacketType = storagelistequipType; - storelist_equip.PacketLength = ( sizeof( storelist_equip ) - ARRAYLENGTH( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); + safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH); +#endif + + clif->send(&storelist_normal, storelist_normal.PacketLength, &sd->bl, SELF); + } + + if( equip ) { + storelist_equip.PacketType = storagelistequipType; + storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); #if PACKETVER >= 20120925 - safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH); + safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH); #endif + + clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); + } - clif->send(&storelist_equip, storelist_equip.PacketLength, &sd->bl, SELF); - } + } while ( i < items_length ); + } void clif_cartlist(struct map_session_data *sd) { @@ -8885,7 +8894,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts } viewequip_list.PacketType = viewequipackType; - viewequip_list.PacketLength = ( sizeof( viewequip_list ) - ARRAYLENGTH( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); + viewequip_list.PacketLength = ( sizeof( viewequip_list ) - sizeof( viewequip_list.list ) ) + ( sizeof(struct EQUIPITEM_INFO) * equip ); safestrncpy(viewequip_list.characterName, tsd->status.name, NAME_LENGTH); @@ -16092,7 +16101,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 } diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 0f46c1c01..2579d84ca 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -48,6 +48,15 @@ enum item_itemid { ITEMID_TRAP_ALLOY = 7940, ITEMID_ANCILLA = 12333, ITEMID_REINS_OF_MOUNT = 12622, + 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, }; /** diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index e9a582582..813aebee0 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -215,9 +215,9 @@ struct NORMALITEM_INFO { #endif #if PACKETVER >= 20120925 struct { - unsigned int IsIdentified : 1; - unsigned int PlaceETCTab : 1; - unsigned int SpareBits : 6; + unsigned char IsIdentified : 1; + unsigned char PlaceETCTab : 1; + unsigned char SpareBits : 6; } Flag; #endif } __attribute__((packed)); @@ -252,10 +252,10 @@ struct EQUIPITEM_INFO { #endif #if PACKETVER >= 20120925 struct { - unsigned int IsIdentified : 1; - unsigned int IsDamaged : 1; - unsigned int PlaceETCTab : 1; - unsigned int SpareBits : 5; + unsigned char IsIdentified : 1; + unsigned char IsDamaged : 1; + unsigned char PlaceETCTab : 1; + unsigned char SpareBits : 5; } Flag; #endif } __attribute__((packed)); diff --git a/src/map/pc.c b/src/map/pc.c index 0244c6c84..35d883b6f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -446,12 +446,66 @@ int pc_inventory_rental_clear(struct map_session_data *sd) /* 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: 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); diff --git a/src/map/pc.h b/src/map/pc.h index 14e1da5f4..fc37d0ef2 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -47,13 +47,13 @@ enum equip_index { EQI_COSTUME_MID, EQI_COSTUME_LOW, EQI_COSTUME_GARMENT, + EQI_AMMO, EQI_SHADOW_ARMOR, EQI_SHADOW_WEAPON, EQI_SHADOW_SHIELD, EQI_SHADOW_SHOES, EQI_SHADOW_ACC_R, EQI_SHADOW_ACC_L, - EQI_AMMO, EQI_MAX }; struct weapon_data { @@ -449,7 +449,6 @@ struct map_session_data { const char* debug_func; unsigned int bg_id; - unsigned short user_font; /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] diff --git a/src/map/script.c b/src/map/script.c index 2a83f3918..d51f27ce9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -16229,10 +16229,10 @@ BUILDIN(setfont) if( sd == NULL ) return true; - 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 true; |