PatchwerkHeal

纳克萨玛斯NAXX,战神帕奇维克,治疗副坦克插件,一键无脑流。

localizations.lua

local AppName = ...
local AL = LibStub("AceLocale-3.0")
local L = AL:NewLocale(AppName, "enUS", true)
L.ADDON_NAME="PatchwerkHeal"
L.LoadInfo = "PatchwerkHeal Loaded"
L.UnLoadInfo = "PatchwerkHeal UnLoaded"
L["PatchwerkHeal_TOGGLE_TEXT"] = "click to open/close the PW Heal Frame"
L["ShowPatchwerkHeal"]="open the PW Heal assist,use mouse right key to drag the frame"
L["HidePatchwerkHeal"]="close the PW Heal assist"
L["Not Setting"]="No Target setted"
L["CannotModifyInCombat"]="Cannot in combat"
L["level"]="level"
L["HelpTips"]="Select target,then drap skill to PW frame,if no target ,the drag can clear the setting."

L = AL:NewLocale(AppName, "zhCN")
if L then
	L.ADDON_NAME="帕奇维克又来陪我们玩"
	L.LoadInfo= "|cff1eff00帕奇维克又来陪我们玩|r 已装载\nBy 一只傻安安@班尔法克斯"
	L["PatchwerkHeal_TOGGLE_TEXT"] = "点击以开启/关闭PW治疗框体"
	L["ShowPatchwerkHeal"]="开启帕奇维克治疗助手,右键移动框体"
	L["HidePatchwerkHeal"]="关闭帕奇维克治疗助手"
	L["Not Setting"]="未设置有效目标"
	L["CannotModifyInCombat"]="战斗中无法修改"
	L["level"]="等级"
	L["HelpTips"]="PW框体:选中目标,拖动设置的技能到PW治疗框体,不选中目标的拖曳可以清除当前选择。"
end

 

 

PatchwerkHeal.lua

local AppName = ...
local L = LibStub("AceLocale-3.0"):GetLocale(AppName)
PatchwerkHeal=LibStub("AceAddon-3.0"):NewAddon("PatchwerkHeal", "AceConsole-3.0","AceEvent-3.0","AceTimer-3.0")
PatchwerkHeal.Active=false
PatchwerkHeal.Debug=false
--PatchwerkHeal:UnregisterAllEvents()

local function DPrint(...)
	if PatchwerkHeal.Debug then
		print(...)
	end
end
local spellRankTableData = {
	[1] = { 774, 8936, 5185, 740, 635, 19750, 139, 2060, 596, 2061, 2054, 2050, 1064, 331, 8004, 136, 755, 689, 746 },
	[2] = { 1058, 8938, 5186, 8918, 639, 19939, 6074, 10963, 996, 9472, 2055, 2052, 10622, 332, 8008, 3111, 3698, 699, 1159 },
	[3] = { 1430, 8939, 5187, 9862, 647, 19940, 6075, 10964, 10960, 9473, 6063, 2053, 10623, 547, 8010, 3661, 3699, 709, 3267 },
	[4] = { 2090, 8940, 5188, 9863, 1026, 19941, 6076, 10965, 10961, 9474, 6064, 913, 10466, 3662, 3700, 7651, 3268 },
	[5] = { 2091, 8941, 5189, 1042, 19942, 6077, 22009, 25314, 25316, 10915, 939, 10467, 13542, 11693, 11699, 7926 },
	[6] = { 3627, 9750, 6778, 3472, 19943, 6078, 10916, 959, 10468, 13543, 11694, 11700, 7927, 23569, 24412 },
	[7] = { 8910, 9856, 8903, 10328, 10927, 10917, 8005, 13544, 11695, 10838 },
	[8] = { 9839, 9857, 9758, 10329, 10928, 10395, 10839, 23568, 24413 },
	[9] = { 9840, 9858, 9888, 25292, 10929, 10396, 18608 },
	[10] = { 9841, 9889, 25315, 25357, 18610, 23567, 24414 },
	[11] = { 25299, 25297, 30020 },
}

local function make_class_prefix(classid)
  local classid2color={"|cFFC79C6E","|cFFF58CBA","|cFFA9D271","|cFFFFF569","|cFFFFFFFF","|cFFC41F3B","|cFF0070DE","|cFF40C7EB","|cFF8787ED","|cFF00FF96","|cFFFF7D0A","|cFFA330C9"}
  return classid2color[classid]
end

local SpellIDToRank = {}
for rankIndex, spellIDTable in pairs(spellRankTableData) do
	for _, spellID in pairs(spellIDTable) do
		SpellIDToRank[spellID] = rankIndex
	end
end


function PatchwerkHeal:BuildFrame()
	--DPrint("buldFrame")
	local texture_str = "Interface\\TARGETINGFRAME\\UI-StatusBar"
	if not PatchwerkHealFrame then
		PatchwerkHealFrame=CreateFrame("Button", "myMacroButton", UIParent, "SecureActionButtonTemplate")
		PatchwerkHealFrame:SetAttribute("type1", "macro") -- left click causes macro
		
		PatchwerkHealFrame.bg = PatchwerkHealFrame:CreateTexture(nil,"BACKGROUND", nil, -5)
		PatchwerkHealFrame.bg:SetTexture(texture_str)
		PatchwerkHealFrame.bg:SetVertexColor(0,0.1,0,0.8)
		PatchwerkHealFrame.bg:SetAllPoints(PatchwerkHealFrame)
		print('/script print("'..L["HelpTips"]..'")')
		PatchwerkHealFrame:SetAttribute("macrotext1",'/script print("'..L["HelpTips"]..'")') 
		PatchwerkHealFrame:SetMovable(true)
		PatchwerkHealFrame:SetSize(100,60)
		PatchwerkHealFrame:SetPoint("TOPLEFT",0,-10)
		PatchwerkHealFrame:EnableMouse(true)
		PatchwerkHealFrame:RegisterForDrag("RightButton")
		PatchwerkHealFrame:SetScript("OnDragStart", PatchwerkHealFrame.StartMoving)
		PatchwerkHealFrame:SetScript("OnDragStop", PatchwerkHealFrame.StopMovingOrSizing)
		PatchwerkHealFrame.HPTip = PatchwerkHealFrame:CreateFontString(nil, "ARTWORK", "GameTooltipTextSmall");
		PatchwerkHealFrame.HPTip:SetAllPoints( PatchwerkHealFrame)
		PatchwerkHealFrame.HPTip:SetTextColor(1,1,0)
		PatchwerkHealFrame.HPTip:SetText(L["Not Setting"])

		PatchwerkHealFrame:SetScript("OnReceiveDrag",function()
			if InCombatLockdown() then
				print(L["CannotModifyInCombat"])
				return
			end
			local ret={GetCursorInfo()}
			if ret[1]=="spell" then
				local dragtype,spellIndex, bookType, spellID=ret[1],ret[2],ret[3],ret[4]
				local level=SpellIDToRank[spellID]
				
				if level then
					level="("..L["level"].." "..level..")"
				else
					level=""
				end
				local spellName=GetSpellInfo(spellID)
				local guid,playername = UnitGUID("target"), UnitName("target")
				local classFilename, classId = UnitClassBase("target")
				
				--DPrint(playername,guid,classId,spellID,level)
				if guid and spellName then
					local type, zero, server_id, instance_id, zone_uid, npc_id, spawn_uid = strsplit("-",guid);
					if type=="Player" then
						DPrint("/cast "..'[@"' .. playername .. '",help,nodead] '..spellName..level)
						PatchwerkHealFrame.playername=playername
						PatchwerkHealFrame.playerid=guid
						PatchwerkHealFrame:SetAttribute("macrotext1", "/cast ".."[@" .. playername .. ",help,nodead] "..spellName..level)
						
						PatchwerkHealFrame.TipText=("%s%s|r\n%s"):format(make_class_prefix(classId),PatchwerkHealFrame.playername,spellName..level)
						PatchwerkHealFrame.HPTip:SetText(PatchwerkHealFrame.TipText)
						PatchwerkHeal:UNIT_HEALTH("UNIT_HEALTH","target")
						--PatchwerkHealFrame.HPTip:SetText(PatchwerkHealFrame.playername.."\n"..spellName..level)
						ClearCursor()
					end
				else
					PatchwerkHealFrame.playername=nil
					PatchwerkHealFrame.playerid=nil
					PatchwerkHealFrame.TipText=""
					
					PatchwerkHealFrame:SetAttribute("macrotext1",'/script print("'..L["HelpTips"]..'")') 
					PatchwerkHealFrame.HPTip:SetText(L["Not Setting"])
					if PatchwerkHealMask then
						PatchwerkHealMask.bar:SetValue(0)
					end
					ClearCursor()
				end
			end
		end)	
		PatchwerkHealFrame:Hide()
	end	
--Mask Frame
	if not PatchwerkHealMask then
		PatchwerkHealMask=CreateFrame("frame",nil)
		PatchwerkHealMask:SetFrameLevel(2)
		PatchwerkHealMask:SetSize(100,60)
		PatchwerkHealMask.maskbg=PatchwerkHealMask:CreateTexture(nil,"ARTWORK", nil,1)
		PatchwerkHealMask:EnableMouse(false)
		PatchwerkHealMask.maskbg:SetTexture(texture_str)
		PatchwerkHealMask.maskbg:SetVertexColor(0.8,0.1,0.1,0.0)
		PatchwerkHealMask.maskbg:SetAllPoints(PatchwerkHealMask)

		local border_texture_str = "Interface\\Tooltips\\UI-StatusBar-Border"	
		
		local border_texture1=PatchwerkHealMask:CreateTexture(nil,"BORDER")
		
		border_texture1:SetPoint("TOPLEFT",-3,3)
		border_texture1:SetSize(96,16)
		border_texture1:SetTexture(border_texture_str)
		PatchwerkHealMask.bar=CreateFrame("StatusBar",nil,PatchwerkHealMask)
		PatchwerkHealMask.bar:SetMinMaxValues(0,100)
		PatchwerkHealMask.bar:SetValue(0)
		PatchwerkHealMask.bar:SetStatusBarTexture(texture_str,"BACKGROUND", nil,3)
		PatchwerkHealMask.bar:SetStatusBarColor(0.1,0.8,0,0.85)
		PatchwerkHealMask.bar:SetSize(90,10)
		PatchwerkHealMask.bar:SetPoint("TOPLEFT",PatchwerkHealMask,"TOPLEFT",0,0)
		PatchwerkHealMask:SetAllPoints(PatchwerkHealFrame)

		
	end
	PatchwerkHealMask:Hide()
end

function PatchwerkHeal:Toggle(force)
	if InCombatLockdown() then
		print(L["CannotModifyInCombat"])
		return
	end
	if self:IsEnabled() and force~="Enable" then
		self:Disable()
	elseif (not self:IsEnabled()) and force~="Disable" then
		self:Enable()
	end
end
function PatchwerkHeal:SetupDataBroker()
    local LDB = LibStub('LibDataBroker-1.1')
     local PatchwerkHealLauncher = LDB:NewDataObject('PatchwerkHeal', {
        type = 'launcher',
		icon = "Interface\\Icons\\INV_Mace_15",
		label = L["PatchwerkHeal_TOGGLE_TEXT"],
        OnClick = function()
            return self:Toggle()
        end,
		OnTooltipShow = function(tt)
			tt:AddLine(L["PatchwerkHeal_TOGGLE_TEXT"])
		end,
        OnLeave = GameTooltip_Hide,
    })

     LibStub('LibDBIcon-1.0'):Register('PatchwerkHeal', PatchwerkHealLauncher,{ 
		hide = false,
		radius = 110,
	})
end
--event
local function parseGUID(gid)
	if gid==nil then
		return nil,nil
	end
	local type, zero, server_id, instance_id, zone_uid, npc_id, spawn_uid = strsplit("-", gid or "")
	return npc_id,spawn_uid
end
function PatchwerkHeal:CombatLogEvent(timestamp, eventtype, hideCaster, srcGUID, srcName, srcFlags, srcRaidFlags, dstGUID, dstName, dstFlags, dstRaidFlags, ...)
	local direct_damage={["SWING_DAMAGE"]=1,["RANGE_DAMAGE"]=4,["SPELL_DAMAGE"]=4,["SPELL_PERIODIC_DAMAGE"]=4,["DAMAGE_SPLIT"]=4}
	local npc_id,spawn_uid=parseGUID(dstGUID)
	local do_damage=0
	if PatchwerkHealFrame.playerid~=nil and PatchwerkHealFrame.playerid==dstGUID then
		--DPrint(eventtype,srcName,dstName,...)
		if eventtype=="SPELL_HEAL" then
			--local data={...}
			--DPrint(("|cFFF58CBAHeal:%s:%d|r"):format(data[2],data[4]-data[5]))
		elseif eventtype=="SPELL_PERIODIC_HEAL" then
			--local data={...}
			--DPrint(("|cFFF58CBAHot:%s:%d|r"):format(data[2],data[4]-data[5]))
		elseif eventtype=="SPELL_DAMAGE" then
			local data={...}
			if (data[2]=="仇恨打击" or data[2]=="寒冰箭") then
				DPrint(GetTime(),(":|cFFFFF569:%s:%d|r"):format(data[2],data[4]))
				PatchwerkHealMask.maskbg:SetVertexColor(0.1,0.1,0.1,0.0)
				PlaySound(5275)
				PatchwerkHealMask:EnableMouse(false)
				C_Timer.After(1, function() 
					DPrint(GetTime(),":","Disable")
					PatchwerkHealMask.maskbg:SetVertexColor(0.8,0.1,0.1,0.6)
					PatchwerkHealMask:EnableMouse(true) 
					end)
			end
		elseif direct_damage[eventtype]~=nil then

		elseif eventtype=="UNIT_DIED" then

		end	
	end
	
end
function PatchwerkHeal:UNIT_HEALTH(event,uid)
	--DPrint(uid)
	if PatchwerkHealFrame.playerid~=nil and PatchwerkHealFrame.playerid==UnitGUID(uid) and PatchwerkHealMask.bar then
			-- DPrint(UnitHealth(uid))
			-- if UnitHealth(uid)>=UnitHealthMax(uid) then
				-- PatchwerkHealMask:EnableMouse(true)
			-- else
				-- PatchwerkHealMask:EnableMouse(false)
			-- end
			local health_rate=UnitHealth(uid)*100/UnitHealthMax(uid)
			if health_rate<=30 then
				PatchwerkHealMask.bar:SetStatusBarColor(0.8,0.1,0,0.85)
			elseif health_rate<=70 then
				PatchwerkHealMask.bar:SetStatusBarColor(0.7,0.7,0,0.85)
			else
				PatchwerkHealMask.bar:SetStatusBarColor(0.1,0.8,0,0.85)
			end
			PatchwerkHealMask.bar:SetValue(UnitHealth(uid)*100/UnitHealthMax(uid))
	end
end
function PatchwerkHeal:COMBAT_LOG_EVENT_UNFILTERED()
	PatchwerkHeal:CombatLogEvent(CombatLogGetCurrentEventInfo())
end

function PatchwerkHeal:PLAYER_REGEN_ENABLED()
	if PatchwerkHealMask then
		PatchwerkHealMask.maskbg:SetVertexColor(0.1,0.1,0.1,0.0)
		PatchwerkHealMask:EnableMouse(false)	
	end
end
function PatchwerkHeal:PLAYER_REGEN_DISABLED()
	if PatchwerkHealMask then
		PatchwerkHealMask.maskbg:SetVertexColor(0.9,0.2,0.2,0.6)
		PatchwerkHealMask:EnableMouse(true) 	
	end	
end

function PatchwerkHeal:OnInitialize()
	self:BuildFrame()
	self:SetEnabledState(false)
	self:SetupDataBroker()
	self:Print(L["LoadInfo"])
end

function PatchwerkHeal:OnEnable()
	DPrint("Enable")
	if PatchwerkHealFrame then
		PatchwerkHealFrame:Show()
		PatchwerkHealMask:Show()
		self:Print(SELECTED_CHAT_FRAME,L["ShowPatchwerkHeal"])
		self.timerCount=0 
		PatchwerkHeal.Active=true				
		PatchwerkHeal:RegisterEvent("UNIT_HEALTH")
		PatchwerkHeal:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
		PatchwerkHeal:RegisterEvent("PLAYER_REGEN_ENABLED")
		PatchwerkHeal:RegisterEvent("PLAYER_REGEN_DISABLED")
	end

end

function PatchwerkHeal:OnDisable()
	DPrint("Disable")
	if PatchwerkHealFrame then
		PatchwerkHealFrame:Hide()
		PatchwerkHealMask:Hide()
		PatchwerkHealMask:EnableMouse(false)
		self:Print(SELECTED_CHAT_FRAME,L["HidePatchwerkHeal"])
		PatchwerkHeal.Active=false
		PatchwerkHeal:UnregisterEvent("UNIT_HEALTH")
		PatchwerkHeal:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
		PatchwerkHeal:UnregisterEvent("PLAYER_REGEN_ENABLED")
		PatchwerkHeal:UnregisterEvent("PLAYER_REGEN_DISABLED")
	end
	

end

PatchwerkHeal.toc

## Interface: 11302
## Title: PatchwerkHeal
## Title-zhCN: |cff1eff00帕奇维克又来陪我们玩|r
## Notes: Oracle开发组
## Author: 一只傻安安
## Version: 0.1
## SavedVariables: PatchwerkHeal_DB
## OptionalDeps: LibStub, CallbackHandler-1.0,AceAddon-3.0, AceDB-3.0, AceEvent-3.0,AceLocale-3.0
## DefaultState: disabled

localizations.lua
PatchwerkHeal.lua

 

1:解压文件,其实里面就三个lua脚本文件,这些不用管

:2:放到wow安装插件目录下,是整个文件夹拷贝进去,本例的目录是:D:\World of Warcraft\_classic_\Interface\AddOns

大家根据自己安装的根目录查找下_classic_\Interface\AddOns

怀旧服的_classic_

 

文件目录注意下:

如果不对的,把这三个文件拷贝进去也可以的

实在不知道,就新建文件夹【PatchwerkHeal】

D:\World of Warcraft\_classic_\Interface\AddOns\PatchwerkHeal

 

 

3:登录游戏,角色列表,左下方插件(前提要安装下大脚插件)

 

 

 

 

 

 

很明显,我得创建个奶妈号,用我以前朋友名字纪念下:“小德的追逐”

 

 

 

鼠标右键可以把这个 【小方框】 拖动到自己习惯的位置上。

 

重点::::

 

锁定下目标不然等下,点点点点,给自己加血了!!!目标是你的副坦克,不然要罚款了哦。。。。

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值