Log:
HellbenderDKP:
- Fixed filenames for auto zip generation
Added:
trunk/HellbenderDKP/HellbenderDKP.lua
- copied unchanged from r45019, /trunk/HellbenderDKP/Hellbender.lua
trunk/HellbenderDKP/HellbenderDKP.toc
- copied, changed from r45019, /trunk/HellbenderDKP/Hellbender.toc
Removed:
trunk/HellbenderDKP/Hellbender.lua
trunk/HellbenderDKP/Hellbender.toc
Deleted: trunk/HellbenderDKP/Hellbender.lua
==============================================================================
--- trunk/HellbenderDKP/Hellbender.lua Fri Jul 27 23:30:36 2007
+++ (empty file)
@@ -1,464 +0,0 @@
-
---[[
- Name: Hellbender DKP
- Author: Earthbane @ Hellscream
- Contact: earthb...@gishpuppy.com
-
- Description:
- Hellbender DKP is a replacement for HoB_DKP and works initially using the same
- formulas as HoB_DKP. It will dynamically generate DKP values for items based on
- the item's atributes. The importance of item atributes can be customized to tweek
- the importance of certain stats to certain classes.
-
- The aim for Hellbender is to be easier to customize the DKP weights and make it
- easier for others to hack to their needs
-
- Complimentary Addons:
- CT_Raidtracker - Hellbender should be able to send it's DKP values to
- CTRA when it records the item in the raid.
---]]
-
--------------------
--- Localize globals
--------------------
-local L = AceLibrary("AceLocale-2.2"):new("Hellbender");
-local BC = AceLibrary("Babble-Class-2.2");
-local BI = AceLibrary("Babble-Inventory-2.2");
-
-------------------
--- Library Loading
-------------------
-local ibl = AceLibrary("ItemBonusLib-1.0")
-Hellbender = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceEvent-2.0", "AceDB-2.0","AceHook-2.1");
-
------------------------------
--- Configure Default Settings
------------------------------
-local options = {
- type='group',
- args = {
- debug = {
- type = 'range',
- name = L['Debug'],
- desc = L['Enable debug output'],
- get = "GetDebug",
- set = "SetDebug",
- min = 0,
- max = 3,
- },
-
- showEligibleClasses = {
- type = 'toggle',
- name = L['Eligibility'],
- desc = L['Toggle to show in tooltip those classes who are able to use the weapon'],
- get = "ShowEligibleClasses",
- set = "ToggleShowEligibleClasses",
- },
-
- showClass = {
- type = 'toggle',
- name = L['Class'],
- desc = L["Toggle to show in tooltip which class's DKP modifiers were used for final DKP value"],
- get = "ShowDKPClass",
- set = "ToggleShowDKPClass",
- },
-
- dkpPrecision = {
- type = 'range',
- name = L['Precision'],
- desc = L['Set precision in DKP result, how many decimal places to show.'],
- min = 0,
- max = 6,
- get = "GetDKPPrecision",
- set = "SetDKPPrecision",
- },
-
- dkpMultiplier = {
- type = 'range',
- name = L['multiplier'],
- desc = L['Multiply the final DKP calculation by this amount'],
- min = 1,
- max = 100,
- get = "GetDKPMultiplier",
- set = "SetDKPMultiplier",
- },
- },
-}
-
-Hellbender:RegisterChatCommand(L["Slash-Commands"], options);
-
-Hellbender:RegisterDB("HellbenderDB","HellbenderDBPC");
-Hellbender:RegisterDefaults("profile", {
- debug = 0,
- showEligibleClasses = true,
- showClass = true,
- dkpPrecision = 2,
- dkpMultiplier = 1,
-} )
-
------------------------------------
--- Slash Command Property Functions
------------------------------------
-function Hellbender:GetDKPMultiplier()
- return self.db.profile.dkpMultiplier;
-end
-
-function Hellbender:SetDKPMultiplier(NewValue)
- self.db.profile.dkpMultiplier = NewValue;
-end
-
-function Hellbender:GetDKPPrecision()
- return self.db.profile.dkpPrecision;
-end
-
-function Hellbender:SetDKPPrecision(NewValue)
- self.db.profile.dkpPrecision = NewValue;
-end
-
-function Hellbender:ShowDKPClass()
- return self.db.profile.showClass;
-end
-
-function Hellbender:ToggleShowDKPClass()
- self.db.profile.showClass = not self.db.profile.showClass;
-end
-
-function Hellbender:ShowEligibleClasses()
- return self.db.profile.showEligibleClasses;
-end
-
-function Hellbender:ToggleShowEligibleClasses()
- self.db.profile.showEligibleClasses = not self.db.profile.showEligibleClasses;
-end
-
-function Hellbender:GetDebug()
- return self.db.profile.debug;
-end
-
-function Hellbender:SetDebug(NewValue)
- self.db.profile.debug = NewValue;
-end
-
------------------
--- Event Handlers
------------------
-function Hellbender:OnInitialize()
-
-end
-
-function Hellbender:OnEnable()
-
- -- Borrowed basic code and concept from TipHooker-1.0
- tooltips = {
- ["GameTooltip"] = true,
- ["ItemRefTooltip"] = true,
- ["ShoppingTooltip"] = true,
- -- EquipCompare support
- ["ComparisonTooltip"] = true,
- -- EQCompare support
- ["EQCompareTooltip"] = true,
- -- takKompare support
- ["tekKompareTooltip"] = true,
- -- LinkWrangler support
- ["IRR_"] = true,
- ["LinkWrangler"] = true,
- -- MultiTips support
- -- Links support
- ["LinksTooltip"] = true,
- -- AtlasLoot support
- ["AtlasLootTooltip"] = true,
- -- ItemMagic support
- ["ItemMagicTooltip"]= true,
- -- Sniff support
- ["SniffTooltip"] = true,
- };
-
- local tooltip = EnumerateFrames();
- while tooltip do
- if tooltip:GetObjectType() == "GameTooltip" then
- local name = tooltip:GetName();
- if name then
- self:Debug("Found GameTooltip: "..name,1);
- if tooltips[name] then
- self:Debug("InitializeHook(item) = "..name,1);
- self:HookScript(tooltip, "OnTooltipSetItem")
- end
- end
- end
- tooltip = EnumerateFrames(tooltip)
- end
-
- if self.db.profile.debug >= 1 then
- self:HookReport();
- end
-
- if HDKP_GetDKP then
- -- Replace call to Hob_DKP with our own magic juice
- HDKP_GetDKP = Hellbender_HDKP_GetDKP_Hack;
- self:Debug("HoB_DKP hook overridden",1);
- end
-
- self:Print("Enabled and registered");
-
-end
-
-function Hellbender:OnDisable()
-
-end
-
-
-function Hellbender:Debug(message, level)
- if self.db.profile.debug >= level then
- self:Print(message)
- end
-end
-
---------
--- Hooks
---------
-
----------------------------------------------
--- OnTooltipSetItem
---
--- A tooltip we hooked has recieved an item to
--- display. We will extract the item, get the
--- DKP value, and display it.
----------------------------------------------
-function Hellbender:OnTooltipSetItem(tooltip,...)
- if self.db.profile.debug >= 2 then
- self:Print("In OnTooltipSetItem");
- end
- local item, link = tooltip:GetItem();
- if not item then
- self:Debug("No item given ("..item.." , "..link..") from "..tooltip:GetName(),2);
- return self.hooks[tooltip].OnTooltipSetItem(tooltip, ...)
- else
- self:Debug("Got item ("..item.." , "..link..") from "..tooltip:GetName(),2);
- end
-
- local dkp, highClass, damageClass = self:GimmieDKP(link);
-
- if highClass ~= nil then
- self:Debug("Printing results.",1);
-
- local dkpString = format("%."..self.db.profile.dkpPrecision.."f",dkp * self.db.profile.dkpMultiplier);
- if self.db.profile.showClass then
- dkpString = dkpString.." ("..highClass;
- if damageClass ~= nil then
- dkpString = dkpString.."/"..damageClass;
- end
- dkpString = dkpString..")";
- end
- tooltip:AddDoubleLine("DKP:",dkpString,1,1,1,1,1,1);
- end
-
- return self.hooks[tooltip].OnTooltipSetItem(tooltip, ...);
-end
-
-function Hellbender:GimmieDKP(itemLinkOrString)
- local bonuses = ibl:ScanItem(itemLinkOrString,true);
- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,itemEquipLoc, itemTexture = GetItemInfo(itemLinkOrString);
-
- self:Debug(itemName..":"..itemLink..":"..itemRarity..":"..itemLevel..":"..itemMinLevel..":"..itemType..":"..itemSubType..":"..itemStackCount..":"..itemEquipLoc..":"..itemTexture,1);
-
- if self.db.profile.debug >= 1 then
- for stat,value in pairs(bonuses) do
- self:Print(ibl:GetBonusFriendlyName(stat).."("..stat..") => "..value);
- end
- end
-
- local slotModifier = 1;
- local DKPValues = {};
- local tempDKP = 0;
- local highClass = nil;
- local eligible = false;
- local isCaster = false;
- local users = {}; -- List of classes that can use item
-
- if itemType == L['Armor'] and ItemSlotWeights[itemEquipLoc] ~= nil then
- self:Debug("Slot Weight Adjusted. "..itemEquipLoc.." with weight "..ItemSlotWeights[itemEquipLoc],2);
- slotModifier = ItemSlotWeights[itemEquipLoc];
- end
-
- -- Check if it's a caster weapon, ignore bows, xbows, and guns
- if itemType == L['Weapon'] and NonCasterRangedLocations[itemEquipLoc] ~= nil then
- if itemEqipLoc == "INVTYPE_RANGEDRIGHT" then
- isCaster = true;
- else
- for stat,_ in pairs(bonuses) do
- if CasterFlags[stat] ~= nil then
- isCaster = true;
- break;
- end
- end
- end
- end
-
-
- --[[
- Work out the DKP value for the stats of the item.
-
- If it's a weapon, we will later check it's damage output
- and add the Weapon Damage DKP to the stat DKP
- ]]--
- for class,weights in pairs(StatModifiers) do
- eligible = false;
- if itemType == L['Armor'] then
- -- Work out if eligible class
- self:Debug("Armor check. Class: ("..class..") Subtype: ("..itemSubType..")",2);
- if ArmorUse[itemSubType] ~= nil and ArmorUse[itemSubType][class] ~= nil then
- eligible = true;
- end
- end
-
- if itemType == L['Weapon'] then
- self:Debug("Weapon check. Class: ("..class..") Subtype: "..itemSubType,2);
- if WeaponUse[itemSubType] ~= nil and WeaponUse[itemSubType][class] ~= nil then
- self:Debug(class.." is able to use "..itemSubType,2);
- eligible = true;
- end
- end
-
- if eligible then
- for stat,value in pairs(bonuses) do
-
- if DKPValues[class] == nil then
- DKPValues[class] = 0;
- end
-
- if weights[stat] ~= nil then
- DKPValues[class] = DKPValues[class] + value * weights[stat] * slotModifier;
- end
-
- if highClass == nil then
- highClass = class
- else
- if DKPValues[class] >= DKPValues[highClass] then
- highClass = class;
- end
- end
- end
- end
- --self:Print(key.." => "..value)
- --tooltip:AddDoubleLine(ibl:GetBonusFriendlyName(key),value,1,1,1,r,g,b);
- end
-
- -- Now workout Weapon Damage DKP value
- local damageClass = "No DMG";
- local typeWeight = 1;
- local weaponDKP = -1;
- local sub = 0;
- local dpsWeight = 1;
- local topDamageWeight = 1;
- local dps = 0;
-
- if itemType == L['Weapon'] then
-
- -- 2 Handed caster weapons will have Damage DKP included. All other caster items (save wand) have
- -- Damage dkp values ignored
- if isCaster and itemEquipLoc == "INVTYPE_2HWEAPON" and CasterWeaponsWeights[itemEquipLoc][itemSubType] ~= nil then
-
- sub = CasterWeaponsWeights[itemEquipLoc][itemSubType].sub;
- dpsWeight = CasterWeaponsWeights[itemEquipLoc][itemSubType].dps;
- topDamageWeight = CasterWeaponsWeights[itemEquipLoc][itemSubType].top;
-
- dps = ((bonuses["WEAPON_MAX"] + bonuses['WEAPON_MIN'])/2) / bonuses['WEAPON_SPEED'];
- weaponDKP = (((dps * dpsWeight) + (bonuses["WEAPON_MAX"] * topDamageWeight) - sub) * 2 ) * 0.35;
-
- -- Since only Shaman and Pallies can use these caster, we will figure out which of their
- -- stat DKPs we will use
- if DKPValues[BC["Shaman"]] > DKPValues[BC["Paladin"]] then
- damageClass = BC["Shaman"];
- else
- damageClass = BC["Paladin"];
- end
-
- highClass = damageClass;
-
- self:Debug("Caster 2H Results: "..damageClass.." ("..weaponDKP..") "..bonuses["WEAPON_MAX"]..","..bonuses["WEAPON_MIN"]..","..bonuses["WEAPON_SPEED"],1);
- end
-
- -- All other non-ranged weapon checks
- -- Weapons are evaluated from a Warrior (Tank) standpoint and Rogue (Melee DPS) standpoint
- -- The higher dkp result is the winner
- if not isCaster and NonCasterRangedLocations[itemEquipLoc] == nil and itemEquipLoc ~= "INVTYPE_RANGEDRIGHT" then
- -- IDEA Could possibly make this smoother. some of below is copy and pasted from above
- local warDKP, rogueDKP = 0,0
- dps = ((bonuses["WEAPON_MAX"] + bonuses['WEAPON_MIN'])/2) / bonuses['WEAPON_SPEED'];
-
- if WarriorWeaponsWeights[itemEquipLoc][itemSubType] ~= nil then
- sub = WarriorWeaponsWeights[itemEquipLoc][itemSubType].sub;
- dpsWeight = WarriorWeaponsWeights[itemEquipLoc][itemSubType].dps;
- topDamageWeight = WarriorWeaponsWeights[itemEquipLoc][itemSubType].top;
-
- self:Debug("Warrior modifiers: "..sub..","..dpsWeight..","..topDamageWeight,1);
-
- warDKP = ((dps * dpsWeight) + (bonuses["WEAPON_MAX"] * topDamageWeight) - sub) * 0.8;
- if itemEquipLoc == "INVTYPE_2HWEAPON" then
- warDKP = warDKP * 2;
- end
- end
-
- if RogueWeaponsWeights[itemEquipLoc] ~= nil and RogueWeaponsWeights[itemEquipLoc][itemSubType] ~= nil then
- sub = RogueWeaponsWeights[itemEquipLoc][itemSubType].sub;
- dpsWeight = RogueWeaponsWeights[itemEquipLoc][itemSubType].dps;
- topDamageWeight = RogueWeaponsWeights[itemEquipLoc][itemSubType].top;
-
- self:Debug("Rogue modifiers: "..sub..","..dpsWeight..","..topDamageWeight,1);
-
- rogueDKP = (dps * dpsWeight) + (bonuses["WEAPON_MAX"] * topDamageWeight) - sub;
- end
-
- if warDKP > rogueDKP then
- weaponDKP = warDKP;
- damageClass = BC["Warrior"];
- else
- damageClass = BC["Rogue"];
- weaponDKP = rogueDKP;
- end
-
- self:Debug("Non-ranged melee Results: "..damageClass.." ("..weaponDKP..") "..bonuses["WEAPON_MAX"]..","..bonuses["WEAPON_MIN"]..","..bonuses["WEAPON_SPEED"],1);
- end
-
- -- Finish off weapon DKP calcs with ranged
- if NonCasterRangedLocations[itemEquipLoc] ~= nil or itemEquipLoc == "INVTYPE_RANGEDRIGHT" then
- sub = RangedWeaponsWeights[itemSubType].sub;
- dpsWeight = RangedWeaponsWeights[itemSubType].dps;
- topDamageWeight = RangedWeaponsWeights[itemSubType].top;
-
- dps = ((bonuses["WEAPON_MAX"] + bonuses['WEAPON_MIN'])/2) / bonuses['WEAPON_SPEED'];
- weaponDKP = (dps * dpsWeight) + (bonuses["WEAPON_MAX"] * topDamageWeight) - sub;
-
- damageClass = L['Ranged'];
-
- self:Debug("Ranged Results: "..damageClass.." ("..weaponDKP..") "..bonuses["WEAPON_MAX"]..","..bonuses["WEAPON_MIN"]..","..bonuses["WEAPON_SPEED"],1);
-
- end
- if WeaponTypeWeights[itemType] ~= nil then
- weaponDKP = WeaponTypeWeights[itemType] * weaponDKP;
- end
-
- end
-
- if itemType ~= L['Weapon'] then
- damageClass = nil;
- end
-
- if weaponDKP > 0 then
- DKPValues[highClass] = DKPValues[highClass] + weaponDKP;
- end
-
- return DKPValues[highClass], highClass, damageClass;
-end
-
---[[
- Taking function from HoB_DKP to work with CT_Raidassist
-]]--
-function Hellbender_HDKP_GetDKP_Hack(itemid, enchantid, subid, extra)
- -- item:itemid:enchantid:subid:extra
- Hellbender:Debug("In CTRT Hook: item:"..itemid..":"..enchantid..":"..subid..":"..extra,1);
- local itemString = "item:"..itemid..":"..enchantid..":"..subid..":"..extra;
- local dkp = Hellbender:GimmieDKP(itemString);
- Hellbender:Debug("CTRA DKP Returned: "..dkp);
- return dkp;
-end
\ No newline at end of file
Deleted: trunk/HellbenderDKP/Hellbender.toc
==============================================================================
--- trunk/HellbenderDKP/Hellbender.toc Fri Jul 27 23:30:36 2007
+++ (empty file)
@@ -1,28 +0,0 @@
-## Interface: 20100
-## Title: Hellbender DKP
-## Notes: Dynamic item DKP calculation
-## Author: Earthbane @ Hellsceam
-## eMail: earthb...@gishpuppy.com
-## Version: 1.0
-## X-Category: Raid
-## OptionalDeps: Ace2, CT_RaidAssist, Babble-2.2
-## SavedVariables: HellbenderDB
-## SavedVariablesPerCharacter: HellbenderDBPC
-
-libs\AceLibrary\AceLibrary.lua
-libs\AceOO-2.0\AceOO-2.0.lua
-libs\AceAddon-2.0\AceAddon-2.0.lua
-libs\AceConsole-2.0\AceConsole-2.0.lua
-libs\AceDB-2.0\AceDB-2.0.lua
-libs\AceEvent-2.0\AceEvent-2.0.lua
-libs\AceLocale-2.2\AceLocale-2.2.lua
-libs\AceHook-2.1\AceHook-2.1.lua
-libs\Babble-Class-2.2\Babble-Class-2.2.lua
-libs\Babble-Inventory-2.2\Babble-Inventory-2.2.lua
-libs\ItemBonusLib\ItemBonusLib-1.0\ItemBonusLib-1.0.lua
-
-
-Locale-enUS.lua
-CostModifiers.lua
-ClassItemUsage.lua
-Hellbender.lua
\ No newline at end of file
Copied: trunk/HellbenderDKP/HellbenderDKP.toc (from r45019, /trunk/HellbenderDKP/Hellbender.toc)
==============================================================================
--- /trunk/HellbenderDKP/Hellbender.toc (original)
+++ trunk/HellbenderDKP/HellbenderDKP.toc Fri Jul 27 23:30:36 2007
@@ -25,4 +25,4 @@
Locale-enUS.lua
CostModifiers.lua
ClassItemUsage.lua
-Hellbender.lua
\ No newline at end of file
+HellbenderDKP.lua
\ No newline at end of file