Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
143 stars 127 forks source link

It is not returning the guild id #498

Open luanluciano93 opened 2 years ago

luanluciano93 commented 2 years ago

It is not returning the guild id

https://github.com/Znote/ZnoteAAC/blob/88a13e6d1053884536017173aa98289b97c8a81f/Lua/TFS_10/revscriptsys/playerdeath.lua#L6

Znote commented 2 years ago

Could you elaborate further on the problem?

It is correct that the variables guild and enemyGuild does not return the guild id. https://github.com/Znote/ZnoteAAC/blob/88a13e6d1053884536017173aa98289b97c8a81f/Lua/TFS_10/revscriptsys/playerdeath.lua#L5

They are returning the guild objects/metatables. This seems to be the intended behavior.

The guild id's are passed through the function params and is called guildId and enemyGuildId

luanluciano93 commented 2 years ago

guildId and enemyGuildId are correctly arriving at the local function sendWarStatus, however when passing through the Guild(variable) it is becoming null

Znote commented 2 years ago

Replace: https://github.com/Znote/ZnoteAAC/blob/88a13e6d1053884536017173aa98289b97c8a81f/Lua/TFS_10/revscriptsys/playerdeath.lua#L5-L8

With:

local guild = Guild(guildId)
local enemyGuild = Guild(enemyGuildId) 
if not guild then
    print("sendWarStatus: Error: Failed to load guild data from id: ".. guildId)
    return 
end 
if not enemyGuild then
    print("sendWarStatus: Error: Failed to load guild data from id: ".. enemyGuildId)
    return 
end
print("sendWarStatus: Loading guild data: OK")

What messages do you get in console when reproducing this issue?

luanluciano93 commented 2 years ago

sendWarStatus: Error: Failed to load guild data from id: 2

Znote commented 2 years ago

That is very weird, do you have any data associated to guild id 2 in SQL? In the guilds table? Which server distro are you using, which version?

If there is a bug with initializing a guild through its id, a workaround might be to send the player, and then use player:getGuild() to retrieve the guild object properly.

luanluciano93 commented 2 years ago

That is very weird, do you have any data associated to guild id 2 in SQL? In the guilds table?

no

Which server distro are you using, which version?

nekiro tfs 1.4 8.60

I think it's a bug in the distro then, because the variables with guild ids arrive correctly and when passing through Guild(x) it changes.