Skip to content
Permalink
Browse files
Cleaned up the Font System to properly save to the character.
Also expanded @itemlist to support costume item types.
  • Loading branch information
aleos89 committed May 23, 2014
1 parent 704f4f2 commit 6afcdeb613583c6f6d84ea35e99d206aadf68d71
Showing with 279 additions and 173 deletions.
  1. +34 −16 conf/msg_conf/map_msg.conf
  2. +28 −0 src/common/mmo.h
  3. +82 −77 src/map/atcommand.c
  4. +4 −1 src/map/chrif.c
  5. +4 −4 src/map/clif.c
  6. +2 −1 src/map/itemdb.c
  7. +9 −0 src/map/itemdb.h
  8. +103 −39 src/map/pc.c
  9. +5 −28 src/map/pc.h
  10. +8 −7 src/map/script.c
@@ -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);

0 comments on commit 6afcdeb

Please sign in to comment.