From b0a73e55252f07f6b24ff04db554318f0f306d25 Mon Sep 17 00:00:00 2001 From: 4drik <4drik@users.noreply.github.com> Date: Wed, 27 May 2020 21:41:25 +0200 Subject: [PATCH] Fix an issue with the VIP list data not being stored properly (#1083) The VIP IDs aren't guaranteed to be stable. --- modules/game_viplist/viplist.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index e99971a1..5dfd4d2d 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -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