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

combatsct.lua

时间太紧了
LUA
第 1 页 / 共 4 页
字号:
			for name,spell,num in string.gfind( arg1, DSCT_CRITHEAL_SEARCH1 ) do	
				if DSCT_Get("HEALERNAME") ~= 0 then
					DSCT_Display_Toggle("SHOWHEAL","+"..num.."  *"..name,1);
				else
					DSCT_Display_Toggle("SHOWHEAL","+"..num,1);
				end
				return;		
			end
		end
	elseif (event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS") then
		if DSCT_Get("SHOWHEAL") ~= 0 then	
			for name,spell,num in string.gfind( arg1, DSCT_HEAL_SEARCH1 ) do	
				if DSCT_Get("HEALERNAME") ~= 0 then
					DSCT_Display_Toggle("SHOWHEAL","+"..num.."  *"..name);
				else
					DSCT_Display_Toggle("SHOWHEAL","+"..num);
				end
				return;		
			end			
		end
		return;
	end
	
	if DSCT_SP_OnEvent then DSCT_SP_OnEvent(event, arg1, arg2, arg3);end
end

function DSCTD_Filter(name)
	if name == nil then return "ERROR";end
	local str = name;
	local len = string.len(str);
	local i = 1;
	local index = 1;
	local st = -1;
	local ed;
	while i <= len do
		if string.sub(str,i,i) == "%" then
			st = i;
		end
		if (string.sub(str,i,i) == "s" or string.sub(str,i,i) == "d") and st ~= -1 then
			ed = i;
			if string.sub(str,i,i) == "s" then
				str = string.sub(str,1,st - 1).."(.+)"..string.sub(str,ed + 1,string.len(str));
				i = st + 4 - 1;
			else
				str = string.sub(str,1,st - 1).."(%d+)"..string.sub(str,ed + 1,string.len(str));
				i = st + 5 - 1;
			end
			st = -1;
		end		
		i = i + 1;
	end
	return str;
end

function DSCT_InitCustomEvent()
	if initCE_OK == true then return;end
	if SCT_Event_Config == nil then return;end
	for custkey , custval in SCT_Event_Config do
		if custval.class then	
			if custval.class ~= "failed" and custval.class ~= "ok" then
				if currentclass ~= custval.class then
					custval.class = "failed";
				else
					custval.class = "ok";
				end
			end
		else
			custval.class = "ok";
		end		
		local len = string.len(custval.name);
		local i = 1;
		local index = 1;
		while i <= len - 1 do
			if string.sub(custval.name,i,i) == "*" then
				if tonumber(string.sub(custval.name,i + 1,i + 1)) then
					local n = tonumber(string.sub(custval.name,i + 1,i + 1));
					custval.name = string.sub(custval.name,1,i - 1).."%"..n.."$s"..string.sub(custval.name,i + 2,string.len(custval.name));
					i = i - 1;
					index = index + 1;
					len = string.len(custval.name);
				end	
			end
			i = i + 1;
		end
	end
	initCE_OK = true;
end

function DSCT_CustomEventSearch(arg1)
	local re = false;
	if SCT_Event_Config == nil then return;end
	for key , evt in EVENT_LIST["CUSTOMEVENT"] do
		if evt == event then
			for custkey , custval in SCT_Event_Config do	
				if custval.class == "ok" then
					for re1,re2,re3,re4,re5 in string.gfind( arg1, custval.search ) do					
						local ani = 5;
						local iscrit = 0;
						if custval.iscrit then
							if custval.iscrit ~= 0 then iscrit = 1;end
						end	
						if custval.ani then
							ani = custval.ani;
						end
						DSCT_Set("SHOWCUSTOM",ani);
						DSCT_SetColor("SHOWCUSTOM",custval.r,custval.g,custval.b);
						DSCT_Display_Toggle("SHOWCUSTOM",format(custval.name, re1,re2,re3,re4,re5), iscrit);
						if custval.sound then PlaySoundFile(custval.sound)end
						re = true;--return true;
					end
				end
			end
		end
	end	
	return re;
end
function DSCT_Display()
end

function DSCT_Display_New( msg , color, direction,iscrit )

	local adat, adatpre;
	--DSCT_Set("ANIMODE",2);
	local theType = DSCT_Get("ANIMODE");
	
	if (DSCT_NameRegistered == 0) then
		return;
	end
	if (string.len(msg) <= 0) then
		return;
	end
	if (msg == nil) then
		return;
	end
	if direction > 3 or direction < 1 then direction = 1;end
	
	--Set up  text animation
	adat = arrAniData["aniData"..DSCT_LastBar];
	--get last number
	local LastLastBar = DSCT_LastBar-1;
	if(LastLastBar == 0) then
		LastLastBar = DSCT_Get("ANIC");
	end
	adatpre = arrAniData["aniData"..LastLastBar];
	
	adat.Active = true;
	adat.starttimer = GetTime();
	if iscrit then adat.crit = iscrit;end
	
	--水平
	if (theType == 0) then
		adat.status = 0;
		adat.baseX = 60;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 2;
		adat.timer2 = 2;
		adat.timer3 = adat.timer1 + 0.4;
		if direction == 1 then
			adat.angle1 = 180;--a
			adat.angle2 = 180;--b
			adat.distance1 = 200 * DSCT_ANI_PARAM1;
			adat.distance2 = adat.distance1 / adat.timer1 * 0.4;
		else
			adat.baseX = -adat.baseX;
			adat.angle1 = 0;--a
			adat.angle2 = 0;--b
			adat.distance1 = 200 * DSCT_ANI_PARAM1;
			adat.distance2 = adat.distance1 / adat.timer1 * 0.4;
		end

		adat.alpha = 0;
		adat.lastupdate = 0;

		if adat.starttimer - DSCT_Ani_Fix[direction][1] < 2 / DSCT_ANI_SPEED then			
			DSCT_Ani_Fix[direction][2] = DSCT_Ani_Fix[direction][2] + 1;
			if DSCT_Ani_Fix[direction][2] > 2 then DSCT_Ani_Fix[direction][2] = 0;end
			adat.baseY = -(DSCT_ANI_TEXTSIZE + 2) * DSCT_Ani_Fix[direction][2];
		else
			DSCT_Ani_Fix[direction][2] = 0;
		end
	end
	--垂直
	if (theType == 1) then
		adat.status = 0;
		adat.baseY = 40;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 2;
		adat.timer2 = 2;
		adat.timer3 = adat.timer1 + 0.4;

		if direction == 1 then
			adat.angle1 = 90;--a
			adat.angle2 = 90;--b
			adat.distance1 = 200 * DSCT_ANI_PARAM1;
			adat.distance2 = adat.distance1 / adat.timer1 * 0.4;			
			local obj = arrAniData["aniData"..DSCT_Ani_Fix[direction][3]];
			local fix = 0;
			if obj.Active == true and obj.posY + obj.baseY < adat.baseY + DSCT_ANI_TEXTSIZE + 2 then
				fix = adat.baseY + DSCT_ANI_TEXTSIZE + 2 - (obj.posY + obj.baseY);
			end
			if fix ~= 0 then
				for i = 1,DSCT_Get("ANIC") do
					if i ~= DSCT_LastBar then
						obj = arrAniData["aniData"..i];
						if obj.Active == true and obj.angle1 == 90 then						
							obj.baseY = obj.baseY + fix;
						end
					end
				end
			end
		else
			adat.baseY = -adat.baseY;
			adat.angle1 = 270;--a
			adat.angle2 = 270;--b
			adat.distance1 = 200 * DSCT_ANI_PARAM1;
			adat.distance2 = adat.distance1 / adat.timer1 * 0.4;			
			local obj = arrAniData["aniData"..DSCT_Ani_Fix[direction][3]];
			local fix = 0;
			if obj.Active == true and obj.posY + obj.baseY > adat.baseY - DSCT_ANI_TEXTSIZE - 2 then
				fix = obj.posY + obj.baseY - (adat.baseY - DSCT_ANI_TEXTSIZE - 2);
			end
			if fix ~= 0 then
				for i = 1,DSCT_Get("ANIC") do
					if i ~= DSCT_LastBar then
						obj = arrAniData["aniData"..i];
						if obj.Active == true and obj.angle1 == 270 then						
							obj.baseY = obj.baseY - fix;
						end
					end
				end
			end
		end		
		adat.alpha = 0;
		adat.lastupdate = 0;		
	end
	--抛物线
	if (theType == 2) then
		adat.status = 0;
		adat.baseX = -55;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 1.5;	
		adat.distance1 = 100 * DSCT_ANI_PARAM2;
		adat.distance2 = 2.6 * DSCT_ANI_PARAM1;
		adat.angle1 = -1;
		
		if direction > 1 then
			adat.baseX = -adat.baseX;
			adat.angle1 = -adat.angle1;
		end

		adat.alpha = 0;
		adat.lastupdate = 0;

		if adat.starttimer - DSCT_Ani_Fix[direction][1] < 0.9 / DSCT_ANI_SPEED then			
			DSCT_Ani_Fix[direction][2] = DSCT_Ani_Fix[direction][2] + 1;
			if DSCT_Ani_Fix[direction][2] > 2 then DSCT_Ani_Fix[direction][2] = 0;end
			adat.distance2 = adat.distance2 + 0.5 * DSCT_Ani_Fix[direction][2];
		else
			DSCT_Ani_Fix[direction][2] = 0;
		end
	end
	--弹出1
	if (theType == 3 or theType == 5) then
		adat.status = 0;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 0.3;
		adat.timer2 = 1;
		adat.timer3 = 1.8;
		if direction == 1 then
			adat.angle1 = 5;
			adat.angle2 = 310;
			adat.distance1 = 150 * DSCT_ANI_PARAM1;
			adat.distance2 = 70 * DSCT_ANI_PARAM2;
		elseif direction == 2 then
			adat.angle1 = 130;
			adat.angle2 = 200;
			adat.distance1 = 80 * DSCT_ANI_PARAM1;
			adat.distance2 = 55 * DSCT_ANI_PARAM2;
		else
			adat.angle1 = 175;
			adat.angle2 = 200;
			adat.distance1 = 130 * DSCT_ANI_PARAM1;
			adat.distance2 = 70 * DSCT_ANI_PARAM2;
		end		
		adat.alpha = 1;
		adat.lastupdate = 0;

		if adat.starttimer - DSCT_Ani_Fix[direction][1] < 0.8 / DSCT_ANI_SPEED then
			DSCT_Ani_Fix[direction][2] = DSCT_Ani_Fix[direction][2] + 1;
			if DSCT_Ani_Fix[direction][2] > 2 then DSCT_Ani_Fix[direction][2] = 0;end
			adat.angle1 = adat.angle1 + random(18) - 9;
			adat.distance1 = adat.distance1 + 20 * DSCT_Ani_Fix[direction][2];
			local obj = arrAniData["aniData"..DSCT_Ani_Fix[direction][3]];
			obj.skip = true;
		else
			DSCT_Ani_Fix[direction][2] = 0;
		end
		if theType == 5 then
			adat.angle2 = 0;
			adat.distance2 = 0;
			adat.timer3 = 1.4;
		end
	end
	--弹出2
	if (theType == 4) then
		adat.status = 0;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 0.5;
		adat.timer2 = 1.1;
		adat.timer3 = 2;
		if direction == 1 then
			adat.angle1 = 330;--a
			adat.angle2 = 30;--b
			adat.distance1 = 160 * DSCT_ANI_PARAM1;
			adat.distance2 = 60 * DSCT_ANI_PARAM2;
		elseif direction == 2 then
			adat.angle1 = 200;
			adat.angle2 = 150;
			adat.distance1 = 160 * DSCT_ANI_PARAM1;
			adat.distance2 = 60 * DSCT_ANI_PARAM2;
		else
			adat.angle1 = 270;
			adat.angle2 = 270;
			adat.distance1 = 110 * DSCT_ANI_PARAM1;
			adat.distance2 = 40 * DSCT_ANI_PARAM2;
		end		
		adat.alpha = 1;
		adat.lastupdate = 0;
		
		if adat.starttimer - DSCT_Ani_Fix[direction][1] < 0.8 / DSCT_ANI_SPEED then			
			DSCT_Ani_Fix[direction][2] = DSCT_Ani_Fix[direction][2] + 1;
			if DSCT_Ani_Fix[direction][2] > 2 then DSCT_Ani_Fix[direction][2] = 0;end
			--if direction ~= 3 then
			adat.angle1 = adat.angle1 + random(20) - 10;
			adat.distance1 = adat.distance1 + 20 * DSCT_Ani_Fix[direction][2];
			local obj = arrAniData["aniData"..DSCT_Ani_Fix[direction][3]];
			obj.skip = true;
		else
			DSCT_Ani_Fix[direction][2] = 0;
		end		
	end
	--弹出3
	if (theType == 6) then
		adat.status = 0;
		adat.posX = 0;
		adat.posY = 0;
		adat.timer1 = 0.5;
		adat.timer2 = 1.0;
		adat.timer3 = 1.8;
		if direction == 1 then
			adat.angle1 = 25;
			adat.angle2 = 90;
			adat.distance1 = 100 * DSCT_ANI_PARAM1;
			adat.distance2 = 110 * DSCT_ANI_PARAM2;
		elseif direction == 2 then
			adat.angle1 = 155;
			adat.angle2 = 100;
			adat.distance1 = 90 * DSCT_ANI_PARAM1;
			adat.distance2 = 110 * DSCT_ANI_PARAM2;
		else
			adat.timer1 = 0.4;
			adat.angle1 = 330;
			adat.angle2 = 0;
			adat.distance1 = 100 * DSCT_ANI_PARAM1;
			adat.distance2 = 100 * DSCT_ANI_PARAM2;
		end		
		adat.alpha = 1;
		adat.lastupdate = 0;
		
		if adat.starttimer - DSCT_Ani_Fix[direction][1] < 0.8 / DSCT_ANI_SPEED then			
			DSCT_Ani_Fix[direction][2] = DSCT_Ani_Fix[direction][2] + 1;
			if DSCT_Ani_Fix[direction][2] > 2 then DSCT_Ani_Fix[direction][2] = 0;end
			local obj = arrAniData["aniData"..DSCT_Ani_Fix[direction][3]];
			obj.skip = true;
		else
			DSCT_Ani_Fix[direction][2] = 0;
		end		
	end
	DSCT_Ani_Fix[direction][3] = DSCT_LastBar;
	DSCT_Ani_Fix[direction][1] = adat.starttimer;
	
	--If they want to tag all self events
	if (DSCT_Get("SHOWSELF") == 1) then
		msg = DSCT_SelfFlag..msg..DSCT_SelfFlag;
	end
	
	adat.FObject:SetTextHeight(DSCT_Get("TEXTSIZE"));
	--set the color
	adat.FObject:SetTextColor(color.r, color.g, color.b);
	--set alpha
	adat.FObject:SetAlpha(adat.alpha);
	--Position
	adat.FObject:SetPoint("CENTER", "WorldFrame", "CENTER", adat.posX + adat.baseX, adat.posY + adat.baseY);--UIParent
	--Set the text to display
	adat.FObject:SetText(msg);
	
	--update current text being used
	DSCT_LastBar = DSCT_LastBar + 1;
	
	--if we reached the end, set to first
	if DSCT_LastBar >= (DSCT_Get("ANIC") + 1) then
		DSCT_LastBar = 1;
	end
end

----------------------
--Displays a message at the top of the screen
function DSCT_Display_Message(msg, color)
		--UIErrorsFrame:AddMessage(msg, color.r, color.g, color.b, 1.0, 1);
		local adat;
		
		if (DSCT_NameRegistered == 0) then
			return;
		end
		if (string.len(msg) <= 0) then
			return;
		end
		if (msg == nil) then
			return;
		end
	
		adat = arrCusMessData["cusMessData"..DENNIE_cusMessLast];
		DSCT_cusMessReset(adat);
		adat.txtbak = msg;
		adat.posX = DENNIE_cusMess_posX
		adat.posY = DENNIE_cusMess_posY;
		for i = 1,3 do
			if (i ~= DENNIE_cusMessLast) then
				local tmpdat;
				tmpdat = arrCusMessData["cusMessData"..i];
				if (tmpdat.Active == true) then					
					tmpdat.posY = tmpdat.posY + DENNIE_CUSMESS_TEXTSIZE;
					--tmpdat.alpha = 0.8;				
					--tmpdat.FObject:SetAlpha(tmpdat.alpha);	
				end				
			end
		end	
		
		adat.alpha = DSCT_Get("MESSAGEALPHA");

		adat.FObject:SetTextHeight(DENNIE_CUSMESS_TEXTSIZE);
		--set the color
		adat.FObject:SetTextColor(color.r, color.g, color.b);
		--set alpha
		adat.FObject:SetAlpha(adat.alpha);
		--Position
		adat.FObject:SetPoint("CENTER", "UIParent", "CENTER", adat.posX, adat.posY);
		--Set the text to display
		adat.FObject:SetText(msg);
		
		adat.lastupdate = GetTime();
		
		adat.Active = true;

		DENNIE_cusMessLast = DENNIE_cusMessLast + 1;
		if (DENNIE_cusMessLast > 3) then
			DENNIE_cusMessLast = 1;
		end
end

function DSCT_Display_Toggle(name,msg1,iscrit, msg2)
	if msg1 == nil or name == nil then return;end
	local val = DSCT_Get(name);
	if val == nil then return;end
	if val == 0 then return;end
	if val > 3 then
		if msg2 ~= nil then DSCT_Display_Message( msg2, DSCT_nGetColor(name) );else DSCT_Display_Message( msg1, DSCT_nGetColor(name) );end
	else
		DSCT_Display_New( msg1 , DSCT_nGetColor(name), val,iscrit );		
	end	
end

-- Update the animcation
function DSCT_TextUpdate()	
	DSCT_updateAnimation();
end

----------------------
-- Upate animations that are being used
function DSCT_updateAnimation()		
	local timer;
	local timer2;
	local bak;
	local beupdataed = false;
	
	DENNIE_TYPE4_FixFlag = true;
	local posx,posy;
	for key, value in arrAniData do
		if (value.Active == true) then
			DSCT_doAnimation(value);
			posx = (value.posX + value.baseX)  * DSCT_ROTATION_COS - (value.posY + value.baseY) * DSCT_ROTATION_SIN;
			posy = (value.posX + value.baseX) * DSCT_ROTATION_SIN + (value.posY + value.baseY) * DSCT_ROTATION_COS;

⌨️ 快捷键说明

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