comparison Main.lua @ 484:679e2846ff88

Replaced 'GetCvar("portal")' with the library LibRealmInfo in order to get accurate server and region information (needed for world quest data recording).
author MMOSimca <mmosimca@gmail.com>
date Tue, 06 Sep 2016 09:31:06 -0400
parents 271132f4fa77
children 5e5ddb69f845
comparison
equal deleted inserted replaced
483:271132f4fa77 484:679e2846ff88
24 local LibStub = _G.LibStub 24 local LibStub = _G.LibStub
25 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0") 25 local WDP = LibStub("AceAddon-3.0"):NewAddon(ADDON_NAME, "AceConsole-3.0", "AceEvent-3.0")
26 26
27 local deformat = LibStub("LibDeformat-3.0") 27 local deformat = LibStub("LibDeformat-3.0")
28 local HereBeDragons = LibStub("HereBeDragons-1.0") 28 local HereBeDragons = LibStub("HereBeDragons-1.0")
29 local LibRealmInfo = LibStub("LibRealmInfo")
29 30
30 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate") 31 local DatamineTT = _G.CreateFrame("GameTooltip", "WDPDatamineTT", _G.UIParent, "GameTooltipTemplate")
31 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE") 32 DatamineTT:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
32 33
33 34
838 global_db = db.global 839 global_db = db.global
839 char_db = db.char 840 char_db = db.char
840 841
841 local raw_db = _G.WoWDBProfilerData 842 local raw_db = _G.WoWDBProfilerData
842 local build_num = tonumber(private.build_num) 843 local build_num = tonumber(private.build_num)
843 844
845 -- Get current region from LibRealmInfo (and account for the fact that PTR and Beta return nil)
846 local current_region = LibRealmInfo:GetCurrentRegion() or "XX"
847
848 -- Wipe all data if DB version or build number changed
844 if (raw_db.version and raw_db.version < DB_VERSION) or (raw_db.build_num and raw_db.build_num < build_num) then 849 if (raw_db.version and raw_db.version < DB_VERSION) or (raw_db.build_num and raw_db.build_num < build_num) then
845 for entry in pairs(DATABASE_DEFAULTS.global) do 850 for entry in pairs(DATABASE_DEFAULTS.global) do
846 global_db[entry] = {} 851 global_db[entry] = {}
847 end 852 end
848 end 853 end
849 raw_db.build_num = build_num 854 raw_db.build_num = build_num
850 raw_db.region = private.region 855 raw_db.region = current_region
851 raw_db.version = DB_VERSION 856 raw_db.version = DB_VERSION
852 857
853 private.InitializeCommentSystem() 858 private.InitializeCommentSystem()
854 self:RegisterChatCommand("comment", private.ProcessCommentCommand) 859 self:RegisterChatCommand("comment", private.ProcessCommentCommand)
855 end 860 end
928 local instance_difficulty_id = tonumber(item_results[13]) or 0 933 local instance_difficulty_id = tonumber(item_results[13]) or 0
929 local num_bonus_ids = tonumber(item_results[14]) or 0 934 local num_bonus_ids = tonumber(item_results[14]) or 0
930 -- upgrade_value is optional in 6.2! can be detected using upgrade_type_id, but it's just as easy to check like this 935 -- upgrade_value is optional in 6.2! can be detected using upgrade_type_id, but it's just as easy to check like this
931 local upgrade_value = tonumber(item_results[15 + num_bonus_ids]) or 0 936 local upgrade_value = tonumber(item_results[15 + num_bonus_ids]) or 0
932 937
933 local unkItemField1 = tonumber(item_results[16 + num_bonus_ids]) or 0 938 local unk_item_field_1 = tonumber(item_results[16 + num_bonus_ids]) or 0
934 local unkItemField2 = tonumber(item_results[17 + num_bonus_ids]) or 0 939 local unk_item_field_2 = tonumber(item_results[17 + num_bonus_ids]) or 0
935 if unkItemField1 > 0 then Debug("unkItemField1 is non-zero, specifically %d.", unkItemField1) end 940 --if unk_item_field_1 > 0 then Debug("unk_item_field_1 for %s is non-zero, specifically %d.", item_link, unk_item_field_1) end
936 if unkItemField2 > 0 then Debug("unkItemField2 is non-zero, specifically %d.", unkItemField2) end 941 --if unk_item_field_2 > 0 then Debug("unk_item_field_2 for %s is non-zero, specifically %d.", item_link, unk_item_field_2) end
937 942
938 -- If there is anything special (non-zero) for this item then we need to make note of everything 943 -- If there is anything special (non-zero) for this item then we need to make note of everything
939 if math.max(suffix_id, instance_difficulty_id, num_bonus_ids, upgrade_value) ~= 0 then 944 if math.max(suffix_id, instance_difficulty_id, num_bonus_ids, upgrade_value) ~= 0 then
940 item = DBEntry("items", item_id) 945 item = DBEntry("items", item_id)
941 item.suffix_id = suffix_id 946 item.suffix_id = suffix_id