Cleanup of NPC logic

This commit is contained in:
Lemongrass3110 2022-12-01 00:28:38 +01:00
parent 0da07fff32
commit 2857e51abd

View File

@ -6,12 +6,10 @@
//= 1.0 Initial release [Lemongrass]
//= 1.1 Replay version [eppc0330]
//= 1.2 Translation of the replay version [Lemongrass]
//= 1.3 Cleanup of NPC logic [Lemongrass]
//============================================================
prontera,0,0,0 script Goldpoint Manager::GOLDPCCAFE 4_F_02,{
.@point = Goldpc_Points;
.@npcName$ = "[Goldpoint Manager]";
// ID:AMOUNT:PRICE
setarray .items$[1],
"25464:1:2", // World_Tour_Ticket 1
@ -19,37 +17,46 @@ prontera,0,0,0 script Goldpoint Manager::GOLDPCCAFE 4_F_02,{
"23919:11:100",// K_Secret_Key 11
"23919:33:300";// K_Secret_Key 33
mes "[Goldpoint Manager]";
mes "You currently have ^0000ff"+Goldpc_Points+"^000000 points.";
mes "What reward do you want?";
next;
.@menu$ = "View current points";
for(.@i = 1; .@i < getarraysize(.items$); .@i++) {
explode(.@array$, .items$[.@i], ":");
.@cost = atoi(.@array$[2]);
.@menu$ += ":"+(.@cost)+" points gift"+((.@point<.@cost)?" ^ff0000(not enough points)^000000":"");
.@menu$ += ":" + .@cost + " points gift";
if( Goldpc_Points < .@cost ){
.@menu$ += " ^ff0000(not enough points)^000000";
}
mes .@npcName$;
mes "You currently have ^0000ff"+.@point+"^000000 points.";
mes "What reward do you want?";
next;
}
.@s = select(.@menu$)-1;
if(.@s == 0) {
mes .@npcName$;
mes "You currently have ^0000ff"+.@point+"^000000 points.";
mes "[Goldpoint Manager]";
mes "You currently have ^0000ff"+Goldpc_Points+"^000000 points.";
close;
}
explode(.@array$, .items$[.@s], ":");
.@itemid = atoi(.@array$[0]);
.@amount = atoi(.@array$[1]);
.@cost = atoi(.@array$[2]);
if(.@point < .@cost) {
mes .@npcName$;
mes "You have ^0000ff"+.@point+"^000000 points remaining.";
if(Goldpc_Points < .@cost) {
mes "[Goldpoint Manager]";
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
mes "You cannot get the prize with this amount of points.";
close;
}
mes .@npcName$;
mes "[Goldpoint Manager]";
mes "You chose the "+.@cost+" points gift. We will reward you immediately.";
mes "You have ^0000ff"+(.@point-.@cost)+"^000000 points remaining.";
Goldpc_Points -= .@cost;
getitem .@itemid,.@amount;
mes "You have ^0000ff"+Goldpc_Points+"^000000 points remaining.";
close;
}