Mercurial > wow > breuesk
diff Lists.lua @ 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 |
line wrap: on
line diff
--- 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--}}}