diff Main.lua @ 520:3fee2a08fdaa 7.1.0-4

Attempted a hacky workaround for detecting Ephemeral Crystals (English clients only).
author MMOSimca <mmosimca@gmail.com>
date Tue, 08 Nov 2016 19:06:58 -0500
parents 2325dbe5c10a
children 39c3576943ba
line wrap: on
line diff
--- a/Main.lua	Tue Nov 08 19:05:42 2016 -0500
+++ b/Main.lua	Tue Nov 08 19:06:58 2016 -0500
@@ -49,6 +49,10 @@
 
 local ITEM_ID_TIMBER = 114781
 
+local LOOT_SLOT_CURRENCY = _G.LOOT_SLOT_CURRENCY
+local LOOT_SLOT_ITEM = _G.LOOT_SLOT_ITEM
+local LOOT_SLOT_MONEY = _G.LOOT_SLOT_MONEY
+
 local LOOT_SOURCE_ID_REDUNDANT = 3
 local LOOT_SOURCE_ID_GARRISON_CACHE = 10
 
@@ -63,9 +67,7 @@
 local PLAYER_NAME = _G.UnitName("player")
 local PLAYER_RACE = _G.select(2, _G.UnitRace("player"))
 
-local LOOT_SLOT_CURRENCY = _G.LOOT_SLOT_CURRENCY
-local LOOT_SLOT_ITEM = _G.LOOT_SLOT_ITEM
-local LOOT_SLOT_MONEY = _G.LOOT_SLOT_MONEY
+local SPELL_ID_UPDATE_INTERACTIONS = 161006
 
 local WORLD_MAP_ID_BROKEN_ISLES = 1007
 
@@ -3010,6 +3012,14 @@
         return
     end
 
+    -- For Ephemeral Crystals (uses a combination of mouseover text and a 'Update Interactions' spell cast to detect the object - this is incredibly hacky but there is no alternative)
+    local text = _G["GameTooltipTextLeft1"] and _G["GameTooltipTextLeft1"]:GetText() or nil
+    if spell_id == SPELL_ID_UPDATE_INTERACTIONS and text and text == "Ephemeral Crystal" then
+        for index = 1, #private.EPHEMERAL_CRYSTAL_OBJECT_IDS do
+            UpdateDBEntryLocation("objects", private.EPHEMERAL_CRYSTAL_OBJECT_IDS[index])
+        end
+    end
+
     if anvil_spell_ids[spell_id] then
         UpdateDBEntryLocation("objects", OBJECT_ID_ANVIL)
     elseif forge_spell_ids[spell_id] then