Quantcast

Working on memory allocation

Alar of Daggerspine [07-20-15 - 10:26]
Working on memory allocation

Signed-off-by: Alar of Daggerspine <alar@aspide.it>
Filename
PartyCache.lua
diff --git a/PartyCache.lua b/PartyCache.lua
index 059ff44..66eddf7 100644
--- a/PartyCache.lua
+++ b/PartyCache.lua
@@ -13,6 +13,7 @@ local type=type
 local pairs=pairs
 local format=format
 -- Temporary party management
+local empty={}
 local parties=setmetatable({},{
 	__index=function(t,k)  rawset(t,k,
 		{
@@ -24,7 +25,8 @@ local parties=setmetatable({},{
 			xpBonus=0,
 			gold=0,
 			goldMultiplier=1,
-			materialMultiplier=1,
+			partyBuffs=empty,
+			materialMultiplier=empty,
 			resources=0,
 			totalTimeString="Not Running",
 			totalTimeSeconds=0
@@ -199,13 +201,20 @@ end
 function addon:GetParties()
 	return self:GetParty()
 end
+
 function addon:GetParty(missionID,key,default)
 	if not missionID then return parties end
 	local party=parties[missionID]
+	if not party then print(GetTime(),missionID,G.GetMissionName(missionID),"Empty") end
+	if not party then return default end
 	if #party.members==0 and G.GetNumFollowersOnMission(missionID)>0 then
+		if not party.perc or party.perc < 1 then
+			party.perc=G.GetMissionSuccessChance(missionID)
+		end
 		--Running Mission, taking followers from mission data
 		local followers=self:GetMissionData(missionID,'followers')
-		addPartyMissionInfo(party,missionID)
+		print(followers)
+		--addPartyMissionInfo(party,missionID)
 		if followers then
 			for i=1,#followers do
 				party.members[i]=followers[i]
@@ -213,7 +222,7 @@ function addon:GetParty(missionID,key,default)
 		end
 	end
 	if key then
-		return party[key]
+		return party[key] or default
 	else
 		return party
 	end