Mercurial > wow > askmrrobot
comparison AskMrRobot-Serializer/AskMrRobot-Serializer.lua @ 91:b8e9664d3229 v43
option to disable equipment manager sets, minor artifact/talent bug fixes
| author | yellowfive | 
|---|---|
| date | Wed, 21 Sep 2016 00:14:22 -0700 | 
| parents | 6bbe64d587b4 | 
| children | 177391341e26 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 90:db63475ef5d4 | 91:b8e9664d3229 | 
|---|---|
| 1 -- AskMrRobot-Serializer will serialize and communicate character data between users. | 1 -- AskMrRobot-Serializer will serialize and communicate character data between users. | 
| 2 -- This is used primarily to associate character information to logs uploaded to askmrrobot.com. | 2 -- This is used primarily to associate character information to logs uploaded to askmrrobot.com. | 
| 3 | 3 | 
| 4 local MAJOR, MINOR = "AskMrRobot-Serializer", 42 | 4 local MAJOR, MINOR = "AskMrRobot-Serializer", 43 | 
| 5 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) | 5 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) | 
| 6 | 6 | 
| 7 if not Amr then return end -- already loaded by something else | 7 if not Amr then return end -- already loaded by something else | 
| 8 | 8 | 
| 9 -- event and comm used for player snapshotting on entering combat | 9 -- event and comm used for player snapshotting on entering combat | 
| 145 ["Alliance"] = 1, | 145 ["Alliance"] = 1, | 
| 146 ["Horde"] = 2 | 146 ["Horde"] = 2 | 
| 147 } | 147 } | 
| 148 | 148 | 
| 149 Amr.InstanceIds = { | 149 Amr.InstanceIds = { | 
| 150 Auchindoun = 1182, | 150 EmeraldNightmare = 1094, | 
| 151 BloodmaulSlagMines = 1175, | 151 Nighthold = 1530 | 
| 152 GrimrailDepot = 1208, | |
| 153 IronDocks = 1195, | |
| 154 ShadowmoonBurialGrounds = 1176, | |
| 155 Skyreach = 1209, | |
| 156 TheEverbloom = 1279, | |
| 157 UpperBlackrockSpire = 1358, | |
| 158 Highmaul = 1228, | |
| 159 BlackrockFoundry = 1205, | |
| 160 HellfireCitadel = 1448 | |
| 161 } | 152 } | 
| 162 | 153 | 
| 163 -- instances that AskMrRobot currently supports logging for | 154 -- instances that AskMrRobot currently supports logging for | 
| 164 Amr.SupportedInstanceIds = { | 155 Amr.SupportedInstanceIds = { | 
| 165 --[1182] = true, | 156 [1094] = true, | 
| 166 --[1175] = true, | 157 [1088] = true | 
| 167 --[1208] = true, | |
| 168 --[1195] = true, | |
| 169 --[1176] = true, | |
| 170 --[1209] = true, | |
| 171 --[1279] = true, | |
| 172 --[1358] = true, | |
| 173 [1228] = true, | |
| 174 [1205] = true, | |
| 175 [1448] = true | |
| 176 } | 158 } | 
| 177 | 159 | 
| 178 -- just to make life easier, maps ID of each artifact weapon to the spec number (1-4) | 160 -- just to make life easier, maps ID of each artifact weapon to the spec number (1-4) | 
| 179 Amr.ArtifactIdToSpecNumber = { | 161 Amr.ArtifactIdToSpecNumber = { | 
| 180 [128402] = 1, -- DK | 162 [128402] = 1, -- DK | 
| 745 return ret | 727 return ret | 
| 746 end | 728 end | 
| 747 | 729 | 
| 748 -- returns true if this is an instance that AskMrRobot supports for logging | 730 -- returns true if this is an instance that AskMrRobot supports for logging | 
| 749 function Amr.IsSupportedInstanceId(instanceMapID) | 731 function Amr.IsSupportedInstanceId(instanceMapID) | 
| 732 for k,v in pairs(Amr.SupportedInstanceIds) do | |
| 733 local instanceId = GetAreaMapInfo(k) | |
| 734 if instanceId == tonumber(instanceMapID) then | |
| 735 return true | |
| 736 end | |
| 737 end | |
| 738 return false | |
| 739 --[[ | |
| 750 if Amr.SupportedInstanceIds[tonumber(instanceMapID)] then | 740 if Amr.SupportedInstanceIds[tonumber(instanceMapID)] then | 
| 751 return true | 741 return true | 
| 752 else | 742 else | 
| 753 return false | 743 return false | 
| 754 end | 744 end | 
| 745 ]] | |
| 755 end | 746 end | 
| 756 | 747 | 
| 757 -- returns true if currently in a supported instance for logging | 748 -- returns true if currently in a supported instance for logging | 
| 758 function Amr.IsSupportedInstance() | 749 function Amr.IsSupportedInstance() | 
| 759 local zone, _, difficultyIndex, _, _, _, _, instanceMapID = GetInstanceInfo() | 750 local zone, _, difficultyIndex, _, _, _, _, instanceMapID = GetInstanceInfo() | 
| 1131 table.insert(fields, data.ActiveSpec) | 1122 table.insert(fields, data.ActiveSpec) | 
| 1132 for spec = 1, 4 do | 1123 for spec = 1, 4 do | 
| 1133 if data.Specs[spec] and (complete or spec == data.ActiveSpec) then | 1124 if data.Specs[spec] and (complete or spec == data.ActiveSpec) then | 
| 1134 table.insert(fields, ".s" .. spec) -- indicates the start of a spec block | 1125 table.insert(fields, ".s" .. spec) -- indicates the start of a spec block | 
| 1135 table.insert(fields, data.Specs[spec]) | 1126 table.insert(fields, data.Specs[spec]) | 
| 1136 table.insert(fields, data.Talents[spec]) | 1127 table.insert(fields, data.Talents[spec] or "") | 
| 1137 | 1128 | 
| 1138 local powerids = {} | 1129 local powerids = {} | 
| 1139 local powerranks = {} | 1130 local powerranks = {} | 
| 1140 local reliclinks = {} | 1131 local reliclinks = {} | 
| 1141 | 1132 | 
| 1183 -- if doing a complete export, include reputations and bank/bag items too | 1174 -- if doing a complete export, include reputations and bank/bag items too | 
| 1184 if complete then | 1175 if complete then | 
| 1185 | 1176 | 
| 1186 -- export reputations | 1177 -- export reputations | 
| 1187 local reps = {} | 1178 local reps = {} | 
| 1179 table.insert(reps, "_") | |
| 1180 --[[ | |
| 1188 local noreps = true | 1181 local noreps = true | 
| 1189 if data.Reputations then | 1182 if data.Reputations then | 
| 1190 for k, v in pairs(data.Reputations) do | 1183 for k, v in pairs(data.Reputations) do | 
| 1191 noreps = false | 1184 noreps = false | 
| 1192 table.insert(reps, k .. ":" .. v) | 1185 table.insert(reps, k .. ":" .. v) | 
| 1193 end | 1186 end | 
| 1194 end | 1187 end | 
| 1195 if noreps then | 1188 if noreps then | 
| 1196 table.insert(reps, "_") | 1189 table.insert(reps, "_") | 
| 1197 end | 1190 end | 
| 1198 | 1191 ]] | 
| 1192 | |
| 1199 table.insert(fields, ".r") | 1193 table.insert(fields, ".r") | 
| 1200 table.insert(fields, table.concat(reps, ",")) | 1194 table.insert(fields, table.concat(reps, ",")) | 
| 1201 | 1195 | 
| 1202 -- export bag and bank | 1196 -- export bag and bank | 
| 1203 local itemObjects = {} | 1197 local itemObjects = {} | 
