Quantcast

Move guildName to encounter table.

Peter Eliasson [08-07-16 - 16:14]
Move guildName to encounter table.
Filename
src/highscore.lua
src/main.lua
diff --git a/src/highscore.lua b/src/highscore.lua
index f2cf2b0..49f5e18 100644
--- a/src/highscore.lua
+++ b/src/highscore.lua
@@ -20,6 +20,7 @@ local format = format;
 local ipairs = ipairs;
 local pairs = pairs;
 local assert = assert;
+local type = type;


 -- Set up module
@@ -251,15 +252,15 @@ local function addEncounterParseForPlayer(parsesTable, player, groupParseId)
 	tinsert(parsesTable, parse);
 end

-function highscore:AddEncounterParsesForPlayers(guildName, encounter, players)
+function highscore:AddEncounterParsesForPlayers(encounter, players)
 	local db = self:GetDB()

 	-- Theses checks _should_ never fail. Something might fail though,
 	-- so these are here as a final safe-guard against bad data being
 	-- inserted into the db (which could be very hard to fix later on).
-	guildName = assert(guildName);
 	encounter = assert(encounter and type(encounter) == "table");
 	players = assert(players);
+	local guildName = assert(encounter.guildName);
 	local zoneId = assert(encounter.zoneId);
 	local zoneName = assert(encounter.zoneName);
 	local encounterId = assert(encounter.id);
diff --git a/src/main.lua b/src/main.lua
index 79a8124..a373d4f 100644
--- a/src/main.lua
+++ b/src/main.lua
@@ -169,6 +169,7 @@ function addon:OnEncounterEndSuccess(encounterId, encounterName, difficultyId, r
 	end

 	local encounter = {
+		guildName = guildName,
 		zoneId = zoneId,
 		zoneName = zoneName,
 		id = encounterId,
@@ -190,7 +191,7 @@ function addon:OnEncounterEndSuccess(encounterId, encounterName, difficultyId, r
 		encounter.duration = duration;

 		addon.inspect:GetInspectDataForPlayers(players, function()
-			addon.highscore:AddEncounterParsesForPlayers(guildName, encounter, players);
+			addon.highscore:AddEncounterParsesForPlayers(encounter, players);
 		end);
 	end);
 end