Fix an issue with the VIP list data not being stored properly (#1083)

The VIP IDs aren't guaranteed to be stable.
This commit is contained in:
4drik 2020-05-27 21:41:25 +02:00 committed by GitHub
parent 307a618591
commit b0a73e5525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,9 +148,9 @@ function createEditWindow(widget)
g_game.editVip(id, description, iconId, notify)
else
if notify ~= false or #description > 0 or iconId > 0 then
vipInfo[id] = {description = description, iconId = iconId, notifyLogin = notify}
vipInfo[name] = {description = description, iconId = iconId, notifyLogin = notify}
else
vipInfo[id] = nil
vipInfo[name] = nil
end
end
@ -203,10 +203,11 @@ function removeVip(widgetOrName)
if widget then
local id = widget:getId():sub(4)
local name = widget:getText()
g_game.removeVip(id)
vipList:removeChild(widget)
if vipInfo[id] and g_game.getFeature(GameAdditionalVipInfo) then
vipInfo[id] = nil
if vipInfo[name] and g_game.getFeature(GameAdditionalVipInfo) then
vipInfo[name] = nil
end
end
end
@ -252,7 +253,7 @@ function onAddVip(id, name, state, description, iconId, notify)
label:setText(name)
if not g_game.getFeature(GameAdditionalVipInfo) then
local tmpVipInfo = vipInfo[tostring(id)]
local tmpVipInfo = vipInfo[name]
label.iconId = 0
label.notifyLogin = false
if tmpVipInfo then