Merge pull request #187 from Quintinon/master

Minor Fixes and Ignore/Unignore options in right click menus
This commit is contained in:
Ben Dol 2013-01-09 20:19:39 -08:00
commit d70b835464
3 changed files with 28 additions and 6 deletions

View File

@ -446,7 +446,11 @@ function processMessageMenu(mousePos, mouseButton, creatureName, text)
if not g_game.getLocalPlayer():hasVip(creatureName) then if not g_game.getLocalPlayer():hasVip(creatureName) then
menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end) menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end)
end end
-- TODO ignore creatureName if isIgnored(creatureName) then
menu:addOption(tr('Unignore') .. ' ' .. creatureName, function() removeIgnoredPlayer(creatureName) end)
else
menu:addOption(tr('Ignore') .. ' ' .. creatureName, function() addIgnoredPlayer(creatureName) end)
end
menu:addSeparator() menu:addSeparator()
end end
--TODO select all --TODO select all
@ -768,6 +772,16 @@ function isIgnored(name)
return table.find(ignoreSettings.players, name) return table.find(ignoreSettings.players, name)
end end
function addIgnoredPlayer(name)
if not isIgnored(name) then
table.insert(ignoreSettings.players, name)
end
end
function removeIgnoredPlayer(name)
table.removevalue(ignoreSettings.players, name)
end
function isIgnoringPrivate() function isIgnoringPrivate()
return ignoreSettings.privateMessages return ignoreSettings.privateMessages
end end
@ -789,6 +803,7 @@ function onClickIgnoreButton()
local selection = ignoreListPanel:getFocusedChild() local selection = ignoreListPanel:getFocusedChild()
if selection then if selection then
ignoreListPanel:removeChild(selection) ignoreListPanel:removeChild(selection)
selection:destroy()
end end
if ignoreListPanel:getChildCount() == 0 then if ignoreListPanel:getChildCount() == 0 then
removeButton:disable() removeButton:disable()
@ -820,7 +835,8 @@ function onClickIgnoreButton()
saveButton.onClick = function() saveButton.onClick = function()
ignoreSettings.players = {} ignoreSettings.players = {}
for i = 1, ignoreListPanel:getChildCount() do for i = 1, ignoreListPanel:getChildCount() do
table.insert(ignoreSettings.players, ignoreListPanel:getChildByIndex(i):getText()) addIgnoredPlayer(ignoreListPanel:getChildByIndex(i):getText())
--table.insert(ignoreSettings.players, ignoreListPanel:getChildByIndex(i):getText())
end end
ignoreSettings.yelling = ignoreYellingBox:isChecked() ignoreSettings.yelling = ignoreYellingBox:isChecked()

View File

@ -412,6 +412,12 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end) menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end)
end end
if modules.game_console.isIgnored(creatureName) then
menu:addOption(tr('Unignore') .. ' ' .. creatureName, function() modules.game_console.removeIgnoredPlayer(creatureName) end)
else
menu:addOption(tr('Ignore') .. ' ' .. creatureName, function() modules.game_console.addIgnoredPlayer(creatureName) end)
end
local localPlayerShield = localPlayer:getShield() local localPlayerShield = localPlayer:getShield()
local creatureShield = creatureThing:getShield() local creatureShield = creatureThing:getShield()

View File

@ -9,7 +9,7 @@ NPCItemBox < UICheckBox
border-color: #000000 border-color: #000000
color: #aaaaaa color: #aaaaaa
text-align: center text-align: center
text-offset: 0 20 text-offset: 0 30
@onCheckChange: modules.game_npctrade.onItemBoxChecked(self) @onCheckChange: modules.game_npctrade.onItemBoxChecked(self)
Item Item