Jump to content

GM Trade / Drop logs + announce


Smoke

Recommended Posts


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   8
  • Joined:  01/06/12
  • Last Seen:  

Hello,

This is the first of my code modifications, so do let me know (with possible fix and what I did wrong) if you find any bugs.

What this modification does?

Basically logs and announces all trades and drops by GMs using a table that's much easy to understand than normal trade logs, whilst preserving the original trade logs.

Find and Replace : TradelogPatch.txt

Recompile and ban your corruption!

Do let me know what you think :D

Edited by Smoke
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Sorry , but according to the Source Release Section Rules

Upload your diffs as an attachment or some other external link where it can be downloaded. Don't post a codebox with it.

Please revise your topic and edit it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   8
  • Joined:  01/06/12
  • Last Seen:  

Sorry , but according to the Source Release Section Rules

Upload your diffs as an attachment or some other external link where it can be downloaded. Don't post a codebox with it.

Please revise your topic and edit it.

Hey, I'm sorry about this but I dont use rAthena so I cannot make a diff with exact line edits. Is it fine if I make a txt file with Find and Replace ?

I've added a txt file with find and replace instructions.

Edited by Smoke
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.02
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

Hey.. im getting a lot or errors using 3ceam,,

can you help me..?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  251
  • Reputation:   20
  • Joined:  12/22/11
  • Last Seen:  

where the log file is saved?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

where the log file is saved?

tradelog table

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.02
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

does it work to you guys?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

Nope, it's not compatible with rAthena.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  82
  • Topics Per Day:  0.02
  • Content Count:  223
  • Reputation:   4
  • Joined:  02/23/12
  • Last Seen:  

im using 3ceam.. if its not compatible with both.. then..

its useless..?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  271
  • Reputation:   7
  • Joined:  01/06/12
  • Last Seen:  

can you please make a 3ceam patch, thanks in advance

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

doesn't work if I implemented it totally.. XD

however, thank Smoke, sorry I almost edit all ur work to be like these, my modification focuss in announcement than log because we can use picklog, right?

======================================

add in one of your battle\conf files, maybe items.conf

then add this lines, so you can modif the Trade/Drop announcement states easily then use @realoadbattleconf

// [Cydh] credit to [smoke]
// gm_drop_announce, 1 = enable, 0 = disable
// Dropped item(s) by GM Level form gm_drop_lvl_from until gm_drop_lvl_to will be announced in the public
gm_drop_announce: 1
gm_drop_lvl_from: 10
gm_drop_lvl_to: 98
// [Cydh] credit to [smoke]
// gm_trade_announce, 1 = enable, 0 = disable
// Tradded item(s) by GM Level form gm_trade_lvl_from until gm_trade_lvl_to will be announced in the public
gm_trade_announce: 1
gm_trade_lvl_from: 10
gm_trade_lvl_to: 98

inside extern struct Battle_Config in src\map\battle.h, find

int item_drop_adddrop_min,item_drop_adddrop_max; //[skotlex]

int prevent_logout; // Added by RoVeRT

it becomes

int item_drop_adddrop_min,item_drop_adddrop_max; //[skotlex]

int prevent_logout; // Added by RoVeRT

int gm_drop_announce; //Added by Cydh. Dropped item announcement
int gm_drop_lvl_from; //Added by Cydh. Dropped item announcement
int gm_drop_lvl_to; //Added by Cydh. Dropped item announcement
int gm_trade_announce; //Added by Cydh. Traded item announcement
int gm_trade_lvl_from; //Added by Cydh. Traded item announcement
int gm_trade_lvl_to; //Added by Cydh. Traded item announcement

in src\map\battle.c, inside

static const struct _battle_data {
const char* str;
int* val;
int defval;
int min;
int max;
} battle_data[] = {
....
....
};

before }; signs

add new lines,and it becomes

static const struct _battle_data {
const char* str;
int* val;
int defval;
int min;
int max;
} battle_data[] = {
....
....
{ "gm_drop_announce",				   &battle_config.gm_drop_announce,				 1,	 0,			1,		}, //GM Dropped item announcement [Cydh]
{ "gm_drop_lvl_from",				   &battle_config.gm_drop_lvl_from,				 20,	0,		   99,		}, //GM Dropped item announcement [Cydh]
{ "gm_drop_lvl_to",					 &battle_config.gm_drop_lvl_to,				   98,	0,		   99,		}, //GM Dropped item announcement [Cydh]
{ "gm_trade_announce",				  &battle_config.gm_trade_announce,				1,	 0,			1,		}, //GM Traded item announcement [Cydh]
{ "gm_trade_lvl_from",				  &battle_config.gm_trade_lvl_from,				20,	0,		   99,		}, //GM Traded item announcement [Cydh]
{ "gm_trade_lvl_to",					&battle_config.gm_trade_lvl_to,				  98,	0,		   99,		}, //GM Traded item announcement [Cydh]
};

inside pc_dropitem in map\pc.c, find

int pc_dropitem(struct map_session_data *sd,int n,int amount)
{
nullpo_retr(1, sd);

if(n < 0 || n >= MAX_INVENTORY)

and change it becomes

int pc_dropitem(struct map_session_data *sd,int n,int amount)
{
struct item_data *item_data; //GM Drop log
char output[255]; //GM Dropped item announcement
int gm_lvl1; //GM Dropped item announcement [Cydh]. Must be less than gm_lvl2
int gm_lvl2; //GM Dropped item announcement [Cydh]. Must be more than gm_lvl1
nullpo_retr(1, sd);

gm_lvl1 = battle_config.gm_drop_lvl_from; //GM Dropped item announcement [Cydh]. Must be less than gm_lvl2
gm_lvl2 = battle_config.gm_drop_lvl_to; //GM Dropped item announcement [Cydh]. Must be more than gm_lvl1
if(gm_lvl1 > gm_lvl2) //If gm_lvl1 > gm_lvl2, swith them!
{
gm_lvl1 = battle_config.gm_drop_lvl_to; //GM Dropped item announcement [Cydh]
gm_lvl2 = battle_config.gm_drop_lvl_from; //GM Dropped item announcement [Cydh]
}

if(n < 0 || n >= MAX_INVENTORY)

still inside pc_dropitem in map\pc.c, find

//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);

}
return 1;

change it becomes

//Logs
if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
 return 0;
item_data = itemdb_search(sd->status.inventory[n].nameid); //GM Drop log
pc_delitem(sd, n, amount, 0, 7);
if(battle_config.gm_trade_announce) //GM Dropped item announcement [Cydh]
{
 //==========================================
 //   GM Drop log by Smoke, edited by Cydh
 //==========================================
 if(pc_isGM(sd) >= gm_lvl1 && pc_isGM(sd) <= gm_lvl2)
 {
  sprintf(output, "%s dropped %s %dx at %s %d %d",sd->status.name,item_data->jname,amount,mapindex_id2name(map_id2index(sd->bl.m)),sd->bl.x,sd->bl.y);
  intif_broadcast(output, strlen(output) + 1, 0);
 }
 //==========================================
}
return 1;

then, inside trade_tradecommit in map\ trade.c, find

void trade_tradecommit(struct map_session_data *sd)
{
struct map_session_data *tsd;
int trade_i;
int flag;

it becomes

void trade_tradecommit(struct map_session_data *sd)
{
struct item_data *item_data; //GM Trade Log
char output[255]; //GM Traded item announcement
struct map_session_data *tsd;
int trade_i;
int flag;

still inside trade_tradecommit in map\ trade.c, find

// trade is accepted and correct.
for( trade_i = 0; trade_i < 10; trade_i++ )
{
 int n;

 if (sd->deal.item[trade_i].amount)
 {
  n = sd->deal.item[trade_i].index;
  flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);
  if (flag == 0)
  {

it becomes

// trade is accepted and correct.
for( trade_i = 0; trade_i < 10; trade_i++ )
{
 int n;
 int itemtrade_id; //GM Traded item announcement [Cydh]
 int itemtrade_amount; //GM Traded item announcement [Cydh]
 int gm_lvl1; //GM Traded item announcement [Cydh]. Must be less than gm_lvl2
 int gm_lvl2; //GM Traded item announcement [Cydh]. Must be more than gm_lvl1

 gm_lvl1 = battle_config.gm_drop_lvl_from; //GM Traded item announcement [Cydh]. Must be less than gm_lvl2
 gm_lvl2 = battle_config.gm_drop_lvl_to; //GM Traded item announcement [Cydh]. Must be more than gm_lvl1
 if(gm_lvl1 > gm_lvl2) //If gm_lvl1 > gm_lvl2, swith them!
 {
  gm_lvl1 = battle_config.gm_drop_lvl_to; //GM Traded item announcement [Cydh]
  gm_lvl2 = battle_config.gm_drop_lvl_from; //GM Traded item announcement [Cydh]
 }

 if (sd->deal.item[trade_i].amount)
 {
  n = sd->deal.item[trade_i].index;
  itemtrade_id = sd->status.inventory[n].nameid; //GM Traded item announcement [Cydh]
  itemtrade_amount = sd->deal.item[trade_i].amount;  //GM Traded item announcement [Cydh]
  flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);
  if (flag == 0)
  {

still inside trade_tradecommit in map\ trade.c, find

} 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;

it becomes

} else
clif_additem(sd, n, sd->deal.item[trade_i].amount, 0);

  item_data = itemdb_search(itemtrade_id); //GM Traded item announcement
  if(battle_config.gm_trade_announce) //GM Traded item announcement [Cydh]
  {
//==========================================
//   GM Trade log by Smoke, edited by Cydh
//==========================================
if(pc_isGM(sd) >= gm_lvl1 && pc_isGM(sd) <= gm_lvl2)
{
 sprintf(output, "%s has trade %s %dx with %s", sd->status.name,item_data->jname,itemtrade_amount,tsd->status.name);
 intif_broadcast(output, strlen(output) + 1, 0);
}
//==========================================
  }
  itemtrade_id = 0; //GM Traded item announcement [Cydh]
  itemtrade_amount = 0; //GM Traded item announcement [Cydh]
  sd->deal.item[trade_i].index = 0;
  sd->deal.item[trade_i].amount = 0;

still inside trade_tradecommit in map\ trade.c, find

if (tsd->deal.item[trade_i].amount)
 {
  n = tsd->deal.item[trade_i].index;
  flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount);
  if (flag == 0)
  {
//Logs (T)rade [Lupus]

it becomes

if (tsd->deal.item[trade_i].amount)
 {
  n = tsd->deal.item[trade_i].index;
  itemtrade_id = tsd->status.inventory[n].nameid;  //GM Traded item announcement [Cydh]
  itemtrade_amount = tsd->deal.item[trade_i].amount;  //GM Traded item announcement [Cydh]
  flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount);
  if (flag == 0)
  {
//Logs (T)rade [Lupus]

still inside trade_tradecommit is map\ trade.c, find

  } 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;
 }

it becomes

  } else
clif_additem(tsd, n, tsd->deal.item[trade_i].amount, 0);

  item_data = itemdb_search(itemtrade_id); //GM Traded item announcement
  if(battle_config.gm_trade_announce) //GM Traded item announcement [Cydh]
  {
//==========================================
//   GM Trade log by Smoke, edited by Cydh
//==========================================
if(pc_isGM(sd) >= gm_lvl1 && pc_isGM(sd) <= gm_lvl2)
{
 sprintf(output, "%s has trade %s %dx with %s", tsd->status.name,item_data->jname,itemtrade_amount,sd->status.name);
 intif_broadcast(output, strlen(output) + 1, 0);
}
//==========================================
  }
  itemtrade_id = 0; //GM Traded item announcement [Cydh]
  itemtrade_amount = 0; //GM Traded item announcement [Cydh]
  tsd->deal.item[trade_i].index = 0;
  tsd->deal.item[trade_i].amount = 0;
 }

all above, work fine for me.

Edited by cydh
Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  520
  • Reputation:   64
  • Joined:  11/19/11
  • Last Seen:  

doesn't work if I implemented it totally.. XD

however, thank Smoke, sorry I almost edit all ur work to be like these, my modification focuss in announcement than log because we can use picklog, right?

Error on TRADE.C, I'm using latest rAthena SVN.

Edited by Rejected
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

Error on TRADE.C, I'm using latest rAthena SVN.

what's line? the error message?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  520
  • Reputation:   64
  • Joined:  11/19/11
  • Last Seen:  

Error on TRADE.C, I'm using latest rAthena SVN.

what's line? the error message?

I think this line, Sorry I forgot.

flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);

Edited by Rejected
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount);

I don't know why, I don't know what's the error/warning message..

try to send me PM of the compile error message and your trade.c file..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_SCRIPT);
int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type)

you forgot this

Edited by goddameit
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_SCRIPT);
int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type)

you forgot this

not forget, only based on original file.. I wasn't editing for latest rAthena version.. xD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...