Close
Showing results 1 to 9 of 9

Hybrid View

  1. #1

    Default

    As far as I know, the API for UnitPower has types, and combo points aren't listed as usable.

    Did you add this code into a folder, or stuffed it inside another addon?
    Vek'linash - Alliance
    Morra -5 man PVE <League of Crafters>
    Prank - Rogue - Solo Toon
    PVP Druid Team - Boxone, Boxtwo, Boxthree, Boxfour, Boxfive. 2 Resto, 3 Feral

  2. #2

    Default

    As far as I know, the API for UnitPower has types, and combo points aren't listed as usable.
    yes exact.
    combo points are not "shown" with UnitPower("unit",type").
    In UnitPower "unit" is the "unit"-power to show.
    and "type" has values from 1 to 9:
    1)mana,2)rage,3).....9)holypower, no combo points but energy is avaible for rogues/cat druids here with this API function.
    for many types of energy it works for "player" as "unit" but doesnt work for specific characters names( bad limit for Mboxers), so i decided to use communications.
    In this way it works outside groups, communications are always sent and recieved if characters involved in send-recieve are online in same server at same time. Ofc characters need to be configured in the code as senders and reciever.

    not sure what happens with chars names in BG, but according some documents i read, simple chars names like "Prega", for example, in BG become "Prega-Alonsus", where alonsus is my server name.
    a simple condition added in 'IF then' statement will solve all communications issues in BG.

    Combo Points are different. the main issue is combo points are target related.
    Manage combo points surely is a bit + complicated.
    somenthing have to happen when you change target or if you targetting for mistake/lag something wrong: otherwize you display wrong values.
    But there are some events "generators" like UNIT_COMBO_POINTS, fired when combo points happen and usable in a similar logical scheme to communicate and display the values.
    Or simply use function GetComboPoints(unit, target): unit="player" and target is target explicitly declared. looks easier to use but it needs some code to manage what happens when targets are different for slaves and main.
    This happens expecially when main switch target etc.

    A lot easier looks display Rune values for DK.
    Rune works with UnitPower, it is type 5.
    Not sure about what format have data output (not tested atm).
    maybe requires some little fix.
    Explain. You know Runes are 3 "sub-types": blood, frost and unholy.
    it s good know amount avaible and, ofc, sub-type in real time, not just a simple undefined number.

    Did you add this code into a folder, or stuffed it inside another addon?
    this is a little addon internal code:
    i know it s not a complete addon...in normal sense hehe.
    but little time to create a easier way to use it.
    idea was to share general infos about how it s possible and "easy" manage things like holy power etc etc with simple code (believe me it s a simple code, rewritten trying to avoid usage of strange complex functions, avoiding xml usage, avoiding framework usage etc etc, keeping in this way code + readable)
    yes, , atm customization cant result so easy .
    here missing .toc file, a needed file for any addons: it defines .lua file association and, implicitly, addon folder.

    i try to show a step by step a customization process.

    open a notepad file, copy the whole named file_1 content in your empty notepad file. as above.
    Save this file as a .Lua, giving it as name "Multihp.lua". Tips: verify it is saved as a .lua not a.txt.

    In file_1:
    -STEP1

    Code:
    -- player [1] is always leader. others are 2-5
    -- Holy Power values are shown with text
    
    local MyGrp = {
    [1] = "Prega",
    [2] = "Alad",
    [3] = "Redcrox" ,
    [4] = "Whitecrox" ,
    [5] = "Yargo"
    }
    sub "Prega" with your main name, aka name of char where you want show holypower for all group.keep "name" format.
    after that, keeping number order, sub "Alad" name with your char nr 2 and then redcrox and so on etc etc.
    ------------------
    -STEP2

    --------------------------frame1=PREGA--local frame for main(prega) hp--
    frame1 = CreateFrame("Frame", "frame1", UIParent)
    text1 = frame1:CreateFontString()

    frame1:SetPoint("CENTER",0, -100)
    frame1:SetWidth(128)
    frame1:SetHeight(128)
    frame1:SetMovable(true)
    frame1:EnableMouse(true)
    text1:SetAllPoints(frame1)
    text1:SetFont("Fonts\\ARIALN.TTF", 32)


    frame1:RegisterForDrag("LeftButton")
    frame1:SetScript("OnDragStart", function(self) self:StartMoving() end)
    frame1:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)


    --------------------------frame2=ALAD
    frame2 = CreateFrame("Frame", "frame2", UIParent)
    text2 = frame2:CreateFontString()......................... .
    Delete the bold-underline text if you going to use a Main char is NOT A PALADIN.
    -----------------

    STEP3

    Code:
    --------handle event UNIT POWER for main:not useful if main is not a paladin
    function handler1(self,event, ...)
    
        local source, type = select(1, ...);
        if source == "player" and type == "HOLY_POWER" then
            p = UnitPower("player",9)
            text1:SetText(p)
    
        end
    end
    Again, IF YOUR MAIN IS NOT A PALADIN, delete. bold-underline text
    --------

    STEP4

    Code:
    -------- set handlers and register events for each frames
    
    frame1:SetScript("OnEvent", handler1)
    frame2:SetScript("OnEvent", handler2)
    frame3:SetScript("OnEvent", handler2)
    frame4:SetScript("OnEvent", handler2)
    frame5:SetScript("OnEvent", handler2)
    frame1:RegisterEvent("UNIT_POWER")
    frame2:RegisterEvent("CHAT_MSG_ADDON")
    frame3:RegisterEvent("CHAT_MSG_ADDON")
    frame4:RegisterEvent("CHAT_MSG_ADDON")
    frame5:RegisterEvent("CHAT_MSG_ADDON")
    Delete, IF YOUR MAIN IS NOT A PALADIN, bold-underline text

    Save and exit
    -------------------------

    STEP ON file_2.lua
    Open a new notepad empty file, copy in it code from file_2 above and give it name "Multihp1.lua" and save as .lua file type.

    in file_2 content, at 1st line

    Code:
    ---------------------------------------
    local gl = "Prega"
    local myname =UnitName ("player")
    local w = "WHISPER"
    change "Prega", with name of your Main name.
    save and exit.

    go in wow/interface/addon folder and create a new folder called "Multihp" for your main char addon.
    Put Multihp.lua in this folder.

    in this folder create a new notepad empty file, name it "Multihp.toc"
    copy/paste this content:

    Code:
    ## Author: Me
    ## Interface: 40000
    ## Title: Multihp
    ## Version: 1.0
    Multihp.lua
    save as .toc file and exit

    for each slaves, if you use multiple wow folders, or just 1 time if you use a single wow folder, create a new folder in wow/interface/addons path and name it "Multihp1". It hosts the addon for slaves.
    in this folder create the .toc with notepad, as explained and name it "Multihp1.toc"

    Code:
    ## Author: Me
    ## Interface: 40000
    ## Title: Multihp1
    ## Version: 1.0
    Multihp1.lua
    unique things different are the bold-underline text.
    put in folder Multihp1 the file Multihp1.lua file.

    at the end each folder, Multihp and Multihp1, have to contain 2 files:
    in Multihp folder, files are Multihp.lua and Multihp.toc. Multihp.lua is file_1 modified
    in Multihp1 folder, files are Multihp1.lua and Multihp1.toc. Multihp1.lua is file_2 modified.

    check for main char only Multihp is active as addon and Multihp1 is active as addon only for slaves chars.

    i know, it sounds complicated
    Last edited by Prega : 11-24-2010 at 10:44 AM

Posting Rules

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