Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local resources = 0
- function MiniGameEvent(self, event)
- if event == 0 then
- PlaySound("igSpellBookOpen");
- self:Show();
- MinigameFrame:SetFrameStrata("BACKGROUND")
- elseif event == 1 then
- self:Hide();
- end
- end
- function PurchaseWeakGhoul()
- if resources > 4 then
- SendChatMessage("[CU-ADDON] SpawnWeakGhouls", "WHISPER", nil, UnitName("player"))
- end
- end
- function PurchaseSpellcaster()
- if resources > 6 then
- SendChatMessage("[CU-ADDON] SpawnSpellcaster", "WHISPER", nil, UnitName("player"))
- end
- end
- function PurchaseAbomination()
- if resources > 49 then
- SendChatMessage("[CU-ADDON] SpawnAbomination", "WHISPER", nil, UnitName("player"))
- end
- end
- function PurchaseTurret(self,num)
- if resources > 29 then
- self:Disable()
- if num == 0 then -- R
- SendChatMessage("[CU-ADDON] TurretR", "WHISPER", nil, UnitName("player"))
- else
- SendChatMessage("[CU-ADDON] TurretL", "WHISPER", nil, UnitName("player"))
- end
- end
- end
- function Upgrade_Unit(self, num)
- if resources > 49 then
- self:Disable()
- if num == 0 then -- upgrade ghouls
- else -- upgrade necromancers
- end
- end
- end
- ChatFrame_MessageEvnt3 = ChatFrame_MessageEventHandler
- function ChatFrame_MessageEventHandler(s,e,arg1,...)
- if arg1 ~= nil then
- if arg1 ~= "" then
- if string.find(arg1, "[CU-ADDON]", 1, true) ~= nil then
- if (arg1 == "[CU-ADDON] OpenMinigame") then
- MiniGameEvent(MinigameFrame, 0);
- elseif (arg1 == "[CU-ADDON] CloseMiniGame") then
- MiniGameEvent(MinigameFrame, 1);
- elseif (string.find(arg1, "[CU-ADDON] minigame-resources : ", 1, true) ~= nil) then
- local nums = scen_split(arg1)
- if #nums == 1 then
- MiniGameResourcesButton.label:SetText("Resources:\n"..nums[1])
- resources = tonumber(nums[1])
- end
- end
- return;
- end
- end
- end
- ChatFrame_MessageEvnt3(s,e,arg1,...)
- end
- function scen_split(str)
- local b = {}
- local c = 1
- local d = {}
- string.gsub(str, "[%d]", function(a)
- if (a == "-") then
- c = c + 1
- else
- if (not b[c]) then
- b[c] = {}
- end
- table.insert(b[c], a)
- end
- end)
- for k, v in pairs (b) do
- table.insert(d, table.concat(v))
- end
- return d
- end
Advertisement
Add Comment
Please, Sign In to add comment