优化扩展血条插件,改用异形形状外观
This commit is contained in:
parent
3edd97c433
commit
adb198d57c
@ -1,29 +1,54 @@
|
||||
--[[
|
||||
插件名称: 尚美&魔兽插件
|
||||
插件用途: 本插件用于匹配数据库[__sm_生物血量扩展]显示生物超21亿血量使用
|
||||
插件作者: 尚美
|
||||
联系方式:QQ:2370337237
|
||||
制作日期: 2025年9月5日
|
||||
插件版本: 0.0.1
|
||||
版权信息: 本插件未经授权不得转用、修改或用于商业用途。
|
||||
插件文件: 主文件
|
||||
--]]
|
||||
|
||||
-- 配置参数
|
||||
local MAX_HEALTH_PER_LAYER = 10000000000
|
||||
local SHAKE_ENABLED = false -- 震动开关变量设置为 false 可禁用震动
|
||||
local SHAKE_INTENSITY = 2 -- 震动强度
|
||||
local Translation_1 = 0.01 -- 震动速度1-向下速度
|
||||
local Translation_2 = 0.21 -- 震动速度2-回弹速度
|
||||
local FLASH_DURATION = 0.3
|
||||
local SHAKE_ENABLED = true -- 震动开关变量设置为 false 可禁用震动
|
||||
local SHAKE_INTENSITY = 1 -- 震动强度
|
||||
local Translation_1 = 0.1 -- 震动速度1-向下速度
|
||||
local Translation_2 = 0.001 -- 震动速度2-回弹速度
|
||||
local DAMAGE_TRACK_COOLDOWN = 0.02 -- 独立伤害追踪冷却
|
||||
local SHAKE_COOLDOWN = 0.1 -- 独立震动冷却
|
||||
local HEALTHFRAME_W = 800 --血条宽度
|
||||
local HEALTHFRAME_H = 25 --血条高度
|
||||
local HEALTHFRAME_H = 60 --血条高度
|
||||
|
||||
-- 遮罩系统配置常量
|
||||
local MASK_CONFIG = {
|
||||
-- 血条区域定义(百分比)
|
||||
RIGHT_SECTION_START = 32, -- 右侧区域开始位置(32%)
|
||||
TRANSITION_START = 31, -- 过渡区域开始位置(31%)
|
||||
LEFT_SECTION_END = 0, -- 左侧区域结束位置(0%)
|
||||
|
||||
-- 高度定义(像素)
|
||||
RIGHT_HEIGHT = 12, -- 右侧区域高度
|
||||
LEFT_HEIGHT = 16, -- 左侧区域高度
|
||||
|
||||
-- 边距定义
|
||||
LEFT_MARGIN = 80, -- 左边距
|
||||
RIGHT_MARGIN = 35, -- 右边距
|
||||
}
|
||||
|
||||
-- 血条颜色
|
||||
local LAYER_COLOR_TABLE = {
|
||||
-- 基础高饱和色
|
||||
{ r = 1.00, g = 0.00, b = 0.00 }, -- 红(原色,饱和)
|
||||
{ r = 0.00, g = 1.00, b = 0.00 }, -- 绿(原色,饱和)
|
||||
{ r = 1.00, g = 1.00, b = 0.00 }, -- 黄(原色,饱和)
|
||||
{ r = 1.00, g = 0.00, b = 1.00 }, -- 品红(原色,饱和)
|
||||
{ r = 0.00, g = 1.00, b = 1.00 }, -- 青(原色,饱和)
|
||||
{ r = 1.00, g = 0.50, b = 0.00 }, -- 橙(饱和度已提高)
|
||||
{ r = 0.00, g = 0.18, b = 0.65 }, -- 克莱因蓝(RGB: #002FA7)
|
||||
{ r = 0.98, g = 0.86, b = 0.14 }, -- 申布伦黄(RGB: #F9DC24)
|
||||
{ r = 0.46, g = 0.00, b = 0.13 }, -- 勃艮第红(RGB: #990033)
|
||||
{ r = 0.18, g = 0.55, b = 0.34 }, -- 马尔斯绿(RGB: #2E8B57)
|
||||
{ r = 0.99, g = 0.39, b = 0.28 }, -- 提香红(RGB: #FF6347)
|
||||
{ r = 1.00, g = 0.00, b = 0.00 }, -- 红
|
||||
{ r = 0.00, g = 1.00, b = 0.00 }, -- 绿
|
||||
{ r = 1.00, g = 1.00, b = 0.00 }, -- 黄
|
||||
{ r = 1.00, g = 0.00, b = 1.00 }, -- 品红
|
||||
{ r = 0.00, g = 1.00, b = 1.00 }, -- 青
|
||||
{ r = 1.00, g = 0.50, b = 0.00 }, -- 橙
|
||||
{ r = 0.00, g = 0.18, b = 0.65 }, -- 克莱因蓝
|
||||
{ r = 0.98, g = 0.86, b = 0.14 }, -- 申布伦黄
|
||||
{ r = 0.46, g = 0.00, b = 0.13 }, -- 勃艮第红
|
||||
{ r = 0.18, g = 0.55, b = 0.34 }, -- 马尔斯绿
|
||||
{ r = 0.99, g = 0.39, b = 0.28 }, -- 提香红
|
||||
}
|
||||
|
||||
Creature_MultiLifeMultiplierAddon = Creature_MultiLifeMultiplierAddon or
|
||||
@ -32,7 +57,7 @@ Creature_MultiLifeMultiplierAddon = Creature_MultiLifeMultiplierAddon or
|
||||
CreatureTemplates = {}, -- 新增:按Entry存储模板数据
|
||||
lastDamageTrackTime = 0, -- 独立追踪冷却计时
|
||||
lastShakeTime = 0, -- 独立震动冷却计时
|
||||
lastTargetWasCustom = false -- 跟踪上一次选择的目标类型
|
||||
lastTargetWasCustom = false -- 跟踪上一次选择的目标类型
|
||||
}
|
||||
|
||||
-- 初始化函数
|
||||
@ -56,61 +81,60 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.CustomHealthFrame:SetSize(HEALTHFRAME_W, HEALTHFRAME_H)
|
||||
self.CustomHealthFrame:SetPoint("BOTTOM", UIParent, "TOP", 0, -80)
|
||||
self.CustomHealthFrame:SetBackdrop({
|
||||
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
||||
-- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
|
||||
})
|
||||
self.CustomHealthFrame:Hide()
|
||||
|
||||
|
||||
-- 血条边框
|
||||
self.border = CreateFrame("Frame", nil, self.CustomHealthFrame)
|
||||
self.border:SetSize(HEALTHFRAME_W, HEALTHFRAME_H)
|
||||
self.border:SetPoint("CENTER", self.CustomHealthFrame, "CENTER", 0, 0)
|
||||
self.border:SetBackdrop({ bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\B\\FrameBack" })
|
||||
if self.border.SetFrameLevel then
|
||||
self.border:SetFrameLevel(5)
|
||||
end
|
||||
|
||||
-- 背景血条
|
||||
self.healthBarBg = CreateFrame("StatusBar", nil, self.CustomHealthFrame)
|
||||
self.healthBarBg = CreateFrame("StatusBar", nil, self.border)
|
||||
self.healthBarBg:SetSize(HEALTHFRAME_W, HEALTHFRAME_H)
|
||||
self.healthBarBg:SetPoint("TOP", self.CustomHealthFrame, "TOP", 0, 0) -- 调整锚点
|
||||
self.healthBarBg:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
self.healthBarBg:SetPoint("TOP", self.border, "TOP", 0, 0) -- 调整锚点
|
||||
self.healthBarBg:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\B\\StatusBar")
|
||||
self.healthBarBg:SetMinMaxValues(0, MAX_HEALTH_PER_LAYER)
|
||||
if self.healthBarBg.SetFrameLevel then
|
||||
self.healthBarBg:SetFrameLevel(1)
|
||||
end
|
||||
|
||||
-- 伤害跟踪条
|
||||
self.damageTrackBar = CreateFrame("StatusBar", nil, self.healthBarBg)
|
||||
self.damageTrackBar:SetAllPoints(self.healthBarBg)
|
||||
self.damageTrackBar:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
self.damageTrackBar:SetMinMaxValues(0, MAX_HEALTH_PER_LAYER)
|
||||
self.damageTrackBar:Hide()
|
||||
|
||||
-- 主血条
|
||||
self.healthBar = CreateFrame("StatusBar", nil, self.healthBarBg)
|
||||
self.healthBar:SetAllPoints(self.healthBarBg)
|
||||
self.healthBar:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
self.healthBar:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\B\\StatusBar")
|
||||
self.healthBar:SetMinMaxValues(0, MAX_HEALTH_PER_LAYER)
|
||||
if self.healthBar.SetFrameLevel then
|
||||
self.healthBar:SetFrameLevel(2)
|
||||
end
|
||||
|
||||
-- 闪光效果层
|
||||
self.flashEffectBar = CreateFrame("StatusBar", nil, self.healthBarBg)
|
||||
self.flashEffectBar:SetAllPoints(self.healthBarBg)
|
||||
self.flashEffectBar:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
self.flashEffectBar:SetMinMaxValues(0, MAX_HEALTH_PER_LAYER)
|
||||
if self.flashEffectBar.SetFrameLevel then
|
||||
self.flashEffectBar:SetFrameLevel(3)
|
||||
end
|
||||
self.flashEffectBar:Hide()
|
||||
---------------------------------------------------- 为主血条添加双遮罩系统 ----------------------------------------------------
|
||||
-- 创建左侧遮罩(负责0%-45%区域)
|
||||
self.healthBar.leftMask = CreateFrame("Frame", nil, self.healthBar)
|
||||
self.healthBar.leftMask:SetFrameLevel(self.healthBar:GetFrameLevel() + 1)
|
||||
self.healthBar.leftMask:SetHeight(MASK_CONFIG.LEFT_HEIGHT)
|
||||
self.healthBar.leftMask:SetWidth(0)
|
||||
self.healthBar.leftMask:SetBackdrop({ bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\WHITE8X8" })
|
||||
|
||||
-- 血条边框
|
||||
local border = CreateFrame("Frame", nil, self.healthBar)
|
||||
border:SetSize(HEALTHFRAME_W + 5, HEALTHFRAME_H + 5)
|
||||
border:SetPoint("CENTER", self.healthBar, "CENTER", 0, 0)
|
||||
border:SetBackdrop({ edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 10 })
|
||||
if border.SetFrameLevel then
|
||||
border:SetFrameLevel(5)
|
||||
end
|
||||
-- 创建右侧遮罩(负责45%-100%区域)
|
||||
self.healthBar.rightMask = CreateFrame("Frame", nil, self.healthBar)
|
||||
self.healthBar.rightMask:SetFrameLevel(self.healthBar:GetFrameLevel() + 1)
|
||||
self.healthBar.rightMask:SetHeight(MASK_CONFIG.RIGHT_HEIGHT)
|
||||
self.healthBar.rightMask:SetWidth(0)
|
||||
self.healthBar.rightMask:SetBackdrop({ bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\WHITE8X8" })
|
||||
---------------------------------------------------- 为主血条添加双遮罩系统 ----------------------------------------------------
|
||||
|
||||
-- 右下方百分比框架
|
||||
local HealthPerFeame = CreateFrame("Frame", nil, border)
|
||||
local HealthPerFeame = CreateFrame("Frame", nil, self.border)
|
||||
HealthPerFeame:SetSize(80, 20)
|
||||
HealthPerFeame:SetPoint("TOPRIGHT", border, "BOTTOMRIGHT", 0, 4)
|
||||
HealthPerFeame:SetBackdrop({ bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\HealthPerImg" })
|
||||
HealthPerFeame:SetPoint("TOPRIGHT", self.border, "BOTTOMRIGHT", -15, 8)
|
||||
HealthPerFeame:SetBackdrop({ bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\B\\HealthPerImg" })
|
||||
if HealthPerFeame.SetFrameLevel then
|
||||
HealthPerFeame:SetFrameLevel(4)
|
||||
end
|
||||
@ -128,43 +152,35 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.HealthPerText:SetPoint("LEFT", HealthPerFeame, "LEFT", 20 + 13, 0)
|
||||
self.HealthPerText:SetText("100%")
|
||||
|
||||
-- 创建闪光效果纹理
|
||||
self.flashTexture = self.healthBarBg:CreateTexture(nil, "OVERLAY")
|
||||
self.flashTexture:SetSize(60, 25)
|
||||
self.flashTexture:SetPoint("CENTER", self.healthBarBg, "CENTER")
|
||||
self.flashTexture:SetTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\flash")
|
||||
self.flashTexture:SetBlendMode("ADD")
|
||||
self.flashTexture:SetAlpha(0)
|
||||
|
||||
-- 创建血量文本
|
||||
self.healthText = self.healthBarBg:CreateFontString(nil, "OVERLAY")
|
||||
self.healthText:SetFont("Fonts\\ZYKai_T.TTF", 12, "OUTLINE, MONOCHROME")
|
||||
self.healthText:SetTextColor(1, 1, 1)
|
||||
self.healthText:SetPoint("BOTTOMRIGHT", self.healthBarBg, "TOPRIGHT", 0, 5)
|
||||
self.healthText:SetPoint("BOTTOMRIGHT", self.healthBarBg, "TOPRIGHT", -20, -25)
|
||||
self.healthText:SetShadowOffset(1, -1);
|
||||
|
||||
-- 创建层数文本
|
||||
self.layerText = border:CreateFontString(nil, "OVERLAY")
|
||||
self.layerText = self.border:CreateFontString(nil, "OVERLAY")
|
||||
self.layerText:SetFont("Fonts\\SM02-W.TTF", 16, "OUTLINE, MONOCHROME")
|
||||
self.layerText:SetTextColor(1, 1, 1)
|
||||
self.layerText:SetPoint("RIGHT", border, "RIGHT", -20, 0)
|
||||
self.layerText:SetPoint("RIGHT", self.border, "RIGHT", 15, -8)
|
||||
self.layerText:SetShadowColor(0 / 255, 0 / 255, 0 / 255) --文本阴影
|
||||
self.layerText:SetShadowOffset(1, -1);
|
||||
|
||||
-- 创建生物分类按钮
|
||||
self.CreateClassificationButton = CreateFrame("Button", nil, border)
|
||||
self.CreateClassificationButton = CreateFrame("Button", nil, self.healthBarBg)
|
||||
self.CreateClassificationButton:SetSize(15, 15)
|
||||
self.CreateClassificationButton:SetPoint("BOTTOMLEFT", border, "TOPLEFT", 10, 0)
|
||||
self.CreateClassificationButton:SetPoint("BOTTOMLEFT", self.border, "TOPLEFT", 90, -18)
|
||||
self.CreateClassificationButton:SetNormalTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
|
||||
-- 创建生物类型按钮
|
||||
self.CreateTypeButton = CreateFrame("Button", nil, border)
|
||||
self.CreateTypeButton = CreateFrame("Button", nil, self.CreateClassificationButton)
|
||||
self.CreateTypeButton:SetSize(15, 15)
|
||||
self.CreateTypeButton:SetPoint("BOTTOMLEFT", self.CreateClassificationButton, "BOTTOMRIGHT", 5, 0)
|
||||
self.CreateTypeButton:SetNormalTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
|
||||
-- 创建等级文本
|
||||
self.levelText = self.CreateTypeButton:CreateFontString(nil, "OVERLAY")
|
||||
self.levelText = self.border:CreateFontString(nil, "OVERLAY")
|
||||
self.levelText:SetFont("Fonts\\ZYKai_T.TTF", 14, "OUTLINE, MONOCHROME")
|
||||
self.levelText:SetTextColor(255 / 255, 255 / 255, 255)
|
||||
self.levelText:SetShadowColor(0, 0, 0)
|
||||
@ -172,7 +188,7 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.levelText:SetPoint("LEFT", self.CreateTypeButton, "RIGHT", 10, 0)
|
||||
|
||||
-- 创建名字文本
|
||||
self.nameText = border:CreateFontString(nil, "OVERLAY")
|
||||
self.nameText = self.border:CreateFontString(nil, "OVERLAY")
|
||||
self.nameText:SetFont("Fonts\\ZYKai_T.TTF", 14, "OUTLINE, MONOCHROME")
|
||||
self.nameText:SetTextColor(255 / 255, 255 / 255, 255)
|
||||
self.nameText:SetShadowColor(0, 0, 0)
|
||||
@ -180,11 +196,11 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.nameText:SetPoint("LEFT", self.levelText, "RIGHT", 0, 0)
|
||||
|
||||
-- 头像框架
|
||||
self.portraitFrame = CreateFrame("Frame", nil, self.healthBarBg)
|
||||
self.portraitFrame:SetSize(50, 50)
|
||||
self.portraitFrame:SetPoint("RIGHT", self.healthBarBg, "LEFT", 3, 0)
|
||||
self.portraitFrame = CreateFrame("Frame", nil, self.border)
|
||||
self.portraitFrame:SetSize(80, 55)
|
||||
self.portraitFrame:SetPoint("LEFT", self.border, "LEFT", 10, 8)
|
||||
self.portraitFrame:SetBackdrop({
|
||||
bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\PortraitFrame"
|
||||
--bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\PortraitFrame"
|
||||
})
|
||||
self.portraitFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
|
||||
if self.portraitFrame.SetFrameLevel then
|
||||
@ -193,31 +209,31 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
|
||||
-- 头像遮罩
|
||||
self.portraitIconMask = CreateFrame("Button", nil, self.portraitFrame)
|
||||
self.portraitIconMask:SetSize(self.portraitFrame:GetWidth() - 10, self.portraitFrame:GetHeight() - 10)
|
||||
self.portraitIconMask:SetSize(self.portraitFrame:GetWidth() - 15, self.portraitFrame:GetHeight() - 15)
|
||||
self.portraitIconMask:SetPoint("CENTER", self.portraitFrame, "CENTER", 0, 0)
|
||||
self.portraitIconMask:SetNormalTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\Mask")
|
||||
self.portraitIconMask:SetNormalTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\B\\Mask")
|
||||
self.portraitIconMask:SetFrameLevel(self.portraitFrame:GetFrameLevel() - 2)
|
||||
self.portraitIconMask:GetNormalTexture():SetBlendMode("MOD")
|
||||
|
||||
-- -- 创建头像
|
||||
self.portraitIcon = self.portraitIconMask:CreateTexture(nil, "BACKGROUND")
|
||||
self.portraitIcon:SetSize(34, 34)
|
||||
self.portraitIcon:SetSize(60, 35)
|
||||
self.portraitIcon:SetPoint("CENTER", self.portraitIconMask, "CENTER")
|
||||
|
||||
-- 创建Boss图标
|
||||
self.bossIcon = self.portraitFrame:CreateTexture(nil, "ARTWORK")
|
||||
self.bossIcon:SetSize(25, 25)
|
||||
self.bossIcon:SetSize(22, 15)
|
||||
self.bossIcon:SetPoint("LEFT", self.healthBar, "RIGHT", 10, 0)
|
||||
self.bossIcon:SetTexture("Interface\\TARGETINGFRAME\\UI-TargetingFrame-Skull")
|
||||
self.bossIcon:Hide()
|
||||
|
||||
------------------------------------------ 下方总血条 ------------------------------------------
|
||||
-- 下方总血条底部纹理
|
||||
self.Z_border = CreateFrame("Frame", nil, border)
|
||||
self.Z_border:SetSize(HEALTHFRAME_W / 1.105, HEALTHFRAME_H / 3)
|
||||
self.Z_border:SetPoint("TOPLEFT", border, "BOTTOMLEFT", 1, 2)
|
||||
self.Z_border:SetFrameLevel(5)
|
||||
self.Z_border:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" })
|
||||
self.Z_border = CreateFrame("Frame", nil, self.border)
|
||||
self.Z_border:SetSize(HEALTHFRAME_W / 1.201, HEALTHFRAME_H / 6)
|
||||
self.Z_border:SetPoint("BOTTOMRIGHT", self.border, "BOTTOMRIGHT", -16, 6)
|
||||
self.Z_border:SetFrameLevel(self.border:GetFrameLevel() - 5)
|
||||
--self.Z_border:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background" })
|
||||
|
||||
-- 总血条状态条
|
||||
self.Z_border.healthBar = CreateFrame("StatusBar", nil, self.Z_border)
|
||||
@ -234,19 +250,19 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.Z_border.maskOverlay:SetPoint("TOPRIGHT", self.Z_border.healthBar, "TOPRIGHT", 0, 0)
|
||||
self.Z_border.maskOverlay:SetPoint("BOTTOMRIGHT", self.Z_border.healthBar, "BOTTOMRIGHT", 0, 0)
|
||||
self.Z_border.maskOverlay:SetWidth(0) -- 初始宽度为0(满血状态)
|
||||
print("总血量宽度= 0 --初始化的时候")
|
||||
|
||||
-- 创建遮罩纹理
|
||||
self.Z_border.maskTexture = self.Z_border.maskOverlay:CreateTexture(nil, "ARTWORK")
|
||||
self.Z_border.maskTexture:SetAllPoints(self.Z_border.maskOverlay)
|
||||
self.Z_border.maskTexture:SetTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\WHITE8x8")
|
||||
self.Z_border.maskTexture:SetTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\Black8X8")
|
||||
|
||||
-- 下方总血条覆盖边框
|
||||
self.Z_border.WFrame = CreateFrame("Frame", nil, border)
|
||||
self.Z_border.WFrame = CreateFrame("Frame", nil, self.border)
|
||||
self.Z_border.WFrame:SetAllPoints(self.Z_border)
|
||||
self.Z_border.WFrame:SetFrameLevel(self.Z_border.healthBar:GetFrameLevel() + 2)
|
||||
self.Z_border.WFrame:SetFrameLevel(self.Z_border.maskOverlay:GetFrameLevel() + 1)
|
||||
self.Z_border.WFrame:SetBackdrop({
|
||||
bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\Z_border_healthWFrame",
|
||||
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 5
|
||||
bgFile = "Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\Z_border_healthWFrame",
|
||||
--edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 5
|
||||
})
|
||||
|
||||
-- 总血条闪光效果层
|
||||
@ -254,21 +270,17 @@ function Creature_MultiLifeMultiplierAddon:InitializeProgressBar()
|
||||
self.Z_border.flashEffectBar:SetAllPoints(self.Z_border.healthBar)
|
||||
self.Z_border.flashEffectBar:SetStatusBarTexture("Interface\\AddOns\\SM_BloodVolumeExpansion\\img\\StatusBar")
|
||||
self.Z_border.flashEffectBar:SetMinMaxValues(0, 100)
|
||||
self.Z_border.flashEffectBar:SetFrameLevel(6)
|
||||
self.Z_border.flashEffectBar:SetFrameLevel(self.Z_border.WFrame:GetFrameLevel() - 1)
|
||||
self.Z_border.flashEffectBar:Hide()
|
||||
|
||||
------------------------------------------ 其他初始化 ------------------------------------------
|
||||
-- 初始化动画
|
||||
self.shakeAnimation = self:CreateShakeAnimation()
|
||||
self.flashAnimation = self:CreateFlashAnimation()
|
||||
|
||||
-- 初始化闪光效果动画
|
||||
self:CreateFlashEffectAnimation()
|
||||
|
||||
-- 初始化伤害跟踪动画
|
||||
self:CreateDamageTrackAnimation()
|
||||
|
||||
-- 初始化宗学跳闪光效果动画
|
||||
-- 初始化总血条闪光效果动画
|
||||
self:CreateZ_borderFlashEffectAnimation()
|
||||
end
|
||||
|
||||
@ -280,58 +292,25 @@ function Creature_MultiLifeMultiplierAddon:SafeHideDefaultTargetFrame()
|
||||
end
|
||||
end
|
||||
|
||||
-- 闪光动画
|
||||
function Creature_MultiLifeMultiplierAddon:CreateFlashAnimation()
|
||||
if not self.flashTexture then return nil end
|
||||
|
||||
local ag = self.flashTexture:CreateAnimationGroup()
|
||||
if not ag then return nil end
|
||||
|
||||
local fadeIn = ag:CreateAnimation("Alpha")
|
||||
if not fadeIn then return nil end
|
||||
fadeIn:SetDuration(FLASH_DURATION / 3)
|
||||
fadeIn:SetOrder(1)
|
||||
|
||||
local fadeOut = ag:CreateAnimation("Alpha")
|
||||
if not fadeOut then return nil end
|
||||
fadeOut:SetDuration(FLASH_DURATION * 2 / 3)
|
||||
fadeOut:SetStartDelay(FLASH_DURATION / 3)
|
||||
fadeOut:SetOrder(2)
|
||||
|
||||
ag:SetScript("OnFinished", function(self)
|
||||
if self:GetParent() then
|
||||
self:GetParent():SetAlpha(0)
|
||||
end
|
||||
end)
|
||||
|
||||
ag:SetScript("OnPlay", function(self)
|
||||
if self:GetParent() then
|
||||
self:GetParent():SetAlpha(0.8)
|
||||
end
|
||||
end)
|
||||
|
||||
return ag
|
||||
end
|
||||
|
||||
-- 震动动画
|
||||
function Creature_MultiLifeMultiplierAddon:CreateShakeAnimation()
|
||||
if not self.CustomHealthFrame or not SHAKE_ENABLED then
|
||||
if not self.border or not SHAKE_ENABLED then
|
||||
return nil
|
||||
end
|
||||
local ag = self.CustomHealthFrame:CreateAnimationGroup()
|
||||
local ag = self.border:CreateAnimationGroup()
|
||||
|
||||
if not ag then
|
||||
return nil
|
||||
end
|
||||
|
||||
local a1 = ag:CreateAnimation("Translation")
|
||||
|
||||
if not a1 then
|
||||
return nil
|
||||
end
|
||||
|
||||
a1:SetDuration(Translation_1)
|
||||
a1:SetOffset(SHAKE_INTENSITY, -SHAKE_INTENSITY)
|
||||
a1:SetOrder(1)
|
||||
|
||||
local a2 = ag:CreateAnimation("Translation")
|
||||
a2:SetDuration(Translation_2)
|
||||
@ -343,51 +322,13 @@ function Creature_MultiLifeMultiplierAddon:CreateShakeAnimation()
|
||||
end)
|
||||
|
||||
ag:SetScript("OnFinished", function()
|
||||
self.CustomHealthFrame:ClearAllPoints()
|
||||
self.CustomHealthFrame:SetPoint("BOTTOM", UIParent, "TOP", 0, -80)
|
||||
self.border:ClearAllPoints()
|
||||
self.border:SetPoint("CENTER", self.CustomHealthFrame, "CENTER", 0, 0)
|
||||
end)
|
||||
|
||||
return ag
|
||||
end
|
||||
|
||||
-- 闪光效果动画
|
||||
function Creature_MultiLifeMultiplierAddon:CreateFlashEffectAnimation()
|
||||
if not self.flashEffectBar then return nil end
|
||||
|
||||
self.flashEffectBar.animationData = {
|
||||
isAnimating = false,
|
||||
startTime = nil,
|
||||
duration = 0.3,
|
||||
startAlpha = 0.9,
|
||||
endAlpha = 0
|
||||
}
|
||||
|
||||
self.flashEffectBar:SetScript("OnUpdate", function(self, elapsed)
|
||||
local animData = self.animationData
|
||||
if not animData or not animData.isAnimating then return end
|
||||
|
||||
local currentTime = GetTime()
|
||||
local elapsed = currentTime - animData.startTime
|
||||
local progress = elapsed / animData.duration
|
||||
|
||||
if progress >= 1 then
|
||||
self:SetAlpha(0)
|
||||
self:Hide()
|
||||
animData.isAnimating = false
|
||||
else
|
||||
local alpha
|
||||
if progress < 0.2 then
|
||||
alpha = animData.startAlpha * (progress / 0.2)
|
||||
else
|
||||
alpha = animData.startAlpha * (1 - (progress - 0.2) / 0.8)
|
||||
end
|
||||
self:SetAlpha(alpha)
|
||||
end
|
||||
end)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- 总血条闪光效果动画
|
||||
function Creature_MultiLifeMultiplierAddon:CreateZ_borderFlashEffectAnimation()
|
||||
if not self.Z_border.flashEffectBar then return nil end
|
||||
@ -426,78 +367,10 @@ function Creature_MultiLifeMultiplierAddon:CreateZ_borderFlashEffectAnimation()
|
||||
return true
|
||||
end
|
||||
|
||||
-- 播放层破碎特效
|
||||
function Creature_MultiLifeMultiplierAddon:PlayLayerBreakEffect(oldHealth, newHealth, oldLayerColor, newLayerColor)
|
||||
if not self.damageTrackBar then return end
|
||||
|
||||
local currentTime = GetTime()
|
||||
if currentTime - self.lastDamageTrackTime < DAMAGE_TRACK_COOLDOWN then
|
||||
return
|
||||
end
|
||||
self.lastDamageTrackTime = currentTime
|
||||
|
||||
-- 计算旧层血量
|
||||
local oldLayerHealth = oldHealth % MAX_HEALTH_PER_LAYER
|
||||
if oldLayerHealth == 0 and oldHealth > 0 then
|
||||
oldLayerHealth = MAX_HEALTH_PER_LAYER
|
||||
end
|
||||
|
||||
-- 创建破碎效果:血条快速闪烁并从满血降到0
|
||||
local fadeColor = {
|
||||
r = oldLayerColor.r * 0.9,
|
||||
g = oldLayerColor.g * 0.9,
|
||||
b = oldLayerColor.b * 0.9
|
||||
}
|
||||
self.damageTrackBar:SetStatusBarColor(fadeColor.r, fadeColor.g, fadeColor.b)
|
||||
|
||||
-- 播放强烈的闪光效果
|
||||
self:PlayIntenseFlashEffect(oldLayerHealth, oldLayerColor)
|
||||
|
||||
-- 设置破碎动画参数
|
||||
local animData = self.damageTrackBar.animationData
|
||||
animData.isAnimating = true
|
||||
animData.startTime = GetTime()
|
||||
animData.startValue = MAX_HEALTH_PER_LAYER -- 从满血开始
|
||||
animData.endValue = 0 -- 降到0表示层被破坏
|
||||
animData.currentValue = MAX_HEALTH_PER_LAYER
|
||||
animData.isLayerBreak = true -- 标记为层破碎效果
|
||||
animData.duration = 0.3 -- 稍微长一点的动画,让效果更明显
|
||||
|
||||
-- 重置其他参数
|
||||
animData.isFirstPhase = false
|
||||
animData.secondPhaseStartValue = 0
|
||||
animData.secondPhaseEndValue = 0
|
||||
animData.newLayerColor = nil
|
||||
|
||||
self.damageTrackBar:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
self.damageTrackBar:Show()
|
||||
self.damageTrackBar:SetAlpha(1.0) -- 更明显的透明度
|
||||
|
||||
-- 添加调试输出
|
||||
-- print("[调试] 播放层破碎效果,从层", math.floor((oldHealth - 1) / MAX_HEALTH_PER_LAYER) + 1, "到层",
|
||||
-- math.floor((newHealth - 1) / MAX_HEALTH_PER_LAYER) + 1)
|
||||
end
|
||||
|
||||
-- 播放强烈闪光效果(用于层破碎)
|
||||
function Creature_MultiLifeMultiplierAddon:PlayIntenseFlashEffect(healthValue, layerColor)
|
||||
if not self.flashEffectBar then return end
|
||||
|
||||
-- 使用层颜色而不是白色
|
||||
self.flashEffectBar:SetStatusBarColor(layerColor.r, layerColor.g, layerColor.b)
|
||||
self.flashEffectBar:SetValue(healthValue)
|
||||
self.flashEffectBar:Show()
|
||||
|
||||
local animData = self.flashEffectBar.animationData
|
||||
animData.isAnimating = true
|
||||
animData.startTime = GetTime()
|
||||
animData.duration = 0.3 -- 更长的闪光时间
|
||||
animData.startAlpha = 1.0 -- 更强的闪光
|
||||
end
|
||||
|
||||
-- 修改伤害跟踪动画以支持层破碎效果
|
||||
function Creature_MultiLifeMultiplierAddon:CreateDamageTrackAnimation()
|
||||
if not self.damageTrackBar then return nil end
|
||||
|
||||
-- 动画数据结构
|
||||
self.damageTrackBar.animationData = {
|
||||
isAnimating = false,
|
||||
startTime = nil,
|
||||
@ -520,24 +393,52 @@ function Creature_MultiLifeMultiplierAddon:CreateDamageTrackAnimation()
|
||||
local elapsed = currentTime - animData.startTime
|
||||
local progress = elapsed / animData.duration
|
||||
|
||||
-- 高度计算
|
||||
local currentValue = animData.startValue - (animData.startValue - animData.endValue) * progress
|
||||
local healthPercent = currentValue / MAX_HEALTH_PER_LAYER
|
||||
local lostHealthPercent = 1 - healthPercent
|
||||
|
||||
-- 宽度计算
|
||||
local maxWidth = self:GetWidth()
|
||||
local maskWidth = lostHealthPercent * maxWidth
|
||||
self.maskOverlay:SetWidth(maskWidth)
|
||||
|
||||
|
||||
-- 高度计算
|
||||
local baseHeight = 50
|
||||
local maxHeight = 80
|
||||
local currentHeight
|
||||
|
||||
if healthPercent >= 1.0 then
|
||||
currentHeight = baseHeight
|
||||
elseif healthPercent <= 0.3 then
|
||||
currentHeight = maxHeight
|
||||
else
|
||||
local factor = (1.0 - healthPercent) / 0.7
|
||||
currentHeight = baseHeight + (maxHeight - baseHeight) * factor
|
||||
end
|
||||
|
||||
self.maskOverlay:SetHeight(currentHeight)
|
||||
|
||||
-- 血条始终显示满血状态
|
||||
self:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
|
||||
if animData.isLayerBreak then
|
||||
-- 层破碎特效:快速下降 + 更明显的闪烁
|
||||
-- 层破碎特效:使用遮罩实现快速下降 + 闪烁
|
||||
if progress >= 1 then
|
||||
self:SetValue(0)
|
||||
-- 动画结束:完全遮罩(血条消失)
|
||||
self.maskOverlay:SetWidth(self:GetWidth())
|
||||
self:SetAlpha(0)
|
||||
self:Hide()
|
||||
animData.isAnimating = false
|
||||
animData.isLayerBreak = false
|
||||
else
|
||||
local currentValue = animData.startValue * (1 - progress)
|
||||
self:SetValue(currentValue)
|
||||
|
||||
-- 更明显的闪烁效果
|
||||
local flashCycle = math.sin(progress * 30) * 0.4 + 0.6 -- 增加闪烁频率和幅度
|
||||
local flashCycle = math.sin(progress * 30) * 0.4 + 0.6
|
||||
self:SetAlpha(flashCycle)
|
||||
end
|
||||
else
|
||||
-- 原有的普通动画逻辑
|
||||
-- 普通伤害动画:使用遮罩实现平滑过渡
|
||||
if progress >= 1 then
|
||||
if animData.isFirstPhase then
|
||||
-- 跨层两阶段动画逻辑
|
||||
@ -555,17 +456,39 @@ function Creature_MultiLifeMultiplierAddon:CreateDamageTrackAnimation()
|
||||
self:SetStatusBarColor(fadeColor.r, fadeColor.g, fadeColor.b)
|
||||
end
|
||||
|
||||
self:SetValue(animData.startValue)
|
||||
-- 设置第二阶段的初始遮罩状态
|
||||
local healthPercent = animData.startValue / MAX_HEALTH_PER_LAYER
|
||||
local lostHealthPercent = 1 - healthPercent
|
||||
local maxWidth = self:GetWidth()
|
||||
local maskWidth = lostHealthPercent * maxWidth
|
||||
self.maskOverlay:SetWidth(maskWidth)
|
||||
self:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
return
|
||||
else
|
||||
self:SetValue(animData.endValue)
|
||||
-- 动画完全结束
|
||||
local healthPercent = animData.endValue / MAX_HEALTH_PER_LAYER
|
||||
local lostHealthPercent = 1 - healthPercent
|
||||
local maxWidth = self:GetWidth()
|
||||
local maskWidth = lostHealthPercent * maxWidth
|
||||
self.maskOverlay:SetWidth(maskWidth)
|
||||
self:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
self:SetAlpha(0)
|
||||
self:Hide()
|
||||
animData.isAnimating = false
|
||||
end
|
||||
else
|
||||
-- 动画进行中:使用遮罩实现平滑过渡
|
||||
local currentValue = animData.startValue - (animData.startValue - animData.endValue) * progress
|
||||
self:SetValue(currentValue)
|
||||
local healthPercent = currentValue / MAX_HEALTH_PER_LAYER
|
||||
local lostHealthPercent = 1 - healthPercent
|
||||
local maxWidth = self:GetWidth()
|
||||
local maskWidth = lostHealthPercent * maxWidth
|
||||
self.maskOverlay:SetWidth(maskWidth)
|
||||
|
||||
-- 血条始终显示满血状态
|
||||
self:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
|
||||
-- 透明度渐变
|
||||
local alpha = 0.8 * (1 - progress * 0.3)
|
||||
self:SetAlpha(alpha)
|
||||
end
|
||||
@ -644,19 +567,6 @@ function Creature_MultiLifeMultiplierAddon:GetColorForLayer(layer, totalLayers)
|
||||
return LAYER_COLOR_TABLE[colorIndex]
|
||||
end
|
||||
|
||||
-- 播放闪光效果
|
||||
function Creature_MultiLifeMultiplierAddon:PlayFlashEffect(healthValue)
|
||||
if not self.flashEffectBar then return end
|
||||
|
||||
self.flashEffectBar:SetStatusBarColor(1, 1, 1)
|
||||
self.flashEffectBar:SetValue(healthValue)
|
||||
self.flashEffectBar:Show()
|
||||
|
||||
local animData = self.flashEffectBar.animationData
|
||||
animData.isAnimating = true
|
||||
animData.startTime = GetTime()
|
||||
end
|
||||
|
||||
-- 播放总血条闪光效果
|
||||
function Creature_MultiLifeMultiplierAddon:PlayTotalHealthBarFlash(healthValue)
|
||||
if not self.Z_border.flashEffectBar then return end
|
||||
@ -732,44 +642,40 @@ function Creature_MultiLifeMultiplierAddon:PlayDamageTrackEffect(oldHealth, newH
|
||||
end
|
||||
|
||||
-- 更新血条
|
||||
function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data,isDead)
|
||||
function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data, isDead)
|
||||
if not data then return end
|
||||
-- 保存旧的血量值用于伤害跟踪效果
|
||||
local oldHealth = data.lastHealth or data.currentHealth
|
||||
local totalLayers = math.ceil(data.maxHealth / MAX_HEALTH_PER_LAYER) -- 总层数
|
||||
|
||||
-- 计算当前层和当前层血量
|
||||
local totalLayers = math.ceil(data.healthPerBar / MAX_HEALTH_PER_LAYER)
|
||||
local currentLayer = math.floor((data.healthPerBar - data.currentHealth) / MAX_HEALTH_PER_LAYER) + 1
|
||||
local currentLayer = math.floor((data.maxHealth - data.currentHealth) / MAX_HEALTH_PER_LAYER) + 1 -- 计算当前层
|
||||
local currentLayerHealth = data.currentHealth % MAX_HEALTH_PER_LAYER
|
||||
if currentLayerHealth == 0 and data.currentHealth > 0 then
|
||||
currentLayerHealth = MAX_HEALTH_PER_LAYER
|
||||
end
|
||||
|
||||
-- 计算剩余层数(倒数显示)
|
||||
local remainingLayers = totalLayers - currentLayer
|
||||
|
||||
-- 更新背景血条(修复版本)
|
||||
-- 获取当前层和下一层颜色
|
||||
local currentLayerColor = self:GetColorForLayer(currentLayer, totalLayers)
|
||||
local nextLayerColor = nil
|
||||
|
||||
if currentLayer < totalLayers then
|
||||
local nextLayerColor = self:GetColorForLayer(currentLayer + 1, totalLayers)
|
||||
nextLayerColor = self:GetColorForLayer(currentLayer + 1, totalLayers)
|
||||
-- 背景血条使用下一层的颜色,确保与遮罩一致
|
||||
self.healthBarBg:SetStatusBarColor(nextLayerColor.r, nextLayerColor.g, nextLayerColor.b)
|
||||
self.healthBarBg:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
self.healthBarBg:Show()
|
||||
else
|
||||
-- 即使是最后一层,也要确保有背景显示
|
||||
local currentLayerColor = self:GetColorForLayer(currentLayer, totalLayers)
|
||||
self.healthBarBg:SetStatusBarColor(currentLayerColor.r * 0.3, currentLayerColor.g * 0.3,
|
||||
currentLayerColor.b * 0.3)
|
||||
self.healthBarBg:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
self.healthBarBg:Show() -- 保持显示,不要隐藏
|
||||
end
|
||||
|
||||
-- 更新主血条
|
||||
self.healthBar:SetValue(currentLayerHealth)
|
||||
local currentLayerColor = self:GetColorForLayer(currentLayer, totalLayers)
|
||||
self.healthBar:SetStatusBarColor(currentLayerColor.r, currentLayerColor.g, currentLayerColor.b)
|
||||
self.healthBarBg:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
self.healthBarBg:Show()
|
||||
|
||||
-- 血量百分比
|
||||
local healthPercent = currentLayerHealth / MAX_HEALTH_PER_LAYER
|
||||
self:UpdateDualMask(healthPercent, currentLayer, totalLayers)
|
||||
self.healthBar:SetValue(MAX_HEALTH_PER_LAYER)
|
||||
|
||||
-- 前景血条始终使用当前层的完整颜色
|
||||
self.healthBar:SetStatusBarColor(currentLayerColor.r, currentLayerColor.g, currentLayerColor.b)
|
||||
-- 检查是否跨层
|
||||
local oldLayer = math.floor((data.healthPerBar - oldHealth) / MAX_HEALTH_PER_LAYER) + 1
|
||||
local oldLayer = math.floor((data.maxHealth - oldHealth) / MAX_HEALTH_PER_LAYER) + 1
|
||||
if oldLayer ~= currentLayer then
|
||||
-- 播放声音效果
|
||||
PlaySoundFile("Sound\\Interface\\ui_blizzardstore_open.ogg", "Master")
|
||||
@ -779,7 +685,10 @@ function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data,isDead)
|
||||
if oldHealth > data.currentHealth then
|
||||
local oldLayerColor = self:GetColorForLayer(oldLayer, totalLayers)
|
||||
local newLayerColor = self:GetColorForLayer(currentLayer, totalLayers)
|
||||
self:PlayLayerBreakEffect(oldHealth, data.currentHealth, oldLayerColor, newLayerColor)
|
||||
|
||||
-- print("[调试] 从层", math.floor((oldHealth) / MAX_HEALTH_PER_LAYER), "层颜色:", oldLayerColor.r,
|
||||
-- oldLayerColor.g, oldLayerColor.b, "到层", math.floor((data.currentHealth) / MAX_HEALTH_PER_LAYER),
|
||||
-- "层颜色:", newLayerColor.r, newLayerColor.g, newLayerColor.b)
|
||||
end
|
||||
|
||||
local currentTime = GetTime()
|
||||
@ -805,7 +714,7 @@ function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data,isDead)
|
||||
|
||||
-- 更新血量文本
|
||||
if not isDead then
|
||||
self.healthText:SetText(string.format("%.0f / %.0f", data.currentHealth, data.healthPerBar))
|
||||
self.healthText:SetText(string.format("%.0f / %.0f", data.currentHealth, data.maxHealth))
|
||||
self.healthText:SetTextColor(1, 1, 1) -- 恢复白色
|
||||
end
|
||||
|
||||
@ -816,7 +725,7 @@ function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data,isDead)
|
||||
end
|
||||
-- 更新血量百分比文本和总血条遮罩
|
||||
local currentHealth = tonumber(data.currentHealth) or 0
|
||||
local healthPerBar = tonumber(data.healthPerBar) or 1
|
||||
local healthPerBar = tonumber(data.maxHealth) or 1
|
||||
|
||||
-- 添加数据有效性检查
|
||||
if currentHealth < 0 or healthPerBar <= 0 or currentHealth > healthPerBar then
|
||||
@ -851,8 +760,7 @@ function Creature_MultiLifeMultiplierAddon:UpdateHealthBar(data,isDead)
|
||||
local lostHealthPercent = 100 - healthPer
|
||||
local maxWidth = self.Z_border.healthBar:GetWidth()
|
||||
local maskWidth = (lostHealthPercent / 100) * maxWidth
|
||||
print("总血量宽度= --更新血条的时候maskWidth= "..maskWidth)
|
||||
|
||||
|
||||
self.Z_border.maskOverlay:SetWidth(maskWidth)
|
||||
|
||||
end
|
||||
@ -860,19 +768,13 @@ end
|
||||
-- 播放伤害效果
|
||||
function Creature_MultiLifeMultiplierAddon:PlayDamageEffects()
|
||||
if not SHAKE_ENABLED then return end
|
||||
|
||||
if self.shakeAnimation and self.shakeAnimation:IsPlaying() then
|
||||
self.shakeAnimation:Stop()
|
||||
end
|
||||
if self.shakeAnimation then
|
||||
self.shakeAnimation:Play()
|
||||
end
|
||||
|
||||
if self.flashAnimation and self.flashAnimation:IsPlaying() then
|
||||
self.flashAnimation:Stop()
|
||||
end
|
||||
if self.flashAnimation then
|
||||
self.flashAnimation:Play()
|
||||
end
|
||||
end
|
||||
|
||||
-- 处理插件事件 分离目标切换和血量更新逻辑
|
||||
@ -880,12 +782,13 @@ function Creature_MultiLifeMultiplierAddon:SM_MultiLifeMultiplierEvent(event, ..
|
||||
if event == 'CHAT_MSG_ADDON' then
|
||||
local Packet, Msg, Type, Sender = ...
|
||||
if Packet == 'SM_S_CUSTOM_CREATURE_HEALTH_DATA' then
|
||||
local entry, healthPerBar = strsplit(",", Msg)
|
||||
-- 生物ID 最大血量
|
||||
local entry, maxHealth = strsplit(",", Msg)
|
||||
entry = tonumber(entry)
|
||||
healthPerBar = tonumber(healthPerBar)
|
||||
if healthPerBar and healthPerBar > 0 then
|
||||
maxHealth = tonumber(maxHealth)
|
||||
if maxHealth and maxHealth > 0 then
|
||||
self.CreatureTemplates[entry] = {
|
||||
healthPerBar = healthPerBar
|
||||
maxHealth = maxHealth
|
||||
}
|
||||
end
|
||||
elseif Packet == 'SM_S_UPDATE_CREATURE_HEALTH' then
|
||||
@ -902,9 +805,9 @@ function Creature_MultiLifeMultiplierAddon:SM_MultiLifeMultiplierEvent(event, ..
|
||||
if not self.SavedData[targetGUID] then
|
||||
self.SavedData[targetGUID] = {
|
||||
entry = entry,
|
||||
healthPerBar = self.CreatureTemplates[entry].healthPerBar,
|
||||
maxHealth = self.CreatureTemplates[entry].maxHealth,
|
||||
currentHealth = currentHealth,
|
||||
lastHealth = currentHealth
|
||||
lastHealth = maxHealth
|
||||
}
|
||||
end
|
||||
-- 【修改】只更新血量数据,不重新设置整个UI
|
||||
@ -1010,12 +913,6 @@ function Creature_MultiLifeMultiplierAddon:ForceCompleteUIReset()
|
||||
self.damageTrackBar:SetAlpha(0)
|
||||
end
|
||||
|
||||
if self.flashEffectBar and self.flashEffectBar.animationData then
|
||||
self.flashEffectBar.animationData.isAnimating = false
|
||||
self.flashEffectBar:Hide()
|
||||
self.flashEffectBar:SetAlpha(0)
|
||||
end
|
||||
|
||||
if self.Z_border and self.Z_border.flashEffectBar and self.Z_border.flashEffectBar.animationData then
|
||||
self.Z_border.flashEffectBar.animationData.isAnimating = false
|
||||
self.Z_border.flashEffectBar:Hide()
|
||||
@ -1070,7 +967,6 @@ function Creature_MultiLifeMultiplierAddon:ForceCompleteUIReset()
|
||||
-- 重置总血条遮罩
|
||||
if self.Z_border and self.Z_border.maskOverlay then
|
||||
self.Z_border.maskOverlay:SetWidth(0) -- 【修复】改为0,不是100
|
||||
print("总血量宽度= 0 --完全重置所有UI状态的时候")
|
||||
end
|
||||
|
||||
-- 强制刷新TargetFrame
|
||||
@ -1151,7 +1047,6 @@ function Creature_MultiLifeMultiplierAddon:UpdateHealthData(targetGUID, currentH
|
||||
end
|
||||
|
||||
-- 只更新血条,不重新设置整个UI
|
||||
print("只更新血条,不重新设置整个UI")
|
||||
self:UpdateHealthBar(data)
|
||||
|
||||
-- 【新增】定期更新buff和连击点(控制频率避免性能问题)
|
||||
@ -1176,9 +1071,9 @@ function Creature_MultiLifeMultiplierAddon:InitializeTargetData(targetGUID, targ
|
||||
local isDead = UnitIsDeadOrGhost("target")
|
||||
self.SavedData[targetGUID] = {
|
||||
entry = targetEntry,
|
||||
healthPerBar = self.CreatureTemplates[targetEntry].healthPerBar,
|
||||
currentHealth = isDead and 0 or self.CreatureTemplates[targetEntry].healthPerBar,
|
||||
lastHealth = isDead and 0 or self.CreatureTemplates[targetEntry].healthPerBar
|
||||
maxHealth = self.CreatureTemplates[targetEntry].maxHealth,
|
||||
currentHealth = isDead and 0 or self.CreatureTemplates[targetEntry].maxHealth,
|
||||
lastHealth = isDead and 0 or self.CreatureTemplates[targetEntry].maxHealth
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -1238,11 +1133,11 @@ function Creature_MultiLifeMultiplierAddon:UpdateStaticTargetInfo()
|
||||
data.currentHealth = 0
|
||||
elseif data.currentHealth == 0 then
|
||||
-- 如果之前是死亡状态,现在复活了,恢复满血
|
||||
data.currentHealth = data.healthPerBar
|
||||
data.currentHealth = data.maxHealth
|
||||
end
|
||||
-- 【新增】添加标记,表示这是目标切换时的初始化调用
|
||||
data.isInitialUpdate = true
|
||||
self:UpdateHealthBar(data,isDead)
|
||||
self:UpdateHealthBar(data, isDead)
|
||||
data.isInitialUpdate = false
|
||||
end
|
||||
|
||||
@ -1269,7 +1164,7 @@ end
|
||||
-- 新增调试函数
|
||||
function Creature_MultiLifeMultiplierAddon:DebugTargetInfo(isCustom, hasTarget)
|
||||
local targetType = hasTarget and (isCustom and "自定义生物" or "普通生物") or "无目标"
|
||||
print(string.format("目标切换: %s | 状态: %s", targetType, self.usingCustomFrame and "使用自定义框架" or "使用默认框架"))
|
||||
--print(string.format("目标切换: %s | 状态: %s", targetType, self.usingCustomFrame and "使用自定义框架" or "使用默认框架"))
|
||||
end
|
||||
|
||||
-- 【新增】设置目标存活状态的所有UI效果
|
||||
@ -1305,14 +1200,13 @@ function Creature_MultiLifeMultiplierAddon:RestoreNormalTargetState()
|
||||
|
||||
self.Z_border.maskOverlay:SetAlpha(0)
|
||||
self.Z_border.maskOverlay:SetWidth(0)
|
||||
-- print("总血量宽度= 0 --目标存活状态的时候")
|
||||
|
||||
if self.healthText then
|
||||
self.healthText:SetText("")
|
||||
self.healthText:SetFont("Fonts\\ZYKai_T.TTF", 12, "OUTLINE, MONOCHROME")
|
||||
self.healthText:SetTextColor(1, 1, 1)
|
||||
self.healthText:ClearAllPoints() --重置位置之前需要清除之前的位置设置
|
||||
self.healthText:SetPoint("BOTTOMRIGHT", self.healthBarBg, "TOPRIGHT", 0, 5) -- 血量文本放到右上角
|
||||
self.healthText:SetPoint("BOTTOMRIGHT", self.healthBarBg, "TOPRIGHT", -30, -25) -- 血量文本放到右上角
|
||||
end
|
||||
|
||||
-- 右下方百分比攻击存活状态
|
||||
@ -1365,8 +1259,7 @@ function Creature_MultiLifeMultiplierAddon:SetDeadTargetState()
|
||||
self.healthText:SetText("死亡")
|
||||
self.healthText:SetFont("Fonts\\ZYKai_T.TTF", 16, "OUTLINE, MONOCHROME")
|
||||
self.healthText:ClearAllPoints() --重置位置之前需要清除之前的位置设置
|
||||
self.healthText:SetPoint("CENTER", self.CustomHealthFrame, "CENTER", 0, 0) -- 死亡文本在中间
|
||||
print("血量文本-目标死亡状态")
|
||||
self.healthText:SetPoint("CENTER", self.CustomHealthFrame, "CENTER", 0, 15) -- 死亡文本在中间
|
||||
end
|
||||
|
||||
-- 生物名称文本设置为灰色
|
||||
@ -1409,10 +1302,6 @@ function Creature_MultiLifeMultiplierAddon:SetDeadTargetState()
|
||||
self.damageTrackBar.animationData.isAnimating = false
|
||||
self.damageTrackBar:Hide()
|
||||
end
|
||||
if self.flashEffectBar and self.flashEffectBar.animationData then
|
||||
self.flashEffectBar.animationData.isAnimating = false
|
||||
self.flashEffectBar:Hide()
|
||||
end
|
||||
|
||||
-- 设置攻击图标为死亡状态
|
||||
if self.HealthPerAttImg then
|
||||
@ -1422,7 +1311,85 @@ function Creature_MultiLifeMultiplierAddon:SetDeadTargetState()
|
||||
-- 总血条也设置为死亡状态
|
||||
if self.Z_border and self.Z_border.maskOverlay then
|
||||
self.Z_border.maskOverlay:SetWidth(self.Z_border.healthBar:GetWidth()) -- 完全遮罩
|
||||
print("死亡状态下的总血量宽度= --死亡状态的时候"..self.Z_border.healthBar:GetWidth())
|
||||
end
|
||||
end
|
||||
|
||||
-- 新增 主血条双遮罩更新函数
|
||||
function Creature_MultiLifeMultiplierAddon:UpdateDualMask(healthPercent, currentLayer, totalLayers)
|
||||
local totalWidth = self.healthBar:GetWidth()
|
||||
local availableWidth = totalWidth - MASK_CONFIG.LEFT_MARGIN - MASK_CONFIG.RIGHT_MARGIN
|
||||
local currentPosition = healthPercent * 100
|
||||
|
||||
-- 修正:获取下一层颜色时保持一致的亮度
|
||||
local nextLayerColor = nil
|
||||
if currentLayer < totalLayers then
|
||||
-- 使用下一层的颜色作为遮罩,但透明度稍低
|
||||
local nextColor = self:GetColorForLayer(currentLayer + 1, totalLayers)
|
||||
nextLayerColor = {
|
||||
r = nextColor.r * 1.0, -- 改为1.0
|
||||
g = nextColor.g * 1.0, -- 改为1.0
|
||||
b = nextColor.b * 1.0 -- 改为1.0
|
||||
}
|
||||
else
|
||||
-- 最后一层时使用黑色
|
||||
nextLayerColor = {
|
||||
r = 0,
|
||||
g = 0,
|
||||
b = 0
|
||||
}
|
||||
end
|
||||
|
||||
if currentPosition > MASK_CONFIG.RIGHT_SECTION_START then
|
||||
self.healthBar.leftMask:Hide()
|
||||
self.healthBar.rightMask:Show()
|
||||
|
||||
local rightSectionLoss = (100 - currentPosition) / (100 - MASK_CONFIG.RIGHT_SECTION_START)
|
||||
local rightSectionWidth = availableWidth * (100 - MASK_CONFIG.RIGHT_SECTION_START) / 100
|
||||
local rightMaskWidth = rightSectionLoss * rightSectionWidth
|
||||
|
||||
self.healthBar.rightMask:ClearAllPoints()
|
||||
self.healthBar.rightMask:SetPoint("BOTTOMRIGHT", self.healthBar, "BOTTOMRIGHT", -MASK_CONFIG.RIGHT_MARGIN, 20)
|
||||
self.healthBar.rightMask:SetWidth(rightMaskWidth)
|
||||
self.healthBar.rightMask:SetHeight(MASK_CONFIG.RIGHT_HEIGHT)
|
||||
|
||||
-- 设置遮罩为下一层的原始颜色
|
||||
self.healthBar.rightMask:SetBackdropColor(nextLayerColor.r, nextLayerColor.g, nextLayerColor.b, 1)
|
||||
self.healthBar.leftMask:SetBackdropColor(nextLayerColor.r, nextLayerColor.g, nextLayerColor.b, 1)
|
||||
|
||||
else
|
||||
self.healthBar.rightMask:Show()
|
||||
self.healthBar.leftMask:Show()
|
||||
|
||||
local rightSectionWidth = availableWidth * (100 - MASK_CONFIG.RIGHT_SECTION_START) / 100
|
||||
self.healthBar.rightMask:ClearAllPoints()
|
||||
self.healthBar.rightMask:SetPoint("BOTTOMRIGHT", self.healthBar, "BOTTOMRIGHT", -MASK_CONFIG.RIGHT_MARGIN, 20)
|
||||
self.healthBar.rightMask:SetWidth(rightSectionWidth)
|
||||
self.healthBar.rightMask:SetHeight(MASK_CONFIG.RIGHT_HEIGHT)
|
||||
|
||||
-- 设置右侧遮罩为下一层颜色
|
||||
self.healthBar.rightMask:SetBackdropColor(nextLayerColor.r, nextLayerColor.g, nextLayerColor.b, 1)
|
||||
|
||||
local leftSectionLoss = (MASK_CONFIG.RIGHT_SECTION_START - currentPosition) / MASK_CONFIG.RIGHT_SECTION_START
|
||||
local leftSectionWidth = availableWidth * MASK_CONFIG.RIGHT_SECTION_START / 100
|
||||
local leftMaskWidth = leftSectionLoss * leftSectionWidth
|
||||
|
||||
self.healthBar.leftMask:ClearAllPoints()
|
||||
local rightMaskLeftEdge = -MASK_CONFIG.RIGHT_MARGIN - rightSectionWidth
|
||||
self.healthBar.leftMask:SetPoint("BOTTOMRIGHT", self.healthBar, "BOTTOMRIGHT", rightMaskLeftEdge, 20)
|
||||
self.healthBar.leftMask:SetWidth(leftMaskWidth)
|
||||
|
||||
-- 设置左侧遮罩为下一层颜色
|
||||
self.healthBar.leftMask:SetBackdropColor(nextLayerColor.r, nextLayerColor.g, nextLayerColor.b, 1)
|
||||
|
||||
if currentPosition >= MASK_CONFIG.TRANSITION_START then
|
||||
local transitionProgress = (currentPosition - MASK_CONFIG.TRANSITION_START) /
|
||||
(MASK_CONFIG.RIGHT_SECTION_START - MASK_CONFIG.TRANSITION_START)
|
||||
local currentHeight = MASK_CONFIG.LEFT_HEIGHT +
|
||||
(MASK_CONFIG.RIGHT_HEIGHT - MASK_CONFIG.LEFT_HEIGHT) * transitionProgress
|
||||
self.healthBar.leftMask:SetHeight(currentHeight)
|
||||
else
|
||||
self.healthBar.leftMask:SetHeight(MASK_CONFIG.LEFT_HEIGHT)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
--[[
|
||||
插件名称: 尚美&魔兽插件
|
||||
插件用途: 本插件用于匹配数据库[__sm_生物血量扩展]显示自定义血量生物buff显示
|
||||
插件作者: 尚美
|
||||
联系方式:QQ:2370337237
|
||||
制作日期: 2025年9月5日
|
||||
插件版本: 0.0.1
|
||||
版权信息: 本插件未经授权不得转用、修改或用于商业用途。
|
||||
插件文件: 子文件[buff] [debuff]
|
||||
--]]
|
||||
|
||||
-- 重要buff
|
||||
local importantBuffs =
|
||||
{
|
||||
|
||||
@ -1,36 +1,46 @@
|
||||
-- 职业标记系统
|
||||
--[[
|
||||
插件名称: 尚美&魔兽插件
|
||||
插件用途: 本插件用于匹配数据库[__sm_生物血量扩展]显示自定义血量生物的职业标记,目前只有
|
||||
插件作者: 尚美
|
||||
联系方式:QQ:2370337237
|
||||
制作日期: 2025年9月5日
|
||||
插件版本: 0.0.1
|
||||
版权信息: 本插件未经授权不得转用、修改或用于商业用途
|
||||
插件文件: 子文件[职业标记]
|
||||
--]]
|
||||
|
||||
-- 初始化职业标记系统
|
||||
function Creature_MultiLifeMultiplierAddon:ClassMarkersInitialize()
|
||||
-- 获取玩家职业(使用英文常量)
|
||||
local _, englishClass = UnitClass("player")
|
||||
-- 根据职业创建相应的标记框架
|
||||
if englishClass == "ROGUE" then --潜行者
|
||||
if englishClass == "ROGUE" then --潜行者
|
||||
self:CreateComboPointSystem()
|
||||
elseif englishClass == "WARLOCK" then
|
||||
self:CreateWarlockMarkers() --术士
|
||||
self:CreateWarlockMarkers() --术士
|
||||
elseif englishClass == "HUNTER" then
|
||||
self:CreateHunterMarkers() --猎人
|
||||
self:CreateHunterMarkers() --猎人
|
||||
elseif englishClass == "MAGE" then
|
||||
self:CreateMageMarkers() --法师
|
||||
self:CreateMageMarkers() --法师
|
||||
elseif englishClass == "DRUID" then
|
||||
--self:CreateDruidMarkers() --德鲁伊
|
||||
--self:CreateDruidMarkers() --德鲁伊
|
||||
self:CreateComboPointSystem()
|
||||
elseif englishClass == "PRIEST" then
|
||||
self:CreatePriestMarkers() --牧师
|
||||
self:CreatePriestMarkers() --牧师
|
||||
elseif englishClass == "PALADIN" then
|
||||
self:CreatePaladinMarkers() --圣骑士
|
||||
self:CreatePaladinMarkers() --圣骑士
|
||||
elseif englishClass == "DEATHKNIGHT" then
|
||||
self:CreateDeathKnightMarkers() --死亡骑士
|
||||
elseif englishClass == "SHAMAN" then
|
||||
self:CreateShamanMarkers() --萨满
|
||||
self:CreateShamanMarkers() --萨满
|
||||
elseif englishClass == "WARRIOR" then
|
||||
self:CreateWarriorMarkers() --战士
|
||||
self:CreateWarriorMarkers() --战士
|
||||
else
|
||||
print("未知职业或不支持的职业:", englishClass)
|
||||
end
|
||||
end
|
||||
|
||||
-- 潜行者连击点-自定义外形
|
||||
-- 连击点-自定义设定-[盗贼和的德鲁伊使用]
|
||||
function Creature_MultiLifeMultiplierAddon:CreateComboPointSystem()
|
||||
if not self.portraitFrame then
|
||||
print("错误:CustomHealthFrame不存在,无法创建连击点")
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
--[[
|
||||
插件名称: 尚美&魔兽插件
|
||||
插件用途: 本插件用于匹配数据库[__sm_生物血量扩展]显示自定义血量扩展生物的类型
|
||||
插件作者: 尚美
|
||||
联系方式:QQ:2370337237
|
||||
制作日期: 2025年9月5日
|
||||
插件版本: 0.0.1
|
||||
版权信息: 本插件未经授权不得转用、修改或用于商业用途。
|
||||
插件文件: 子文件[生物类型] [生物分类]
|
||||
--]]
|
||||
|
||||
local SM_Blood_Creature_TYPE_ICONS =
|
||||
{
|
||||
["野兽"] = "Interface\\Icons\\ability_druid_catform",
|
||||
|
||||
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBack.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBack.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBack.tga
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBack.tga
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask2.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask2.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask3.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/FrameBackMask3.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/HealthPerImg.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/HealthPerImg.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/MASK.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/MASK.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/PortraitFrame.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/PortraitFrame.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/StatusBar.blp
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/StatusBar.blp
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/aaaaaaaa.tga
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/B/aaaaaaaa.tga
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/Black8X8.BLP
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/Black8X8.BLP
Normal file
Binary file not shown.
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/WHITE8X8 - 副本.BLP
Normal file
BIN
配套插件/AddOns/SM_BloodVolumeExpansion/img/WHITE8X8 - 副本.BLP
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user