Advertisement
Guest User

Untitled

a guest
Apr 6th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.61 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= eAthena PVP-Ladder
  3. //===== By: ==================================================
  4. //= Terces
  5. //===== Current Version: =====================================
  6. //= 1.7.2
  7. //===== Compatible With: =====================================
  8. //= Any Athena Version that has "for" implemented
  9. //===== Credits: =============================================
  10. //= The whole eAthena Board and the eAthena Chat
  11. //===== Notes: ===============================================
  12. //= Note 1:
  13. //= Experience gain works like this formula:
  14. //= ($@LadderLength-(<new position>-1))*$@LadderExp
  15. //= so if someone gets the first place he'll get
  16. //= $@LadderLength*$@LadderExp experience points.
  17. //============================================================
  18. //= Fixxed by Dante
  19. //= V1.7.2
  20. //= Hosted by Dant3 aka Dante
  21. // HAFE FUN! READ THE TOPIC! IT DONT WORKS MAYBE ON OLDER REV
  22. //
  23. //
  24. // LAST UPDATE: 12th,February.2008
  25. //
  26. // Main Script - Terces (Main Thanks to Terces ^_^)
  27. // V1.7.0 - Dant3
  28. // v1.7.1 - AnnieRuRu
  29. // v1.7.2 - Dant3
  30.  
  31. // THIS SCRIPT WORKS ONLY ON THE NEW EATHENA REVISIONS! ENJOY!
  32.  
  33. - script PVPLADDEROPTIONS -1,{
  34. end;
  35. OnInit:
  36. // 0 = Disabled (NO)
  37. // 1 = Enable (YES)
  38. set $@languageselect, 0; //Enable/Disable language selection [English/German] (Default: 1)
  39. set $@LadderAnnounce, 0; //Enable/Disable the announcement when a char reaches a new position in the ladder (Default: 1)
  40.  
  41. set $@LadderLength, 30; //Set the length of the Ladder [!Not higher than 128!] (Default: 30)
  42. set $@LadderSteps, 10; //Set the views per page (Default: 10)
  43.  
  44. set $@LadderExpGain, 1; //Enable/Disable experience gain when reaching a new position in the ladder (*Note1)
  45. set $@LadderExp, 50; //Set Experience gain value (*Note1)
  46.  
  47. // Update v1.7.0
  48. set $@LadderZenyGain, 1; //Enable/Disable zeny gain when reaching a new position in the ladder
  49. set $@LadderZeny, 50; //Set Zeny gain value
  50. set $@LadderChatRoom, 1; //Enable/Disable an Chat Room over the NPC with the message "PvP Ladder" (Users can not enter the Chat room)
  51.  
  52. // Update v1.7.1 (Thanks to AnnieRuRu)
  53. // Added GM PvP Ladder Reset Function
  54.  
  55. // Update v1.7.2
  56. // Thanks to for the Feedback
  57. set $@LadderAskLogin, 1; //Enable/Disable that the NPC asks about the Broadcast when a Player logins / or with the Npc Chat (0 = Login Ask , 1 = Npc Chat) Related: 0
  58. }
  59.  
  60. - script PVPLADDER -1,{
  61. OnPCKillEvent:
  62. if (terces_PVP_resets != $terces_PVP_resets) {
  63. dispbottom "Please relog your character, in order to get the correct kills for you in the PVP ladder.";
  64. dispbottom "Because a GM just reset the ladder.";
  65. end;
  66. }
  67. if ( killedrid == getcharid(3) ) {
  68. set PVPDeaths, PVPDeaths +1;
  69. set #PVPDeathsAccount, #PVPDeathsAccount +1;
  70. set @PVPDeathstoday, @PVPDeathstoday +1;
  71. end;
  72. }
  73. set $@PVPcounter,$@PVPcounter+1;
  74. set getd("$@PVPKill"+$@PVPcounter),getcharid(3); //getd to avoid errors when more than 1 people kill someone
  75. attachrid(killedrid);
  76. set PVPDeaths,PVPDeaths+1;
  77. set @PVPDeathstoday,@PVPDeathstoday+1;
  78. set #PVPDeathsAccount,#PVPDeathsAccount+1;
  79. set getd("$@PVPkilledplayer"+$@PVPcounter+"$"), strcharinfo(0); //again, getd to avoid possible glitches
  80. detachrid;
  81.  
  82. attachrid(getd("$@PVPKill"+$@PVPcounter));
  83. CountKills:
  84. set PVPKills,PVPKills+1;
  85. set @PVPKillstoday,@PVPKillstoday+1;
  86. set #PVPKillsAccount,#PVPKillsAccount+1;
  87. setarray @playerstats[0],@PVPKillstoday,@PVPDeathstoday,PVPKills,PVPDeaths,#PVPKillsAccount,#PVPDeathsAccount;
  88.  
  89. l_ladder:
  90. set @considerdeath,0;
  91. for (set @PosinLadder, 0; @PosinLadder < $@LadderLength; set @PosinLadder, @PosinLadder + 1){
  92. if (PVPKills >= $terces_PVP_kills[@PosinLadder]){ //Player deserves to be in the ladder
  93. //Check if Death plays a role on the position
  94. if ((PVPKills == $terces_PVP_kills[@PosinLadder]) && (PVPDeaths > $terces_PVP_deaths[@PosinLadder])) set @considerdeath,1; //Consider Deaths
  95. //Check if the player only topped his own scores
  96. if ($terces_PVP_names$[@PosinLadder] == strcharinfo(0)){
  97. set $terces_PVP_kills[@PosinLadder],PVPKills;
  98. set $terces_PVP_deaths[@PosinLadder],PVPDeaths;
  99. end;
  100. }
  101. //Moves all characters in the Ladder
  102. for (set @beginmoving, $@LadderLength; @beginmoving >= (@PosinLadder+@considerdeath); set @beginmoving, @beginmoving - 1){
  103. if ($terces_PVP_names$[@beginmoving] == strcharinfo(0)){
  104. //If the player already is in the Ladder it only has to move players between characters new position and characters old position
  105. callsub L_LadderMove,0;
  106. end;
  107. }
  108. else if (@beginmoving == (@PosinLadder+@considerdeath)){
  109. //Player is not in the Ladder and therefor it has to move all players from characters new position downwards
  110. callsub L_LadderMove,1;
  111. end;
  112. }
  113. }
  114. end;
  115. }
  116. }
  117.  
  118.  
  119. L_LadderMove:
  120. if (getarg(0) == 0) set @length,@beginmoving;
  121. if (getarg(0) == 1) set @length,$@LadderLength;
  122. for (set @movecycle, @length; @movecycle > (@PosinLadder+@considerdeath);
  123. set @movecycle, @movecycle - 1){
  124.  
  125. set $terces_PVP_names$[@movecycle],$terces_PVP_names$[(@movecycle-1)];
  126. set $terces_PVP_kills[@movecycle],$terces_PVP_kills[(@movecycle-1)];
  127. set $terces_PVP_deaths[@movecycle],$terces_PVP_deaths[(@movecycle-1)];
  128. set $terces_PVP_times[@movecycle],$terces_PVP_times[(@movecycle-1)];
  129. }
  130. //sets the character's stats in the new position
  131. set $terces_PVP_names$[(@PosinLadder+@considerdeath)],strcharinfo(0);
  132. set $terces_PVP_kills[(@PosinLadder+@considerdeath)],PVPKills;
  133. set $terces_PVP_deaths[(@PosinLadder+@considerdeath)],PVPDeaths;
  134. set $terces_PVP_times[(@PosinLadder+@considerdeath)],gettimetick(2);
  135. //Experience Gain
  136. if ($@LadderExpGain == 1){
  137. set BaseExp,BaseExp+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderExp);
  138. dispbottom "You have just been rewarded with "+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderExp)+" base experience points";
  139. }
  140. //Zeny Gain
  141. if ($@LadderZenyGain == 1){
  142. set Zeny,Zeny+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderZeny);
  143. dispbottom "You have just been rewarded with "+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderZeny)+" Zeny";
  144. }
  145. //Announcement (Setting for Char)
  146. if (pvpbroadcast == 2){
  147. announce strcharinfo(0)+" just claimed the "+((@PosinLadder+@considerdeath)+1)+". Position in the Top "+$@LadderLength+" after killing "+getd("$@PVPkilledplayer"+$@PVPcounter+"$")+".",16;
  148. }
  149. //Announcement (Setting for Account)
  150. if (#pvpbroadcast == 2){
  151. announce strcharinfo(0)+" just claimed the "+((@PosinLadder+@considerdeath)+1)+". Position in the Top "+$@LadderLength+" after killing "+getd("$@PVPkilledplayer"+$@PVPcounter+"$")+".",16;
  152. }
  153. end;
  154.  
  155. OnPCLoginEvent:
  156. if (terces_PVP_resets != $terces_PVP_resets){
  157. set PVPDeaths,0;
  158. set @PVPDeathstoday,0;
  159. set #PVPDeathsAccount,0;
  160. set PVPKills,0;
  161. set @PVPKillstoday,0;
  162. set #PVPKillsAccount,0;
  163. set terces_PVP_resets,$terces_PVP_resets;
  164. }
  165. if ($@LadderAskLogin == 0){
  166. if (#pvpbroadcast == 2) goto L_ignore;
  167. if (pvpbroadcast == 2) goto L_ignore;
  168. if (#pvpbroadcast == 1) goto L_ignore;
  169. if (pvpbroadcast == 1) goto L_ignore;
  170.  
  171. if (pvpbroadcast == 0)
  172. mes "Hi, "+strcharinfo(0)+"";
  173. mes "Me is the PvP Top Management!";
  174. mes "Let me ask you one Question and i will let you play!";
  175. menu "Later please",L_close,"Okay, fine",L_fine;
  176.  
  177. L_fine:
  178. next;
  179. mes "Well, do you want read Broadcast Messages when a Player reach a new position on the PvP Ranglist?";
  180. menu "Yeah, why not",L_accept,"No, thanks",L_accept_2,"Wtf is Broadcast?",L_broadcast;
  181.  
  182. L_accept:
  183. next;
  184. mes "Yay, thank you! ^_^";
  185. mes "Will this Setting work on all your Chars on this account or only this char?";
  186. menu "Account",L_account,"Only this char",L_char;
  187.  
  188. L_account:
  189. set #pvpbroadcast,2;
  190. next;
  191. mes "Okay, "+strcharinfo(0)+"";
  192. mes "Thank you for your time and have fun!";
  193. close;
  194.  
  195. L_char:
  196. set pvpbroadcast,2;
  197. next;
  198. mes "Okay, "+strcharinfo(0)+"";
  199. mes "Thank you for your time and have fun!";
  200. goto access_eng;
  201. close;
  202.  
  203. L_accept_2:
  204. next;
  205. mes "Yay, thank you! ^_^";
  206. mes "Will this Setting work on all your Chars on this account or only this char?";
  207. menu "Account",L_account_2,"Only this char",L_char_2;
  208.  
  209. L_close:
  210. close;
  211.  
  212. L_account_2:
  213. set #pvpbroadcast,1;
  214. next;
  215. mes "Okay, "+strcharinfo(0)+"";
  216. mes "Thank you for your time and have fun!";
  217. close;
  218.  
  219. L_char_2:
  220. set pvpbroadcast,1;
  221. next;
  222. mes "Okay, "+strcharinfo(0)+"";
  223. mes "Thank you for your time and have fun!";
  224. goto access_eng;
  225. close;
  226.  
  227.  
  228. L_broadcast:
  229. mes "Broadcasts are this yellow messages from the GMs";
  230. goto L_fine;
  231. }
  232. }
  233.  
  234. celestian,72,62,4 script PvP Ladder 616,{
  235. if ($@LadderChatRoom == 1) {
  236. waitingroom "PvP Top "+$@LadderLength+"",0; // Look on the configuration!
  237. }
  238. set @name$,"[PvP-Ladder]";
  239. //Colour of: Position Name Kills Deaths Time
  240. setarray @colour$[0], "^996600", "^006699", "^00AA00", "^FF0000", "^EE8800";
  241. if ($@LadderAskLogin == 1){
  242. if (#pvpbroadcast == 2) goto access_eng;
  243. if (pvpbroadcast == 2) goto access_eng;
  244. if (#pvpbroadcast == 1) goto access_eng;
  245. if (pvpbroadcast == 1) goto access_eng;
  246. if (pvpbroadcast == 0)
  247. mes "Hi, "+strcharinfo(0)+"";
  248. mes "Me is the PvP Top Management!";
  249. mes "Let me ask you one Question and i will let you play!";
  250. menu "Later please",L_close,"Okay, fine",L_fine;
  251.  
  252. L_fine:
  253. next;
  254. mes "Well, do you want read Broadcast Messages when a Player reach a new position on the PvP Ranglist?";
  255. menu "Yeah, why not",L_accept,"No, thanks",L_accept_2,"Wtf is Broadcast?",L_broadcast;
  256.  
  257. L_accept:
  258. next;
  259. mes "Yay, thank you! ^_^";
  260. mes "Will this Setting work on all your Chars on this account or only this char?";
  261. menu "Account",L_account,"Only this char",L_char;
  262.  
  263. L_account:
  264. set #pvpbroadcast,2;
  265. next;
  266. mes "Okay, "+strcharinfo(0)+"";
  267. mes "Thank you for your time and have fun!";
  268. close;
  269.  
  270. L_char:
  271. set pvpbroadcast,2;
  272. next;
  273. mes "Okay, "+strcharinfo(0)+"";
  274. mes "Thank you for your time and have fun!";
  275. goto access_eng;
  276. close;
  277.  
  278. L_accept_2:
  279. next;
  280. mes "Yay, thank you! ^_^";
  281. mes "Will this Setting work on all your Chars on this account or only this char?";
  282. menu "Account",L_account_2,"Only this char",L_char_2;
  283.  
  284. L_close:
  285. close;
  286.  
  287. L_account_2:
  288. set #pvpbroadcast,1;
  289. next;
  290. mes "Okay, "+strcharinfo(0)+"";
  291. mes "Thank you for your time and have fun!";
  292. close;
  293.  
  294. L_char_2:
  295. set pvpbroadcast,1;
  296. next;
  297. mes "Okay, "+strcharinfo(0)+"";
  298. mes "Thank you for your time and have fun!";
  299. goto access_eng;
  300. close;
  301.  
  302.  
  303. L_broadcast:
  304. mes "Broadcasts are this yellow messages from the GMs";
  305. goto L_fine;
  306. }
  307. access_eng:
  308. mes @name$;
  309. mes "Hello "+strcharinfo(0)+"...";
  310. mes "If you want to I can show you your PVP stats.";
  311. next;
  312. M_selection_eng:
  313. if ( getgmlevel () < 99 )
  314. menu "Show me the PVP Ladder",M_Ladder_eng,"PvP stats since my login",M_seitLogin_eng,"PvP stats of this Char",M_dieserChar_eng,"Stats of the whole account",M_vomAccount_eng,"Cancel",M_abbrechen_eng;
  315. else
  316. menu "Show me the PVP Ladder",M_Ladder_eng,"PvP stats since my login",M_seitLogin_eng,"PvP stats of this Char",M_dieserChar_eng,"Stats of the whole account",M_vomAccount_eng,"Reset Ladder",L_reset,"Cancel",M_abbrechen_eng;
  317.  
  318. M_Ladder_eng:
  319. mes "Alright...I'll show you the Top "+ $@LadderLength +" with "+$@LadderSteps+" entries per page.";
  320. mes "It'll be viewed like this:";
  321. mes @colour$[0]+"Place^000000: "+@colour$[1]+"<name>^000000 :"+@colour$[2]+"<kills>^000000:"+@colour$[3]+"<deaths>^000000 "+@colour$[4]+"<time>";
  322. next;
  323. callsub L_Ladder;
  324. goto M_selection_eng;
  325.  
  326. M_seitLogin_eng:
  327. mes @name$;
  328. mes "Your stats since your login:";
  329. mes @PVPKillstoday+"/"+@PVPDeathstoday+"(Kills/Deaths)";
  330. next;
  331. goto M_selection_eng;
  332.  
  333. M_dieserChar_eng:
  334. mes @name$;
  335. mes "Your stats of this Char:";
  336. mes PVPKills+"/"+PVPDeaths+"(Kills/Deaths)";
  337. next;
  338. goto M_selection_eng;
  339.  
  340. M_vomAccount_eng:
  341. mes @name$;
  342. mes "Your stats of the whole account:";
  343. mes #PVPKillsAccount+"/"+#PVPDeathsAccount+"(Kills/Deaths)";
  344. next;
  345. goto M_selection_eng;
  346.  
  347. M_abbrechen_eng:
  348. mes @name$;
  349. mes "OK. You can come back to me and see your stats whenever you want.";
  350. close;
  351.  
  352. L_reset:
  353. if (getgmlevel() < 99) end;
  354. mes "Do you want to reset the ladder?";
  355. if (select ("Yes","No") == 2) goto L_end;
  356. mes "Are you really really sure you want to reset it?";
  357. menu "Yes, ffs!!",-,"No",L_end;
  358. deletearray $terces_PVP_kills,128;
  359. deletearray $terces_PVP_deaths,128;
  360. deletearray $terces_PVP_names$,128;
  361. deletearray $terces_PVP_times,128;
  362. set $terces_PVP_resets,$terces_PVP_resets +1;
  363.  
  364. L_end:
  365. mes "Okay...cya";
  366. close;
  367.  
  368. L_Ladder:
  369. for (set @y,0; @y < $@LadderLength; set @y,@y+$@LadderSteps){
  370. for (set @x,@y; (@x < (@y+$@LadderSteps)) && (@x < ($@LadderLength)); set @x,@x+1){
  371. if ($terces_PVP_names$[@x] != ""){
  372. mes @colour$[0]+(@x+1)+"^000000: "+@colour$[1]+$terces_PVP_names$[@x]+"^000000 "+@colour$[2]+$terces_PVP_kills[@x]+"^000000:"+@colour$[3]+$terces_PVP_deaths[@x]+"^000000 ~ "+@colour$[4]+callfunc ("Gettime",$terces_PVP_times[@x])+"^000000";
  373. } else {
  374. mes "^DD0000"+(@x+1)+": ^006699None^000000 ";
  375. }
  376. }
  377. next;
  378. }
  379. return;
  380. }
  381.  
  382. function script Gettime {
  383. if (getarg(0)==0) return;
  384.  
  385. set @difftimedays,(gettimetick(2) - getarg(0));
  386. set @difftimehours,@difftimedays%86400;
  387. set @difftimeminutes,@difftimehours%3600;
  388. set @difftimeseconds,@difftimeminutes%60;
  389.  
  390. set @days,@difftimedays/86400;
  391. set @hours,@difftimehours/3600;
  392. set @minutes,@difftimeminutes/60;
  393. set @seconds,@difftimeseconds;
  394. set @result$,"";
  395. if(@days != 0) set @result$,@result$+@days+"d ";
  396. if(@hours != 0) set @result$,@result$+@hours+"h ";
  397. if(@minutes != 0) set @result$,@result$+@minutes+"m ";
  398. if(@seconds != 0) set @result$,@result$+@seconds+"s";
  399.  
  400. return (@result$);
  401. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement