mirror of
https://github.com/brues-code/Vanilla_MikScrollingBattleText.git
synced 2026-09-30 11:10:00 +00:00
293 lines
59 KiB
Lua
293 lines
59 KiB
Lua
MikSBT.DISPLAYTYPE_INCOMING=1;MikSBT.DISPLAYTYPE_OUTGOING=2;MikSBT.DISPLAYTYPE_NOTIFICATION=3;MikSBT.CurrentProfile=nil;if not ICON_CACHE then ICON_CACHE={}end ICON_CACHE["repousser au loin"]="Interface\\Icons\\Inv_Gauntlets_05"ICON_CACHE["rupture du sol"]="Interface\\Icons\\Spell_Nature_Earthquake"ICON_CACHE["rayon de l'oeil"]="Interface\\Icons\\Spell_Nature_Callstorm"ICON_CACHE["salve de traits de l'ombre"]="Interface\\Icons\\Spell_Shadow_Shadowbolt"ICON_CACHE["tempête d'ombre"]="Interface\\Icons\\spell_shadow_shadowbolt"ICON_CACHE["gaz"]="Interface\\Icons\\Spell_Nature_Abolishmagic"ICON_CACHE["décimer"]="Interface\\Icons\\Inv_Shield_01"ICON_CACHE["champ statique"]="Interface\\Icons\\Spell_Nature_WispHeal"ICON_CACHE["horion"]="Interface\\Icons\\Spell_Nature_WispHeal"ICON_CACHE["secousse"]="Interface\\Icons\\spell_nature_earthquake"ICON_CACHE["charge de bouclier"]="Interface\\Icons\\ability_warrior_charge"ICON_CACHE["eclair des arcanes"]="Interface\\Icons\\spell_arcane_starfire"ICON_CACHE["gémissement des âmes"]="Interface\\Icons\\spell_nature_lightning"ICON_CACHE["trait noir"]="Interface\\Icons\\spell_shadow_shadowbolt"ICON_CACHE["infusion de mana"]="Interface\\Icons\\inv_trinket_naxxramas01"ICON_CACHE["afflux"]="Interface\\Icons\\Ability_Warrior_Charge"ICON_CACHE["frappe"]="Interface\\Icons\\Ability_Rogue_Ambush"ICON_CACHE["souffle de lave"]="Interface\\Icons\\Spell_Fire_WindsOfWoe"ICON_CACHE["frappe des ailes"]="Interface\\Icons\\Inv_Misc_Monsterscales_14"ICON_CACHE["lance de flammes"]="Interface\\Icons\\Ability_Throw"ICON_CACHE["horion de l'ombre"]="Interface\\Icons\\Spell_Shadow_Shadowbolt"ICON_CACHE["explosion de lave"]="Interface\\Icons\\Spell_Fire_Volcano"ICON_CACHE["bouclier de lave"]="Interface\\Icons\\Spell_Fire_Immolation"ICON_CACHE["fleur de feu"]="Interface\\Icons\\Spell_Fire_Fireball02"ICON_CACHE["bombe"]="Interface\\Icons\\Spell_Fire_Selfdestruct"ICON_CACHE["explosion"]="Interface\\Icons\\Spell_Fire_Selfdestruct"ICON_CACHE["colère de ragnaros"]="Interface\\Icons\\Spell_Fire_Soulburn"ICON_CACHE["choc"]="Interface\\Icons\\Ability_Smash"ICON_CACHE["secousse violente"]="Interface\\Icons\\Ability_Smash"ICON_CACHE["nova de feu"]="Interface\\Icons\\Spell_Fire_SealOfFire"ICON_CACHE["marque de détonation"]="Interface\\Icons\\spell_fire_selfdestruct"ICON_CACHE["cône de feu"]="Interface\\Icons\\Spell_Fire_WindsOfWoe"ICON_CACHE["volée de boules de feu"]="Interface\\Icons\\Spell_Fire_Flamebolt"ICON_CACHE["vague de foudre"]="Interface\\Icons\\Spell_Nature_Chainlightning"ICON_CACHE["coup de queue"]="Interface\\Icons\\Inv_Misc_MonsterScales_05"ICON_CACHE["exploiter faiblesse"]="Interface\\Icons\\ability_backstab"ICON_CACHE["lancer feu liquide"]="Interface\\Icons\\spell_fire_meteorstorm"ICON_CACHE["poing de force"]="Interface\\Icons\\inv_gauntlets_31"ICON_CACHE["uppercut"]="Interface\\Icons\\inv_gauntlets_31"ICON_CACHE["sangsue"]="Interface\\Icons\\ability_racial_cannibalize"ICON_CACHE["choc de feu"]="Interface\\Icons\\spell_fire_immolation"ICON_CACHE["malédiction du sang"]="Interface\\Icons\\spell_shadow_ritualofsacrifice"ICON_CACHE["brasier"]="Interface\\Icons\\spell_fire_incinerate"ICON_CACHE["météore"]="Interface\\Icons\\spell_fire_meteorstorm"ICON_CACHE["jet de poison"]="Interface\\Icons\\spell_nature_corrosivebreath"ICON_CACHE["explosion d'ombre"]="Interface\\Icons\\spell_shadow_antishadow"ICON_CACHE["voile de l'ombre"]="Interface\\Icons\\spell_shadow_gathershadows"ICON_CACHE["nuée maléfique"]="Interface\\Icons\\spell_nature_abolishmagic"ICON_CACHE["crachat empoisonné"]="Interface\\Icons\\spell_nature_corrosivebreath"ICON_CACHE["piétiner"]="Interface\\Icons\\spell_nature_natureswrath"ICON_CACHE["spores mutées"]="Interface\\Icons\\spell_nature_abolishmagic"ICON_CACHE["heurtoir du vomisseur de bile"]="Interface\\Icons\\ability_devour"ICON_CACHE["eruption"]="Interface\\Icons\\spell_fire_volcano"ICON_CACHE["tempête de mana"]="Interface\\Icons\\spell_frost_icestorm"ICON_CACHE["frappe sacrée"]="Interface\\Icons\\ability_thunderbolt"ICON_CACHE["grondement du tonnerre"]="Interface\\Icons\\spell_nature_thunderclap"ICON_CACHE["déflagration des arcanes"]="Interface\\Icons\\spell_shadow_deathpact"ICON_CACHE["nuage pestilentiel"]="Interface\\Icons\\spell_nature_abolishmagic"ICON_CACHE["régénération de mana"]="Interface\\Icons\\spell_nature_manaregentotem"ICON_CACHE["potion de soins"]="Interface\\Icons\\inv_potion_54"ICON_CACHE["restauration du mana"]="Interface\\Icons\\inv_potion_76"ICON_CACHE["rune démoniaque"]="Interface\\Icons\\inv_misc_rune_04"ICON_CACHE["rune ténébreuse"]="Interface\\Icons\\spell_shadow_sealofkings"ICON_CACHE["absorption de magie"]="Interface\\Icons\\spell_nature_astralrecalgroup"ICON_CACHE["gel"]="Interface\\Icons\\spell_frost_glacier"ICON_CACHE["lésions cérébrales"]="Interface\\Icons\\ability_gouge"ICON_CACHE["décharge électrique"]="Interface\\Icons\\spell_lightning_lightningbolt01"ICON_CACHE["foudre"]="Interface\\Icons\\spell_lightning_lightningbolt01"ICON_CACHE["enchantement flamboyant"]="Interface\\Icons\\spell_fire_selfdestruct"ICON_CACHE["pierre de soins supérieure"]="Interface\\Icons\\inv_stone_04"ICON_CACHE["pierre de soins mineure"]="Interface\\Icons\\inv_stone_04"ICON_CACHE["pierre de soins inférieure"]="Interface\\Icons\\inv_stone_04"ICON_CACHE["pierre de soins majeure"]="Interface\\Icons\\inv_stone_04"ICON_CACHE["pierre de soins"]="Interface\\Icons\\inv_stone_04"ICON_CACHE["capturer un esprit"]="Interface\\Icons\\Spell_Shadow_Haunting"NO_ICON_CACHE={}local BS=AceLibrary("Babble-Spell-2.2")local NUM_FONT_STRINGS=20;local MIN_VERTICAL_SPACING=8;local MERGE_DELAY_TIME=0.3;local STICKY_FADE_IN_TIME=0.15;local STICKY_DISPLAY_TIME=2;local STICKY_FADE_OUT_TIME=0.5;local ANIMATION_SPEED=0.02;local SCROLL_DIRECTION_UP=1;local SCROLL_DIRECTION_DOWN=2;local ANIMATION_STYLE_STRAIGHT=1;local ANIMATION_STYLE_LEFT_PARABOLA=2;local ANIMATION_STYLE_RIGHT_PARABOLA=3;local MAX_COMBO_POINTS=5;local debugMode=false;local listenEvents={};local scrollAreas={};local animationMergeData={["Incoming"]={["TimeSinceMerge"]=0,UnmergedEvents={},MergedEvents={}},["Outgoing"]={["TimeSinceMerge"]=0,UnmergedEvents={},MergedEvents={}},};local stillMerging=false;local activeNonStickies={};local activeStickies={};local eventsRecycler=MikTRO:NewRecyclerObject(40);function MikSBT.Print(msg,r,g,b)DEFAULT_CHAT_FRAME:AddMessage("MSBT: "..msg,r,g,b);end
|
|
function MikSBT.PrintDebug(msg,r,g,b)if(debugMode)then
|
|
DEFAULT_CHAT_FRAME:AddMessage(msg,r,g,b);end end
|
|
function MikSBT.RegisterEvents()for k,v in listenEvents do MSBTEventFrame:RegisterEvent(v);end end
|
|
function MikSBT.UnregisterEvents()for k,v in listenEvents do MSBTEventFrame:UnregisterEvent(v);end end
|
|
function MikSBT.OnLoad()MSBTEventFrame:RegisterEvent("ADDON_LOADED");end
|
|
function MikSBT.OnEvent()if(event=="ADDON_LOADED")then
|
|
if(arg1==MikSBT.MOD_NAME)then
|
|
this:UnregisterEvent("ADDON_LOADED");MikSBT.RegisterEvents();MikSBT.Init();end end end
|
|
function MikSBT.OnUpdate()for _,mergeData in animationMergeData do
|
|
mergeData.TimeSinceMerge=mergeData.TimeSinceMerge+arg1;if((mergeData.TimeSinceMerge>=MERGE_DELAY_TIME)and not stillMerging)then
|
|
stillMerging=true;local numEvents=table.getn(mergeData.UnmergedEvents);MikSBT.MergeEvents(mergeData,numEvents);for _,animationEvent in mergeData.MergedEvents do MikSBT.AddAnimation(animationEvent);end
|
|
local numMergedEvents=table.getn(mergeData.MergedEvents);for i=1,numMergedEvents do table.remove(mergeData.MergedEvents,1);end
|
|
mergeData.TimeSinceMerge=0;stillMerging=false;end end end
|
|
function MikSBT.OnUpdateAnimationFrame(frame)local scrollArea;local frameName=frame:GetName();if(frameName==scrollAreas.Incoming.AssociatedFrame)then scrollArea=scrollAreas.Incoming;elseif(frameName==scrollAreas.Outgoing.AssociatedFrame)then scrollArea=scrollAreas.Outgoing;elseif(frameName==scrollAreas.Notification.AssociatedFrame)then scrollArea=scrollAreas.Notification;end
|
|
local allInactive=true;for _,animDisplayInfo in scrollArea.AnimationDisplayArray do
|
|
if(animDisplayInfo.IsActive)then
|
|
MikSBT.DoAnimation(animDisplayInfo,scrollArea);allInactive=false;end end
|
|
if(allInactive and frame:IsVisible())then frame:Hide();end end
|
|
function MikSBT.Init()SLASH_MSBT1=MikSBT.COMMAND;SlashCmdList["MSBT"]=function(params)MikSBT.CommandHandler(params);end
|
|
if(not MikSBT_Save or not MikSBT_Save.Profiles)then MikSBT_Save={};MikSBT_Save.UserDisabled=false;MikSBT_Save.CurrentProfile=MikSBT.DEFAULT_PROFILE_NAME;MikSBT_Save.Profiles={};MikSBT_Save.Profiles[MikSBT_Save.CurrentProfile]={};MikSBT.ResetProfile(MikSBT_Save.CurrentProfile);end
|
|
MikSBT.UpdateProfiles();MikSBT.CurrentProfile=MikSBT_Save.Profiles[MikSBT_Save.CurrentProfile];MikSBT.SetupAnimationScrollAreas();MikSBT.RepositionAnimationFrames();MikSBT.RegisterTriggers();MikSBT.SetOptionUserDisabled(MikSBT_Save.UserDisabled)end
|
|
function MikSBT.SetupAnimationScrollAreas()scrollAreas.Incoming={};scrollAreas.Outgoing={};scrollAreas.Notification={};scrollAreas.Incoming.AssociatedFrame="MSBTFrameIncoming";scrollAreas.Outgoing.AssociatedFrame="MSBTFrameOutgoing";scrollAreas.Notification.AssociatedFrame="MSBTFrameNotification";scrollAreas.Incoming.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Incoming;scrollAreas.Outgoing.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Outgoing;scrollAreas.Notification.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Notification;for _,scrollArea in scrollAreas do
|
|
scrollArea.NextAnimationDisplay=1;scrollArea.FirstSticky=11;scrollArea.NextSticky=scrollArea.FirstSticky;scrollArea.AnimationDisplayArray={};for x=1,NUM_FONT_STRINGS do scrollArea.AnimationDisplayArray[x]={};scrollArea.AnimationDisplayArray[x].FontObject=getglobal(scrollArea.AssociatedFrame.."Text"..x);scrollArea.AnimationDisplayArray[x].LastUpdated=0;end end end
|
|
function MikSBT.RepositionAnimationFrames()for _,scrollArea in scrollAreas do getglobal(scrollArea.AssociatedFrame):SetPoint("BOTTOM","UIParent","CENTER",scrollArea.DisplaySettings.FrameOffsets.x,scrollArea.DisplaySettings.FrameOffsets.y);end end
|
|
function MikSBT.CombatEventsHandler(combatEvent)local animationEvent=eventsRecycler:AcquireTable();local eventTypeString="MSBT_EVENTTYPE_";if(combatEvent.DirectionType==MikCEH.DIRECTIONTYPE_PLAYER_INCOMING)then animationEvent.ScrollArea=scrollAreas.Incoming;eventTypeString=eventTypeString.."INCOMING_";elseif(combatEvent.DirectionType==MikCEH.DIRECTIONTYPE_PLAYER_OUTGOING)then animationEvent.ScrollArea=scrollAreas.Outgoing;eventTypeString=eventTypeString.."OUTGOING_";elseif(combatEvent.DirectionType==MikCEH.DIRECTIONTYPE_PET_OUTGOING)then animationEvent.ScrollArea=scrollAreas.Outgoing;eventTypeString=eventTypeString.."OUTGOING_PET_";end
|
|
if(combatEvent.EventType==MikCEH.EVENTTYPE_DAMAGE)then
|
|
if(combatEvent.EffectName~=nil)then eventTypeString=eventTypeString.."SPELL_";end
|
|
if(combatEvent.ActionType==MikCEH.ACTIONTYPE_HIT)then if(combatEvent.HitType==MikCEH.HITTYPE_OVER_TIME)then eventTypeString=eventTypeString.."DOT";else eventTypeString=eventTypeString.."DAMAGE";end elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_MISS)then eventTypeString=eventTypeString.."MISS";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_DODGE)then eventTypeString=eventTypeString.."DODGE";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_PARRY)then eventTypeString=eventTypeString.."PARRY";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_BLOCK)then eventTypeString=eventTypeString.."BLOCK";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_RESIST)then eventTypeString=eventTypeString.."RESIST";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_ABSORB)then eventTypeString=eventTypeString.."ABSORB";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_IMMUNE)then eventTypeString=eventTypeString.."IMMUNE";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_EVADE)then eventTypeString=eventTypeString.."EVADE";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_REFLECT)then eventTypeString=eventTypeString.."REFLECT";elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_DROWNING)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_DROWNING;elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_FALLING)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_FALLING;elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_FATIGUE)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_FATIGUE;elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_FIRE)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_FIRE;elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_LAVA)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_LAVA;elseif(combatEvent.ActionType==MikCEH.ACTIONTYPE_SLIME)then eventTypeString=eventTypeString.."ENVIRONMENTAL"combatEvent.EffectName=MikSBT.MSG_ENVIRONMENTAL_SLIME;end
|
|
elseif(combatEvent.EventType==MikCEH.EVENTTYPE_HEAL)then if(combatEvent.HealType==MikCEH.HEALTYPE_NORMAL or combatEvent.HealType==MikCEH.HEALTYPE_CRIT)then eventTypeString=eventTypeString.."HEAL";elseif(combatEvent.HealType==MikCEH.HEALTYPE_OVER_TIME)then eventTypeString=eventTypeString.."HOT";end
|
|
elseif(combatEvent.EventType==MikCEH.EVENTTYPE_NOTIFICATION)then animationEvent.ScrollArea=scrollAreas.Notification;eventTypeString=eventTypeString.."NOTIFICATION_";if(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_DEBUFF)then eventTypeString=eventTypeString.."DEBUFF";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_BUFF)then eventTypeString=eventTypeString.."BUFF";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_ITEM_BUFF)then eventTypeString=eventTypeString.."ITEM_BUFF";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_BUFF_FADE)then eventTypeString=eventTypeString.."BUFF_FADE";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_COMBAT_ENTER)then eventTypeString=eventTypeString.."COMBAT_ENTER";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_COMBAT_LEAVE)then eventTypeString=eventTypeString.."COMBAT_LEAVE";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_POWER_GAIN)then eventTypeString=eventTypeString.."POWER_GAIN";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_POWER_LOSS)then eventTypeString=eventTypeString.."POWER_LOSS";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_CP_GAIN)then
|
|
if(combatEvent.Amount==MAX_COMBO_POINTS)then eventTypeString=eventTypeString.."CP_FULL";else eventTypeString=eventTypeString.."CP_GAIN";end elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_HONOR_GAIN)then eventTypeString=eventTypeString.."HONOR_GAIN";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_REP_GAIN)then eventTypeString=eventTypeString.."REP_GAIN";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_REP_LOSS)then eventTypeString=eventTypeString.."REP_LOSS";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_SKILL_GAIN)then eventTypeString=eventTypeString.."SKILL_GAIN";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_EXPERIENCE_GAIN)then eventTypeString=eventTypeString.."EXPERIENCE_GAIN";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_PC_KILLING_BLOW)then eventTypeString=eventTypeString.."PC_KILLING_BLOW";elseif(combatEvent.NotificationType==MikCEH.NOTIFICATIONTYPE_NPC_KILLING_BLOW)then eventTypeString=eventTypeString.."NPC_KILLING_BLOW";elseif(combatEvent.NotificationType~=nil)then eventTypeString=eventTypeString..combatEvent.NotificationType;end end
|
|
if(combatEvent.HitType==MikCEH.HITTYPE_CRIT or combatEvent.HealType==MikCEH.HEALTYPE_CRIT)then animationEvent.IsCrit=true;end
|
|
animationEvent.Amount=combatEvent.Amount;animationEvent.EffectName=combatEvent.EffectName;animationEvent.Name=combatEvent.Name;if(combatEvent.DamageType~=nil)then animationEvent.DamageType=MikCEH.GetDamageTypeString(combatEvent.DamageType);end
|
|
if(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_ABSORB)then if(ABSORB_TRAILER)then animationEvent.PartialEffectText="\124cffFAFA00\124h"..string.gsub(ABSORB_TRAILER,"%%d",combatEvent.PartialAmount).."\124h\124r";end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_BLOCK)then if(BLOCK_TRAILER)then animationEvent.PartialEffectText="\124cff7F00FF\124h"..string.gsub(BLOCK_TRAILER,"%%d",combatEvent.PartialAmount).."\124h\124r";end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_RESIST)then if(RESIST_TRAILER)then animationEvent.PartialEffectText=" \124cff81007F\124h"..string.gsub(RESIST_TRAILER,"%%d",combatEvent.PartialAmount).."\124h\124r";end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_VULNERABLE)then if(MikSBT.MSG_VULERNABLE_TRAILER)then animationEvent.PartialEffectText=string.gsub(MikSBT.MSG_VULERNABLE_TRAILER,"%%d",combatEvent.PartialAmount);end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_CRUSHING)then if(CRUSHING_TRAILER)then animationEvent.PartialEffectText="\124cff7D0000\124h"..CRUSHING_TRAILER.."\124h\124r";end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_GLANCING)then if(GLANCING_TRAILER)then animationEvent.PartialEffectText="\124cffFA0000\124h"..GLANCING_TRAILER.."\124h\124r";end elseif(combatEvent.PartialActionType==MikCEH.PARTIALACTIONTYPE_OVERHEAL)then animationEvent.OverhealAmount=combatEvent.PartialAmount;end
|
|
if(MikSBT.CurrentProfile.EventSettings[eventTypeString])then
|
|
animationEvent.EventType=eventTypeString;animationEvent.EventSettings=MikSBT.CurrentProfile.EventSettings[animationEvent.EventType];animationEvent.UnformattedText=animationEvent.EventSettings.Message;MikSBT.DispatchAnimationEvent(animationEvent);else
|
|
MikSBT.Print("No profile data found for "..eventTypeString,1,0,0)eventsRecycler:ReclaimTable(animationEvent);end end
|
|
function MikSBT.TriggerHandler(triggerEvent)local animationEvent=eventsRecycler:AcquireTable();if(MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].EventSettings)then
|
|
animationEvent.ScrollArea=scrollAreas.Notification;animationEvent.EventSettings=MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].EventSettings;MikSBT.FormatTriggerText(animationEvent,triggerEvent);if(MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].Texture)then animationEvent.Texture=MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].Texture end
|
|
MikSBT.DispatchAnimationEvent(animationEvent);else
|
|
MikSBT.Print("No profile data found for trigger key "..triggerEvent.TriggerKey,1,0,0);eventsRecycler:ReclaimTable(animationEvent);end end
|
|
function MikSBT.CopyTable(srcTable)local newTable={};for key,value in srcTable do
|
|
if(type(value)=="table")then
|
|
value=MikSBT.CopyTable(value);end
|
|
newTable[key]=value;end
|
|
return newTable;end
|
|
function MikSBT.MergeEvents(mergeData,numEvents)local eventMerged=false;for x=1,numEvents do
|
|
for _,animationEvent in mergeData.MergedEvents do
|
|
if((mergeData.UnmergedEvents[x].EventType==animationEvent.EventType)and(mergeData.UnmergedEvents[x].EffectName==animationEvent.EffectName))then
|
|
if(mergeData.UnmergedEvents[x].EffectName==nil)then
|
|
if((mergeData.UnmergedEvents[x].Name==animationEvent.Name)and mergeData.UnmergedEvents[x].Name~=nil)then
|
|
eventMerged=true;end
|
|
else
|
|
if(animationEvent.Name~=nil)then animationEvent.Name=MikSBT.MSG_MULTIPLE_TARGETS;end
|
|
eventMerged=true;end
|
|
end
|
|
if(eventMerged)then
|
|
mergeData.UnmergedEvents[x].EventMerged=true;if(animationEvent.Amount~=nil and mergeData.UnmergedEvents[x].Amount~=nil)then animationEvent.Amount=tonumber(animationEvent.Amount,10)if animationEvent.Amount and mergeData.UnmergedEvents[x].Amount then animationEvent.Amount=animationEvent.Amount+mergeData.UnmergedEvents[x].Amount;end
|
|
end
|
|
if(mergeData.UnmergedEvents[x].OverhealAmount~=nil)then animationEvent.OverhealAmount=(animationEvent.OverhealAmount or 0)+mergeData.UnmergedEvents[x].OverhealAmount;end
|
|
animationEvent.PartialEffectText=nil;animationEvent.NumMerged=animationEvent.NumMerged+1;if(mergeData.UnmergedEvents[x].IsCrit)then animationEvent.NumCrits=animationEvent.NumCrits+1;end
|
|
animationEvent.IsCrit=false;end
|
|
end
|
|
if(not eventMerged)then local animationEvent=mergeData.UnmergedEvents[x];animationEvent.NumMerged=0;if(animationEvent.IsCrit)then animationEvent.NumCrits=1;else animationEvent.NumCrits=0;end
|
|
table.insert(mergeData.MergedEvents,animationEvent);end
|
|
eventMerged=false;end
|
|
for _,animationEvent in mergeData.MergedEvents do
|
|
if(animationEvent.NumMerged>0)then
|
|
local trailerText=" ["..animationEvent.NumMerged+1 .." "..MikSBT.MSG_HITS;if(animationEvent.NumCrits>1)then trailerText=trailerText..", "..animationEvent.NumCrits.." "..MikSBT.MSG_CRITS;elseif(animationEvent.NumCrits==1)then trailerText=trailerText..", "..animationEvent.NumCrits.." "..MikSBT.MSG_CRIT;end
|
|
trailerText=trailerText.."]";animationEvent.MergeTrailerText=trailerText;end end
|
|
for x=1,numEvents do
|
|
if(mergeData.UnmergedEvents[1].EventMerged)then
|
|
eventsRecycler:ReclaimTable(mergeData.UnmergedEvents[1]);end
|
|
table.remove(mergeData.UnmergedEvents,1);end end
|
|
function MikSBT.GetFontSize(scrollArea,eventSettings,isCrit)local eventFontSizeNormal=0;local eventFontSizeCrit=0;if(eventSettings~=nil)then
|
|
eventFontSizeNormal=eventSettings.FontSettings.Normal.FontSize;if(eventSettings.FontSettings.Crit~=nil)then eventFontSizeCrit=eventSettings.FontSettings.Crit.FontSize;end end
|
|
local scrollAreaFontSizeNormal=scrollArea.DisplaySettings.FontSettings.Normal.FontSize;local scrollAreaFontSizeCrit=scrollArea.DisplaySettings.FontSettings.Crit.FontSize;local masterFontSizeNormal=MikSBT.CurrentProfile.MasterFontSettings.Normal.FontSize;local masterFontSizeCrit=MikSBT.CurrentProfile.MasterFontSettings.Crit.FontSize;local fontSize=eventFontSizeNormal;if(fontSize==0)then fontSize=scrollAreaFontSizeNormal;end
|
|
if(fontSize==0)then fontSize=masterFontSizeNormal;end
|
|
if(isCrit)then
|
|
fontSize=eventFontSizeCrit;if(fontSize==0)then fontSize=scrollAreaFontSizeCrit;end
|
|
if(fontSize==0)then fontSize=masterFontSizeCrit;end end
|
|
return fontSize;end
|
|
function MikSBT.GetFontPath(scrollArea,eventSettings,isCrit)local eventFontIndexNormal=0;local eventFontIndexCrit=0;if(eventSettings~=nil)then
|
|
eventFontIndexNormal=eventSettings.FontSettings.Normal.FontIndex;if(eventSettings.FontSettings.Crit~=nil)then eventFontIndexCrit=eventSettings.FontSettings.Crit.FontIndex;end end
|
|
local scrollAreaFontIndexNormal=scrollArea.DisplaySettings.FontSettings.Normal.FontIndex;local scrollAreaFontIndexCrit=scrollArea.DisplaySettings.FontSettings.Crit.FontIndex;local masterFontIndexNormal=MikSBT.CurrentProfile.MasterFontSettings.Normal.FontIndex;local masterFontIndexCrit=MikSBT.CurrentProfile.MasterFontSettings.Crit.FontIndex;local fontIndex=eventFontIndexNormal;if(fontIndex==0)then fontIndex=scrollAreaFontIndexNormal;end
|
|
if(fontIndex==0)then fontIndex=masterFontIndexNormal;end
|
|
if(isCrit)then
|
|
fontIndex=eventFontIndexCrit;if(fontIndex==0)then fontIndex=scrollAreaFontIndexCrit;end
|
|
if(fontIndex==0)then fontIndex=masterFontIndexCrit;end end
|
|
if(MikSBT.AVAILABLE_FONTS[fontIndex]==nil)then fontIndex=1;end
|
|
return MikSBT.AVAILABLE_FONTS[fontIndex].Path;end
|
|
function MikSBT.GetFontOutline(scrollArea,eventSettings,isCrit)local eventOutlineIndexNormal=0;local eventOutlineIndexCrit=0;if(eventSettings~=nil)then
|
|
eventOutlineIndexNormal=eventSettings.FontSettings.Normal.OutlineIndex;if(eventSettings.FontSettings.Crit~=nil)then eventOutlineIndexCrit=eventSettings.FontSettings.Crit.OutlineIndex;end end
|
|
local scrollAreaOutlineIndexNormal=scrollArea.DisplaySettings.FontSettings.Normal.OutlineIndex;local scrollAreaOutlineIndexCrit=scrollArea.DisplaySettings.FontSettings.Crit.OutlineIndex;local masterOutlineIndexNormal=MikSBT.CurrentProfile.MasterFontSettings.Normal.OutlineIndex;local masterOutlineIndexCrit=MikSBT.CurrentProfile.MasterFontSettings.Crit.OutlineIndex;local outlineIndex=eventOutlineIndexNormal;if(outlineIndex==0)then outlineIndex=scrollAreaOutlineIndexNormal;end
|
|
if(outlineIndex==0)then outlineIndex=masterOutlineIndexNormal;end
|
|
if(isCrit)then
|
|
outlineIndex=eventOutlineIndexCrit;if(outlineIndex==0)then outlineIndex=scrollAreaOutlineIndexCrit;end
|
|
if(outlineIndex==0)then outlineIndex=masterOutlineIndexCrit;end end
|
|
return MikSBT.AVAILABLE_OUTLINES[outlineIndex].Style;end
|
|
function MikSBT.FormatEventText(animationEvent)local outputString=animationEvent.UnformattedText;if(outputString==nil)then return;end outputString=string.gsub(outputString,"-%%a","\124cffff0000\124h-\124h\124r%%a");if(animationEvent.DamageType~=nil)then if animationEvent.DamageType==SPELL_SCHOOL1_CAP then outputString=string.gsub(outputString,"%%a","\124cffF6F99E\124h%%a\124h\124r");elseif animationEvent.DamageType==SPELL_SCHOOL2_CAP then outputString=string.gsub(outputString,"%%a","\124cffFF8080\124h%%a\124h\124r");elseif animationEvent.DamageType==SPELL_SCHOOL3_CAP then outputString=string.gsub(outputString,"%%a","\124cff80FF80\124h%%a\124h\124r");elseif animationEvent.DamageType==SPELL_SCHOOL4_CAP then outputString=string.gsub(outputString,"%%a","\124cff8080FF\124h%%a\124h\124r");elseif animationEvent.DamageType==SPELL_SCHOOL5_CAP then outputString=string.gsub(outputString,"%%a","\124cffA000A0\124h%%a\124h\124r");elseif animationEvent.DamageType==SPELL_SCHOOL6_CAP then outputString=string.gsub(outputString,"%%a","\124cffFFB9FF\124h%%a\124h\124r");elseif animationEvent.DamageType=="Inconnu"then outputString=string.gsub(outputString,"%%a","\124cffFFB9FF\124h%%a\124h\124r");end end
|
|
if(animationEvent.Amount~=nil)then
|
|
if(animationEvent.OverhealAmount~=nil and MikSBT.CurrentProfile.ShowOverheals)then local overhealTrailer=string.gsub(MikSBT.MSG_OVERHEAL_TRAILER,"%%d",animationEvent.OverhealAmount);outputString=string.gsub(outputString,"%%a",(animationEvent.Amount-animationEvent.OverhealAmount)..overhealTrailer);else outputString=string.gsub(outputString,"%%a",animationEvent.Amount);end end
|
|
if(animationEvent.Name~=nil)and(animationEvent.Name~=UnitName("player"))then outputString=string.gsub(outputString,"%%n",animationEvent.Name);else outputString=string.gsub(outputString,"%(%%n%)","");outputString=string.gsub(outputString,"%%n","");end
|
|
if(animationEvent.EffectName~=nil)then outputString=string.gsub(outputString,"%%s",animationEvent.EffectName);end
|
|
if(animationEvent.DamageType~=nil)then outputString=string.gsub(outputString,"%%t",animationEvent.DamageType);end
|
|
if(animationEvent.PartialEffectText~=nil and MikSBT.CurrentProfile.ShowPartialEffects)then outputString=outputString..animationEvent.PartialEffectText;end
|
|
if(animationEvent.MergeTrailerText~=nil)then outputString=outputString..animationEvent.MergeTrailerText;end
|
|
animationEvent.Text=outputString;end
|
|
function MikSBT.FormatTriggerText(animationEvent,triggerEvent)local outputString=animationEvent.EventSettings.Message;if(outputString==nil)then return;end
|
|
for i=1,triggerEvent.NumCaptures do outputString=string.gsub(outputString,"%%"..i,triggerEvent["CapturedData"..i]);end
|
|
animationEvent.Text=outputString;end
|
|
function MikSBT.RegisterTriggers()MikCEH.UnregisterAllTriggers();for triggerKey,triggerData in MikSBT.CurrentProfile.Triggers do
|
|
if(triggerData.EventSettings.Show)then MikCEH.RegisterTrigger(triggerKey,triggerData.TriggerSettings);end end end
|
|
function MikSBT.UpdateProfiles()for _,profile in MikSBT_Save.Profiles do if not profile.CreationVersion then
|
|
MikSBT.ResetProfile(profile);end
|
|
if(profile.CreationVersion<2.0)then
|
|
profile.ShowOverheals=MikSBT.DEFAULT_CONFIG.ShowOverheals;profile.ShowGameDamage=MikSBT.DEFAULT_CONFIG.ShowGameDamage;profile.UseStickyCrits=MikSBT.DEFAULT_CONFIG.UseStickyCrits;profile.EventSettings["MSBT_EVENTTYPE_INCOMING_SPELL_DOT"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_INCOMING_SPELL_DOT"]);profile.EventSettings["MSBT_EVENTTYPE_INCOMING_HOT"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_INCOMING_HOT"]);profile.EventSettings["MSBT_EVENTTYPE_OUTGOING_SPELL_DOT"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_OUTGOING_SPELL_DOT"]);profile.EventSettings["MSBT_EVENTTYPE_OUTGOING_HOT"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_OUTGOING_HOT"]);profile.CreationVersion=2.0;end
|
|
if(profile.CreationVersion<2.1)then
|
|
for eventTypeName,eventType in profile.EventSettings do
|
|
if(string.find(eventTypeName,"MISS")or string.find(eventTypeName,"DODGE")or string.find(eventTypeName,"PARRY")or string.find(eventTypeName,"BLOCK")or string.find(eventTypeName,"ABSORB")or string.find(eventTypeName,"IMMUNE")or string.find(eventTypeName,"DOT")or string.find(eventTypeName,"RESIST")or string.find(eventTypeName,"HOT")or string.find(eventTypeName,"ENVIRONMENTAL")or string.find(eventTypeName,"EVADE")or string.find(eventTypeName,"NOTIFICATION"))then
|
|
eventType.FontSettings.Crit=nil;end
|
|
if(string.find(eventTypeName,"NOTIFICATION"))then eventType.IsSticky=MikSBT.DEFAULT_CONFIG.EventSettings[eventTypeName].IsSticky;end
|
|
profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_EXPERIENCE_GAIN"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_EXPERIENCE_GAIN"]);end
|
|
profile.CreationVersion=2.1;end
|
|
if(profile.CreationVersion<3.0)then
|
|
profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_LOW_HEALTH"]=nil;profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_LOW_MANA"]=nil;profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_EXECUTE"]=nil;profile.WarningPercentageHealth=nil;profile.WarningPercentageMana=nil;profile.Triggers=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.Triggers);profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_PC_KILLING_BLOW"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_PC_KILLING_BLOW"]);profile.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_NPC_KILLING_BLOW"]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.EventSettings["MSBT_EVENTTYPE_NOTIFICATION_NPC_KILLING_BLOW"]);profile.Suppressions=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG.Suppressions);profile.CreationVersion=3.0;end
|
|
if(profile.CreationVersion<4.0)then profile.ShowAllManaGains=false;profile.LowHealthSound=true;profile.LowManaSound=true;profile.CreationVersion=4.0;end
|
|
if(profile.CreationVersion<4.1)then if profile.Triggers.MSBT_TRIGGER_WINDFURY then
|
|
profile.Triggers.MSBT_TRIGGER_WINDFURY.TriggerSettings.SearchPatterns[1]=string.format(AURAADDEDSELFHELPFUL,string.gsub(BS["Windfury Totem"],"-","%%-"))end if profile.Triggers.MSBT_TRIGGER_HAND_OF_JUSTICE then
|
|
profile.Triggers["MSBT_TRIGGER_HAND_OF_JUSTICE"]=nil;end profile.CreationVersion=4.1;end end end
|
|
function MikSBT.ProfileExists(profileName)local profileFound=false;for pName in MikSBT_Save.Profiles do if(pName==profileName)then profileFound=true;end end
|
|
return profileFound;end
|
|
function MikSBT.ResetProfile(profileName,showOutput)local profileExists=MikSBT.ProfileExists(profileName);if(profileExists)then
|
|
MikSBT_Save.Profiles[profileName]=MikSBT.CopyTable(MikSBT.DEFAULT_CONFIG);if(profileName==MikSBT_Save.CurrentProfile)then
|
|
MikSBT.CurrentProfile=MikSBT_Save.Profiles[MikSBT_Save.CurrentProfile];if(scrollAreas.Incoming~=nil)then
|
|
scrollAreas.Incoming.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Incoming;scrollAreas.Outgoing.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Outgoing;scrollAreas.Notification.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Notification;end
|
|
MikSBT.RepositionAnimationFrames();MikSBT.RegisterTriggers();end
|
|
if(showOutput)then
|
|
MikSBT.Print(profileName.." "..MikSBT.MSG_PROFILE_RESET,0,1,0);end end end
|
|
function MikSBT.SelectProfile(profileName)local profileExists=MikSBT.ProfileExists(profileName);if(profileExists)then
|
|
MikSBT_Save.CurrentProfile=profileName;MikSBT.CurrentProfile=MikSBT_Save.Profiles[MikSBT_Save.CurrentProfile];if(scrollAreas.Incoming~=nil)then
|
|
scrollAreas.Incoming.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Incoming;scrollAreas.Outgoing.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Outgoing;scrollAreas.Notification.DisplaySettings=MikSBT.CurrentProfile.DisplaySettings.Notification;end
|
|
MikSBT.RepositionAnimationFrames();MikSBT.RegisterTriggers();end end
|
|
function MikSBT.CreateProfile(profileName)local profileExists=MikSBT.ProfileExists(profileName);if(not profileExists and profileName~=nil and profileName~="")then
|
|
MikSBT_Save.Profiles[profileName]={};MikSBT.ResetProfile(profileName);end end
|
|
function MikSBT.DeleteProfile(profileName)if(profileName==MikSBT.DEFAULT_PROFILE_NAME)then return;end
|
|
local profileExists=MikSBT.ProfileExists(profileName);if(profileExists)then
|
|
if(profileName==MikSBT_Save.CurrentProfile)then
|
|
MikSBT.SelectProfile(MikSBT.DEFAULT_PROFILE_NAME);end
|
|
MikSBT_Save.Profiles[profileName]=nil;end end
|
|
function MikSBT.SetOptionUserDisabled(isDisabled)MikSBT_Save.UserDisabled=isDisabled;if(isDisabled)then
|
|
MikSBT.UnregisterEvents();MikCEH.UnregisterEvents();SetCVar("CombatDamage",1);if(SHOW_COMBAT_TEXT~=nil)then SHOW_COMBAT_TEXT=1;end else
|
|
MikSBT.RegisterEvents();MikCEH.RegisterEvents();MikSBT.SetOptionShowGameDamage(MikSBT.CurrentProfile.ShowGameDamage);if(SHOW_COMBAT_TEXT~=nil)then SHOW_COMBAT_TEXT=0;end
|
|
SetCVar("CombatLogPeriodicSpells",1);end end
|
|
function MikSBT.SetOptionShowGameDamage(showDamage)MikSBT.CurrentProfile.ShowGameDamage=showDamage;if(showDamage)then
|
|
SetCVar("CombatDamage",1);else
|
|
SetCVar("CombatDamage",0);end end
|
|
function MikSBT.GetOptionFromVarPath(varPath)local currentTable=MikSBT.CurrentProfile;for varName in string.gfind(varPath,"[%w_]+")do if(type(currentTable[varName])=="table")then currentTable=currentTable[varName];else return currentTable[varName];end end return nil;end
|
|
function MikSBT.SetOptionFromVarPath(varPath,newValue)local currentTable=MikSBT.CurrentProfile;for varName in string.gfind(varPath,"[%w_]+")do if(type(currentTable[varName])=="table")then currentTable=currentTable[varName]else currentTable[varName]=newValue;end end end
|
|
function MikSBT.DispatchAnimationEvent(animationEvent)if(animationEvent.EventSettings.Show and animationEvent.ScrollArea.DisplaySettings.Show)then
|
|
if(animationEvent.ScrollArea==scrollAreas.Incoming)then table.insert(animationMergeData.Incoming.UnmergedEvents,animationEvent);elseif(animationEvent.ScrollArea==scrollAreas.Outgoing)then table.insert(animationMergeData.Outgoing.UnmergedEvents,animationEvent);else MikSBT.AddAnimation(animationEvent);end end end
|
|
function MikSBT.AddAnimation(animationEvent)MikSBT.FormatEventText(animationEvent);for _,suppressionSettings in MikSBT.CurrentProfile.Suppressions do
|
|
if(suppressionSettings.Enabled and(string.find(animationEvent.Text,suppressionSettings.SearchPattern)))then
|
|
eventsRecycler:ReclaimTable(animationEvent);return;elseif(suppressionSettings.Enabled and animationEvent.EffectName and string.find(animationEvent.EffectName,suppressionSettings.SearchPattern))then
|
|
eventsRecycler:ReclaimTable(animationEvent);return;end end if animationEvent.EventType=="MSBT_EVENTTYPE_NOTIFICATION_POWER_GAIN"and animationEvent.EffectName~=0and MikSBT.CurrentProfile.ShowAllManaGains then return end
|
|
if(animationEvent.EventSettings~=nil and animationEvent.EventSettings.IsSticky)then animationEvent.IsSticky=true;end
|
|
local UnitID=MikCEH.GetUnitIDFromName(animationEvent.Name)if UnitID then local _,Class=UnitClass(UnitID)if Class and Class=="PALADIN"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffF58CBA|h"..animationEvent.Name.."|h|r")elseif Class and Class=="DRUID"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffFF7D0A|h"..animationEvent.Name.."|h|r")elseif Class and Class=="HUNTER"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffABD473|h"..animationEvent.Name.."|h|r")elseif Class and Class=="MAGE"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cff69CCF0|h"..animationEvent.Name.."|h|r")elseif Class and Class=="PRIEST"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffFFFFFF|h"..animationEvent.Name.."|h|r")elseif Class and Class=="ROGUE"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffFFF569|h"..animationEvent.Name.."|h|r")elseif Class and Class=="SHAMAN"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cff0070DE|h"..animationEvent.Name.."|h|r")elseif Class and Class=="WARLOCK"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cff9482C9|h"..animationEvent.Name.."|h|r")elseif Class and Class=="WARRIOR"then animationEvent.Text=string.gsub(animationEvent.Text,animationEvent.Name,"|cffC79C6E|h"..animationEvent.Name.."|h|r")end end
|
|
local animDisplayInfo=MikSBT.GetNextAnimationDisplayInfo(animationEvent);animDisplayInfo.ScrollFunction=MikSBT.GetScrollFunction(animationEvent);animDisplayInfo.PositionX,animDisplayInfo.PositionY=MikSBT.GetAnimationStartingPosition(animationEvent)if(animationEvent.EventSettings~=nil)then
|
|
animDisplayInfo.FontSize=MikSBT.GetFontSize(animationEvent.ScrollArea,animationEvent.EventSettings,animationEvent.IsCrit);animDisplayInfo.FontPath=MikSBT.GetFontPath(animationEvent.ScrollArea,animationEvent.EventSettings,animationEvent.IsCrit);animDisplayInfo.FontOutline=MikSBT.GetFontOutline(animationEvent.ScrollArea,animationEvent.EventSettings,animationEvent.IsCrit);animDisplayInfo.ColorR=animationEvent.EventSettings.FontSettings.Color.r;animDisplayInfo.ColorG=animationEvent.EventSettings.FontSettings.Color.g;animDisplayInfo.ColorB=animationEvent.EventSettings.FontSettings.Color.b;else
|
|
animDisplayInfo.FontSize=animationEvent.FontSize;animDisplayInfo.FontPath=animationEvent.FontPath;animDisplayInfo.FontOutline=animationEvent.FontOutline;animDisplayInfo.ColorR=animationEvent.ColorR;animDisplayInfo.ColorG=animationEvent.ColorG;animDisplayInfo.ColorB=animationEvent.ColorB;end
|
|
animDisplayInfo.Alpha=0;animDisplayInfo.AnchorPoint=MikSBT.AVAILABLE_TEXT_ALIGNS[animationEvent.ScrollArea.DisplaySettings.FontSettings.TextAlignIndex].AnchorPoint;animDisplayInfo.IsCrit=animationEvent.IsCrit;animDisplayInfo.IsSticky=animationEvent.IsSticky;animDisplayInfo.FontObject:ClearAllPoints();animDisplayInfo.FontObject:SetFont(animDisplayInfo.FontPath,animDisplayInfo.FontSize,animDisplayInfo.FontOutline);animDisplayInfo.FontObject:SetTextColor(animDisplayInfo.ColorR,animDisplayInfo.ColorG,animDisplayInfo.ColorB);animDisplayInfo.FontObject:SetText(animationEvent.Text);animDisplayInfo.FontObject:SetAlpha(animDisplayInfo.Alpha);animDisplayInfo.FontObject:SetPoint(animDisplayInfo.AnchorPoint,animDisplayInfo.PositionX,animDisplayInfo.PositionY);local texture if animationEvent.Texture then texture=animationEvent.Texture end if animationEvent.EffectName then local name=string.gsub(animationEvent.EffectName," %(%d+%)","")if ICON_CACHE[strlower(name)]then texture=ICON_CACHE[strlower(name)]elseif not texture and MikSBT.FindBuff(name)then local bufftype,index,_=MikSBT.FindBuff(name)local icon if bufftype=="buff"then icon=UnitBuff("player",index)ICON_CACHE[strlower(name)]=icon texture=icon elseif bufftype=="debuff"then icon=UnitDebuff("player",index)ICON_CACHE[strlower(name)]=icon texture=icon else texture=nil NO_ICON_CACHE[strlower(name)]=1 end elseif not texture and BS:GetSpellIcon(name)then texture=BS:GetSpellIcon(name)elseif not texture and MikSBT.FindItemIcon(name)then texture=MikSBT.FindItemIcon(name)ICON_CACHE[strlower(name)]=MikSBT.FindItemIcon(name)elseif not texture then texture=nil NO_ICON_CACHE[strlower(name)]=1 end end if texture then
|
|
if not animDisplayInfo.Texture then
|
|
animDisplayInfo.Texture=getglobal(animationEvent.ScrollArea.AssociatedFrame):CreateTexture(nil,"ARTWORK")end
|
|
animDisplayInfo.Texture:ClearAllPoints();animDisplayInfo.Texture:SetTexture(nil);animDisplayInfo.Texture:SetTexture(texture);animDisplayInfo.Texture:SetWidth(animDisplayInfo.FontSize);animDisplayInfo.Texture:SetHeight(animDisplayInfo.FontSize);animDisplayInfo.Texture:SetTexCoord(0.125,0.875,0.125,0.875)animDisplayInfo.Texture:SetPoint("RIGHT",animDisplayInfo.FontObject,"LEFT",-4,0);animDisplayInfo.Texture:SetDrawLayer(animDisplayInfo.IsSticky and"OVERLAY"or animDisplayInfo.IsCrit and"OVERLAY"or"ARTWORK");elseif animDisplayInfo.Texture then animDisplayInfo.Texture:SetTexture(nil);end
|
|
animDisplayInfo.LastUpdated=GetTime();animDisplayInfo.IsActive=true;if(not getglobal(animationEvent.ScrollArea.AssociatedFrame):IsVisible())then getglobal(animationEvent.ScrollArea.AssociatedFrame):Show();end
|
|
if(animDisplayInfo.IsSticky or(animDisplayInfo.IsCrit and MikSBT.CurrentProfile.UseStickyCrits))then
|
|
MikSBT.RepositionStickyAnimDisplayInfo(animationEvent.ScrollArea);else
|
|
MikSBT.RepositionAnimDisplayInfo(animationEvent.ScrollArea);end
|
|
eventsRecycler:ReclaimTable(animationEvent);end
|
|
function ItemLinkToName(link)return gsub(link,"^.*%[(.*)%].*$","%1");end function MikSBT.FindItemIcon(item)if(not item)then return;end item=string.lower(item);local link;for i=1,23do link=GetInventoryItemLink("player",i);if(link)then if(item==string.lower(ItemLinkToName(link)))then return i,nil,GetInventoryItemTexture('player',i),GetInventoryItemCount('player',i);end end end local count,bag,slot,texture;for i=0,NUM_BAG_FRAMES do for j=1,MAX_CONTAINER_ITEMS do link=GetContainerItemLink(i,j);if(link)then if(item==string.lower(ItemLinkToName(link)))then bag,slot=i,j;texture,count=GetContainerItemInfo(i,j);end end end end return texture;end
|
|
function MikSBT.FindBuff(obuff,unit,item)local buff=strlower(obuff);local tooltip=MSBT_Tooltip;local textleft1=getglobal(tooltip:GetName().."TextLeft1");if(not unit)then unit='player';end local my,me,mc,oy,oe,oc=GetWeaponEnchantInfo();if(my)then tooltip:SetOwner(UIParent,"ANCHOR_NONE");tooltip:SetInventoryItem(unit,16);for i=1,23do local text=getglobal("MSBT_TooltipTextLeft"..i):GetText();if(not text)then break;elseif(text and strlower(text)==buff)then tooltip:Hide();return"main",me,mc;end end tooltip:Hide();elseif(oy)then tooltip:SetOwner(UIParent,"ANCHOR_NONE");tooltip:SetInventoryItem(unit,17);for i=1,23do local text=getglobal("MSBT_TooltipTextLeft"..i):GetText();if(not text)then break;elseif(text and strlower(text)==buff)then tooltip:Hide();return"off",oe,oc;end end tooltip:Hide();end if(item)then return end tooltip:SetOwner(UIParent,"ANCHOR_NONE");tooltip:SetTrackingSpell();local b=textleft1:GetText();if(b and strlower(b)==buff)then tooltip:Hide();return"track",b;end local c=nil;for i=1,32do tooltip:SetOwner(UIParent,"ANCHOR_NONE");tooltip:SetUnitBuff(unit,i);b=textleft1:GetText();tooltip:Hide();if(b and strlower(b)==buff)then return"buff",i,b;elseif(c==b)then break;end
|
|
end c=nil;for i=1,16do tooltip:SetOwner(UIParent,"ANCHOR_NONE");tooltip:SetUnitDebuff(unit,i);b=textleft1:GetText();tooltip:Hide();if(b and strlower(b)==buff)then return"debuff",i,b;elseif(c==b)then break;end
|
|
end tooltip:Hide();end
|
|
local depth=0local function dump(...)local out="";for i=1,arg.n,1do if depth>30then out=out.."|cffffd800... Too many things here!|r"return out;end local d=arg[i];local t=type(d);if(t=="table")then out=out.."{ |cff9f9f9f--[["..tostring(arg[i]).."]]|r\n";local first=true;if(d)then for k,v in pairs(d)do if(not first)then out=out..", \n";end first=false;depth=depth+1out=out.." "..dump(k);out=out.." = ";out=out..dump(v);end end out=out.."\n}, |cff9f9f9f--[["..tostring(arg[i]).."]]|r\n";elseif(t=="nil")then out=out.."|cffff7f7fnil|r";elseif(t=="number")then out=out.."|cffff7fff"..d.."|r";elseif(t=="string")then out=out..'"|cff7fd5ff'..d..'|r"';elseif(t=="boolean")then if(d)then out=out.."|cffff9100true|r";else out=out.."|cffff9100false|r";end elseif(t=="function")then out=out.."|cff7fd5ff"..tostring(d).."|r";elseif(t=="userdata")then out=out..string.format("|cffffea00<%s:%s>|r",t,getmetatable(d)or"(anon)")else out=out..string.upper(t).."??";end if(i<arg.n)then out=out..", ";end end return out;end function MikSBT.debugPrint(...)local debugWin=0;local name,shown;for i=1,NUM_CHAT_WINDOWS do name,_,_,_,_,_,shown=GetChatWindowInfo(i);if(string.lower(name)=="debug")then debugWin=i;break;end end if(debugWin==0)then return end local out="";depth=0for i=1,arg.n,1do if(i>1)then out=out..", ";end out=arg[i].." = "arg[i]=getglobal(arg[i])local t=type(arg[i]);if(t=="string")then out=out..'"|cff7fd5ff'..arg[i]..'|r"';elseif(t=="number")then out=out.."|cffff7fff"..arg[i].."|r";elseif(t=="boolean")then out=out.."|cffff9100"..arg[i].."|r";elseif(t==nil)then out=out.."|cffff7f7f"..arg[i].."|r";else out=out..dump(arg[i]);end end local start=GetTime()getglobal("ChatFrame"..debugWin):AddMessage("|cffffd800<|r\n"..out,1.0,1.0,1.0);getglobal("ChatFrame"..debugWin):AddMessage("|cffffd800> displayed in:|r "..string.format("%.4f",GetTime()-start).."|cffffd800s|r",1.0,1.0,1.0);end SLASH_MSBTDUMPCMD1="/bump"SlashCmdList["MSBTDUMPCMD"]=MikSBT.debugPrint
|
|
function MikSBT.GetNextAnimationDisplayInfo(animationEvent)local animDisplayInfo;if(animationEvent.IsSticky or(animationEvent.IsCrit and MikSBT.CurrentProfile.UseStickyCrits))then
|
|
animDisplayInfo=animationEvent.ScrollArea.AnimationDisplayArray[animationEvent.ScrollArea.NextSticky];animationEvent.ScrollArea.NextSticky=animationEvent.ScrollArea.NextSticky+1;if(animationEvent.ScrollArea.NextSticky>NUM_FONT_STRINGS)then animationEvent.ScrollArea.NextSticky=animationEvent.ScrollArea.FirstSticky;end
|
|
else
|
|
animDisplayInfo=animationEvent.ScrollArea.AnimationDisplayArray[animationEvent.ScrollArea.NextAnimationDisplay];animationEvent.ScrollArea.NextAnimationDisplay=animationEvent.ScrollArea.NextAnimationDisplay+1;if(animationEvent.ScrollArea.NextAnimationDisplay>(animationEvent.ScrollArea.FirstSticky-1))then animationEvent.ScrollArea.NextAnimationDisplay=1;end end
|
|
return animDisplayInfo;end
|
|
function MikSBT.GetScrollFunction(animationEvent)if(animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_STRAIGHT)then
|
|
if(animationEvent.ScrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
return MikSBT.ScrollStraightDown;else
|
|
return MikSBT.ScrollStraightUp;end
|
|
elseif(animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_LEFT_PARABOLA)then
|
|
if(animationEvent.ScrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
return MikSBT.ScrollLeftParabolaDown;else
|
|
return MikSBT.ScrollLeftParabolaUp;end
|
|
elseif(animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_RIGHT_PARABOLA)then
|
|
if(animationEvent.ScrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
return MikSBT.ScrollRightParabolaDown;else
|
|
return MikSBT.ScrollRightParabolaUp;end end
|
|
return MikSBT.ScrollStraightUp;end
|
|
function MikSBT.GetAnimationStartingPosition(animationEvent)local startPositionX,startPositionY;if(animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_STRAIGHT or animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_LEFT_PARABOLA or animationEvent.ScrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_RIGHT_PARABOLA)then
|
|
if(animationEvent.ScrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
startPositionX=0;startPositionY=animationEvent.ScrollArea.DisplaySettings.ScrollHeight;else
|
|
startPositionX=0;startPositionY=0;end
|
|
if(animationEvent.IsSticky or(animationEvent.IsCrit and MikSBT.CurrentProfile.UseStickyCrits))then
|
|
startPositionY=ceil(animationEvent.ScrollArea.DisplaySettings.ScrollHeight/2);end end
|
|
return startPositionX,startPositionY;end
|
|
function MikSBT.RepositionAnimDisplayInfo(scrollArea)for x=scrollArea.NextAnimationDisplay,scrollArea.FirstSticky-1do local animDisplayInfo=scrollArea.AnimationDisplayArray[x];if(animDisplayInfo.IsActive)then table.insert(activeNonStickies,animDisplayInfo);end end for x=1,scrollArea.NextAnimationDisplay-1do local animDisplayInfo=scrollArea.AnimationDisplayArray[x];if(animDisplayInfo.IsActive)then table.insert(activeNonStickies,animDisplayInfo);end end
|
|
local numNonStickies=table.getn(activeNonStickies);if(scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_STRAIGHT or scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_LEFT_PARABOLA or scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_RIGHT_PARABOLA)then
|
|
if(scrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
if(numNonStickies>1)then
|
|
for x=numNonStickies,2,-1do local bottomPointCurrent=activeNonStickies[x].PositionY;local topPointNext=activeNonStickies[x-1].PositionY+activeNonStickies[x-1].FontSize+MIN_VERTICAL_SPACING;if(topPointNext>bottomPointCurrent)then activeNonStickies[x-1].PositionY=bottomPointCurrent-activeNonStickies[x-1].FontSize-MIN_VERTICAL_SPACING;end end end
|
|
else
|
|
if(numNonStickies>1)then
|
|
for x=numNonStickies,2,-1do local topPointCurrent=activeNonStickies[x].PositionY+activeNonStickies[x].FontSize+MIN_VERTICAL_SPACING;local bottomPointNext=activeNonStickies[x-1].PositionY;if(bottomPointNext<topPointCurrent)then activeNonStickies[x-1].PositionY=topPointCurrent;end end end end
|
|
end
|
|
for x=1,numNonStickies do table.remove(activeNonStickies,1);end end
|
|
function MikSBT.RepositionStickyAnimDisplayInfo(scrollArea)for x=scrollArea.NextSticky,NUM_FONT_STRINGS do local animDisplayInfo=scrollArea.AnimationDisplayArray[x];if(animDisplayInfo.IsActive)then table.insert(activeStickies,animDisplayInfo);end end for x=scrollArea.FirstSticky,scrollArea.NextSticky-1do local animDisplayInfo=scrollArea.AnimationDisplayArray[x];if(animDisplayInfo.IsActive)then table.insert(activeStickies,animDisplayInfo);end end
|
|
local numStickies=table.getn(activeStickies);if(scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_STRAIGHT or scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_LEFT_PARABOLA or scrollArea.DisplaySettings.AnimationStyle==ANIMATION_STYLE_RIGHT_PARABOLA)then
|
|
if(scrollArea.DisplaySettings.ScrollDirection==SCROLL_DIRECTION_DOWN)then
|
|
if(numStickies>1)then
|
|
local middleSticky=floor((numStickies+1)/2);activeStickies[middleSticky].PositionY=scrollArea.DisplaySettings.ScrollHeight/2;for x=middleSticky-1,1,-1do activeStickies[x].PositionY=activeStickies[x+1].PositionY-activeStickies[x].FontSize-MIN_VERTICAL_SPACING;end
|
|
for x=middleSticky+1,numStickies do activeStickies[x].PositionY=activeStickies[x-1].PositionY+activeStickies[x-1].FontSize+MIN_VERTICAL_SPACING;end end
|
|
else
|
|
if(numStickies>1)then
|
|
local middleSticky=ceil((numStickies+1)/2);activeStickies[middleSticky].PositionY=scrollArea.DisplaySettings.ScrollHeight/2;for x=middleSticky-1,1,-1do activeStickies[x].PositionY=activeStickies[x+1].PositionY+activeStickies[x+1].FontSize+MIN_VERTICAL_SPACING;end
|
|
for x=middleSticky+1,numStickies do activeStickies[x].PositionY=activeStickies[x-1].PositionY-activeStickies[x].FontSize-MIN_VERTICAL_SPACING;end end end
|
|
end
|
|
for x=1,numStickies do table.remove(activeStickies,1);end end
|
|
function MikSBT.DoAnimation(animDisplayInfo,scrollArea)local currentTime=GetTime();local elapsedTime=currentTime-animDisplayInfo.LastUpdated;if(animDisplayInfo.IsSticky or(animDisplayInfo.IsCrit and MikSBT.CurrentProfile.UseStickyCrits))then
|
|
animDisplayInfo.FontObject:SetPoint(animDisplayInfo.AnchorPoint,animDisplayInfo.PositionX,animDisplayInfo.PositionY);if(elapsedTime<=STICKY_FADE_IN_TIME)then local textDelta=animDisplayInfo.FontSize*(1-(elapsedTime/STICKY_FADE_IN_TIME));animDisplayInfo.FontObject:SetTextHeight(animDisplayInfo.FontSize+textDelta);animDisplayInfo.FontObject:SetAlpha(1);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetAlpha(1);animDisplayInfo.Texture:SetWidth(animDisplayInfo.FontSize+textDelta);animDisplayInfo.Texture:SetHeight(animDisplayInfo.FontSize+textDelta);end return;elseif(elapsedTime<=(STICKY_DISPLAY_TIME+STICKY_FADE_IN_TIME))then animDisplayInfo.FontObject:SetTextHeight(animDisplayInfo.FontSize);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetWidth(animDisplayInfo.FontSize);animDisplayInfo.Texture:SetHeight(animDisplayInfo.FontSize);end if animDisplayInfo.IsCrit then if not animDisplayInfo.timeLastJiggled then animDisplayInfo.originalPositionX=animDisplayInfo.PositionX animDisplayInfo.originalPositionY=animDisplayInfo.PositionY animDisplayInfo.DecalageX=0animDisplayInfo.DecalageY=0animDisplayInfo.timeLastJiggled=0 end if animDisplayInfo.PositionY~=(animDisplayInfo.originalPositionY+animDisplayInfo.DecalageY)then animDisplayInfo.originalPositionX=animDisplayInfo.PositionX animDisplayInfo.originalPositionY=animDisplayInfo.PositionY end if(elapsedTime-animDisplayInfo.timeLastJiggled>0.05)then animDisplayInfo.DecalageX=math.ceil(math.random(-1,1));animDisplayInfo.DecalageY=math.ceil(math.random(-1,1));animDisplayInfo.PositionX=animDisplayInfo.originalPositionX+animDisplayInfo.DecalageX;animDisplayInfo.PositionY=animDisplayInfo.originalPositionY+animDisplayInfo.DecalageY;animDisplayInfo.timeLastJiggled=elapsedTime;animDisplayInfo.FontObject:SetPoint(animDisplayInfo.AnchorPoint,animDisplayInfo.PositionX,animDisplayInfo.PositionY);end end return;elseif(elapsedTime<=(STICKY_DISPLAY_TIME+STICKY_FADE_IN_TIME+STICKY_FADE_OUT_TIME))then local alpha=1-((elapsedTime-STICKY_DISPLAY_TIME-STICKY_FADE_IN_TIME)/STICKY_FADE_OUT_TIME);animDisplayInfo.timeLastJiggled=nil animDisplayInfo.FontObject:SetAlpha(alpha);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetAlpha(alpha);end return;end
|
|
animDisplayInfo.FontObject:SetAlpha(0);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetAlpha(0);end animDisplayInfo.IsActive=false;return;end
|
|
if(elapsedTime>ANIMATION_SPEED)then
|
|
local animationComplete=animDisplayInfo.ScrollFunction(animDisplayInfo,scrollArea);if(animationComplete)then
|
|
animDisplayInfo.FontObject:SetAlpha(0);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetAlpha(0);end
|
|
animDisplayInfo.IsActive=false;else
|
|
animDisplayInfo.FontObject:SetPoint(animDisplayInfo.AnchorPoint,animDisplayInfo.PositionX,animDisplayInfo.PositionY);animDisplayInfo.FontObject:SetAlpha(animDisplayInfo.Alpha);if animDisplayInfo.Texture then animDisplayInfo.Texture:SetAlpha(animDisplayInfo.Alpha);end end
|
|
animDisplayInfo.LastUpdated=currentTime;end
|
|
end
|
|
function MikSBT.ScrollUp(animDisplayInfo,scrollArea)local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;animDisplayInfo.PositionY=animDisplayInfo.PositionY+MikSBT.CurrentProfile.AnimationStep;if(animDisplayInfo.PositionY>=animationMidPoint)then animDisplayInfo.Alpha=1-((animDisplayInfo.PositionY-animationMidPoint)/animationMidPoint);else animDisplayInfo.Alpha=1;end
|
|
if(animDisplayInfo.PositionY>=scrollArea.DisplaySettings.ScrollHeight)then
|
|
return true;end
|
|
return false;end
|
|
function MikSBT.ScrollDown(animDisplayInfo,scrollArea)local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;animDisplayInfo.PositionY=animDisplayInfo.PositionY-MikSBT.CurrentProfile.AnimationStep;if(animDisplayInfo.PositionY<animationMidPoint)then animDisplayInfo.Alpha=1-((animationMidPoint-animDisplayInfo.PositionY)/animationMidPoint);else animDisplayInfo.Alpha=1;end
|
|
if(animDisplayInfo.PositionY<=0)then
|
|
return true;end
|
|
return false;end
|
|
function MikSBT.ScrollStraightUp(animDisplayInfo,scrollArea)return MikSBT.ScrollUp(animDisplayInfo,scrollArea);end
|
|
function MikSBT.ScrollStraightDown(animDisplayInfo,scrollArea)return MikSBT.ScrollDown(animDisplayInfo,scrollArea);end
|
|
function MikSBT.ScrollLeftParabolaUp(animDisplayInfo,scrollArea)local animationComplete=MikSBT.ScrollUp(animDisplayInfo,scrollArea);local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;local parabolaMaxX=ceil((animationMidPoint*animationMidPoint)/(4*animationMidPoint));local parabolaY=animDisplayInfo.PositionY-animationMidPoint;local newX=parabolaMaxX-ceil((parabolaY*parabolaY)/(4*animationMidPoint));animDisplayInfo.PositionX=newX*-1;return animationComplete;end
|
|
function MikSBT.ScrollLeftParabolaDown(animDisplayInfo,scrollArea)local animationComplete=MikSBT.ScrollDown(animDisplayInfo,scrollArea);local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;local parabolaMaxX=ceil((animationMidPoint*animationMidPoint)/(4*animationMidPoint));local parabolaY=animDisplayInfo.PositionY-animationMidPoint;local newX=parabolaMaxX-ceil((parabolaY*parabolaY)/(4*animationMidPoint));animDisplayInfo.PositionX=newX*-1;return animationComplete;end
|
|
function MikSBT.ScrollRightParabolaUp(animDisplayInfo,scrollArea)local animationComplete=MikSBT.ScrollUp(animDisplayInfo,scrollArea);local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;local parabolaMaxX=ceil((animationMidPoint*animationMidPoint)/(4*animationMidPoint));local parabolaY=animDisplayInfo.PositionY-animationMidPoint;local newX=parabolaMaxX-ceil((parabolaY*parabolaY)/(4*animationMidPoint));animDisplayInfo.PositionX=newX;return animationComplete;end
|
|
function MikSBT.ScrollRightParabolaDown(animDisplayInfo,scrollArea)local animationComplete=MikSBT.ScrollDown(animDisplayInfo,scrollArea);local animationMidPoint=scrollArea.DisplaySettings.ScrollHeight/2;local parabolaMaxX=ceil((animationMidPoint*animationMidPoint)/(4*animationMidPoint));local parabolaY=animDisplayInfo.PositionY-animationMidPoint;local newX=parabolaMaxX-ceil((parabolaY*parabolaY)/(4*animationMidPoint));animDisplayInfo.PositionX=newX;return animationComplete;end
|
|
function MikSBT.GetNextParameter(paramString)local remainingParams;local currentParam=paramString;local idx=string.find(paramString," ");if(idx)then
|
|
currentParam=string.sub(paramString,1,idx-1);remainingParams=string.sub(paramString,idx+1);end
|
|
return currentParam,remainingParams;end
|
|
function MikSBT.CommandHandler(params)local currentParam;local remainingParams;currentParam,remainingParams=MikSBT.GetNextParameter(params);local showUsage=true;if(currentParam)then currentParam=string.lower(currentParam);end
|
|
if(currentParam=="")then
|
|
if(not IsAddOnLoaded(MikSBT.MOD_NAME.."Options"))then
|
|
UIParentLoadAddOn(MikSBT.MOD_NAME.."Options");end
|
|
if(IsAddOnLoaded(MikSBT.MOD_NAME.."Options"))then
|
|
if(not MSBTScrollAreaMoverControlFrame:IsShown())then
|
|
MSBTFrameOptions:Show();end end
|
|
showUsage=false;elseif(currentParam==MikSBT.COMMAND_RESET)then
|
|
MikSBT.ResetProfile(MikSBT_Save.CurrentProfile,true);showUsage=false;elseif(currentParam==MikSBT.COMMAND_DISABLE)then
|
|
MikSBT.SetOptionUserDisabled(true);MikSBT.Print(MikSBT.MSG_DISABLE,1,1,1);showUsage=false;elseif(currentParam==MikSBT.COMMAND_ENABLE)then
|
|
MikSBT.SetOptionUserDisabled(false);MikSBT.Print(MikSBT.MSG_ENABLE,1,1,1);showUsage=false;elseif(currentParam==MikSBT.COMMAND_SHOWVER)then
|
|
MikSBT.Print(MikSBT.VERSION_STRING,1,1,1);showUsage=false;elseif(currentParam==MikSBT.COMMAND_STATS)then
|
|
eventsRecycler:PrintStats();showUsage=false;elseif(currentParam==MikSBT.COMMAND_SEARCH)then
|
|
if(remainingParams and remainingParams~="")then
|
|
MikCEH.EnableEventSearching(remainingParams);MikSBT.Print(MikSBT.MSG_SEARCH_ENABLE..remainingParams,1,1,1);else
|
|
MikCEH.DisableEventSearching();MikSBT.Print(MikSBT.MSG_SEARCH_DISABLE,1,1,1);end
|
|
showUsage=false;elseif(currentParam==MikSBT.COMMAND_DEBUG)then
|
|
debugMode=not debugMode;if(debugMode)then MikSBT.Print(MikSBT.MSG_DEBUG_ENABLE,1,1,1);else MikSBT.Print(MikSBT.MSG_DEBUG_DISABLE,1,1,1);end
|
|
showUsage=false;end
|
|
if(showUsage)then MikSBT.PrintUsage();end end
|
|
function MikSBT.PrintUsage()for _,msg in MikSBT.COMMAND_USAGE do MikSBT.Print(msg,1,1,1);end end
|
|
function MikSBT.DisplayMessage(message,displayType,isSticky,colorR,colorG,colorB,fontSize,fontIndex,outlineIndex,Texture)if(message==nil)then return;end
|
|
if(displayType~=MikSBT.DISPLAYTYPE_INCOMING and displayType~=MikSBT.DISPLAYTYPE_OUTGOING and displayType~=MikSBT.DISPLAYTYPE_NOTIFICATION)then
|
|
displayType=MikSBT.DISPLAYTYPE_NOTIFICATION;end
|
|
local scrollArea;if(displayType==MikSBT.DISPLAYTYPE_INCOMING)then scrollArea=scrollAreas.Incoming;elseif(displayType==MikSBT.DISPLAYTYPE_OUTGOING)then scrollArea=scrollAreas.Outgoing;elseif(displayType==MikSBT.DISPLAYTYPE_NOTIFICATION)then scrollArea=scrollAreas.Notification;end
|
|
if(not scrollArea.DisplaySettings.Show)then return;end
|
|
if(colorR==nil or colorR<0or colorR>255)then
|
|
colorR=255;end
|
|
if(colorG==nil or colorG<0or colorG>255)then
|
|
colorG=255;end
|
|
if(colorB==nil or colorB<0or colorB>255)then
|
|
colorB=255;end
|
|
if(fontSize==nil or fontSize<12or fontSize>32)then fontSize=MikSBT.GetFontSize(scrollArea,nil,false);end local fontPath;if(fontIndex==nil or MikSBT.AVAILABLE_FONTS[fontIndex]==nil)then fontPath=MikSBT.GetFontPath(scrollArea,nil,false);else fontPath=MikSBT.AVAILABLE_FONTS[fontIndex].Path;end local fontOutline;if(outlineIndex==nil or MikSBT.AVAILABLE_OUTLINES[outlineIndex]==nil)then fontOutline=MikSBT.GetFontOutline(scrollArea,nil,false);else fontOutline=MikSBT.AVAILABLE_OUTLINES[outlineIndex].Style;end
|
|
local animationEvent=eventsRecycler:AcquireTable();animationEvent.ScrollArea=scrollArea;animationEvent.IsCrit=false;animationEvent.IsSticky=isSticky;animationEvent.Text=message;animationEvent.FontSize=fontSize;animationEvent.FontPath=fontPath;animationEvent.FontOutline=fontOutline;animationEvent.ColorR=colorR;animationEvent.ColorG=colorG;animationEvent.ColorB=colorB;animationEvent.Texture=Texture;MikSBT.AddAnimation(animationEvent);end |