Follow-up to Global_Function updates (97687ca).
* Added format string to "F_InsertPlural" for added flexibility. * Added more checks to "F_GetPlural" for better handling of multi-word arguments (e.g. items). * Updated some more scripts with new functions. Some misc. cleanup of constants in scripts. Signed-off-by: Euphy <euphy.raliel@rathena.org>
This commit is contained in:
parent
2ab4d8c276
commit
834f3baa05
@ -17,8 +17,8 @@ prontera,124,201,1 script Universal Rental NPC 726,{
|
||||
} else if ((eaclass()&EAJ_THIRDMASK==EAJ_RANGER) && !countitem(6124)) {
|
||||
if (!checkfalcon() && getskilllv("HT_FALCON") && !checkoption(Option_Wug) && !checkoption(Option_Wugrider)) {
|
||||
if(select(" ~ Falcon: ~ Warg")==1) setfalcon;
|
||||
else getitem 6124,1;
|
||||
} else getitem 6124,1;
|
||||
else getitem 6124,1; //Wolf's_Flute
|
||||
} else getitem 6124,1; //Wolf's_Flute
|
||||
} else if ((eaclass()&EAJ_THIRDMASK==EAJ_MECHANIC) && !checkcart() && getskilllv("MC_PUSHCART")) {
|
||||
if (!checkmadogear() && getskilllv("NC_MADOLICENCE")) {
|
||||
if(select(" ~ Cart: ~ Mado")==1) setcart;
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
prt_in,28,73,4 script Wise Old Woman#eAcustom 78,{
|
||||
|
||||
set .zenycost,200000; // Set base cost in zeny of the card remover services
|
||||
set .percardcost,25000; // set cost per card of the card remover services
|
||||
set .faildestroy,1; // Should the card remover have a chance of failure that destroys items? 1 = Yes, 0 = No.
|
||||
set .zenycost,200000; // base cost of the card remover services (in Zeny)
|
||||
set .percardcost,25000; // cost per card of the card remover services (in Zeny)
|
||||
set .faildestroy,1; // should the card remover have a chance of failure that destroys items? (1=yes, 0=no)
|
||||
|
||||
disable_items;
|
||||
mes "[Wise Old Woman]";
|
||||
@ -91,8 +91,8 @@ prt_in,28,73,4 script Wise Old Woman#eAcustom 78,{
|
||||
mes "[Wise Old Woman]";
|
||||
mes "Very well. I shall begin.";
|
||||
set Zeny, Zeny - (.zenycost+(.@cardcount * .percardcost));
|
||||
delitem 1000,1;
|
||||
delitem 715,1;
|
||||
delitem 1000,1; //Star_Crumb
|
||||
delitem 715,1; //Yellow_Gemstone
|
||||
|
||||
// Replace the constants in the next 3 lines with failure chance values defined in refine_db.txt
|
||||
// First value = Total failure chance (item and cards destroyed)
|
||||
@ -142,7 +142,7 @@ prt_in,28,73,4 script Wise Old Woman#eAcustom 78,{
|
||||
close;
|
||||
case 2:
|
||||
mes "[Wise Old Woman]";
|
||||
mes "I charge a flat fee of "+.zenycost+" zeny, plus "+.percardcost+" zeny for each card I remove from the item. In addition, I need a star crumb and a yellow gemstone to work my magic.";
|
||||
mes "I charge a flat fee of "+callfunc("F_InsertComma",.zenycost)+" zeny, plus "+callfunc("F_InsertComma",.percardcost)+" zeny for each card I remove from the item. In addition, I need a star crumb and a yellow gemstone to work my magic.";
|
||||
close;
|
||||
case 3:
|
||||
mes "[Wise Old Woman]";
|
||||
|
@ -246,7 +246,7 @@ Board:
|
||||
L_Yes:
|
||||
if($destination!=getarg(0))goto Notime;
|
||||
warp "airplane", 105, 72;
|
||||
specialeffect2 501;
|
||||
specialeffect2 EF_CASTSPIN;
|
||||
L_Nope:
|
||||
mes "^FF0000[Porter]^000000";
|
||||
mes "Have a good day. Thank you for traveling with Airship.";
|
||||
@ -356,7 +356,7 @@ Lyes:
|
||||
if($destination == 250)goto Notime;
|
||||
if($destination != @dockky)goto Notime;
|
||||
warp $locationsmap$[$destination], $locationsx[$destination], $locationsy[$destination];
|
||||
specialeffect2 501;
|
||||
specialeffect2 EF_CASTSPIN;
|
||||
|
||||
Lnope:
|
||||
mes "^FF0000[Airplane Attendant]^000000";
|
||||
|
@ -35,9 +35,9 @@ L_NoIncomeToday:
|
||||
set #kb_int,@kb_int; //reset days timer
|
||||
|
||||
if(#kafrabank==0) mes "We could open you an account.";
|
||||
if(@income>0) mes "Today's income: ^135445" + @income + "^000000 zeny.";
|
||||
if(@income>0) mes "Today's income: ^135445" + callfunc("F_InsertComma",@income) + "^000000 zeny.";
|
||||
set #kafrabank,#kafrabank+@income;
|
||||
if(#kafrabank>0) mes "Your account: ^135445" + #kafrabank + "^000000 zeny.";
|
||||
if(#kafrabank>0) mes "Your account: ^135445" + callfunc("F_InsertComma",#kafrabank) + "^000000 zeny.";
|
||||
mes "What would you like?";
|
||||
next;
|
||||
if(#kafrabank==0) menu "-Open an account",-,"-Quit",B_EXIT2;
|
||||
@ -53,7 +53,7 @@ L_NoIncomeToday:
|
||||
set Zeny, Zeny-@kafrabank;
|
||||
set #kafrabank,#kafrabank+@kafrabank;
|
||||
mes"[Maniss]";
|
||||
mes "You've made a deposit of ^135445" + @kafrabank + "z^000000.";
|
||||
mes "You've made a deposit of ^135445" + callfunc("F_InsertComma",@kafrabank) + "z^000000.";
|
||||
//we log these zeny operations into the log db
|
||||
logmes "Bank %: " + @income +"z, Deposit: "+ @kafrabank +"z, Final: "+ #kafrabank +"z";
|
||||
goto B_EXIT;
|
||||
@ -61,7 +61,7 @@ L_NoIncomeToday:
|
||||
M_WITHDRAW:
|
||||
if(#kafrabank==0) goto L_ZERO_ACCOUNT;
|
||||
mes"[Maniss]";
|
||||
mes "Your account: ^135445" + #kafrabank + "^000000 zeny.";
|
||||
mes "Your account: ^135445" + callfunc("F_InsertComma",#kafrabank) + "^000000 zeny.";
|
||||
mes "How much zeny would you like to withdraw?";
|
||||
next;
|
||||
if(input(@kafrabank) == 1) goto L_TOO_BIG_AMOUNT;
|
||||
@ -71,7 +71,7 @@ M_WITHDRAW:
|
||||
set #kafrabank,#kafrabank-@kafrabank;
|
||||
set Zeny, Zeny+@kafrabank;
|
||||
mes"[Maniss]";
|
||||
mes "Here is your ^135445" + @kafrabank + "z^000000, put your sign here...";
|
||||
mes "Here is your ^135445" + callfunc("F_InsertComma",@kafrabank) + "z^000000, put your sign here...";
|
||||
//we log these zeny operations into the log db
|
||||
logmes "Bank %: " + @income +"z, Withdraw: "+ @kafrabank +"z, Final: "+ #kafrabank +"z";
|
||||
goto B_EXIT;
|
||||
|
@ -38,7 +38,7 @@ quiz_00,49,31,4 script MVP Arena Guide 778,{
|
||||
mes "There are eight rooms per Keeper, and sixteen MVPs in total.";
|
||||
close;
|
||||
case 2:
|
||||
specialeffect2 313;
|
||||
specialeffect2 EF_HEAL2;
|
||||
percentheal 100,100;
|
||||
close;
|
||||
case 3:
|
||||
@ -78,7 +78,7 @@ function script Protector {
|
||||
warp getarg(0),102,102;
|
||||
end;
|
||||
case 2:
|
||||
specialeffect2 313;
|
||||
specialeffect2 EF_HEAL2;
|
||||
percentheal 100,100;
|
||||
end;
|
||||
case 3:
|
||||
|
@ -23,7 +23,7 @@ prontera,156,219,4 script Cluckers 800,{
|
||||
set .@GMAccess,80; // GM level required to access NPC
|
||||
|
||||
if (.startcluck) {
|
||||
specialeffect2 2;
|
||||
specialeffect2 EF_HIT3;
|
||||
switch(rand(15)) {
|
||||
case 0: npctalk "CLUUUUUUCK!!!"; unitskilluseid getcharid(3),"NPC_SELFDESTRUCTION",1; emotion e_omg; break;
|
||||
case 1: npctalk "Cluuuuuck!~"; break;
|
||||
@ -42,7 +42,7 @@ prontera,156,219,4 script Cluckers 800,{
|
||||
default:
|
||||
if (rand(50) < 4) {
|
||||
npctalk "WOOF!...........";
|
||||
specialeffect2 72;
|
||||
specialeffect2 EF_SPHERE;
|
||||
announce "[Cluck! Cluck! Boom!] " + strcharinfo(0) + " squeezed out the prize! Well done!",0;
|
||||
getitem $cluck_item_id,$cluck_item_amount;
|
||||
set .startcluck,0;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
if (@HD > gettimetick(2)) end;
|
||||
if (.@Price) {
|
||||
message strcharinfo(0),"Healing costs "+.@Price+" Zeny.";
|
||||
message strcharinfo(0),"Healing costs "+callfunc("F_InsertComma",.@Price)+" Zeny.";
|
||||
if (Zeny < .@Price) end;
|
||||
if(select("^0055FFHeal^000000:^777777Cancel^000000") == 2) end;
|
||||
set Zeny, Zeny-.@Price;
|
||||
|
@ -32,8 +32,8 @@ prt_in,24,61,7 script Perchik 47,{
|
||||
mes "For my work I accept:";
|
||||
if (getarraysize(.@Item)) for(set .@i,0; .@i<getarraysize(.@Item); set .@i,.@i+2)
|
||||
mes " ~ "+.@Item[.@i+1]+"x "+getitemname(.@Item[.@i]);
|
||||
if (.@Cost[0]) mes " ~ "+.@Cost[0]+" Zeny";
|
||||
if (.@Cost[1]) mes " ~ "+.@Cost[1]+" Zeny per refine";
|
||||
if (.@Cost[0]) mes " ~ "+callfunc("F_InsertComma",.@Cost[0])+" Zeny";
|
||||
if (.@Cost[1]) mes " ~ "+callfunc("F_InsertComma",.@Cost[1])+" Zeny per refine";
|
||||
}
|
||||
else mes "I work for free, but...";
|
||||
next;
|
||||
|
@ -16,7 +16,7 @@
|
||||
//============================================================
|
||||
|
||||
prontera,153,193,6 script Job Master 123,{
|
||||
function Job_Menu; function A_An;
|
||||
function Job_Menu;
|
||||
|
||||
mes "[Job Master]";
|
||||
if (Class > 4049) {
|
||||
@ -127,11 +127,11 @@ function Job_Menu {
|
||||
set .@i, getarg(0);
|
||||
if (select(" ~ Change into ^0055FF"+jobname(.@i)+"^000000 class: ~ ^777777"+((getargcount() > 1)?"Go back":"Cancel")+"^000000") == 1) {
|
||||
mes "[Job Master]";
|
||||
mes "You are now "+A_An(jobname(.@i))+"!";
|
||||
mes "You are now "+callfunc("F_InsertArticle",jobname(.@i))+"!";
|
||||
if (.@i==4001 && .LastJob) set lastJob, Class;
|
||||
jobchange .@i;
|
||||
if (.@i==4001 || .@i==4023) resetlvl(1);
|
||||
specialeffect2 338; specialeffect2 432;
|
||||
specialeffect2 EF_ANGEL2; specialeffect2 EF_ELECTRIC;
|
||||
if (.Platinum) callsub Get_Platinum;
|
||||
close;
|
||||
}
|
||||
@ -141,14 +141,6 @@ function Job_Menu {
|
||||
end;
|
||||
}
|
||||
|
||||
function A_An {
|
||||
setarray .@A$[0],"a","e","i","o","u";
|
||||
set .@B$, "_"+getarg(0);
|
||||
for(set .@i,0; .@i<5; set .@i,.@i+1)
|
||||
if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
|
||||
return "a "+getarg(0);
|
||||
}
|
||||
|
||||
Get_Platinum:
|
||||
skill 142,1,0;
|
||||
switch(BaseClass) {
|
||||
|
@ -39,7 +39,7 @@ function Chk;
|
||||
mes "Is there anything I can help";
|
||||
mes "you with?";
|
||||
mes " ";
|
||||
mes "^777777~ You've completed ^0055FF"+callfunc("F_InsertPlural",Mission_Total,"mission")+"^777777. ~^000000";
|
||||
mes "^777777~ You've completed "+callfunc("F_InsertPlural",Mission_Total,"mission",0,"^0055FF%d^777777 %s")+". ~^000000";
|
||||
next;
|
||||
switch(select(((!Mission0)?" ~ New Mission::":": ~ Mission Status: ~ Abandon Mission")+": ~ Information: ~ Mission Shop: ~ View Top Hunters: ~ ^777777Cancel^000000")) {
|
||||
case 1:
|
||||
|
@ -23,9 +23,9 @@ prontera,150,193,4 script Reset Girl 124,{
|
||||
|
||||
mes "[Reset Girl]";
|
||||
mes "I am the Reset Girl.";
|
||||
mes "Reset Stats: "+ .@ResetStat +"z";
|
||||
mes "Reset Skills: "+ .@ResetSkill +"z";
|
||||
mes "Reset Both: "+ .@ResetBoth +"z";
|
||||
mes "Reset Stats: "+ callfunc("F_InsertComma",.@ResetStat) +"z";
|
||||
mes "Reset Skills: "+ callfunc("F_InsertComma",.@ResetSkill) +"z";
|
||||
mes "Reset Both: "+ callfunc("F_InsertComma",.@ResetBoth) +"z";
|
||||
mes "Please select the service you want:";
|
||||
next;
|
||||
switch(select("^FF3355Reset Skills:Reset Stats:Reset Both^000000:Cancel")) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
prontera,170,180,1 script Stylist#custom_stylist 122,{
|
||||
setarray .@Styles[1],getbattleflag("max_cloth_color"),getbattleflag("max_hair_style"),getbattleflag("max_hair_color");
|
||||
setarray .@Look[1],7,1,6;
|
||||
setarray .@Look[1],LOOK_CLOTHES_COLOR,LOOK_HAIR,LOOK_HAIR_COLOR;
|
||||
set .@s, select(" ~ Cloth color: ~ Hairstyle: ~ Hair color");
|
||||
set .@Revert, getlook(.@Look[.@s]);
|
||||
set .@Style,1;
|
||||
|
@ -3,7 +3,7 @@
|
||||
//===== By: ==================================================
|
||||
//= Lupus, kobra_k88
|
||||
//===== Current Version: =====================================
|
||||
//= 2.2
|
||||
//= 2.21
|
||||
//===== Compatible With: =====================================
|
||||
//= rAthena 1.0
|
||||
//===== Description: =========================================
|
||||
@ -43,6 +43,7 @@
|
||||
//= 2.18 Removed useless 'getJobName' function. [Euphy]
|
||||
//= 2.2 Added "F_GetPlural", "F_InsertPlural", "F_InsertArticle", "F_InsertComma", "F_GetNumSuffix". [Euphy]
|
||||
//= Standardized descriptions, updated 'F_GetArmorType'.
|
||||
//= 2.21 Added format string to "F_InsertPlural" and more checks to "F_GetPlural". [Euphy]
|
||||
//============================================================
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
@ -368,28 +369,45 @@ function script Time2Str {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Returns the plural of a noun - only follows basic rules, with few exceptions!
|
||||
// -- callfunc "F_GetPlural","<noun>"{,<1:uppercase>}
|
||||
// -- callfunc "F_GetPlural","<noun>"{,<0:normal/1:uppercase>}
|
||||
// Examples:
|
||||
// callfunc("F_GetPlural","dog") // returns "dogs"
|
||||
// callfunc("F_GetPlural","fox",1) // returns "FOXES"
|
||||
// callfunc("F_GetPlural","knife") // returns "knives"
|
||||
//
|
||||
// Returns the plural of a noun if the given number is not 1.
|
||||
// -- callfunc "F_InsertPlural",<number>,"<noun>"{,<1:uppercase>}
|
||||
// -- callfunc "F_InsertPlural",<number>,"<noun>"{,<0:normal/1:uppercase>{,"<format string>"}}
|
||||
// Format string uses sprintf(), and MUST contain %d (arg0) and %s (arg1), in that order.
|
||||
// Examples:
|
||||
// callfunc("F_InsertPlural",1,"dog") // returns "1 dog"
|
||||
// callfunc("F_InsertPlural",3,"fox",1) // returns "3 FOXES"
|
||||
// callfunc("F_InsertPlural",0,"knife") // returns "0 knives"
|
||||
//
|
||||
// NOTE: Nouns must be 3 or more characters in length.
|
||||
// // returns "^FF00005^000000 knives"
|
||||
// callfunc("F_InsertPlural",5,"knife",0,"^FF0000%d^000000 %s")
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
function script F_GetPlural {
|
||||
set .@str$, getarg(0);
|
||||
|
||||
if (countstr(.@str$," ")) { // if multiple words, only pluralize last word
|
||||
explode(.@tmp$,.@str$," ");
|
||||
set .@size, getarraysize(.@tmp$);
|
||||
set .@str$, .@tmp$[.@size-1];
|
||||
deletearray .@tmp$[.@size-1],1;
|
||||
set .@pre$, implode(.@tmp$," ") + " ";
|
||||
}
|
||||
|
||||
set .@strlen, getstrlen(.@str$);
|
||||
if (.@strlen < 3) // prevent errors
|
||||
return ((getarg(1,0)) ? strtoupper(.@pre$ + .@str$) : .@pre$ + .@str$);
|
||||
|
||||
setarray .@suffix$[0], charat(.@str$,.@strlen - 1), substr(.@str$,.@strlen - 2,.@strlen - 1);
|
||||
|
||||
// common exceptions --> singular form == plural form
|
||||
if (compare("deceit|information|wisdom|intelligence|fish|glasses|sunglasses",.@str$)) {
|
||||
set .@result$, .@str$;
|
||||
}
|
||||
|
||||
// ends in -s, -x, -z, -ch, -sh --> add -es
|
||||
if (.@suffix$[0] == "s" || .@suffix$[0] == "x" || .@suffix$[0] == "z" ||
|
||||
else if (.@suffix$[0] == "s" || .@suffix$[0] == "x" || .@suffix$[0] == "z" ||
|
||||
.@suffix$[1] == "ch" || .@suffix$[1] == "sh") {
|
||||
set .@result$, .@str$ + "es";
|
||||
}
|
||||
@ -418,16 +436,16 @@ function script F_GetPlural {
|
||||
set .@result$, .@str$ + "s";
|
||||
}
|
||||
|
||||
return ((getarg(1,0)) ? strtoupper(.@result$) : .@result$);
|
||||
return ((getarg(1,0)) ? strtoupper(.@pre$ + .@result$) : .@pre$ + .@result$);
|
||||
}
|
||||
function script F_InsertPlural {
|
||||
return getarg(0) + " " + ((getarg(0) == 1) ? getarg(1) : callfunc("F_GetPlural",getarg(1),getarg(2,0)));
|
||||
return sprintf(getarg(3,"%d %s"), getarg(0), ((getarg(0) == 1) ? getarg(1) : callfunc("F_GetPlural",getarg(1),getarg(2,0))));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Returns 'a' or 'an' based on a word - only follows basic rules, without exceptions!
|
||||
// -- callfunc "F_InsertArticle","<word>"{,<1:uppercase A>}
|
||||
// -- callfunc "F_InsertArticle","<word>"{,<0:lowercase a/1:uppercase A>}
|
||||
// Examples:
|
||||
// callfunc("F_InsertArticle","apple") // returns "an apple"
|
||||
// callfunc("F_InsertArticle","dog",1) // returns "A dog"
|
||||
|
@ -1723,7 +1723,7 @@ OnMyMobDead:
|
||||
mapannounce "juperos_02","Have you come seeking Juperos?! It no longer exists...",bc_map,"0xFF0000";
|
||||
else if (.MyMobs == 0) {
|
||||
mapannounce "juperos_02","Have you come to see me? Fine! Find me first!",bc_map,"0xFF0000";
|
||||
specialeffect2 563;
|
||||
specialeffect2 EF_SCREEN_QUAKE;
|
||||
soundeffectall "earth_quake.wav",0;
|
||||
disablenpc "3F Gate Switch#jupe";
|
||||
donpcevent "Restricted Area#jupe::OnEnable";
|
||||
@ -4315,7 +4315,7 @@ jupe_ele_r,51,98,0 script Switch#ufe 844,{
|
||||
disablenpc "Switch#ufe";
|
||||
enablenpc "Switch On#ufe";
|
||||
initnpctimer;
|
||||
specialeffect2 563;
|
||||
specialeffect2 EF_SCREEN_QUAKE;
|
||||
soundeffectall "earth_quake.wav",0;
|
||||
close2;
|
||||
cutin "5-1",255;
|
||||
|
Loading…
x
Reference in New Issue
Block a user