Advertisement
johnlol

arena_master

May 2nd, 2019
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VeriLog 55.36 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Arena Master
  3. //===== By ===================================================
  4. //= llchrisll
  5. //===== Version ==============================================
  6. //= 1.0 - Initial Version
  7. //        Added Multi Kill & SoundEffects
  8. //        Added Bounty & Promotion Feature
  9. //        Fully tested & Rewritten most of the code
  10. //        - Since it didn't wanted to work like I wanted
  11. //        - Couldn't test the Party PvP option though.
  12. //        Added a bonus at the bounty feature
  13. //        - If an player gains a "$@bty_bon_start" spree, "$@bty_bonus"
  14. //          will be given to the player, who kill him/her.
  15. //= 1.1 - Fixxed an Bounty bug - Thanks to raijin91
  16. //          = Also the bounty bonus wasn't added, kinda forgot that it seems
  17. //      - Changed the First Blood part
  18. //      - Changed the Chat blocking part
  19. //      - Shorted the sphree part a bit, still testing it.
  20. //      - Added an Cost Multiplier for the shop to adjust the prices for Mid Rate and higher Servers.
  21. //      - Added another function to get the map users in each room and each pvp.
  22. //= 1.2 - Compatible with rAthena
  23. //      - Fixed some bugs
  24. //= 1.3 - Made the Sphree Announcer dynamically
  25. //      - Made modification regarding the sphree ranking, removed doPromote; function
  26. //      - Shorted the ranking display choices
  27. //= 1.4 - Moved writeStats; into the kill part, bug with Logout prevented from saving in ranking
  28. //      - Fixed an bug with "First Blood" announcer
  29. //      - Updated the MvP Ranker to rAthena, @getmonsterinfo has an check for MvP EXP now
  30. //        - Removed limitation to MvP Arena, against every MvP useable now
  31. //      - Fixxed Ranking bug, didn't save Kills and stuff correctly.
  32. //      - Added an addtional Player Counter for each PvP Room
  33. //      - Added Class Limitation regarding 3rd Jobs
  34. //      - Fixxed an bug with Auto-Resurrect on Deathmatch Maps
  35. //      - Fixxed another Ranking bug, didn't display correctly
  36. //= 1.5 - Added Custom Bounty Map Feature, see line around '861'
  37. //      - Added to the Bounty Hunter an Locater, which locates the player...
  38. //      - Fixxed an bug about the Bounty Hunter, forgot to reset the @hunt variable
  39. //      - Removed First Blood completely
  40. //      - Removed Chat Block part completely + OnPCMapLoadEvent
  41. //      - Fixxed an Arena Shop bug by using $@arena_pay = 2 (Permanent Price Array) - Thanks to Lelantos for the bug report
  42. //      - Rewrote the whole check at the Party PvP, also fixxed the check for
  43. //        online party member counting > misplaced the variables for "isloggedin" ... - Thanks to Lelantos for the bug report
  44. //= 1.6 - Reduced PvP Rooms by adding Map Rotation Settings; Fixed Maps + Random Map each Day + Specific Map on an specific Day
  45. //      - Removed the Player Limitation except Party PvP
  46. //      - Reduced GvG Maps to 3
  47. //      - Removed the functions getPvPMapUsers and getPartyMapUsers
  48. //      - Added an announcer on Room Entry
  49. //      - Added in Party PvP an display how many parties are in which room before joining
  50. //      - Fixed minor bugs
  51. //      - Exchanged #CASHPOINTS Reward with Custom Variable Support, you can decide now
  52. //      - Modified the Arena Shop Multiplier by using an array to decide it for each Item seperatly
  53. //      - Moved the Arena Shop Config to the Arena Master NPC and made $@arena_ to .arena_ or .@arena_ variables
  54. //===== Tested With =========================================
  55. //= rAthena SQL 07/16-2017 Revision
  56. //===== Description ==========================================
  57. //= PvP / GvG Arenas with ranking ladder & MvP Ranker.
  58. //= PvP Types:
  59. //  - Normal
  60. //  - Dispell: You'll be dispelled on Room entry.
  61. //  - Deathmatch: You'll be auto resurrect when you die.
  62. //    If you type @die, get comaed and similar, you'll be warped to your save point.
  63. //  - Party PvP: 2vs2, 3vs3, 4vs4, 5vs5
  64. //  -----------------------------------------------
  65. //= GvG: 3 Arenas, the default guild_vs1 - guild_vs3.
  66. //===== Comments & Credits =============================================
  67. // = Thanks to Lelantos for the idea of the Custom Bounty Map Feature
  68. //===== MySQL Entries ========================================
  69. /*
  70. // v1.0
  71. DROP TABLE IF EXISTS `arena_master`;
  72. CREATE TABLE `arena_master` (
  73.   `char_id` int(10) unsigned NOT NULL,
  74.   `kills` smallint(5) unsigned DEFAULT '0',
  75.   `death` smallint(5) unsigned DEFAULT '0',
  76.   `hscore` smallint(5) unsigned DEFAULT '0',
  77.   `bounty` smallint(5) unsigned DEFAULT '0',
  78.   `bounty_pts` smallint(5) unsigned DEFAULT '0',
  79.   `killer` smallint(5) unsigned DEFAULT '0',
  80.   `domi` smallint(5) unsigned DEFAULT '0',
  81.   `mega` smallint(5) unsigned DEFAULT '0',
  82.   `unstopp` smallint(5) unsigned DEFAULT '0',
  83.   `wicked` smallint(5) unsigned DEFAULT '0',
  84.   `monster` smallint(5) unsigned DEFAULT '0',
  85.   `godlike` smallint(5) unsigned DEFAULT '0',
  86.   `holys` smallint(5) unsigned DEFAULT '0',
  87.   `mvp` smallint(5) unsigned DEFAULT '0',
  88. PRIMARY KEY (`char_id`)
  89. ) ENGINE=MyISAM;
  90. */
  91. //=============== ToDo List ==========================
  92. //= Maybe adding a even more detailed class limitation, but just maybe
  93. //============================================================
  94. // ================= Arena Master ================== //
  95. prontera,147,159,6  script  Arena Master    808,{
  96.  
  97. mes .n$;
  98. mes "Hello, "+strcharinfo(0)+"!";
  99. if(getgmlevel() > 79)
  100.     if(select("- GM Menu:- Player Menu") == 1)
  101.         goto GM_Menu;
  102. if($@pvpgvg_load == 1) {
  103.     mes "I'm sorry, but the Arena and it's features are not available yet. Try again in a few minutes please.";
  104.     close;
  105. }
  106. mes "How can I help you?";
  107. mes "Ranking Status: "+ ( ($@pvptable)?"Enabled":"Disabled");
  108. next;
  109. switch(select("- Arenas:- Rankings:- Arena Shop:- Information:- Nevermind")) {
  110.    
  111. // Arenas
  112.     case 1:
  113.     set @sphr,0;
  114.     set @bty,0;
  115.     set @killct,0;
  116.     mes .n$;
  117.     mes "In which arena do you want to fight?";
  118.     next;
  119.     switch(select("- PvP:- GvG:- Nevermind")) {
  120. // PvP
  121.         case 1:
  122.         mes .n$;
  123.         mes "Please choose the PvP Type:";
  124.         mes "In the \"()\" stands, if 3rd Jobs, only 3rd Jobs or All Jobs are allowed to enter.";
  125.         next;
  126.         switch($@class_disp[$disppvp_map]) {
  127.             case 0: set .@m_pvpdisp$,"No 3rd Jobs"; break;
  128.             case 1: set .@m_pvpdisp$,"Only 3rd Jobs"; break;
  129.             case 2: set .@m_pvpdisp$,"All Jobs"; break;
  130.         }
  131.         switch($@class_n[$npvp_map]) {
  132.             case 0: set .@m_pvpn$,"No 3rd Jobs"; break;
  133.             case 1: set .@m_pvpn$,"Only 3rd Jobs"; break;
  134.             case 2: set .@m_pvpn$,"All Jobs"; break;
  135.         }
  136.         switch($@class_dm[$dmpvp_map]) {
  137.             case 0: set .@m_pvpdm$,"No 3rd Jobs"; break;
  138.             case 1: set .@m_pvpdm$,"Only 3rd Jobs"; break;
  139.             case 2: set .@m_pvpdm$,"All Jobs"; break;
  140.         }
  141.         switch(select("- PvP Dispell ["+getmapusers($@disppvp$[$disppvp_map])+"] ("+.@m_pvpdisp$+"):- Normal PvP ["+getmapusers($@npvp$[$npvp_map])+"] ("+.@m_pvpn$+"):- PvP Deathmatch["+getmapusers($@dmpvp$[$dmpvp_map])+"] ("+.@m_pvpdm$+"):- Party PvP")) {
  142.        
  143.             // PvP Dispell
  144.             case 1:
  145.             mes .n$;
  146.             if($@class_disp[$disppvp_map] == 0 && eaclass()&EAJL_THIRD) {
  147.                 mes "I'm sorry, but 3rd Classes are not allowed in this PvP Room.";
  148.                 close;
  149.             } else if($@class_disp[$disppvp_map] == 1 && !(eaclass()&EAJL_THIRD)) {
  150.                 mes "I'm sorry, but only 3rd Classes are allowed in this PvP Room.";
  151.                 close;
  152.             }
  153.             mes "I'll warp you now to the PvP Room, also remove all your buffs.";
  154.             close2;
  155.             sc_end SC_ALL; // Remove every kind of buff
  156.             warp $@disppvp$[$disppvp_map],0,0;
  157.             announce "["+strcharinfo(0)+"] has entered the PvP Dispell Arena!",0;
  158.             end;
  159.            
  160.             //PvP Normal
  161.             case 2:
  162.             mes .n$;
  163.             if($@class_n[$npvp_map] == 0 && eaclass()&EAJL_THIRD) {
  164.                 mes "I'm sorry, but 3rd Classes are not allowed in this PvP Room.";
  165.                 close;
  166.             } else if($@class_n[$npvp_map] == 1 && !(eaclass()&EAJL_THIRD)) {
  167.                 mes "I'm sorry, but only 3rd Classes are allowed in this PvP Room.";
  168.                 close;
  169.             }
  170.             mes "I'll warp you now to the Normal PvP Room.";
  171.             close2;
  172.             warp $@npvp$[$npvp_map],0,0;
  173.             announce "["+strcharinfo(0)+"] has entered the Normal PvP Arena",0;
  174.             end;
  175.            
  176.             // PvP DM  
  177.             case 3:
  178.             mes .n$;
  179.             if($@class_dm[$dmpvp_map] == 0 && eaclass()&EAJL_THIRD) {
  180.                 mes "I'm sorry, but 3rd Classes are not allowed in this PvP Room.";
  181.                 close;
  182.             } else if($@class_dm[$dmpvp_map] == 1 && !(eaclass()&EAJL_THIRD)) {
  183.                 mes "I'm sorry, but only 3rd Classes are allowed in this PvP Room.";
  184.                 close;
  185.             }
  186.             mes "I'll warp you now to the PvP Deathmatch Room.";
  187.             close2;
  188.             set @dm,1;
  189.             warp $dmpvp$[$dmpvp_map],0,0;
  190.             announce "["+strcharinfo(0)+"] has entered the PvP Deathmatch Arena!",0;
  191.             end;
  192.        
  193.             // Party PvP
  194.             case 4:
  195.             mes .n$;
  196.             if(!getcharid(1)) {
  197.                 mes "I'm sorry, but you are not in a party.";
  198.                 mes "Please come back as soon you have found one.";
  199.                 close;
  200.             }
  201.             if(getpartyleader(getcharid(1)) != strcharinfo(0)) {
  202.                 mes "I'm sorry, but only your leader can register your party.";
  203.                 close;
  204.             }
  205.             mes "Parties in Rooms:";
  206.             mes "2vs2: "+getmapusers($@pt2pvp$[$pt2pvp_map])/2;
  207.             mes "3vs3: "+getmapusers($@pt3pvp$[$pt3pvp_map])/3;
  208.             mes "4vs4: "+getmapusers($@pt4pvp$[$pt4pvp_map])/4;
  209.             mes "5vs5: "+getmapusers($@pt5pvp$[$pt5pvp_map])/5;
  210.             next;
  211.             mes .n$;
  212.             set @pty_id,getcharid(1);
  213.             getpartymember(@pty_id,1);
  214.             getpartymember(@pty_id,2);
  215.             set @ptymem,$@partymembercount;
  216.             copyarray @ptymemid[0],$@partymembercid,@ptymem; // Char ID
  217.             copyarray @ptymemaid[0],$@partymemberaid,@ptymem; // Account ID
  218.             set .@pt_ct,0;
  219.             for ( set .@pm,0; .@pm < @ptymem; set .@pm,.@pm + 1)
  220.                 if( isloggedin(@ptymemaid[.@pm],@ptymemid[.@pm]) == 1)
  221.                     set .@pt_ct,.@pt_ct + 1;
  222.  
  223.             if(.@pt_ct < 2) {
  224.                 mes "It seems like you don't the required members for the Party vs Party Mode.";
  225.                 mes "You need at least two players, which have to be online, to be able to participate.";
  226.                 close;
  227.             }
  228.             set .@pt,.@pt_ct;
  229.             mes "Chosen Party vs Party Mode:";
  230.             mes .@pt+"vs"+.@pt+" Party PvP";
  231.             mes "Class Restriction:";
  232.             switch( getd("$@class_p"+.@pt+"["+getd("$pt"+.@pt+"pvp_map")+"]") ) {
  233.                 case 0: mes "No 3rd Jobs allowed"; break;
  234.                 case 1: mes "Only 3rd Jobs allowed"; break;
  235.                 case 2: mes "All Jobs allowed"; break;
  236.             }
  237.             next;
  238.             mes .n$;
  239.             if(getmapusers(getd("$@pt"+.@pt+"pvp$["+getd("$pt"+.@pt+"pvp_map")+"]")) >= (.@pt+.@pt)) {
  240.                 mes "I'm sorry, but the "+.@pt+"vs"+.@pt+" Arena is already full.";
  241.                 mes "Please come back later.";
  242.                 close;
  243.             }
  244.             getpartymember(@pty_id,1);
  245.             getpartymember(@pty_id,2);
  246.             set @ptymem,$@partymembercount;
  247.             copyarray @ptymemid[0],$@partymembercid,@ptymem; // Char ID
  248.             copyarray @ptymemaid[0],$@partymemberaid,@ptymem; // Account ID
  249.             for ( set .@pm,0; .@pm < @ptymem; set .@pm,.@pm + 1)
  250.                 if(isloggedin(@ptymemaid[.@pm],@ptymemid[.@pm]) == 1)
  251.                     if(getd("$@class_p"+.@pt+"["+getd("$pt"+.@pt+"pvp_map")+"]") == 0 && eaclass()&EAJL_THIRD) {
  252.                         mes "I'm sorry, but 3rd Classes are not allowed in this PvP Room.";
  253.                         close;
  254.                     } else if(getd("$@class_p"+.@pt+"["+getd("$pt"+.@pt+"pvp_map")+"]") == 1 && !(eaclass()&EAJL_THIRD)) {
  255.                         mes "I'm sorry, but only 3rd Classes are allowed in this PvP Room.";
  256.                         close;
  257.                     }
  258.             mes "I'll warp your party now.";
  259.             mes "Good luck.";
  260.             close2;
  261.             warpparty getd("$@pt"+.@pt+"pvp$["+getd("$pt"+.@pt+"pvp_map")+"]"),0,0,@pty_id;
  262.             announce "The Party ["+getpartyname(getcharid(1))+"] has entered the "+.@pt+"vs"+.@pt+" Party PvP Arena!",0;
  263.             end;
  264.         }
  265.         break;
  266.    
  267.         // GvG
  268.         case 2:
  269.         mes .n$;
  270.         if(!getcharid(2)) {
  271.             mes "I'm sorry, but you are not in a guild.";
  272.             close;
  273.         }
  274.         mes "Please choose the room you want to join:";
  275.         next;
  276.         set .@rchoi,select("- GvG 1 ["+getmapusers($@gvgr$[0])+"]:- GvG 2 ["+getmapusers($@gvgr$[1])+"]:- GvG 3 ["+getmapusers($@gvgr$[2])+"]") - 1;
  277.         mes .n$;
  278.         mes "I will warp you now.";
  279.         close2;
  280.         warp $@gvgr$[.@rchoi],0,0;
  281.         end;
  282.         break;
  283.        
  284.     // Nevermind
  285.         case 3:
  286.         goto R_Bye;
  287.         break;
  288.     }
  289.  
  290. // Ranking
  291.     case 2:
  292.     mes .n$;
  293.     if(!$@pvptable) {
  294.         mes "I'm sorry, the ranking system is offline and thus I can't show you any ranking.";
  295.         close;
  296.     }
  297.     mes "Which ranking do you wanna see?";
  298.     next;
  299.    
  300.     set .@rank,select("- Kills:- Deaths:- High Scores:- Killing Sphree:- Dominating:- Mega Kill:- Unstoppable:- Wicked Sick:- Monster Kill:- GodLike:- Holy Sh1t:- MvP");
  301.     if(.@rank > 3 && .@rank < 12) // PvP Sphree Rankers
  302.         set .@listr$,$@sphree_rank$[.@rank-4];
  303.     else if(.@rank == 12) // MvP Hunters
  304.         set .@listr$,"mvp";
  305.     else { // PvP General K/D/High Score Rankers
  306.         setarray .@db_rank$[0],"kills","death","hscore";
  307.         set .@listr$,.@db_rank$[.@rank-1];
  308.     }
  309.     mes .n$;
  310.     mes "Which list do you want to see?";
  311.     next;
  312.     set .@limit,select("- Top 5:- Top 10:- Top 15:- Top 20:- Top 25:- Top 30:- Nevermind") * 5;
  313.     if(.@limit == 35)
  314.         goto R_Bye;
  315.        
  316.     mes .n$;
  317.     mes "Ranking:";
  318.     switch(.@rank) {
  319.  
  320.         case 1: mes set(.@rankn$,"Top "+.@limit+" Killers");    set .@rankt$,"Kills";   break;
  321.         case 2: mes set(.@rankn$,"Top "+.@limit+" Victims");    set .@rankt$,"Deaths";  break;
  322.         case 3: mes set(.@rankn$,"Top "+.@limit+" High Scores");    set .@rankt$,"High Score";  break;
  323.         case 12: mes set(.@rankn$,"Top "+.@limit+" MvP Hunters");   set .@rankt$,"MvP Kills";   break;
  324.         default:    mes set(.@rankn$,"Top "+.@limit+" "+$@sphree_names$[@rank-4]+" Rankers");   set .@rankt$,$@sphree_names$[.@rank-4]+"s"; break;
  325.     }
  326.     mes "Correct?";
  327.     next;
  328.     if(select("- Yes:- No") == 2) goto R_Bye;
  329.     mes .n$;
  330.     mes "I will now list the ranking in your Chat Box.";
  331.     close2;
  332.     dispbottom "======= "+.@rankn$+" ===========";
  333.     dispbottom "Player Name:    "+.@rankt$;
  334.     if(query_sql("SELECT `char_id` , `"+.@listr$+"` FROM `arena_master` WHERE `"+.@listr$+"` > 0 ORDER BY `"+.@listr$+"` DESC LIMIT "+.@limit,.@ch_id,.@sh_r) == 0) {
  335.         dispbottom "No Player found.";
  336.         end;
  337.     }
  338.     for( set .@r,0; .@r < getarraysize(.@sh_r); set .@r,.@r + 1) {
  339.         query_sql "SELECT `name` FROM `char` WHERE `char_id` = '"+.@ch_id[.@r]+"'",.@ch_na$;
  340.         dispbottom .@ch_na$+":    "+.@sh_r[.@r];
  341.     }
  342.     end;
  343.    
  344. // Arena Shop
  345.     case 3:
  346.     mes .n$;
  347.     mes "Hello, I can sell your useful items for the daily PvP need and more.";
  348.     mes "Depending on the bounty, I will open the respective shop.";
  349.     switch($@bty_type) {
  350.        
  351.         case 0:
  352.         next;
  353.         mes .n$;
  354.         mes "I'm sorry, but the bounty feature is not enabled.";
  355.         close;
  356.        
  357.         case 1:
  358.         dispbottom "[Arena Shop]: I will now open the Bounty Shop, which uses \"Zeny\" as payment.";
  359.         break;
  360.        
  361.         case 2:
  362.         dispbottom "[Arena Shop]: I will now open the Bounty Shop, which uses \""+$@bty_cvard$+"\" as payment.";
  363.         dispbottom "[Arena Shop]: You have "+getd(""+$@bty_cvarn$)+" "+$@bty_cvard$+".";
  364.         break;
  365.        
  366.         case 3:
  367.         set @pts,0;
  368.         dispbottom "[Arena Shop]: I will now open the Bounty Shop, which uses \"Bounty Points\" as payment.";
  369.         query_sql "SELECT `bounty_pts` FROM `arena_master` WHERE `char_id` = '"+getcharid(0)+"'",@pts;
  370.         dispbottom "[Arena Shop]: You have "+@pts+" Bounty Points.";
  371.         break;
  372.     }
  373.     close2;
  374.     callshop "Arena_Shop",1;
  375.     npcshopattach "Arena_Shop";
  376.     end;
  377.  
  378.     OnBuyItem:
  379.     for( set @s,0; @s < getarraysize(@bought_nameid); set @s,@s + 1) {
  380.         for( set @i,0; @i < getarraysize(.arena_sh); set @i,@i + 1) {
  381.             if(@bought_nameid[@s] == .arena_sh[@i]) {
  382.                 if(checkweight(@bought_nameid[@s],@bought_quantity[@s]) == 1) {
  383.                     set @c_item,(@bought_quantity[@s]*.arena_ar[@i]);
  384.                     set @total,(@total + @c_item);
  385.                     break;
  386.                 } else {
  387.                     dispbottom "[Arena Shop]: You have reached your weight limit, lose some weight and come back please.";
  388.                     end;
  389.                 }
  390.             }
  391.         }
  392.     }
  393.     switch($@bty_type) {
  394.  
  395.         case 1:
  396.         if(Zeny >= @total) set Zeny,Zeny - @total;
  397.         else dispbottom "[Arena Shop]:You don't have enough Zeny.";
  398.         break;
  399.        
  400.         case 2:
  401.         if(getd(""+$@bty_cvarn$) >= @total) setd(""+$@bty_cvarn$),getd(""+$@bty_cvarn$) - @total;
  402.         else dispbottom "[Arena Shop]:You don't have enough "+$@bty_cvard$+", currently "+getd(""+$@bty_cvarn$)+".";
  403.         break;
  404.        
  405.         case 3:
  406.         if(@pts >= @total) query_sql "UPDATE `arena_master` SET `bounty_pts` = `bounty_pts` - "+@total+" WHERE `char_id` = '"+getcharid(0)+"'";
  407.         else dispbottom "[Arena Shop]:You don't have enough Bounty Points, currently "+@pts;
  408.         break;
  409.     }
  410.    
  411.     for ( set @b,0; @b < getarraysize(@bought_nameid); set @b,@b + 1)
  412.         getitem @bought_nameid[@b],@bought_quantity[@b];
  413.  
  414.     set @total,0;
  415.     deletearray @bought_nameid[0],getarraysize(@bought_nameid);
  416.     deletearray @bought_quantity[0],getarraysize(@bought_quantity);
  417.     end;
  418.    
  419. // Information
  420.     case 4:
  421.     mes .n$;
  422.     mes "What do you want to know about?";
  423.     next;
  424.     switch(select("- PvP:- GvG:- Sphree:- Ranking:- Bounty Feature:- Nevermind")) {
  425.        
  426.         case 1:
  427.         mes "[=== PvP ===]";
  428.         mes "PvP Types:";
  429.         mes " - Normal";
  430.         mes " - Dispell";
  431.         mes " - Deathmatch";
  432.         mes " - Party PvP:";
  433.         mes "   - 2vs2";
  434.         mes "   - 3vs3";
  435.         mes "   - 4vs4";
  436.         mes "   - 5vs5";
  437.         next;
  438.         mes "[=== PvP ===]";
  439.         mes "Dispell PvP:";
  440.         mes " - You'll be dispelled, when you enter the room.";
  441.         mes " ";
  442.         mes "Deathmatch PvP:";
  443.         mes " - You'll be auto-resurrect on death, except you type @die, get comaed or similar, then you'll be warped to your savepoint.";
  444.         close;
  445.        
  446.         case 2:
  447.         mes "[=== GvG ===]";
  448.         mes "In these rooms, you can see what WoE would look like.";
  449.         close;
  450.        
  451.         case 3:
  452.         mes "[=== Sphree ===]";
  453.         mes "Sphree - Required Kills.";
  454.         mes "First Blood - 1";
  455.         for ( set .@s,0; .@s < getarraysize($@sphree_names$); set .@s,.@s + 1)
  456.             mes $@sphree_names$[.@s] +" - "+$@sphree_kills[.@s];
  457.        
  458.         next;
  459.         mes "[=== Sphree ===]";
  460.         mes "For each sphree you accomplish, except First Blood, you gain an point for the bounty feature, if it has been activated.";
  461.         mes "For more ask me about the Bounty Feature.";
  462.         next;
  463.         mes "[=== Sphree ===]";
  464.         mes "Also there is the Multi Kill Sphrees, but you won't recieve points for them.";
  465.         mes "The time span you can achieve them is "+ $@multi/1000+" seconds.";
  466.         next;
  467.         mes "[=== Sphree ===]";
  468.         mes "In this time you, if you kill";
  469.         mes " - one more player = Double Kill";
  470.         mes " - two more players = Triple Kill";
  471.         mes " - three or more players = Ultra Kill";
  472.         close;
  473.        
  474.         case 4:
  475.         mes "[=== Ranking ===]";
  476.         mes "Kills, Deaths, Sphree Counts (like Killing Sphree), the highest kill count till you died and lists it in either a Top 5, 10, 15, 20, 25 or a Top 30 List with the wanted information you have chosen.";
  477.         close;
  478.        
  479.         case 5:
  480.         mes .n$;
  481.         if(!$@bty_type) {
  482.             mes "This feature isn't activate.";
  483.             close;
  484.         }
  485.         mes "Current Bounty Reward: "+ $@bty_price + " " + ( ($@bty_type == 1)?"Zeny": ( ($@bty_type == 2)?$@bty_cvard$:"Bounty Points") );
  486.         mes "Also an Shop exists so you can prepare you for battle easier.";
  487.         mes "Next is an Bounty Bonus, which automatically activates when someone reaches "+$@bty_bon_start+" kills.";
  488.         mes "An announce will be displayed, to stop him and that you get an bonus to the bounty price, which depends on the bounty type.";
  489.         mes "Current Bonus is: "+$@bty_bonus+" " + ( ($@bty_type == 1)?"Zeny": ( ($@bty_type == 2)?$@bty_cvard$:"Bounty Points") );
  490.         mes "Also there is an Bounty Bonus Multiplier, but the value of that will stay an secret.";
  491.         next;
  492.         mes .n$;
  493.         mes "The bounty depends on your victims sphree.";
  494.         mes "Here is a list of them:";
  495.         mes " ";
  496.         mes "Sphree - Points";
  497.         for ( set .@s,0; .@s < getarraysize($@sphree_names$); set .@s,.@s + 1)
  498.             mes $@sphree_names$[.@s] +" - "+.@s;
  499.            
  500.         next;
  501.        
  502.         case 6:
  503.         break;
  504.     }
  505.  
  506. // Nevermind
  507.     case 5:
  508.     break;
  509. }
  510.  
  511. R_Bye:
  512. mes .n$;
  513. mes "Okay, see ya.";
  514. close;
  515.  
  516. // GM Menu
  517. GM_Menu:
  518. mes "How can I help you?";
  519. next;
  520. switch(select("- Table Settings:- Debug State:- Nevermind")) {
  521.    
  522.     case 1:
  523.     mes .n$;
  524.     mes "Table Status: "+( ($@pvptable == 1)?"":"Not ")+"Installed";
  525.     mes "What do you want to do?";
  526.     next;
  527.     if($@pvptable == 1) {
  528.         switch(select("- Erase Content from Table:- Delete Table completely:- Nevermind")) {
  529.             case 1:
  530.             mes .n$;
  531.             mes "Are you sure, that you want to delete the rankings from the tables?";
  532.             if(select("- Yes:- No") - 1) close;
  533.             next;
  534.             mes .n$;
  535.             mes "Here we go!";
  536.             query_sql "TRUNCATE TABLE `arena_master`";
  537.             break;
  538.            
  539.             case 2:
  540.             mes .n$;
  541.             mes "Are you sure, that you want to delete the whole table from the database?";
  542.             if(select("- Yes:- No") - 1) close;
  543.             next;
  544.             mes .n$;
  545.             mes "Here we go!!!";
  546.             query_sql "DROP TABLE IF EXISTS `arena_master`";
  547.             set $@pvp_table,0;
  548.             break;
  549.            
  550.             case 3:
  551.             break;
  552.         }
  553.     } else if($@pvptable == 0) {
  554.         if(select("- Create Tables:- Nevermind") - 1) close;
  555.         mes .n$;
  556.         mes "Are you sure, that you want to create the tables for the rankings?";
  557.         if(select("- Yes:- No") - 1) close;
  558.         next;
  559.         mes .n$;
  560.         mes "Here we go!";
  561.         query_sql "CREATE TABLE `arena_master` ( `char_id` int(10) unsigned NOT NULL, `kills` smallint(5) unsigned DEFAULT '0', `death` smallint(5) unsigned DEFAULT '0', `hscore` smallint(5) unsigned DEFAULT '0', `bounty` smallint(5) unsigned DEFAULT '0', `bounty_pts` smallint(5) unsigned DEFAULT '0', `killer` smallint(5) unsigned DEFAULT '0', `domi` smallint(5) unsigned DEFAULT '0', `mega` smallint(5) unsigned DEFAULT '0', `unstopp` smallint(5) unsigned DEFAULT '0', `wicked` smallint(5) unsigned DEFAULT '0', `monster` smallint(5) unsigned DEFAULT '0', `godlike` smallint(5) unsigned DEFAULT '0', `holys` smallint(5) unsigned DEFAULT '0', `mvp` smallint(5) unsigned DEFAULT '0' )";
  562.         set $@pvp_table,1;
  563.         break;
  564.     }
  565.     close;
  566.    
  567.     case 2:
  568.     mes .n$;
  569.     mes "Debug State: "+( ($arena_debug == 1)?"Online":"Offline");
  570.     mes "Do you want to change it?";
  571.     if(select("- Yes:- No") - 1) close;
  572.     next;
  573.     mes .n$;
  574.     mes "Debug State has been turned "+ ( (!$arena_debug)?"on":"off")+".";
  575.     set $arena_debug,!$arena_debug;
  576.     break;
  577.    
  578.     case 3:
  579.     break;
  580. }
  581. close;
  582.  
  583. OnLoading:
  584. set .n$,"["+strnpcinfo(1)+"]";
  585. while($@pvpgvg_load) {
  586.     delwaitingroom;
  587.     waitingroom "Arena: Closed",0;
  588.     sleep 2000;
  589. }
  590. delwaitingroom;
  591. announce "PvP/GvG Arena is now opened.",0;
  592. waitingroom "PvP/GvG Arena: Open",0;
  593. if($arena_debug) debugmes "Main OnInit Loaded, continuing with Arena Shop";
  594. if($@bty_type) { // If Bounty is enabled
  595.     // Shop Items: PvP useful stuff, like Elements, Boxes and Food
  596.     // These will be used for all shops, but the prices depends on the Bounty Type you have set.
  597.     setarray .arena_sh[0],12020, // [0] == Cursed Water
  598.                            12028, // [1] == Box of Thunder
  599.                            12029, // [2] == Box of Gloom
  600.                            12030, // [3] == Box of Resentment
  601.                            12031, // [4] == Box of Drowsiness
  602.                            12032, // [5] == Box of Stroms
  603.                            12033, // [6] == Box of Sunlight
  604.                            12034, // [7] == Box of Panting
  605.                            12108, // [8] == Scroll Package
  606.                            12215, // [9] == LV 10 Blessing Scroll
  607.                            12216, // [10] == LV 10 Agi Scroll
  608.                            12217, // [11] == LV 5 Aspersio Scroll
  609.                            12218, // [12] == LV 5 Assumptio Scroll
  610.                            12219, // [13] == LV 10 Wind Walker Scroll
  611.                            12075, // [14] == Steamed Tongue
  612.                            12080, // [15] == Dragon Breath Cocktail
  613.                            12085, // [16] == Immortal Stew
  614.                            12090, // [17] == Steamed Desert Scorpions
  615.                            12095, // [18] == Hwergelmir's Tonic
  616.                            12100, // [19] == Cooked Nice Tail's Tails
  617.                            12114, // [20] == Elemental Converter[Fire]
  618.                            12115, // [21] == Elemental Converter[Water]
  619.                            12116, // [22] == Elemental Converter[Earth]
  620.                            12117, // [23] == Elemental Converter[Wind]
  621.                            12118, // [24] == Fireproof Potion
  622.                            12119, // [25] == Coldproof Potion
  623.                            12120, // [26] == Earthproof Potion
  624.                            12121, // [27] == Thunderproof Potion
  625.                            13543, // [28] == Chemical Protection Helm Scroll Box
  626.                            13544, // [29] == Chemical Protection Shield Scroll Box
  627.                            13545, // [30] == Chemical Protection Armor Scroll Box
  628.                            13546, // [31] == Chemical Protection Weapon Scroll Box
  629.                            13547, // [32] == Repair Weapon Scroll Box
  630.                            14593; // [33] == Mystical Amplification Scroll
  631.  
  632.     // Prices:
  633.     // Two ways of doing so:
  634.     // - Per formula
  635.     // - Per Array
  636.     // You can determine for each currency the way of calculation and prices.
  637.     // If you want to use the formula, set ".arena_pay" to 1.
  638.     // If you wanna use the array, set ".arena_pay" to 2,
  639.     // but remember to put the prices for all items, also there is no multiplier added for this.
  640.     set .@arena_pay,1;
  641.    
  642.     // Cost Multiplier:
  643.     // The value here will multiply the costs in the shop.
  644.     // Fill in the index of the item array for which Item you want to use the multiplier.
  645.     // * Suggested Values:
  646.     // - Minimum: 1
  647.     // - Maximum: 10
  648.     // Note: On Mid Rate and High Rate Servers, it's easy to gain money very fast.
  649.     // So I added this to only increase the costs in the shop, but not the gain per kill.
  650.     // Note2: NEVER PUT '0' ALSO I DIDN'T ADD AN PREVENTION IF YOU GO HIGHER THAN '10'!!!
  651.     setarray .@arena_multi[0],1, // [0]
  652.                               2, // [1]
  653.                               2, // [2]
  654.                               2, // [3]
  655.                               2, // [4]
  656.                               2, // [5]
  657.                               2, // [6]
  658.                               2, // [7]
  659.                               4, // [8]
  660.                               4, // [9]
  661.                               4, // [10]
  662.                               4, // [11]
  663.                               4, // [12]
  664.                               4, // [13]
  665.                               5, // [14]
  666.                               5, // [15]
  667.                               5, // [16]
  668.                               5, // [17]
  669.                               5, // [18]
  670.                               5, // [19]
  671.                               3, // [20]
  672.                               3, // [21]
  673.                               3, // [22]
  674.                               3, // [23]
  675.                               1, // [24]
  676.                               1, // [25]
  677.                               1, // [26]
  678.                               1, // [27]
  679.                               4, // [28]
  680.                               4, // [29]
  681.                               4, // [30]
  682.                               4, // [31]
  683.                               3, // [32]
  684.                               2; // [33]
  685.  
  686.     if(.@arena_pay == 1) {
  687. // ============== * By Formula * ================
  688. // Note: If the formula results in a decimal number it will be degraded.
  689.  
  690.         for ( set .@s,0; .@s < getarraysize(.arena_sh); set .@s,.@s + 1) {
  691.         // =============== Zeny Formula ========== //
  692.             // Default: (($@bty_price+(.@s*($@bty_price/10)))/2)*.@arena_multi
  693.             // Base Price = $@bty_price, "Bonus" = + (Index ID* ($@bty_price/10))/2
  694.             // Example: 5000 + (4(=Index of 12031)*(5000/10=500) > 7000/2 = 3500 Zeny for 12031
  695.             // With Multiplier: ".@arena_multi[4] = 5": 3500 * 5 = 17500
  696.             if($@bty_type == 1) set .@arena_fo,(($@bty_price+(.@s*($@bty_price/10)))/2)*.@arena_multi[.@s];
  697.            
  698.         // =============== Custom Points Formula ========== //
  699.             // Default: (($@bty_price+.@s)/2)*.@arena_multi
  700.             // Base Price = $@bty_price, "Bonus" = + Index ID/2
  701.             // Example: 2 + 4(=Index of 12031) > 6/2 = 3 Custom Points for 12031
  702.             // With Multiplier: ".@arena_multi[4] = 5": 3 * 5 = 15
  703.             else if($@bty_type == 2) set .@arena_fo,(($@bty_price+.@s)/2)*.@arena_multi[.@s];
  704.            
  705.         // =============== Bounty Points Formula ========== //
  706.             // Default: (($@bty_price+(.@s*10))/2)*.@arena_multi
  707.             // Base Price = $@bty_price, "Bonus" = + (Index ID* 10)/2
  708.             // Example: 5 + (4(=Index of 12031)*10) > 45/2 = 22 Bounty Points for 12031
  709.             // With Multiplier: ".@arena_multi[4] = 5": 22 * 5 = 110
  710.             else if($@bty_type == 3) set .@arena_fo,(($@bty_price+(.@s*10))/2)*.@arena_multi[.@s];
  711.            
  712.         // =============== Adding the price (calculated by the formula) to the array ========== //
  713.             setarray .arena_ar[.@s],.@arena_fo;
  714.         }
  715.  
  716.     // Price Array
  717.     } else
  718.         setarray .arena_ar[0],100, // [0]
  719.                                100, // [1]
  720.                                100, // [2]
  721.                                100, // [3]
  722.                                100, // [4]
  723.                                100, // [5]
  724.                                100, // [6]
  725.                                100, // [7]
  726.                                100, // [8]
  727.                                100, // [9]
  728.                                100, // [10]
  729.                                100, // [11]
  730.                                100, // [12]
  731.                                100, // [13]
  732.                                100, // [14]
  733.                                100, // [15]
  734.                                100, // [16]
  735.                                100, // [17]
  736.                                100, // [18]
  737.                                100, // [19]
  738.                                100, // [20]
  739.                                100, // [21]
  740.                                100, // [22]
  741.                                100, // [23]
  742.                                100, // [24]
  743.                                100, // [25]
  744.                                100, // [26]
  745.                                100, // [27]
  746.                                100, // [28]
  747.                                100, // [29]
  748.                                100, // [30]
  749.                                100, // [31]
  750.                                100, // [32]
  751.                                100; // [33]
  752.    
  753.     npcshopdelitem "Arena_Shop",512;
  754.     // Adding Items and Prices to the Shop
  755.     for ( set .@s,0; .@s < getarraysize(.arena_sh); set .@s,.@s + 1)
  756.         npcshopadditem "Arena_Shop",.arena_sh[.@s],.arena_ar[.@s];
  757.        
  758. if($arena_debug) debugmes "Arena Shop loaded - Items: "+getarraysize(.arena_sh)+", Prices: "+getarraysize(.arena_ar);
  759. }
  760. end;
  761. }
  762. // =============== Bounty Shop =========== //
  763. -   shop    Arena_Shop  -1,512:-1
  764. // =============== Main Settings ===============//
  765. -   script  PvPGvGMain  -1,{
  766. end;
  767.  
  768. OnInit:
  769. freeloop(1);
  770. // =============== Ranking Check & Debug Messages ================//
  771. set $@pvpgvg_load,1;
  772. //set $arena_debug,1;
  773. initnpctimer;
  774. if($arena_debug) debugmes "====== Arena Master - Debug initiate... ========";
  775. if(query_sql("SHOW TABLES LIKE 'arena_master'",.@pvptab) == 0) set $@pvptable,0; else set $@pvptable,1;
  776. donpcevent "Arena Master::OnLoading";
  777. // ============== Sphree Settings ============//
  778. setarray $@sphree_names$[0],"Killing Sphree","Dominating","Mega Kill","Unstoppable","Wicked Sick","Monster Kill","GodLike","Holy Sh1t";
  779. setarray $@sphree_kills[0],3,5,7,9,11,13,15,17; // Kills required for each sphree.
  780. setarray $@sphree_wav$[0],"killingspree","dominating","megakill","unstoppable","wickedsick","monsterkill","godlike","holyshit"; // WAV file names
  781. setarray $@sphree_rank$[0],"killer","domi","mega","unstopp","wicked","monster","godlike","holys"; // Variable Names for the ranking of each sphree
  782. set $@multi,5000; // Time Span for chance to gain Multi-Kill in milliseconds.
  783. if($arena_debug) debugmes "PvP Sphree Names loaded: "+getarraysize($@sphree_names$);
  784. if($arena_debug) debugmes "PvP Sphree Kills loaded: "+getarraysize($@sphree_kills);
  785. if($arena_debug) debugmes "PvP Sphree WAV Names loaded: "+getarraysize($@sphree_wav$);
  786. if($arena_debug) debugmes "PvP Sphree Ranking Names loaded: "+getarraysize($@sphree_rank$);
  787. // ============== Bounty Settings =========//
  788. // Bounty Type:
  789. // * 0 = Off
  790. // * 1 = Zeny
  791. // * 2 = Custom Points
  792. // * 3 = Bounty Points
  793. set $@bty_type,2;
  794. if($@bty_type) {
  795.     set $@bty_bonus,5; // Bonus, if you kill an player
  796.     set $@bty_bon_start,4; //which has achieved an spree of "$@bty_bon_start"
  797.     set $@bty_bonus_multi,1; // Use Bonus Multiplier depending on the Bounty Type? See seperate sections below
  798.     set $@bty_bonus_m,1000; // Multiplier for Bounty Bonus
  799.     // Custom Points Settings
  800.     set $@bty_cvard$,"Cash Points"; // What to display for players
  801.     set $@bty_cvarn$,"#CASHPOINTS"; // Actual Variable Name
  802.    
  803.     // =============== Zeny ========== //
  804.     if($@bty_type == 1)
  805.         set $@bty_price,5000; // Zeny per Sphree
  806.    
  807.     // =============== Custom Points ========== //
  808.     else if($@bty_type == 2)
  809.         set $@bty_price,2; // Custom Points per Sphree
  810.    
  811.     // =============== Bounty Points ========== //
  812.     else if($@bty_type == 3)
  813.         set $@bty_price,5; // Bounty Points per Sphree
  814.  
  815.     // Custom Bounty Maps
  816.     // = Maps on which you also can gain the reward
  817.     // 1 = On
  818.     // 0 = Off, ordinary ones
  819.     set $@bty_cmap,1;
  820.    
  821.     if($@bty_cmap == 1) {
  822.         // Map Type:
  823.         // 1 = Every Map with PvP/GvG Mapflags
  824.         // 2 = Specific (Array below)
  825.         set $@bty_cmap_type,2;
  826.        
  827.         if($@bty_cmap_type == 2) {
  828.             // Map Array
  829.             // Put the either the whole map name
  830.             // or a part of it to add more maps with the part containing
  831.             setarray $@bty_cmaps$[0],"prt_fild08","prt_gld";
  832.            
  833.             // Which map is a PvP/GvG Map?
  834.             // 6 = PvP
  835.             // 9 = GvG
  836.             // Note: In the same order as above
  837.             setarray $@bty_cmap_pg[0],6,9;
  838.         }
  839.        
  840.         // Party Usage
  841.         // 1 = No parties Allowed
  842.         // 2 = Parties allowed
  843.         setarray $@bty_cmap_pty,2,1;
  844.        
  845.         // Mapflags
  846.         setarray $@bty_cmapfl[0],0, //mf_nomemo
  847.                             //   1, //mf_noteleport
  848.                                  2, //mf_nosave
  849.                                  3, //mf_nobranch
  850.                                  4, //mf_nopenalty
  851.                                  5, //mf_nozenypenalty
  852.                                 11, //mf_notrade
  853.                             //  13, //mf_nowarp
  854.                             //  22, //mf_nogo
  855.                                 33, //mf_noreturn
  856.                             //  34, //mf_nowarpto
  857.                             //  35, //mf_nightmaredrop
  858.                                 38, //mf_nodrop
  859.                                 41, //mf_novending
  860.                                 44, //mf_noexppenalty
  861.                                 14, //mf_partylock
  862.                                  7; //mf_pvp_noparty
  863.  
  864.         // ======= Auto Mapflag Adding ===============//
  865.         for ( set .@m,0; .@m < getarraysize($@bty_cmaps$); set .@m,.@m + 1 ) {
  866.             if($arena_debug) debugmes "Mapflag set at "+$@bty_cmaps$[.@m] + " initiate...";
  867.             for ( set .@mf,0; .@mf < getarraysize($@bty_cmapfl); set .@mf,.@mf + 1 ) {
  868.                 if(($@bty_cmapfl[.@mf] == 14 || $@bty_cmapfl[.@mf] == 7) && $@bty_cmap_pty[.@m] == 1) continue;
  869.                 setmapflag $@bty_cmaps$[.@m],$@bty_cmapfl[.@mf];
  870.                 if($arena_debug) debugmes "Mapflag "+ $@bty_cmapfl[.@mf] +" set at "+$@bty_cmaps$[.@m] + " complete";
  871.             }
  872.             // PvP or GvG Mapflag
  873.             setmapflag $@bty_cmaps$[.@m],$@bty_cmap_pg[.@m];
  874.             if($arena_debug) debugmes "Mapflag "+ $@bty_cmap_pg[.@m] +" set at "+$@bty_cmaps$[.@m] + " complete";
  875.         }
  876.     }
  877. }
  878. if($arena_debug) debugmes "Bounty Shop - Currency: " + ( ($@bty_type == 1)?"Zeny": ( ($@bty_type == 2)?$@bty_cvard$:"Bounty Points") ) + ", Basic Price: "+ $@bty_price;
  879. // Bounty Calculation:
  880. // Scroll down till the line with "function getBounty   {"
  881. if($arena_debug) debugmes "Bounty Type loaded: "+$@bty_type;
  882. // ============ GvG Settings ============//
  883. setarray $@gvgr$[0],"guild_vs1","guild_vs2","guild_vs3";
  884. if($arena_debug) debugmes "Guild Maps loaded: "+getarraysize($@gvgr$);
  885. // Party Usage
  886. // 1 = No parties Allowed
  887. // 2 = Parties allowed
  888. setarray $@gvg_pty[0],2,2,2;
  889. // ======== Mapflags ======== //
  890. // If you want you can add more mapflags
  891. setarray .gvg_mf[0],0, //mf_nomemo
  892.                      1, //mf_noteleport
  893.                      2, //mf_nosave
  894.                      3, //mf_nobranch
  895.                      4, //mf_nopenalty
  896.                      5, //mf_nozenypenalty
  897.                      9, //mf_gvg
  898.                     11, //mf_notrade
  899.                     13, //mf_nowarp
  900.                     15, //mf_noicewall
  901.                     22, //mf_nogo
  902.                     33, //mf_noreturn
  903.                     34, //mf_nowarpto
  904.                     35, //mf_nightmaredrop
  905.                     38, //mf_nodrop
  906.                     41, //mf_novending
  907.                     44, //mf_noexppenalty
  908.                     14, //mf_partylock
  909.                     10; //mf_gvg_noparty
  910.                    
  911. if($arena_debug) debugmes "Guild Mapflags loaded: "+getarraysize(.gvg_mf);
  912. if($arena_debug) debugmes "Array Reading of GvG Maps complete";
  913. for ( set .@m,0; .@m < getarraysize($@gvgr$); set .@m,.@m + 1 ) {
  914.     if($arena_debug) debugmes "Mapflag set at "+$@gvgr$[.@m] + " initiate...";
  915.     for ( set .@mf,0; .@mf < getarraysize(.gvg_mf); set .@mf,.@mf + 1 ) {
  916.         if((.gvg_mf[.@mf] == 14 || .gvg_mf[.@mf] == 10) && .gvg_pty[.@m] == 2) continue;
  917.         setmapflag $@gvgr$[.@m],.gvg_mf[.@mf];
  918.         if($arena_debug) debugmes "Mapflag "+ .gvg_mf[.@mf] +" set at "+$@gvgr$[.@m] + " complete";
  919.     }
  920. }
  921. if($arena_debug) debugmes "Guild Mapflag loading completed";
  922. // ============ PvP Settings ============//
  923. // = You can use your own Maps as you like, even reduce or put more
  924. // = These below are the default PvP Maps
  925. // ====== Dispell PvP ==========//
  926. setarray $@disppvp$[1],"pvp_y_1-1","pvp_y_1-4","pvp_y_1-2","pvp_y_1-3","pvp_y_1-5";
  927. if($arena_debug) debugmes "PvP Dispell Maps loaded: "+(getarraysize($@disppvp$)-1);
  928. // ================== Normal Maps ================//
  929. setarray $@npvp$[1],"pvp_y_2-1","pvp_y_2-4","pvp_y_2-2","pvp_y_2-3","pvp_y_2-5";
  930. if($arena_debug) debugmes "PvP Normal Maps loaded: "+(getarraysize($@npvp$)-1);
  931. // ================== Deathmatch Maps ================//
  932. setarray $@dmpvp$[1],"pvp_y_3-1","pvp_y_3-4","pvp_y_3-2","pvp_y_3-3","pvp_y_3-5";
  933. if($arena_debug) debugmes "PvP DM Maps loaded: "+(getarraysize($@dmpvp$)-1);
  934. // ========= 2vs2 Party PvP ==========//
  935. setarray $@pt2pvp$[1],"pvp_y_4-1","pvp_y_4-4","pvp_y_4-2","pvp_y_4-3","pvp_y_4-5";
  936. if($arena_debug) debugmes "Party PvP 2vs2 Maps loaded: "+(getarraysize($@pt2pvp$)-1);
  937. // ========= 3vs3 Party PvP ==========//
  938. setarray $@pt3pvp$[1],"pvp_y_5-1","pvp_y_5-4","pvp_y_5-2","pvp_y_5-3","pvp_y_5-5";
  939. if($arena_debug) debugmes "Party PvP 3vs3 Maps loaded: "+(getarraysize($@pt3pvp$)-1);
  940. // ========= 4vs4 Party PvP ==========//
  941. setarray $@pt4pvp$[1],"pvp_y_6-1","pvp_y_6-4","pvp_y_6-2","pvp_y_6-3","pvp_y_6-5";
  942. if($arena_debug) debugmes "Party PvP 4vs4 Maps loaded: "+(getarraysize($@pt4pvp$)-1);
  943. // ========= 5vs5 Party PvP ==========//
  944. setarray $@pt5pvp$[1],"pvp_y_7-1","pvp_y_7-4","pvp_y_7-2","pvp_y_7-3","pvp_y_7-5";
  945. if($arena_debug) debugmes "Party PvP 5vs5 Maps loaded: "+(getarraysize($@pt5pvp$)-1);
  946. // ======= Party Usage ==========
  947. // 1 = No parties Allowed
  948. // 2 = Parties allowed
  949. setarray .disp_pty[1],2,2,2,2,2;
  950. setarray .n_pty[1],2,2,2,2,2;
  951. setarray .dm_pty[1],2,2,2,2,2;
  952. // ============= Class Limitation ========//
  953. // * Values:
  954. // 0 = No 3rd Job Allowed
  955. // 1 = Only 3rd Job Allowed
  956. // 2 = All
  957. // --------------------------------------
  958. // * Dispell PvP Rooms
  959. setarray $@class_disp[1],2,2,2,2,2;
  960. // * Normal PvP Rooms
  961. setarray $@class_n[1],2,2,2,2,2;
  962. // * Deathmatch PvP Rooms
  963. setarray $@class_dm[1],2,2,2,2,2;
  964. // * Party PvP 2vs2 Rooms
  965. setarray $@class_p2[1],2,2,2,2,2;
  966. // * Party PvP 3vs3 Rooms
  967. setarray $@class_p3[1],2,2,2,2,2;
  968. // * Party PvP 4vs4 Rooms
  969. setarray $@class_p4[1],2,2,2,2,2;
  970. // * Party PvP 5vs5 Rooms
  971. setarray $@class_p5[1],2,2,2,2,2;
  972. //==============================
  973. // ===== Map Rotation ====== //
  974. // 1 = Fixed Map (Always Default)
  975. // 2 = Random each Day
  976. // 3 = Each specific Day an specific Map
  977. set .pvp_map,3;
  978. // ===== 1: Fixed Map (Always Default) ======== //
  979. // Type the Index of $@<Type>pvp$ for the Map to be used
  980. set $disppvp_map,2;
  981. set $npvp_map,3;
  982. set $dmpvp_map,1;
  983. set $pt2pvp_map,4;
  984. set $pt3pvp_map,4;
  985. set $pt4pvp_map,4;
  986. set $pt5pvp_map,4;
  987.    
  988. // ===== 3: Specific Day ======== //
  989. if(.pvp_map == 3) {
  990.     //     > Chose your time in the same row as the $@pvp_maps$ order
  991.     //     > Values for the Array:
  992.     //       MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
  993.     // ============================== //
  994.     setarray $@disppvp_day[1],MONDAY,MONDAY,WEDNESDAY,SATURDAY,TUESDAY;
  995.     setarray $@npvp_day[1],TUESDAY,SATURDAY,WEDNESDAY,THURSDAY,MONDAY;
  996.     setarray $@dmpvp_day[1],WEDNESDAY,MONDAY,SUNDAY,TUESDAY,FRIDAY;
  997.     setarray $@pt2pvp_day[1],FRIDAY,TUESDAY,SATURDAY,MONDAY,TUESDAY;
  998.     setarray $@pt3pvp_day[1],FRIDAY,TUESDAY,SATURDAY,MONDAY,TUESDAY;
  999.     setarray $@pt4pvp_day[1],FRIDAY,TUESDAY,SATURDAY,MONDAY,TUESDAY;
  1000.     setarray $@pt5pvp_day[1],FRIDAY,TUESDAY,SATURDAY,MONDAY,TUESDAY;
  1001. }
  1002. // ======== Mapflags ======== //
  1003. // If you want to add more mapflags,
  1004. // add them before the last two, which are for allowing party or not
  1005. setarray .pvp_mf[0],0, //mf_nomemo
  1006.                      1, //mf_noteleport
  1007.                      2, //mf_nosave
  1008.                      3, //mf_nobranch
  1009.                      4, //mf_nopenalty
  1010.                      5, //mf_nozenypenalty
  1011.                     11, //mf_notrade
  1012.                     13, //mf_nowarp
  1013.                     22, //mf_nogo
  1014.                     33, //mf_noreturn
  1015.                     34, //mf_nowarpto
  1016.                     35, //mf_nightmaredrop
  1017.                     38, //mf_nodrop
  1018.                     41, //mf_novending
  1019.                     44, //mf_noexppenalty
  1020.                     14, //mf_partylock
  1021.                      7; //mf_pvp_noparty
  1022. if($arena_debug) debugmes "PvP Mapflags loaded: "+(getarraysize(.pvp_mf)-1);
  1023. function writeStats;
  1024. if($arena_debug) debugmes "Write Stats Function loaded.";
  1025. function getBounty;
  1026. function writeBounty;
  1027. if($arena_debug) debugmes "Bounty Function loaded.";
  1028. function PVP_BTY_CMAP;
  1029. if($arena_debug) debugmes "Custom Bounty Map Function loaded.";
  1030. stopnpctimer;
  1031. set .time,getnpctimer(0);
  1032. if($arena_debug) debugmes "Loading Time: "+.time+" seconds.";
  1033. freeloop(0);
  1034. set $@pvpgvg_load,0;
  1035.  
  1036. OnClock0001:
  1037. freeloop(1);
  1038. setarray .@pre$[0],"disp","n","dm","pt2","pt3","pt4","pt5";
  1039. if(.pvp_map == 2) {
  1040.     if($arena_debug) debugmes "Random Map Rotation:";
  1041.     for ( set .@l,0; .@l < getarraysize(.@pre$); set .@l,.@l + 1) {
  1042.         if($arena_debug) debugmes ".@pre$ = "+.@pre$[.@l];
  1043.         if($arena_debug) debugmes "Array Size: $@"+.@pre$[.@l]+"pvp$ = "+getarraysize(getd("$@"+.@pre$[.@l]+"pvp$"));
  1044.        
  1045.         setd("$"+.@pre$[.@l]+"pvp_map"),rand(1,getarraysize(getd("$@"+.@pre$[.@l]+"pvp$"))-1);
  1046.        
  1047.         if($arena_debug) debugmes "$"+.@pre$[.@l]+"pvp_map = "+getd("$"+.@pre$[.@l]+"pvp_map");
  1048.         if($arena_debug) debugmes "$@"+.@pre$[.@l]+"pvp$["+getd("$"+.@pre$[.@l]+"pvp_map")+"] == "+getd("$@"+.@pre$[.@l]+"pvp$["+getd("$"+.@pre$[.@l]+"pvp_map")+"]");
  1049.    
  1050.         if(!getd("$"+.@pre$[.@l]+"pvp_last") || getd("$"+.@pre$[.@l]+"pvp_last") != getd("$"+.@pre$[.@l]+"pvp_map"))
  1051.             setd("$"+.@pre$[.@l]+"pvp_last"),getd("$"+.@pre$[.@l]+"pvp_map");
  1052.     }
  1053. } else if(.pvp_map == 3) {
  1054.     if($arena_debug) debugmes "Specific Day an Specific Map:";
  1055.     for ( set .@l,0; .@l < getarraysize(.@pre$); set .@l,.@l + 1) {
  1056.         if($arena_debug) debugmes ".@pre$ = "+.@pre$[.@l];
  1057.         if($arena_debug) debugmes "Previous Map: "+getd("$"+.@pre$[.@l]+"pvp_map");
  1058.         // Saving the previous Map
  1059.         if($arena_debug) debugmes "Saving Previous Map: "+getd("$@"+.@pre$[.@l]+"pvp_last");       
  1060.         setd("$"+.@pre$[.@l]+"pvp_last"),getd("$"+.@pre$[.@l]+"pvp_map");  
  1061.        
  1062.         for ( set .@t,1; .@t < getarraysize(getd("$@"+.@pre$[.@l]+"pvp$")); set .@t,.@t + 1) {
  1063.             if($arena_debug) debugmes "Checking Day of ["+.@t+"]: "+getd("$@"+.@pre$[.@l]+"pvp_day["+.@t+"]")+" == "+gettime(DT_DAYOFWEEK);        
  1064.             if(getd("$@"+.@pre$[.@l]+"pvp_day["+.@t+"]") == gettime(DT_DAYOFWEEK)) {
  1065.                 setd("$"+.@pre$[.@l]+"pvp_map"),.@t;
  1066.                 if($arena_debug) debugmes "Day Check passed: "+getd("$"+.@pre$[.@l]+"pvp_map")+" == "+.@t;
  1067.             }
  1068.         }
  1069.     }
  1070. }
  1071. if($arena_debug) debugmes "OnClock0001 and/or OnInit loaded, Auto Mapflag adding now....";
  1072. // ======= Auto Mapflag Adding ===============//
  1073. // ======= Dispell PvP ===============//
  1074. if($arena_debug) debugmes "Mapflag set at "+$@disppvp$[$disppvp_map] + " initiate...";
  1075. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1076.     if((.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) && .disp_pty[.@m] == 2) continue;
  1077.     setmapflag $@disppvp$[$disppvp_map],.pvp_mf[.@mf];
  1078.     if($disppvp_map != $disppvp_last)
  1079.         removemapflag $@disppvp$[$disppvp_last],.pvp_mf[.@mf];
  1080.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@disppvp$[$disppvp_map] + " complete";
  1081. }
  1082. if($arena_debug) debugmes "PvP Dispell Mapflags loaded.";
  1083. // ======= Normal PvP ===============//
  1084. if($arena_debug) debugmes "Mapflag set at "+$@npvp$[$npvp_map] + " initiate...";
  1085. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1086.     if((.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) && .n_pty[.@m] == 2) continue;
  1087.     setmapflag $@npvp$[$npvp_map],.pvp_mf[.@mf];
  1088.     if($npvp_map != $npvp_last)
  1089.         removemapflag $@npvp$[$npvp_last],.pvp_mf[.@mf];
  1090.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@npvp$[$npvp_map] + " complete";
  1091. }
  1092. if($arena_debug) debugmes "PvP Normal Mapflags loaded.";       
  1093. // ======= Deathmatch PvP ===============//
  1094. if($arena_debug) debugmes "Mapflag set at "+$@dmpvp$[$dmpvp_map] + " initiate...";
  1095. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1096.     if((.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) && .dm_pty[.@m] == 2) continue;
  1097.     setmapflag $@dmpvp$[$dmpvp_map],.pvp_mf[.@mf];
  1098.     if($dmpvp_map != $dmpvp_last)
  1099.         removemapflag $@dmpvp$[$dmpvp_last],.pvp_mf[.@mf];
  1100.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@dmpvp$[$dmpvp_map] + " complete";
  1101. }
  1102. if($arena_debug) debugmes "PvP DM Mapflags loaded.";   
  1103. // ============== Party 2vs2 =================//
  1104. if($arena_debug) debugmes "Mapflag set at "+$@pt2pvp$[$pt2pvp_map] + " initiate...";
  1105. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1106.     if(.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) continue;
  1107.     setmapflag $@pt2pvp$[$pt2pvp_map],.pvp_mf[.@mf];
  1108.     if($pt2pvp_map != $pt2pvp_last)
  1109.         removemapflag $@pt2pvp$[$pt2pvp_last],.pvp_mf[.@mf];
  1110.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@pt2pvp$[$pt2pvp_map] + " complete";
  1111. }
  1112. if($arena_debug) debugmes "Party 2v2 PvP Mapflags loaded.";
  1113. // ============== Party 3vs3 =================//
  1114. if($arena_debug) debugmes "Mapflag set at "+$@pt3pvp$[$pt3pvp_map] + " initiate...";
  1115. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1116.     if(.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) continue;
  1117.     setmapflag $@pt3pvp$[$pt3pvp_map],.pvp_mf[.@mf];
  1118.     if($pt3pvp_map != $pt3pvp_last)
  1119.         removemapflag $@pt3pvp$[$pt3pvp_last],.pvp_mf[.@mf];
  1120.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@pt3pvp$[$pt3pvp_map] + " complete";
  1121. }
  1122. if($arena_debug) debugmes "Party 3v3 PvP Mapflags loaded.";
  1123. // ============== Party 4vs4 =================//
  1124. if($arena_debug) debugmes "Mapflag set at "+$@pt4pvp$[$pt4pvp_map] + " initiate...";
  1125. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1126.     if(.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) continue;
  1127.     setmapflag $@pt4pvp$[$pt4pvp_map],.pvp_mf[.@mf];
  1128.     if($pt4pvp_map != $pt4pvp_last)
  1129.         removemapflag $@pt4pvp$[$pt4pvp_last],.pvp_mf[.@mf];
  1130.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@pt4pvp$[$pt4pvp_map] + " complete";
  1131. }
  1132. if($arena_debug) debugmes "Party 4v4 PvP Mapflags loaded.";
  1133. // ============== Party 5vs5 =================//
  1134. if($arena_debug) debugmes "Mapflag set at "+$@pt5pvp$[$pt5pvp_map] + " initiate...";
  1135. for ( set .@mf,0; .@mf < getarraysize(.pvp_mf); set .@mf,.@mf + 1 ) {
  1136.     if(.pvp_mf[.@mf] == 14 || .pvp_mf[.@mf] == 7) continue;
  1137.     setmapflag $@pt5pvp$[$pt5pvp_map],.pvp_mf[.@mf];
  1138.     if($pt5pvp_map != $pt5pvp_last)
  1139.         removemapflag $@pt5pvp$[$pt5pvp_last],.pvp_mf[.@mf];
  1140.     if($arena_debug) debugmes "Mapflag "+ .pvp_mf[.@mf] +" set at "+$@pt5pvp$[$pt5pvp_map] + " complete";
  1141. }
  1142. freeloop(0);
  1143. if($arena_debug) debugmes "Party 5v5 PvP Mapflags loaded.";
  1144. if($arena_debug) debugmes "PvP Mapflags loaded.";
  1145. end;
  1146.  
  1147. OnPCKillEvent:
  1148. if(PVP_BTY_CMAP($@bty_cmap_type,strcharinfo(3)) == 1) end;
  1149. set .@v,killedrid;
  1150. mapannounce strcharinfo(3),strcharinfo(0) + " has killed "+rid2name(.@v)+"!!!!!",0;
  1151. set @killct,@killct + 1;
  1152. if($arena_debug) {
  1153.     debugmes "[Arena]: Showing debug messages";
  1154.  
  1155.     for ( set .@l,0; .@l < getarraysize($@sphree_kills); set .@l,.@l + 1)
  1156.         debugmes "[Arena]: Sphree Kills Array - Index #"+.@l+": "+$@sphree_kills[.@l];
  1157.     for ( set .@l,0; .@l < getarraysize($@sphree_names$); set .@l,.@l + 1)
  1158.         debugmes "[Arena]: Sphree Names Array - Index #"+.@l+": "+$@sphree_names$[.@l];
  1159.     for ( set .@l,0; .@l < getarraysize($@sphree_wav$); set .@l,.@l + 1)
  1160.         debugmes "[Arena]: Sphree WAV Names Array - Index #"+.@l+": "+$@sphree_wav$[.@l];
  1161.  
  1162.     debugmes "[Arena]: Kill Counter Check and announces...";
  1163.     debugmes "[Arena]: Kills: "+@killct+", Arraysize $@sphree_kills: "+getarraysize($@sphree_kills)+", last sphree kills: "+$@sphree_kills[getarraysize($@sphree_kills)-1];
  1164. }
  1165. // Checking if the kill counter is below the last sphree number
  1166. if(@killct <= $@sphree_kills[getarraysize($@sphree_kills)-1]) {
  1167.     if($arena_debug) debugmes "[Arena]: Kills is less than last sphree kill.";
  1168.     // Looping through the array to check for the sphree kill
  1169.     for ( set .@k,0; .@k < getarraysize($@sphree_kills); set .@k,.@k + 1) {
  1170.         if($arena_debug) debugmes "[Arena]: Array Index:"+.@k+", Array Content: "+$@sphree_kills[.@k];
  1171.         if(@killct == $@sphree_kills[.@k]) {
  1172.             if($arena_debug) debugmes "[Arena]: "+@killct+", "+$@sphree_kills[.@k];
  1173.             mapannounce strcharinfo(3),strcharinfo(0) + " is now on "+$@sphree_names$[.@k]+"!!!!",0;
  1174.             soundeffectall $@sphree_wav$[.@k]+".wav",0,strcharinfo(3);
  1175.             setd("@"+$@sphree_rank$[.@k]),getd("@"+$@sphree_rank$[.@k]) + 1; // Ranking Variable
  1176.             break;
  1177.         }
  1178.     }
  1179. // Checking if the kill counter is above the last sphree number
  1180. } else if(@killct >= $@sphree_kills[getarraysize($@sphree_kills)-1]) {
  1181.     mapannounce strcharinfo(3),strcharinfo(0) + " is now on "+$@sphree_names$[getarraysize($@sphree_names$)-1]+"!!!!",0;
  1182.     soundeffectall $@sphree_wav$[getarraysize($@sphree_wav$)-1]+".wav",0,strcharinfo(3);
  1183. }
  1184. if($arena_debug) debugmes "[Arena]: Check Done";
  1185. set @prokill,@prokill + 1;
  1186.  
  1187. set @mkillct,@mkillct + 1;
  1188. deltimer strnpcinfo(0)+"::OnMultiSpan";
  1189. addtimer $@multi,strnpcinfo(0)+"::OnMultiSpan";
  1190. if(@mkillct >= 4) sleep2 500; // Slowing down multi-kill sound effects
  1191. if(@mkillct == 2) {
  1192.     mapannounce strcharinfo(3),strcharinfo(0) + " has made an Double Kill!!!!",0;
  1193.     soundeffectall "doublekill.wav",0,strcharinfo(3);
  1194. } else if(@mkillct == 3) { 
  1195.     mapannounce strcharinfo(3),strcharinfo(0) + " has made an Triple Kill!!!!",0;
  1196.     soundeffectall "triplekill.wav",0,strcharinfo(3);
  1197. } else if(@mkillct >= 4) {
  1198.     mapannounce strcharinfo(3),strcharinfo(0) + " has made an Ultra Kill!!!!",0;
  1199.     soundeffectall "ultrakill.wav",0,strcharinfo(3);
  1200. }
  1201. if($@bty_type && $@pvptable) {
  1202.     if(@killct >= $@bty_bon_start) {
  1203.         if(!@hunt) {
  1204.             announce "Bounty Hunter: Oh My God!!! Someone stop "+strcharinfo(0)+" please!!! I'll give you a bonus of "+($@bty_bonus*$@bty_bonus_m)+" " + ( ($@bty_type == 1)?"Zeny": ( ($@bty_type == 2)?$@bty_cvard$:"Bounty Points") ) + " on "+ ( (Sex)?"his":"her") +" head!!",0;
  1205.             sleep2 2500;
  1206.             setarray .@pvp_pre$[0],"disp","n","dm","pt2","pt3","pt4","pt5";
  1207.             setarray .@pvp_n$[0],"Dispell","Normal","Deathmatch","Party 2vs2","Party 3vs3","Party 4vs4","Party 5vs5";
  1208.             for ( set .@l,0; .@l < getarraysize(.@pvp_pre$); set .@l,.@l + 1)
  1209.                 for ( set .@m,1; .@m < getarraysize(getd("$@"+.@pvp_pre$[.@l]+"pvp$")); set .@m,.@m + 1)
  1210.                     if(strcharinfo(3) == getd("$@"+.@pvp_pre$[.@l]+"pvp$["+.@m+"]")) {
  1211.                         announce "Bounty Hunter: "+( (Sex)?"He":"She")+" is in the '"+$@room$[.@m]+" "+.@pvp_n$[.@l]+" Arena'!!!",0;
  1212.                         break;
  1213.                     }
  1214.             for ( set .@m,0; .@m < getarraysize($@gvgr$); set .@m,.@m + 1)
  1215.                 if(strcharinfo(3) == $@gvgr$[.@m]) {
  1216.                     announce "Bounty Hunter: "+( (Sex)?"He":"She")+" is in the Guild Room "+(.@m+1)+"!!!",0;
  1217.                     break;
  1218.                 }
  1219.                
  1220.             if($@bty_cmap)
  1221.                 for ( set .@m,0; .@m < getarraysize($@bty_cmaps$); set .@m,.@m + 1)
  1222.                     if(compare(strcharinfo(3),$@bty_cmaps$[.@m]) == 1) {
  1223.                         announce "Bounty Hunter: "+( (Sex)?"He":"She")+" is on the map '"+$@bty_cmaps$[.@m]+"'!!!",0;
  1224.                         break;
  1225.                     }
  1226.  
  1227.             set @hunt,1;
  1228.         }
  1229.         set @sphr,@killct + $@bty_bonus;
  1230.     }
  1231.     query_sql("SELECT `bounty` FROM `arena_master` WHERE `char_id` = '"+getcharid(0,rid2name(.@v))+"'",@bty);
  1232.     getBounty(@bty,.@v);
  1233.     writeBounty(@sphr,getcharid(0));
  1234.     writeStats(@killct,0);
  1235. }
  1236. if(@killct%5==0) message strcharinfo(0),"Defeated Players: "+@killct;
  1237. end;
  1238.  
  1239. OnPCDieEvent:
  1240. if(PVP_BTY_CMAP(1,strcharinfo(3)) == 1) end;
  1241. // ===== Should affects you only, if you warped to an player via @warpto/@goto or were @recall-ed
  1242. // ==== so you won't recieve a value for @map, which is required for the respawn in DM Maps
  1243. if(!@dm)
  1244.     if(strcharinfo(3) == $@dmpvp$[$dmpvp_map])
  1245.         set @dm,1;
  1246.  
  1247. if($@pvptable) {
  1248.     writeStats(0,1);
  1249.     if($@bty_type) writeBounty(@sphr,getcharid(0));
  1250. }
  1251. set @sphr,0;
  1252. set @killct,0;
  1253.  
  1254. if(@dm) {
  1255.     if($arena_debug) debugmes "KillerRid: "+killerrid+", KilledRid: "+killedrid;
  1256.     sleep2 1300;
  1257.     if(killerrid != 0 && killerrid != getcharid(3)) {
  1258.         warp strcharinfo(3),0,0;
  1259.         if(HP == 0) atcommand "@alive";
  1260.         percentheal 100,100;
  1261.     } else warp "SavePoint",0,0;
  1262. }
  1263. set @hunt,0;
  1264. end;
  1265.  
  1266. OnMultiSpan:
  1267. set @mkillct,0;
  1268. end;
  1269.  
  1270. OnNPCKillEvent:
  1271. if(!$@pvptable) end;
  1272. if(getmonsterinfo(killedrid,MOB_MVPEXP) > 0) { // Update to rAthena: getmonsterinfo supports now an check for MVP Exp
  1273.     if(query_sql("SELECT `char_id` FROM `arena_master` WHERE `char_id` = '"+getcharid(0)+"'",@charid) != 0)
  1274.         query_sql "UPDATE `arena_master` SET `mvp` = `mvp` + 1  WHERE `char_id` = '"+getcharid(0)+"'";
  1275.     else query_sql "INSERT INTO `arena_master` ( `char_id` , `mvp`) VALUES ( '"+getcharid(0)+"' , '1' )";
  1276. }
  1277. end;
  1278.  
  1279.     function    writeStats  {
  1280.     if(!$@pvptable) return; // To be save :O
  1281.     set @k,getarg(0); // Kills
  1282.     set @d,getarg(1); // Deaths
  1283.     if(query_sql("SELECT `kills` FROM `arena_master` WHERE `char_id` = '"+getcharid(0)+"'",@kills) != 0) {
  1284.         if(@k > query_sql("SELECT `hscore` FROM `arena_master` WHERE `char_id` = '"+getcharid(0)+"'",@hscore)) set @hscore,@k;
  1285.         // Adding General Kill/Death/Highscore Values
  1286.         query_sql "UPDATE `arena_master` SET `kills` = `kills` + "+@k+", `death` = `death` + "+@d+" , `hscore` = '"+@hscore+"' WHERE `char_id` = '"+getcharid(0)+"'";
  1287.         // Adding Sphree Ranking Values
  1288.         query_sql "UPDATE `arena_master` SET `killer` = `killer` + "+@killer+" , `domi` = `domi` + "+@domi+" , `mega` = `mega` + "+@mega+" , `unstopp` = `unstopp` + "+@unstopp+" , `wicked` = `wicked` + "+@wicked+" , `monster` = `monster` + "+@monster+" , `godlike` = `godlike` + "+@godlike+" , `holys` = `holys` + "+@holys+" WHERE `char_id` = '"+getcharid(0)+"'";
  1289.         // Reseting Ranking Variables
  1290.         for ( set .@l,0; .@l < getarraysize($@sphree_rank$); set .@l,.@l + 1)
  1291.             setd("@"+$@sphree_rank$[.@l]),0;
  1292.        
  1293.     } else query_sql "INSERT INTO `arena_master` ( `char_id` , `kills` , `death` , `hscore` , `killer` , `domi` , `mega` , `unstopp` , `wicked` , `monster` , `godlike` , `holys` ) VALUES ( '"+getcharid(0)+"' , '"+@k+"' , '"+@d+"' , '"+@k+"' , '"+@killer+"' , '"+@domi+"' , '"+@mega+"' , '"+@unstopp+"' , '"+@wicked+"' , '"+@monster+"' , '"+@godlike+"' , '"+@holys+"' )";
  1294.     return;
  1295.     }
  1296.    
  1297.     function    getBounty   {
  1298.     // getarg(0) == Last Sphree of Victim
  1299.     // getarg(1) == RID of Victim
  1300.     if(!getarg(0)) return; // No Sphree = No Bounty ;I
  1301.     // Calculation:
  1302.     // Exchange the */+ with the symbol you want,
  1303.     // but note that it can be exploited if you change it too much,
  1304.     // like 8 (Sphree Index)*$@bty_price (Custom Points,5) = 40 Custom Points
  1305.        
  1306.         // If Bounty Bonus Multiplier is active
  1307.         if($@bty_bonus_multi == 1)
  1308.             set .@bty_b_gain,$@bty_bonus*$@bty_bonus_m;
  1309.         else
  1310.             set .@bty_b_gain,$@bty_bonus;
  1311.            
  1312.         if(getarg(0) >= $@bty_bon_start)
  1313.             mapannounce strcharinfo(3),"Bounty Hunter: "+strcharinfo(0)+" has ended "+rid2name(getarg(1))+"'s Spree and was rewarded with additional "+.@bty_b_gain+" " + ( ($@bty_type == 1)?"Zeny": ( ($@bty_type == 2)?$@bty_cvard$:"Bounty Points") ),0;
  1314.        
  1315.         switch($@bty_type) { // Bounty Reward Type
  1316.             case 1: // Zeny
  1317.             set Zeny,Zeny + ($@bty_price*getarg(0)) + .@bty_b_gain;
  1318.             dispbottom "Bounty Hunter: You have recieved "+($@bty_price*getarg(0)+.@bty_b_gain)+" Zeny for killing "+rid2name(getarg(1))+".";
  1319.             break;
  1320.            
  1321.             case 2: // Custom Points
  1322.             setd(""+$@bty_cvarn$),getd(""+$@bty_cvarn$) + ($@bty_price+getarg(0)) + .@bty_b_gain;
  1323.             dispbottom "Bounty Hunter: You have recieved "+($@bty_price+getarg(0)+.@bty_b_gain)+" "+$@bty_cvard$+" for killing "+rid2name(getarg(1))+".";
  1324.             dispbottom "You have now "+getd(""+$@bty_cvarn$)+" "+$@bty_cvard$+".";
  1325.             break;
  1326.            
  1327.             case 3: // Bounty Points
  1328.             query_sql "UPDATE `arena_master` SET `bounty_pts` = `bounty_pts` + "+($@bty_price+getarg(0)+.@bty_b_gain)+" WHERE `char_id` = '"+getcharid(0)+"'";
  1329.             dispbottom "Bounty Hunter: You have recieved "+($@bty_price+getarg(0)+.@bty_b_gain)+" Bounty Points for killing "+rid2name(getarg(1))+".";
  1330.             break;
  1331.         }
  1332.         writeBounty(0,getcharid(0,rid2name(getarg(1))));
  1333.         return;
  1334.     }
  1335.    
  1336.     function    writeBounty {
  1337.     // getarg(0) == Kills
  1338.     // getarg(1) == Character ID
  1339.         query_sql "UPDATE `arena_master` SET `bounty` = '"+getarg(0)+"' WHERE `char_id` = '"+getarg(1)+"'";
  1340.         return;
  1341.     }
  1342.    
  1343.     function    PVP_BTY_CMAP    {
  1344.     // =====================================
  1345.     // getarg(0) - Flag Type > $@bty_cmap_type
  1346.     //        1 = Mapflags
  1347.     //        2 = Specific Maps
  1348.     // getarg(1) - strcharinfo(3) value
  1349.     // =====================================
  1350.  
  1351.     // Regular Maps in $@<.>pvp$ & $@gvgr$ array
  1352.         setarray .@pvp_pre$[0],"disp","dm","n","pt2","pt3","pt4","pt5";
  1353.         for ( set .@l,0; .@l < getarraysize(.@pvp_pre$); set .@l,.@l + 1)
  1354.             for ( set .@m,1; .@m < getarraysize(getd("$@"+.@pvp_pre$[.@l]+"pvp$")); set .@m,.@m + 1)
  1355.                 if(getarg(1) != getd("$@"+.@pvp_pre$[.@l]+"pvp$["+.@m+"]"))
  1356.                     set .@f,1;
  1357.                 else
  1358.                     set .@f,0;
  1359.                
  1360.         for ( set .@m,0; .@m < getarraysize($@gvgr$); set .@m,.@m + 1)
  1361.                 if(getarg(1) != $@gvgr$[.@m])
  1362.                     set .@f,1;
  1363.                 else
  1364.                     set .@f,0;
  1365.        
  1366.         // Mapflag
  1367.         if(getarg(0) == 1)
  1368.             if(getmapflag(getarg(1),mf_pvp) == 0 && getmapflag(getarg(1),mf_gvg) == 0)
  1369.                 set .@f,1;
  1370.             else
  1371.                 set .@f,0;
  1372.  
  1373.         // Custom Maps
  1374.         else if(getarg(0) == 2) {
  1375.             // One Map
  1376.             if(getarraysize($@bty_cmaps$) == 1)
  1377.                 if(compare(getarg(1),$@bty_cmaps$[0]) == 0)
  1378.                     set .@f,1;
  1379.                 else
  1380.                     set .@f,0;
  1381.  
  1382.             // Array   
  1383.             else if(getarraysize($@bty_cmaps$) > 1)
  1384.                 for ( set .@m,0; .@m < getarraysize($@bty_cmaps$); set .@m,.@m + 1)
  1385.                     if(compare(getarg(1),$@bty_cmaps$[.@m]) == 0)
  1386.                         set .@f,1;
  1387.                     else
  1388.                         set .@f,0;
  1389.         }
  1390.         return .@f;
  1391.     }
  1392. // =========== End of Function ==========
  1393. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement