Page 2 of 2 FirstFirst
1
2
  1. #21
    Quote Originally Posted by Tactica View Post
    Within the ORIGINAL addon, I completely replaced "say" with "party." I see no point in /Say when there is an automatic emote for some spells.
    Yes I know that, but to test it I don't want to have to join a group or use specific items/abilities so I altered the code to allow me to do that. I could just have just as easily removed the SendChatMessage() bit and used print() instead, either way it works (with class coloring) just fine.

    Quote Originally Posted by Tactica View Post
    This fixed the issue of the addon announcing in say even though I was in a party of two.
    You are aware that the original code you posted went out of its way to do just that?

    If that code you posted works except for the class coloring and doesn't work when you replace:
    Code:
    message     = "{rt1}" ..sourceName .. " creates " .. GetSpellLink(spellID).."{rt1}"
    with:
    Code:
    local _, class = GetPlayerInfoByGUID(sourceGUID)
    local color, message = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
    if color then
        message = ("{rt1}\124c%s%s\124r has created %s{rt1}"):format(color.colorStr, sourceName, GetSpellLink(spellID))
    else
        message = ("{rt1}%s has created %s{rt1}"):format(sourceName, GetSpellLink(spellID))
    end
    then the problem is on your end. I even tweaked it on my end to make the player's name a hyperlink and could target/whisper them using it.

    Given your history of having issues with copy-paste I can only assume that what you are posting here and what you are running in WoW are different and leave it at that.

    Do you have Lua errors turned on in game? If not you should change that before asking for additional help.

  2. #22
    Field Marshal Tactica's Avatar
    Join Date
    Mar 2014
    Location
    9942 Apophis
    Posts
    84
    Quote Originally Posted by Vexxilus View Post
    Given your history of having issues with copy-paste I can only assume that what you are posting here and what you are running in WoW are different and leave it at that.

    Do you have Lua errors turned on in game? If not you should change that before asking for additional help.
    Tested and confirmed both in game and with http://codepad.org/dlhrKHRC which returned no errors.

    Have lua errors set to display along with buggrabber. Addon loaded, no bugs reported when item conjured, but no message was sent:

    Code:
    		 local timestamp, sourceGUID, type, hideCaster, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName = ...
    		
    		--print (type,spellID,sourceName,destName)
    		--printMessage (searchTable)
    
    		if (AnnouncerState == true and (UnitInParty(sourceName) or UnitInRaid(sourceName)) and (type=="SPELL_CREATE" or type=="SPELL_SUMMON" or type=="SPELL_CAST_SUCCESS") and GetNumGroupMembers()>0 and checkTable[spellID]~=nil) then
    			--printMessage ("**************")
    			--printMessage (type,spellID,sourceName,destName)
    			
    			-- use this for cauldrons, they show up only for SPELL_CAST_START and have null for destName
    			if (destName==nil) then
    				destName = spellName
    			end
    
    			
    			if (destName=="Create Soulwell") then
    				return
    			end
    			
    		local _, class = GetPlayerInfoByGUID(sourceGUID)
    		local color, message = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
    			if color then
    				message = ("{rt1}\124c%s%s\124r has created %s{rt1}"):format(color.colorStr, sourceName, GetSpellLink(spellID))
    			else
    				message = ("{rt1}%s has created %s{rt1}"):format(sourceName, GetSpellLink(spellID))
    			end
    - - - Updated - - -

    Disregarding all previous attempts and going back to the original concern. Noodle Carts are not linking nor do they show using the original script. As it stands this will be published w/o class colors
    SendChatMessage API it will not work.

    You cannot send any kind of escape codes (this includes colors) in chat with the exception of target charms. ({rt#})

    You can only colorize messages locally (in your own chatframes)
    The script below works as intended though none of the noodle carts appear with the spelllink:

    Code:
    function displayMessage(msg)
    	inInstance, instanceType = IsInInstance()
    
    	local messageType = "party"
    
    	if Announcerparty==true then
    		--
    	elseif inInstance == 1 and instanceType ~= "none" then
    		messageType = "INSTANCE_CHAT"
    	end
    
    	if (AnnouncerRW == true and (UnitIsGroupAssistant("player") or UnitIsGroupLeader("player")) and IsInRaid()) then
    		messageType = "RAID_WARNING"
    	end
    	
    	SendChatMessage(msg,messageType)
    end
    
    function printMessage(msg)
    	print("|cff7f7fff[Conjured Announcer 2] "..msg)
    end
    
    function OnEvent(self, event, ...)
    	if event == "VARIABLES_LOADED" then
    	
    		if AnnouncerState==nil then
    			AnnouncerState = true
    		end
    
    		if Announcerparty==nil then
    			Announcerparty = true
    		end
    		if AnnouncerRW==nil then
    			AnnouncerRW = false
    		end		
    		
    		if AnnouncerState==true then
    			conjuredAnnouncer:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    		else
    			conjuredAnnouncer:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    		end
    		
    		printMessage("Conjured Announcer 2 loaded.")
    		printMessage("Type /can or /cann for options. Announcer state is: "..getState(AnnouncerState))
    			
    		SlashCmdList["FFDCMD"] = SlashCommand;
    		SLASH_FFDCMD1 = "/can";
    		SLASH_FFDCMD2 = "/cann";
    	else
    		local timestamp, type, sourceGUID,hideCaster, sourceName, sourceFlags,sourceRaidFlags, destGUID, destName, destFlags,destRaidFlags, spellID, spellName = select(1, ...)
    		
    		--print (type,spellID,sourceName,destName)
    		--printMessage (searchTable)
    
    		if (AnnouncerState == true and (UnitInParty(sourceName) or UnitInRaid(sourceName)) and (type=="SPELL_CREATE" or type=="SPELL_SUMMON" or type=="SPELL_CAST_START") and GetNumGroupMembers()>0 and checkTable[spellID]~=nil) then
    			--printMessage ("**************")
    			--printMessage (type,spellID,sourceName,destName)
    			
    			-- use this for cauldrons, they show up only for SPELL_CAST_START and have null for destName
    			if (destName==nil) then
    				destName = spellName
    			end
    
    			
    			if (destName=="Create Soulwell") then
    				return
    			end
    			
    			message     = "{rt1}" ..sourceName .. " has created " .. GetSpellLink(spellID).."{rt1}"
    			
    
    			
    			if (antispamtable[message]==nil) then
    				antispamtable[message] = time()
    				displayMessage(message)
    			else			
    				if (time()-antispamtable[message])>10 then
    					antispamtable[message] = time()
    					displayMessage(message)
    				end
    			end
    		end
    	end
    end
    
    function helptxt()
    	printMessage(" Conjured Announcer 2. Current state: "..getState(AnnouncerState))
    	printMessage(" ")	
    	printMessage(" Activate : /can on")
    	printMessage(" Deactivate: /can off")
    	printMessage(" Announce on party: /can party")
    	printMessage(" Announce on group chat: /can group")
    	printMessage(" Announce on raid warning: /can rw")
    end
    
    function SlashCommand(msg)
    	local argc, argv = 0, {}
    	gsub(msg, "[^%s]+", function (word) argc=argc+1; argv[argc]=word; end);
    
    	if (argc == 1) then
    		if (argv[1] == "help") then
    			helptxt()
    		elseif (argv[1] == "off") then
    			printMessage("Announcer state OFF. Type /can on to activate")
    			AnnouncerState = false;		
    			conjuredAnnouncer:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    		elseif  (argv[1] == "on") then
    			printMessage("Announcer state ON. Type /can off to deactivate")
    			AnnouncerState = true
    			conjuredAnnouncer:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    		elseif  (argv[1] == "party") then
    			Announcerparty = true
    			printMessage("Announcer set to party.")
    		elseif  (argv[1] == "rw") then
    			AnnouncerRW = not AnnouncerRW
    			printMessage("Announcer using raidwarning: "..getState(AnnouncerRW))
    		elseif  (argv[1] == "group") then
    			Announcerparty = false
    			printMessage("Announcer set to GROUP.")			
    		end
    	else
    		helptxt()
    	end
    end
    
    function getState(cond)
    	if cond==true then
    		return "ON"	
    	else
    		return "OFF"
    	end
    end
    
    	
    --67826 jewels
    --54711 scrapbot
    --44389 Field Repair Bot 110G
    --57426 fishfeast
    --57301 great feast
    --54710 moll-e
    
    --92824 Ritual of Refreshment
    --43987 Refreshment Portal
    --698   Ritual of Summoning
    --29893 Ritual of Souls
    
    --92649 Cauldron of Battle
    --92712 Big Cauldron of Battle
    --87915 Goblin Barbecue Feast
    --87644 Seafood Magnifique Feast
    --87643 Broiled Dragon Feast
    
    --104958 Pandaren Banquet
    --126492 Banquet of the Grill
    --126494 Great Banquet of the Grill
    --126501 Banquet of the Oven
    --126502 Great Banquet of the Oven
    --126504 Great Banquet of the Brew
    --126498 Great Banquet of the Pot
    --126500 Great Banquet of the Steamer
    --126496 Great Banquet of the Wok
    --105193 Great Pandaren Banquet
    --126503 Banquet of the Brew
    --126497 Banquet of the Pot
    --126499 Banquet of the Steamer
    --126495 Banquet of the Wok
    
    --10059 STORMWIND PORTAL
    --11416 IRONFORGE PORTAL
    --11417 ORGRIMMAR PORTAL
    --11418 UNDERCITY PORTAL
    --11419 DARNASSUS PORTAL
    --11420 THUNDER BLUFF PORTAL
    --32266 EXODAR PORTAL
    --32267 SILVERMOON PORTAL
    --33691 SHATTRATH PORTAL
    --35717 SHATTRATH PORTAL
    --49360 THERAMORE PORTAL
    --49361 STONARD PORTAL
    --53142 DALARAN PORTAL
    --88345 TOL BARAD PORTAL
    --88346 TOL BARAD PORTAL
    --120146 ANCIENT DALARAN PORTAL
    --132620 VALE OF ETERNAL BLOSSOMS PORTAL
    --132626 VALE OF ETERNAL BLOSSOMS PORTAL
    
    spellIDS   = {67826,54711,44389,22704,57426,57301,54710,92824,43987,698,29893,41458,41500,41501,92649,92712,87915,87644,87643,145196,145169,145166,104958,126492,126494,126501,145061,145038,126502,126504,126498,126500,126496,105193,126503,126497,126499,126495,10059,11416,11417,11418,11419,11420,32266,32267,33691,35717,49360,49361,53142,88345,88346,120146,132620,132626}
    checkTable = {}
    
    for i=1,#spellIDS do checkTable[spellIDS[i]]=1 end
    
    msgType = {}
    msgType["pvp"]="BATTLEGROUND"
    msgType["arena"]="PARTY"
    msgType["party"]="PARTY"
    msgType["raid"]="RAID"
    
    antispamtable = {}
    
    
    
    conjuredAnnouncer = CreateFrame("Frame")
    conjuredAnnouncer:RegisterEvent("VARIABLES_LOADED")
    conjuredAnnouncer:SetScript("OnEvent", OnEvent)
    Last edited by Tactica; 2014-03-21 at 05:30 PM. Reason: added code test link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •