Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- allowed = false
- buffy = false
- iss = ""
- IDbuff = {11517,11518,11519,11520,11521,11522}
- IDsonata = {11529,11530,11532}
- harmony = ""
- timer = 20
- function OnCreate()
- this:RegisterCommand("buffer", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME)
- this:RegisterCommand("iss", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME)
- end;
- function OnCommand_buffer(vCommandChatType, vNick, vCommandParam)
- if ( allowed == false ) then
- allowed = true;
- ShowToClient("buffer", "ON");
- else
- allowed = false;
- ShowToClient("buffer", "OFF");
- end;
- end;
- function OnCommand_iss(vCommandChatType, vNick, vCommandParam)
- if ( vCommandParam:GetCount() ~= 1 ) then
- ShowToClient("iss", "Bad input. Usage: //iss_[\"off\"|nickname]");
- return;
- end;
- local parameter = tostring(vCommandParam:GetParam(0):GetStr(true));
- if parameter == "off" then
- buffy = false;
- ShowToClient("iss", "OFF");
- return;
- end;
- buffy = true;
- harmony = ""
- iss = parameter;
- ShowToClient("iss", "ON: Buff requests will be sent to "..iss..".");
- end;
- function OnLTick1s()
- if(buffy == false) then
- return;
- end;
- timer = timer-1;
- if(timer > 0) then
- return;
- end;
- timer = 20;
- local count = GetMe():GetBuffsCount();
- local needRebuff = false;
- local needSonatas = false;
- for i=0,count-1,1 do
- local buff = GetMe():GetBuffByIdx(i);
- if(buff.endTime-GetTime() < 30000) then
- if(inTable(IDbuff,buff.skillId)) then
- needRebuff = true
- elseif(inTable(IDsonata,buff.skillId)) then
- needSonatas = true
- end;
- if(buff.skillId == 11523) then
- harmony = "knight"
- elseif(buff.skillId == 11524) then
- harmony = "warrior"
- elseif(buff.skillId == 11525) then
- harmony = "wizard"
- end;
- end;
- end;
- issUser = nil
- for user in GetPlayerList().list do
- if(user:GetName():lower() == iss:lower()) then
- issUser = user;
- end;
- end;
- if(issUser == nil) then
- return;
- end;
- if(issUser:IsMyPartyMember()) then
- return;
- end;
- if(needRebuff == true) then
- Command("/invite "..iss);
- Sleep(5000);
- SendPM(iss, ""..harmony);
- SendPM(iss, "fullleave");
- elseif(needSonatas == true) then
- Command("/invite "..iss);
- Sleep(5000);
- SendPM(iss, ""..harmony);
- SendPM(iss, "danceleave");
- end;
- end;
- function OnChatSystemMessage(id, msg)
- if ( allowed == true ) then
- if(isStartingWith(msg,"You have acquired")) then
- members = GetPartyList();
- for player in members.list do
- if(player:GetHp() < 2) then
- Command("/target "..player:GetName());
- Sleep(1000);
- Command("/useskill angel's resurrection");
- Sleep(1000);
- ClearTargets();
- end;
- end;
- end;
- end;
- end;
- function OnChatUserMessage(chatType, nick, msg)
- if ( allowed == true ) then
- local caller = GetUserByName(nick);
- local Message = string.lower(msg); -- Converts message to lower case letters.
- Message = Message:gsub("^%s*(.-)%s*$", "%1"); -- Trimming message of spaces on start.
- if (chatType == L2ChatType.CHAT_TELL) then
- if (Message == "summon mentor" or Message == "mentor summon") then
- Command("/useskill Mentee's Mentor Summon" .. nick);
- end;
- if (Message == "invite") then
- Command("/invite " .. nick);
- end;
- if (Message == "heal") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill healing melody");
- end;
- if (Message == "fullleave" and caller:IsMyPartyMember()) then
- Sleep (1000);
- Command("/useskill pipe organ melody");
- Sleep (1000);
- Command("/useskill drum melody");
- Sleep (1000);
- Command("/useskill guitar melody");
- Sleep (1000);
- Command("/useskill lute melody");
- Sleep (1000);
- Command("/useskill horn melody");
- Sleep (1000);
- Command("/useskill harp melody");
- Sleep (1000);
- --Command("/useskill divine protection");
- --Sleep (1000);
- --Command("/useskill elemental protection");
- Command("/useshortcut 4 7");
- Sleep (1000);
- Command("/useshortcut 4 8");
- Sleep (1000);
- Command("/useshortcut 4 9");
- --Command("/useskill mental protection");
- Sleep (1000);
- Command("/useskill refreshing sonata");
- Sleep (1000);
- Command("/useskill prevailing sonata");
- Sleep (1000);
- Command("/useskill daring sonata");
- Sleep (1000);
- Command("/leave");
- end;
- if (Message == "knight" and caller:IsMyPartyMember()) then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill knight's harmony");
- Sleep (1000);
- Command("/leave");
- end;
- if (Message == "warrior" and caller:IsMyPartyMember()) then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill warrior's harmony");
- Sleep (1000);
- Command("/leave");
- end;
- if (Message == "wizard" and caller:IsMyPartyMember()) then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill wizard's harmony");
- Sleep (1000);
- Command("/leave");
- end;
- if(Message == "danceleave" and caller:IsMyPartyMember()) then
- Sleep (1000);
- Command("/useskill refreshing sonata");
- Sleep (1000);
- Command("/useskill prevailing sonata");
- Sleep (1000);
- Command("/useskill daring sonata");
- Sleep (1000);
- Command("/leave");
- end;
- end;
- if (chatType == L2ChatType.CHAT_PARTY) then
- if ((Message == "full") or (Message == "fullbuff") or (Message == "buffs") or (Message == "buffy") or (Message == "buff") or (Message == "melody") or (Message == "fullleave")) and (GetPartyMaster():GetName() == nick) then
- Sleep (1000);
- Command("/useskill pipe organ melody");
- Sleep (1000);
- Command("/useskill drum melody");
- Sleep (1000);
- Command("/useskill guitar melody");
- Sleep (1000);
- Command("/useskill lute melody");
- Sleep (1000);
- Command("/useskill horn melody");
- Sleep (1000);
- Command("/useskill harp melody");
- Sleep (1000);
- --Command("/useskill divine protection");
- --Sleep (1000);
- --Command("/useskill elemental protection");
- Command("/useshortcut 4 7");
- Sleep (1000);
- Command("/useshortcut 4 8");
- Sleep (1000);
- Command("/useshortcut 4 9");
- --Command("/useskill mental protection");
- Sleep (1000);
- Command("/useskill refreshing sonata");
- Sleep (1000);
- Command("/useskill prevailing sonata");
- Sleep (1000);
- Command("/useskill daring sonata");
- Sleep (1000);
- if(Message == "fullleave") then
- Command("/leave");
- end;
- end;
- if (Message == "knight" or Message == "knightleave") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill knight's harmony");
- Sleep (1000);
- if(Message == "knightleave") then
- Command("/leave");
- end;
- end;
- if (Message == "warrior" or Message == "warriorleave") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill warrior's harmony");
- Sleep (1000);
- if(Message == "warriorleave") then
- Command("/leave");
- end;
- end;
- if (Message == "wizard" or Message == "wizardleave") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill wizard's harmony");
- Sleep (1000);
- if(Message == "wizardleave") then
- Command("/leave");
- end;
- end;
- if(Message == "sonaty") or (Message == "sonata") or (Message == "sonatas") or (Message == "dance") or (Message == "dancy") or (Message == "dances") or (Message == "danceleave") then
- Sleep (1000);
- Command("/useskill refreshing sonata");
- Sleep (1000);
- Command("/useskill prevailing sonata");
- Sleep (1000);
- Command("/useskill daring sonata");
- Sleep (1000);
- if(Message == "danceleave") then
- Command("/leave");
- end;
- end;
- if (Message == "res") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill angel's resurrection");
- end;
- if (Message == "heal") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill healing melody");
- end;
- if (Message == "cpheal") then
- Command("/target " .. nick);
- Sleep (1000);
- Command("/useskill recovery melody");
- end;
- if (Message == "followme") then
- Command("/target " .. nick);
- Sleep (100);
- Command("/target " .. nick);
- end;
- --and (GetPartyMaster():GetName() == nick)
- if (Message == "debuff") then
- Sleep (1000);
- Command("/useshortcut 2 6");
- Sleep (1000);
- Command("/useshortcut 2 7");
- end;
- if (Message == "shadow") then
- Sleep (1000);
- Command("/useskill devil's movement");
- end;
- -- give xxx to yyy
- if (isStartingWith(Message,"give")) then
- -- split(Message, " ");
- local array = split(Message, " ");
- if (array[1] == "knight") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill knight's harmony");
- end;
- if (array[1] == "warrior") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill warrior's harmony");
- end;
- if (array[1] == "wizard") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill wizard's harmony");
- end;
- if (array[1] == "res") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill angel's resurrection");
- end;
- if (array[1] == "heal") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill healing melody");
- end;
- if (array[1] == "cpheal") then
- Command("/target " .. array[4]);
- Sleep (1000);
- Command("/useskill recovery melody");
- end;
- end;
- -- jebat to
- -- if (Message == "cpheal full") then
- -- if(GetMe():GetMpPercent() < 40) then
- -- Say2(L2ChatType.CHAT_PARTY,"no mp","");
- -- else
- -- Command("/target " .. nick);
- -- while(GetTarget():GetCpPercent() < 95) do
- -- Sleep (1000);
- --ShowToClient("cpheal"," "..GetTarget():GetCpPercent());
- -- Command("/useskill recovery melody");
- -- end;
- -- end;
- -- end;
- end;
- end;
- end;
- function inTable(tbl, item)
- for key, value in pairs(tbl) do
- if value == item then return true end
- end
- return false
- end
- function isStartingWith(String,Start)
- return string.sub(String,1,string.len(Start))==Start
- end;
- function string.ends(String,End)
- return End=='' or string.sub(String,-string.len(End))==End
- end;
- function split(str, c)
- a = string.find(str, c)
- str = string.gsub(str, c, "", 1)
- aCount = 0
- start = 1
- array = {}
- last = 0
- while a do
- array[aCount] = string.sub(str, start, a - 1)
- start = a
- a = string.find(str, c)
- str = string.gsub(str, c, "", 1)
- aCount = aCount + 1
- end
- return array
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement