azerothcore / mod-eluna

Eluna Lua Engine © for WoW Emulators
https://elunaluaengine.github.io/
GNU General Public License v3.0
96 stars 126 forks source link

global"GetItemGuid" Should be treated differently #140

Open GoMateoGo opened 1 year ago

GoMateoGo commented 1 year ago

There are currently 2 types of 'GetItemGuid'

  1. Roll

  2. Global

When using global GetItemGuid (lowGuid), it defaults to executing roll first

These two types should be treated differently

GoMateoGo commented 1 year ago

By modifying roll: GetItemGuid

Can changing the capitalization of method names or other methods solve the problem?

I'm not sure how to solve this problem more reasonably

r-o-b-o-t-o commented 1 year ago

It correctly executes the global one for me. Do you have a minimal reproducible example? Also what OS is your AzerothCore running?

GoMateoGo commented 1 year ago

OS: Win11 22621.1778

  1. You can view characters.instance_ Is the item.guid consistent with the lGuid printing

  2. Record the printed value of hGuid

  3. Please modify or comment out roll: GetItemGuid for compilation

  4. Run the example here to view the hGuid printed value and compare it with the previous value

I accidentally discovered this

example:

RegisterItemEvent(6948, 2, function (event, player, item, target)
    local lGuid = item:GetGUIDLow()
    print("lGuid=",lGuid)
    local hGuid = GetItemGUID(lGuid)
    print("hGuid=",hGuid)
    local mlguid = item:GetGUID()
    print("mlguid=",mlguid)

    -----------The correct approach
    --local guid = item:GetGUID()
    --print("guid=",guid)
    --local items = player:GetItemByGUID( guid )
    --print("items",items:GetEntry())
 end)
GoMateoGo commented 1 year ago

I don't know why, every time I use 'code' preview, it always doesn't match my expectations