Skorm

Ghost's PVP System (Updated v1.4)

Feb 28th, 2022
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 26.18 KB | None | 0 0
  1. //========================================================================================
  2. //Title: Ghost's PvP System (Multi-announcer + Ladder)
  3. //Version: 1.4
  4. //Author: Ghost
  5. //Created: 12/27/2011
  6. //Released: 01/31/2012
  7. //Compatibility: rAthena | eAthena
  8. //Support: TXT & SQL
  9. //rAthena Topic: http://rathena.org/board/topic/58222-ghosts-scripts/
  10. //Required File:
  11. //  SQL Table: http://pastebin.com/dEqrkczy
  12. //  Wav Files: http://www.mediafire.com/?i3uutvdp00jw4r8
  13. //References:
  14. //  http://www.wowwiki.com/Defense_of_the_Ancients:_Allstars
  15. //Additional Note:
  16. //  Multiple kill timer is set to Heroes of Newerth's 18 seconds.
  17. //  KDR Algorithm is originally written by me, Ghost.
  18. //  If you like this PvP System, say thanks at my rAthena topic.
  19. //Glossary:
  20. //  KDR: Kill Death Ratio
  21. //  SK: Streak Kill
  22. //  MK: Multi Kill
  23. //Credits:
  24. //  Thank you to the Athena community.
  25. //Changelog:
  26. //  v1.4 = Removed Loads of frivolous syntax; Optimized bits and bobs. [Skorm]
  27. //  v1.3 = Fixed .PvPMap$[0] settings [Ghost]
  28. //       = Added .GMLevel at configuration [Ghost]
  29. //       = Change SK Hex Color to ^00FF00 for visibility [Ghost]
  30. //       = Fixed Streak Kill ended broadcast [Ghost]
  31. //       = Typographical error (Ms. Pudding to Flamboyant) on Announcer Setting corrected [Ghost]
  32. //           = Changed Top 10 Players ranking from KDR to Kills [Ghost]
  33. //  v1.2 = Fixed obfuscation at PvP Statistics [Ghost]
  34. //  v1.1 = KDR Algorithm update for undefined calculation check [Lighta]
  35. //       = Fixed obfuscation at Nemesis Kill [Lighta]
  36. //  v1.0 = Initial release
  37. //©2011-2012 Ghost
  38. //========================================================================================
  39. -   script  Versus  -1,{
  40. OnInit:
  41.     //--Configuration
  42.     set         .System,        1; //Toggle PvP System (0:Disable|1:Enable)
  43.     set         .ServerType,    1; //Are you using TXT or SQL? (0:TXT|1:SQL)
  44.     set         .GMLevel,       100; //GM levels above or equal this level will be ignored by the system
  45.     setarray    .PvPMap$,       "All"; //List all pvp maps here (Index 0:"All" to enable all maps)
  46.  
  47.     //PvP Ladder
  48.     set         .Top,           10; //What is the length of the list?
  49.     set         .Reset,         3; //Allow players to reset their PvP statistics? (0:Disable|1:Zeny|2:Cashpoint|3:Skull)
  50.     set         .ZenyFee,       0; //How much zeny you want to charge to reset their pvp stat?
  51.     set         .CashFee,       1000; //How much cashpoint you want to charge to reset their pvp stat?
  52.     set         .SkullFee,      1000; //How much skull you want to charge to reset their pvp stat?
  53.     set         .AnnouncerFee,  2000; //How much cashpoint per announcer? (DotA announcer is set as default)
  54.  
  55.     //Reward Setting (Every Kill)
  56.     set         .MaxZeny,       1000000000; //What is the max zeny of the server?
  57.     set         .Zeny,          0; //Earn zeny each kill? (0:Disable)
  58.     set         .Cash,          0; //How much #CASHPOINT every kill? (0:Disable)
  59.     set         .Skull,         1; //Collect player's skull each kill? (0:Disable|1:Enable)
  60.     setarray    .ItemID,        0; //Get items each kill? (0:Disable)
  61.     setarray    .Amount,        0; //How many items per kill?
  62.  
  63.     //Penalty Setting
  64.     set         .Feed,          10; //How many kills before feeding is called? (10:Recommended)
  65.     set         .Penalty,       1; //What is the penalty for the feedee? (0:Disable|1:Kill Rollback|2:Server Kick|3:Server Block)
  66.     set         .Kick,          1; //Who to kick? (1:Feedee|2:Feeder|3:Both)
  67.     set         .Rollback,      10; //How many times should the kill count rollback when feeding is called? (10:Recommended)
  68.  
  69.     //Announcer Setting
  70.     set         .Broadcast,     bc_map; //Where do you want to broadcast? ( bc_all | bc_map )
  71.     set         .Streak,        1; //Show number of killing streak in broadcast? e.g. Ghost is Beyond Godlike(8)
  72.     set         .Multiple,      1; //Show number of multiple kill in broadcast? e.g. Makizushi just got an Ownage(5)
  73.     set         .Nemesis,       1; //Show number of nemesis in broadcast? e.g. Epoque is owning Jguy(9)
  74.     set         .Feeder,        1; //Show number of feed in broadcast? e.g. Cookies is feeding `KeiKun(10)
  75.     set         .RandKillWord,  1; //Randomize the kill words? e.g. Arcenciel "Kill Word" jTynne (0:Disable|Default:"pwned")
  76.     setarray    .KillWord$,
  77.                 "pwned", "killed", "disintegrated", "neutralized"; //Enable above setting for this to work
  78.  
  79.     //Broadcast Color | See HexTable: http://johncfish.com/bggallery/otherchart/hextable.gif
  80.     set         .KColor$,       "0xFFFF00"; //Kill Broadcast Color | e.g. Jguy pwned Mercurial
  81.     set         .KSColor$,      "0xFFFF00"; //Killing Streak Broadcast Color | e.g. jTynne is on a Killing Spree
  82.     set         .MKColor$,      "0x33FF00"; //Multiple Kill Broadcast Color | e.g. Mercurial just got a Double Kill
  83.     set         .ESColor$,      "0xFF0000"; //End Streak Broadcast Color | e.g. BrianL just ended Jguy's Killing Spree
  84.     set         .NMColor$,      "0x0099FF"; //Nemesis Broadcast Color | e.g. Xazax is owning Cookies
  85.     set         .PBColor$,      "0xFF0000"; //Payback Broadcast Color | e.g. Makizushi just have a payback againts lilcooldude69
  86.     set         .FDColor$,      "0xFF00CC"; //Feeder Broadcast Color | e.g. Cookies is feeding Z3R0
  87.  
  88.     //--Warning: Critical Setting | Killing Streaks and Multiple Kills Announcer
  89.     setarray    .KSDotA$,   "is on a Killing Spree", "is Dominating", "has a Mega-Kill", "is Unstoppable", "is Wicked Sick", "has a M-m-m-m....Monster Kill", "is Godlike", "is Beyond Godlike";
  90.     setarray    .KSHoN$,        "is a Serial Killer", "is an Ultimate Warrior", "is Legendary", "is on an Onslaught!", "is Savage Sick", "is Dominating", "has a Bloodbath", "is Immortal"; //Took out #9. Champion of Newearth
  91.     setarray    .MKDotA$,   "just got a Double Kill", "just got a Triple Kill", "just got an Ultra Kill", "is on a Rampage", "is Owning his enemies";
  92.     setarray    .MKHoN$,        "just got a Double Tap", "just got a Hat Trick", "just got an Quad Kill", "annihilated his enemies", "just got a Genocide";
  93.     setarray    .ESDotA$,   "Killing Spree", "Dominating", "Mega-Kill", "Unstoppable", "Wicked Sick", "Monster Kill", "Godlike", "Beyond Godlike";
  94.     setarray    .ESHoN$,        "Serial Killer", "Ultimate Warrior", "Legendary", "Onslaught", "Savage Sick", "Dominating", "Bloodbath", "Immortal"; //Took out #9. Champion of Newearth
  95.     setarray    .EMDotA$,   "Double Kill", "Triple Kill", "Ultra Kill", "Rampage", "Ownage";
  96.     setarray    .EMHoN$,        "Double Tap", "Hat Trick", "Quad Kill", "Annihilation", "Genocide";
  97.  
  98.     //--Warning: Fail Safe | Do Not Touch
  99. /*  set .System, ( .System < 0 ) ? 0 : .System;
  100.     set .ServerType, ( .ServerType < 0 ) ? 0 : .ServerType;
  101.     set .Ladder, ( .Ladder < 0 ) ? 0 : .Ladder;
  102.     set .Top, ( .Top < 0 ) ? 0 : .Top;
  103.     //set .GMLevel, ( .GMLevel < 0 ) ? 0 : ( ( .GMLevel > 99 ) ? 99 : .GMLevel );
  104.     set .Reset, ( .Reset < 0 ) ? 0 : ( ( .Reset > 3 ) ? 3 : .Reset );
  105.     set .ZenyFee, ( .ZenyFee < 0 ) ? 0 : ( ( .ZenyFee > .MaxZeny ) ? .MaxZeny : .ZenyFee );
  106.     set .CashFee, ( .CashFee < 0 ) ? 0 : .CashFee;
  107.     set .SkullFee, ( .SkullFee < 0 ) ? 0 : .SkullFee;
  108.     set .Zeny, ( .Zeny < 0 ) ? 0 : ( ( .Zeny > .MaxZeny ) ? .MaxZeny : .Zeny );
  109.     set .Cash, ( .Cash < 0 ) ? 0 : .Cash;
  110.     if( .Feed < 1){ set .Feed, 0; }
  111.     if( .Penalty > 3){ set .Penalty, 3; }
  112.     if( .Penalty < 1){ set .Penalty, 0; }
  113.     if( .Rollback < 1){ set .Rollback, 0; }
  114.     if( .Streak > 1){ set .Streak, 1; }
  115.     if( .Streak < 1){ set .Streak, 0; }
  116.     if( .Multiple > 1){ set .Multiple, 1; }
  117.     if( .Multiple < 1){ set .Multiple, 0; }
  118.     if( .Nemesis > 1){ set .Nemesis, 1; }
  119.     if( .Nemesis < 0){ set .Nemesis, 0; }
  120.     if( .Feeder > 1){ set .Feeder, 1; }
  121.     if( .Feeder < 1){ set .Feeder, 0; }
  122.     if( .RandKillWord > 1 ) set .RandKillWord, 1;
  123.     if( .RandKillWord < 0 ) set .RandKillWord, 0;*/
  124.    
  125.     //SQL Bits
  126.     query_sql (
  127.         "CREATE TABLE IF NOT EXISTS `pvp_rank` ("+
  128.         "`char_id` int(11) NOT NULL,"+
  129.         "`account_id` int(11) NOT NULL,"+
  130.         "`char` varchar(30) NOT NULL,"+
  131.         "`kill` int(11) NOT NULL,"+
  132.         "`death` int(11) NOT NULL,"+
  133.         "`kdr` varchar(30) NOT NULL,"+
  134.         "`killingstreak` int(11) NOT NULL,"+
  135.         "`multikill` int(11) NOT NULL,"+
  136.         "`killingspree` int(11) NOT NULL,"+
  137.         "`dominating` int(11) NOT NULL,"+
  138.         "`megakill` int(11) NOT NULL,"+
  139.         "`unstoppable` int(11) NOT NULL,"+
  140.         "`wickedsick` int(11) NOT NULL,"+
  141.         "`monsterkill` int(11) NOT NULL,"+
  142.         "`godlike` int(11) NOT NULL,"+
  143.         "`beyondgodlike` int(11) NOT NULL,"+
  144.         "`doublekill` int(11) NOT NULL,"+
  145.         "`triplekill` int(11) NOT NULL,"+
  146.         "`ultrakill` int(11) NOT NULL,"+
  147.         "`rampage` int(11) NOT NULL,"+
  148.         "`ownage` int(11) NOT NULL,"+
  149.         "`nemesiskill` int(11) NOT NULL,"+
  150.         "`feedcount` int(11) NOT NULL,"+
  151.         "PRIMARY KEY (`char_id`)"+
  152.         ") ENGINE=MyISAM;"
  153.     );
  154.     end;
  155.  
  156. OnPCKillEvent:
  157.     if( .System ) {
  158.         if( getgmlevel() >= .GMLevel )
  159.             end;
  160.         if( !compare( .PvPMap$[0], "All" ) )
  161.             for( set .@i, 0; .@i < ( getarraysize(.PvPMap$) - 1 ); set .@i, .@i + 1 )
  162.                 if( strcharinfo(3) != .PvPMap$[.@i] )
  163.                     end;
  164.                
  165.         if( @nm == .Feed && .Penalty ) {
  166.             dispbottom "Penalized";
  167.             callsub OnClearData;
  168.             setarray .@penalty_cmd$[2], "kick", "block";
  169.             switch ( .Penalty ) {
  170.                 case 1: callsub OnRollback; break;
  171.                 default: callsub OnRollback;
  172.                     if( .Kick & 1 ) atcommand "@"+.@penalty_cmd$[.Penalty]+" "+strcharinfo(0);
  173.                     if( .Kick & 2 ) atcommand "@"+.@penalty_cmd$[.Penalty]+" "+rid2name(killedrid);
  174.                     break;
  175.             }
  176.         }
  177.        
  178.         //Rewards Per-kill.
  179.         if( @nm < .Feed ) {
  180.             if( .Zeny && ( ( Zeny + .Zeny ) < .MaxZeny ) )
  181.                 set Zeny, Zeny + .Zeny;
  182.             if( .Cash )
  183.                 dispbottom "[Point System] +1 Cashpoint."; set #CASHPOINT, #CASHPOINT + .Cash;
  184.             if( .Skull )
  185.                 getnameditem 7420, rid2name(killedrid);
  186.             for( set .@i, 0; .@i < getarraysize(.ItemID); set .@i, .@i + 1 )
  187.                 if(.ItemID) getitem .ItemID[.@i], .Amount[.@i];
  188.         }
  189.            
  190.         announce strcharinfo(0)+" "+( .RandKillWord ? .KillWord$[ rand( getarraysize( .KillWord$ ) ) ] : "pwned" )+" "+rid2name(killedrid)+"'s head", .Broadcast, .KColor$;
  191.         set Kill, Kill + 1;
  192.         if( @ks < 10 )
  193.             set @ks, @ks + 1;
  194.         if( @mk < 6 )
  195.             set @mk, @mk + 1;
  196.         if( !NemesisKilled )
  197.             set NemesisKilled, killedrid;
  198.         if( NemesisKilled == killedrid )
  199.             set @nm, @nm + 1;
  200.         deltimer "Versus::OnMKReset";
  201.         addtimer 18000, "Versus::OnMKReset";
  202.         callsub OnRecordStreak;
  203.         dispbottom "KS: "+@ks;
  204.         callsub OnAnnounce;
  205.     }
  206.     end;
  207.  
  208. OnPCDieEvent:
  209.     if( .System ) {
  210.         if( getgmlevel() >= .GMLevel || killerrid < 2000000 || killerrid > 3000000 )
  211.             end;
  212.         if( !compare( .PvPMap$[0], "All" ) ) {
  213.             for(set .@i, 0; .@i < getarraysize(.PvPMap$); set .@i, .@i + 1)
  214.                 if( strcharinfo(3) == .PvPMap$[.@i] ) {
  215.                     set Death, Death + 1;
  216.                     break;
  217.                 }
  218.         } else
  219.             set Death, Death + 1;
  220.         callsub OnDeath;
  221.     }
  222.     end;
  223.  
  224. OnPCLogoutEvent:
  225.     if( .System ) {
  226.         if( getgmlevel() >= .GMLevel )
  227.             end;
  228.         set NemesisKilled, 0;
  229.         if( .ServerType && Kill )
  230.             query_sql("REPLACE INTO `pvp_rank` (`char_id`, `account_id`, `char`, `kill`, `death`, `kdr`, `killingstreak`, `multikill`,  `nemesiskill`, `feedcount`,`killingspree`, `dominating`, `megakill`, `unstoppable`, `wickedsick`, `monsterkill`, `godlike`, `beyondgodlike`, `doublekill`, `triplekill`, `ultrakill`, `rampage`, `ownage`) VALUES ("+getcharid(0)+","+getcharid(3)+", '"+rid2name(getcharid(3))+"', "+Kill+", "+Death+", '"+callfunc("KDR_Calc", Kill, ( !Death ? 1 : Death ))+"', "+KillingStreak+", "+MultiKill+",  "+NemesisKill+", "+FeedCount+", "+KillingSpree+", "+Dominating+", "+MegaKill+", "+Unstoppable+", "+WickedSick+", "+MonsterKill+", "+Godlike+", "+BeyondGodlike+", "+DoubleKill+", "+TripleKill+", "+UltraKill+", "+Rampage+", "+Ownage+")");
  231.     }
  232.     end;
  233.  
  234. OnRecordStreak:
  235.     if( @ks > 2 ) {
  236.         set KillingStreak, KillingStreak + 1;
  237.         switch( @ks ) {
  238.             case 3: set KillingSpree, KillingSpree + 1;     break;
  239.             case 4: set Dominating, Dominating + 1;         break;
  240.             case 5: set MegaKill, MegaKill + 1;             break;
  241.             case 6: set Unstoppable, Unstoppable + 1;       break;
  242.             case 7: set WickedSick, WickedSick + 1;         break;
  243.             case 8: set MonsterKill, MonsterKill + 1;       break;
  244.             case 9: set Godlike, Godlike + 1;               break;
  245.             case 10: set BeyondGodlike, BeyondGodlike + 1;  break;
  246.             default: break;
  247.         }
  248.     }
  249.     if( @mk > 1 ) {
  250.         set MultiKill, MultiKill + 1;
  251.         switch( @mk ) {
  252.             case 2: set DoubleKill, DoubleKill + 1; break;
  253.             case 3: set TripleKill, TripleKill + 1; break;
  254.             case 4: set UltraKill, UltraKill + 1;   break;
  255.             case 5: set Rampage, Rampage + 1;       break;
  256.             case 6: set Ownage, Ownage + 1;         break;
  257.             default: break;
  258.         }
  259.     }
  260.     if( @nm > 3 && @nm < .Feed )
  261.         set NemesisKill, NemesisKill + 1;
  262.     if( @nm >= .Feed )
  263.         set FeedCount, FeedCount + 1;
  264.     return;
  265.  
  266. OnAnnounce:
  267.     if( @ks == 1 && Kill == 1 ) {
  268.         announce strcharinfo(0)+( !#Announcer ? " drew first blood" : " got bloodlust" ), .Broadcast, .KSColor$;
  269.         soundeffectall ""+#Announcer+"_KS"+1+".wav", 0, strcharinfo(3);
  270.     }
  271.     if( @ks > 2 ) {
  272.         announce strcharinfo(0)+" "+( !#Announcer ? .KSDotA$[@ks - 3] : .KSHoN$[@ks - 3] )+" "+((.Streak)?"("+@ks+")":"")+"", .Broadcast, .KSColor$;
  273.         soundeffectall ""+#Announcer+"_KS"+@ks+".wav", 0, strcharinfo(3);
  274.     }
  275.     if( @mk > 1 ) {
  276.         announce strcharinfo(0)+" "+( !#Announcer ? .MKDotA$[@mk - 2] : .MKHoN$[@mk - 2] )+" "+((.Multiple)?"("+@mk+")":"")+"", .Broadcast, .MKColor$;
  277.         sleep2 1500;
  278.         soundeffectall ""+#Announcer+"_MK"+@mk+".wav", 0, strcharinfo(3);
  279.     }
  280.     if( @nm > 3 && @nm < .Feed ) {
  281.         announce strcharinfo(0)+" is owning "+rid2name(NemesisKilled)+" "+((.Nemesis)?"("+@nm+")":"")+"", .Broadcast, .NMColor$;
  282.         sleep2 2000;
  283.         if( #Announcer > 0 ) { soundeffectall #Announcer+"_Nemesis.wav", 0, strcharinfo(3); } else { soundeffectall "1_Nemesis.wav", 0; }
  284.     }
  285.     if( @nm >= .Feed ) {
  286.         announce rid2name(NemesisKilled)+" is feeding "+strcharinfo(0)+" "+((.Feeder)?"("+@nm+")":"")+"", .Broadcast, .FDColor$;
  287.         sleep2 1500;
  288.         soundeffectall "Feeder.wav", 0, strcharinfo(3);
  289.     }
  290.     return;
  291.  
  292. OnDeath:
  293.     if( @ks > 2 )
  294.         announce rid2name( killerrid )+" just ended "+strcharinfo(0)+"'s "+( !#Announcer ? .ESDotA$[@ks - 3] : .ESHoN$[@ks - 3] )+" "+((.Streak)?"("+@ks+")":"")+"", .Broadcast, .ESColor$;
  295.     if( @nm > 3 ) {
  296.         soundeffectall #Announcer+"_Payback.wav", 0, rid2name(killedrid);
  297.         announce rid2name( killerrid )+" just got payback against "+strcharinfo(0)+" "+((.Nemesis)?"("+@nm+")":"")+"", .Broadcast, .PBColor$;
  298.     }
  299.     callsub OnClearData;
  300.     return;
  301.  
  302. OnMKReset:
  303.     set @mk, 0;
  304.     end;
  305.    
  306. OnClearData:
  307.     sleep2 1000;
  308.     set NemesisKilled, 0;
  309.     set @ks, 0;
  310.     set @mk, 0;
  311.     set @nm, 0;
  312.     return;
  313.  
  314. OnRollback:
  315.     if( .Zeny )
  316.         set Zeny, Zeny - (.Zeny * .Rollback);
  317.     if( .Cash ) {
  318.         dispbottom "[Point System] -"+(.Cash * .Rollback)+" Cashpoint.";
  319.         set #CASHPOINT, #CASHPOINT - ( .Cash * .Rollback );
  320.     }
  321.     if( .Skull )
  322.         delitem 7420, .Rollback;
  323.     for( set .@i, 0; .@i < getarraysize(.ItemID); set .@i, .@i + 1 )
  324.         if( .ItemID ) delitem .ItemID[.@i], .Amount[.@i] * .Rollback;
  325.        
  326.     set Kill,           ( ( Kill - .Rollback ) > 0 )                ? ( Kill - .Rollback )              : 0;
  327.     set KillingSpree,   ( ( KillingSpree - 1 ) > 0 )                ? ( KillingSpree - 1 )              : 0;
  328.     set Dominating,     ( ( Dominating - 1 ) > 0 )                  ? ( Dominating - 1 )                : 0;
  329.     set MegaKill,       ( ( MegaKill - 1 ) > 0 )                    ? ( MegaKill - 1 )                  : 0;
  330.     set Unstoppable,    ( ( Unstoppable - 1 ) > 0 )                 ? ( Unstoppable - 1 )               : 0;
  331.     set WickedSick,     ( ( WickedSick - 1 ) > 0 )                  ? ( WickedSick - 1 )                : 0;
  332.     set MonsterKill,    ( ( MonsterKill - 1 ) > 0 )                 ? ( MonsterKill - 1 )               : 0;
  333.     set Godlike,        ( ( Godlike - 1 ) > 0 )                     ? ( Godlike - 1 )                   : 0;
  334.     set BeyondGodlike,  ( ( BeyondGodlike - 1 ) > 0 )               ? ( BeyondGodlike - 1 )             : 0;
  335.     set DoubleKill,     ( ( DoubleKill - 1 ) > 0 )                  ? ( DoubleKill - 1 )                : 0;
  336.     set TripleKill,     ( ( TripleKill - 1 ) > 0 )                  ? ( TripleKill - 1 )                : 0;
  337.     set UltraKill,      ( ( UltraKill - 1 ) > 0 )                   ? ( UltraKill - 1 )                 : 0;
  338.     set Rampage,        ( ( Rampage - 1 ) > 0 )                     ? ( Rampage - 1 )                   : 0;
  339.     set Ownage,         ( ( Ownage - 1 ) > 0 )                      ? ( Ownage - 1 )                    : 0;
  340.     set NemesisKill,    ( ( NemesisKill - (.Rollback - 3) ) > 0 )   ? ( NemesisKill - (.Rollback - 3) ) : 0;
  341.     announce "[Anti-Feed] Your kill count has been rollbacked "+.Rollback+" times.",bc_self,0xFF0000;
  342.     return;
  343.    
  344. //Added Functions
  345. function broadcast { return ( ( getarg(0) ) ? bc_all : bc_map ); }
  346. }
  347.  
  348. morocc,162,107,3    script  Loki    467,{
  349.     mes "[Loki]"; mes "What can I do for you today?";
  350.     switch( select( "Player Ranking:My PvP Statistic:Announcer Setting" ) ) {
  351.         case 1: //Player Ranking
  352.             next;
  353.             if( getvariableofnpc(.ServerType, "Versus") ) {
  354.                 mes "[Top "+getvariableofnpc(.Top, "Versus")+" PvP Players]";
  355.                 mes "^0000FFKill^000000 | ^FF0000Death^000000 | ^FF22FFKDR^000000 | ^00FF00SK^000000 | ^666666MK^000000";
  356.                 query_sql "SELECT `char`, `kill`, `death`, `kdr`, `killingstreak`, `multikill` FROM `pvp_rank` ORDER BY `pvp_rank`.`kill` DESC LIMIT "+getvariableofnpc(.Top, "Versus")+"", .@char$, .@kill, .@death, .@kdr$, .@sk, .@mk;
  357.                 for(set .@i, 0; .@i < getarraysize(.@char$); set .@i, .@i + 1){
  358.                     mes .@i+1+". "+.@char$[.@i]+" ^0000FF"+.@kill[.@i]+"^000000 ^FF0000"+.@death[.@i]+"^000000 ^FF22FF"+.@kdr$[.@i]+"^000000 ^00FF00"+.@sk[.@i]+"^000000 ^666666"+.@mk[.@i]+"^000000 ";
  359.                 }
  360.                 close;
  361.             } else {
  362.                 mes "Top "+getvariableofnpc(.Top, "Versus")+" ranking is not yet implemented for this server type.";
  363.             }
  364.         case 2: //PvP Statistic
  365.             next;
  366.             mes strcharinfo(0)+"'s PvP Statistic"; mes "^666666Kill:^000000 "+Kill+" ^666666Death:^000000 "+Death+" ^666666KDR:^000000 "+callfunc("KDR_Calc", Kill, ( !Death ? 1 : Death ))+"^000000";
  367.             mes "^666666Killing Streak:^000000 "+KillingStreak+" ^666666Multi-Kills:^000000 "+MultiKill+"";
  368.             switch(select("Killing Streak:Multi-Kill Streak:Nemesis Streak:"+(getvariableofnpc(.Reset, "Versus")?"Reset":"")+"")){
  369.                 case 1: //Killing Streak
  370.                     next;
  371.                     setarray .LSDotA$[0], ""+KillingSpree+"", ""+Dominating+"", ""+MegaKill+"", ""+Unstoppable+"", ""+WickedSick+"", ""+MonsterKill+"", ""+Godlike+"", ""+BeyondGodlike+"";
  372.                     mes "Killing Streak Stats";
  373.                     switch(#Announcer){
  374.                         case 0:
  375.                             for(set .@i, 0; .@i < getarraysize(.LSDotA$); set .@i, .@i + 1){
  376.                                 mes "^666666"+getvariableofnpc(.ESDotA$[.@i], "Versus")+"^000000: "+ .LSDotA$[.@i];
  377.                              }
  378.                             close;
  379.                         default:
  380.                             for(set .@i, 0; .@i < getarraysize(.LSDotA$); set .@i, .@i + 1){
  381.                                 mes "^666666"+getvariableofnpc(.ESHoN$[.@i], "Versus")+"^000000: "+ .LSDotA$[.@i];
  382.                              }
  383.                             close;
  384.                     }
  385.                     close;
  386.                 case 2: //Multi-Kill
  387.                     next;
  388.                     setarray .LMDotA$[0], ""+DoubleKill+"", ""+TripleKill+"", ""+UltraKill+"", ""+Rampage+"", ""+Ownage+"";
  389.                     mes "Multi-Kill Stats";
  390.                     switch(#Announcer){
  391.                         case 0:
  392.                             for(set .@i, 0; .@i < getarraysize(.LMDotA$); set .@i, .@i + 1){
  393.                                 mes "^666666"+getvariableofnpc(.EMDotA$[.@i], "Versus")+"^000000: "+ .LMDotA$[.@i];
  394.                              }
  395.                             close;
  396.                         default:
  397.                             for(set .@i, 0; .@i < getarraysize(.LMDotA$); set .@i, .@i + 1){
  398.                                 mes "^666666"+getvariableofnpc(.EMHoN$[.@i], "Versus")+"^000000: "+ .LMDotA$[.@i];
  399.                              }
  400.                             close;
  401.                     }
  402.                 case 3: //Nemesis
  403.                     next;
  404.                     mes "Nemesis Stat";
  405.                     mes "^666666Nemesis Kill^000000: "+NemesisKill;
  406.                     mes "^666666Feed Count^000000: "+FeedCount;
  407.                     close;
  408.                 case 4: //Reset Stat
  409.                     next;
  410.                     set .Reset, getvariableofnpc(.Reset, "Versus");
  411.                     set .ZenyFee, getvariableofnpc(.ZenyFee, "Versus");
  412.                     set .CashFee, getvariableofnpc(.CashFee, "Versus");
  413.                     set .SkullFee, getvariableofnpc(.SkullFee, "Versus");
  414.                     mes "[Loki]"; mes "Are you sure you want to reset your PvP Statistics?";
  415.                     if(.Reset == 1){ mes "^FF0000Reset Fee:^000000 "+.ZenyFee+" Zeny."; }
  416.                     if(.Reset == 2){ mes "^FF0000Reset Fee:^000000 "+.CashFee+" Cashpoints."; }
  417.                     if(.Reset == 3){ mes "^FF0000Reset Fee:^000000 "+.SkullFee+" Skulls."; }
  418.                     switch(select("No:Yes")) {
  419.                         case 1: close;
  420.                         case 2:
  421.                             switch(.Reset) {
  422.                                 case 0: break;
  423.                                 case 1:
  424.                                     if(Zeny < .ZenyFee) { next; mes "[Loki]"; mes "You don't have enough Zeny."; close; }
  425.                                     set Zeny, Zeny - .ZenyFee; break;
  426.                                 case 2:
  427.                                     if(#CASHPOINTS < .CashFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  428.                                     set #CASHPOINTS, #CASHPOINTS - .CashFee; break;
  429.                                 case 3:
  430.                                     if(countitem(7420) < .SkullFee) { next; mes "[Loki]"; mes "You don't have enough Skull."; close; }
  431.                                     delitem 7420, .SkullFee; break;
  432.                                 default: break;
  433.                             }
  434.                             if( getvariableofnpc(.ServerType, "Versus") ) { query_sql "DELETE FROM `pvp_rank` WHERE `pvp_rank`.`char_id` = "+getcharid(0)+""; }
  435.                             callsub OnPvPReset; announce "[Loki] Your PvP Statistic has been reset.",bc_self,0xFF0000; close;
  436.                     }
  437.                     close;
  438.                 }
  439.                 close;
  440.         case 3: //Announcer Setting
  441.             next; mes "[Loki]"; mes "What kind of announcer you want to use?";
  442.             if( getvariableofnpc( .AnnouncerFee, "Versus" ) )
  443.                 set .AnnouncerFee, getvariableofnpc(.AnnouncerFee, "Versus");
  444.             L_Announce:
  445.                 switch(select(""+((#Announcer == 0)?"^FF0000DotA^000000":"DotA")+":"+((#Announcer == 1)?"^FF0000HoN^000000":"HoN")+":"+((#Announcer == 2)?"^FF0000Ms. Pudding^000000":"Ms. Pudding")+":"+((#Announcer == 3)?"^FF0000Flamboyant^000000":"Flamboyant")+":"+((#Announcer == 4)?"^FF0000English^000000":"English")+":"+((#Announcer == 5)?"^FF0000Balls of Steel^000000":"Balls of Steel")+":"+((#Announcer == 6)?"^FF0000BreakyCPK^000000":"BreakyCPK")+"")) {
  446.                     case 1: //DotA
  447.                         if(#Announcer == 0){ goto L_Announce; }
  448.                         soundeffect "0_KS1.wav", 0;
  449.                         set #Announcer, 0;
  450.                         announce "[Loki] DotA announcer has been configured to your account.",bc_self,0xFF0000;
  451.                         close;
  452.                     case 2: //HoN
  453.                         if(#Announcer == 1){ goto L_Announce; }
  454.                         if((.AnnouncerFee) && (!#Hon)) {
  455.                         next; mes "[Loki]"; mes "Do you want to purchase HoN announcer for "+.AnnouncerFee+" Cashpoints?";
  456.                             switch(select("No:Yes")) {
  457.                                 case 1: close;
  458.                                 case 2:
  459.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  460.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  461.                                 set #Hon, 1;
  462.                             }
  463.                         }
  464.                         soundeffect "1_KS1.wav", 0;
  465.                         set #Announcer, 1;
  466.                         announce "[Loki] HoN announcer has been configured to your account.",bc_self,0xFF0000;
  467.                         close;
  468.                     case 3: //Ms. Pudding
  469.                         if(#Announcer == 2){ goto L_Announce; }
  470.                         if((.AnnouncerFee) && (!#MsPudding)) {
  471.                         next; mes "[Loki]"; mes "Do you want to purchase Ms. Pudding announcer for "+.AnnouncerFee+" Cashpoints?";
  472.                             switch(select("No:Yes")){
  473.                                 case 1: close;
  474.                                 case 2:
  475.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  476.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  477.                                 set #MsPudding, 1;
  478.                             }
  479.                         }
  480.                         soundeffect "2_KS1.wav", 0;
  481.                         set #Announcer, 2;
  482.                         announce "[Loki] Ms. Pudding announcer has been configured to your account.",bc_self,0xFF0000;
  483.                         close;     
  484.                     case 4: //Flamboyant
  485.                         if(#Announcer == 3){ goto L_Announce; }
  486.                         if((.AnnouncerFee) && (!#Flamboyant)) {
  487.                         next; mes "[Loki]"; mes "Do you want to purchase Flamboyant announcer for "+.AnnouncerFee+" Cashpoints?";
  488.                             switch(select("No:Yes")) {
  489.                                 case 1: close;
  490.                                 case 2:
  491.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  492.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  493.                                 set #Flamboyant, 1;
  494.                             }
  495.                         }
  496.                         soundeffect "3_KS1.wav", 0;
  497.                         set #Announcer, 3;
  498.                         announce "[Loki] Flamboyant announcer has been configured to your account.",bc_self,0xFF0000;
  499.                         close;         
  500.                     case 5: //English
  501.                         if(#Announcer == 4){ goto L_Announce; }
  502.                         if((.AnnouncerFee) && (!#English)) {
  503.                         next; mes "[Loki]"; mes "Do you want to purchase English announcer for "+.AnnouncerFee+" Cashpoints?";
  504.                             switch(select("No:Yes")) {
  505.                                 case 1: close;
  506.                                 case 2:
  507.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  508.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  509.                                 set #English, 1;
  510.                             }
  511.                         }
  512.                         soundeffect "4_KS1.wav", 0;
  513.                         set #Announcer, 4;
  514.                         announce "[Loki] English announcer has been configured to your account.",bc_self,0xFF0000;
  515.                         close;
  516.                     case 6: //Balls of Steel
  517.                         if(#Announcer == 5){ goto L_Announce; }
  518.                         if((.AnnouncerFee) && (!#BallsofSteel)) {
  519.                         next; mes "[Loki]"; mes "Do you want to purchase Balls of Steel announcer for "+.AnnouncerFee+" Cashpoints?";
  520.                             switch(select("No:Yes")) {
  521.                                 case 1: close;
  522.                                 case 2:
  523.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  524.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  525.                                 set #BallsofSteel, 1;
  526.                             }
  527.                         }
  528.                         soundeffect "5_KS1.wav", 0;
  529.                         set #Announcer, 5;
  530.                         announce "[Loki] Balls of Steel announcer has been configured to your account.",bc_self,0xFF0000;
  531.                         close;
  532.                     case 7: //BreakyCPK
  533.                         if(#Announcer == 6){ goto L_Announce; }
  534.                         if((.AnnouncerFee) && (!#BreakyCPK)) {
  535.                             next; mes "[Loki]"; mes "Do you want to purchase BreakyCPK announcer for "+.AnnouncerFee+" Cashpoints?";
  536.                             switch(select("No:Yes")) {
  537.                                 case 1: close;
  538.                                 case 2:
  539.                                 if(#CASHPOINTS < .AnnouncerFee) { next; mes "[Loki]"; mes "You don't have enough Cashpoints."; close; }
  540.                                 set #CASHPOINTS, #CASHPOINTS - .AnnouncerFee;
  541.                                 set #BreakyCPK, 1;
  542.                             }
  543.                         }
  544.                         soundeffect "6_KS1.wav", 0;
  545.                         set #Announcer, 6;
  546.                         announce "[Loki] BreakyCPK announcer has been configured to your account.",bc_self,0xFF0000;
  547.                         close;
  548.                     default:
  549.                         close;
  550.                 }
  551.             end;
  552.     }
  553. close;
  554.  
  555. OnPvPReset:
  556.     set Kill, 0;
  557.     set Death, 0;
  558.     set KillingStreak, 0;
  559.     set MultiKill, 0;
  560.     set KillingSpree, 0;
  561.     set Dominating, 0;
  562.     set MegaKill, 0;
  563.     set Unstoppable, 0;
  564.     set WickedSick, 0;
  565.     set MonsterKill, 0;
  566.     set Godlike, 0;
  567.     set BeyondGodlike, 0;
  568.     set DoubleKill, 0;
  569.     set TripleKill, 0;
  570.     set UltraKill, 0;
  571.     set Rampage, 0;
  572.     set Ownage, 0;
  573.     set NemesisKill, 0;
  574.     set FeedCount, 0;
  575.     return;
  576. }
  577.  
  578. //Ghost's KDR Algorithm
  579. function    script  KDR_Calc    {
  580.     if(!getarg(1)) { debugmes "Error in KDR function, getarg(1) invalid value"; return 0; } // [Lighta]
  581.     if(getarg(0) >= getarg(1)) {
  582.         if(getarg(1)) {
  583.             set .@i, getarg(0)/getarg(1);
  584.             if((getarg(0)%getarg(1)) == 0) { return .@i+".00"; }
  585.             set .@j, (getarg(0)%getarg(1))*100/getarg(1);
  586.             return .@i+"."+.@j;
  587.         } else {
  588.             return getarg(0)+".00";
  589.         }
  590.     }
  591.     if( getarg(0) < getarg(1) ) {
  592.         if( getarg(0) ) {
  593.             set .@i, (getarg(0)*10)/getarg(1);
  594.             set .@j, ((getarg(0)*10)%getarg(1))*10/getarg(1);
  595.         return "0."+.@i +.@j;
  596.         } else {
  597.             return "0.00";
  598.         }
  599.      }
  600.  }
Add Comment
Please, Sign In to add comment