summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-11 17:35:28 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-11 17:35:28 +0000
commite782bd5f2f7cd73634dfd8616a351a1b97c2109c (patch)
tree319366658d419bed37df23fc67b1c80957a141f4 /src/map
parente18603bb1985d5628f1213999e92eaed8d008eb1 (diff)
downloadhercules-e782bd5f2f7cd73634dfd8616a351a1b97c2109c.tar.gz
hercules-e782bd5f2f7cd73634dfd8616a351a1b97c2109c.tar.bz2
hercules-e782bd5f2f7cd73634dfd8616a351a1b97c2109c.tar.xz
hercules-e782bd5f2f7cd73634dfd8616a351a1b97c2109c.zip
Picklog improvements:
- now it is finally possible to log every item players gain or lose - added 3 log types: `I` for auctioned items, `B` for buying shop transactions and `X` for all other items transactions that don't fall into another category (for detailed explanation on all log types read `conf/log_athena.conf`) - it also fixes items being logged as picked up/gained by player when in fact they were dropped on the ground due to full inventory git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15420 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c32
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/buyingstore.c6
-rw-r--r--src/map/chrif.c4
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/homunculus.c3
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/log.c7
-rw-r--r--src/map/log.h36
-rw-r--r--src/map/mail.c23
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/npc.c20
-rw-r--r--src/map/party.c9
-rw-r--r--src/map/pc.c53
-rw-r--r--src/map/pc.h9
-rw-r--r--src/map/pet.c17
-rw-r--r--src/map/script.c77
-rw-r--r--src/map/skill.c40
-rw-r--r--src/map/storage.c25
-rw-r--r--src/map/trade.c20
-rw-r--r--src/map/vending.c8
22 files changed, 146 insertions, 257 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3ac0fe572..40d1590b1 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1722,14 +1722,11 @@ ACMD_FUNC(item)
item_tmp.nameid = item_id;
item_tmp.identify = 1;
- if ((flag = pc_additem(sd, &item_tmp, get_count)))
+ if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif_additem(sd, 0, 0, flag);
}
}
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, item_id, number, NULL);
-
clif_displaymessage(fd, msg_txt(18)); // Item created.
return 0;
}
@@ -1797,13 +1794,10 @@ ACMD_FUNC(item2)
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
- if ((flag = pc_additem(sd, &item_tmp, get_count)))
+ if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif_additem(sd, 0, 0, flag);
}
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, item_tmp.nameid, number, &item_tmp);
-
clif_displaymessage(fd, msg_txt(18)); // Item created.
} else {
clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name.
@@ -1823,11 +1817,7 @@ ACMD_FUNC(itemreset)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
-
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
-
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
}
}
clif_displaymessage(fd, msg_txt(20)); // All of your items have been removed.
@@ -2887,10 +2877,7 @@ ACMD_FUNC(produce)
clif_produceeffect(sd, 0, item_id);
clif_misceffect(&sd->bl, 3);
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, tmp_item.nameid, 1, &tmp_item);
-
- if ((flag = pc_additem(sd, &tmp_item, 1)))
+ if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif_additem(sd, 0, 0, flag);
} else {
sprintf(atcmd_output, msg_txt(169), item_id, item_data->name); // The item (%d: '%s') is not equipable.
@@ -5970,10 +5957,7 @@ void getring (struct map_session_data* sd)
item_tmp.card[2] = sd->status.partner_id;
item_tmp.card[3] = sd->status.partner_id >> 16;
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, item_id, 1, &item_tmp);
-
- if((flag = pc_additem(sd,&item_tmp,1))) {
+ if((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -8747,11 +8731,7 @@ ACMD_FUNC(delitem)
{// delete pet
intif_delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
}
-
- //Logs (A)dmins items [Lupus]
- log_pick_pc(sd, LOG_TYPE_COMMAND, nameid, -delamount, &sd->status.inventory[idx]);
-
- pc_delitem(sd, idx, delamount, 0, 0);
+ pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
amount-= delamount;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index c31058047..46e930ebf 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1005,7 +1005,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,1);
+ pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
sd->state.arrow_atk = 0;
}
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index eddfa0127..01964a56e 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -367,13 +367,11 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
zeny = amount*pl_sd->buyingstore.items[listidx].price;
// log
- log_pick_pc(sd, LOG_TYPE_BUYING_STORE, nameid, -((int)amount), &sd->status.inventory[index]);
- log_pick_pc(pl_sd, LOG_TYPE_BUYING_STORE, nameid, amount, &sd->status.inventory[index]);
log_zeny(sd, LOG_TYPE_BUYING_STORE, pl_sd, zeny);
// move item
- pc_additem(pl_sd, &sd->status.inventory[index], amount);
- pc_delitem(sd, index, amount, 1, 0);
+ pc_additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
+ pc_delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
pl_sd->buyingstore.items[listidx].amount-= amount;
// pay up
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 3ec26f4e5..36a76892c 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -937,7 +937,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, 0);
+ pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
if( (sd = map_charid2sd(partner_id)) != NULL && sd->status.partner_id == char_id )
@@ -945,7 +945,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, 0);
+ pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index fe5d559d5..37ad4ae72 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12783,7 +12783,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, 1);
+ pc_delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);
}
@@ -13532,7 +13532,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, 6);
+ pc_delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION);
sd->auction.amount = 0;
pc_payzeny(sd, auction.hours * battle_config.auction_feeperhour);
}
diff --git a/src/map/guild.c b/src/map/guild.c
index ec15d8cfb..28d4c7062 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -399,7 +399,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,0); // エンペリウム消耗
+ pc_delitem(sd,pc_search_inventory(sd,714),1,0,0,LOG_TYPE_CONSUME); // エンペリウム消耗
return 0;
}
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index c6546ce92..d46c55a52 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -445,8 +445,7 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd)
clif_hom_food(sd,foodID,0);
return 1;
}
- log_pick_pc(sd, LOG_TYPE_CONSUME, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
- pc_delitem(sd,i,1,0,0);
+ pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if ( hd->homunculus.hunger >= 91 ) {
merc_hom_decrease_intimacy(hd, 50);
diff --git a/src/map/intif.c b/src/map/intif.c
index 77d4a4b87..20623a146 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1772,7 +1772,7 @@ static void intif_parse_Auction_register(int fd)
else
{
clif_Auction_message(sd->fd, 4);
- pc_additem(sd, &auction.item, auction.item.amount);
+ pc_additem(sd, &auction.item, auction.item.amount, LOG_TYPE_AUCTION);
pc_getzeny(sd, auction.hours * battle_config.auction_feeperhour);
}
}
diff --git a/src/map/log.c b/src/map/log.c
index 4325d50fe..4da060fe1 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -64,20 +64,21 @@ static char log_picktype2char(e_log_pick_type type)
case LOG_TYPE_SCRIPT: return 'N'; // (N)PC Script
//case LOG_TYPE_STEAL: return 'D'; // Steal/Snatcher
case LOG_TYPE_CONSUME: return 'C'; // (C)onsumed
- //case LOG_TYPE_PRODUCE: return 'O'; // Pr(O)duced/Ingredients
+ case LOG_TYPE_PRODUCE: return 'O'; // Pr(O)duced/Ingredients
//case LOG_TYPE_MVP: return 'U'; // MVP Rewards
case LOG_TYPE_COMMAND: return 'A'; // (A)dmin command
case LOG_TYPE_STORAGE: return 'R'; // Sto(R)age
case LOG_TYPE_GSTORAGE: return 'G'; // (G)uild storage
case LOG_TYPE_MAIL: return 'E'; // (E)mail attachment
- //case LOG_TYPE_AUCTION: return 'I'; // Auct(I)on
+ case LOG_TYPE_AUCTION: return 'I'; // Auct(I)on
case LOG_TYPE_BUYING_STORE: return 'B'; // (B)uying Store
case LOG_TYPE_LOOT: return 'L'; // (L)oot (consumed monster pick/drop)
+ case LOG_TYPE_OTHER: return 'X'; // Other
}
// should not get here, fallback
ShowDebug("log_picktype2char: Unknown pick type %d.\n", type);
- return 'S';
+ return 'X';
}
diff --git a/src/map/log.h b/src/map/log.h
index e49fff429..114e71177 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -26,26 +26,28 @@ e_log_chat_type;
typedef enum e_log_pick_type
{
- LOG_TYPE_TRADE = 0x0001,
- LOG_TYPE_VENDING = 0x0002,
- LOG_TYPE_PICKDROP_PLAYER = 0x0004,
- LOG_TYPE_PICKDROP_MONSTER = 0x0008,
- LOG_TYPE_NPC = 0x0010,
- LOG_TYPE_SCRIPT = 0x0020,
- //LOG_TYPE_STEAL = 0x0040,
- LOG_TYPE_CONSUME = 0x0080,
- //LOG_TYPE_PRODUCE = 0x0100,
- //LOG_TYPE_MVP = 0x0200,
- LOG_TYPE_COMMAND = 0x0400,
- LOG_TYPE_STORAGE = 0x0800,
- LOG_TYPE_GSTORAGE = 0x1000,
- LOG_TYPE_MAIL = 0x2000,
- //LOG_TYPE_AUCTION = 0x4000,
- LOG_TYPE_BUYING_STORE = 0x8000,
+ LOG_TYPE_NONE = 0,
+ LOG_TYPE_TRADE = 0x00001,
+ LOG_TYPE_VENDING = 0x00002,
+ LOG_TYPE_PICKDROP_PLAYER = 0x00004,
+ LOG_TYPE_PICKDROP_MONSTER = 0x00008,
+ LOG_TYPE_NPC = 0x00010,
+ LOG_TYPE_SCRIPT = 0x00020,
+ //LOG_TYPE_STEAL = 0x00040,
+ LOG_TYPE_CONSUME = 0x00080,
+ LOG_TYPE_PRODUCE = 0x00100,
+ //LOG_TYPE_MVP = 0x00200,
+ LOG_TYPE_COMMAND = 0x00400,
+ LOG_TYPE_STORAGE = 0x00800,
+ LOG_TYPE_GSTORAGE = 0x01000,
+ LOG_TYPE_MAIL = 0x02000,
+ LOG_TYPE_AUCTION = 0x04000,
+ LOG_TYPE_BUYING_STORE = 0x08000,
+ LOG_TYPE_OTHER = 0x10000,
// combinations
LOG_TYPE_LOOT = LOG_TYPE_PICKDROP_MONSTER|LOG_TYPE_CONSUME,
// all
- LOG_TYPE_ALL = 0xFFFF,
+ LOG_TYPE_ALL = 0xFFFFF,
}
e_log_pick_type;
diff --git a/src/map/mail.c b/src/map/mail.c
index f8adb5f0e..d410faf28 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -33,12 +33,8 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if( sd->mail.amount )
{
- if (flag)
- { // Item send
- log_pick_pc(sd, LOG_TYPE_MAIL, sd->mail.nameid, -sd->mail.amount, &sd->status.inventory[sd->mail.index]);
-
- pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0);
- }
+ if (flag) // Item send
+ pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
else
clif_additem(sd, sd->mail.index, sd->mail.amount, 0);
}
@@ -141,15 +137,12 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item
{
if( item->nameid > 0 && item->amount > 0 )
{
- pc_additem(sd, item, item->amount);
-
- log_pick_pc(sd, LOG_TYPE_MAIL, item->nameid, item->amount, item);
-
+ pc_additem(sd, item, item->amount, LOG_TYPE_MAIL);
clif_Mail_getattachment(sd->fd, 0);
}
if( zeny > 0 )
- { //Zeny recieve
+ { //Zeny receive
log_zeny(sd, LOG_TYPE_MAIL, sd, zeny);
pc_getzeny(sd, zeny);
}
@@ -174,15 +167,13 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->item.amount > 0 )
{
- // Item recieve (due to failure)
- log_pick_pc(sd, LOG_TYPE_MAIL, msg->item.nameid, msg->item.amount, &msg->item);
-
- pc_additem(sd, &msg->item, msg->item.amount);
+ // Item receive (due to failure)
+ pc_additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
}
if( msg->zeny > 0 )
{
- //Zeny recieve (due to failure)
+ //Zeny receive (due to failure)
log_zeny(sd, LOG_TYPE_MAIL, sd, msg->zeny);
sd->status.zeny += msg->zeny;
diff --git a/src/map/mob.c b/src/map/mob.c
index 585ebf0af..49ef0bfbc 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2403,15 +2403,13 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
intif_broadcast(message,strlen(message)+1,0);
}
- if((temp = pc_additem(mvp_sd,&item,1)) != 0) {
+ if((temp = pc_additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
clif_additem(mvp_sd,0,0,temp);
map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
}
//Logs items, MVP prizes [Lupus]
log_pick_mob(md, LOG_TYPE_PICKDROP_MONSTER, item.nameid, -1, NULL);
- if (!temp)
- log_pick_pc(mvp_sd, LOG_TYPE_PICKDROP_PLAYER, item.nameid, 1, NULL);
break;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index eb99d8243..a17f83df7 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1271,10 +1271,8 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
{
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp,amount);
+ pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
-
- log_pick_pc(sd, LOG_TYPE_NPC, nameid, amount, NULL);
}
return 0;
@@ -1378,11 +1376,9 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp, amount);
+ pc_additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
}
- log_pick_pc(sd, LOG_TYPE_NPC, nameid, amount, NULL);
-
return 0;
}
@@ -1486,11 +1482,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp,amount);
-
- //Logs items, Bought in NPC (S)hop [Lupus]
- log_pick_pc(sd, LOG_TYPE_NPC, item_tmp.nameid, amount, NULL);
- //Logs
+ pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
// custom merchant shop exp bonus
@@ -1631,10 +1623,6 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
amount = item_list[i*2+1];
nameid = sd->status.inventory[idx].nameid;
- //Logs items, Sold to NPC (S)hop [Lupus]
- log_pick_pc(sd, LOG_TYPE_NPC, nameid, -amount, &sd->status.inventory[idx]);
- //Logs
-
if( sd->inventory_data[idx]->type == IT_PETEGG && sd->status.inventory[idx].card[0] == CARD0_PET )
{
if( search_petDB_index(sd->status.inventory[idx].nameid, PET_EGG) >= 0 )
@@ -1643,7 +1631,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
}
}
- pc_delitem(sd, idx, amount, 0, 6);
+ pc_delitem(sd, idx, amount, 0, 6, LOG_TYPE_NPC);
}
if( z > MAX_ZENY )
diff --git a/src/map/party.c b/src/map/party.c
index 87adc6c29..0ddf5c9b9 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -1033,7 +1033,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) )
continue;
- if (pc_additem(psd,item_data,item_data->amount))
+ if (pc_additem(psd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
continue; //Chosen char can't pick up loot.
//Successful pick.
@@ -1055,7 +1055,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
}
while (count > 0) { //Pick a random member.
i = rand()%count;
- if (pc_additem(psd[i],item_data,item_data->amount))
+ if (pc_additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
{ //Discard this receiver.
psd[i] = psd[count-1];
count--;
@@ -1069,13 +1069,10 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if (!target) {
target = sd; //Give it to the char that picked it up
- if ((i=pc_additem(sd,item_data,item_data->amount)))
+ if ((i=pc_additem(sd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)))
return i;
}
- //Logs items, taken by (P)layers [Lupus]
- log_pick_pc(target, LOG_TYPE_PICKDROP_PLAYER, item_data->nameid, item_data->amount, item_data);
-
if( p && battle_config.party_show_share_picker && battle_config.show_picker_item_type&(1<<itemdb_type(item_data->nameid)) )
clif_party_show_picker(target, item_data);
diff --git a/src/map/pc.c b/src/map/pc.c
index 25c0f5789..032516810 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -439,7 +439,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
if( sd->status.inventory[i].expire_time <= time(NULL) )
{
clif_rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 1, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
}
else
{
@@ -3251,13 +3251,15 @@ 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,0) == 1 )
+ if( pc_delitem(sd,idx_card,1,1,0,LOG_TYPE_OTHER) == 1 )
{// failed
clif_insert_card(sd,idx_equip,idx_card,1);
}
else
{// success
+ log_pick_pc(sd, LOG_TYPE_OTHER, sd->status.inventory[idx_equip].nameid, -1, &sd->status.inventory[idx_equip]);
sd->status.inventory[idx_equip].card[i] = nameid;
+ log_pick_pc(sd, LOG_TYPE_OTHER, sd->status.inventory[idx_equip].nameid, 1, &sd->status.inventory[idx_equip]);
clif_insert_card(sd,idx_equip,idx_card,0);
}
@@ -3501,7 +3503,7 @@ int pc_search_inventory(struct map_session_data *sd,int item_id)
/*==========================================
* アイテム追加。個?のみitem構造?の?字を無視
*------------------------------------------*/
-int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
+int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type)
{
struct item_data *data;
int i;
@@ -3560,6 +3562,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
sd->inventory_data[i] = data;
clif_additem(sd,i,amount,0);
}
+ log_pick_pc(sd, log_type, sd->status.inventory[i].nameid, amount, &sd->status.inventory[i]);
sd->weight += w;
clif_updatestatus(sd,SP_WEIGHT);
@@ -3571,13 +3574,15 @@ 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, short reason)
+int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason, e_log_pick_type log_type)
{
nullpo_retr(1, sd);
if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amount<amount || sd->inventory_data[n] == NULL)
return 1;
+ log_pick_pc(sd, log_type, sd->status.inventory[n].nameid, -amount, &sd->status.inventory[n]);
+
sd->status.inventory[n].amount -= amount;
sd->weight -= sd->inventory_data[n]->weight*amount ;
if(sd->status.inventory[n].amount<=0){
@@ -3627,14 +3632,10 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
return 0;
}
- //Logs items, dropped by (P)layers [Lupus]
- log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, sd->status.inventory[n].nameid, -amount, (struct item*)&sd->status.inventory[n]);
- //Logs
-
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, 7);
+ pc_delitem(sd, n, amount, 0, 7, LOG_TYPE_PICKDROP_PLAYER);
return 1;
}
@@ -3938,11 +3939,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( sd->status.inventory[n].expire_time == 0 )
{
clif_useitemack(sd,n,amount-1,1);
-
- //Logs (C)onsumable items [Lupus]
- log_pick_pc(sd, LOG_TYPE_CONSUME, sd->status.inventory[n].nameid, -1, &sd->status.inventory[n]);
-
- pc_delitem(sd,n,1,1,0); // Rental Usable Items are not deleted until expiration
+ pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
}
else
clif_useitemack(sd,n,0,0);
@@ -3968,7 +3965,7 @@ int pc_useitem(struct map_session_data *sd,int n)
/*==========================================
* カ?トアイテム追加。個?のみitem構造?の?字を無視
*------------------------------------------*/
-int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount)
+int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type)
{
struct item_data *data;
int i,w;
@@ -4017,7 +4014,8 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
sd->cart_num++;
clif_cart_additem(sd,i,amount,0);
}
-
+ log_pick_pc(sd, log_type, sd->status.cart[i].nameid, amount, &sd->status.cart[i]);
+
sd->cart_weight += w;
clif_updatestatus(sd,SP_CARTINFO);
@@ -4027,7 +4025,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
/*==========================================
* カ?トアイテムを減らす
*------------------------------------------*/
-int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type)
+int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type)
{
nullpo_retr(1, sd);
@@ -4035,6 +4033,8 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type)
sd->status.cart[n].amount<amount)
return 1;
+ log_pick_pc(sd, log_type, sd->status.cart[n].nameid, -amount, &sd->status.cart[n]);
+
sd->status.cart[n].amount -= amount;
sd->cart_weight -= itemdb_weight(sd->status.cart[n].nameid)*amount ;
if(sd->status.cart[n].amount <= 0){
@@ -4066,8 +4066,8 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount)
if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending )
return 1;
- if( pc_cart_additem(sd,item_data,amount) == 0 )
- return pc_delitem(sd,idx,amount,0,5);
+ if( pc_cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 )
+ return pc_delitem(sd,idx,amount,0,5,LOG_TYPE_NONE);
return 1;
}
@@ -4105,8 +4105,8 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending )
return 1;
- if((flag = pc_additem(sd,item_data,amount)) == 0)
- return pc_cart_delitem(sd,idx,amount,0);
+ if((flag = pc_additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0)
+ return pc_cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE);
clif_additem(sd,0,0,flag);
return 1;
@@ -4187,7 +4187,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
tmp_item.nameid = itemid;
tmp_item.amount = 1;
tmp_item.identify = itemdb_isidentified(itemid);
- flag = pc_additem(sd,&tmp_item,1);
+ flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
//TODO: Should we disable stealing when the item you stole couldn't be added to your inventory? Perhaps players will figure out a way to exploit this behaviour otherwise?
md->state.steal_flag = UCHAR_MAX; //you can't steal from this mob any more
@@ -4202,7 +4202,6 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv)
//Logs items, Stolen from mobs [Lupus]
log_pick_mob(md, LOG_TYPE_PICKDROP_MONSTER, itemid, -1, NULL);
- log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, itemid, 1, NULL);
//A Rare Steal Global Announce by Lupus
if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) {
@@ -7726,7 +7725,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) )
{
ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", id, sd->status.inventory[i].amount, sd->status.char_id);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
}
}
@@ -7737,7 +7736,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) )
{
ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", id, sd->status.cart[i].amount, sd->status.char_id);
- pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0);
+ pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
}
}
}
@@ -7899,9 +7898,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, 0);
+ pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
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, 0);
+ pc_delitem(p_sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
clif_divorced(sd, p_sd->status.name);
diff --git a/src/map/pc.h b/src/map/pc.h
index 58ea2401c..67a7ac198 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -16,6 +16,7 @@
#include "unit.h" // unit_stop_attack(), unit_stop_walking()
#include "vending.h" // struct s_vending
#include "mob.h"
+#include "log.h"
#define MAX_PC_BONUS 10
#define MAX_PC_SKILL_REQUIRE 5
@@ -644,16 +645,16 @@ int pc_checkadditem(struct map_session_data*,int,int);
int pc_inventoryblank(struct map_session_data*);
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_additem(struct map_session_data*,struct item*,int,e_log_pick_type);
int pc_getzeny(struct map_session_data*,int);
-int pc_delitem(struct map_session_data*,int,int,int,short);
+int pc_delitem(struct map_session_data*,int,int,int,short,e_log_pick_type);
// Special Shop System
void pc_paycash(struct map_session_data *sd, int price, int points);
void pc_getcash(struct map_session_data *sd, int cash, int points);
-int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount);
-int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type);
+int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
+int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
int pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
diff --git a/src/map/pet.c b/src/map/pet.c
index fb5ba4699..d067b133f 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -301,7 +301,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
tmp_item.card[1] = GetWord(pd->pet.pet_id,0);
tmp_item.card[2] = GetWord(pd->pet.pet_id,1);
tmp_item.card[3] = pd->pet.rename_flag;
- if((flag = pc_additem(sd,&tmp_item,1))) {
+ if((flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -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,0);
+ pc_delitem(sd,i,1,0,0,LOG_TYPE_OTHER);
} else {
pet_data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
@@ -566,7 +566,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
tmp_item.card[1] = GetWord(pet_id,0);
tmp_item.card[2] = GetWord(pet_id,1);
tmp_item.card[3] = 0; //New pets are not named.
- if((ret = pc_additem(sd,&tmp_item,1))) {
+ if((ret = pc_additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
clif_additem(sd,0,0,ret);
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -662,7 +662,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
return 1;
}
- pc_delitem(sd,index,1,0,0);
+ pc_delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
pd->pet.equip = nameid;
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
clif_pet_equip_area(pd);
@@ -698,7 +698,7 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
tmp_item.identify = 1;
- if((flag = pc_additem(sd,&tmp_item,1))) {
+ if((flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -737,7 +737,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,0);
+ pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if( pd->pet.hungry > 90 )
pet_set_intimate(pd, pd->pet.intimate - pd->petDB->r_full);
@@ -1010,14 +1010,13 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
for(i=0;i<pd->loot->count;i++) {
it = &pd->loot->item[i];
if(sd){
- if((flag = pc_additem(sd,it,it->amount))){
+ if((flag = pc_additem(sd,it,it->amount,LOG_TYPE_PICKDROP_PLAYER))){
clif_additem(sd,0,0,flag);
ditem = ers_alloc(item_drop_ers, struct item_drop);
memcpy(&ditem->item_data, it, sizeof(struct item));
ditem->next = dlist->item;
dlist->item = ditem;
- } else
- log_pick_pc(sd, LOG_TYPE_PICKDROP_PLAYER, it->nameid, it->amount, it);
+ }
}
else {
ditem = ers_alloc(item_drop_ers, struct item_drop);
diff --git a/src/map/script.c b/src/map/script.c
index de130cd1d..203973860 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5689,17 +5689,14 @@ BUILDIN_FUNC(getitem)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &it, get_count)))
+ if ((flag = pc_additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
{
clif_additem(sd, 0, 0, flag);
if( pc_candrop(sd,&it) )
map_addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
- }
- }
-
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, amount, NULL);
+ }
+ }
return 0;
}
@@ -5790,7 +5787,7 @@ BUILDIN_FUNC(getitem2)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &item_tmp, get_count)))
+ if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
{
clif_additem(sd, 0, 0, flag);
if( pc_candrop(sd,&item_tmp) )
@@ -5798,9 +5795,6 @@ BUILDIN_FUNC(getitem2)
}
}
}
-
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, amount, &item_tmp);
}
return 0;
@@ -5856,7 +5850,7 @@ BUILDIN_FUNC(rentitem)
it.identify = 1;
it.expire_time = (unsigned int)(time(NULL) + seconds);
- if( (flag = pc_additem(sd, &it, 1)) )
+ if( (flag = pc_additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
{
clif_additem(sd, 0, 0, flag);
return 1;
@@ -5864,8 +5858,6 @@ BUILDIN_FUNC(rentitem)
clif_rental_time(sd->fd, nameid, seconds);
pc_inventory_rental_add(sd, seconds);
-
- log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, 1, NULL);
return 0;
}
@@ -5930,14 +5922,11 @@ BUILDIN_FUNC(getnameditem)
item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus]
item_tmp.card[2]=tsd->status.char_id;
item_tmp.card[3]=tsd->status.char_id >> 16;
- if(pc_additem(sd,&item_tmp,1)) {
+ if(pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
script_pushint(st,0);
return 0; //Failed to add item, we will not drop if they don't fit
}
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, item_tmp.amount, &item_tmp);
-
script_pushint(st,1);
return 0;
}
@@ -6028,12 +6017,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
{// delete associated pet
intif_delete_petdata(MakeDWord(inv->card[1], inv->card[2]));
}
-
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, inv->nameid, -delamount, inv);
- //Logs
-
- pc_delitem(sd, idx, delamount, 0, 0);
+ pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
}
amount[0]-= delamount;
@@ -6977,15 +6961,12 @@ BUILDIN_FUNC(failedrefitem)
if (num > 0 && num <= ARRAYLENGTH(equip))
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
-
sd->status.inventory[i].refine = 0;
pc_unequipitem(sd,i,3);
// 精錬失敗エフェクトのパケット
clif_refine(sd->fd,1,i,sd->status.inventory[i].refine);
- pc_delitem(sd,i,1,0,2);
+ pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
// 他の人にも失敗を通知
clif_misceffect(&sd->bl,2);
}
@@ -10342,10 +10323,7 @@ BUILDIN_FUNC(successremovecards)
for (j = 0; j < MAX_SLOTS; j++)
item_tmp.card[j]=0;
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, NULL);
-
- if((flag=pc_additem(sd,&item_tmp,1))){ // 持てないならドロップ
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // 持てないならドロップ
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -10364,15 +10342,8 @@ BUILDIN_FUNC(successremovecards)
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
-
- pc_delitem(sd,i,1,0,3);
-
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, &item_tmp);
-
- if((flag=pc_additem(sd,&item_tmp,1))){ // もてないならドロップ
+ pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // もてないならドロップ
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -10421,10 +10392,7 @@ BUILDIN_FUNC(failedremovecards)
for (j = 0; j < MAX_SLOTS; j++)
item_tmp.card[j]=0;
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, NULL);
-
- if((flag=pc_additem(sd,&item_tmp,1))){
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -10435,10 +10403,7 @@ BUILDIN_FUNC(failedremovecards)
if(cardflag == 1)
{
if(typefail == 0 || typefail == 2){ // 武具損失
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
-
- pc_delitem(sd,i,1,0,2);
+ pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
if(typefail == 1){ // カードのみ損失(武具を返す)
int flag;
@@ -10447,19 +10412,13 @@ BUILDIN_FUNC(failedremovecards)
item_tmp.equip=0,item_tmp.identify=1,item_tmp.refine=sd->status.inventory[i].refine;
item_tmp.attribute=sd->status.inventory[i].attribute,item_tmp.expire_time=sd->status.inventory[i].expire_time;
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
-
for (j = 0; j < sd->inventory_data[i]->slot; j++)
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,2);
+ pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, 1, &item_tmp);
-
- if((flag=pc_additem(sd,&item_tmp,1))){
+ if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -11124,11 +11083,7 @@ BUILDIN_FUNC(clearitem)
if(sd==NULL) return 0;
for (i=0; i<MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
-
- //Logs items, got from (N)PC scripts [Lupus]
- log_pick_pc(sd, LOG_TYPE_SCRIPT, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]);
-
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
}
}
return 0;
diff --git a/src/map/skill.c b/src/map/skill.c
index 60c8e0dc4..33e4d24f9 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1991,7 +1991,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
{ //Consume one Fragment per hit of the casted skill? [Skotlex]
type = tsd?pc_search_inventory (tsd, 7321):0;
if (type >= 0) {
- if ( tsd ) pc_delitem(tsd, type, 1, 0, 1);
+ if ( tsd ) pc_delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
dmg.damage = dmg.damage2 = 0;
dmg.dmg_lv = ATK_MISS;
sc->data[SC_SPIRIT]->val3 = skillid;
@@ -2691,7 +2691,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, 1);
+ if( index[i] >= 0 ) pc_delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME);
}
if( type&2 )
@@ -5467,7 +5467,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
item_tmp.identify = 1;
tbl.id = 0;
clif_takeitem(&sd->bl,&tbl);
- eflag = pc_additem(sd,&item_tmp,1);
+ eflag = pc_additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
if(eflag) {
clif_additem(sd,0,0,eflag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -6149,7 +6149,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = skill_db[su->group->skill_id].itemid[i];
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i])) )
+ if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
{
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -6163,7 +6163,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = ITEMID_TRAP;
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,1)) )
+ if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
{
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -10348,7 +10348,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,0); // Rental usable items are not consumed until expiration
+ pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
}
return 1;
}
@@ -11140,7 +11140,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,1);
+ pc_delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME);
}
}
@@ -11724,7 +11724,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,0);
+ pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
clif_item_repaireffect(sd,item->nameid,0);
if(sd!=target_sd)
clif_item_repaireffect(target_sd,item->nameid,0);
@@ -11778,9 +11778,11 @@ 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, 0);
+ pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if (per > rand() % 100) {
+ log_pick_pc(sd, LOG_TYPE_OTHER, item->nameid, -1, item);
item->refine++;
+ log_pick_pc(sd, LOG_TYPE_OTHER, item->nameid, 1, item);
if(item->equip) {
ep = item->equip;
pc_unequipitem(sd,idx,3);
@@ -11812,7 +11814,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,2);
+ pc_delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
clif_misceffect(&sd->bl,2);
clif_emotion(&sd->bl, E_OMG);
}
@@ -13372,12 +13374,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,0);
+ pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
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,0);
+ pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
ele=ele_table[slot[i]-994];
}
}
@@ -13417,7 +13419,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,0);
+ pc_delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
} else
ShowError("skill_produce_mix: material item error\n");
@@ -13688,7 +13690,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
}
}
if (tmp_item.amount) { //Success
- if((flag = pc_additem(sd,&tmp_item,tmp_item.amount))) {
+ if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -13757,7 +13759,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,0);
+ pc_delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE);
for(i=0;i<MAX_ARROW_RESOURCE;i++) {
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.identify = 1;
@@ -13771,7 +13773,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
}
if(tmp_item.nameid <= 0 || tmp_item.amount <= 0)
continue;
- if((flag = pc_additem(sd,&tmp_item,tmp_item.amount))) {
+ if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
@@ -13783,7 +13785,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
sc_type type;
int t_lv = 0, chance, i;
nullpo_ret(sd);
- if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0) ) {
+ if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
clif_skill_fail(sd,GC_POISONINGWEAPON,0,0);
return 0;
}
@@ -13813,14 +13815,14 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
nullpo_ret(sd);
skill = sd->menuskill_val;
- if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill || pc_delitem(sd,i,1,0,0) )
+ if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) )
{
clif_skill_fail(sd,NC_MAGICDECOY,0,0);
return 0;
}
// Spawn Position
- pc_delitem(sd,i,1,0,0);
+ pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
x = sd->sc.comet_x;
y = sd->sc.comet_y;
sd->sc.comet_x = sd->sc.comet_y = 0;
diff --git a/src/map/storage.c b/src/map/storage.c
index dd14acfda..a7aab8d79 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -154,7 +154,6 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
return 1;
stor->items[i].amount += amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
- log_pick_pc(sd, LOG_TYPE_STORAGE, item_data->nameid, -amount, item_data);
return 0;
}
}
@@ -171,7 +170,6 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
stor->items[i].amount = amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updatestorageamount(sd,stor->storage_amount);
- log_pick_pc(sd, LOG_TYPE_STORAGE, item_data->nameid, -amount, item_data);
return 0;
}
@@ -185,9 +183,6 @@ int storage_delitem(struct map_session_data* sd, int n, int amount)
return 1;
sd->status.storage.items[n].amount -= amount;
-
- log_pick_pc(sd, LOG_TYPE_STORAGE, sd->status.storage.items[n].nameid, amount, &sd->status.storage.items[n]);
-
if( sd->status.storage.items[n].amount == 0 )
{
memset(&sd->status.storage.items[n],0,sizeof(sd->status.storage.items[0]));
@@ -218,7 +213,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,4);
+ pc_delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE);
return 1;
}
@@ -239,7 +234,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( (flag = pc_additem(sd,&sd->status.storage.items[index],amount)) == 0 )
+ if( (flag = pc_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
storage_delitem(sd,index,amount);
else
clif_additem(sd,0,0,flag);
@@ -267,7 +262,7 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
return 0;
if( storage_additem(sd,&sd->status.cart[index],amount) == 0 )
- pc_cart_delitem(sd,index,amount,0);
+ pc_cart_delitem(sd,index,amount,0,LOG_TYPE_STORAGE);
return 1;
}
@@ -288,7 +283,7 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( pc_cart_additem(sd,&sd->status.storage.items[index],amount) == 0 )
+ if( pc_cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
storage_delitem(sd,index,amount);
return 1;
@@ -410,7 +405,6 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
stor->items[i].amount+=amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
stor->dirty = 1;
- log_pick_pc(sd, LOG_TYPE_GSTORAGE, item_data->nameid, -amount, item_data);
return 0;
}
}
@@ -427,7 +421,6 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updateguildstorageamount(sd,stor->storage_amount);
stor->dirty = 1;
- log_pick_pc(sd, LOG_TYPE_GSTORAGE, item_data->nameid, -amount, item_data);
return 0;
}
@@ -440,7 +433,6 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto
return 1;
stor->items[n].amount-=amount;
- log_pick_pc(sd, LOG_TYPE_GSTORAGE, stor->items[n].nameid, amount, &stor->items[n]);
if(stor->items[n].amount==0){
memset(&stor->items[n],0,sizeof(stor->items[0]));
stor->storage_amount--;
@@ -470,9 +462,8 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.inventory[index].amount )
return 0;
-// log_tostorage(sd, index, 1);
if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
- pc_delitem(sd,index,amount,0,4);
+ pc_delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -497,7 +488,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
if(amount < 1 || amount > stor->items[index].amount)
return 0;
- if((flag = pc_additem(sd,&stor->items[index],amount)) == 0)
+ if((flag = pc_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
guild_storage_delitem(sd,stor,index,amount);
else
clif_additem(sd,0,0,flag);
@@ -526,7 +517,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
return 0;
if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0)
- pc_cart_delitem(sd,index,amount,0);
+ pc_cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -550,7 +541,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
if(amount < 1 || amount > stor->items[index].amount)
return 0;
- if(pc_cart_additem(sd,&stor->items[index],amount)==0)
+ if(pc_cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
guild_storage_delitem(sd,stor,index,amount);
return 1;
diff --git a/src/map/trade.c b/src/map/trade.c
index 3b882307d..3c398ab83 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -550,14 +550,10 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = sd->deal.item[trade_i].index;
- flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);
+ flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- {
- //Logs (T)rade [Lupus]
- log_pick_pc(sd, LOG_TYPE_TRADE, sd->status.inventory[n].nameid, -(sd->deal.item[trade_i].amount), &sd->status.inventory[n]);
- log_pick_pc(tsd, LOG_TYPE_TRADE, 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, 6);
- } else
+ pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ else
clif_additem(sd, n, sd->deal.item[trade_i].amount, 0);
sd->deal.item[trade_i].index = 0;
sd->deal.item[trade_i].amount = 0;
@@ -566,14 +562,10 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = tsd->deal.item[trade_i].index;
- flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount);
+ flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- {
- //Logs (T)rade [Lupus]
- log_pick_pc(tsd, LOG_TYPE_TRADE, tsd->status.inventory[n].nameid, -(tsd->deal.item[trade_i].amount), &tsd->status.inventory[n]);
- log_pick_pc(sd, LOG_TYPE_TRADE, 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, 6);
- } else
+ pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ else
clif_additem(tsd, n, tsd->deal.item[trade_i].amount, 0);
tsd->deal.item[trade_i].index = 0;
tsd->deal.item[trade_i].amount = 0;
diff --git a/src/map/vending.c b/src/map/vending.c
index 0d97cf2fc..38c817139 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -181,14 +181,10 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
short idx = *(uint16*)(data + 4*i + 2);
idx -= 2;
- //Logs sold (V)ending items [Lupus]
- log_pick_pc(vsd, LOG_TYPE_VENDING, vsd->status.cart[idx].nameid, -amount, &vsd->status.cart[idx]);
- log_pick_pc( sd, LOG_TYPE_VENDING, vsd->status.cart[idx].nameid, amount, &vsd->status.cart[idx]);
-
// vending item
- pc_additem(sd, &vsd->status.cart[idx], amount);
+ pc_additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
- pc_cart_delitem(vsd, idx, amount, 0);
+ pc_cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
clif_vendingreport(vsd, idx, amount);
//print buyer's name