Merge pull request #6 from sn4ke/master

Fixed bug with adding Vip from console or map, who is already on viplist.
This commit is contained in:
Eduardo Bart 2012-07-09 09:19:23 -03:00
commit 23fee49456
3 changed files with 13 additions and 2 deletions

View File

@ -31,3 +31,10 @@ function Player:isPartySharedExperienceActive()
shield == ShieldBlueNoSharedExpBlink or shield == ShieldBlueNoSharedExpBlink or
shield == ShieldBlueNoSharedExp) shield == ShieldBlueNoSharedExp)
end 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

View File

@ -403,7 +403,9 @@ function Console.popupMenu(mousePos, mouseButton, creatureName, text)
if creatureName then if creatureName then
if creatureName ~= g_game.getCharacterName() then if creatureName ~= g_game.getCharacterName() then
menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end) 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 -- TODO ignore creatureName
menu:addSeparator() menu:addSeparator()
end end

View File

@ -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('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 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 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 localPlayerShield = localPlayer:asCreature():getShield()
local creatureShield = creatureThing:getShield() local creatureShield = creatureThing:getShield()