- Joined
- Jul 18, 2010
- Messages
- 2,291
This will probably get a vjass port in some days.
--[[ TasToolTipBox V4e by Tasyen
An additional TooltipBox for buttons in the command card/inventory which displays MissileSpeed, Cooldown, Range & Area values
changes position of ORIGIN_FRAME_UBERTOOLTIP
function TasToolTipBox.AddData(array, unitCode, objectCode)
Tell the TasToolTipBox that units of unitTypeId UnitCode have objectCode inside array. This is needed for BuiltMenu, LearnMenu & Selling/Training.
array should be one of the TasTooltipBox dataSets:
TasToolTipBox.DataBuilt
TasToolTipBox.DataLearn
TasToolTipBox.DataDefault
unitCode is the unitTypeId of the unit using this data.
objectCode is one RawCode in a string or a number 'Hpal'.
uses x/y coords of objectCode, therefore with colisions you get unwanted results
function TasToolTipBox.AddDataBatch(array, unitCode, objectCodeString)
uses TasToolTipBox.AddData with many rawCodes at once.
TasToolTipBox.AddDataBatch(TasToolTipBox.DataBuilt, 'hpea', "htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt")
TasToolTipBox.AddDataBatch(TasToolTipBox.DataDefault, 'htow', "hpea,Rhpm,hkee")
to get this string open the unit in object editor navigate to the field hold shift press enter which opens the field in text input, copy paste it.
works incorrect when multiple skills use 1 slot in the command card
works incorrect in group selection
works incorrect with spellbooks
requires BlzGetAbilityId for skills with more than 1 level (not Warcraft V1.31.1)
requires HoverOriginButton
]]
do
TasToolTipBox = {
--config start
TocPath = "war3mapImported\\TasToolTipBox.toc"
,AutoRun = true --(true) will create Itself at 0s, (false) you need to TasToolTipBox.Init()
,ParentFunc = function() return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) end -- should not be simple, called when TasToolTipBox is created the returned frame is used as parent
,Hide0Text = true -- hide a Slot when the displayed Text would be 0/0s/0.0s
,InfoCount = 5 -- how many Infos you want, every 4 are one row
,FixedPos = false -- true default tooltip pos does not change when TasToolTipBox is not shown
,ExcludSlots = {[7] = true} -- the buttonIndexes set, are not used in the auto ability detection -> this.ActionSpell; [7] = true -> ignore command button 7, 0 is the Top Left button 11 the bottom right
,Icon = { -- filePaths used for the icons, Indexes should fit the data used in this.ActionXxxx functions
"replaceabletextures/passivebuttons/pasbtntrueshot"
,"ui/widgets/battlenet/bnet-tournament-clock"
,"replaceabletextures/commandbuttons/btnload"
,"replaceabletextures/selection/spellareaofeffect_undead"
,"replaceabletextures/commandbuttons/btnreplay-speedup"
,"UI/Widgets/ToolTips/Human/ToolTipManaIcon"
}
,FilterItemSkills = true -- true items are never in the command card in your map
,EnableSubMenu = true -- true creates events/timer; changing it after the Init run is not supported/recommented.
,YPos = 0.17
--
-- manual stored data Display Actions
--
---@param buttonIndex integer active commandButton Index
---@param data type manual stored Data at buttonIndex for Learning
---@param unit unit active unit
---@param unitCode integer of unit
---@return boolean use/show the custom UI
,ActionSubMenuHero = function(buttonIndex, data, unit, unitCode)
-- requires EnableSubMenu
-- inside hero skill menu
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
end
,ActionSubMenuBuilt = function(buttonIndex, data, unit, unitCode)
-- requires EnableSubMenu
-- inside built menu
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
end
,ActionDefaultData = function(buttonIndex, data, unit, unitCode)
-- mostly meant for shops/trainers
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
end
--
-- autoDetect Actions
--
---@param buttonIndex integer active commandButton Index
---@param abi ability ability that uses the button
---@param abiCode integer rawCode of abi requires BlzGetAbilityId
---@param unit unit active unit
---@param unitCode integer of unit
---@param level integer abi index for abilityInstance api requires BlzGetAbilityId
---@return boolean use/show the custom UI
,ActionSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode)
-- displayed data in autoDetect ability
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
--BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))
return true
end
,ActionItemSpell = function(buttonIndex, abi, unit, abiCode, level, unitCode, item)
-- displayed data autoDetect inventoryButton-ability
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)).."s")
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level)))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level)))
BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level).."s")
--BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level))
return true
end
-- config ende
= "replaceabletextures/passivebuttons/pasbtntrueshot"
set Icon[2] = "ui/widgets/battlenet/bnet-tournament-clock"
set Icon[3] = "replaceabletextures/commandbuttons/btnload"
set Icon[4] = "replaceabletextures/selection/spellareaofeffect_undead"
set Icon[5] = "replaceabletextures/commandbuttons/btnreplay-speedup"
set Icon[6] = "UI/Widgets/ToolTips/Human/ToolTipManaIcon"
set ExcludSlots[7] = true // the buttonIndexes set, are not used in the auto ability detection -> ActionSpell; [7] = true -> ignore command button 7, 0 is the Top Left button 11 the bottom right
endfunction
public function ActionSubMenuHero takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
// requires EnableSubMenu
// what to display inside hero skill menu
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
endfunction
public function ActionSubMenuBuilt takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
// what to display inside built menu
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
endfunction
public function ActionDefaultData takes integer buttonIndex, integer data, unit u, integer unitCode returns boolean
// what to display with manual written data
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), GetObjectName(data))
return true
endfunction
public function ActionSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode returns boolean
// this is the place you can change the displayed data
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
//call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))
return true
endfunction
public function ActionItemSpell takes integer buttonIndex, ability abi, unit u, integer abiCode, integer level, integer unitCode, item it returns boolean
// Update displayed Text
// this is the place you can change the displayed data
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 1), I2S(BlzGetAbilityIntegerField(abi, ABILITY_IF_MISSILE_SPEED)))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 2), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_COOLDOWN, level)))+"s")
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 3), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CAST_RANGE, level))))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 4), I2S(R2I(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_AREA_OF_EFFECT, level))))
call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 5), R2SW(BlzGetAbilityRealLevelField(abi, ABILITY_RLF_CASTING_TIME, level),1,1)+"s")
//call BlzFrameSetText(BlzGetFrameByName("TasTooltipBoxInfoText", 6), I2S(BlzGetAbilityIntegerLevelField(abi, ABILITY_ILF_MANA_COST, level)))
return true
endfunction
// ==========
// Confg Ende
// ==========