⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 easymother.lua

📁 wow关于主母的炮位插件
💻 LUA
字号:

-- constants
EasyMother_mode = 1;
EasyMother_pos_y = 1;
EasyMother_pos_x = 1;
EasyMother_lock = true;
EasyMother_version = "1.81";
EasyMother_mother = {};
EasyMother_mother["left"] = 0;
EasyMother_mother["right"] = 0;
EasyMother_mother["timer"] = 0;
EasyMother_mother["stop"] = 0;
EasyMother_mother["on"] = 0;
EasyMother_test = 0;
EasyMother_test_timer = 0;
EasyMother_test_boss = 0;
EasyMother_test_door = 0;
EasyMother_test_stay = 0;
EasyMother_teleport = {};
EasyMother_teleport["on"] = 0;
EasyMother_teleport["number"] = 0;
EasyMother_teleport["timer"] = 0;
easymother_check_running = 0;
easymother_check_number = 0;
easymother_check_time = 0;
easymother_check = {};
easymother_check_players = "";

function EasyMother_SlashCmd(arg)
	local _, _, msg, args = string.find(arg, "(%w+)%s?(.*)");
	if (msg) then
		msg = strlower(msg);
	end
	if (msg == "test") then 
		if ( EasyMother_test == 1 ) then
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Already running test!");
		else
			EasyMotherFramePos(EasyMother_pos_x,EasyMother_pos_y);
			EasyMother_test_boss = 1;
			EasyMother_test_door = 1;
			EasyMother_test_stay = 1;
			EasyMother_test = 1;
			EasyMother_test_timer = 0;
		end
	elseif (msg == "reset") then 
		EasyMother_Clear();
		EasyMotherDragFrame:Hide();
		EasyMother_pos_y = 0;
		EasyMother_pos_x = 0;
		EasyMotherFramePos(0,0);
		EasyMother_lock = false;
		EasyMotherDragFrame:Show();
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r is |c00FF0000[Unlocked]|r. Drag the image to desired position.");
	elseif (msg == "lock") then 
		if ( EasyMother_lock == 0 or EasyMother_lock == false ) then
			EasyMother_lock = true;
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r is |c0000FF00[Locked]|r");
			EasyMotherDragFrame:Hide();
		else 
			EasyMother_lock = false;
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r is |c00FF0000[Unlocked]|r. Drag the image to desired position.");
			EasyMotherDragFrame:Show();

		end
	elseif (msg == "mode") then 	
		if ( EasyMother_mode == 1 ) then
			EasyMother_mode = 0;
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Arrow Mode |c00FF0000[Old]|r");
		else
			EasyMother_mode = 1;
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Arrow Mode |c0000FF00[New]|r");
		end
	elseif (msg == "version" or msg == "ver" or msg == "check") then 	
		easymother_check_running = 1;
		easymother_check_number = 0;
		easymother_check_time = 0;
		easymother_check = {};
		easymother_check_players = "";
		if ( GetNumRaidMembers() > 1 ) then
			SendAddonMessage("EASYMOTHER","VCHECK","RAID");
		else
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FF0000You must be in a raid.|r");
		end
	else
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00Mother Shahraz Easy Mode|r");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom mode|r Changes between New and Old arrows models.");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom lock|r Changes arrow position.");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom reset|r Resets arrow position.");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r --------------------------");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom test|r Test this addon.");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom check|r Check raid members for addon.");
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FFFF00/mom help|r Displays this help commands.");
	end
end

function EasyMotherFramePos(x,y)
	if ( not (x or y) ) then
		x = 0; y = 0;
	end
	EasyMother_pos_y = y;
	EasyMother_pos_x = x;
	EasyMotherDragFrame:ClearAllPoints();
	EasyMotherDragFrame:SetPoint("CENTER", UIParent, "CENTER", x, y)
	EasyMotherLeftFrame:ClearAllPoints();
	EasyMotherRightFrame:ClearAllPoints();
	EasyMotherStopFrame:ClearAllPoints();
	EasyMotherDownFrame:ClearAllPoints();
	EasyMotherUpFrame:ClearAllPoints();
	EasyMotherDragFrame:ClearAllPoints();
	EasyMotherNewStopFrame:ClearAllPoints();
	EasyMotherNewFrame:ClearAllPoints();
	EasyMotherLeftFrame:SetPoint("CENTER", UIParent, "CENTER", x/5, y/5)
	EasyMotherRightFrame:SetPoint("CENTER", UIParent, "CENTER", x/5, y/5)
	EasyMotherNewStopFrame:SetPoint("CENTER", UIParent, "CENTER", x/0.6, y/0.6)
	EasyMotherDownFrame:SetPoint("CENTER", UIParent, "CENTER", x/5, y/5)
	EasyMotherUpFrame:SetPoint("CENTER", UIParent, "CENTER", x/5, y/5)
	EasyMotherDragFrame:SetPoint("CENTER", UIParent, "CENTER", x, y)
	EasyMotherStopFrame:SetPoint("CENTER", UIParent, "CENTER", x/5, y/5)
	EasyMotherNewFrame:SetPoint("CENTER", UIParent, "CENTER", x/4, y/4)
end

function EasyMother_OnLoad()
	EasyMotherFrame:Show();
	
	DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r "..EasyMother_version.." loaded.");
	
	this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
	--this:RegisterEvent("CHAT_MSG_WHISPER");
	this:RegisterEvent("CHAT_MSG_ADDON");
	this:RegisterEvent("VARIABLES_LOADED");

	SLASH_EasyMother1 = "/mom";
	SLASH_EasyMother2 = "/easymother";
	SlashCmdList["EasyMother"] = EasyMother_SlashCmd;
	EasyMotherLeftFrame:SetScale(2.5);
	EasyMotherNewStopFrame:SetScale(0.3);
	EasyMotherRightFrame:SetScale(2.5);
	EasyMotherUpFrame:SetScale(2.5);
	EasyMotherDownFrame:SetScale(2.5);
	EasyMotherStopFrame:SetScale(2.5);
	EasyMotherDragFrame:SetScale(0.5);
	EasyMotherNewStopTexture:SetVertexColor(1,1,1,0.5);
	EasyMotherLeftTexture:SetVertexColor(255,255,0,0.7);
	EasyMotherStopTexture:SetVertexColor(0,0,1,0.8);
	EasyMotherRightTexture:SetVertexColor(255,255,0,0.7);
	EasyMotherDownTexture:SetVertexColor(1,0,0,0.7);
	EasyMotherUpTexture:SetVertexColor(0,1,0,0.7);
	EasyMotherLeftFrame:Hide();
	EasyMotherRightFrame:Hide();
	EasyMotherStopFrame:Hide();
	EasyMotherDownFrame:Hide();
	EasyMotherUpFrame:Hide();
	EasyMotherDragFrame:Hide();
	EasyMotherNewFrame:Hide();
	EasyMotherNewStopFrame:Hide();
	local t = { Minimap:GetChildren() }
	for i = #t, 1, -1 do
		local v = t[i]
		if v:GetObjectType() == "Model" and not v:GetName() then
			playerModel = v
			break
		end
	end
end
function EasyMother_OnEvent()
	if arg1 then 
		if (event == "CHAT_MSG_ADDON" and arg1 == "EASYMOTHER" ) then
			if ( arg2 == UnitName("player").." 1" ) then
				EasyMother_mother["right"] = 1;
				EasyMother_mother["left"] = 0;
				EasyMother_mother["stop"] = 0;
				EasyMother_mother["timer"] = 0;
				EasyMother_mother["on"] = 1;
			elseif ( arg2 == UnitName("player").." 2" ) then
				EasyMother_mother["right"] = 0;
				EasyMother_mother["left"] = 1;
				EasyMother_mother["stop"] = 0;
				EasyMother_mother["timer"] = 0;
				EasyMother_mother["on"] = 1;
			elseif ( arg2 == UnitName("player").." 3" ) then
				EasyMother_mother["right"] = 0;
				EasyMother_mother["left"] = 0;
				EasyMother_mother["stop"] = 1;
				EasyMother_mother["timer"] = 0;
				EasyMother_mother["on"] = 1;
			elseif (arg2 == "VCHECK" ) then
				SendAddonMessage("EASYMOTHER","VCHECKME "..arg4.." "..EasyMother_version,"RAID");
			elseif ( EasyMother_GetWords(arg2,1) == "VCHECKME" and EasyMother_GetWords(arg2,2) == UnitName("player")) then
				player = EasyMother_GetWords(arg2,2);
				version = EasyMother_GetWords(arg2,3);
				easymother_check_number = easymother_check_number+1;
				if ( tonumber(version)> tonumber(EasyMother_version)) then
					version = "|c0000FF00"..version.."|r";
				elseif (tonumber(version)< tonumber(EasyMother_version)) then
					version = "|c00FF0000"..version.."|r";
				end
				
				DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r "..arg4.." has version ".. version);
				easymother_check[EasyMother_GetRaidPlayerID(arg4)] = 1;
			end
		--IsRaidLeader() and   elseif ( string.find(arg1,EasyMother_Combatlog) and IsRaidLeader() and event == "CHAT_MSG_WHISPER") then
		elseif ( event == "COMBAT_LOG_EVENT_UNFILTERED" and arg2 == "SPELL_AURA_APPLIED" and arg9 == 41001 ) then
			if arg7 then
				if ( EasyMother_teleport["on"] ~= 1 ) then
					EasyMother_teleport["timer"] = 0;
					EasyMother_teleport["number"] = 0;
					EasyMother_teleport["on"] = 1;
				end
				EasyMother_teleport["number"] = EasyMother_teleport["number"]+1;
				SendAddonMessage("EASYMOTHER",arg7.." "..EasyMother_teleport["number"],"RAID");
			end
		end
	end
end
function EasyMother_GetRaidPlayerID( player1 )
	if ( string.find(player1, "raid") and type(tonumber(strsub(player1,5))) == "number" ) then
		return tonumber(strsub(player1,5));
	end
	player1 = string.lower(player1);
	for i=0, 40 do
		player = string.lower(tostring(UnitName("raid"..i)));
		if (player) then
			if (player == player1) then
				return i;
			end
		end
	end
	for i=0, 40 do
		player = string.lower(tostring(UnitName("raid"..i)));
		if (player) then
			if (string.find(player,player1.."(.+)")) then
				return i;
			end
		end
	end
	return false;
end
function EasyMother_GetWords(str,nr)
	local ret = {};
	local pos=0;
	while(true) do
		local word;
		_,pos,word=string.find(str, "^ *([^%s]+) *", pos+1);
		if(not word) then
			if (nr) then
				return ret[nr];
			else
				return ret;
			end
		end
		table.insert(ret, word);
	end
end

function EasyMother_Clear()
	EasyMotherLeftFrame:Hide();
	EasyMotherRightFrame:Hide();
	EasyMotherStopFrame:Hide();
	EasyMotherUpFrame:Hide();
	EasyMotherDownFrame:Hide();
	EasyMotherNewFrame:Hide();
	EasyMotherNewStopFrame:Hide();
end
function EasyMother_OnUpdate(arg1)
	easymother_check_time = easymother_check_time+arg1;
	if ( easymother_check_time > 3 and easymother_check_running == 1) then
		easymother_check_running = 0;
		for a=1,GetNumRaidMembers() do
			if (easymother_check[a] == 1) then
			else
				name,rank = GetRaidRosterInfo(a);
				if ( rank == 2 ) then
					DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FF0000WARNING: Raid Leader missing addon!|r");
				end
				easymother_check_players = easymother_check_players.." "..name;
			end
		end
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r "..easymother_check_number.." players have it.");
		if (easymother_check_players ~= "" ) then
			DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r |c00FF0000Missing:|r "..easymother_check_players);
		end
	end
	
	



	EasyMother_teleport["timer"] = EasyMother_teleport["timer"]+arg1;
	if ( EasyMother_teleport["timer"] > 7 and EasyMother_teleport["on"] == 1) then
		EasyMother_teleport["number"] = 0;
		EasyMother_teleport["on"] = 0;
		EasyMother_teleport["timer"] = 0;
	end

	EasyMother_test_timer = EasyMother_test_timer + arg1;
	if ( EasyMother_test_timer > 0 and EasyMother_test == 1 and EasyMother_test_boss == 1) then
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Testing -Boss Spawn-");
		EasyMother_mother["right"] = 1;
		EasyMother_mother["left"] = 0;
		EasyMother_mother["stop"] = 0;
		EasyMother_mother["on"] = 1;
		EasyMother_mother["timer"] = 0;
		EasyMother_test_boss = 0;
	elseif ( EasyMother_test_timer > 8 and EasyMother_test == 1 and EasyMother_test_door == 1) then
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Testing -Door-");
		EasyMother_mother["left"] = 1;
		EasyMother_mother["right"] = 0;
		EasyMother_mother["stop"] = 0;
		EasyMother_mother["on"] = 1;
		EasyMother_mother["timer"] = 0;
		EasyMother_test_door = 0;
	elseif ( EasyMother_test_timer > 16 and EasyMother_test == 1 and EasyMother_test_stay == 1) then
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Testing -STOP-");
		EasyMother_mother["stop"] = 1;
		EasyMother_mother["left"] = 0;
		EasyMother_mother["right"] = 0;
		EasyMother_mother["on"] = 1;
		EasyMother_mother["timer"] = 0;
		EasyMother_test_stay = 0;
	elseif ( EasyMother_test_timer > 24 and EasyMother_test == 1) then
		DEFAULT_CHAT_FRAME:AddMessage( "|c0000FF00[EasyMother]|r Test ended");
		EasyMother_test = 0;
		EasyMother_test_timer = 0;
	end


	EasyMother_mother["timer"] = EasyMother_mother["timer"] + arg1;
	if ( EasyMother_mother["on"] == 1 and EasyMother_mother["timer"] > 7) then
		EasyMother_mother["left"] = 0;
		EasyMother_mother["right"] = 0;
		EasyMother_mother["stop"] = 0;
		EasyMother_Clear();
		direction = 0;
	elseif ( EasyMother_mother["on"] == 1 and EasyMother_mother["timer"] > 8) then
		EasyMother_mother["timer"] = 0;
		EasyMother_mother["on"] = 0;
		EasyMother_mother["left"] = 0;
		EasyMother_mother["right"] = 0;
		EasyMother_mother["stop"] = 0;
		EasyMother_Clear();
		direction = 0;
	elseif ( EasyMother_mother["on"] == 1 and EasyMother_mode == 0) then
		if (playerModel:GetFacing() > 5.215 or playerModel:GetFacing() < 1.075) then
			direction = 1;
		elseif(playerModel:GetFacing() < 5.215 and playerModel:GetFacing() > 4.215) then
			direction = 2;
		elseif(playerModel:GetFacing() > 2.075 and playerModel:GetFacing() < 4.205) then
			direction = 3;
		elseif(playerModel:GetFacing() > 1.075 and playerModel:GetFacing() < 2.075) then
			direction = 4;
		end 
		EasyMother_Clear();
		if ( EasyMother_mother["right"] == 1) then
			if ( direction == 1) then
				EasyMotherRightFrame:Show();
			elseif ( direction == 2) then
				EasyMotherUpFrame:Show();
			elseif ( direction == 3) then
				EasyMotherLeftFrame:Show();
			elseif ( direction == 4) then
				EasyMotherDownFrame:Show();
			end
		elseif ( EasyMother_mother["left"] == 1 ) then

			if ( direction == 1) then
				EasyMotherLeftFrame:Show();
			elseif ( direction == 2) then
				EasyMotherDownFrame:Show();
			elseif ( direction == 3) then
				EasyMotherRightFrame:Show();
			elseif ( direction == 4) then
				EasyMotherUpFrame:Show();
			end
		elseif ( EasyMother_mother["stop"] == 1) then
			EasyMotherStopFrame:Show();
		end
	elseif ( EasyMother_mother["on"] == 1 and EasyMother_mode == 1)then
		EasyMother_Clear();
		EasyMother_NewUpdate();
	end
end

function EasyMother_NewUpdate()
	if (EasyMother_mother["stop"] == 1) then
		EasyMotherNewStopFrame:Show();
	else
		if (EasyMother_mother["left"] == 1) then
			dir = -playerModel:GetFacing()-1.57-3.14;	
		elseif (EasyMother_mother["right"] == 1 )then
			dir = -playerModel:GetFacing()-1.57;
		end
		EasyMotherNewFrame:Show();
		EasyMotherNewTexture:Show();
		EasyMotherNewFrame:SetScale(2.0);
		local val = (dir*54/math.pi + 108) % 108;
		local col, row = math.floor(val % 9), math.floor(val / 9);
		EasyMotherNewTexture:SetTexCoord(col*56/512, (col+1)*56/512, row*42/512, (row+1)*42/512);
		if (row == 0 or row == 11 ) then
			EasyMotherNewTexture:SetVertexColor(0,1,0,0.7);
		elseif (row == 4 or row == 5 or row == 6 ) then
			EasyMotherNewTexture:SetVertexColor(1,0,0,0.7);
		else
			EasyMotherNewTexture:SetVertexColor(255,255,0,0.7);
		end
	end
end

⌨️ 快捷键说明

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