• 0

    posted a message on Some things that could be improved in these forums...

    Hi there!

     

    I am new to the curseforge community as a publishing AddOn author and I don't know the old forums too well. But while writing a thread here a few minutes ago, I noticed a few things that might could be improved.

     

    > The function "Insert a code block":

    - Doesn't support <em>formatting correctly</em> and displays <strong>the code</strong> for the formatting in the created thread...<span style="text-decoration: underline;">as you can see here</span>.
    - It is hard to read the actual code when the lines are a bit longer and therefore wrap to the next line. That shouldn't happen at all in a code-block. Some sort of scrollbar for these blocks would be great!<br />- After the block is inserted, editing it with copy &amp; paste sometimes had odd results.

    > The "Preview" button doesn't work properly. Well, that was unexpected...

     

    I didn't try much more until now, but at least these things really bothered my while writing the thread.

     

     

    If YOU also experienced something that could be improved for these forums, post it below! Maybe one of the devs behind it will find one or two things to actually implement one time. At least the hope dies last... ;)

    Posted in: WoW Sites Feedback
  • 0

    posted a message on Collecting related data from different WoW events

    Hi there!

     

    I want to link two different WoW events together. I need some information from both events and store them together in a simple table. Also it is important that the data of the second event is stored only if the first event even fired!

     

     

    FIRST THE SHORT STORY:

    In my case its the name of a creature from "COMBAT_LOG_EVENT_UNFILTERED" and the reputation gained from "COMBAT_TEXT_UPDATE". The reputation should only be stored, if it is gained from killing a creature. I am currently doing that with a temporary table to link those. It stores the name from the first event and will be readable in the second event. Here's the simplified code for that:

     

     

    nehFragger_ReputationDB = {}   — The actual database for my AddOn.
    local TempKillLog = {}   — A table that I use to link the different events.
    
    function nehFraggerFrame_OnLoad(frame)
    	frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    	frame:RegisterEvent("COMBAT_TEXT_UPDATE")
    end
    
    function nehFraggerFrame_OnEvent(frame, event, ...)
    
    	local arg1, eventType, arg3, arg4, sourceName, arg6, arg7, destGUID, destName = select(1, ...)
    	if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
    		if (eventType == "PARTY_KILL") then
    			TempKillLog.creatureGUID = destGUID   — The unique identifier of the creature.
    			TempKillLog.creatureName = destName    — The creature name that I need.
    		end
    	end
    
    	local eventType, faction, reputation = select(1, ...)
    	if (event == "COMBAT_TEXT_UPDATE") then
    		if (eventType == "FACTION") then
    			local GUID = TempKillLog.creatureGUID
    			if (string.upper(string.sub(GUID, 1 , 8)) == "CREATURE") then   -- Make sure the link-table data really is a creature.
    				local creatureName = TempKillLog.creatureName   — The name from my link-table.
    				local reputationGain = reputation   — The reputation that I need.
    				— Simply store the stuff to the database table for this faction:
    				nehFragger_ReputationDB[faction] = {}
    				nehFragger_ReputationDB[faction].creatureName = creatureName
    				nehFragger_ReputationDB[faction].reputationGain = reputationGain
    			end
    		end
    	end
    
    end

     

    This works...sort of. There are several problems with that (see below in the long story).

     

    My question at this point is:

    Is there a possibility to either

    - get some unique identifier for the source of different events in general (like the destGUID of "COMBAT_LOG_EVENT") to connect those

    - or is there an even simpler way to get the reputation of a kill (including creature and reputation information) like in the case of my AddOn?

     

    If you don't want to read any further, that's OK. You'd still help me greatly if you can give me some hint or link or something regarding the question above. If you are one of the enthusiasts out there, feel free to read on! :)

     

     

    ###

     

     

    NOW THE LONG STORY FOR THE ENTHUSIASTS:

    I am trying to add a new feature to one of my simpler AddOns (nehFragger) and I wanted to keep it simple...but the problem described above seems to break that. At least I didn't figure out a simple or even properly working way to implement this.

     

    Oh, before someone asks: Yes, I am totally sure these two events follow up in this order each and every time a reputation-giving-creature is killed! I tested this quite some time.

     

    The above codes first error encountered was, if you killed any creature and then anytime after that gain reputation from some source like an item or a quest. This triggers the database storage, because the TempKillLog still has creatureGUID stored. So I implemented a timestamp to make sure, these two events need to be fired right after each other to store data. The addition looks like this:

     

     

    function nehFraggerFrame_OnEvent(frame, event, ...)
    
    	local arg1, eventType, arg3, arg4, sourceName, arg6, arg7, destGUID, destName = select(1, ...)
    	if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
    		if (eventType == "PARTY_KILL") then
    			TempKillLog.timestamp = GetTime()   -- Needed for checking validity with following WoW events.
    			TempKillLog.creatureGUID = destGUID
    			TempKillLog.creatureName = destName
    		end
    	end
    
    	local eventType, faction, reputation = select(1, ...)
    	if (event == "COMBAT_TEXT_UPDATE") then
    		if (eventType == "FACTION") then
    			local currentTS = GetTime()   — The time when this event is fired.
    			local LogTS = TempKillLog.timestamp   — The time when the first event fired.
    			if (LogTS <= currentTS) and (currentTS <= LogTS+0.1) then   -- Check, if TempKillLog data is still valid.
    				local GUID = TempKillLog.creatureGUID
    				if (string.upper(string.sub(GUID, 1 , 8)) == "CREATURE") then
    					local creatureName = TempKillLog.creatureName
    					local reputationGain = reputation
    					nehFragger_ReputationDB[faction] = {}
    					nehFragger_ReputationDB[faction].creatureName = creatureName
    					nehFragger_ReputationDB[faction].reputationGain = reputationGain
    				end
    			end
    		end
    	end
    
    end

     

    As you can see, there is a timeframe from 0.1 seconds for the "COMBAT_TEXT_UPDATE" to fire after the creature was killed. This makes sure, the reputation really is only logged if a creature died at the same time. But...

     

    There is the next problem right in the wording 'died at the same time'. Because if there are more than one creatures (lets say 5) that die at the exact same time, then the first event "COMBAT_LOG_EVENT_UNFILTERED" fires 5 times in a row for each creature, always overriding the TempKillLog, and THEN the second event "COMBAT_TEXT_UPDATE" fires 5 times, each giving reputation and each using the same TempKillLog data of the last creature died/logged with the first event. Phew, what a sentence... o_O

    This means, the reputation gain itself is correct, but in my case, the names of the first 4 creatures are wrong! But hey, the basic function of the AddOn still holds tight: Log only reputation gained from killing. So this is a minor fault and wouldn't disturb me too much...

     

    If there weren't the next interconnected problem, that breaks this functionality!

    With the latest WoW expansion 'Legion' there are these nice, new world quests. You go somewhere and the quest pops up and you kill some creatures to complete it and then directly get your rewards. And there you go: If you kill a creature and this completes the world quest and you gain some reputation from this world quest, this last creature - even though the creature itself doesn't give any reputation - will be stored to nehFragger_ReputationDB, because those events also fire within the 0.1 second timeframe. This is just one example of such a behaviour and there might be more such cases in WoW.

     

    There are some more situations where my current approach doesn't work as intended.

    This is why I stopped right there and now I am searching for an entirely new approach to this feature for my AddOn!

     

    And so, what now?

    I hope someone can give me a little hint or tell me, that I am completely mistaken with my old approach or what I could do better.

     

    This is what I hope to get from this thread:

    1. Tips to finish the new feature that "gathers reputation from creature killing only, along with creature and reputation/faction information".

    2. Know, if there is a way to get more information about the source of a WoW event in general than just the few predefined parameters. Something like the source GUID to look up stuff with corresponding functions.

    3. Know, if there is an easy way to interconnect different WoW events in general. At least ones that definitively have the same source, like in my example "THE CREATURE that is killed and in return directly gives reputation to a faction".

     

     

     

    Thank you for any help or food for thought in advance!

    Looking forward to finish this feature and finally release my otherwise completed update to nehFragger! :)

    Posted in: AddOn HELP!
  • To post a comment, please or register a new account.