Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npc/custom/card_remover.txt is bugged. #2469

Open
Mojacko opened this issue May 11, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@Mojacko
Copy link

commented May 11, 2019

Describe the bug
If you manage to get to the part of code

if(.@failchance < 10) {
	next;
	failedremovecards .@part,3;
	mes "[Card Remover]";
	mes "I have failed to remove the cards. Luckily, however, both the item and the cards are still okay.";
	close;
}

While it won't break any item or card. it would read the current equipment as "no card" while there is still a card inside it. so you won't be able to remove the card permanently. what's worse is that you CAN ADD 1 MORE CARD. making it 2 Slot ...

Screenshots
img

To Reproduce
Steps to reproduce the behavior:

  1. Enable the npc
  2. just remove item until you get that message it fail but no item were destroy
  3. try adding cards or even try again talking to the npc and she will say that it doesnt have any card in it.
  4. See error

Expected behavior
It should leave the failed attempt as normal items with compounded card.

System specs (please complete the following information):

  • OS: centos 6
  • Hercules Version [Release v2019.05.05+3]
  • Mode: [pre-renewal?]
  • Packet version: 2018-04-18bRagexeRE
  • Client type: RE

Plugins used or source modifications
If you are using any plugins besides the ones that come bundled with Hercules,
please enumerate them here.

Additional context
There is no warning/error message when this happens

@Emistry

This comment has been minimized.

Copy link
Member

commented May 16, 2019

hmm ... the NPC doesn't help you add a card into the item. You're only able to manually compound a card into an item.

Do you meant after the process of removing card failed, but the item compounded (duplicated?) a new card into the other slot?

Have you check your item_db that it has how many slots?

@Mojacko

This comment has been minimized.

Copy link
Author

commented May 16, 2019

Hi,
Yes the process of removing card failed. but the item is still compounded. but no new card on my inventory.
then if i try to use the card remover again and choose the same item it says it doesnt contain any card.
also i can add another card to the item.
Im 100% sure that the slot is only 1 because this image i upload is my 5th test and not just on this briss it happen it also happen to mink coat.

@Emistry

This comment has been minimized.

Copy link
Member

commented May 17, 2019

I think something is wrong with the *failedremovecards(...) script command.

prontera,155,181,5	script	sample	4_F_KAFRA1,{
	failedremovecards EQI_ARMOR,3;
	mes "[Card Remover]";
	mes "I have failed to remove the cards. Luckily, however, both the item and the cards are still okay.";
	close;
}

img

from doc/script_command.txt

 0 - will destroy both the item and the cards.
 1 - will keep the item, but destroy the cards.
 2 - will keep the cards, but destroy the item.

but current result

 0 - correct, currently it lose both items
 1 - correct, will keep the item, but destroy the cards.
 2 - wrong, currently it lose both items (unable to retrieve back the cards)

other value - execute fine, but item remain same, but once unequip the item, we able to compound cards to other slot which are not defined in item_db.
but I don't think we are suppose to use any value other than specified, the script are probably outdated. That line failedremovecards .@part, 3; should be removed.

this could lead to serious exploit, perhaps for now you shall not use any card remover that remove item using the said script command above.
use custom card remover npc that use delitem2 + getitem2 to uncompound cards.


but if they try to insert multiple card into the slot after they remove it using the npc, when they relog, they lose all "extra" card.
Ex:

  1. using the NPC to uncompound card
  2. insert a new card into the equip (Creamy Card into Clip[1])
  3. repeat steps 1~2 multiple time (get a )
  4. relog character
  5. the Quadraple Teleport Clip[1] become a normal Teleport Clip[1], the other extra 3 creamy cards are lost.

Tried to debug ...
when *failedremovecards(...) script command call pc_additem(...)

if( item_data->nameid <= 0 || amount <= 0 )
		return 1;`

somehow the value of item_data->nameid = 0, then it tried to create an item on floor, but failed too.

Update:
the root cause that caused above issue i believe its this line.

cardflag = 1;
sd->status.inventory[i].card[c] = 0;  

it shouldn't set the value to 0 if didnt remove the card.

tldr; it shouldn't remove card value if its not type == 1.

Emistry added a commit to Emistry/Hercules that referenced this issue May 17, 2019

Fix *failedremovecards script command.
- only `type == 1` will remove the card.
- fixes HerculesWS#2469

@Emistry Emistry referenced this issue May 17, 2019

Open

Fix *failedremovecards script command. #2477

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.