Mercurial > wow > breuesk
diff Lists.lua @ 43:4109683c3172
Kept AceConsole embedded - it handily disables the chat commands when the addon is disabled
Did a little passthrough to properly set the self param for commands like Print()
author | John@Yosemite-PC |
---|---|
date | Thu, 15 Mar 2012 22:27:51 -0400 |
parents | 72055fc7e115 |
children | 8913e7d79cad |
line wrap: on
line diff
--- a/Lists.lua Thu Mar 15 08:47:41 2012 -0400 +++ b/Lists.lua Thu Mar 15 22:27:51 2012 -0400 @@ -124,9 +124,9 @@ -- Debugging {{{ function PrettyPrintList(listIndex) local list = lists[listIndex] - bsk:Print("List: " .. list.name .. " (" .. listIndex .. ") - last modified " .. date("%m/%d/%y %H:%M:%S", list.time) .. " (",list.time,")" ) + print("List: " .. list.name .. " (" .. listIndex .. ") - last modified " .. date("%m/%d/%y %H:%M:%S", list.time) .. " (",list.time,")" ) for i = 1,#list do - bsk:Print(" " .. i .. " - " .. persons[list[i].id].main) + print(" " .. i .. " - " .. persons[list[i].id].main) end end function PrettyPrintLists() @@ -146,40 +146,40 @@ function PrintAPI(object) for i,v in pairs(object) do if type(v) == "function" then - bsk:Print("function "..i.."()") + print("function "..i.."()") end end end function PrintTable(table, depth) depth = depth or "" if not table then return end - if #depth > 3*5 then bsk:Print(depth.."Recursion too deep - stopping"); return end + if #depth > 3*5 then print(depth.."Recursion too deep - stopping"); return end for i,v in pairs(table) do if( type(v) == "string" ) then - bsk:Print(depth .. i .. " - " .. v) + print(depth .. i .. " - " .. v) elseif( type(v) == "number" ) then - bsk:Print(depth .. i .. " - " .. tostring(v)) + print(depth .. i .. " - " .. tostring(v)) elseif( type(v) == "table" ) then - bsk:Print(depth .. i .." - ") + print(depth .. i .." - ") PrintTable(v,depth.." ") elseif( type(v) == "boolean" ) then - bsk:Print(depth .. i .. " - " .. tostring(v)) + print(depth .. i .. " - " .. tostring(v)) elseif( type(v) == "function" ) then - bsk:Print(depth .. "function " .. i .. "()") + print(depth .. "function " .. i .. "()") else - bsk:Print(depth .. i .. " - not sure how to print type: " .. type(v) ) + print(depth .. i .. " - not sure how to print type: " .. type(v) ) end end end function PrintRaidAndReserve() - bsk:Print("RaidNameP") + print("RaidNameP") PrintTable(raidNameP) - bsk:Print("RaidIdP") + print("RaidIdP") PrintTable(raidIdP) - bsk:Print("ReserveP") + print("ReserveP") PrintTable(reserveIdP) - bsk:Print("personName2id") + print("personName2id") PrintTable(personName2id) end --}}} @@ -192,7 +192,7 @@ end end --- Czohange processing {{{ +-- Change processing {{{ function CreateWorkingStateFromChanges(changes) local personsBase = db.profile.persons local lists = db.profile.lists @@ -261,7 +261,7 @@ elseif change.action == "SuicidePerson" then DoSuicidePerson(change) else - bsk:Print("Unknown message encountered") + print("Unknown message encountered") PrintTable(change) assert(false) end @@ -335,20 +335,20 @@ local guid = _G.UnitGUID(name) -- TODO: check guid to be sure it's a player if not guid then - bsk:Print(sformat("Could not add player %s - they must be in range or group",name)) + printf("Could not add player %s - they must be in range or group",name) return end local _,englishClass = _G.UnitClass(name) - --bsk:Print("Person " .. name .. " is class " .. englishClass) + --print("Person " .. name .. " is class " .. englishClass) local id = string.sub(guid,6) -- skip at least 0x0580 ... id = id:gsub("^0*(.*)","%1") -- nom all leading zeroes remaining if persons[id] and persons[id] ~= name then - bsk:Print(sformat("Namechange detected for %s - new is %s, please rename the existing entry", persons[id].main, name)) + printf("Namechange detected for %s - new is %s, please rename the existing entry", persons[id].main, name) return end if persons[id] ~= nil then - bsk:Print(sformat("%s is already in the persons list; disregarding", name)) + printf("%s is already in the persons list; disregarding", name) return end local change = {action="AddPerson",arg={name=name,id=id,class=englishClass}} @@ -358,7 +358,7 @@ end--}}} function DoCreateList(change)--{{{ --if GetListIndex(change.arg.name) then - -- bsk:Print(sformat("List %s already exists",v.name)) + -- rintf(("List %s already exists",v.name) -- return false --end lists[change.arg.id]={name=change.arg.name,time=change.time} @@ -369,7 +369,7 @@ local change={action="CreateList",arg={name=name}} StartChange(change) change.arg.id=change.time -- use the creation timestamp as the list's index. it's as unique as anything... - bsk:Print("Creating ... " .. name) + print("Creating ... " .. name) if DoCreateList(change) then CommitChange(change) end @@ -395,10 +395,10 @@ local listIndex = GetListIndex(listName) local id = personName2id[name] if IdIsInList(id,lists[listIndex]) then - bsk:Print(sformat("Person %s is already on the reqeuested list",name)) + printf("Person %s is already on the reqeuested list",name) return false end - bsk:Print(sformat("Adding %s (%s) to list %s (%s)", name, id, listName, listIndex)) + printf("Adding %s (%s) to list %s (%s)", name, id, listName, listIndex) local change = {action="AddToListEnd",arg={id=id,listIndex=listIndex}} StartChange(change) if DoAddPersonToListEnd(change) then @@ -419,16 +419,16 @@ -- require admin local listIndex = GetListIndex(listName) if lists[listIndex].closedRandom then - bsk:Print("Cannot add person to list by random roll because an add-to-end operation has already occurred") + print("Cannot add person to list by random roll because an add-to-end operation has already occurred") return false end local id = personName2id[name] if IdIsInList(id,lists[listIndex]) then - bsk:Print(sformat("Person %s is already on the reqeuested list",name)) + printf("Person %s is already on the reqeuested list",name) return false end local roll = math.random() - bsk:Print(sformat("Adding %s (%s) to list %s (%s) with roll (%f)", name, id, listName, listIndex, roll)) + printf("Adding %s (%s) to list %s (%s) with roll (%f)", name, id, listName, listIndex, roll) local change = {action="AddToListRand",arg={id=id,listIndex=listIndex,roll=roll}} StartChange(change) if DoAddPersonToListRandom(change) then @@ -445,7 +445,7 @@ function RemovePerson(name)--{{{ local id = personName2id[name] if not id then - bsk:Print(sformat("%s is not in the persons list, please check your spelling", name)) + printf("%s is not in the persons list, please check your spelling", name) return false end local listsTheyreOn = {} @@ -457,7 +457,7 @@ end end if getn(listsTheyreOn) > 0 then - bsk:Print(sformat("Cannot remove person %s because they are on one or more lists (%s)",name,table.concat(listsTheyreOn,", "))) + printf("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}} @@ -476,7 +476,7 @@ local replacement = shallowCopy(change.arg.affect) local temp = table.remove(replacement,1) -- pop tinsert(replacement,temp) -- push_back - --bsk:Print(sformat("Before suicide of %s on list %s",slist[1],list.name)) + --rintf(("Before suicide of %s on list %s",slist[1],list.name) --PrintTable(list) for i = 1, #list do if list[i].id == affected[1] then @@ -555,7 +555,7 @@ function TrimLists(time) if not CheckListCausality() then - bsk:Print("Unable to trim changelist due to violated causality") + print("Unable to trim changelist due to violated causality") return false end @@ -595,7 +595,7 @@ end for name,_ in pairs(raidNameP) do if personName2id[name] == nil then - bsk:Print(sformat("Person %s is missing from the persons list - adding",name)) + printf("Person %s is missing from the persons list - adding",name) AddPerson(name) end end @@ -644,7 +644,7 @@ -- reserves function AddReserve(name) - bsk:Print("Reserving" .. name) + print("Reserving" .. name) reserveIdP[personName2id[name]]=true -- TODO: communicate to others. don't store this in any way. end @@ -711,7 +711,7 @@ function GetSuicideList(id,list) - --bsk:Print("Calculating changeset for "..name.." from list -") + --print("Calculating changeset for "..name.." from list -") --PrintTable(list) local t = {} local ret = {} @@ -724,9 +724,9 @@ tinsert(ret,list[i].id) end end - --bsk:Print("GSL") + --print("GSL") --PrintTable(ret) - --bsk:Print("GSL") + --print("GSL") return ret end