Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Testing Events.

  • Loading branch information...
commit 5d5537542adbb4c86092e87c4b1c80546b8c72e2 1 parent d0246b4
AlphaDio authored April 17, 2012

Showing 1 changed file with 7 additions and 69 deletions. Show diff stats Hide diff stats

  1. 76  BattleAdvisor.lua
76  BattleAdvisor.lua
@@ -20,7 +20,8 @@ function BattleAdvisorAddon:OnInitialize()
20 20
     loadBattlegrounds()
21 21
 
22 22
     BattleAdvisorAddon:RegisterEvent("ZONE_CHANGED_NEW_AREA", "ZoneChanged")
23  
-    BattleAdvisorAddon:RegisterEvent("CHAT_MSG_BATTLEGROUND", "CommunicationEvent")
  23
+    -- BattleAdvisorAddon:RegisterEvent("CHAT_MSG_BATTLEGROUND", "CommunicationEvent")
  24
+    BA_MainFrame:RegisterEvent("CHAT_MSG_BATTLEGROUND");
24 25
 end
25 26
 
26 27
 -- When the addon is enabled.
@@ -235,7 +236,6 @@ function BattleAdvisor_OnLoad()
235 236
     -- Register the necessary events
236 237
     
237 238
     --
238  
-    BA_MainFrame:RegisterEvent("CHAT_MSG_BATTLEGROUND");
239 239
     -- Whenever we change zone, for example enter a battleground
240 240
     BA_MainFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
241 241
     -- Whenever an event on Horde side happens
@@ -259,74 +259,10 @@ function BattleAdvisor_OnEvent()
259 259
 
260 260
     -- When a player whisper us, need to find a way to distribute the workload among people
261 261
     if event == "CHAT_MSG_BATTLEGROUND" then
262  
-        
  262
+        print("BOOYAAAAHHHHHHH")
263 263
     end
264 264
 
265  
-    -- If it is a BG Horde message
266  
-    if event == "CHAT_MSG_BG_SYSTEM_HORDE" or 
267  
-            event == "CHAT_MSG_BG_SYSTEM_ALLIANCE" or 
268  
-            event == "CHAT_MSG_BG_SYSTEM_NEUTRAL" then
269  
-        BattleAdvisor_BGEvent(arg1);
270  
-    end
271  
-    
272  
-    -- Everytime we have an event on the BG
273  
-    if event == "UPDATE_BATTLEFIELD_STATUS" then
274  
-        
275  
-    end
276  
-    
277  
-    -- If it is a change of zone, possibly entering a BG
278  
-    if (event == "ZONE_CHANGED_NEW_AREA") then
279  
-        print("Zone Changed!!");
280  
-        
281  
-        -- Unlock the BG buttons so that they can be used
282  
-        -- // Should automatize this
283  
-        unlockMode();
284  
-        
285  
-        -- Get the location we just entered
286  
-        local location = GetRealZoneText();
287  
-        
288  
-        -- Check if we are actually in a Battleground
289  
-        if isBG(location) then
290  
-            -- We must reset the addon
291  
-            BA_MainFrame:Show();
292  
-        else
293  
-            BA_MainFrame:Hide();
294  
-        end
295  
-        
296  
-    end
297  
-    
298  
-    -- If it is the loading of the AddOn
299  
-    if event == "ADDON_LOADED" and arg1 == "BattleAdvisor" then
300  
-    
301  
-        -- Load the variables for the different battlegrounds
302  
-        loadBattlegrounds();
303  
-        
304  
-        isAvailable = "true";
305  
-        standing = 1; -- Default standing
306  
-        playerName, playerRealm = UnitName("player", true);
307  
-    
308  
-        -- Create a general Frame
309  
-        -- BA_GeneralFrame =
310  
-        --     CreateFrame("Frame", "BA_GeneralFrame", UIParent, "BA_TemplateMainFrame");
311  
-    
312  
-        -- createMainFrame();
313  
-        createPanelFrame();
314  
-        
315  
-        -- Tell the rest of the program that the variables are
316  
-        -- ready
317  
-        enabled = true;
318  
-        
319  
-        print("Variables Available!!");
320  
-    end
321  
-    
322  
-    -- The handling of the role asking distribution
323  
-    if event == "CHAT_MSG_ADDON" then
324  
-        
325  
-        if arg1 == "BA" then
326  
-            handleMSG(arg2);
327  
-        end
328  
-    end
329  
-    
  265
+   
330 266
 end
331 267
 
332 268
 -- This function role is to handle when we receive a addon message and redistribute
@@ -644,7 +580,7 @@ function BattleAdvisorAddon:CommunicationEvent(arg1, arg2)
644 580
     local tempPlayer;
645 581
     local found     = false;
646 582
 
647  
-    if arg1 == "advice" then
  583
+    if message == "advice" then
648 584
         print("Got a Request!")
649 585
         for i=1, nums do
650 586
             tempPlayer = {GetRaidRosterInfo(i)};
@@ -700,6 +636,8 @@ function AddToMessageQueue(tempPlayer, roleTitle, roleDescription)
700 636
 end
701 637
 
702 638
 function BattleAdvisorAddon:ZoneChanged()
  639
+    --
  640
+    print("Zone Changed, Resetting!")
703 641
     -- Empty the queue of messages just in case.
704 642
     queue = {}
705 643
     -- Empty the array of players already treated.

0 notes on commit 5d55375

Please sign in to comment.
Something went wrong with that request. Please try again.