Jump to content

multiple @alootid


CalciumKid

Recommended Posts


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  257
  • Reputation:   253
  • Joined:  11/29/11
  • Last Seen:  

Thoughts on implementing this source mod into the rAthena SVN?


Index: src/map/atcommand.c

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

--- src/map/atcommand.c (revision 14109)

+++ src/map/atcommand.c (working copy)

@@ -6074,35 +6074,84 @@

}

/*==========================================

- * @autolootitem

+ * @autolootitem [modified version by Rad]

+ * modified to enable players autoloot 5

+ * different items. Uses array. Counter checks added biggrin.png

+ * Sorry if it is too lousy for you biggrin.png

*------------------------------------------*/

int atcommand_autolootitem(const int fd, struct map_session_data* sd, const char* command, const char* message)

{

struct item_data *item_data = NULL;

+ int i, slot=0;

+ char item_name[100];

- if (!message || !*message) {

- if (sd->state.autolootid) {

- sd->state.autolootid = 0;

+ memset(item_name, '\0', sizeof(item_name));

+

+ if (!message || !*message || (

+ sscanf(message, "\"[^\"]\" %d", item_name, &slot) < 1 &&

+ sscanf(message, "s %d", item_name, &slot) < 1

+

+ )) {

+

+ if (sd->state.autolootactive) {

+ sd->state.autolootactive = 0;

clif_displaymessage(fd, "Autolootitem have been turned OFF.");

- } else

- clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @autolootitem <item_name_or_ID>).");

+ }

+ else

+ clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @alootid <item_name_or_ID> [<slot>]).");

+ clif_displaymessage(fd, "...to see autoloot list, @alootid list");

+ return -1;

+ }

+ if(strcmp(item_name,"list")==0)

+ {

+ clif_displaymessage(fd, "Autoloot items:");

+ for(i=0; i < 5; i++){

+ if(sd->state.autolootid <= 500)

+ sprintf(atcmd_output, "Slot %d: %s",i+1,">>> Free autoloot slot <<<");

+ else{

+ item_data = itemdb_search(sd->state.autolootid);

+ sprintf(atcmd_output, "Slot %d: '%s'",i+1,item_data->name);

+ }

+ clif_displaymessage(fd, atcmd_output);

+ }

+ return 0;

+ }

+

+ else if ((item_data = itemdb_searchname(item_name)) == NULL &&

+ (item_data = itemdb_exists(atoi(item_name))) == NULL)

+ {

+ clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name.

return -1;

}

+

+ if(slot<1 || slot>5) slot = 1; // check

+ slot = slot - 1;

+

+ if (slot < 0 || slot >4){ //counter check

+ clif_displaymessage(fd, "Slot # can only be 1~5");

+ return -1;

+ }

- if ((item_data = itemdb_exists(atoi(message))) == NULL)

- item_data = itemdb_searchname(message);

-

if (!item_data) {

// No items founds in the DB with Id or Name

clif_displaymessage(fd, "Item not found.");

return -1;

}

+

+ for(i=0; i < 5; i++){ //to prevent duplicate entry

+ if(item_data->nameid == sd->state.autolootid){

+ sprintf(atcmd_output, "'%s' is already auto-looted in Slot %d.",item_data->name, i+1);

+ clif_displaymessage(fd, atcmd_output);

+ return -1;

+ }

+ }

- sd->state.autolootid = item_data->nameid; // Autoloot Activated

+ sd->state.autolootid[slot] = item_data->nameid; // Autoloot Activated

+ sd->state.autolootactive = 1;

- sprintf(atcmd_output, "Autolooting Item: '%s'/'%s' {%d}",

- item_data->name, item_data->jname, item_data->nameid);

+ sprintf(atcmd_output, "Autolooting Item: '%s'/'%s' {%d} , Stored in slot %d",

+ item_data->name, item_data->jname, item_data->nameid,slot+1);

clif_displaymessage(fd, atcmd_output);

return 0;

Index: src/map/mob.c

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

--- src/map/mob.c (revision 14109)

+++ src/map/mob.c (working copy)

@@ -1719,7 +1719,7 @@

if( sd == NULL ) sd = map_charid2sd(dlist->third_charid);

if( sd

- && (drop_rate <= sd->state.autoloot || ditem->item_data.nameid == sd->state.autolootid)

+ && (drop_rate <= sd->state.autoloot || mob_processdrop( sd, ditem->item_data.nameid ))

&& (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)

&& (battle_config.homunculus_autoloot?1:!flag)

#ifdef AUTOLOOT_DISTANCE

@@ -1738,6 +1738,17 @@

dlist->item = ditem;

}

+int mob_processdrop(struct map_session_data * sd, int nameid)

+{

+ int i;

+ for(i=0; i < 5; i++)

+ {

+ if(nameid == sd->state.autolootid)

+ return 1;

+ }

+ return 0;

+}

+

int mob_timer_delete(int tid, unsigned int tick, int id, intptr data)

{

struct block_list* bl = map_id2bl(id);

Index: src/map/mob.h

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

--- src/map/mob.h (revision 14109)

+++ src/map/mob.h (working copy)

@@ -230,6 +230,7 @@

int mob_dead(struct mob_data *md, struct block_list *src, int type);

void mob_revive(struct mob_data *md, unsigned int hp);

void mob_heal(struct mob_data *md,unsigned int heal);

+int mob_processdrop(struct map_session_data * sd, int nameid);

#define mob_stop_walking(md, type) unit_stop_walking(&(md)->bl, type)

#define mob_stop_attack(md) unit_stop_attack(&(md)->bl)

Index: src/map/pc.h

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

--- src/map/pc.h (revision 14109)

+++ src/map/pc.h (working copy)

@@ -122,7 +122,8 @@

unsigned ignoreAll : 1;

unsigned debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS]

unsigned short autoloot;

- unsigned short autolootid; // [Zephyrus]

+ unsigned short autolootid[5]; // [Zephyrus]

+ unsigned short autolootactive;

unsigned noks : 3; // [Zeph Kill Steal Protection]

bool changemap;

short pmap; // Previous map on Map Change

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  117
  • Reputation:   167
  • Joined:  11/10/11
  • Last Seen:  

Interesting, I don't see the harm in allowing multiple auto-loots. One I designed a while ago for Project Odin used the following format:

@alootid -- list all current autoloot items and show the options (below)
@alootid reset -- clears all autoloot items
@alootid +<item id or name> -- add an item to the autoloot list
@alootid -<item id or name> -- remove an item from the autoloot list

I think definitely having a +/- or add/remove option would be an awesome idea, to add more flexibility. Or even just retain that @alootid <item id or name> adds to a list, while @alootid remove <item id or name> would remove it. Thoughts?

  • Upvote 6
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  243
  • Reputation:   206
  • Joined:  11/28/11
  • Last Seen:  

I think this is a norm to servers nowadays so I agree that multiple alootid should be added to the SVN.

Additionally, I was working on something similar to both Rad's and Epoque's system with a bit more functionality:

- Ability to add/remove in more than one item to the list in one command (a player's suggestion) [@alootid + 607 606 ...]

- User panel in-game called from an atcommand to do the same as the commands (more user friendly?)

- Able to hold more than 5 autolooting items

I haven't finished it though, haha. So if you'd like, feel free to add those in. In any case, the previously posted versions should be added to the SVN.

  • Upvote 1
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  146
  • Topics Per Day:  0.03
  • Content Count:  1195
  • Reputation:   467
  • Joined:  11/15/11
  • Last Seen:  

Bump.

Also agree to this addition (Epoque + Xantara's)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  257
  • Reputation:   253
  • Joined:  11/29/11
  • Last Seen:  

Epoque, have you got a diff for your command?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  186
  • Reputation:   51
  • Joined:  11/14/11
  • Last Seen:  

Here's my version of it.

If you could use the identifer LOOTITEM_SIZE in the message

You can have 10 items on your autolootitem list.

i would vote for it. ^_^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

I vote for epoque's whops didn't notice gepard's one is like that. +1 gepard's =3

Edited by Ind
Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  257
  • Reputation:   253
  • Joined:  11/29/11
  • Last Seen:  

Does gepards have a reset function?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   285
  • Joined:  12/19/11
  • Last Seen:  

How about I add the reset function to it and finally commit to repo? There is always room for improvements, and every dev would be free to do so.

It's been a month already since we started to discuss it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  169
  • Topics Per Day:  0.04
  • Content Count:  1260
  • Reputation:   750
  • Joined:  11/19/11
  • Last Seen:  

How about I add the reset function to it and finally commit to repo? There is always room for improvements, and every dev would be free to do so.

It's been a month already since we started to discuss it.

imo go ahead

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   285
  • Joined:  12/19/11
  • Last Seen:  

Ok, added in r15489.

  • Upvote 1
Link to comment
Share on other sites

×
×
  • Create New...