summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/packet_db.txt8
-rw-r--r--src/map/atcommand.c6
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c193
-rw-r--r--src/map/clif.h6
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/mail.c2
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/npc.c2
-rw-r--r--src/map/pc.c20
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/pet.c6
-rw-r--r--src/map/script.c24
-rw-r--r--src/map/skill.c24
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/trade.c4
18 files changed, 207 insertions, 108 deletions
diff --git a/db/packet_db.txt b/db/packet_db.txt
index 1a3803b14..4476dc946 100644
--- a/db/packet_db.txt
+++ b/db/packet_db.txt
@@ -1431,12 +1431,12 @@ packet_ver: 25
0x07f6,14
//2009-11-03aRagexeRE
-//0x07f7,0
-//0x07f8,0
-//0x07f9,0
+0x07f7,-1
+0x07f8,-1
+0x07f9,-1
//2009-11-17aRagexeRE
-//0x07fa,-1
+0x07fa,8
//2009-11-24aRagexeRE
//0x07fb,25
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3f57beba6..6cb27551b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1719,7 +1719,7 @@ int atcommand_itemreset(const int fd, struct map_session_data* sd, const char* c
if(log_config.enable_logs&0x400)
log_pick_pc(sd, "A", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
}
}
clif_displaymessage(fd, msg_txt(20)); // All of your items have been removed.
@@ -2678,7 +2678,7 @@ int atcommand_refine(const int fd, struct map_session_data* sd, const char* comm
current_position = sd->status.inventory[i].equip;
pc_unequipitem(sd, i, 3);
clif_refine(fd, 0, i, sd->status.inventory[i].refine);
- clif_delitem(sd, i, 1);
+ clif_delitem(sd, i, 1, 3);
clif_additem(sd, i, 1, 0);
pc_equipitem(sd, i, current_position);
clif_misceffect(&sd->bl, 3);
@@ -8489,7 +8489,7 @@ int atcommand_delitem(const int fd, struct map_session_data* sd, const char* com
if(log_config.enable_logs&0x400)
log_pick_pc(sd, "A", sd->status.inventory[item_position].nameid, -1, &sd->status.inventory[item_position]);
- pc_delitem(sd, item_position, 1, 0);
+ pc_delitem(sd, item_position, 1, 0, 0);
count++;
item_position = pc_search_inventory(sd, item_id); // for next loop
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 12f16f83d..064ac3a7c 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -897,7 +897,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill, int lv)
}
if(sd->equip_index[EQI_AMMO]>=0) //Qty check should have been done in skill_check_condition
- pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0);
+ pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1);
sd->state.arrow_atk = 0;
}
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 505405424..15b9bd624 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -902,7 +902,7 @@ int chrif_divorceack(int char_id, int partner_id)
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- pc_delitem(sd, i, 1, 0);
+ pc_delitem(sd, i, 1, 0, 0);
}
if( (sd = map_charid2sd(partner_id)) != NULL && sd->status.partner_id == char_id )
@@ -910,7 +910,7 @@ int chrif_divorceack(int char_id, int partner_id)
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- pc_delitem(sd, i, 1, 0);
+ pc_delitem(sd, i, 1, 0, 0);
}
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 3f4b314df..088bda13a 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -161,6 +161,24 @@ uint16 clif_getport(void)
return map_port;
}
+#if PACKETVER >= 20071106
+static inline unsigned char clif_bl_type(struct block_list *bl) {
+ switch (bl->type) {
+ case BL_PC: return disguised(bl)?0x1:0x0; //PC_TYPE
+ case BL_ITEM: return 0x2; //ITEM_TYPE
+ case BL_SKILL: return 0x3; //SKILL_TYPE
+ case BL_CHAT: return 0x4; //UNKNOWN_TYPE
+ case BL_MOB: return 0x5; //NPC_MOB_TYPE
+ case BL_NPC: return 0x6; //NPC_EVT_TYPE
+ case BL_PET: return 0x7; //NPC_PET_TYPE
+ case BL_HOM: return 0x8; //NPC_HOM_TYPE
+ case BL_MER: return 0x9; //NPC_MERSOL_TYPE
+// case BL_ELEM: return 0xA; //NPC_ELEMENTAL_TYPE
+ default: return 0x1; //NPC_TYPE
+ }
+}
+#endif
+
/*==========================================
* clif_sendでAREA*指定時用
*------------------------------------------*/
@@ -751,36 +769,52 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
struct status_change* sc = status_get_sc(bl);
struct view_data* vd = status_get_viewdata(bl);
unsigned char *buf = WBUFP(buffer,0);
+#if PACKETVER < 20091103
bool type = !pcdb_checkid(vd->class_);
+#endif
#if PACKETVER >= 7
unsigned short offset = 0;
#endif
+#if PACKETVER >= 20091103
+ const char *name;
+#endif
sd = BL_CAST(BL_PC, bl);
+#if PACKETVER < 20091103
if(type)
WBUFW(buf,0) = spawn?0x7c:0x78;
else
+#endif
#if PACKETVER < 4
WBUFW(buf,0) = spawn?0x79:0x78;
#elif PACKETVER < 7
WBUFW(buf,0) = spawn?0x1d9:0x1d8;
-#else
+#elif PACKETVER < 20080102
WBUFW(buf,0) = spawn?0x22b:0x22a;
+#elif PACKETVER < 20091103
+ WBUFW(buf,0) = spawn?0x2ed:0x2ee;
+#else
+ WBUFW(buf,0) = spawn?0x7f8:0x7f9;
#endif
-#if PACKETVER >= 20071106
- if (type) {
- // shift payload 1 byte to the right for mob packets
- WBUFB(buf,2) = 0; // padding?
+#if PACKETVER >= 20091103
+ name = status_get_name(bl);
+ WBUFW(buf,2) = (spawn?62:63)+strlen(name);
+ WBUFB(buf,4) = clif_bl_type(bl);
+ offset+=3;
+ buf = WBUFP(buffer,offset);
+#elif PACKETVER >= 20071106
+ if (type) { //Non-player packets
+ WBUFB(buf,2) = clif_bl_type(bl);
offset++;
buf = WBUFP(buffer,offset);
}
#endif
-
WBUFL(buf, 2) = bl->id;
WBUFW(buf, 6) = status_get_speed(bl);
WBUFW(buf, 8) = (sc)? sc->opt1 : 0;
WBUFW(buf,10) = (sc)? sc->opt2 : 0;
+#if PACKETVER < 20091103
if (type&&spawn) { //uses an older and different packet structure
WBUFW(buf,12) = (sc)? sc->option : 0;
WBUFW(buf,14) = vd->hair_style;
@@ -789,14 +823,21 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf,20) = vd->class_; //Pet armor (ignored by client)
WBUFW(buf,22) = vd->shield;
} else {
-#if PACKETVER >= 7
+#endif
+#if PACKETVER >= 20091103
+ WBUFL(buf,12) = (sc)? sc->option : 0;
+ offset+=2;
+ buf = WBUFP(buffer,offset);
+#elif PACKETVER >= 7
if (!type) {
WBUFL(buf,12) = (sc)? sc->option : 0;
offset+=2;
- buf = WBUFP(buffer,offset); //Shift 2 bytes to the right for the rest of fields
+ buf = WBUFP(buffer,offset);
} else
-#endif
WBUFW(buf,12) = (sc)? sc->option : 0;
+#else
+ WBUFW(buf,12) = (sc)? sc->option : 0;
+#endif
WBUFW(buf,14) = vd->class_;
WBUFW(buf,16) = vd->hair_style;
WBUFW(buf,18) = vd->weapon;
@@ -807,7 +848,9 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf,20) = vd->shield;
WBUFW(buf,22) = vd->head_bottom;
#endif
+#if PACKETVER < 20091103
}
+#endif
WBUFW(buf,24) = vd->head_top;
WBUFW(buf,26) = vd->head_mid;
@@ -820,43 +863,57 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool
WBUFW(buf,28) = vd->hair_color;
WBUFW(buf,30) = vd->cloth_color;
WBUFW(buf,32) = (sd)? sd->head_dir : 0;
+#if PACKETVER < 20091103
if (type&&spawn) { //End of packet 0x7c
WBUFB(buf,34) = (sd)?sd->status.karma:0; // karma
WBUFB(buf,35) = vd->sex;
WBUFPOS(buf,36,bl->x,bl->y,unit_getdir(bl));
WBUFB(buf,39) = 0;
-#if PACKETVER >= 20071106
WBUFB(buf,40) = 0;
-#endif
-#if PACKETVER > 20081217
- WBUFB(buf,41) = 0;
- WBUFB(buf,42) = 0;
-#endif
return packet_len(0x7c);
}
+#endif
WBUFL(buf,34) = status_get_guild_id(bl);
WBUFW(buf,38) = status_get_emblem_id(bl);
WBUFW(buf,40) = (sd)? sd->status.manner : 0;
-#if PACKETVER >= 7
+#if PACKETVER >= 20091103
+ WBUFL(buf,42) = (sc)? sc->opt3 : 0;
+ offset+=2;
+ buf = WBUFP(buffer,offset);
+#elif PACKETVER >= 7
if (!type) {
WBUFL(buf,42) = (sc)? sc->opt3 : 0;
offset+=2;
- buf = WBUFP(buffer,offset); //Shift additional 2 bytes...
+ buf = WBUFP(buffer,offset);
} else
-#endif
WBUFW(buf,42) = (sc)? sc->opt3 : 0;
+#else
+ WBUFW(buf,42) = (sc)? sc->opt3 : 0;
+#endif
WBUFB(buf,44) = (sd)? sd->status.karma : 0;
WBUFB(buf,45) = vd->sex;
WBUFPOS(buf,46,bl->x,bl->y,unit_getdir(bl));
WBUFB(buf,49) = (sd)? 5 : 0;
WBUFB(buf,50) = (sd)? 5 : 0;
- if (spawn) {
- WBUFW(buf,51) = clif_setlevel(status_get_lv(bl));
- } else {
+ if (!spawn) {
WBUFB(buf,51) = vd->dead_sit;
- WBUFW(buf,52) = clif_setlevel(status_get_lv(bl));
+ offset++;
+ buf = WBUFP(buffer,offset);
}
+ WBUFW(buf,51) = clif_setlevel(status_get_lv(bl));
+#if PACKETVER < 20091103
+ if (type) //End for non-player packet
+ return packet_len(WBUFW(buffer,0));
+#endif
+#if PACKETVER >= 20080102
+ WBUFW(buf,53) = sd?sd->state.user_font:0;
+#endif
+#if PACKETVER >= 20091103
+ strcpy((char*)WBUFP(buf,55), name);
+ return WBUFW(buffer,2);
+#else
return packet_len(WBUFW(buffer,0));
+#endif
}
/*==========================================
@@ -871,6 +928,9 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
#if PACKETVER >= 7
unsigned short offset = 0;
#endif
+#if PACKETVER >= 20091103
+ const char *name;
+#endif
sd = BL_CAST(BL_PC, bl);
@@ -878,14 +938,24 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
WBUFW(buf, 0) = 0x7b;
#elif PACKETVER < 7
WBUFW(buf, 0) = 0x1da;
-#else
+#elif PACKETVER < 20080102
WBUFW(buf, 0) = 0x22c;
+#elif PACKETVER < 20091103
+ WBUFW(buf, 0) = 0x2ec;
+#else
+ WBUFW(buf, 0) = 0x7f7;
#endif
+#if PACKETVER >= 20091103
+ name = status_get_name(bl);
+ WBUFW(buf, 2) = 69+strlen(name);
+ offset+=2;
+ buf = WBUFP(buffer,offset);
+#endif
#if PACKETVER >= 20071106
- WBUFB(buf, 2) = 0; // padding?
+ WBUFB(buf, 2) = clif_bl_type(bl);
offset++;
- buf = WBUFP(buf,offset);
+ buf = WBUFP(buffer,offset);
#endif
WBUFL(buf, 2) = bl->id;
WBUFW(buf, 6) = status_get_speed(bl);
@@ -931,8 +1001,15 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un
WBUFB(buf,56) = (sd)? 5 : 0;
WBUFB(buf,57) = (sd)? 5 : 0;
WBUFW(buf,58) = clif_setlevel(status_get_lv(bl));
-
+#if PACKETVER >= 20080102
+ WBUFW(buf,60) = sd?sd->state.user_font:0;
+#endif
+#if PACKETVER >= 20091103
+ strcpy((char*)WBUFP(buf,62), name);
+ return WBUFW(buffer,2);
+#else
return packet_len(WBUFW(buffer,0));
+#endif
}
//Modifies the buffer for disguise characters and sends it to self.
@@ -1069,8 +1146,6 @@ int clif_spawn(struct block_list *bl)
clif_specialeffect(bl,423,AREA);
else if(sd->state.size==1)
clif_specialeffect(bl,421,AREA);
- if( sd->state.user_font )
- clif_font_area(sd);
if( sd->state.bg_id && map[sd->bl.m].flag.battleground )
clif_sendbgemblem_area(sd);
}
@@ -1867,7 +1942,7 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail)
/*==========================================
*
*------------------------------------------*/
-int clif_delitem(struct map_session_data *sd,int n,int amount)
+int clif_dropitem(struct map_session_data *sd,int n,int amount)
{
int fd;
@@ -1883,6 +1958,43 @@ int clif_delitem(struct map_session_data *sd,int n,int amount)
return 0;
}
+/*==========================================
+ * Deletes an item from your inventory.
+ * Reason values:
+ * 0 - Normal
+ * 1 - Item used for a skill
+ * 2 - Refine failed
+ * 3 - Material changed
+ * 4 - Moved to storage
+ * 5 - Moved to cart
+ * 6 - Item sold
+ * 7 - Item dropped
+ *------------------------------------------*/
+int clif_delitem(struct map_session_data *sd,int n,int amount, short reason)
+{
+#if PACKETVER < 20091117
+ return clif_dropitem(sd,n,amount);
+#else
+ int fd;
+
+ nullpo_retr(0, sd);
+
+ if (reason == 7)
+ return clif_dropitem(sd,n,amount);
+
+ fd=sd->fd;
+
+ WFIFOHEAD(fd, packet_len(0x7fa));
+ WFIFOW(fd,0)=0x7fa;
+ WFIFOW(fd,2)=reason;
+ WFIFOW(fd,4)=n+2;
+ WFIFOW(fd,6)=amount;
+ WFIFOSET(fd,packet_len(0x7fa));
+
+ return 0;
+#endif
+}
+
// Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex]
// Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet
// armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point.
@@ -3702,8 +3814,6 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl)
clif_specialeffect_single(bl,423,sd->fd);
else if(tsd->state.size==1)
clif_specialeffect_single(bl,421,sd->fd);
- if( tsd->state.user_font )
- clif_font_single(sd->fd,tsd);
if( tsd->state.bg_id && map[tsd->bl.m].flag.battleground )
clif_sendbgemblem_single(sd->fd,tsd);
}
@@ -9352,7 +9462,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
} while (0);
//Because the client does not like being ignored.
- clif_delitem(sd, item_index,0);
+ clif_dropitem(sd, item_index,0);
}
/*==========================================
@@ -12112,7 +12222,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
return;
clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1);
- pc_delitem(sd, item_position, 1, 0);
+ pc_delitem(sd, item_position, 1, 0, 1);
}
/// /check <string>
@@ -12770,7 +12880,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
clif_Auction_message(fd, 4); // No Char Server? lets say something to the client
else
{
- pc_delitem(sd, sd->auction.index, sd->auction.amount, 1);
+ pc_delitem(sd, sd->auction.index, sd->auction.amount, 1, 6);
sd->auction.amount = 0;
pc_payzeny(sd, auction.hours * battle_config.auction_feeperhour);
}
@@ -13547,7 +13657,7 @@ int clif_sendbgemblem_single(int fd, struct map_session_data *sd)
* Custom Fonts
* S 0x2ef <account_id>.l <font id>.w
*------------------------------------------*/
-int clif_font_area(struct map_session_data *sd)
+int clif_font(struct map_session_data *sd)
{
unsigned char buf[8];
nullpo_retr(0,sd);
@@ -13558,17 +13668,6 @@ int clif_font_area(struct map_session_data *sd)
return 1;
}
-int clif_font_single(int fd, struct map_session_data *sd)
-{
- nullpo_retr(0,sd);
- WFIFOHEAD(fd,packet_len(0x2ef));
- WFIFOW(fd,0) = 0x2ef;
- WFIFOL(fd,2) = sd->bl.id;
- WFIFOW(fd,6) = sd->state.user_font;
- WFIFOSET(fd,packet_len(0x2ef));
- return 1;
-}
-
/*==========================================
* Instancing Window
*------------------------------------------*/
@@ -14108,7 +14207,7 @@ static int packetdb_readdb(void)
6, 2, -1, 4, 4, 4, 4, 8, 8,268, 6, 8, 6, 54, 30, 54,
#endif
0, 0, 0, 0, 0, 8, 8, 32, -1, 5, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 14, 93, 86, 87, 0, 0, 0, 0, 26, 0,
+ 0, 0, 0, 0, 0, 0, 14, -1, -1, -1, 8, 0, 0, 0, 26, 0,
//#0x0800
-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 20,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/src/map/clif.h b/src/map/clif.h
index 090ed71a2..68f36dc59 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -114,7 +114,8 @@ int clif_scriptinputstr(struct map_session_data *sd,int npcid); // self
int clif_cutin(struct map_session_data* sd, const char* image, int type); //self
int clif_viewpoint(struct map_session_data*,int,int,int,int,int,int); //self
int clif_additem(struct map_session_data *sd, int n, int amount, int fail); // self
-int clif_delitem(struct map_session_data*,int,int); //self
+int clif_dropitem(struct map_session_data*,int,int); //self
+int clif_delitem(struct map_session_data*,int,int,short); //self
int clif_updatestatus(struct map_session_data*,int); //self
int clif_changestatus(struct block_list*,int,int); //area
int clif_damage(struct block_list* src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2); // area
@@ -333,8 +334,7 @@ void clif_instance_join(int fd, int instance_id);
void clif_instance_leave(int fd);
// Custom Fonts
-int clif_font_area(struct map_session_data *sd);
-int clif_font_single(int fd, struct map_session_data *sd);
+int clif_font(struct map_session_data *sd);
// atcommand
int clif_displaymessage(const int fd,const char* mes);
diff --git a/src/map/guild.c b/src/map/guild.c
index 937a90ea9..dbb59c334 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -440,7 +440,7 @@ int guild_created(int account_id,int guild_id)
sd->status.guild_id=guild_id;
clif_guild_created(sd,0);
if(battle_config.guild_emperium_check)
- pc_delitem(sd,pc_search_inventory(sd,714),1,0); // エンペリウム消耗
+ pc_delitem(sd,pc_search_inventory(sd,714),1,0,0); // エンペリウム消耗
return 0;
}
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 6acd969fa..b74fe2a13 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -444,7 +444,7 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd)
clif_hom_food(sd,foodID,0);
return 1;
}
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,0);
if ( hd->homunculus.hunger >= 91 ) {
merc_hom_decrease_intimacy(hd, 50);
diff --git a/src/map/mail.c b/src/map/mail.c
index d2dce6f17..afef81fe6 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -38,7 +38,7 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if(log_config.enable_logs&0x2000)
log_pick_pc(sd, "E", sd->mail.nameid, -sd->mail.amount, &sd->status.inventory[sd->mail.index]);
- pc_delitem(sd, sd->mail.index, sd->mail.amount, 1);
+ pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0);
}
else
clif_additem(sd, sd->mail.index, sd->mail.amount, 0);
diff --git a/src/map/map.c b/src/map/map.c
index 909566243..790c1515a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2668,9 +2668,9 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
}
/*==========================================
- * [Shinryo]: Init and free the mapcache
+ * [Shinryo]: Init the mapcache
*------------------------------------------*/
-char *map_init_mapcache(FILE *fp)
+static char *map_init_mapcache(FILE *fp)
{
size_t size = 0, read_size;
char *buffer;
diff --git a/src/map/npc.c b/src/map/npc.c
index fe3318c9b..8db2036a2 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1406,7 +1406,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
pc_setreg(sd,add_str("@sold_nameid")+(i<<24),(int)sd->status.inventory[idx].nameid);
pc_setreg(sd,add_str("@sold_quantity")+(i<<24),qty);
}
- pc_delitem(sd,idx,qty,0);
+ pc_delitem(sd,idx,qty,0,6);
}
if (z > MAX_ZENY) z = MAX_ZENY;
diff --git a/src/map/pc.c b/src/map/pc.c
index 70a433c0e..f31442d28 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -339,7 +339,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
if( sd->status.inventory[i].expire_time <= time(NULL) )
{
clif_rental_expired(sd->fd, sd->status.inventory[i].nameid);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
}
else
{
@@ -3124,7 +3124,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
// remember the card id to insert
nameid = sd->status.inventory[idx_card].nameid;
- if( pc_delitem(sd,idx_card,1,1) == 1 )
+ if( pc_delitem(sd,idx_card,1,1,0) == 1 )
{// failed
clif_insert_card(sd,idx_equip,idx_card,1);
}
@@ -3378,7 +3378,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
/*==========================================
* アイテムを減らす
*------------------------------------------*/
-int pc_delitem(struct map_session_data *sd,int n,int amount,int type)
+int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason)
{
nullpo_retr(1, sd);
@@ -3394,7 +3394,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type)
sd->inventory_data[n] = NULL;
}
if(!(type&1))
- clif_delitem(sd,n,amount);
+ clif_delitem(sd,n,amount,reason);
if(!(type&2))
clif_updatestatus(sd,SP_WEIGHT);
@@ -3442,7 +3442,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
return 0;
- pc_delitem(sd, n, amount, 0);
+ pc_delitem(sd, n, amount, 0, 7);
return 1;
}
@@ -3705,7 +3705,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( log_config.enable_logs&0x100 )
log_pick_pc(sd, "C", sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
- pc_delitem(sd,n,1,1); // Rental Usable Items are not deleted until expiration
+ pc_delitem(sd,n,1,1,0); // Rental Usable Items are not deleted until expiration
}
else
clif_useitemack(sd,n,0,0);
@@ -3826,7 +3826,7 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount)
return 1;
if( pc_cart_additem(sd,item_data,amount) == 0 )
- return pc_delitem(sd,idx,amount,0);
+ return pc_delitem(sd,idx,amount,0,5);
return 1;
}
@@ -7230,7 +7230,7 @@ int pc_checkitem(struct map_session_data *sd)
if( battle_config.item_check && !itemdb_available(id) )
{
ShowWarning("illegal item id %d in %d[%s] inventory.\n",id,sd->bl.id,sd->status.name);
- pc_delitem(sd,i,sd->status.inventory[i].amount,3);
+ pc_delitem(sd,i,sd->status.inventory[i].amount,3,0);
continue;
}
if( i > j )
@@ -7409,9 +7409,9 @@ int pc_divorce(struct map_session_data *sd)
for( i = 0; i < MAX_INVENTORY; i++ )
{
if( sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F )
- pc_delitem(sd, i, 1, 0);
+ pc_delitem(sd, i, 1, 0, 0);
if( p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F )
- pc_delitem(p_sd, i, 1, 0);
+ pc_delitem(p_sd, i, 1, 0, 0);
}
clif_divorced(sd, p_sd->status.name);
diff --git a/src/map/pc.h b/src/map/pc.h
index 1328e9367..9c8b524af 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -571,7 +571,7 @@ int pc_search_inventory(struct map_session_data *sd,int item_id);
int pc_payzeny(struct map_session_data*,int);
int pc_additem(struct map_session_data*,struct item*,int);
int pc_getzeny(struct map_session_data*,int);
-int pc_delitem(struct map_session_data*,int,int,int);
+int pc_delitem(struct map_session_data*,int,int,int,short);
// Special Shop System
void pc_paycash(struct map_session_data *sd, int price, int points);
diff --git a/src/map/pet.c b/src/map/pet.c
index 3e7e55e3c..76f990455 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -445,7 +445,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
return 1;
}
if (!pet_birth_process(sd,p)) //Pet hatched. Delete egg.
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,0);
} else {
pet_data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
@@ -659,7 +659,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
return 1;
}
- pc_delitem(sd,index,1,0);
+ pc_delitem(sd,index,1,0,0);
pd->pet.equip = nameid;
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
clif_pet_equip_area(pd);
@@ -734,7 +734,7 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
clif_pet_food(sd,k,0);
return 1;
}
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,0);
if( pd->pet.hungry > 90 )
pet_set_intimate(pd, pd->pet.intimate - pd->petDB->r_full);
diff --git a/src/map/script.c b/src/map/script.c
index 3430db937..bf81b984f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5677,7 +5677,7 @@ BUILDIN_FUNC(delitem)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
- pc_delitem(sd,i,amount,0);
+ pc_delitem(sd,i,amount,0,0);
return 0; //we deleted exact amount of items. now exit
} else {
amount-=sd->status.inventory[i].amount;
@@ -5688,7 +5688,7 @@ BUILDIN_FUNC(delitem)
}
//Logs
- pc_delitem(sd,i,sd->status.inventory[i].amount,0);
+ pc_delitem(sd,i,sd->status.inventory[i].amount,0,0);
}
}
//2nd pass
@@ -5706,7 +5706,7 @@ BUILDIN_FUNC(delitem)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
- pc_delitem(sd,i,amount,0);
+ pc_delitem(sd,i,amount,0,0);
return 0; //we deleted exact amount of items. now exit
} else {
amount-=sd->status.inventory[i].amount;
@@ -5715,7 +5715,7 @@ BUILDIN_FUNC(delitem)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
- pc_delitem(sd,i,sd->status.inventory[i].amount,0);
+ pc_delitem(sd,i,sd->status.inventory[i].amount,0,0);
}
}
@@ -5804,7 +5804,7 @@ BUILDIN_FUNC(delitem2)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -amount, &sd->status.inventory[i]);
- pc_delitem(sd,i,amount,0);
+ pc_delitem(sd,i,amount,0,0);
return 0; //we deleted exact amount of items. now exit
} else {
amount-=sd->status.inventory[i].amount;
@@ -5813,7 +5813,7 @@ BUILDIN_FUNC(delitem2)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
- pc_delitem(sd,i,sd->status.inventory[i].amount,0);
+ pc_delitem(sd,i,sd->status.inventory[i].amount,0,0);
}
}
@@ -6471,7 +6471,7 @@ BUILDIN_FUNC(successrefitem)
pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
clif_refine(sd->fd,0,i,sd->status.inventory[i].refine);
- clif_delitem(sd,i,1);
+ clif_delitem(sd,i,1,3);
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
@@ -6526,7 +6526,7 @@ BUILDIN_FUNC(failedrefitem)
// 精錬失敗エフェクトのパケット
clif_refine(sd->fd,1,i,sd->status.inventory[i].refine);
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,2);
// 他の人にも失敗を通知
clif_misceffect(&sd->bl,2);
}
@@ -9798,7 +9798,7 @@ BUILDIN_FUNC(successremovecards)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,3);
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
@@ -9872,7 +9872,7 @@ BUILDIN_FUNC(failedremovecards)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,2);
}
if(typefail == 1){ // カードのみ損失(武具を返す)
int flag;
@@ -9889,7 +9889,7 @@ BUILDIN_FUNC(failedremovecards)
item_tmp.card[j]=0;
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- pc_delitem(sd,i,1,0);
+ pc_delitem(sd,i,1,0,2);
//Logs items, got from (N)PC scripts [Lupus]
if(log_config.enable_logs&0x40)
@@ -10566,7 +10566,7 @@ BUILDIN_FUNC(clearitem)
if(log_config.enable_logs&0x40)
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
}
}
return 0;
diff --git a/src/map/skill.c b/src/map/skill.c
index e214a7f55..476008bf9 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1681,7 +1681,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
//This should account for ground spells (and single target spells will be completed on castend_id) [Skotlex]
type = pc_search_inventory (tsd, 7321);
if (type >= 0)
- pc_delitem(tsd, type, 1, 0);
+ pc_delitem(tsd, type, 1, 0, 1);
if (type >= 0) {
dmg.damage = dmg.damage2 = 0;
@@ -2273,7 +2273,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, int skill, int
// Consume items
for( i = 0; i < ARRAYLENGTH(itemid); i++ )
{
- if( index[i] >= 0 ) pc_delitem(sd, index[i], amount[i], 0);
+ if( index[i] >= 0 ) pc_delitem(sd, index[i], amount[i], 0, 1);
}
if( type&2 )
@@ -8237,7 +8237,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh
if( skill == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rand()%100 > sc->data[SC_EARTHSCROLL]->val2 ) // [marquis007]
; //Do not consume item.
else if( sd->status.inventory[i].expire_time == 0 )
- pc_delitem(sd,i,1,0); // Rental usable items are not consumed until expiration
+ pc_delitem(sd,i,1,0,0); // Rental usable items are not consumed until expiration
}
return 1;
}
@@ -8826,7 +8826,7 @@ int skill_consume_requirement( struct map_session_data *sd, short skill, short l
continue; //Gemstones are checked, but not substracted from inventory.
if( (n = pc_search_inventory(sd,req.itemid[i])) >= 0 )
- pc_delitem(sd,n,req.amount[i],0);
+ pc_delitem(sd,n,req.amount[i],0,1);
}
}
@@ -9337,7 +9337,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx)
clif_skill_nodamage(&sd->bl,&target_sd->bl,sd->menuskill_id,1,1);
item->attribute=0;
clif_equiplist(target_sd);
- pc_delitem(sd,pc_search_inventory(sd,material),1,0);
+ pc_delitem(sd,pc_search_inventory(sd,material),1,0,0);
clif_item_repaireffect(sd,item->nameid,0);
if(sd!=target_sd)
clif_item_repaireffect(target_sd,item->nameid,0);
@@ -9391,7 +9391,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
per = percentrefinery [ditem->wlv][(int)item->refine];
per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]
- pc_delitem(sd, i, 1, 0);
+ pc_delitem(sd, i, 1, 0, 0);
if (per > rand() % 100) {
item->refine++;
if(item->equip) {
@@ -9399,7 +9399,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
pc_unequipitem(sd,idx,3);
}
clif_refine(sd->fd,0,idx,item->refine);
- clif_delitem(sd,idx,1);
+ clif_delitem(sd,idx,1,3);
clif_additem(sd,idx,1,0);
if (ep)
pc_equipitem(sd,idx,ep);
@@ -9425,7 +9425,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if(item->equip)
pc_unequipitem(sd,idx,3);
clif_refine(sd->fd,1,idx,item->refine);
- pc_delitem(sd,idx,1,0);
+ pc_delitem(sd,idx,1,0,2);
clif_misceffect(&sd->bl,2);
clif_emotion(&sd->bl, 23);
}
@@ -10833,12 +10833,12 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
if(j < 0)
continue;
if(slot[i]==1000){ /* Star Crumb */
- pc_delitem(sd,j,1,1);
+ pc_delitem(sd,j,1,1,0);
sc++;
}
if(slot[i]>=994 && slot[i]<=997 && ele==0){ /* Flame Heart . . . Great Nature */
static const int ele_table[4]={3,1,4,2};
- pc_delitem(sd,j,1,1);
+ pc_delitem(sd,j,1,1,0);
ele=ele_table[slot[i]-994];
}
}
@@ -10856,7 +10856,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
if(j >= 0){
y = sd->status.inventory[j].amount;
if(y>x)y=x;
- pc_delitem(sd,j,y,0);
+ pc_delitem(sd,j,y,0,0);
} else
ShowError("skill_produce_mix: material item error\n");
@@ -11165,7 +11165,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
if(index < 0 || (j = pc_search_inventory(sd,nameid)) < 0)
return 1;
- pc_delitem(sd,j,1,0);
+ pc_delitem(sd,j,1,0,0);
for(i=0;i<MAX_ARROW_RESOURCE;i++) {
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.identify = 1;
diff --git a/src/map/storage.c b/src/map/storage.c
index 305d90d69..1c06dfb70 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -222,7 +222,7 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount)
return 0;
if( storage_additem(sd,&sd->status.inventory[index],amount) == 0 )
- pc_delitem(sd,index,amount,0);
+ pc_delitem(sd,index,amount,0,4);
return 1;
}
@@ -477,7 +477,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
// log_tostorage(sd, index, 1);
if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
- pc_delitem(sd,index,amount,0);
+ pc_delitem(sd,index,amount,0,4);
return 1;
}
diff --git a/src/map/trade.c b/src/map/trade.c
index f7f986ac7..392acb33f 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -554,7 +554,7 @@ void trade_tradecommit(struct map_session_data *sd)
log_pick_pc(sd, "T", sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
log_pick_pc(tsd, "T", sd->status.inventory[n].nameid, sd->deal.item[trade_i].amount, &sd->status.inventory[n]);
}
- pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1);
+ pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6);
} else
clif_additem(sd, n, sd->deal.item[trade_i].amount, 0);
sd->deal.item[trade_i].index = 0;
@@ -573,7 +573,7 @@ void trade_tradecommit(struct map_session_data *sd)
log_pick_pc(tsd, "T", tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
log_pick_pc(sd, "T", tsd->status.inventory[n].nameid, tsd->deal.item[trade_i].amount, &tsd->status.inventory[n]);
}
- pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1);
+ pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6);
} else
clif_additem(tsd, n, tsd->deal.item[trade_i].amount, 0);
tsd->deal.item[trade_i].index = 0;