Advertisement
horato

Buff

Nov 2nd, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.81 KB | None | 0 0
  1. allowed = true
  2.  
  3. function OnCreate()
  4.     this:RegisterCommand("buffer", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME)
  5. end;
  6.  
  7. function OnCommand_buffer(vCommandChatType, vNick, vCommandParam)
  8.     if ( allowed == false ) then
  9.         allowed = true;
  10.         ShowToClient("buffer", "ON")
  11.     else
  12.         allowed = false;
  13.         ShowToClient("buffer", "OFF");
  14.     end
  15. end;
  16.  
  17. function OnChatSystemMessage(id, msg)
  18.     if ( allowed == true ) then
  19.         if(isStartingWith(msg,"You have acquired")) then
  20.             members = GetPartyList();
  21.             for player in members.list do
  22.                 if(player:GetHp() < 2) then
  23.                     Command("/target "..player:GetName());
  24.                     Sleep(1000);
  25.                     Command("/useskill angel's resurrection");
  26.                     Sleep(1000);
  27.                     ClearTargets();
  28.                 end;
  29.             end;
  30.         end;
  31.     end;   
  32. end;
  33.  
  34. function OnChatUserMessage(chatType, nick, msg)
  35.     if ( allowed == true ) then
  36.         local caller = GetUserByName(nick);
  37.         local Message = string.lower(msg); -- Converts message to lower case letters.
  38.         Message = Message:gsub("^%s*(.-)%s*$", "%1"); -- Trimming message of spaces on start.
  39.         if (chatType == L2ChatType.CHAT_PARTY) then
  40.             if ((Message == "full") or (Message == "fullbuff") or (Message == "buffs") or (Message == "buffy") or (Message == "buff") or (Message == "melody")) and (GetPartyMaster():GetName() == nick) then
  41.                 Sleep (1000);
  42.                 Command("/useskill pipe organ melody");
  43.                 Sleep (1000);
  44.                 Command("/useskill drum melody");
  45.                 Sleep (1000);
  46.                 Command("/useskill guitar melody");
  47.                 Sleep (1000);
  48.                 Command("/useskill lute melody");
  49.                 Sleep (1000);
  50.                 Command("/useskill horn melody");
  51.                 Sleep (1000);
  52.                 Command("/useskill harp melody");
  53.                 Sleep (1000);
  54.                 --Command("/useskill divine protection");
  55.                 --Sleep (1000);
  56.                 --Command("/useskill elemental protection");
  57.                 Command("/useshortcut 4 7");
  58.                 Sleep (1000);
  59.                 Command("/useshortcut 4 8");
  60.                 Sleep (1000);
  61.                 Command("/useshortcut 4 9");
  62.                 --Command("/useskill mental protection");
  63.                 Sleep (1000);
  64.                 Command("/useskill refreshing sonata");
  65.                 Sleep (1000);
  66.                 Command("/useskill prevailing sonata");
  67.                 Sleep (1000);
  68.                 Command("/useskill daring sonata");
  69.             end;
  70.             if (Message == "knight") then
  71.                 Command("/target " .. nick);
  72.                 Sleep (1000);
  73.                 Command("/useskill knight's harmony");
  74.             end;
  75.             if (Message == "warrior") then
  76.                 Command("/target " .. nick);
  77.                 Sleep (1000);
  78.                 Command("/useskill warrior's harmony");
  79.             end;
  80.             if (Message == "wizard") then
  81.                 Command("/target " .. nick);
  82.                 Sleep (1000);
  83.                 Command("/useskill wizard's harmony");
  84.             end;
  85.             if(Message == "sonaty") or (Message == "sonata") or (Message == "sonatas") or (Message == "dance") or (Message == "dancy") or (Message == "dances") then
  86.                 Sleep (1000);
  87.                 Command("/useskill refreshing sonata");
  88.                 Sleep (1000);
  89.                 Command("/useskill prevailing sonata");
  90.                 Sleep (1000);
  91.                 Command("/useskill daring sonata");
  92.             end;
  93.             if (Message == "res") then
  94.                 Command("/target " .. nick);
  95.                 Sleep (1000);
  96.                 Command("/useskill angel's resurrection");
  97.             end;
  98.             if (Message == "heal") then
  99.                 Command("/target " .. nick);
  100.                 Sleep (1000);
  101.                 Command("/useskill healing melody");
  102.             end;
  103.             if (Message == "cpheal") then
  104.                 Command("/target " .. nick);
  105.                 Sleep (1000);
  106.                 Command("/useskill recovery melody");
  107.             end;
  108.         --  if (Message == "assistkill") then
  109.         --      Target(caller:GetTarget():GetNpcId());
  110.         --      Sleep (1000);
  111.         --      Command("/attack");
  112.         --  end;
  113.             if (Message == "followme") then
  114.                 Command("/target " .. nick);
  115.                 Sleep (100);
  116.                 Command("/target " .. nick);
  117.             end;
  118.             --and (GetPartyMaster():GetName() == nick)
  119.             if (Message == "debuff") then
  120.                 Sleep (1000);
  121.                 Command("/useshortcut 2 6");
  122.                 Sleep (1000);
  123.                 Command("/useshortcut 2 7");
  124.             end;
  125.             if (Message == "shadow") then
  126.                 Sleep (1000);
  127.                 Command("/useskill devil's movement");
  128.             end;
  129.     --      give xxx to yyy
  130.             if (isStartingWith(Message,"give")) then
  131.     --      split(Message, " ");
  132.                 local array = split(Message, " ");
  133.                 if (array[1] == "knight") then
  134.                     Command("/target " .. array[4]);
  135.                     Sleep (1000);
  136.                     Command("/useskill knight's harmony");
  137.                 end;
  138.                 if (array[1] == "warrior") then
  139.                     Command("/target " .. array[4]);
  140.                     Sleep (1000);
  141.                     Command("/useskill warrior's harmony");
  142.                 end;
  143.                 if (array[1] == "wizard") then
  144.                     Command("/target " .. array[4]);
  145.                     Sleep (1000);
  146.                     Command("/useskill wizard's harmony");
  147.                 end;
  148.                 if (array[1] == "res") then
  149.                     Command("/target " .. array[4]);
  150.                     Sleep (1000);
  151.                     Command("/useskill angel's resurrection");
  152.                 end;
  153.                 if (array[1] == "heal") then
  154.                     Command("/target " .. array[4]);
  155.                     Sleep (1000);
  156.                     Command("/useskill healing melody");
  157.                 end;
  158.                 if (array[1] == "cpheal") then
  159.                     Command("/target " .. array[4]);
  160.                     Sleep (1000);
  161.                     Command("/useskill recovery melody");
  162.                 end;
  163.             end;
  164.            
  165. --          if (Message == "cpheal full") then
  166. --              if(GetMe():GetMpPercent() < 40) then
  167. --                  Say2(L2ChatType.CHAT_PARTY,"no mp","");
  168. --              else
  169. --                  Command("/target " .. nick);
  170. --                  while(GetTarget():GetCpPercent() < 95) do
  171. --                      Sleep (1000);
  172.                         --ShowToClient("cpheal"," "..GetTarget():GetCpPercent());
  173. --                      Command("/useskill recovery melody");
  174. --                  end;
  175. --              end;
  176. --          end;
  177.         end;
  178.     end;
  179. end;
  180.  
  181. function isStartingWith(String,Start)
  182.    return string.sub(String,1,string.len(Start))==Start
  183. end;
  184.  
  185. function string.ends(String,End)
  186.    return End=='' or string.sub(String,-string.len(End))==End
  187. end;
  188.  
  189. function split(str, c)
  190. a = string.find(str, c)
  191. str = string.gsub(str, c, "", 1)
  192. aCount = 0
  193. start = 1
  194. array = {}
  195. last = 0
  196.    
  197.     while a do
  198.     array[aCount] = string.sub(str, start, a - 1)
  199.     start = a
  200.     a = string.find(str, c)
  201.    
  202.     str = string.gsub(str, c, "", 1)
  203.     aCount = aCount + 1
  204.     end
  205.    
  206. return array
  207. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement