Mercurial > wow > breuesk
changeset 28:eb3a3f69559e
Command to remove person
Disallow removing someone who is still on a list somewhere
author | John@Yosemite-PC |
---|---|
date | Sun, 11 Mar 2012 17:27:31 -0400 |
parents | 611808dbc0c0 |
children | 731182d55b6c |
files | Core.lua Lists.lua |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Sat Mar 10 17:21:48 2012 -0500 +++ b/Core.lua Sun Mar 11 17:27:31 2012 -0400 @@ -79,6 +79,9 @@ end local person = FixPersonName(param[3]) bsk:RemovePersonFromList(person, param[4]) + elseif param[2] == "person" then + local person = FixPersonName(param[3]) + bsk:RemovePerson(person) else bsk:Print(sformat("Deleting anything of type %s is not supported",param[2])) end
--- a/Lists.lua Sat Mar 10 17:21:48 2012 -0500 +++ b/Lists.lua Sun Mar 11 17:27:31 2012 -0400 @@ -422,9 +422,23 @@ bsk:Print(sformat("%s is not in the persons list, please check your spelling", name)) return false end + local listsTheyreOn = {} + -- check if they're active on any loot list + for i,v in pairs(bsk.lists) do + for x,y in ipairs(v) do + if y.id == id then + tinsert(listsTheyreOn,v.name) + break + end + end + end + if getn(listsTheyreOn) > 0 then + self:Print(sformat("Cannot remove person %s because they are on one or more lists (%s)",name,table.concat(listsTheyreOn,", "))) + return false + end local change = {action="RemovePerson",arg={id=id}} bsk:StartChange(change) - if bsk:DoRemovePerson() then + if bsk:DoRemovePerson(change) then bsk:CommitChange(change) end end--}}}