Merge pull request #6 from sn4ke/master

Fixed bug with adding Vip from console or map, who is already on viplist.
master
Eduardo Bart 12 years ago
commit 23fee49456

@ -31,3 +31,10 @@ function Player:isPartySharedExperienceActive()
shield == ShieldBlueNoSharedExpBlink or
shield == ShieldBlueNoSharedExp)
end
function Player:hasVip(creatureName)
for id, vip in pairs(g_game.getVips()) do
if (vip[1] == creatureName) then return true end
end
return false
end

@ -403,7 +403,9 @@ function Console.popupMenu(mousePos, mouseButton, creatureName, text)
if creatureName then
if creatureName ~= g_game.getCharacterName() then
menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end)
menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end) --TODO not show if creature already in vip
if (not Player:hasVip(creatureName)) then
menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end)
end
-- TODO ignore creatureName
menu:addSeparator()
end

@ -263,7 +263,9 @@ function GameInterface.createThingMenu(menuPosition, lookThing, useThing, creatu
menu:addOption(tr('Invite to private chat'), function() g_game.inviteToOwnChannel(creatureName) end)
menu:addOption(tr('Exclude from private chat'), function() g_game.excludeFromOwnChannel(creatureName) end) -- [TODO] must be removed after message's popup labels been implemented
end
menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end)
if (not Player:hasVip(creatureName)) then
menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end)
end
local localPlayerShield = localPlayer:asCreature():getShield()
local creatureShield = creatureThing:getShield()

Loading…
Cancel
Save