//===== EinherjarRo Scripts ================================== //= PvP Ladder //===== Author =============================================== //= Stolao //===== Current Version: ===================================== //= 3.21 //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= // Configurable Pvp Ladder //===== Comments: ============================================ //= [Stolao] //===== Additional Comments: ================================= //= 3.00 Overhaul //= 3.01 Fixed missing "No" for "No Ygg" //= 3.02 Added Show Map Name Option //= 3.03 Added Max Players Option //= 3.04 Optimized and fixed SQL queries [Secret] //= 3.05 Replaced some queries with addrid(0) //= 3.06 Updated Rewards to RODEX compatable //= 3.07 Fixed all rom referancing room [0] player limit //= 3.08 Made Made .MaxPlayers = 0, mean unlimited //= 3.09 Removed use of getd //= 3.0A Cleaned up some code //= 3.0B Moved Menu Generation to fix Map Count not showing //= 3.0C Actually Added RoDex Support now //= 3.0D Fixed Map Menu Generation //= 3.0E Fixed sql query //= 3.0F Cleaned Code a bit //= 3.10 Did more Cleaned Code a bit //= 3.11 Fixed a logic bug in GM reset //= 3.12 Added Waiting Room //= 3.13 Added Dynamic Waiting Room //= 3.14 Moved and added more At_Commands //= 3.15 Dynamic Waiting Room (&4096) require Waiting Room (&2048) to work //= 3.16 Increased Waiting Room Rotation Time //= 3.17 Fixed Typos in Reset PVP Stats //= 3.18 Removed unnessisary next, creating hang screens //= 3.19 Made compatable with new mail command //= 3.1A Reformatted Rewards in conf to support 5 items //= 3.1B Fixeda Hang when entering Nightmare PVP (thanks klesler) //= 3.1C Cied incorrrect use of close //= 3.1D Fixed Missing Party Check (thanks Haikenz) //= 3.1E Fixed Not opening PVP ladder, only GVG ladder (thanks Haikenz) //= 3.1F Fixed a warning when generating waitingroom //= 3.20 Fixed Missing Guild Check (thanks Haikenz) //= 3.21 Changed Default maps to pvp maps //===== Todo: ================================================ //= Condence repeat queries //===== Contact Ifo: ========================================= //= [Stolao] // Email: Taingram11@gmail.com //============================================================ prontera,161,196,2 script Ladder 837,{ //================================== OnPvpLadder: //-- Menus //================================== .@Menu = select(((getarraysize(.MapName$))?"Enter PvP Map:":":")+ ((.Options&1)?"Pvp Ladder:":":")+ ((.Options&2)?"GvG Ladder:":":")+ ((.Options&8)?"Top Guild:":":")+ ((.Options&16)?"PvP Shops:":":")+ ((.Options&1 || .Options&2 || .Options&8 || .Options&16)?"Personal Stats:":":")+ ((getgmlevel() >= 99)?"Reset PVP Stats":"")); switch(.@Menu){ case 2: case 3: if(.@Menu == 2){ if(.Options&384) .@key$ = "m_kda"; else if(.Options&256) .@key$ = "kda"; else if(.Options&128) .@key$ = "m_pkcount"; else .@key$ = "pl_pkcount"; } else { if(.Options&384) .@key$ = "gvg_kda"; else if(.Options&256) .@key$ = "m_gvg_kda"; else if(.Options&128) .@key$ = "m_gvg_kcount"; else .@key$ = "gvg_kcount"; } query_sql("SELECT `char_reg_num`.`value`,`char`.`name`,`char`.`char_id` FROM `char` INNER JOIN `char_reg_num` ON `char_reg_num`.`char_id`=`char`.`char_id` WHERE `char_reg_num`.`key`='" + .@key$ + "' ORDER BY `char_reg_num`.`value` DESC LIMIT 10",.@value,.@name$,.@cid); if(!(.Options&256)){ for(.@i = 0; .@i < getarraysize(.@cid); .@i++) { if(.@i == 2){ if(.Options&128) .@key$ = "m_dthcount"; else .@key$ = "pl_dthcount"; } else if(.Options&128) .@key$ = "m_gvg_dcount"; else .@key$ = "gvg_dcount"; query_sql("SELECT CAST(`value` AS SIGNED) FROM `char_reg_num` WHERE char_id = "+.@cid[.@i]+" AND `key` = '';",.@j); .@Death[.@i] = .@j; } } mes "~ ^990000"+((.Options&128)?"Monthly ":"") + ((.@Menu == 2)?"PvP":"GvG") +" Ladder^000000 ~"; if (!getarraysize(.@cid)){ mes "The rankings are empty."; } else { for(.@i = 0; .@i= 8)?"No ":"") + ((.MapMode[.@i]&8)?"Ygg ":"") + ((.MapMode[.@i]&16)?"3rds ":"") + ((.MapMode[.@i]&32)?"Trans ":"") + ((.MapMode[.@i]&64)?.MapName$[.@i]:"") + ((.MaxPlayers[.@i])?"["+getmapusers(.MapName$[.@i])+"/"+.MaxPlayers[.@i]+"]":""); } //========================================================== .@m = select(implode(.@MapList$,":")) - 1; if(.MapMode[.@m]&2){ mes "You are about to enter NIGHTMARE PvP, on death you will lose gear randomly."; if(select("Nevermind:Continue") == 1) close; } else if(.MapMode[.@m]&8 && (countitem(607) || countitem(608))){ mes "No "+getitemname(607)+" or "+getitemname(608)+" Allowed."; close; } else if(.MapMode[.@m]&16){ mes "No 3rd Classes Allowed."; close; } else if(.MapMode[.@m]&32){ mes "No Trans Classes Allowed."; close; } else if(.MaxPlayers[.@m] && getmapusers(.MapName$[.@m]) >= .MaxPlayers[.@m]){ mes "Room is Full."; close; } else if(.MapMode[.@m]&4 && getcharid(1) <= 0 ){ mes "You must be in a Party to join."; close; } else if(.MapMode[.@m]&1 && getcharid(2) <= 0 ){ mes "You must be in a Guild to join."; close; } announce "[ PvP Warper ] "+strcharinfo(0)+" has entered in "+((.MapMode[.@m]&1)?"GvG":"PvP")+" Room",0,((.MapMode[.@m]&1)?0x00CC99:0xEE0000); warp .MapName$[.@m],0,0; } end; //================================== OnPCKillEvent: //-- Adding Stats //================================== if(!getgmlevel() || .Options&512){ if(LastPK == killedrid) RepeatKill++; else { LastPK = killedrid; RepeatKill = 0; } if(.Options&4) announce "[PVP]: "+strcharinfo(0)+" has slain "+ rid2name(LastPK) + ((RepeatKill)?" for the "+callfunc("F_GetNumSuffix",RepeatKill)+" time in a row":"") +".",bc_all; if((RepeatKill < .RepeatCount && .Options&32) || !.Options&32){ if(.Options&1) pl_pkcount++; if(.Options&129) m_pkcount++; if(.Options&257) kda++; if(.Options&385) m_kda++; if(.Options&16) #PvpPoints++; if((getmapflag(strcharinfo(3),MF_GVG) || getmapflag(strcharinfo(3),MF_GVG_NOPARTY)) && (agitcheck() || agitcheck2()) && getcharid(2) && .Options&2){ gvg_kcount++; if(.Options&128) m_gvg_kcount++; if(.Options&256) gvg_kda++; if(.Options&384) m_gvg_kda++; if(.Options&8) $Guild_Kills[getcharid(2)]++; if(.Options&136) $M_Guild_Kills[getcharid(2)]++; if(.Options&256) $Guild_Kda[getcharid(2)]++; if(.Options&264) $M_Guild_Kda[getcharid(2)]++; } attachrid(LastPK); if(.Options&1) pl_dthcount++; if(.Options&129) m_dthcount++; if(.Options&257) kda -= 1; if(.Options&385) m_kda -= 1; if((getmapflag(strcharinfo(3),MF_GVG) || getmapflag(strcharinfo(3),MF_GVG_NOPARTY)) && (agitcheck() || agitcheck2()) && getcharid(2) && .Options&2){ gvg_dcount++; if(.Options&128) m_gvg_dcount++; if(.Options&258) gvg_kda -= 1; if(.Options&384) m_gvg_kda -= 1; if(.Options&8) $Guild_Deaths[getcharid(2)]++; if(.Options&136) $M_Guild_Deaths[getcharid(2)]++; if(.Options&256) $Guild_Kda[getcharid(2)] -= 1; if(.Options&264) $M_Guild_Kda[getcharid(2)] -= 1; } } else if(.Options&1024) atcommand "@request [PvP Ladder]: "+strcharinfo(0)+" is showing signs of abusing the PvP Ladder Please Investigate"; if(.Options&64) warp "Save",0,0; } end; //================================== OnHour00: //-- Monthly Rewards //================================== if(gettime(5) == 1 && .Options&128 && .MailType){ if(.RewardType&1 && .Options&1){ query_sql("SELECT char_id,`char`.name,CAST(`value` AS SIGNED) FROM `char_reg_num` INNER JOIN `char` ON `char`.char_id = `char_reg_num`.char_id WHERE `key` = '"+((.Options&256)?"m_kda":"m_pkcount")+"' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT "+getarraysize(.PVP_Items$)+"",.@cid,.@name$,.@value); for(.@i = 0; .@i< getarraysize(.@cid); .@i++) mail .@cid[.@i], "no-reply", "PvP Ranking", "Congratulations!% You have placed #"+(.@i+1)+" in the PvP Raning this Month % % %[ Your reward is attached. ]", .PVP_Zeny[.@i], getd(".Pitem"+.@i), getd(".Pqnt"+.@i); announce "[PVP Ranking]: Rewards have been mailed to the top "+getarraysize(.PVP_Items$)+" in PvP~!",bc_blue|bc_all; query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'"); } sleep 10000; if(.RewardType&2 && .Options&2){ query_sql("SELECT char_id,`char`.name,CAST(`value` AS SIGNED) FROM `char_reg_num` INNER JOIN `char` ON `char`.char_id = `char_reg_num`.char_id WHERE `key` = '"+((.Options&256)?"m_gvg_kda":"m_gvg_kcount")+"' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT "+getarraysize(.GVG_Items$)+"",.@cid,.@name$,.@value); for(.@i = 0; .@i= 8)?"No ":"") + ((.MapMode[.@i]&8)?"Ygg ":"") + ((.MapMode[.@i]&16)?"3rds ":"") + ((.MapMode[.@i]&32)?"Trans ":"") + ((.MapMode[.@i]&64)?.MapName$[.@i]:"") + ((.MaxPlayers[.@i])?"["+getmapusers(.MapName$[.@i])+"/"+.MaxPlayers[.@i]+"]":""); delwaitingroom; waitingroom .@MapList$[.@i],0; sleep 3000; } } //========================================================== } //================================== //-- Call Shop //================================== - pointshop PvP_Cash_Shop -1,#PvpPoints,501:1,502:2