View Single Post
07-22-13, 04:23 PM   #9
Niketa
A Wyrmkin Dreamwalker
 
Niketa's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2013
Posts: 54
Just an update what I came up with so far is this:


Code:
local timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName = ...
enemy = NPCID(sourceName)
	
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
		for k,v in pairs(ml_bosses) do
			if v == enemy and methodtrigger ~= 1 then
				method, threshold = GetLootMethod(), GetLootThreshold()
				print("|cff00ff00MountLooter: Master Looter set! Will revert back to \""..method.."\" loot method and threshold "..threshold.." when boss is killed.")
				SetLootMethod("master",UnitName("player"))
				methodtrigger = 1 -- prevents spam
				break
			end
		end
	end
Just a couple notes on that... I've defined my variables outside of this as local already so no worries about what looks like names that would likely conflict with other addons and stuff. Also this is obviously inside my f:SetScript.

ml_bosses is the table where I have the NPCIDs of the bosses I want stored. The NPCID() function is just a function I made with the conversion from GUID to NPCID. methodtrigger prevents spam since it will set the value to 1 the first time a correct NPC is found in the combat log and I have the code if statement dependent of this being ~= 1.

Further on in the "LOOT_OPENED" event I'll set methodtrigger = nil so it can rinse and repeat for other bosses.


I have only been able to test it so far on Onyxia and some mobs outside because I'm trying to finish up the rest of the coding before I check others. For now I just need a place to stay and test. So far it's working.

Thanks for the pointers and further tips are still appreciated, I will be checking back in (especially because I haven't been able to test everything yet, so I might still have problems!).


Also because I don't want to spam a bunch of posts in this forum, I do have another question.

I created two frames that I was using to handle my events. One I made as a sort of welcome frame that defines appropriate variables when entering the world and prints a message depending on whether or not the player is in an instance and raid leader. I set it so that if these criterion were met if would register events to the second frame to enable the functionality of the addon (so that it wouldn't register the events frame two was watching if, for example, you weren't even raid leader, etc).

I registered the COMBAT_LOG_EVENT_UNFILTERED to frame two and it works just fine. However when I try to register "LOOT_OPENED" to the same frame it doesn't work. The event fires but it won't execute the if statement I set. For debugging purposes I registered it to my welcome frame instead and it worked.

So, does COMBAT_LOG_EVENT_UNFILTERED have to have its own frame or is there another issue going on here?

Last edited by Niketa : 07-22-13 at 04:45 PM.
  Reply With Quote