Register for your free account! | Forgot your password?

Go Back   elitepvpers > World of Warcraft > WoW Addons
You last visited: Today at 03:37

  • Please register to post and access all features, it's quick, easy and FREE!

 

Hilfe print ausgabe in raidwarning umwandeln

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2012
Posts: 4
Received Thanks: 0
Question Hilfe print ausgabe in raidwarning umwandeln

Hallo leute,
Ich habe ein Addon namens Brez, was mir u.a., immer wenn jemand einen br ausführt in den chat eine print ausgabe für mich gibt, wer wen rezzt.

nun ist es aber in manchen situationen schwierig immer in den chat zu schauen, und eine ausgabe als raidwarnung bzw. raidwarnung nur für mich, fände ich wesentlich besser.

die frage ist nun, was ich genau ändern muss bzw. wie der code aussehen muss um diese print ausgabe als raidwarning zu erhalten.

so sieht die lua aus:
Code:
local brez = CreateFrame("Frame", "bRez", UIParent)
brez:SetPoint("CENTER", UIParent, "CENTER")
brez:SetWidth(100)
brez:SetHeight(30)
brez:EnableMouse(true)
brez:RegisterForDrag("LeftButton")
brez:SetClampedToScreen(true)
brez:SetMovable(true)
brez:RegisterEvent("PLAYER_LOGIN")
brez:SetScript("OnEvent", function(frame, event, ...) frame[event](frame, ...) end)
brez:SetScript("OnDragStart", function(frame) if IsAltKeyDown() then frame:StartMoving() end end)
brez:SetScript("OnDragStop", function(frame) frame:StopMovingOrSizing() end)

brez.cooldown = brez:CreateFontString("bRezCooldownText", "OVERLAY")
brez.cooldown:SetHeight(20)
brez.cooldown:SetPoint("TOPLEFT", brez, "TOPLEFT")
brez.cooldown:SetFont(TextStatusBarText:GetFont(), 11, "OUTLINE")
brez.cooldown:SetJustifyH("LEFT")

brez.ready = brez:CreateFontString("bRezReadyText", "OVERLAY")
brez.ready:SetHeight(20)
brez.ready:SetPoint("BOTTOMLEFT", brez.cooldown, "BOTTOMLEFT", 0 , -10)
brez.ready:SetFont(TextStatusBarText:GetFont(), 11, "OUTLINE")
brez.ready:SetJustifyH("LEFT")

brez.count = brez:CreateFontString("bRezCountText", "OVERLAY")
brez.count:SetHeight(50)
brez.count:SetPoint("RIGHT", brez, "LEFT", -2, -2)
brez.count:SetFont(TextStatusBarText:GetFont(), 24, "OUTLINE")
brez.count:SetJustifyH("CENTER")

local theDead, count = {}, 0
function brez:ZONE_CHANGED_NEW_AREA()
	local _, type, _, _, maxPlayers = GetInstanceInfo()
	if type == "raid" then
		if not self.isEngaged then
			count = maxPlayers == 10 and 1 or 3
		end
		self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
		self:RegisterEvent("GROUP_ROSTER_UPDATE")
		self.count:SetFormattedText("|cFF00FF7F%d|r", count)
		self:Show()
	else
		if self:IsShown() then
			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			self:UnregisterEvent("GROUP_ROSTER_UPDATE")
			self:Hide()
			wipe(theDead)
			self.isEngaged = nil
		end
	end
end

function brez:PLAYER_LOGIN()
	if not bRezDB then bRezDB = {} end
	self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
	self:ZONE_CHANGED_NEW_AREA()
end

function brez:EncounterUpdate(wiped)
	if wiped then
		for k in pairs(bRezDB) do
			bRezDB[k] = 0
		end
	end
	local _, _, _, _, maxPlayers = GetInstanceInfo()
	count = maxPlayers == 10 and 1 or 3
	self.count:SetFormattedText("|cFF00FF7F%d|r", count)
	wipe(theDead)
end

local redemption, feign, lastCheck, IsEncounterInProgress = GetSpellInfo(27827), GetSpellInfo(5384), 0, IsEncounterInProgress
local minutes, seconds, ready, cooldown = "%s("..MINUTE_ONELETTER_ABBR:gsub(" ", "")..") ", "%s("..SECOND_ONELETTER_ABBR:gsub(" ", "")..") ", "|cFF00FF7F"..READY.."|r: ", "|cFFFF0000"..ON_COOLDOWN.."|r: "
function brez:COMBAT_LOG_EVENT_UNFILTERED(time, event, _, _, name, _, _, _, tarName, _, _, spellId, spellName)
	-- Rebirth/Raise Ally/Combat Soulstone/Soulstone
	if (event == "SPELL_RESURRECT" and (spellId == 20484 or spellId == 61999 or spellId == 95750)) or (spellId == 20707 and event == "SPELL_AURA_APPLIED") then
		bRezDB[name] = time
		local tbl = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS -- Support custom class color addons, if installed
		local _, class = UnitClass(tarName)
		local t = class and tbl[class] or GRAY_FONT_COLOR -- Failsafe, rarely UnitClass can return nil
		_, class = UnitClass(name)
		local s = class and tbl[class] or GRAY_FONT_COLOR -- Failsafe, rarely UnitClass can return nil
		print("|cFF33FF99bRez|r: ", ("|Hplayer:"..name.."|h|cFF%02x%02x%02x["..name.."]|r|h"):format(s.r * 255, s.g * 255, s.b * 255), ">>",
			"|cFFFF0000|Hspell:"..spellId.."|h["..spellName.."]|h|r", ">>",
			("|Hplayer:"..tarName.."|h|cFF%02x%02x%02x["..tarName.."]|r|h"):format(t.r * 255, t.g * 255, t.b * 255)
		)
		if spellId ~= 20707 then -- A warlock just applied a non-combat Soulstone to someone, don't add them to the deaths table
			theDead[tarName] = "br"
		end
	end

	-- Lots of lovely checks before adding someone to the deaths table
	if event == "UNIT_DIED" and self.isEngaged and UnitIsPlayer(tarName) and not UnitIsFeignDeath(tarName) and not UnitBuff(tarName, redemption) and not UnitBuff(tarName, feign) then
		theDead[tarName] = "r"
		return
	end

	if time - lastCheck < 2 then return end

	if not self.isEngaged and IsEncounterInProgress() then
		self.isEngaged = true
		self:EncounterUpdate()
	elseif self.isEngaged and not IsEncounterInProgress() then
		self.isEngaged = nil
		self:EncounterUpdate(true)
	end

	for k,v in pairs(theDead) do
		if UnitBuff(k, redemption) or UnitBuff(k, feign) or UnitIsFeignDeath(k) then -- The backup plan, you need one with Blizz
			theDead[k] = nil
		elseif not UnitIsDeadOrGhost(k) and UnitIsConnected(k) and UnitAffectingCombat(k) then
			local tbl = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS -- Support custom class color addons, if installed
			local _, class = UnitClass(k)
			local s = class and tbl[class] or GRAY_FONT_COLOR -- Failsafe, rarely UnitClass can return nil
			if class == "SHAMAN" and v == "r" then
				print("|cFF33FF99bRez|r: ", ("|Hplayer:"..k.."|h|cFF%02x%02x%02x["..k.."]|r|h"):format(s.r * 255, s.g * 255, s.b * 255), ">>",
					"|cFFFF0000|Hspell:20608|h["..GetSpellInfo(20608).."]|h|r"
				)
			else
				if v == "r" then
					print("|cFF33FF99bRez|r: ", ("|Hplayer:"..k.."|h|cFF%02x%02x%02x["..k.."]|r|h"):format(s.r * 255, s.g * 255, s.b * 255), ">>",
						"|cFFFF0000|Hspell:20707|h["..GetSpellInfo(20707).."]|h|r"
					)
				end
				if self.isEngaged then count = count - 1 end
			end
			self.count:SetFormattedText("%s%d|r", count > 0 and "|cFF00FF7F" or "|cFFFF0000", count)
			theDead[k] = nil
		end
	end
	lastCheck = time
	local cdnames = cooldown
	local readynames = ready
	for k, v in pairs(bRezDB) do
		-- Replace server names with *
		local name = k:match("^(.-)%-")
		name = name and name.."*" or k

		if v > 0 then
			local timeleft = (select(2, UnitClass(k)) == "WARLOCK" and 900 or 600) - (time - v)
			if timeleft > 60 then
				cdnames = cdnames .. (minutes):format(name, ceil(timeleft / 60))
			elseif timeleft < 4 then
				bRezDB[k] = 0
				readynames = readynames .. (UnitIsDeadOrGhost(k) and "|cFFFF0000"..name or "|cFFFFFFFF"..name) .. ". |r"
			else
				cdnames = cdnames .. (seconds):format(name, timeleft)
			end
		else
			readynames = readynames .. (UnitIsDeadOrGhost(k) and "|cFFFF0000"..name or "|cFFFFFFFF"..name) .. ". |r"
		end
	end
	self.cooldown:SetText(cdnames)
	self.ready:SetText(readynames)
end

function brez:GROUP_ROSTER_UPDATE()
	local _, type, _, _, maxPlayers = GetInstanceInfo()
	if type ~= "raid" then return end

	for k in pairs(bRezDB) do
		if not UnitInRaid(k) then
			bRezDB[k] = nil
			theDead[k] = nil
		end
	end

	for i = 1, GetNumGroupMembers() do
		local player, _, subgroup, _, _, class = GetRaidRosterInfo(i)
		if class == "DRUID" or class == "DEATHKNIGHT" or class == "WARLOCK" then
			if subgroup <= maxPlayers/5 then
				if not bRezDB[player] then
					bRezDB[player] = 0
				end
			else
				bRezDB[player] = nil
			end
		end
	end
end



katzenjoe is offline  
Old   #2
 
elite*gold: 0
Join Date: Jun 2008
Posts: 96
Received Thanks: 218
Question

So, you want that the text is also printed as a Raid Warning and not just as a message in chat, right?

(Also, Sie wollen, dass der Text auch als Raid Warning und nicht nur als eine Nachricht im Chat gedruckt, richtig?)


vabatta is offline  
Old   #3
 
elite*gold: 0
Join Date: Apr 2012
Posts: 4
Received Thanks: 0
yes but it doesnt have to print both, just a raidwarning would be nice

and if its not a big deal a also a sound for that would be nice but thats optional :P
katzenjoe is offline  
Old   #4
 
elite*gold: 104
Join Date: Oct 2012
Posts: 2,720
Received Thanks: 592
Raidwarning wird meines Wissens an alle Mitglieder des Raids geschickt, müsstest du mal schauen.. kann man sicher auch anders regeln z.b mit nem Text aufm Bildschirm den man in einer Ecke anzeigt.


Cambios is offline  
Old   #5
 
elite*gold: 0
Join Date: Apr 2012
Posts: 4
Received Thanks: 0
es gibt auch ne virtuelle raidwarnung, die man quasi nur im endsprechenden raidwarnugs-frame für sich selbst angezeigt bekommt. sieht man zb. ganz oft bei bossmods.
geht sich halt nur drum, das man die warnug besser sieht bzw sie mehr in der mitte ist, und man nicht erst im chat suchen muss...
katzenjoe is offline  
Old   #6
 
elite*gold: 0
Join Date: Jun 2008
Posts: 96
Received Thanks: 218
Just use this:
Quote:
RaidNotice_AddMessage(RaidWarningFrame, <TEXT TO PRINT>, { ["r"] = 1, ["g"] = 1, ["b"] = 0 })
You just need to replace the holder <TEXT TO PRINT> with the text that you need to print. Only you will see the message.

Use instead of print in the script you posted, and for the text, you will need to remove every comma from the text and add a + instead.

Hope that this help!
vabatta is offline  
Old   #7
 
elite*gold: 0
Join Date: Apr 2012
Posts: 4
Received Thanks: 0
Unhappy

im sorry but that doesnt work.
ive changed the script like u said, but everytime my brez is done, and the message should appear i get this error message:

Quote:
Error occured in: Global
Count: 1
Message: ..\AddOns\bRez\bRez.lua line 85:
attempt to perform arithmetic on a string value
Debug:
[string "*:OnLoad"]:6:
[string "*:OnLoad"]:1
[C]: ?
bRez\bRez.lua:85: ?()
bRez\bRez.lua:11:
bRez\bRez.lua:11
Locals:
None
this is what i changed.
from this
Code:
local s = class and tbl[class] or GRAY_FONT_COLOR -- Failsafe, rarely UnitClass can return nil
		print("|cFF33FF99bRez|r: ", ("|Hplayer:"..name.."|h|cFF%02x%02x%02x["..name.."]|r|h"):format(s.r * 255, s.g * 255, s.b * 255), ">>",
			"|cFF71d5ff|Hspell:"..spellId.."|h["..spellName.."]|h|r", ">>",
			("|Hplayer:"..tarName.."|h|cFF%02x%02x%02x["..tarName.."]|r|h"):format(t.r * 255, t.g * 255, t.b * 255)
		)
		if spellId ~= 20707 then -- A warlock just applied a non-combat Soulstone to someone, don't add them to the deaths table
			theDead[tarName] = "br"
to this
Code:
local s = class and tbl[class] or GRAY_FONT_COLOR -- Failsafe, rarely UnitClass can return nil
		RaidNotice_AddMessage(RaidWarningFrame, ("|cFF33FF99bRez|r: "+ ("|Hplayer:"..name.."|h|cFF%02x%02x%02x["..name.."]|r|h"):format(s.r * 255+ s.g * 255+ s.b * 255)+ ">>"+
			"|cFF71d5ff|Hspell:"..spellId.."|h["..spellName.."]|h|r"+ ">>"+
			("|Hplayer:"..tarName.."|h|cFF%02x%02x%02x["..tarName.."]|r|h"):format(t.r * 255+ t.g * 255+ t.b * 255)
		),{["r"] = 1,["g"] = 1, ["b"] = 0 })
		if spellId ~= 20707 then -- A warlock just applied a non-combat Soulstone to someone, don't add them to the deaths table
			theDead[tarName] = "br"
whats wrong?
katzenjoe is offline  
Old   #8
 
elite*gold: 0
Join Date: Jun 2008
Posts: 96
Received Thanks: 218
Oh sorry, confusion with programming language. In LUA to concatenate string the operator is "..", so replace all "+" with it and it should works.

PS.: I saw something in your code about a color. I will try to implement it later, maybe.


vabatta is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[Hilfe]Metin2 Root Client in Hamachi umwandeln
Hallo Com... Ich brauch ganz dringen eure Hilfe ich wollte mir einen Metin2-Root Client zu Einen Hamachi Cleint machen ich hab von einen anderen...
10 Replies - Metin2 PServer - Discussions / Questions
PHP - print
Huhu, habe ein Problem zum print-Befehl von PHP. Habe diesen Quellcode hier: Ich möchte gerne das Ergebnis hier (ist jetzt ein...
10 Replies - Web Development
Hilfe !!! datei in .class wieder umwandeln wie
Hallo ich spiele minecraft und habe mir gedacht ich versuche mich mal an den plugin. Das hat soweit geklappt ich habe die .jar datei in .class...
9 Replies - Minecraft
Hilfe bei msgbox ausgabe
Hallo, ich bin derzeit dabei einen kleinen Bot für Dekaron zu schreiben, der mir das spielen sehr vereinfacht ;) Die Funktionen gehen auch...
21 Replies - AutoIt



All times are GMT +1. The time now is 03:37.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.