Mercurial > wow > breuesk
comparison Lists.lua @ 70:236117ab8a49
Decent sketch of what the communication system might look like
author | John@Yosemite-PC |
---|---|
date | Thu, 29 Mar 2012 23:24:51 -0400 |
parents | a177b863ed6c |
children | d5e2dfe0c269 |
comparison
equal
deleted
inserted
replaced
69:b7352f007028 | 70:236117ab8a49 |
---|---|
82 local assert=assert | 82 local assert=assert |
83 local getmetatable=getmetatable | 83 local getmetatable=getmetatable |
84 local setmetatable=setmetatable | 84 local setmetatable=setmetatable |
85 setfenv(1,bsk) | 85 setfenv(1,bsk) |
86 | 86 |
87 local changeListener = nil -- todo: really should not be scoped like this | 87 changeListener = nil -- todo: really should not be scoped like this |
88 | 88 |
89 ListEntry = | 89 ListEntry = |
90 { | 90 { |
91 index = 0.0, | 91 index = 0.0, |
92 id = 0, | 92 id = 0, |
529 function PersonList:AddReserve(id) | 529 function PersonList:AddReserve(id) |
530 local le = self:Select(id) | 530 local le = self:Select(id) |
531 if le then | 531 if le then |
532 -- todo: check that they're not already reserved | 532 -- todo: check that they're not already reserved |
533 self.active.reserve[le:GetId()] = true | 533 self.active.reserve[le:GetId()] = true |
534 end | 534 return true |
535 changeListener:DataEvent() -- todo: revisit | 535 end |
536 end | 536 end |
537 -- todo: remove reserve | 537 -- todo: remove reserve |
538 function PersonList:IsActive(id) -- todo: support LE as input - saves IsActive(le:GetId()) | 538 function PersonList:IsActive(id) -- todo: support LE as input - saves IsActive(le:GetId()) |
539 return self.active.raid[id] or self.active.reserve[id] | 539 return self.active.raid[id] or self.active.reserve[id] |
540 end | 540 end |
628 table.insert(db.profile.changes,change) | 628 table.insert(db.profile.changes,change) |
629 if changeListener then | 629 if changeListener then |
630 changeListener:DataEvent(change) | 630 changeListener:DataEvent(change) |
631 end | 631 end |
632 -- TODO: broadcast | 632 -- TODO: broadcast |
633 Comm:SendChange(change) | |
633 return arg | 634 return arg |
634 else | 635 else |
635 return nil | 636 return nil |
636 end | 637 end |
637 end | 638 end |
816 print("Removing " .. person) | 817 print("Removing " .. person) |
817 PersonList:Remove(person) | 818 PersonList:Remove(person) |
818 end | 819 end |
819 function ReservePerson(person) | 820 function ReservePerson(person) |
820 print("Reserving " .. person) | 821 print("Reserving " .. person) |
821 PersonList:AddReserve(person) | 822 if PersonList:AddReserve(person) then -- todo: would be better if this were an ID ... |
823 Comm:AddReserve(person) | |
824 end | |
822 end | 825 end |
823 --}}} | 826 --}}} |
824 -- Higher order actions (ie calls other standard actions){{{ | 827 -- Higher order actions (ie calls other standard actions){{{ |
825 | 828 |
826 function TrimLists(time) | 829 function TrimLists(time) |