# HG changeset patch # User James D. Callahan III # Date 1337716179 18000 # Node ID bdb3d8a2c3a7e15bba9ab9a4cc932e4a581eef75 # Parent 5802628b2bf07b74501c557203d4e41835c238a1 Slight re-structuring for proper serialization in the web service. diff -r 5802628b2bf0 -r bdb3d8a2c3a7 Main.lua --- a/Main.lua Tue May 22 12:38:35 2012 -0500 +++ b/Main.lua Tue May 22 14:49:39 2012 -0500 @@ -109,6 +109,7 @@ local instance_token = InstanceDifficultyToken() npc.encounter_data = npc.encounter_data or {} npc.encounter_data[instance_token] = npc.encounter_data[instance_token] or {} + npc.encounter_data[instance_token].stats = npc.encounter_data[instance_token].stats or {} return npc end @@ -356,7 +357,7 @@ return end local zone_name, area_id, x, y, map_level, instance_token = CurrentLocationData() - local npc_data = NPCEntry(unit_idnum).encounter_data[instance_token][("level_%d"):format(_G.UnitLevel("target"))] + local npc_data = NPCEntry(unit_idnum).encounter_data[instance_token].stats[("level_%d"):format(_G.UnitLevel("target"))] local location_token = ("%s:%d"):format(zone_name, area_id) npc_data.locations = npc_data.locations or {} npc_data.locations[location_token] = npc_data.locations[location_token] or {} @@ -423,7 +424,7 @@ if not npc then return end - local encounter_data = npc.encounter_data[InstanceDifficultyToken()] + local encounter_data = npc.encounter_data[InstanceDifficultyToken()].stats encounter_data[action_data.npc_level].reputations = encounter_data[action_data.npc_level].reputations or {} encounter_data[action_data.npc_level].reputations[faction_name] = amount end @@ -777,7 +778,7 @@ npc.is_pvp = _G.UnitIsPVP("target") and true or nil npc.reaction = ("%s:%s:%s"):format(_G.UnitLevel("player"), _G.UnitFactionGroup("player"), REACTION_NAMES[_G.UnitReaction("player", "target")]) - local encounter_data = npc.encounter_data[InstanceDifficultyToken()] + local encounter_data = npc.encounter_data[InstanceDifficultyToken()].stats local npc_level = ("level_%d"):format(_G.UnitLevel("target")) if not encounter_data[npc_level] then