欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

combatsct.lua

时间太紧了
LUA
第 1 页 / 共 4 页
字号:
			posx = posx + DENNIE_ani_posX;
			posy = posy + DENNIE_ani_posY;
			if value.alpha > DSCT_ANI_ALPHAMAX then
				value.FObject:SetAlpha(DSCT_ANI_ALPHAMAX);
			else
				value.FObject:SetAlpha(value.alpha);
			end
			value.FObject:SetPoint("CENTER", "UIParent", "CENTER", posx ,posy );--Dennie Add
		end
	end	
	for key, value in arrCusMessData do
		--if (value.Active) then
			DSCT_doCusMess(value);		
		--end
	end

end

----------------------
function DSCT_doCusMess(cusMessData)
	if ( cusMessData.Active == true) then
		local curtime = GetTime();
		if cusMessData.SpellTime ~= -1 then
			local spelltime = cusMessData.SpellTime - curtime + cusMessData.SpellStartTimer;
			if spelltime > 0 then
				if spelltime > 1 then
					cusMessData.FObject:SetText(format(cusMessData.txtbak.." |cffffffff%.1f|r", spelltime));
				else
					cusMessData.FObject:SetText(format(cusMessData.txtbak.." |cffffff00%.1f|r", spelltime));
				end
			else
				cusMessData.FObject:SetText(cusMessData.txtbak.." |cffffffff---|r");
			end
		end
		if ((curtime  - cusMessData.lastupdate) > DSCT_MESS_TIMER) then
			if curtime - cusMessData.lastupdate - DSCT_MESS_TIMER < DSCT_MESS_FADETIMER then
				cusMessData.alpha = (1 - (curtime - cusMessData.lastupdate - DSCT_MESS_TIMER) / DSCT_MESS_FADETIMER) * DSCT_MESS_ALPHAMAX;
			else			
				DSCT_cusMessReset(cusMessData);
				return;
			end			
		end
		if cusMessData.alpha > DSCT_MESS_ALPHAMAX then cusMessData.alpha = DSCT_MESS_ALPHAMAX;end
		cusMessData.FObject:SetAlpha(cusMessData.alpha);
		cusMessData.FObject:SetPoint("CENTER", "UIParent", "CENTER", cusMessData.posX, cusMessData.posY);--Dennie Add

	end	
end

--Move text to get the animation
function DSCT_doAnimation(adat)	--If a crit			
	
	
	--[[
		if (DENNIE_aniDelay > 0) then
			DENNIE_aniDelay = DENNIE_aniDelay - 1;
			aniData.lastupdate = GetTime();
		end]]		
	--if its time to update, move the text step positions
	if ( adat.Active == true) then
		local theType = DSCT_Get("ANIMODE");		
		local curtime = GetTime() - adat.starttimer;
		curtime = DSCT_ANI_SPEED * curtime;
		if adat.sp == true then theType = 99;end
		if theType == 99 then
			if curtime < 0.2 then
				adat.alpha = curtime * 5;
			elseif curtime < 1.5 then
				adat.alpha = 1;
			elseif curtime < 1.9 then
				adat.alpha = 1 - (curtime - 1.5) / 0.4;
			else
				DSCT_aniReset(adat);
				return;
			end
		end
		if theType == 2 then
			if curtime < adat.timer1 then
				adat.posX = (curtime / adat.timer1) * adat.distance1;
				adat.posY = -adat.posX * adat.posX * 0.04 + adat.distance2 * adat.posX;
				adat.posX = adat.angle1 * adat.posX;
				if curtime < 0.2 then
					adat.alpha = curtime * 5;
				elseif curtime > adat.timer1 - 0.4 then
					adat.alpha = 1 - (curtime - (adat.timer1 - 0.4)) / 0.4;	
				else
					adat.alpha = 1;
				end
			else
				DSCT_aniReset(adat);
				return;
			end
		end
		if theType == 3 then
			if curtime < adat.timer1 then
				adat.posX = -cos(adat.angle1) * adat.distance1 * curtime / adat.timer1;
				adat.posY = sin(adat.angle1) * adat.distance1 * curtime / adat.timer1;
			elseif curtime < adat.timer2 then
				if adat.status ~= 1 then
					adat.status = 1;
					adat.posX = -cos(adat.angle1) * adat.distance1;
					adat.posY = sin(adat.angle1) * adat.distance1;
				end
				if curtime < adat.timer1 + 0.4 then
					if curtime - adat.lastupdate > 0.1 then
						adat.lastupdate = curtime;
						adat.posX = adat.posX + adat.baseX;
						adat.posY = adat.posY + adat.baseY;
						adat.bakX = random(70) - 35;
						adat.bakY = random(70) - 35;
						adat.baseX = 0;
						adat.baseY = 0;
					end
					adat.baseX = adat.bakX * (curtime - adat.lastupdate);
					adat.baseY = adat.bakY * (curtime - adat.lastupdate);
				end
				if adat.skip == true then
					adat.starttimer = adat.starttimer - (adat.timer2 - curtime);
				end
			elseif curtime < adat.timer3 then				
				if adat.status ~= 2 then
					adat.status = 2;
					adat.baseX = adat.baseX + adat.posX;
					adat.baseY = adat.baseY + adat.posY;
				end
				if curtime > adat.timer3 - 0.4 then
					adat.alpha = 1 - (curtime - (adat.timer3 - 0.4)) / 0.4;
				end
				adat.posX = -cos(adat.angle2) * adat.distance2 * (curtime - adat.timer2) / (adat.timer3 - adat.timer2);
				adat.posY = sin(adat.angle2) * adat.distance2 * (curtime - adat.timer2) / (adat.timer3 - adat.timer2);			
			else
				DSCT_aniReset(adat);
				return;
			end
		end
		if theType == 0 or theType == 1 or theType == 4 or theType == 5 or theType == 6 then			
			if curtime < adat.timer1 then
				adat.posX = -cos(adat.angle1) * adat.distance1 * curtime / adat.timer1;
				adat.posY = sin(adat.angle1) * adat.distance1 * curtime / adat.timer1;
				if adat.alpha ~= 1 then
					if curtime < 0.25 then
						adat.alpha = curtime * 4;
					else
						adat.alpha = 1;
					end
				end
			elseif curtime < adat.timer2 then
				if adat.status ~= 1 then
					adat.status = 1;
					adat.posX = -cos(adat.angle1) * adat.distance1;
					adat.posY = sin(adat.angle1) * adat.distance1;
				end
				if adat.skip == true then
					adat.starttimer = adat.starttimer - (adat.timer2 - curtime);
				end
			elseif curtime < adat.timer3 then
				if adat.status ~= 2 then
					adat.status = 2;
					adat.baseX = adat.baseX + adat.posX;
					adat.baseY = adat.baseY + adat.posY;
				end
				if curtime > adat.timer3 - 0.4 then
					adat.alpha = 1 - (curtime - (adat.timer3 - 0.4)) / 0.4;
				else
					adat.alpha = 1;
				end
				adat.posX = -cos(adat.angle2) * adat.distance2 * (curtime - adat.timer2) / (adat.timer3 - adat.timer2);
				adat.posY = sin(adat.angle2) * adat.distance2 * (curtime - adat.timer2) / (adat.timer3 - adat.timer2);				
			else
				DSCT_aniReset(adat);
				return;
			end
		end		
		--=============================================================Dennie Add end
		
		if adat.crit > 0 then
			if curtime < 0.2 then
				adat.FObject:SetTextHeight(DSCT_ANI_TEXTSIZE * 2);
			elseif curtime <= 0.4 then			
				adat.FObject:SetTextHeight(DSCT_ANI_TEXTSIZE * (2 - (curtime - 0.2) * 4 ));
			else
				adat.FObject:SetTextHeight(DSCT_ANI_TEXTSIZE);
			end	
		end
	end
	return true;
end

----------------------
--count the number of crits active
function DSCT_critCount()
	local count = 0
	
	for key, value in arrAniData do
		if (value.crit) then
			count = count + 1;
		end
	end
	
	return count;
end

----------------------
--Rest the text animation
function DSCT_aniReset(aniData)	
	
	aniData.Active = false;
	aniData.crit = 0;
	aniData.posY = 0;
	aniData.posX = 0;
	aniData.baseX = 0;
	aniData.baseY = 0;
	aniData.sp = false;
	aniData.alpha = 0;
	aniData.addY = 0;--Dennie Add
	aniData.addX = 0;--Dennie Add
	aniData.skip = false;
	aniData.mir = 1;
	aniData.critdelay = 0;
	
	aniData.FObject:SetAlpha(aniData.alpha);
	aniData.FObject:SetPoint("CENTER", "UIParent", "CENTER", aniData.posX, aniData.posY);
end

----------------------
--Rest all the text animations
function DSCT_aniResetAll()
	
	for key, value in arrAniData do
		DSCT_aniReset(value);
	end

end


function DSCT_cusMessReset(cusMessData)	
	
	cusMessData.Active = false;
	cusMessData.posY = 0;
	cusMessData.posX = 0;
	cusMessData.alpha = 0;
	cusMessData.lastupdate = 0;
	cusMessData.txtbak = "";
	cusMessData.SpellTime = -1;
	cusMessData.SpellStartTimer = 0;
	
	cusMessData.FObject:SetAlpha(0);
	cusMessData.FObject:SetPoint("CENTER", "UIParent", "CENTER", cusMessData.posX, cusMessData.posY);
end

function DSCT_cusMessResetAll()	
	for key, value in arrCusMessData do
		DSCT_cusMessReset(value);
	end
end

----------------------
--Initial animation settings
function DSCT_cusMessInit()
	local MessFontSize;
	MessFontSize = DSCT_Get("MESSAGESIZE");
	if (MessFontSize < 12) then
		MessFontSize = 12;
	end
	if (MessFontSize > 36) then
		MessFontSize = 36;
	end
	DENNIE_cusMessLast = 1;
	
	
	local FontNumber = DSCT_Get("MESSAGEFONT");
	if DSCT_FONTLIST[FontNumber] == nil then
		--DSCT_Set("MESSAGEFONT",1);
		FontNumber = 1;
	end
	local FontName = DSCT_FONTLIST[FontNumber].path;
	local FontOutTxt = "";
	FontOutline = DSCT_Get("MESSFONTOUTLINE");

	if (FontOutline == 2) then
		FontOutTxt = "OUTLINE";
	elseif (FontOutline == 3) then
		FontOutTxt = "THICKOUTLINE";	
	end

	for key, value in arrCusMessData do
		--value.FObject = getglobal("DSCT"..key);
		value.FObject = getglobal("DSCT"..key);
		value.FObject:SetFont(FontName, MessFontSize,FontOutTxt);			
	end
	
	DENNIE_CUSMESS_TEXTSIZE = MessFontSize;
	DSCT_cusMessResetAll();
end

function DSCT_ToDec(a)
	local i = 0;
	while a - i > 1 do
		i = i + 1;
	end
	return i;
end
function DSCT_ToHEX(a)
	local b = a * 256;
	return ""..DSCT_HEX_LIST[DSCT_ToDec(b / 16) + 1]..DSCT_HEX_LIST[ DSCT_ToDec( ( b / 16 - DSCT_ToDec(b / 16) ) * 16 ) + 1];
end
function DSCT_ColorFlip(r,g,b)
	return "|cff"..DSCT_ToHEX(r)..DSCT_ToHEX(g)..DSCT_ToHEX(b);
end

function DSCT_aniInit()
	local FontNumber;
	local FontOutline;
	local FontOutTxt = "";
	local FontSize;
	local FontName = "Fonts\\FZJZJW.TTF";
	FontNumber = DSCT_Get("FONT");
	FontOutline = DSCT_Get("FONTOUTLINE");
	FontSize = DSCT_Get("TEXTSIZE");
	if DSCT_FONTLIST[FontNumber] == nil then
		--DSCT_Set("FONT",1);
		FontNumber = 1;		
	end
	FontName = DSCT_FONTLIST[FontNumber].path;
	if (FontOutline == 2) then
		FontOutTxt = "OUTLINE";
	elseif (FontOutline == 3) then
		FontOutTxt = "THICKOUTLINE";	
	end
	
	for key, value in arrAniData do
		--value.FObject = getglobal("DSCT"..key);
		value.FObject = getglobal("DSCT"..key);		
		value.FObject:SetFont(FontName, FontSize,FontOutTxt);		
		value.lastupdate = 0;		
	end
	
	DSCT_aniResetAll();
end

----------------------
--function of spell alert
function DSCT_isParty(name)
	for i = 1, 4, 1 do
		local partyname = UnitName("party" .. i);
		if (name == partyname ) then
			if not UnitCanAttack("party" .. i, "player") then return 1;end
		end
	end
	return nil;
end

function DSCT_openPreView()
	local adat;
	if (DSCT_NameRegistered == 0) then
		return;
	end
	
	local pre = getglobal("DSCT_PreMessBox");
	pre:ClearAllPoints();
	pre:SetPoint("CENTER", "UIParent", "CENTER", DSCT_Get("MESSAGEPOSX",x), DSCT_Get("MESSAGEPOSY",y));
	pre:Show();
	
	pre = getglobal("DSCT_PreAniBox");
	pre:ClearAllPoints();
	pre:SetPoint("CENTER", "UIParent", "CENTER", DSCT_Get("ANIPOSX",x), DSCT_Get("ANIPOSY",y));
	pre:Show();
	
	DSCT_RefreshStaticVar();
end

function DSCT_closePreView()	
	if (DSCT_NameRegistered == 0) then
		return;
	end
	local pre = getglobal("DSCT_PreMessBox");
	pre:Hide();	
	pre = getglobal("DSCT_PreAniBox");
	pre:Hide();	
end

function DSCT_Cmd(msg)
	local cmdlist = {nil,nil,nil,nil,nil,nil};
	local i = 1;
	local findval = 0;
	if msg == "" then
		if DSCTOptions then DSCT_showMenu();else DSCT_Debug("无菜单");end
		return;
	end	
	while msg ~= nil do
		if strfind(msg," ") then
			findval = strfind(msg," ");
			cmdlist[i] = strsub(msg,1,findval - 1);
			val = strsub(msg,strfind(msg," ") + 1,strlen(msg));
			msg = strsub(msg,strfind(msg," ") + 1,strlen(msg));
		else
			cmdlist[i] = msg;
			msg = nil;
		end		
		i = i + 1;
	end
	
	if cmdlist[1] and cmdlist[2] then
		if strlower(cmdlist[1]) == "save" then
			DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"] = nil;
			DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"] = DSCT_clone(DSCTPlayer);
			DSCT_Debug("保存到: "..strlower(cmdlist[2]));			
		end
		if strlower(cmdlist[1]) == "load" then
			if DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"] then
				DSCT_Load(DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"]);
				DSCT_Debug("已读取: "..strlower(cmdlist[2]));
			else
				DSCT_Debug("不存在的存档: "..strlower(cmdlist[2]));
			end
		end
		if strlower(cmdlist[1]) == "delete" then
			if DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"] then
				DSCT_NEWCONFIG[strlower(cmdlist[2]).."_save"] = nil;
				DSCT_Debug("已删除: "..strlower(cmdlist[2]));
			else
				DSCT_Debug("不存在的存档: "..strlower(cmdlist[2]));
			end
		end
		
		return;
	end
	if strlower(cmdlist[1]) == "list" then
		DSCT_Debug("目前所有的存档列表: ");
		for key,val in DSCT_NEWCONFIG do
			if string.sub(key,string.len(key) - 4,string.len(key)) == "_save" then
				DSCT_Debug(string.sub(key,1,string.len(key) - 5) );
			end
		end
		return;
	end
	
	DSCT_Debug("|cffffff00DSCT 命令帮助:|r");
	DSCT_Debug("/sct save |cffff0000name|r:保存当前设置到指定档案名,例:/sct save myconfig1");
	DSCT_Debug("/sct load |cffff0000name|r:读取指定档案,例:/sct load myconfig1");
	DSCT_Debug("/sct delete |cffff0000name|r:删除指定档案,例:/sct delete myconfig1");
	DSCT_Debug("/sct list:列出目前所有存档的名字");
end


function gLim_Sct_Register()
   gLim_RegisterButton (
	"Sct",
	"战斗提示",
	"Interface\\AddOns\\CombatSct\\Icon", 
	function()	
		gLimModSecBookShowConfig("gLimSct");
	end,
	2,
	2
	);

  gLim_RegisterConfigClass(
	"gLimSct",
	"Sct",
	"CraZy aPpLe"
	);
  gLim_RegisterConfigSection(
	"gLimSctSection",
	"战斗提示",
	"战斗提示 Modified CraZy aPpLe",
	"CraZy aPpLe",
	"gLimSct"
	);

  gLim_RegisterConfigCheckBox(
	"gLim_Sct_Enable",
	"开启战斗提示",
	"显示目标对你造成的伤害信息",
	gLimSctEnable,
	Sct_Enable,
	"gLimSct"
	);
  gLim_RegisterConfigButton(
	"gLim_Sct_Options",
	"战斗提示细节设置",
	"战斗提示的各种细节设置",
	"详细设置",
	function()
		DSCT_showMenu();
		gLimConfigSubFrame:Hide();
	end,
	"gLimSct"
	);
  end


function Sct_Enable(toggle)
	gLimSctEnable = toggle;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -