Jump to content
  • 0

Breaker Rankings NPC


zmref

Question


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

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 displayed

Link to comment
Share on other sites

16 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

1. edit these 2 guild files like so:

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 Economy

Index: 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) {

2. load this script: http://rathena.kpaste.net/934c?raw
prontera,155,188,0	script	Emp Break Ladder	910,{

switch(select("View Emp Break Ladder:Redeem points for TCG:More Info")) {

case 1:

query_sql "SELECT `char`.`name`, 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$, .@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, "+ .@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 {

set .@reward, breaker_points - breaker_tcg;

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

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 your point(s) for TCG.";

break;

}

close;

}

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

It's an honor that you're the one answered my request. Ok I'll try this one thanks in advance! :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

  • Stop your map/char/login servers.

  • execute these SQL queries:
    DELETE FROM global_reg_value WHERE `str`='breaker_points';
    DELETE FROM global_reg_value WHERE `str`='breaker_tcg';
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

Thank you very much Brian, really.. thanks.. :))

Sir, is it possible to reset the breaker points without stopping the map/char/login servers?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

Sir bry........ how to add job class on this script and also...... the points will be receive whenever you destroyed the emperium and not just the last one who broke the emperium...... i would also like it to reset the ladder w/o closing the mapserver/char/login

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

// 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 displayed
// RESET STATS
negel,172,231,5    script    Emp Breaker Ladder    857,{
    switch(select("View Emp Break Ladder:Redeem points for TCG:More Info")) {
    case 1:
        query_sql "SELECT `char`.`name`, 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$, .@guild$, .@points;
        mes "[Top 10 Emp Breakers]";
        mes "Rank, Name, Guild (break points)";
        for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
            mes (.@i+1) +". ^0000FF"+ .@name$[.@i] +"^000000, "+ .@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 {
            set .@reward, breaker_points - breaker_tcg;
            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;
                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 your point(s) for TCG.";
        break;
    }
    close;
}
 

 

 

please make me a reset select menu based on this query or correct me

DELETE FROM global_reg_value WHERE `str`='breaker_points';

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Sir, is it possible to reset the breaker points without stopping the map/char/login servers?

 

Use this script snippet:

	// 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
	}
	close;

OnResetBreakerPoints:
	set breaker_points, 0;
	set breaker_tcg, 0;
	end;

You could create a new menu within the NPC, or trigger that script snippet with an OnTime label, or make a separate GM npc that GMs could click or PM to reset the ladder -- however you want to do it.

how to add job class on this script?

http://rathena.kpaste.net/60f0ec?raw

the points will be receive whenever you destroyed the emperium and not just the last one who broke the emperium.

Actually I misread the original request and forgot to make it "just the last one who broke the emp". Currently, the script records every empbreak.

PS: another way (that allows resetting the ladder while the server is online) is store the "emp break points" in a new column in the `char` SQL table like this: http://trac.assembla.com/raijero/changeset/536/#file1

query_sql "UPDATE `char` SET `empbreak` = `empbreak`+1 WHERE `char_id` = "+ getcharid(0);
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

Sir my client stops after I click the Reset Ladder here's the error

post-5357-0-61687300-1361345527_thumb.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

oops! I forgot to attachrid back to the invoking character.

To fix, add these 2 lines so the fixed script looks like this: http://rathena.kpaste.net/60f0ec?raw

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  148
  • Topics Per Day:  0.03
  • Content Count:  299
  • Reputation:   6
  • Joined:  06/14/12
  • Last Seen:  

thanks it works

you're really a genius

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  115
  • Reputation:   4
  • Joined:  10/25/12
  • Last Seen:  

I've got an error sir:

 

post-9359-0-45592100-1362209338_thumb.jpg

Edited by DJFUNK
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Change (.@job[.i@]) into (.@job[.@i]) in this line:

mes (.@i+1) +". ^0000FF"+ .@name$[.@i] +"^000000, "+jobname(.@job[.i@])+", "+ .@guild$[.@i] +" ("+ .@points[.@i] +((.@points[.@i]==1)?" pt":" pts")+")";
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

how to change the need of points, example you need to get 5 points before you can trade 1 TCG?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

// 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 displayed

prontera,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;
}

/no1

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...