Thread: New Addon Help

  1. #1

    New Addon Help

    Hi!

    I am attempting to create a new addon and have become stuck in the planning process. I am pretty sure I know how to grab all of the relevant data that I need for my addon except for the players hit rating. I have not seen any API's that allow for a call to get this info.

    Any help would be much appreciated.

  2. #2
    Deleted
    Code:
    GetCombatRating(CR_HIT_MELEE)
    Documentation

    EDIT: CR_HIT_MELEE is a global that contains the numeric stat ID for hit rating. You can locally fetch this on load.

  3. #3
    Thanks for the help! Now I have run into a new issue since I started coding.

    I am trying to get the item stats so that I can begin to use them in calculations. However, i cant seem to even get a stat out using getitemstats(). To simplify troubleshooting the table and ability to pull stats I have simply made a table, tried to populate it, and am trying to display a stat value. Once I do this, I know I am getting the stats and can then move on to using them in calculations. Code is below.

    Code:
    function TipTypeFuncs:item(linkToken,id)
    	local owner = self:GetOwner();
    	local _, _, _, itemLevel, _, _, _, itemStackCount, _, itemTexture = GetItemInfo(id);
    	--EP MOD by Dagodz
    	var stats = {};
    	GetItemStats(id, stats);
            local itemstamina = stats[ITEM_MOD_STAMINA_SHORT];
    	-- Icon
    	if (self.SetIconTextureAndText) and (not cfg.if_smartIcons or not (owner.hasItem or owner.link or owner.action)) then
    		local count = itemStackCount and itemStackCount > 1 and (itemStackCount == 0x7FFFFFFF and "#" or itemStackCount) or "";
    		self:SetIconTextureAndText(itemTexture,count);
    	end
    	-- level + id
    	if (cfg.if_showItemLevelAndId) then
    		self:AddLine(format("ItemLevel: %d, ItemID: %d",itemLevel or 0,id or 0),unpack(cfg.if_infoColor));
    		self:AddLine(format("Item Stamina: %d,itemstamina or 0,),unpack(cfg.if_infoColor));
                    self:Show();
    	end
    end
    My ultimate goal here for the first phase of this mod is to take the stats from an item and run them through a calculation function to then present the EP value on to a tooltip. I use TipTac and have started modifying it for myself. Thanks for any help.

  4. #4
    Deleted
    Code:
    local itemstamina = stats[ITEM_MOD_STAMINA_SHORT];
    You're missing quotes.

    ---------- Post added 2011-01-04 at 04:48 PM ----------

    Code:
    GameTooltip:HookScript("OnTooltipSetItem", function(self)
        local _, link = self:GetItem()
        local stats = GetItemStats(link)
        local ep = 0
        for stat, amount in pairs(stats) do
            -- add ep every time with ep=ep+(amount*value)
        end
        self:AddLine("EP: "..ep, 1, 1, 1) -- r, g, b
    end)
    Untested, obviously.

Posting Permissions

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