// http://rathena.org/board/topic/78486-breaker-rankings-npc/// NPC that:// - displays top 10 emperium breaker (Rank, Char Name, Guild Name, Breaker Points)// - when a player was the last to break the emp after the WoE he will get 1 point// - selection which enables the player to trade their points into TCG (item id: 7227)// but their break points are still displayedprontera,155,188,0 script Emp Break Ladder 910,{ switch(select("View Emp Break Ladder:Redeem points for TCG:More Info:" + ((getgmlevel()>=99) ? "Reset Ladder":""))) { case 1: query_sql "SELECT `char`.`name`, `char`.`class`, guild.`name`, CAST(`value` AS UNSIGNED) " + "FROM global_reg_value " + "LEFT JOIN `char` ON global_reg_value.char_id=`char`.char_id " + "LEFT JOIN `guild` ON `char`.guild_id=guild.guild_id " + "WHERE global_reg_value.`str`='breaker_points' " + "ORDER BY CAST(`value` AS UNSIGNED) DESC LIMIT 10", .@name$, .@job, .@guild$, .@points; mes "[Top 10 Emp Breakers]"; for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) { mes (.@i+1) +". ^0000FF"+ .@name$[.@i] +"^000000, "+jobname(.@job[.@i])+", "+ .@guild$[.@i] +" ("+ .@points[.@i] +((.@points[.@i]==1)?" pt":" pts")+")"; } break; case 2: mes "[Emp Break Ladder]"; mes "Total Emp Breaks: " + breaker_points; mes "Available Points: " + (breaker_points - breaker_tcg); if (breaker_points == 0) { mes "You have not broke the emp yet!"; } else if (breaker_points <= breaker_tcg) { mes "You've already exchanged all your points for TCG."; mes "Come back after you break the emp again!"; } else if (breaker_points-breaker_tcg < 5) { mes "You need at least 5 breaker points to exchange for 1 TCG."; } else { set .@reward, (breaker_points-breaker_tcg)/5; if (select("Redeem points for "+.@reward+" TCG:Cancel") == 2) { mes "Come back if you change your mind."; } else if (checkweight(7227, .@reward) == 0) { mes "You are overweight or carrying too many items."; } else { getitem 7227, .@reward; set breaker_tcg, breaker_tcg + (.@reward*5); mes "Here are your "+.@reward+" TCG!"; } } break; case 3: mes "[Emp Break Ladder]"; mes "Each time you break the emp, you earn 1 point."; mes "Then, talk to me to redeem 5 points for 1 TCG."; break; case 4: if (getgmlevel() < 99) end; set .@AID, playerattached(); // reset for offline chars query_sql "DELETE FROM global_reg_value WHERE `str`='breaker_points'"; query_sql "DELETE FROM global_reg_value WHERE `str`='breaker_tcg'"; // for each online char, reset breaker_points to 0 while (getusers(1) > .@count) { set .@count, .@count + query_sql("SELECT account_id FROM `char` WHERE online=1 LIMIT 128 OFFSET "+.@count, .@account_id); set .@i, 0; while (.@i < getarraysize(.@account_id)) { if (attachrid(.@account_id[.@i])) doevent strnpcinfo(3)+"::OnResetBreakerPoints"; set .@i, .@i +1; } deletearray .@account_id, 128; sleep 1; // prevent infinity loop } attachrid .@AID; mes "Emp Break Ladder has been reset."; break; } close;OnResetBreakerPoints: set breaker_points, 0; set breaker_tcg, 0; end;}
Patch
Index: npc/guild2/agit_main_se.txt===================================================================--- npc/guild2/agit_main_se.txt (revision 17127)+++ npc/guild2/agit_main_se.txt (working copy)@@ -601,6 +601,7 @@end;OnStartArena:+ set breaker_points, breaker_points +1;set .@GID,getcharid(2);set .@region$, (compare(strnpcinfo(4),"arug"))?"Valfreyja":"Nithafjoll";// Lower castle EconomyIndex: npc/guild/agit_main.txt===================================================================--- npc/guild/agit_main.txt (revision 17127)+++ npc/guild/agit_main.txt (working copy)@@ -99,6 +99,7 @@// The Emperium has been broken.OnAgitBreak:+ set breaker_points, breaker_points +1;set .@GID,getcharid(2);// Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)if (.@GID <= 0) {
Can someone make this script compatible for hercules? the global_reg_value is missing or maybe changed with char_reg_num_db. Still I don't know what table should I change to get the value of break_points? I tried breaking an EMP but there's no break_points recorded on any tables in DB.
Patch
Can someone make this script compatible for hercules? the global_reg_value is missing or maybe changed with char_reg_num_db. Still I don't know what table should I change to get the value of break_points? I tried breaking an EMP but there's no break_points recorded on any tables in DB.
Source: http://rathena.org/board/topic/78486-breaker-rankings-npc/
Edited by HadeszeusShare this post
Link to post
Share on other sites