Problem with guild IDs after leaving a guild -> ID = ID+MAX_GUILDS
Hey there,
as I tested something with my addon FCOGuildInfo I've joined and left a guild to see what the events for joining/leaving a guild do. After joining a guild: The function GetNumGuilds() gets me the correct number of my new guilds: 5 The function GetGuildName(guildId) gets me the correct name of all my 5 guilds (IDs 1 to 5). Do not logout in between here! After leaving the joined guild later on: The function GetNumGuilds() gets me the correct number of my guilds left: 4 The function GetGuildName(guildId) gets me an empty string? I've tested IDs 1 to 5 -> Empty string After that I just tested IDs > 5 and all of sudden: ID6 = ID1 (Guild 1) -> Name was found correctly ID7 = ID2 (Guild 2) -> Name was found correctly ID8 = ID3 (Guild 3) -> Name was found correctly ID9 = ID4 (Guild 4) -> Name was found correctly I don't know if this is normal but for me it looks like a bug? Maybe they copy the guild ids to ID+MAX_GUILDS (or something like this) as you remove a guild, so they can reorg something in the background. But it seems as if it wa snot moved back to IDs 1 to 4 properly afterwards. Anyone here encountered this too? Edit: The function GetGuildId() always will return 6 at this moment, even if I change the active guild in the roster... Edit2: After joining the same guild again the things get even more weird: Guild 1 was moved to guildID 5 Guild 2 was moved to guildID 6 Guild 3 was moved to guildID 7 Guild 4 was moved to guildID 8 Guild 5 was moved to guildID 9 So everything was moved from starting ID 6 to starting ID 5 (-1)??? |
When you leave/Join a guild, the GetGuildId() is mandatory, while doing test, game often returned me things like
1st = 1 2nd = 17 3rd = 24 4th = 12 5th = 46 Itr reverts correctly at next ReloadUI to 1/2/3/4/5. so, just use GetGuildId(), always. |
No, I cannot say the same Ayantir!
After reloadui it was not reset to normal 1,2,3,4,5 but it stayed at 6+. After a logout it was reset to the normal 1,2,3,4,5 though. But how am I able to loop over all given guilds (from guild 1 to 5) if they do not use the guild ids 1 to 5 but 5 to 9, and GetGuildId() will return something like 6? |
You need to differ between guildIndex and guildID.
guildIndex is what you get when you use GetNumGuilds() and it will always be 1 to number of guilds, guildID is an arbitrary number and cannot be known before using GetGuildId(guildIndex). Don't assume that guildID is in the range 1-5 or even in the "correct" order. guildIndex will always reflect the order you joined the guilds in, but the index might change if you leave a guild. If you want to save something for a guild, it's safest to use the guild name, as this will never change. If you use the guild joined and left events Code:
EVENT_GUILD_SELF_JOINED_GUILD (integer eventCode, integer guildId, string guildName) In order to get the local id you need to use this code inside the eventhandler: Lua Code:
edit: For iterating over all your guilds, use this code: Lua Code:
|
Ok, thanks for the clarification.
I missunderstood the guildId and GetGuildId() functions then. Quote:
|
All times are GMT -6. The time now is 08:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI