WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Helps with Kgpanels! (https://www.wowinterface.com/forums/showthread.php?t=46786)

Akatosh 07-27-13 02:56 PM

Quote:

Originally Posted by Fizzlemizz (Post 281654)
Essentially what I've given you is the variable called "text" that contains the information you want.
The following line needs to be replaced using whatever KgPanels does to update the display with the information from this "text" variable.

-- do whatever KgPanels uses to update the display with "text"

if
self.text:SetText(gold .. "g " .. silver .. "s " .. m - (10000*gold) - (100*silver) .. "c")
worked with your gold display then try:

self.text:SetText(text)

Thanks!!

For the text of gold I use that, and works fine, (atleast for me).

Quote:

Onload

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)
Quote:

Onupdate

local m = GetMoney()
local gold = floor(m/10000)
local silver = floor((m - (10000*gold))/100)
local cooper = m - (10000*gold) - (100*silver)


self.text:SetText(string.format("Gold: |cffffffff%d|cffffcc00g |cffffffff%d|cffc0c0c0s |cffffffff%d|cff996600c",gold,silver,cooper))
For the --text Etc..I do not understand English very well so I do not understand what you mean by this ... leave me a little time to assimilate it.

Edit:

ok ok now understood!

Quote:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
local text
if minutes > 719 then
if minutes > 779 then
hour = floor(minutes/60) - 12
end
self.text:SetText(hour .. ":" .. minute .. " pm")
else
if (hour == 0) then
hour = 12
end
self.text:SetText(hour .. ":" .. minute .. " am")
end
With that, works fine, now I try to class color the text With White (hour) / classcolored (am/pm),wait a sencond and I put the code, I did it with some items I think I can do this too

Thanks!!

Edit2:

Quote:

OnLoad

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.text:SetTextColor(color.r, color.g, color.b)
Quote:

OnUpdate

.. self.text:SetText(string.format("|cffffffff%d:%d|r pm", hour,minute))
else
if (hour == 0) then
hour = 12
end
self.text:SetText(string.format("|cffffffff%d:%d|r am", hour,minute))
end..
itis curious but I have no zeros on left, example: 11:9pm Can you help me to fix that?

Thanks!!

Fizzlemizz 07-27-13 03:13 PM

If you are going to do it this way you can delete the line:

"local text"

as you are not using the variable named text in your script ;).

Akatosh 07-27-13 03:27 PM

Quote:

Originally Posted by Fizzlemizz (Post 281658)
If you are going to do it this way you can delete the line:

"local text"

as you are not using the variable named text in your script ;).

Ok I remove that line, Now I have a little problem... I have no zeros on left side of the tex, I edit my last post to explain it, you can help me to fix that?

Akatosh 07-27-13 04:09 PM

Quote:

Originally Posted by Akatosh (Post 281660)
Ok I remove that line, Now I have a little problem... I have no zeros on left side of the tex, I edit my last post to explain it, you can help me to fix that?

I see the light man!!! I have no idea how can appear in my mind but works good now, I see the code of coords... And I say to me... Umm that be very similar, I put ".i" and nothing changed, ummm maybe if y put 2 appear 1 number more, and bammm.

The part of "OnLoad" be the some.

Now in OnUpdate:

Quote:

local minutes, hour, minute
local t = date("*t", time())
hour = t.hour
minute = t.min
minutes = (hour*60) + minute
if (minutes > 1440) then
minutes = minutes - 1440
end
minutes = abs(minutes)
hour = floor(minutes/60)
minute = format("%02d", mod(minutes, 60))
if minutes > 719 then
if minutes > 779 then
hour = floor(minutes/60) - 12
end
self.text:SetText(string.format("|cffffffff%2i:%2i|r pm", hour,minute))
else
if (hour == 0) then
hour = 12
end
self.text:SetText(string.format("|cffffffff%2i:%.2i|r am", hour,minute))
end
Thanks for all, now I can zocus on the part of zone and subzone (with colors).

Akatosh 07-30-13 05:00 AM

News!

I modify the codes that Phanx and Fizzlemizz provided to me (thanks), I explain, with one of the codes, the calendar works, but only when previously I loaded it manually the blizzard calendar with "/calendar", with the other code, when I click the panel, the frame of calendar only shows the time that I "mouse down" when I "mouse up", the frame disappear.

I try to modify the codes viewing codes of brokers and other lua relationated codes of calendar.

Finaly I got this:

Quote:

if pressed and (not IsAddOnLoaded("Blizzard_Calendar")) then
UIParentLoadAddOn("Blizzard_Calendar")
Calendar_Show()
else
if pressed and (IsAddOnLoaded("Blizzard_Calendar")) then
Calendar_Toggle()
end
end
With that works now exactly how I want.

Thanks for all slowly, I am learning a lot and... I like!

Akatosh 07-30-13 12:23 PM

Hi!.

I have new questions!.

I want make a zonetext panels colored by pvp status.

I find information for other lua codes and for now I have this (Dont work of course Xddddd).

OnLoad

Quote:

local font,size = self.text:GetFont()
self.text:SetFont(font,size,"OUTLINE")
self.text:SetJustifyH("CENTER")
self.text:SetJustifyV("CENTER")

self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_FLAGS_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("PLAYER_LOGIN")
OnEvent
Quote:

zone = GetRealZoneText()
subzone = GetSubZoneText()
self.text:SetText(string.format("%s, %s",zone,subzone))
Who I need:

1º:a class colored text based on pvp status, I extract that lua code, maybe can be usefull:

Quote:

local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
else
return txt
end
return addon['colorize'](txt, col)
But I dont have idea how can I apply to text.

2º: When I enter in a zone with no subzone appear only the Main zone, for example, I enter on Dalaran, appear "Dalaran, Dalaran", When the correct be that only appear 1 dalaran: "Dalaran".

Any help will be greatly appreciated Thanks!!!

Fizzlemizz 07-30-13 01:17 PM

If you weant sub-zone information you will also need to register "ZONE_CHANGED".

The "ZONE_CHANGED_NEW_AREA" event fires whe you cross zone borders and "ZONE_CHANGED" when you cross unto a new sub-zone. You might also want to register "ZONE_CHANGED_INDOORS" which is trggered when you go from inside to out or outside to in.

You can find the list of zone related functions at WowProgramming.

Akatosh 07-30-13 01:49 PM

Quote:

Originally Posted by Fizzlemizz (Post 281968)
If you weant sub-zone information you will also need to register "ZONE_CHANGED".

The "ZONE_CHANGED_NEW_AREA" event fires whe you cross zone borders and "ZONE_CHANGED" when you cross unto a new sub-zone. You might also want to register "ZONE_CHANGED_INDOORS" which is trggered when you go from inside to out or outside to in.

You can find the list of zone related functions at WowProgramming.

Thanks for the tip!!.

I added to "Onload" section.

If you can help me with colored text....

¿how can I do for do a text colored zonetext based on pvp status?.

I have this base code maybe can help:

Quote:

local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
I need help on the second point to:

2º: When I enter in a zone with no subzone appear only the Main zone, for example, I enter on Dalaran, appear "Dalaran, Dalaran", When the correct be that only appear 1 dalaran: "Dalaran".

A lot of Thanks Fizzlemizz.

Fizzlemizz 07-30-13 02:41 PM

The code appears to be only part of a function for getting the appropriate colour. It also seems to asume the the alpha chanel will be set elsewhere but I'll change to set it here
Code:

local col
local pvpType, isFFA, faction = GetZonePVPInfo()
if(pvpType == "friendly") then
        col = "ff00ff00" -- friendly colour
elseif(pvpType == "hostile") then
        col = "ffff0000" -- hostile colour
elseif(pvpType == "arena") then
        col = "ffffff00"  -- arena colour
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
        if(faction == select(2,UnitFactionGroup('player'))) then
                col = "ff886600" -- faction colour for player
        else
                col = "ffff0000" -- other faction colour colour for player
        end
elseif(pvpType == "sanctuary") then
        col = "ff9999ff"  -- sanctuary colour
end

As for changing zones something like:
Code:

local zone, subzone
if event == "ZONE_CHANGED_NEW_AREA" then
        zone = GetRealZoneText()
        self:text:SetText(zone)
elseif event == "ZONE_CHANGED" then
        zone = GetRealZoneText()
        subzone = GetSubZoneText()
        if subzone == "" then
                self:text:SetText(zone)
        else
                self:text:SetText(subzone)
        end
end


jeruku 07-30-13 02:41 PM

Is the following what you are looking for?

For the multi-zone feature you should note that ALL GetZone functions return the Zone if there is no Sub-Zone. The colors are a tad tricky but if those are the accepted values then that works.
If you're more comfortable with one single object then replace the 'return string.format' with 'self.text:SetFormattedText'.
Code:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
    col = "00ff00"
elseif(pvpType == "hostile") then
    col = "ff0000"
elseif(pvpType == "arena") then
    col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
    if(faction == select(2,UnitFactionGroup('player'))) then
          col = "886600"
    else
          col = "ff0000"
    end
elseif(pvpType == "sanctuary") then
    col = "9999ff"
else
    col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
    return string.format("|cff%s%s|r", col, zone)
else
    return string.format("|cff%s%s, %s|r", col, zone, sub)
end


Fizzlemizz 07-30-13 03:01 PM

I was just about to post something similar. I changed the returns because Akatosh is using this in a KgPanels script not as a standalone function. Also changed a bit because sub can be blank.

Code:

if sub == "" then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end


Akatosh 07-30-13 03:16 PM

Quote:

Originally Posted by jeruku (Post 281972)
Is the following what you are looking for?

For the multi-zone feature you should note that ALL GetZone functions return the Zone if there is no Sub-Zone. The colors are a tad tricky but if those are the accepted values then that works.
If you're more comfortable with one single object then replace the 'return string.format' with 'self.text:SetFormattedText'.
Code:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
    col = "00ff00"
elseif(pvpType == "hostile") then
    col = "ff0000"
elseif(pvpType == "arena") then
    col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
    if(faction == select(2,UnitFactionGroup('player'))) then
          col = "886600"
    else
          col = "ff0000"
    end
elseif(pvpType == "sanctuary") then
    col = "9999ff"
else
    col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
    return string.format("|cff%s%s|r", col, zone)
else
    return string.format("|cff%s%s, %s|r", col, zone, sub)
end


Quote:

Originally Posted by Fizzlemizz (Post 281974)
I was just about to post something similar but I think most common use would be

Code:

if sub == zone then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end

I also changed the returns because Akatosh is using this in a KgPanels script not as a standalone function.


Hi all a lot of thanks!!!!, I am very happy.

It works... not exactly one of other... a mix of the two:

Quote:

local pvpType, _, faction = GetZonePVPInfo()
local col
if(pvpType == "friendly") then
col = "00ff00"
elseif(pvpType == "hostile") then
col = "ff0000"
elseif(pvpType == "arena") then
col = "ffff00"
elseif(pvpType == "combat" or pvpType=="contested") then
if(faction == select(2,UnitFactionGroup('player'))) then
col = "886600"
else
col = "ff0000"
end
elseif(pvpType == "sanctuary") then
col = "9999ff"
else
col = "00ff00"
end
local zone, sub = GetZoneText(), GetSubZoneText()
if sub == zone then
self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
self.text:SetText(string.format("|cff%s%s, %s|r", col, zone, sub))
end
120kbs less of memory usage (1 addon) for 25 lines.

I put OnClick:
Quote:

ToggleFrame(WorldMapFrame)
Now that panel is complete!!, ever is less, to finish the interface with your help.

jeruku 07-30-13 06:24 PM

Quote:

Originally Posted by Fizzlemizz (Post 281974)
I was just about to post something similar. I changed the returns because Akatosh is using this in a KgPanels script not as a standalone function. Also changed a bit because sub can be blank.

Code:

if sub == "" then
    self.text:SetText(string.format("|cff%s%s|r", col, zone))
else
    self.text:SetText(string.format("|cff%s%s|r", col, sub))
end



That is why I mentioned SetFormattedText(). It does the SetText() as if it were string.format().

Thanks for correcting me Fizz, GetSubZoneText() does indeed return an empty string.

I also have a tip on appearance, one could move the color escape '|r' and nestle it between the two zones; this would result in only the major zone being colored. Here's an example with a correction of my code with Fizz's fix.

Stormwind, Dwarven District
Code:

if sub == "" then
    self.text:SetFormattedText("|cff%s%s|r", col, zone)
else
    self.text:SetFormattedText("|cff%s%s|r, %s", col, zone, sub)
end


Akatosh 08-05-13 10:41 AM

Hello again!, again I have questions!.

I see the broker "RaidBuffs", and explore the code.

Dont apperar a lot of dificult... I understand it a bit.

The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

The code:

Quote:

--[[
local localizedClasses = {}
FillLocalizedClassList(localizedClasses)
local classLabels = {}
populateClassLabels("HUNTER")
populateClassLabels("WARRIOR")
populateClassLabels("PALADIN")
populateClassLabels("MAGE")
populateClassLabels("PRIEST")
populateClassLabels("WARLOCK")
populateClassLabels("SHAMAN")
populateClassLabels("DEATHKNIGHT")
populateClassLabels("DRUID")
populateClassLabels("MONK")
populateClassLabels("ROGUE")

local populateClassLabels(class)
classLabels[class] = {localizedClasses[class], RAID_CLASS_COLORS[class]}
print(classLabels[class][1], classLabels[class][2], classLabels[class][3], classLabels[class][4])
end
--]]

-- displayName, active, {buff = {class [, note]}, ...}
local buffsList = {
{"5% stats", false, {
[20217] = {"PALADIN"}, -- Blessing of Kings
[117666] = {"MONK"}, -- Legacy of the Emporer
[1126] = {"DRUID"}, -- Mark of the Wild
[90363] = {"HUNTER", "Exotic Pet"}, -- Embrace of the Shale Spider
[133539] = {"Krasang Wilds Druid"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Attack Power", false, {
[19506] = {"HUNTER"}, -- Trueshot Aura
[6673] = {"WARRIOR"}, -- Battle Shout
[57330] = {"DEATHKNIGHT"}, -- Horn of Winter
[133540] = {"Krasang Wilds Warrior"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Attack Speed", false, {
[113742] = {"ROGUE"}, -- Swiftblade's Cunning
[55610] = {"DEATHKNIGHT", "Frost & Unholy"}, -- Unholy Aura
[30809] = {"SHAMAN", "Enhancement"}, -- Unleashed Rage
[128432] = {"HUNTER", "Pet"}, -- Cackling Howl
[128433] = {"HUNTER", "Pet"}, -- Serpent's Swiftness
[133541] = {"Krasang Wilds Rogue"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Spell Power", false, {
[1459] = {"MAGE"}, -- Arcane Brilliance
[61316] = {"MAGE"}, -- Dalaran Brilliance
[77747] = {"SHAMAN"}, -- Burning Wrath
[109773] = {"WARLOCK"}, -- Dark Intent
[126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
[133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Spell Haste", false, {
[24907] = {"DRUID", "Balance"}, -- Moonkin Aura
[24858] = {nil}, -- Druid's Moonkin Aura Self Buff
[49868] = {"PRIEST", "Shadow"}, -- Mind Quickening
[15473] = {nil}, -- Priest's Mind Quickening Self Buff
[51470] = {"SHAMAN", "Elemental"}, -- Elemental Oath
[135678] = {"HUNTER", "Pet"}, -- Energizing Spores
[133545] = {"Krasang Wilds Shaman"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Mastery", false, {
[19740] = {"PALADIN"}, -- Blessing of Might
[116956] = {"SHAMAN"}, -- Grace of Air
[93435] = {"HUNTER", "Pet"}, -- Roar of Courage
[128997] = {"HUNTER", "Exotic Pet"}, -- Spirit Beast Blessing
[133535] = {"Krasang Wilds Paladin"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Crit Chance", false, {
[1459] = {"MAGE"}, -- Arcane Brilliance
[61316] = {"MAGE"}, -- Dalaran Brilliance
[17007] = {"DRUID", "Feral & Guardian"}, -- Leader of the Pack
[116781] = {"MONK", "Windwalker"}, -- Legacy of the White
[126373] = {"HUNTER", "Exotic Pet"}, -- Fearless Courage
[24604] = {"HUNTER", "Pet"}, -- Furious Howl
[126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
[90309] = {"HUNTER", "Exotic Pet"}, -- Terrifying Roar
[133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
}},
{"Stamina", false, {
[21562] = {"PRIEST"}, -- Power Word: Fortitude
[469] = {"WARRIOR"}, -- Commanding Shout
[109773] = {"WARLOCK"}, -- Dark Intent
[90364] = {"HUNTER", "Exotic Pet"}, -- Qiraji Fortitude
[133538] = {"Krasang Wilds Priest"}, -- Dominion Point/Lion's Landing NPCs
}},
}

local BrokerRaidBuffs = ldb:NewDataObject("Broker_RaidBuffs", {
type = "data source",
text = "Please wait",
value = 1,
icon = "interface\\addons\\Broker_RaidBuffs\\BuffConsolidation",
label = "RaidBuffs",
OnTooltipShow = function(tooltip)
tooltip:AddLine("Raidbuffs")
for _,v in pairs(buffsList) do
local r, g, b
if v[2] then
r, g, b = 0, 1, 0
else
r, g, b = 1, 0, 0
end
tooltip:AddLine(v[1], r, g, b)
end
end
})

local function updateBuffs(self, event, unitID)
if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then
-- unflag the active buffs
for i=1, #buffsList do
buffsList[i][2] = false
end

-- populate our buffs lookup table
local activeBuffs, i = {}, 1
local currentBuff = select(11, UnitBuff("player", i))
while currentBuff do
activeBuffs[currentBuff] = true
i = i + 1
currentBuff = select(11, UnitBuff("player", i))
end

local activeRaidBuffs = 0
-- start the lookup
for i = 1, #buffsList do
local raidBuff = buffsList[i][3]
for key, _ in pairs(raidBuff) do
if activeBuffs[key] then
buffsList[i][2] = true
activeRaidBuffs = activeRaidBuffs + 1
break
end
end
end

BrokerRaidBuffs.text = activeRaidBuffs .. " / 8"
end
end

local EventFrame = CreateFrame("Frame")
EventFrame:RegisterEvent("UNIT_AURA")
EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
EventFrame:SetScript("OnEvent", updateBuffs)
What I understand.

The first part appear something like a register of class and their buff, the second part appear a count of the buffs, the third be the tooltip, And finally the number of current buffs and total buffs.

He looks like that with the broker

¿¿You can make it work for kgpanels??

A lot of thanks!!

PD: whats the diference betwen "{ or }" and "( or )"

Phanx 08-05-13 05:25 PM

Please use [code] tags around code blocks, not [quote] tags -- the latter does not preserve indentation, and makes the code annoyingly difficult to read.

Quote:

Originally Posted by Akatosh (Post 282456)
PD: whats the diference betwen "{ or }" and "( or )"

{ curly brackets } create a table object:

Code:

-- Indexed table, array, or list:
local animals = { "cat", "dog", "pig" }

-- Dictionary table, or hash table:
local animals = {
  ["cat"] = "meow",
  ["dog"] = "woof",
  ["pig"] = "oink",
}

( parenthesis ) enclose conditions or function arguments:

Code:

-- This:
if thisVar == 5 or (thatVar == 2 and otherVar == "x") then
  -- do something
end

-- ... is a more compact way of writing this:
if thisVar == 5 then
  -- do something
elseif thatVar == 2 and otherVar == "x" then
  -- do the same thing
end

Code:

function DoSomething(thisVar, thatVar, otherVar)
  -- do something
end

DoSomething(5, 2, "x")

However, I really feel like a broken record here, but copying all these Broker plugins and shoehorning them into kgPanels is really pointless. The Broker plugin you posted won't take up any more memory than a kgPanels panel running the same code (in fact, it will probably take up less memory) and a Broker display addon is not any more heavyweight than kgPanels -- but on any machine capable of running WoW at all, worring about a few dozen or even a few hundred KB is just laughably irrelevant. You might as well worry that one of your T-shirts has 15 more molecules than another, and that those few extra molecules are going to somehow be the difference between you being able to walk around normally, and you being collapsed into a black hole. That memory really does not matter one bit.

Akatosh 08-05-13 06:13 PM

I see the broker "RaidBuffs", and explore the code.

Dont apperar a lot of dificult... I understand it a bit.

The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

The code:

Code:

local ldb = LibStub("LibDataBroker-1.1")

--[[
local localizedClasses = {}
FillLocalizedClassList(localizedClasses)
local classLabels = {}
    populateClassLabels("HUNTER")
    populateClassLabels("WARRIOR")
    populateClassLabels("PALADIN")
    populateClassLabels("MAGE")
    populateClassLabels("PRIEST")
    populateClassLabels("WARLOCK")
    populateClassLabels("SHAMAN")
    populateClassLabels("DEATHKNIGHT")
    populateClassLabels("DRUID")
    populateClassLabels("MONK")
    populateClassLabels("ROGUE")
       
local populateClassLabels(class)
        classLabels[class] = {localizedClasses[class], RAID_CLASS_COLORS[class]}
        print(classLabels[class][1], classLabels[class][2], classLabels[class][3], classLabels[class][4])
end
--]]
       
-- displayName, active, {buff = {class [, note]}, ...}
local buffsList = {
        {"5% stats", false, {
                [20217] = {"PALADIN"}, -- Blessing of Kings
                [117666] = {"MONK"}, -- Legacy of the Emporer
                [1126] = {"DRUID"}, -- Mark of the Wild
                [90363] = {"HUNTER", "Exotic Pet"}, -- Embrace of the Shale Spider
                [133539] = {"Krasang Wilds Druid"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Attack Power", false, {
                [19506] = {"HUNTER"}, -- Trueshot Aura
                [6673] = {"WARRIOR"}, -- Battle Shout
                [57330] = {"DEATHKNIGHT"}, -- Horn of Winter
                [133540] = {"Krasang Wilds Warrior"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Attack Speed", false, {
                [113742] = {"ROGUE"}, -- Swiftblade's Cunning
                [55610] = {"DEATHKNIGHT", "Frost & Unholy"}, -- Unholy Aura
                [30809] = {"SHAMAN", "Enhancement"}, -- Unleashed Rage
                [128432] = {"HUNTER", "Pet"}, -- Cackling Howl
                [128433] = {"HUNTER", "Pet"}, -- Serpent's Swiftness
                [133541] = {"Krasang Wilds Rogue"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Spell Power", false, {
                [1459] = {"MAGE"}, -- Arcane Brilliance
                [61316] = {"MAGE"}, -- Dalaran Brilliance
                [77747] = {"SHAMAN"}, -- Burning Wrath
                [109773] = {"WARLOCK"}, -- Dark Intent
                [126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
                [133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Spell Haste", false, {
                [24907] = {"DRUID", "Balance"}, -- Moonkin Aura
                [24858] = {nil}, -- Druid's Moonkin Aura Self Buff
                [49868] = {"PRIEST", "Shadow"}, -- Mind Quickening
                [15473] = {nil}, -- Priest's Mind Quickening Self Buff
                [51470] = {"SHAMAN", "Elemental"}, -- Elemental Oath
                [135678] = {"HUNTER", "Pet"}, -- Energizing Spores
                [133545] = {"Krasang Wilds Shaman"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Mastery", false, {
                [19740] = {"PALADIN"}, -- Blessing of Might
                [116956] = {"SHAMAN"}, -- Grace of Air
                [93435] = {"HUNTER", "Pet"}, -- Roar of Courage
                [128997] = {"HUNTER", "Exotic Pet"}, -- Spirit Beast Blessing
                [133535] = {"Krasang Wilds Paladin"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Crit Chance", false, {
                [1459] = {"MAGE"}, -- Arcane Brilliance
                [61316] = {"MAGE"}, -- Dalaran Brilliance
                [17007] = {"DRUID", "Feral & Guardian"}, -- Leader of the Pack
                [116781] = {"MONK", "Windwalker"}, -- Legacy of the White
                [126373] = {"HUNTER", "Exotic Pet"}, -- Fearless Courage
                [24604] = {"HUNTER", "Pet"}, -- Furious Howl
                [126309] = {"HUNTER", "Exotic Pet"}, -- Still Water
                [90309] = {"HUNTER", "Exotic Pet"}, -- Terrifying Roar
                [133533] = {"Krasang Wilds Mage"}, -- Dominion Point/Lion's Landing NPCs
        }},
        {"Stamina", false, {
                [21562] = {"PRIEST"}, -- Power Word: Fortitude
                [469] = {"WARRIOR"}, -- Commanding Shout
                [109773] = {"WARLOCK"}, -- Dark Intent
                [90364] = {"HUNTER", "Exotic Pet"}, -- Qiraji Fortitude
                [133538] = {"Krasang Wilds Priest"}, -- Dominion Point/Lion's Landing NPCs
        }},
}

local BrokerRaidBuffs = ldb:NewDataObject("Broker_RaidBuffs", {
        type = "data source",
        text = "Please wait",
        value = 1,
        icon = "interface\\addons\\Broker_RaidBuffs\\BuffConsolidation",
        label = "RaidBuffs",
        OnTooltipShow = function(tooltip)
                tooltip:AddLine("Raidbuffs")
                for _,v in pairs(buffsList) do
                        local r, g, b
                        if v[2] then
                                r, g, b = 0, 1, 0
                        else
                                r, g, b = 1, 0, 0
                        end
                        tooltip:AddLine(v[1], r, g, b)
                end
        end
})

local function updateBuffs(self, event, unitID)
        if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then
                -- unflag the active buffs
                for i=1, #buffsList do
                        buffsList[i][2] = false
                end
               
                -- populate our buffs lookup table
                local activeBuffs, i = {}, 1
                local currentBuff = select(11, UnitBuff("player", i))
                while currentBuff do
                        activeBuffs[currentBuff] = true
                        i = i + 1
                        currentBuff = select(11, UnitBuff("player", i))
                end
               
                local activeRaidBuffs = 0
                -- start the lookup
                for i = 1, #buffsList do
                        local raidBuff = buffsList[i][3]
                        for key, _ in pairs(raidBuff) do
                                if activeBuffs[key] then
                                        buffsList[i][2] = true
                                        activeRaidBuffs = activeRaidBuffs + 1
                                        break
                                end
                        end
                end
               
                BrokerRaidBuffs.text = activeRaidBuffs .. " / 8"
        end
end

local EventFrame = CreateFrame("Frame")
EventFrame:RegisterEvent("UNIT_AURA")
EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
EventFrame:SetScript("OnEvent", updateBuffs)



Better?.

Thanks for the tips, Phanx, I dont want sound rude or border, I'm very grateful to the help that you have rendered me, I respect your point of view, but please be reciprocal with the mine, can be do it by two ways, Kgpanels or broker (or more, I think), is a matter of choice in my opinion.

I wish I could do it myself, but I can not learn faster than my personal life allows me to learn, sorry if I'm asking too much, but I have no alternative, because I do not understand how to do this.

Phanx 08-05-13 06:26 PM

Quote:

Originally Posted by Akatosh (Post 282469)
The problem be that, I dont have idea, How can I adap It, to a panel for kgpanels, I think that be posible do it.

See if you can make it work!!!

It's possible, yes, but while I'm willing to help out with simple scripting like "click to show something" or "change color based on class", a raid buff monitor is pretty far outside the realm of what I think kgPanels is designed to do, and there's no way I'm spending my free time rewriting other people's perfectly functional (and likely copyrighted) Broker plugins into complicated kgPanels scripts for you, sorry.

Akatosh 08-05-13 07:12 PM

Quote:

Originally Posted by Phanx (Post 282471)
It's possible, yes, but while I'm willing to help out with simple scripting like "click to show something" or "change color based on class", a raid buff monitor is pretty far outside the realm of what I think kgPanels is designed to do, and there's no way I'm spending my free time rewriting other people's perfectly functional (and likely copyrighted) Broker plugins into complicated kgPanels scripts for you, sorry.

I did not force you to help me, you are free to do it, or not, for other side I dont copy their broker, I just take their code as a reference to adapt it to kgpanels.

Even for me, I do not know almost nothing, I understand that is something completely different.

Fizzlemizz 08-05-13 08:57 PM

Hi Akatosh,

I see from the RaidBuffStatus page here at WowInterface that it is out of date and from the comments not working. I also see from the DL at Curse that the code, as Phanx pounted out, is most likely copyrighted and now uses 13 libraries and the core.lua file is nearly 5,000 lines long.

I'm sorry to say that in this case while it may be technically possible to do, it would not be quick or easy (even if someone had a clue where to start) and most likely is not worth the time.

Sorry.

Akatosh 08-05-13 09:54 PM

Quote:

Originally Posted by Fizzlemizz (Post 282479)
Hi Akatosh,

I see from the RaidBuffStatus page here at WowInterface that it is out of date and from the comments not working. I also see from the DL at Curse that the code, as Phanx pounted out, is most likely copyrighted and now uses 13 libraries and the core.lua file is nearly 5,000 lines long.

I'm sorry to say that in this case while it may be technically possible to do, it would not be quick or easy (even if someone had a clue where to start) and most likely is not worth the time.

Sorry.

Thanks for the reply, I have a bit issue with that.

http://www.wowinterface.com/forums/s...52&postcount=5

Works ok but, only for 1 time (1 mouseover), If I mouseover 2 times the text come one more time to original color. ¿You kwon how can I fix that?.

Thanks!!.

For the other side I countinue trying the part of the raidbuffs, I think that with time maybe can I do it, I refuse to give up so fast, there must be some way to do it.


All times are GMT -6. The time now is 07:12 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI