Jump to content
  • 0

@command donotloot


kamikai

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

hi all

i'd like to add an @command to my server which is @donotloot, they'd work like the @autoloot commands but in the opposite side, as an exception, say you put your autoloot command to loot everything (autoloot 100), but you want an exception on an iron ore, then you'd use:

@autoloot 100

@donotloot iron_ore

**note: the parameter for donotloot should be item name or it's id

thanks in advance XD /hmm

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   12
  • Joined:  02/02/12
  • Last Seen:  

Diff: http://pastebin.com/sUduy7xb

Woopsie, I forgot to change something~

http://pastebin.com/SqLtTM27

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

  • 1

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   12
  • Joined:  02/02/12
  • Last Seen:  

It works just fine for me:

http://img210.images...6737/noloot.png

Do you get any errors or warnings when you compile?

EDIT:

Heres how to fix it:

Change

mob.c

&& ( ( drop_rate <= sd->state.autoloot && !pc_isnolooting(sd, ditem->item_data.nameid) ) || pc_isautolooting(sd, ditem->item_data.nameid))

for:

&& (pc_isnolooting(sd, ditem->item_data.nameid) == 0)
&& (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))

pc.c

if( !sd->state.nolooting )
return true;

for...

if( !sd->state.nolooting )
return false;

And if you want to remove itens from notloot list when you use alootid:

// No items founds in the DB with Id or Name
clif_displaymessage(fd, "Item not found.");
return -1;
}
}

switch(action) {
case 1:
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid);
if (i != AUTOLOOTITEM_SIZE) {
clif_displaymessage(fd, "You're already autolooting this item.");
return -1;
}

Add after this line:

ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == item_data->nameid);
if ( i != AUTOLOOTITEM_SIZE )
sd->state.nolootid[i] = 0;

Sorry for the trouble /hmm

Edited by Wynn_
  • 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:  

why not just allow user with DONOR state of your to use

@alootid 

if you want it be @donorloot

then just edit at command src there

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

@Emistry, i don't think u understood what i'm requesting...i dont want a separate @command that allows ppl to autoloot only if they've donated to the server, i want to make an exception for the already existing @autoloot command, besides if i knew what to change in the source i wouldn't be requesting it here

here's another example:

say i set @autoloot 100 and @donotloot red_herb, then i kill a lunatic, i would autoloot everything besides red herb

Red Herb - not looting - rate: 6%

Apple - looting - rate: 20%

Carrot - looting - rate: 11%

Clover - looting - rate: 65%

Feather - looting - rate: 10%

Clown Nose - looting - rate: 0.04%

Lunatic Card - looting - rate: 0.01%

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  530
  • Reputation:   33
  • Joined:  01/17/12
  • Last Seen:  

it's like in reverse.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

yeah i know, but i dont know how to implement it

alright, so if i were to use the aloot id as a base for implementing the donotloot, here's the autolooititem code:

/*==========================================
* @alootid
*------------------------------------------*/
ACMD_FUNC(autolootitem)
{
struct item_data *item_data = NULL;
int i;
int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset[/size]
if (message && *message) {
 if (message[0] == '+') {
  message++;
  action = 1;
 }
 else if (message[0] == '-') {
  message++;
  action = 2;
 }
 else if (!strcmp(message,"reset"))
  action = 4;
} if (action < 3) // add or remove
{
 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;
 }
}
switch(action) {
case 1:
 ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid);
 if (i != AUTOLOOTITEM_SIZE) {
  clif_displaymessage(fd, "You're already autolooting this item.");
  return -1;
 }
 ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == 0);
 if (i == AUTOLOOTITEM_SIZE) {
  clif_displaymessage(fd, "Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>.");
  return -1;
 }
 sd->state.autolootid[i] = item_data->nameid; // Autoloot Activated
 sprintf(atcmd_output, "Autolooting item: '%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid);
 clif_displaymessage(fd, atcmd_output);
 sd->state.autolooting = 1;
 break;
case 2:
 ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid);
 if (i == AUTOLOOTITEM_SIZE) {
  clif_displaymessage(fd, "You're currently not autolooting this item.");
  return -1;
 }
 sd->state.autolootid[i] = 0;
 sprintf(atcmd_output, "Removed item: '%s'/'%s' {%d} from your autolootitem list.", item_data->name, item_data->jname, item_data->nameid);
 clif_displaymessage(fd, atcmd_output);
 ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0);
 if (i == AUTOLOOTITEM_SIZE) {
  sd->state.autolooting = 0;
 }
 break;
case 3:
 sprintf(atcmd_output, "You can have %d items on your autolootitem list.", AUTOLOOTITEM_SIZE);
 clif_displaymessage(fd, atcmd_output);
 clif_displaymessage(fd, [email=""]"To add item to the list, use "@alootid[/email] +<item name or ID>". To remove item use "@alootid -<item name or ID>".");
 clif_displaymessage(fd, [email=""]""@alootid[/email] reset" will clear your autolootitem list.");
 ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0);
 if (i == AUTOLOOTITEM_SIZE) {
  clif_displaymessage(fd, "Your autolootitem list is empty.");
 } else {
  clif_displaymessage(fd, "Items on your autolootitem list:");
  for(i = 0; i < AUTOLOOTITEM_SIZE; i++)
  {
if (sd->state.autolootid[i] == 0)
 continue;
if (!(item_data = itemdb_exists(sd->state.autolootid[i]))) {
 ShowDebug("Non-existant item %d on autolootitem list (account_id: %d, char_id: %d)", sd->state.autolootid[i], sd->status.account_id, sd->status.char_id);
 continue;
}
sprintf(atcmd_output, "'%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid);
clif_displaymessage(fd, atcmd_output);
  }
 }
 break;
case 4:
 memset(sd->state.autolootid, 0, sizeof(sd->state.autolootid));
 clif_displaymessage(fd, "Your autolootitem list has been reset.");
 sd->state.autolooting = 0;
 break;
}
return 0;
}

so besides changing ACMD_FUNC(autolootitem) to ACMD_FUNC(donotlootitem), what else should i change?

im rather thinking where is the code of when you kill the mob and it is about to drop the items then it checks if its supposed to be autolooted, if i knew at least that i could try to make it myself

Edited by Emistry
Codeboxed Long Contents
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

@Wynn_, thanks!! /thx Even though i dont have time to test it right now :P , but once i get back home i will for sure! /hmm/no1

----

edit:

finally got back home and well...when i was about to test it, i noticed that after i applied the patch i cant login to map server anymore, weird that a warning message were appearing on the char-server instead of map...anyway i tied up my hands by downloading the svn again and then i could actually try it out...

it 'worked' i mean the logic where you're checking if the item is supposed to be looted or not is kinda messy:

say if you use @autoloot 100, it wouldnt loot anything o_O, but if u set @alootid, to jellopy for example, and @notloot jellopy too, everything would be looted but jellopy, im trying to figure out whats wrong over there...at least that i think i can handle myself...but since its very late here now, im just gonna go to bed, and take a look at that tomorrow XD

anyways, thanks guys, once i fix it up i'll post it here!

Edited by kamikai
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

@Wynn_, thanks again, btw there's a typo on

atcommand.c tpo

[size="2"] [/size][size="2"][size="2"][size="2"]clif_displaymessage(fd, [/size][size="2"][color="#a31515"][size="2"][color="#a31515"]"To add item to the list, use "@nolootitem +<item name or ID>". To remove item use "@nolootitem -<item name or ID>"."[/color][/size][/color][/size][size="2"]);[/size][/size][/size]
[size="2"][size="2"][size="2"]- clif_displaymessage(fd, [/size][size="2"][color="#a31515"][size="2"][color="#a31515"]""@alootid reset" will clear your autolootitem list."[/color][/size][/color][/size][size="2"]);[/size][/size][/size]
[size="2"][size="2"][size="2"]+[size="2"] clif_displaymessage(fd, [color="#a31515"][color="#a31515"]""@[size="2"][color="#a31515"]nolootitem [/color][/size]reset" will clear your [/color][/color][/size][/size][/size][/size][size="2"][size="2"][size="2"][size="2"][color="#a31515"][color="#a31515"][size="2"][color="#a31515"][size="2"][color="#a31515"]nolootitem [/color][/size][/color][/size][/color][/color][/size][/size][/size][/size][size="2"][size="2"][size="2"][size="2"][color="#a31515"][color="#a31515"]list."[/color][/color]);[/size][/size][/size][/size]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  530
  • Reputation:   33
  • Joined:  01/17/12
  • Last Seen:  

@Ms Wynn_ tried to use it too but when adding the lines from atcommand.c

ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.nolootid[i] == item_data->nameid);
if ( i != AUTOLOOTITEM_SIZE )
set sd->state.nolootid[i] = 0;

gives me compile error:

atcommand.c(5835): error C2065: 'set' : undeclared identifier
atcommand.c(5835): error C2146: syntax error : missing ';' before identifier 'sd'

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   12
  • Joined:  02/02/12
  • Last Seen:  

Woah I can't believe I tried using set on source xD just delete the "set", it's supposed to be "sd->state.nolootid = 0;"

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

yeah, it finally works just fine XD

thanks again Wynn_

but now i'm wondering about something, since i'm new with the renewal mechanics, i'd like to make the drops to be old-school like, i looked at the "battle_config" files and couldn't find anything that says something like renewal_drops, or something, that changes the rates depending on whats he lv difference between the player and the monster, where/how do i change this?

Edited by kamikai
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   12
  • Joined:  02/02/12
  • Last Seen:  

You can disable all the Renewal stuff in yout src/map/config/Renewal.h file.

Edited by Wynn_
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  530
  • Reputation:   33
  • Joined:  01/17/12
  • Last Seen:  

@Ms Wynn_ thanks a lot it works now /hmm

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  94
  • Topics Per Day:  0.02
  • Content Count:  2192
  • Reputation:   252
  • Joined:  11/11/11
  • Last Seen:  

Wynn, would you be able to provide an updated diff with the fixes that do work? D:

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   12
  • Joined:  02/02/12
  • Last Seen:  

Sure, I'll edit my post soon with an updated diff.

http://paste.pocoo.org/raw/558391/

Edited by Wynn_
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  25
  • Reputation:   0
  • Joined:  02/22/12
  • Last Seen:  

i know that i've already made another topic about this issue i've noticed that there's something incomplete on the base source of taekwon's ranking bonuses

i'm talking about it here, because this post has been more active than the other one, so...

well Ms. Wynn, i ask you to take a look at my post about the TK-Ranker issue: http://rathena.org/b...2151#entry82151

there in my last post, i've put a link to International Ragnarok Online site, where it describes how the ranking bonuses should actually work, its in the Taekwon Mission Skill's description, i also pasted a copy of the description on my post, the link is just to prove that i'm not making it all up

then please Ms. Wynn, if it's not too much to ask, at least take a look there

thanks in advance XD

/sob

Edited by kamikai
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
Answer this question...

×   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...