Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(Core/ItemHandler): Optional item recovery #2442

Merged
20 commits merged into from
Dec 9, 2019
Merged

feat(Core/ItemHandler): Optional item recovery #2442

20 commits merged into from
Dec 9, 2019

Conversation

IntelligentQuantum
Copy link
Member

@IntelligentQuantum IntelligentQuantum commented Nov 15, 2019

It is for the AzerothJS

@FrancescoBorzi
Copy link
Contributor

hey @IntelligentQuantum thanks for the PR

It is for the AzerothJS

can you elaborate more? what features does this PR implements and in which way are they required to be in the core?

@Helias
Copy link
Member

Helias commented Nov 24, 2019

Features of this PR:

  • it allows to have a log about deleted items
  • It allows to recover items via SQL

This PR adds 3 configs:

  • CONFIG_ITEMDELETE_METHOD
  • CONFIG_ITEMELETE_QUALITY
  • CONFIG_ITEMELETE_ITEM_LEVEL

These configs allow to choose the method, quality and item_level of the items that could be logged in the table recovery_item.

Do we need this?
Yes, because this is an extra-feature of AC.
Besides, I don't think that this bother the blizzlike game, indeed because it's a config, so you can enable/disable.
Moreover, we can implement third-party APIs, modules or tools that work with AC.

Here a video made by @IntelligentQuantum that shows how this feature works (using the AzerothJS API).

https://mega.nz/#!pyYxlYyJ!vy6-5kGcBiTmE6xOOpbBWPuSAZvhhi2jGiFo4FXXHfM

@FrancescoBorzi
Copy link
Contributor

thanks @Helias for the description and @IntelligentQuantum let us know when the PR is ready to be reviewed

@IntelligentQuantum
Copy link
Member Author

Hi @FrancescoBorzi it's ready

@Ali-Khazaee
Copy link
Contributor

As i used this feature before, There is an issue when you sell items to vendors there will be no log

@MarkMBarnett
Copy link

Tested successfully

@FrancescoBorzi
Copy link
Contributor

@IntelligentQuantum looks good 👍

Now waiting for a tester feedback.

@Helias
Copy link
Member

Helias commented Dec 6, 2019

I'm trying to test this PR but I got the following error during the import of db characters updates with latest master revision:

ERROR 1062 (23000) at line 126: Duplicate entry '1572331570357004681' for key 'PRIMARY'

Probably you need to generate again the sql pending file using data/sql/updates/pending_db_characters/create_sql.sh after updating this PR with master.

Anyway, I imported the table recovery_item manually but the feature does not work, I don't kno why.
Probably you added a condition that does not work properly.

@FrancescoBorzi
Copy link
Contributor

@Helias no, we can't merge to master if it gives such an error. I've tried to put a different id (just re-generated). Can you please give another try?

Also @IntelligentQuantum just a tip for future: never push changes to your master branch, always create a new branch for each PR you want to open. But for this time it's fine.

@IntelligentQuantum
Copy link
Member Author

@FrancescoBorzi Kk sorry
@Helias Video

@Helias
Copy link
Member

Helias commented Dec 7, 2019

I rebuild everything and checked the worldserver.conf, probably I missed something, now it works.

@ghost ghost changed the title feat(core) API feat(Core/ItemHandler): Optional item recovery Dec 8, 2019
@ghost ghost merged commit b6c0f58 into azerothcore:master Dec 9, 2019
@BarbzYHOOL
Copy link
Member

BarbzYHOOL commented Dec 10, 2019

quite interesting, don't you think it will flood the DB though? I have seen the configuration options but still

and thank you @IntelligentQuantum

@Nefertumm
Copy link
Member

It would be awesome if it stores the unixtime of deletion in db, so we can implement an option for delete entries after X amount of days.

@mynew
Copy link

mynew commented Dec 15, 2019

#0 0x0000000000c751ab in GetUInt32Value (index=, this=, index=) at ......../src/server/game/Entities/Object/Object.h:164
#1 GetEntry (this=) at ......../src/server/game/Entities/Object/Object.h:138
#2 WorldSession::HandleBuybackItem (this=, recvData=...) at ......../src/server/game/Handlers/ItemHandler.cpp:797
#3 0x0000000000ce55db in WorldSession::Update (this=0x7fff9d62e300, diff=, updater=...) at ......../src/server/game/Server/WorldSession.cpp:328
#4 0x0000000000c8ad81 in Map::Update (this=0x7fffc7f3a300, t_diff=0, s_diff=10) at ......../src/server/game/Maps/Map.cpp:672
#5 0x0000000000e44a99 in MapUpdateRequest::call (this=0x7fff31e40330) at ......../src/server/game/Maps/MapUpdater.cpp:57
#6 0x0000000000ea1f09 in DelayExecutor::svc (this=0x7ffff197cb68) at ......../src/common/Threading/DelayExecutor.cpp:53
#7 0x00007ffff74d56d7 in ACE_Task_Base::svc_run (args=0x7ffff197cb68) at Task.cpp:260
#8 0x00007ffff74d6dc5 in ACE_Thread_Adapter::invoke_i (this=) at Thread_Adapter.cpp:161
#9 0x00007ffff74d6d0f in ACE_Thread_Adapter::invoke (this=0x7fffbbb40d00) at Thread_Adapter.cpp:96
#10 0x00007ffff63e4184 in start_thread (arg=0x7fffb3cd2700) at pthread_create.c:312
#11 0x00007ffff56ed03d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Crash ItemHandler.cpp
stmt->setUInt32(1, pItem->GetEntry());

@Nefertumm
Copy link
Member

@mynew open a new issue please.

@robens
Copy link
Contributor

robens commented Dec 16, 2019

#0 0x0000000000c751ab in GetUInt32Value (index=, this=, index=) at ......../src/server/game/Entities/Object/Object.h:164
#1 GetEntry (this=) at ......../src/server/game/Entities/Object/Object.h:138
#2 WorldSession::HandleBuybackItem (this=, recvData=...) at ......../src/server/game/Handlers/ItemHandler.cpp:797
#3 0x0000000000ce55db in WorldSession::Update (this=0x7fff9d62e300, diff=, updater=...) at ......../src/server/game/Server/WorldSession.cpp:328
#4 0x0000000000c8ad81 in Map::Update (this=0x7fffc7f3a300, t_diff=0, s_diff=10) at ......../src/server/game/Maps/Map.cpp:672
#5 0x0000000000e44a99 in MapUpdateRequest::call (this=0x7fff31e40330) at ......../src/server/game/Maps/MapUpdater.cpp:57
#6 0x0000000000ea1f09 in DelayExecutor::svc (this=0x7ffff197cb68) at ......../src/common/Threading/DelayExecutor.cpp:53
#7 0x00007ffff74d56d7 in ACE_Task_Base::svc_run (args=0x7ffff197cb68) at Task.cpp:260
#8 0x00007ffff74d6dc5 in ACE_Thread_Adapter::invoke_i (this=) at Thread_Adapter.cpp:161
#9 0x00007ffff74d6d0f in ACE_Thread_Adapter::invoke (this=0x7fffbbb40d00) at Thread_Adapter.cpp:96
#10 0x00007ffff63e4184 in start_thread (arg=0x7fffb3cd2700) at pthread_create.c:312
#11 0x00007ffff56ed03d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Crash ItemHandler.cpp
stmt->setUInt32(1, pItem->GetEntry());

Just in case the issue won't be created, try moving all that new code on line ~797(ItemHandler) to the beginning of the "if" so we avoid using pItem after calling StoreItem. That or save the entry before

@Nefertumm
Copy link
Member

That crash made me wonder, what if the seller bought back the item? He can claim the recovery but he has the item...

@robens
Copy link
Contributor

robens commented Dec 16, 2019

That crash made me wonder, what if the seller bought back the item? He can claim the recovery but he has the item...

I think that the block of code that causes the crash is used to avoid that, it's deleting from the recovery table after buying back

@Nefertumm
Copy link
Member

Oh yeah.
Also, what if the item has multiple entries? Recovering just one of them would delete all of them from the table.
This came to me just now, sorry :P

@IntelligentQuantum
Copy link
Member Author

IntelligentQuantum commented Dec 17, 2019

Hey guys

@BarbzYHOOL Actually we can flood db with CharacterRecovery && LagReport, btw we have configuration and ItemRecovery work like CharacterRecovery.

@GitVerge @Nefertumm tnx for help.

@mynew Can you test this diff please Crash.diff

Sorry my english is bad! 😄

This pull request was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants