--[[ TasSkillSetPicker V1 by Tasyen
TasSkillSetPicker.DefineCategory(icon, text) -> number categoryValue
make a new category
categories need to be made before the UI is created.
TasSkillSetPicker.Add(spellCode, category)
add an new Spell as option with category.
i Suggest to store categories in variables and add them
TasSkillSetPicker.Add('AHhb', 1 + 2)
spellCode can be a Table expects some Keys {Icon = img, Text = bigText, Name = smallText}
you can add after the ui was created or before.
this can be used to set the category of already added choices
TasSkillSetPicker.LockCategory(buttonIndex, category)
the skill selected at buttonIndex needs to have this category, it can have other categories aswell.
buttonIndex starts with 1
TasSkillSetPicker.BanCategory(buttonIndex, category)
the skill selected at buttonIndex can not have this category.
TasSkillSetPicker.ActionButtonAccept(frame, player)
finish player, use nil for frame,
fills unset slots with randoms
TasSkillSetPicker.ForcePickNow()
all players PLAYER_SLOT_STATE_PLAYING are forced to accept now, if they did not already.
TasSkillSetPicker.ResetPlayer([player])
players chosen data is removed and can use ui again
no player = all players
TasSkillSetPicker.ShowOtherPlayerBars([show, player])
TasSkillSetPicker.ClearData()
remove all choseable options.
requires
GetPlayerColorTexture
TasButtonList V15
TasWindow
TasFrameList
TasFrameAction
optional
TasAbilityData (ToolTipGenInfo = true)
]]
do
local this = {}
this.Show = true -- Show on Creation
this.TocPath = "war3mapImported\\TasSkillSetPicker.toc"
this.BarSlotCount = 6 -- button in one Bar 1 to 12, dont change after creation
this.ParentFunc = function() return BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) end
this.PosX = 0.77
this.PosY = 0.55
this.SizeX = 0.51 -- total Size with Bars & editor
this.SizeY = 0.37
this.Pos = FRAMEPOINT_TOPRIGHT
this.ToolTipGenInfo = true -- (true) Add generic spell Fields to the displayed tooltip text (only for number choices). requires GetGenericSpellData
this.ShowBars = true -- preview other player builts (false) makes the UI smaller
this.ShowEnemy = true -- can look into enemy builts false/true?
this.FilterNotAllowed = "ui/widgets/battlenet/chaticons/bnet-squelch" -- TasSkillSetPicker.BanCategory
this.FilterNotUsed = "textures/black32" -- user does not search by this category
this.FilterEnforced = "ui/widgets/glues/gluescreen-checkbox-check" -- TasSkillSetPicker.LockCategory
-- accept/random/show Button
-- a button that allows the user to show a hidden TasSkillSetPicker
this.ShowButtonShow = true
this.ShowButtonParentFunc = function() return BlzGetFrameByName("InsideMainPanel", 0) end
this.ShowButtonText = "Skill Picker" --tries Localizing
this.ShowButtonPosX = 0.1
this.ShowButtonPosY = 0.55
-- accept/random Button
this.ControlButtonSizeX = 0.085
this.ControlButtonSizeY = 0.03
this.RandomButtonText = "RANDOM" --tries Localizing
this.AcceptButtonText = "ACCEPT" --tries Localizing
this.RandomButtonTooltip = "Randomize the current Slot" --tries Localizing
this.AcceptButtonTooltip = "Finish selection & Fills unused slots" --tries Localizing
this.EditorBarTitle = "SkillSet Editor"
this.EditorBarIcon = "replaceabletextures/commandbuttons/btnengineeringupgrade"
this.SearchBarTooltip = "Search in Ability Name & Text, Ignores Case"
this.AllowPlayer = function(player)
-- this should be edited for your maps need.
-- used by ForcePickNow & to consider if this player is added to the other players view
-- return false to reject a player
if GetPlayerSlotState(player) ~= PLAYER_SLOT_STATE_PLAYING then return false end
return true
end
this.PlayerDone = function(player, spellArray)
-- this function happens when a player finished the picking
this.PlayerHasDone[player] = true -- remember this player finished
this.EnableControl(player, false)
-- what to do with the choice
TasHeroLearnEx.HeroData[player] = spellArray
end
-- how to display a choice in the list and its tooltip?
function this.ActionSpellListDraw(frameObject, data)
if not data then data = 0 end
if type(data) == "number" then
BlzFrameSetTexture(frameObject.Icon, BlzGetAbilityIcon(data), 0, false)
BlzFrameSetTexture(frameObject.IconPush, BlzGetAbilityIcon(data), 0, false)
BlzFrameSetTexture(frameObject.IconOff, BlzGetAbilityIcon(data), 0, false)
BlzFrameSetText(frameObject.Text, GetObjectName(data))
BlzFrameSetTexture(frameObject.ToolTipFrameIcon, BlzGetAbilityIcon(data), 0, false)
BlzFrameSetText(frameObject.ToolTipFrameName, GetObjectName(data))
--BlzFrameSetText(frameObject.ToolTipFrameText, BlzGetAbilityResearchExtendedTooltip(data, 0))
if this.ToolTipGenInfo and data > 0 then
BlzFrameSetText(frameObject.ToolTipFrameText, BlzGetAbilityResearchExtendedTooltip(data, 0).. TasAbilityData.GetGenericFields(data))
else
BlzFrameSetText(frameObject.ToolTipFrameText, BlzGetAbilityResearchExtendedTooltip(data, 0))
end
elseif type(data) == "table" then
BlzFrameSetTexture(frameObject.Icon, data.Icon, 0, false)
BlzFrameSetTexture(frameObject.IconPush, data.Icon, 0, false)
BlzFrameSetTexture(frameObject.IconOff, data.Icon, 0, false)
BlzFrameSetText(frameObject.Text, data.Text)
BlzFrameSetTexture(frameObject.ToolTipFrameIcon, data.Icon, 0, false)
BlzFrameSetText(frameObject.ToolTipFrameName, data.Name)
BlzFrameSetText(frameObject.ToolTipFrameText, data.Text)
end
end
-- how to search
function this.ActionSpellListSearch(data, text, buttonListObject)
if not text or text == "" then return true end
text = string.lower(text)
if type(data) == "number" then
if string.find(string.lower(GetObjectName(data)), text, 1, true) then return true end
if string.find(string.lower(BlzGetAbilityTooltip(data, 0)), text, 1, true) then return true end
if string.find(string.lower(BlzGetAbilityResearchTooltip(data, 0)), text, 1, true) then return true end
if string.find(string.lower(BlzGetAbilityExtendedTooltip(data, 0)), text, 1, true) then return true end
if string.find(string.lower(BlzGetAbilityResearchExtendedTooltip(data, 0)), text, 1, true) then return true end
elseif type(data) == "table" then
if string.find(string.lower(data.Name), text, 1, true) then return true end
if string.find(string.lower(data.Text), text, 1, true) then return true end
end
return false
end