diff --git a/npc/custom/breeder.txt b/npc/custom/breeder.txt index a3d822a472..b12437955f 100644 --- a/npc/custom/breeder.txt +++ b/npc/custom/breeder.txt @@ -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; diff --git a/npc/custom/card_remover.txt b/npc/custom/card_remover.txt index 7de3b1774c..0599979c5c 100644 --- a/npc/custom/card_remover.txt +++ b/npc/custom/card_remover.txt @@ -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]"; diff --git a/npc/custom/etc/airplane.txt b/npc/custom/etc/airplane.txt index b93af960d8..321551e97e 100644 --- a/npc/custom/etc/airplane.txt +++ b/npc/custom/etc/airplane.txt @@ -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"; diff --git a/npc/custom/etc/bank_kafra.txt b/npc/custom/etc/bank_kafra.txt index 27e4e21117..6dc6a13ee6 100644 --- a/npc/custom/etc/bank_kafra.txt +++ b/npc/custom/etc/bank_kafra.txt @@ -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; diff --git a/npc/custom/etc/mvp_arena.txt b/npc/custom/etc/mvp_arena.txt index 2ed360aa81..27714d48d2 100644 --- a/npc/custom/etc/mvp_arena.txt +++ b/npc/custom/etc/mvp_arena.txt @@ -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: diff --git a/npc/custom/events/cluckers.txt b/npc/custom/events/cluckers.txt index 6ad1d55610..9e96778b19 100644 --- a/npc/custom/events/cluckers.txt +++ b/npc/custom/events/cluckers.txt @@ -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; diff --git a/npc/custom/healer.txt b/npc/custom/healer.txt index 3b3fc9f015..c5441a7291 100644 --- a/npc/custom/healer.txt +++ b/npc/custom/healer.txt @@ -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; diff --git a/npc/custom/item_signer.txt b/npc/custom/item_signer.txt index 96c33ba002..296bc5268d 100644 --- a/npc/custom/item_signer.txt +++ b/npc/custom/item_signer.txt @@ -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 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) { diff --git a/npc/custom/quests/hunting_missions.txt b/npc/custom/quests/hunting_missions.txt index b5c05df244..422a650f7c 100644 --- a/npc/custom/quests/hunting_missions.txt +++ b/npc/custom/quests/hunting_missions.txt @@ -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: diff --git a/npc/custom/resetnpc.txt b/npc/custom/resetnpc.txt index eb34137e40..70632f856a 100644 --- a/npc/custom/resetnpc.txt +++ b/npc/custom/resetnpc.txt @@ -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")) { diff --git a/npc/custom/stylist.txt b/npc/custom/stylist.txt index 94132b2ab6..eb1f0bbd9c 100644 --- a/npc/custom/stylist.txt +++ b/npc/custom/stylist.txt @@ -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; diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt index 8e3833ecc3..1d4b7193db 100644 --- a/npc/other/Global_Functions.txt +++ b/npc/other/Global_Functions.txt @@ -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",""{,<1:uppercase>} +// -- callfunc "F_GetPlural",""{,<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",,""{,<1:uppercase>} +// -- callfunc "F_InsertPlural",,""{,<0:normal/1:uppercase>{,""}} +// 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",""{,<1:uppercase A>} +// -- callfunc "F_InsertArticle",""{,<0:lowercase a/1:uppercase A>} // Examples: // callfunc("F_InsertArticle","apple") // returns "an apple" // callfunc("F_InsertArticle","dog",1) // returns "A dog" diff --git a/npc/quests/quests_juperos.txt b/npc/quests/quests_juperos.txt index e5fc86db14..3ef3db7098 100644 --- a/npc/quests/quests_juperos.txt +++ b/npc/quests/quests_juperos.txt @@ -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;