diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-06-25 22:07:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-25 22:07:46 +0300 |
commit | 5f4c452cdf22f5625b61004ed0e92816b0175ea1 (patch) | |
tree | 1b766d21645ff064e57e366d807497f58d4f0a2d | |
parent | 98da34f0c6785a4227efa0f6718a7453e2991202 (diff) | |
parent | a8590a0b235ce48320d428a184181c1e93267cd6 (diff) | |
download | hercules-5f4c452cdf22f5625b61004ed0e92816b0175ea1.tar.gz hercules-5f4c452cdf22f5625b61004ed0e92816b0175ea1.tar.bz2 hercules-5f4c452cdf22f5625b61004ed0e92816b0175ea1.tar.xz hercules-5f4c452cdf22f5625b61004ed0e92816b0175ea1.zip |
Merge pull request #1292 from HerculesWS/huld-improvements
HULD improvements
41 files changed, 2473 insertions, 1694 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 05d075ac1..f0758de71 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1188,7 +1188,7 @@ From here on, we will have the commands sorted as followed: //===================================== --------------------------------------- -*mes "<string>"{,"<string>"..."<string>"}; +*mes "<string>"; This command will displays a box on the screen for the invoking character, if no such box is displayed already, and will print the string specified @@ -1220,14 +1220,6 @@ non-English characters, the color codes might get screwed if they stick to letters with no intervening space. Separating them with spaces from the letters on either side solves the problem. -To display multiple lines of message while only using a single mes; -command, use the script command in the following format: - - mes "Line 1", "Line 2", "Line 3"; - -This will display 3 different lines while only consuming a single line in -the relevant script file. - If you're using a client from 2011-10-10aRagexe.exe onwards, you can also use automatic navigation and open URLs in browser by using some HTML-like labels. For example: @@ -1243,6 +1235,23 @@ Clicking Google will open the browser and point to Google website. --------------------------------------- +*mesf("<format>"{,<param>{, <param>{, ...}}}) + +This command will display a box on the screen for the invoking character, +if no such box is displayed already, and will print the string specified +into that box, after applying the same format-string replacements as sprintf(). + +Example: + + mesf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class)); + // is equivalent to: + mes(sprintf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +This command is a combination of mes() and sprintf(). See their documentation +for more details. + +--------------------------------------- + *next; This command will display a 'next' button in the message window for the @@ -8067,10 +8076,75 @@ Example: *sprintf(<format>{,param{,param{,...}}}) -C style sprintf. The resulting string is returned same as in PHP. All C -format specifiers are supported except %n. For more info check sprintf -function at www.cplusplus.com -Number of params is only limited by Hercules' script engine. +C style sprintf. The resulting string is returned. + +The format string can contain placeholders (format specifiers) using the +following structure: + + %[parameter][flags][width]type + +The following format specifier types are supported: + +%%: Prints a literal '%' (special case, doesn't support parameter, flag, width) +%d, %i: Formats the specified value as a decimal signed number +%u: Formats the specified value as a decimal unsigned number +%x: Formats the specified value as a hexadecimal (lowercase) unsigned number +%X: Formats the specified value as a hexadecimal (uppercase) unsigned number +%o: Formats the specified value as an octal unsigned number +%s: Formats the specified value as a string +%c: Formats the specified value as a character (only uses the first character + of strings) + +The following format specifier types are not supported: + +%n (not implemented due to safety concerns) +%f, %F, %e, %E, %g, %G (the script engine doesn't use floating point values) +%p (the script engine doesn't use pointers) +%a, %A (not supported, use 0x%x and 0x%X respectively instead) + +An ordinal parameter can be specified in the form 'x$' (where x is a number), +to reorder the output (this may be useful in translated strings, where the +sentence order may be different from the original order). Example: + + // Name, level, job name + mes(sprintf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +When translating the sentence to other languages (for example Italian), +swapping some arguments may be appropriate, and it may be desirable to keep the +actual arguments in the same order (i.e. when translating through the HULD): + + // Job name is printed before the level, although they're specified in the opposite order. + // Name, job name, level + mes(sprintf("Ciao, io sono %1$s, un %3$s di livello %2$d", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +The supported format specifier flags are: + +- (minus): Left-align the output of this format specifier. (the default is to + right-align the output). ++ (plus): Prepends a plus for positive signed-numeric types. positive = '+', + negative = '-'. +(space): Prepends a space for positive signed-numeric types. positive = ' ', + negative = '-'. This flag is ignored if the '+' flag exists. +0 (zero): When a field width option is specified, prepends zeros for numeric + types. (the default prepends spaces). +A field width can be specified. + + mes(sprintf("The temperature is %+d degrees Celsius", .@temperature)); // Keeps the '+' sign in front of positive values + .@map_name$ = sprintf("quiz_%02d", .@i); // Keeps the leading 0 in "quiz_00", etc + +A field width may be specified, to ensure that 'at least' that many characters +are printed. If a star ('*') is specified as width, then the width is read as +argument to the sprintf() function. This also supports positional arguments. + + sprintf("%04d", 10) // Returns "0010" + sprintf("%0*d", 5, 10) // Returns "00010" + sprintf("%5d", 10) // Returns " 10" + sprintf("%-5d", 10) // Returns "10 " + sprintf("%10s", "Hello") // Returns " Hello"; + sprintf("%-10s", "Hello") // Returns "Hello "; + +Precision ('.X') and length ('hh', 'h', 'l', 'll', 'L', 'z', 'j', 't') +specifiers are not implemented (not necessary for the script engine purposes) Example: .@format$ = "The %s contains %d monkeys"; diff --git a/npc/cities/splendide.txt b/npc/cities/splendide.txt index c7ff5a365..d49f50ada 100644 --- a/npc/cities/splendide.txt +++ b/npc/cities/splendide.txt @@ -436,7 +436,7 @@ spl_in01,281,329,3 script Splendide Guard#tre 4_M_FAIRYSOLDIER,{ } else { mes "[Splendide Guard]"; - mes "AnduVeldRe Ko VeldReFulo So LomaurDu So So "; + mes "AnduVeldRe Ko VeldReFulo So LomaurDu So So"; close; } } diff --git a/npc/custom/etc/airplane.txt b/npc/custom/etc/airplane.txt index 99260f455..6fd500a41 100644 --- a/npc/custom/etc/airplane.txt +++ b/npc/custom/etc/airplane.txt @@ -293,10 +293,10 @@ glast_01,196,326,1 script Porter#07 4_M_TWBOY,{ umbala,188,98,3 script Porter#08 4_M_TWBOY,{ callfunc "F_Porter",8; } -comodo,203,75,8 script Porter#09 4_M_TWBOY,{ +comodo,203,75,0 script Porter#09 4_M_TWBOY,{ callfunc "F_Porter",9; } -amatsu,115,78,8 script Porter#10 4_M_TWBOY,{ +amatsu,115,78,0 script Porter#10 4_M_TWBOY,{ callfunc "F_Porter",10; } niflheim,132,242,5 script Porter#11 4_M_TWBOY,{ @@ -305,7 +305,7 @@ niflheim,132,242,5 script Porter#11 4_M_TWBOY,{ xmas,232,309,5 script Porter#12 4_M_TWBOY,{ callfunc "F_Porter",12; } -louyang,35,279,8 script Porter#13 4_M_TWBOY,{ +louyang,35,279,0 script Porter#13 4_M_TWBOY,{ callfunc "F_Porter",13; } gonryun,82,95,7 script Porter#14 4_M_TWBOY,{ diff --git a/npc/custom/etc/quest_warper.txt b/npc/custom/etc/quest_warper.txt index c00559c8f..35b863e9d 100644 --- a/npc/custom/etc/quest_warper.txt +++ b/npc/custom/etc/quest_warper.txt @@ -1621,7 +1621,7 @@ niflheim,197,192,3 duplicate(Warpra#0) Warpra#9 4_F_KAFRA5 pay_arche,39,135,4 duplicate(Warpra#0) Warpra#10 4_F_KAFRA5 prt_fild05,273,215,4 duplicate(Warpra#0) Warpra#11 4_F_KAFRA5 tur_dun01,148,239,4 duplicate(Warpra#0) Warpra#12 4_F_KAFRA5 -valkyrie,48,35,8 duplicate(Warpra#0) Warpra#13 4_F_KAFRA5 +valkyrie,48,35,0 duplicate(Warpra#0) Warpra#13 4_F_KAFRA5 yuno_fild03,37,135,4 duplicate(Warpra#0) Warpra#14 4_F_KAFRA5 alberta,32,240,4 script Warpra#15 4_F_KAFRA5,{ callfunc "QWS_Town_Warpra",1,"Alberta Town"; close; } diff --git a/npc/custom/events/uneasy_cemetery.txt b/npc/custom/events/uneasy_cemetery.txt index 99c1f21cb..7027dacbf 100644 --- a/npc/custom/events/uneasy_cemetery.txt +++ b/npc/custom/events/uneasy_cemetery.txt @@ -33,7 +33,7 @@ OnInit: end; OnHour06: - killmonster "Uneasy_Check::OnZombieDead"; //The Sun kills undead in the morning + killmonster "prontera", "Uneasy_Check::OnZombieDead"; //The Sun kills undead in the morning end; OnHour01: @@ -54,7 +54,7 @@ OnZombieDead: end; L_Start_Undead: - killmonster "Uneasy_Check::OnZombieDead"; //kills any left monsters + killmonster "prontera", "Uneasy_Check::OnZombieDead"; //kills any left monsters enablenpc "Mother Mathana"; //call some monsters in the city set $@UNEASY_MOB, 65; @@ -98,7 +98,7 @@ L_Undead_Walk: mes "[Mother Mathana]"; mes "Upon pouring the cemetery with that water we'll get " + $UNEASY_DL + " safe nights!"; next; - killmonster "Uneasy_Check::OnZombieDead"; //kills any left monsters + killmonster "prontera", "Uneasy_Check::OnZombieDead"; //kills any left monsters mes "[Mother Mathana]"; mes "See, "+ $UNEASY_H$ +"? They all are gone now!"; next; diff --git a/npc/custom/quests/berzebub.txt b/npc/custom/quests/berzebub.txt index 7dec41f79..5590a1911 100644 --- a/npc/custom/quests/berzebub.txt +++ b/npc/custom/quests/berzebub.txt @@ -11,7 +11,7 @@ //= 1.2 Optimized. [Euphy] //============================================================ -prontera,165,178,8 script Old Woman 8_F_GRANDMOTHER,{ +prontera,165,178,0 script Old Woman 8_F_GRANDMOTHER,{ setarray .@items[0],714,25,1061,100,1095,200,618,10,1551,2,1614,1,727,20; set .@n$,"[Old Woman]"; diff --git a/npc/dev/test.txt b/npc/dev/test.txt index 72cf86616..ee2bda259 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -711,6 +711,24 @@ function script HerculesSelfTestHelper { callsub(OnCheck, "Callfunc (return NPC variables from another NPC)", callfunc("F_TestVarOfAnotherNPC", "TestVarOfAnotherNPC"), 1); callsub(OnCheck, "Callfunc (return NPC variables from another NPC - local variable overwrite check)", .x, 2); + callsub(OnCheckStr, "sprintf (%%)", sprintf("'%%'"), "'%'"); + callsub(OnCheckStr, "sprintf (%d)", sprintf("'%d'", 5), "'5'"); + callsub(OnCheckStr, "sprintf (neg. %d)", sprintf("'%d'", -5), "'-5'"); + callsub(OnCheckStr, "sprintf (%u)", sprintf("'%u'", 5), "'5'"); + callsub(OnCheckStr, "sprintf (%x)", sprintf("'%x'", 10), "'a'"); + callsub(OnCheckStr, "sprintf (%X)", sprintf("'%X'", 31), "'1F'"); + callsub(OnCheckStr, "sprintf (%s)", sprintf("'%s'", "Hello World!"), "'Hello World!'"); + callsub(OnCheckStr, "sprintf (%c)", sprintf("'%c'", "Hello World!"), "'H'"); + callsub(OnCheckStr, "sprintf (%+d)", sprintf("'%+d'", 5), "'+5'"); + callsub(OnCheckStr, "sprintf (%{n}d)", sprintf("'%5d'", 5), "' 5'"); + callsub(OnCheckStr, "sprintf (%-{n}d)", sprintf("'%-5d'", 5), "'5 '"); + callsub(OnCheckStr, "sprintf (%-+{n}d)", sprintf("'%-+5d'", 5), "'+5 '"); + callsub(OnCheckStr, "sprintf (%+0{n}d)", sprintf("'%+05d'", 5), "'+0005'"); + callsub(OnCheckStr, "sprintf (%0*d)", sprintf("'%0*d'", 5, 10), "'00010'"); + callsub(OnCheckStr, "sprintf (Two args)", sprintf("'%+05d' '%x'", 5, 0x7f), "'+0005' '7f'"); + callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$+05d'", 5, 6), "'+0006'"); + callsub(OnCheckStr, "sprintf (positional)", sprintf("'%2$s' '%1$c'", "First", "Second"), "'Second' 'F'"); + if (.errors) { debugmes "Script engine self-test [ \033[0;31mFAILED\033[0m ]"; debugmes "**** The test was completed with " + .errors + " errors. ****"; diff --git a/npc/events/halloween_2006.txt b/npc/events/halloween_2006.txt index 8a89214ec..8b34ab824 100644 --- a/npc/events/halloween_2006.txt +++ b/npc/events/halloween_2006.txt @@ -735,7 +735,7 @@ nif_fild01,219,267,4 duplicate(HwChicken) Masta's chicken#06_hw03 4_NFCOCK nif_fild01,199,240,5 duplicate(HwChicken) Masta's chicken#06_hw04 4_NFCOCK nif_fild01,316,97,6 duplicate(HwChicken) Masta's chicken#06_hw05 4_NFCOCK nif_fild01,147,343,7 duplicate(HwChicken) Masta's chicken#06_hw06 4_NFCOCK -nif_fild01,185,325,8 duplicate(HwChicken) Masta's chicken#06_hw07 4_NFCOCK +nif_fild01,185,325,0 duplicate(HwChicken) Masta's chicken#06_hw07 4_NFCOCK nif_fild01,133,105,1 duplicate(HwChicken) Masta's chicken#06_hw08 4_NFCOCK nif_fild01,331,329,2 duplicate(HwChicken) Masta's chicken#06_hw09 4_NFCOCK diff --git a/npc/jobs/2-2/alchemist.txt b/npc/jobs/2-2/alchemist.txt index c3d1f9479..c211c6b60 100644 --- a/npc/jobs/2-2/alchemist.txt +++ b/npc/jobs/2-2/alchemist.txt @@ -41,218 +41,239 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ mes "[Parmy Gianino]"; if (Upper == 1) { - mes "Welcome to the"; - mes "Alchemist Unio--"; - mes "I-Impossible! How c-can"; - mes "something like this happen?"; + mes "Welcome to the\r" + "Alchemist Unio--"; + mes "I-Impossible! How c-can\r" + "something like this happen?"; next; mes "[Parmy Gianino]"; mes "Wait, wait..."; - mes "I'm sorry. I was confused,"; - mes "that's all. You look just like"; - mes "someone I used to know. "; - mes "Still, I get this weird"; - mes "feeling about you..."; + mes "I'm sorry. I was confused,\r" + "that's all. You look just like\r" + "someone I used to know."; + mes "Still, I get this weird\r" + "feeling about you..."; close; } if (BaseJob != Job_Merchant) { if (BaseJob == Job_Alchemist) { - mes "Welcome, " + strcharinfo(0) + "."; - mes "The Alchemist Union"; - mes "is busy today, like always."; + mesf("Welcome, %s.", strcharinfo(0)); + mes "The Alchemist Union\r" + "is busy today, like always."; next; mes "[Parmy Gianino]"; - mes "Everyone is busy with their"; - mes "own research, but recently, some headway has been made in the field of biotechnology."; + mes "Everyone is busy with their\r" + "own research, but recently, some headway has been made in the field of biotechnology."; next; mes "[Parmy Gianino]"; - mes "Everyone is hoping that the biotechnological studies will yield positive results. Speaking of which, I wonder how the Alchemists working on artificial life are doing..."; + mes "Everyone is hoping that the biotechnological studies will yield positive results. " + "Speaking of which, I wonder how the Alchemists working on artificial life are " + "doing..."; close; } else if (BaseClass == Job_Novice) { - mes "Welcome to the"; - mes "Alchemist Union."; - mes "We are recruiting"; - mes "talented people"; - mes "with novel ideas."; + mes "Welcome to the\r" + "Alchemist Union."; + mes "We are recruiting\r" + "talented people\r" + "with novel ideas."; next; mes "[Parmy Gianino]"; - mes "If you're interested in working with chemistry, visit us later when you become more knowledgable."; + mes "If you're interested in working with chemistry, visit us later when you become more " + "knowledgable."; next; mes "[Parmy Gianino]"; - mes "Just one thing:"; - mes "You've got to have"; - mes "knowledge of items"; - mes "as a Merchant first."; + mes "Just one thing:\r" + "You've got to have\r" + "knowledge of items\r" + "as a Merchant first."; close; } - mes "Welcome to the"; - mes "Alchemist Union."; - mes "We are recruiting"; - mes "talented people"; - mes "with novel ideas."; + mes "Welcome to the\r" + "Alchemist Union."; + mes "We are recruiting\r" + "talented people\r" + "with novel ideas."; next; mes "[Parmy Gianino]"; - mes "If you know any exceptional Merchants, by all means, please refer them to us. Those types of people tend to have a talent for Alchemy and experimentation~"; + mes "If you know any exceptional Merchants, by all means, please refer them to us. Those types of " + "people tend to have a talent for Alchemy and experimentation~"; close; } if (ALCH_Q == 0) { - mes "Welcome to the"; - mes "Alchemist Union."; + mes "Welcome to the\r" + "Alchemist Union."; mes "How may I help you?"; next; - switch(select("I would like to learn about Alchemists.", "I want to become an Alchemist.", "Nothing.")) { + switch (select("I would like to learn about Alchemists.", + "I want to become an Alchemist.", + "Nothing.")) { case 1: mes "[Parmy Gianino]"; - mes "Alchemists study and create new substances and items out of existing materials. Our knowledge allows us to change the properties of chemicals at the atomic level."; + mes "Alchemists study and create new substances and items out of existing materials. Our " + "knowledge allows us to change the properties of chemicals at the atomic level."; next; mes "[Parmy Gianino]"; - mes "Most people think our final goal"; - mes "is to create gold, but that's not the entire truth. We also want to create things like medicines"; - mes "and new materials."; + mes "Most people think our final goal\r" + "is to create gold, but that's not the entire truth. We also want to create things " + "like medicines\r" + "and new materials."; next; mes "[Parmy Gianino]"; - mes "A few of us research the"; - mes "creation of life, although many of us consider that god's territory. That field is so complex, most of us deal with slightly less complicated projects anyway."; + mes "A few of us research the\r" + "creation of life, although many of us consider that god's territory. That field is so " + "complex, most of us deal with slightly less complicated projects anyway."; next; mes "[Parmy Gianino]"; - mes "If you are interested in becoming an Alchemist, I recommend that you first get a lot of experience as a Merchant. Being a Merchant is a great opportunity to learn about materials as you deal with them."; + mes "If you are interested in becoming an Alchemist, I recommend that you first get a lot of " + "experience as a Merchant. Being a Merchant is a great opportunity to learn about " + "materials as you deal with them."; next; mes "[Parmy Gianino]"; - mes "Whether or not you try to become"; - mes "an Alchemist is your decision. The road to becoming an Alchemist is very challenging, and you'll need to focus on experimentation and research, instead of commerce."; + mes "Whether or not you try to become an Alchemist is your decision. The road to becoming an " + "Alchemist is very challenging, and you'll need to focus on experimentation and" + "research, instead of commerce."; close; case 2: mes "[Parmy Gianino]"; mes "Is that so?"; mes "Nice to meet you."; - mes "My name is Parmy Gianino"; - mes "of the Alchemist Union."; + mes "My name is Parmy Gianino\r" + "of the Alchemist Union."; next; mes "[Parmy Gianino]"; - mes "If you join our Union and"; - mes "complete the training, you"; - mes "will be officially recognized"; - mes "as an Alchemist and be able"; - mes "to contribute to our research."; + mes "If you join our Union and\r" + "complete the training, you\r" + "will be officially recognized\r" + "as an Alchemist and be able\r" + "to contribute to our research."; next; mes "[Parmy Gianino]"; mes "But we don't accept everyone."; - mes "You must have a lot of tenacity"; - mes "and sincere devotion in exploring"; - mes "the various fields of science."; + mes "You must have a lot of tenacity\r" + "and sincere devotion in exploring\r" + "the various fields of science."; next; mes "[Parmy Gianino]"; - mes "There are a couple"; - mes "of requirements to join"; - mes "the Alchemist Union, but"; - mes "we'll discuss that"; - mes "after you apply."; + mes "There are a couple\r" + "of requirements to join\r" + "the Alchemist Union, but\r" + "we'll discuss that\r" + "after you apply."; next; mes "[Parmy Gianino]"; - mes "Well then, would"; - mes "you like to apply"; - mes "for registration?"; + mes "Well then, would\r" + "you like to apply\r" + "for registration?"; next; if (select("I would like to apply.", "I'll do it later.") == 1) { if (JobLevel < 40) { mes "[Parmy Gianino]"; mes "Hmmm..."; mes "Just a moment."; - mes "I'm sorry to say that"; - mes "you're not experienced"; - mes "enough as a Merchant to"; - mes "join us right now."; + mes "I'm sorry to say that\r" + "you're not experienced\r" + "enough as a Merchant to\r" + "join us right now."; next; mes "[Parmy Gianino]"; - mes "You must be at least"; - mes "^551A8BJob Level 40^000000 to become"; - mes "an Alchemist. Come back"; - mes "later when you meet the"; - mes "Job Level requirement, okay?"; + mes "You must be at least\r" + "^551A8BJob Level 40^000000 to become\r" + "an Alchemist. Come back\r" + "later when you meet the\r" + "Job Level requirement, okay?"; close; } mes "[Parmy Gianino]"; - mes "Alright, your application has been accepted. Now, you must pay the 50,000 Zeny application fee and bring some items before you can begin your formal training."; + mes "Alright, your application has been accepted. Now, you must pay the 50,000 Zeny " + "application fee and bring some items before you can begin your formal " + "training."; next; mes "[Parmy Gianino]"; - mes "But if you bring an ^551A8BOld Magic Book^000000 and ^551A8BHammer of Blacksmith^000000,"; - mes "we will accept that as a substitute for the item requirement."; + mesf("But if you bring an ^551A8B%s^000000 and ^551A8B%s^000000,\r" + "we will accept that as a substitute for the item requirement.", + getitemname(Old_Magic_Book), getitemname(Hammer_Of_Blacksmith)); next; mes "[Parmy Gianino]"; mes "Now..."; - mes "Please sign"; - mes "the application."; + mes "Please sign\r" + "the application."; next; select(strcharinfo(0)); mes "[Parmy Gianino]"; - mes "Good, good. Now, if you have"; - mes "the Zeny for your application fee ready, I will tell you which items you will need to bring. Now, pay attention."; + mes "Good, good. Now, if you have\r" + "the Zeny for your application fee ready, I will tell you which items you will " + "need to bring. Now, pay attention."; next; if (Zeny < 50000) { mes "[Parmy Gianino]"; - mes "Uh oh. You don't"; - mes "seem to have enough Zeny."; - mes "Come back to me when you have 50,000 Zeny, otherwise we can't process your application."; + mes "Uh oh. You don't\r" + "seem to have enough Zeny.\r" + "Come back to me when you have 50,000 Zeny, otherwise we can't process " + "your application."; close; } Zeny -= 50000; mes "[Parmy Gianino]"; mes "Let's see."; - mes "" + strcharinfo(0); - mes "needs to bring..."; + mesf("%s\r" + "needs to bring...", + strcharinfo(0)); switch(rand(1,3)) { case 1: ALCH_Q = 1; setquest 2028; - mes "^551A8B7 Berserk Potions^000000."; + mesf("^551A8B7 %s^000000.", getitemname(Berserk_Potion)); break; case 2: ALCH_Q = 2; setquest 2029; - mes "^551A8B100 Mini Furnaces^000000."; + mesf("^551A8B100 %s^000000.", getitemname(Portable_Furnace)); break; case 3: ALCH_Q = 3; setquest 2030; - mes "^551A8B7,500 Fire Arrows^000000."; + mesf("^551A8B7,500 %s^000000.", getitemname(Fire_Arrow)); } next; mes "[Parmy Gianino]"; - mes "Once you've gathered"; - mes "those items, come back"; - mes "to me and your training"; - mes "as an Alchemist will begin."; + mes "Once you've gathered\r" + "those items, come back\r" + "to me and your training\r" + "as an Alchemist will begin."; mes "See you soon~"; close; } mes "[Parmy Gianino]"; - mes "Talented Merchants"; - mes "are always welcome here."; + mes "Talented Merchants\r" + "are always welcome here."; mes "Please come back soon."; close; case 3: mes "[Parmy Gianino]"; mes "Umm..."; - mes "Please let me know"; - mes "if you need anything."; + mes "Please let me know\r" + "if you need anything."; close; } } else if (ALCH_Q >= 1 && ALCH_Q <= 3) { if (countitem(Old_Magic_Book) > 0 && countitem(Hammer_Of_Blacksmith) > 0) { mes "Well now~!"; - mes "You've brought an"; - mes "Old Magic Book and"; - mes "a Hammer of Blacksmith."; - mes "We'll put these items"; - mes "to good use."; + mesf("You've brought an\r" + "%s and\r" + "a %s.", + getitemname(Old_Magic_Book), + getitemname(Hammer_Of_Blacksmith)); + mes "We'll put these items\r" + "to good use."; next; delitem Old_Magic_Book,1; delitem Hammer_Of_Blacksmith,1; mes "[Parmy Gianino]"; - mes "Okay, now you need to learn"; - mes "the basics to being an Alchemist and learn the procedures for mixing chemicals and medicines."; + mes "Okay, now you need to learn\r" + "the basics to being an Alchemist and learn the procedures for mixing chemicals and " + "medicines."; ALCH_Q = 4; if (questprogress(2028)) { changequest 2028,2031; @@ -265,10 +286,12 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ } next; mes "[Parmy Gianino]"; - mes "But before all of that, you need to speak to Raspuchin. I'm not really sure what you'll be talking about with him..."; + mes "But before all of that, you need to speak to Raspuchin. I'm not really sure what you'll " + "be talking about with him..."; next; mes "[Parmy Gianino]"; - mes "It shouldn't be anything extraordinary, but you're still required to speak to Raspuchin, since apparently he's a part of the Alchemist selection process."; + mes "It shouldn't be anything extraordinary, but you're still required to speak to Raspuchin, " + "since apparently he's a part of the Alchemist selection process."; close; } switch(ALCH_Q) { @@ -277,15 +300,16 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ case 3: setarray .@items[0],1752,7500; break; } if (countitem(.@items[0]) >= .@items[1]) { - mes "Seems like"; - mes "you're all ready."; - mes "The Union will put"; - mes "these items to good use."; + mes "Seems like\r" + "you're all ready."; + mes "The Union will put\r" + "these items to good use."; next; delitem .@items[0],.@items[1]; mes "[Parmy Gianino]"; - mes "Okay, now you need to learn"; - mes "the basics to being an Alchemist and learn the procedures for mixing chemicals and medicines."; + mes "Okay, now you need to learn\r" + "the basics to being an Alchemist and learn the procedures for mixing chemicals and " + "medicines."; ALCH_Q = 4; if (questprogress(2028)) { changequest 2028,2031; @@ -298,45 +322,49 @@ alde_alche,27,185,5 script Alchemist Guildsman#am 4_F_ALCHE,{ } next; mes "[Parmy Gianino]"; - mes "But before all of that, you need to speak to Raspuchin. I'm not really sure what you'll be talking about with him..."; + mes "But before all of that, you need to speak to Raspuchin. I'm not really sure what you'll " + "be talking about with him..."; next; mes "[Parmy Gianino]"; - mes "It shouldn't be anything extraordinary, but you're still required to speak to Raspuchin, since apparently he's a part of the Alchemist selection process."; + mes "It shouldn't be anything extraordinary, but you're still required to speak to Raspuchin, " + "since apparently he's a part of the Alchemist selection process."; close; } mes "Aren't you ready?"; - mes "Like I said before,"; - mes "you must bring"; - mes "^551A8B"+.@items[1]+" "+getitemname(.@items[0])+"s^000000."; + mesf("Like I said before,\r" + "you must bring\r" + "^551A8B%d %s^000000.", + .@items[1], + getitemname(.@items[0])); next; mes "[Parmy Gianino]"; - mes "Come back when you"; - mes "have prepared the"; - mes "required items."; + mes "Come back when you\r" + "have prepared the\r" + "required items."; close; } else if (ALCH_Q == 4) { - mes "Go and talk to"; - mes "Mr. Raspuchin."; - mes "He's involved in the"; - mes "Alchemist selection process, whatever that might mean."; + mes "Go and talk to\r" + "Mr. Raspuchin."; + mes "He's involved in the\r" + "Alchemist selection process, whatever that might mean."; next; mes "[Parmy Gianino]"; - mes "Hopefully, it"; - mes "won't be too much of"; - mes "a problem. I guess he'll just interview you, and ask you"; - mes "some simple questions."; + mes "Hopefully, it\r" + "won't be too much of\r" + "a problem. I guess he'll just interview you, and ask you\r" + "some simple questions."; close; } else { - mes "Ah, I'm sorry, but"; - mes "I'm busy right now~"; + mes "Ah, I'm sorry, but\r" + "I'm busy right now~"; next; mes "[Parmy Gianino]"; - mes "Why don't you ask"; - mes "someone else if you're"; - mes "not sure who to visit"; - mes "next? Good luck~"; + mes "Why don't you ask\r" + "someone else if you're\r" + "not sure who to visit\r" + "next? Good luck~"; close; } } @@ -345,67 +373,68 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ mes "[Raspuchin Gregory]"; if (BaseJob != Job_Merchant) { if (BaseJob == Job_Alchemist) { - mes "Heeheehee"; - mes "keheheh~!"; + mes "Heeheehee\r" + "keheheh~!"; mes "Eh? What do you want?!"; next; mes "[Raspuchin Gregory]"; - mes "You're not here to steal my experimental results or plagiarize my work, are you? How dare you consider intellectual theft!"; + mes "You're not here to steal my experimental results or plagiarize my work, are you? How dare " + "you consider intellectual theft!"; next; mes "[Raspuchin Gregory]"; mes "You're not, are you?"; - mes "Well, as a colleague,"; - mes "let me just warn you"; - mes "that such tricks aren't"; - mes "tolerated here in the"; - mes "Alchemist Union!"; + mes "Well, as a colleague,\r" + "let me just warn you\r" + "that such tricks aren't\r" + "tolerated here in the\r" + "Alchemist Union!"; close; } else if (BaseClass == Job_Novice) { - mes "Heeheehee"; - mes "keheheh~!"; - mes "How cute, you've come"; - mes "all this way just to play..."; + mes "Heeheehee\r" + "keheheh~!"; + mes "How cute, you've come\r" + "all this way just to play..."; next; mes "[Raspuchin Gregory]"; - mes "I'll let you"; - mes "go this time..."; - mes "But next time, don't"; - mes "expect to leave so easily..."; + mes "I'll let you\r" + "go this time..."; + mes "But next time, don't\r" + "expect to leave so easily..."; close; } else { mes "What is it?!"; - mes "You're curious as"; - mes "to what I'm doing?"; + mes "You're curious as\r" + "to what I'm doing?"; next; mes "[Raspuchin Gregory]"; - mes "Heehee"; - mes "keheheh~!"; - mes "Why, I'm busy"; - mes "researching,"; - mes "of course!"; + mes "Heehee\r" + "keheheh~!"; + mes "Why, I'm busy\r" + "researching,\r" + "of course!"; next; mes "[Raspuchin Gregory]"; - mes "Once this"; - mes "potion is complete..."; - mes "You can use it to take"; - mes "over an entire nation!"; + mes "Once this\r" + "potion is complete..."; + mes "You can use it to take\r" + "over an entire nation!"; next; mes "[Raspuchin Gregory]"; mes "Hee hee hee!"; - mes "Something this"; - mes "dangerous has to"; - mes "be kept a secret!"; + mes "Something this\r" + "dangerous has to\r" + "be kept a secret!"; mes "Understand?"; close; } } if (ALCH_Q == 0) { - mes "Heeheehee"; - mes "keheheh~!"; - mes "What do you"; - mes "want, kid?"; + mes "Heeheehee\r" + "keheheh~!"; + mes "What do you\r" + "want, kid?"; next; mes "[Raspuchin Gregory]"; mes "A Merchant should go and set up shop and vend items. Why are you wandering in a place like this?"; @@ -413,32 +442,32 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ mes "[Raspuchin Gregory]"; mes "Heheheh~!"; mes "Go vend somwhere else!"; - mes "And leave me to my"; - mes "dark enterprise!"; + mes "And leave me to my\r" + "dark enterprise!"; close; - } - else if (ALCH_Q >= 1 && ALCH_Q <= 3) { - mes "Heeheehee"; - mes "keheheh~!"; - mes "What do you"; - mes "want, kid?"; + } else if (ALCH_Q >= 1 && ALCH_Q <= 3) { + mes "Heeheehee\r" + "keheheh~!"; + mes "What do you\r" + "want, kid?"; next; mes "[Raspuchin Gregory]"; mes "What...?"; mes "Learn Alchemy?!"; - mes "Don't even speak"; - mes "such nonsense!"; + mes "Don't even speak\r" + "such nonsense!"; next; mes "[Raspuchin Gregory]"; - mes "Even if you tried studying for a thousand years, maybe even more, it'd be useless to you! Forget about it and just worry about your store!"; + mes "Even if you tried studying for a thousand years, maybe even more, it'd be useless to you! Forget " + "about it and just worry about your store!"; close; } else if ((ALCH_Q == 4) || (ALCH_Q == 5)) { if (ALCH_Q == 4) { mes "Heeheehee"; mes "keheheh~!"; - mes "What do you"; - mes "want, kid?"; + mes "What do you\r" + "want, kid?"; next; mes "[Raspuchin Gregory]"; mes "What...?"; @@ -447,44 +476,48 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ mes "I just don't...!"; next; mes "[Raspuchin Gregory]"; - mes "Nowadays, anyone thinks they can"; - mes "be Alchemists just by knowing how to mix a few herbs. That's why my interview is necessary."; + mes "Nowadays, anyone thinks they can\r" + "be Alchemists just by knowing how to mix a few herbs. That's why my interview is " + "necessary."; next; mes "[Raspuchin Gregory]"; - mes "Heeheehee"; - mes "keheheh~!"; - mes "I plan on weeding out all the dumb and incompetent, and chase them"; - mes "all away! We don't need morons!"; + mes "Heeheehee\r" + "keheheh~!"; + mes "I plan on weeding out all the dumb and incompetent, and chase them\r" + "all away! We don't need morons!"; next; if (JobLevel == 50) { mes "[Raspuchin Gregory]"; mes "Wait..."; - mes "Maybe I've"; - mes "misjudged you."; + mes "Maybe I've\r" + "misjudged you."; if (Sex == SEX_MALE) { - mes "You might be a pretty boy,"; - mes "but I can tell you're smart"; - mes "from your eyes."; + mes "You might be a pretty boy,\r" + "but I can tell you're smart\r" + "from your eyes."; } else { - mes "Huh. You're a cutie alright,"; - mes "but I can tell you've got brains."; + mes "Huh. You're a cutie alright,\r" + "but I can tell you've got brains."; } next; mes "[Raspuchin Gregory]"; mes "You're not just some stupid kid."; - mes "I can tell youve gone through some rough times as a Merchant. Excellent. Keh heh heh~"; + mes "I can tell youve gone through some rough times as a Merchant. Excellent. Keh heh " + "heh~"; next; mes "[Raspuchin Gregory]"; - mes "Fine, just so we don't insult each other's intelligence, I'll just let you pass the interview."; + mes "Fine, just so we don't insult each other's intelligence, I'll just let you pass " + "the interview."; next; mes "[Raspuchin Gregory]"; - mes "So hurry up, become an Alchemist, do some good research, and you might turn out to be of some help to me. Hahahahahaha~!"; + mes "So hurry up, become an Alchemist, do some good research, and you might turn out " + "to be of some help to me. Hahahahahaha~!"; next; mes "[Raspuchin Gregory]"; mes "Now go to Darwin!"; - mes "He'll teach you how to do the experiments. Just tell him that"; - mes "I sent you."; + mes "He'll teach you how to do the experiments. Just tell him that\r" + "I sent you."; ALCH_Q = 6; changequest 2031,2032; close; @@ -492,25 +525,25 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ else { mes "[Raspuchin Gregory]"; mes "Surprised, are you?"; - mes "Keheheh~ If you thought"; - mes "becoming an Alchemist was"; - mes "just a matter of changing"; - mes "your clothes, then you're"; - mes "sadly mistaken."; + mes "Keheheh~ If you thought\r" + "becoming an Alchemist was\r" + "just a matter of changing\r" + "your clothes, then you're\r" + "sadly mistaken."; next; mes "[Raspuchin Gregory]"; - mes "Now, try solving"; - mes "all these problems."; - mes "Let's see how smart"; - mes "really are."; + mes "Now, try solving\r" + "all these problems."; + mes "Let's see how smart\r" + "really are."; } } else if (ALCH_Q == 5) { mes "What...?!"; - mes "You want to take"; - mes "the test again?!"; - mes "I thought I told"; - mes "you to leave!"; + mes "You want to take\r" + "the test again?!"; + mes "I thought I told\r" + "you to leave!"; next; mes "[Raspuchin Gregory]"; mes "I don't like it..."; @@ -518,15 +551,15 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ next; mes "[Raspuchin Gregory]"; mes "Fine..."; - mes "I'll try to overlook your pitiful performance last time and give"; - mes "you another chance. Don't screw"; - mes "up again, got it?"; + mes "I'll try to overlook your pitiful performance last time and give\r" + "you another chance. Don't screw\r" + "up again, got it?"; next; mes "[Raspuchin Gregory]"; - mes "Now then,"; - mes "give me all the"; - mes "^551A8Bright^000000 answers"; - mes "this time."; + mes "Now then,\r" + "give me all the\r" + "^551A8Bright^000000 answers\r" + "this time."; } next; switch(rand(1,3)) { @@ -562,38 +595,52 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "How much do"; - mes "12 Red Potions,"; - mes "1 Butterfly Wing"; - mes "and 5 Fly Wings cost"; - mes "after a 24 % discount?"; + mesf("How much do\r" + "12 %s,\r" + "1 %s\r" + "and 5 %s cost\r" + "after a 24%% discount?", + getitemname(Red_Potion), + getitemname(Wing_Of_Butterfly), + getitemname(Wing_Of_Fly)); next; input .@input; if (.@input != 909) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total weight of"; - mes "3 Scimiters, 2 Helms"; - mes "and 1 Long Coat?"; + mesf("What is the\r" + "total weight of\r" + "3 %s, 2 %s\r" + "and 1 %s?", + getitemname(Scimiter), + getitemname(Helm), + getitemname(Coat)); next; input .@input; if (.@input != 450) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total defense of"; - mes "a Biretta, Mantle,"; - mes "Opera Mask, Ribbon,"; - mes "Muffler, Boots, and"; - mes "Ear Muffs?"; + mesf("What is the\r" + "total defense of\r" + "a %s, %s,\r" + "%s, %s,\r" + "%s, %s, and\r" + "%s?", + getitemname(Biretta), + getitemname(Mantle), + getitemname(Phantom_Of_Opera), + getitemname(Ribbon), + getitemname(Muffler), + getitemname(Boots), + getitemname(Ear_Mufs)); next; input .@input; if (.@input != 20) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "If you buy 5 Helms"; - mes "with a 24 % discount"; - mes "and sell it at 20"; - mes "how much profit"; - mes "do you earn?"; + mesf("If you buy 5 %s\r" + "with a 24%% discount\r" + "and sell it at 20\r" + "how much profit\r" + "do you earn?", + getitemname(Helm)); next; input .@input; if (.@input != 8800) .@w_point += 1; @@ -635,39 +682,53 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total price of"; - mes "15 Green Potions,"; - mes "6 Magnifiers and"; - mes "4 Traps after"; - mes "a 24 % discount?"; + mesf("What is the\r" + "total price of\r" + "15 %s,\r" + "6 %s and\r" + "4 %s after\r" + "a 24%% discount?", + getitemname(Green_Potion), + getitemname(Spectacles), + getitemname(Booby_Trap)); next; input .@input; if (.@input != 934) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total weight of"; - mes "3 Ring Pommel Sabers,"; - mes "4 Caps, and 2 Boots?"; + mesf("What is the\r" + "total weight of\r" + "3 %s,\r" + "4 %s, and 2 %s?", + getitemname(Ring_Pommel_Saber), + getitemname(Cap), + getitemname(Boots)); next; input .@input; if (.@input != 550) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total defense of"; - mes "a Buckler, Long Coat,"; - mes "Gas Mask, Big Ribbon,"; - mes "Cute Ribbon, Sakkat,"; - mes "and Glasses?"; + mesf("What is the\r" + "total defense of\r" + "a %s, %s,\r" + "%s, %s.\r" + "%s, %s,\r" + "and %s?", + getitemname(Buckler), + getitemname(Coat), + getitemname(Gas_Mask), + getitemname(Big_Sis'_Ribbon), + getitemname(Fillet), + getitemname(Sahkkat), + getitemname(Glasses)); next; input .@input; if (.@input != 16) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "How much profit do you"; - mes "make if you buy Tights"; - mes "at a 24 % discount and"; - mes "sell it at 20 % of"; - mes "the normal price?"; + mesf("How much profit do you\r" + "make if you buy %s\r" + "at a 24%% discount and\r" + "sell it at 20%% of\r" + "the normal price?", + getitemname(Tights)); next; input .@input; if (.@input != 8520) .@w_point += 1; @@ -704,36 +765,50 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ input .@input; if (.@input != 742) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total cost of"; - mes "6 Red Potions,"; - mes "7 Green Potions,"; - mes "and 8 Fly Wings"; - mes "after a 24 % discount?"; + mesf("What is the\r" + "total cost of\r" + "6 %s,\r" + "7 %s,\r" + "and 8 %s\r" + "after a 24%% discount?", + getitemname(Red_Potion), + getitemname(Green_Potion), + getitemname(Wing_Of_Fly)); next; input .@input; if (.@input != 798) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total weight of"; - mes "2 Ring Pommel Sabers,"; - mes "3 Caps, and 3 boots?"; + mesf("What is the\r" + "total weight of\r" + "2 %s,\r" + "3 %s, and 3 %s?", + getitemname(Ring_Pommel_Saber), + getitemname(Cap), + getitemname(Boots)); next; input .@input; if (.@input != 480) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "What is the"; - mes "total defense of"; - mes "a Mirror Shield, Mr. Smile, Leather Jacket, Silk Robe, Wedding Veil, Muffler, and Eye Patch?"; + mesf("What is the\r" + "total defense of\r" + "a %s, %s, %s, %s, %s, %s, and %s?", + getitemname(Mirror_Shield), + getitemname(Mr_Smile), + getitemname(Leather_Jacket), + getitemname(Silk_Robe), + getitemname(Wedding_Veil), + getitemname(Muffler), + getitemname(Eye_Bandage)); next; input .@input; if (.@input != 12) .@w_point += 1; mes "[Raspuchin Gregory]"; - mes "If you buy 4 Padded Armors"; - mes "at a 24% discount and sell"; - mes "them at 20% of the original"; - mes "price, how much profit would"; - mes "you make from this sale?"; + mesf("If you buy 4 Padded Armors\r" + "at a 24%% discount and sell\r" + "them at 20%% of the original\r" + "price, how much profit would\r" + "you make from this sale?", + getitemname(Padded_Armor)); next; input .@input; if (.@input != 7680) .@w_point += 1; @@ -755,44 +830,45 @@ alde_alche,175,107,3 script Fastidious Alchemist#am 4_M_ALCHE_B,{ } else if (.@w_point == 2 && ALCH_Q == 5) { mes "[Raspuchin Gregory]"; - mes "You've got serious"; - mes "weaknesses in math,"; - mes "but I'll let you go this time..."; + mes "You've got serious\r" + "weaknesses in math,\r" + "but I'll let you go this time..."; next; } else { ALCH_Q = 5; mes "[Raspuchin Gregory]"; mes "Keheheh! Idiot!"; - mes "Just listening to your"; - mes "answers is making me feel"; - mes "stupider! You might as well"; - mes "have got them all wrong!"; + mes "Just listening to your\r" + "answers is making me feel\r" + "stupider! You might as well\r" + "have got them all wrong!"; next; mes "[Raspuchin Gregory]"; - mes "How can a person that"; - mes "can't even answer all of"; - mes "these simple questions think"; - mes "of becoming an Alchemist?!"; + mes "How can a person that\r" + "can't even answer all of\r" + "these simple questions think\r" + "of becoming an Alchemist?!"; next; mes "[Raspuchin Gregory]"; mes "Hm...?"; - mes "Did you get"; - mes "any right?"; + mes "Did you get\r" + "any right?"; next; mes "[Raspuchin Gregory]"; - mes "Fool! Even if you make one little mistake, everything goes wrong"; - mes "in Alchemy! Now get out of here!"; + mes "Fool! Even if you make one little mistake, everything goes wrong\r" + "in Alchemy! Now get out of here!"; mes "You make me sick!"; close; } mes "[Raspuchin Gregory]"; - mes "So hurry up, become an Alchemist, do some good research, and you might turn out to be of some help to me. Hahahahahaha~!"; + mes "So hurry up, become an Alchemist, do some good research, and you might turn out to be of some " + "help to me. Hahahahahaha~!"; next; mes "[Raspuchin Gregory]"; mes "Now go to Darwin!"; - mes "He'll teach you how to do the experiments. Just tell him that"; - mes "I sent you."; + mes "He'll teach you how to do the experiments. Just tell him that\r" + "I sent you."; ALCH_Q = 6; changequest 2031,2032; close; @@ -825,16 +901,16 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ if (BaseJob == Job_Alchemist) { mes "Ah..."; mes "You..."; - mes "You've become"; - mes "an Alchemist."; + mes "You've become\r" + "an Alchemist."; next; mes "[Darwin]"; mes "Remember..."; - mes "In your quest"; - mes "to make your"; - mes "dreams come true,"; - mes "do not lose what"; - mes "you cherish."; + mes "In your quest\r" + "to make your\r" + "dreams come true,\r" + "do not lose what\r" + "you cherish."; next; mes "[Darwin]"; mes "Ah..."; @@ -843,23 +919,23 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ close; } else { - mes "When you have"; - mes "your dreams, you"; - mes "have everything."; - mes "Without them, you have"; - mes "nothing more to lose."; + mes "When you have\r" + "your dreams, you\r" + "have everything."; + mes "Without them, you have\r" + "nothing more to lose."; next; mes "[Darwin]"; mes "These cursed eyes..."; - mes "They've lost sight of"; - mes "my dreams a long time ago."; + mes "They've lost sight of\r" + "my dreams a long time ago."; mes "Ha ha ha ha..."; next; mes "[Darwin]"; - mes "Does paradise"; - mes "really exist...?"; - mes "Not without my love..."; - mes "Not without Harmona..."; + mes "Does paradise\r" + "really exist...?"; + mes "Not without my love...\r" + "Not without Harmona..."; close; } } @@ -880,94 +956,94 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ mes "[Darwin]"; mes "A wolf?"; mes "Or a human?"; - mes "You must be seeking"; - mes "something, are you not?"; + mes "You must be seeking\r" + "something, are you not?"; next; mes "[Darwin]"; mes "After all..."; - mes "Everyone has desires"; - mes "to fulfill. Be be careful."; - mes "Do not be like the wild"; - mes "wolf drawn to the flowers."; + mes "Everyone has desires\r" + "to fulfill. Be be careful."; + mes "Do not be like the wild\r" + "wolf drawn to the flowers."; next; mes "[Darwin]"; mes "In your efforts to gain something else, you may end up sacrificing something precious to you."; next; mes "[Darwin]"; - mes "Cultivating joy and happiness"; - mes "is much like cultivating flowers."; - mes "If something is missing, the"; - mes "flower will wilt away..."; + mes "Cultivating joy and happiness\r" + "is much like cultivating flowers."; + mes "If something is missing, the\r" + "flower will wilt away..."; next; mes "[Darwin]"; - mes "What brings you"; - mes "to this kind of place?"; + mes "What brings you\r" + "to this kind of place?"; next; - switch(select("I want to learn how to experiment.", "Tell me more about flowers.", "Nothing.")) { + switch (select("I want to learn how to experiment.", "Tell me more about flowers.", "Nothing.")) { case 1: mes "[Darwin]"; - mes "You wish to"; - mes "learn Alchemy?"; - mes "Everything I know,"; - mes "I've learned for the"; - mes "sake of making my"; - mes "dream come true..."; + mes "You wish to\r" + "learn Alchemy?"; + mes "Everything I know,\r" + "I've learned for the\r" + "sake of making my\r" + "dream come true..."; next; mes "[Darwin]"; - mes "I'll teach"; - mes "you the basics..."; - mes "But everything you"; - mes "learn afterwards must"; - mes "be directed through"; - mes "your own motivations."; + mes "I'll teach\r" + "you the basics..."; + mes "But everything you\r" + "learn afterwards must\r" + "be directed through\r" + "your own motivations."; next; mes "[Darwin]"; - mes "I will teach you"; - mes "how to make simple"; - mes "medicine. So please"; - mes "bring the following"; - mes "materials right away."; + mes "I will teach you\r" + "how to make simple\r" + "medicine. So please\r" + "bring the following\r" + "materials right away."; next; mes "[Darwin]"; - mes "^551A8B3 Medicine Bowls^000000,"; - mes "^551A8B3 Empty Bottles^000000,"; - mes "^551A8B1 Red Herb^000000,"; - mes "^551A8B1 Yellow Herb^000000 and"; - mes "^551A8B1 White Herb^000000."; + mesf("^551A8B3 %s^000000,", getitemname(Medicine_Bowl)); + mesf("^551A8B3 %s^000000,", getitemname(Empty_Bottle)); + mesf("^551A8B1 %s^000000,", getitemname(Red_Herb)); + mesf("^551A8B1 %s^000000 and", getitemname(Yellow_Herb)); + mesf("^551A8B1 %s^000000.", getitemname(White_Herb)); ALCH_Q = 7; changequest 2032,2033; next; mes "[Darwin]"; - mes "Once you have"; - mes "prepared everything,"; - mes "return to me."; + mes "Once you have\r" + "prepared everything,\r" + "return to me."; close; case 2: mes "[Darwin]"; mes "Flowers...?"; - mes "In the darkest"; - mes "recesses of my mind,"; - mes "there is a blossum"; - mes "that I faintly remember..."; + mes "In the darkest\r" + "recesses of my mind,\r" + "there is a blossum\r" + "that I faintly remember..."; next; mes "[Darwin]"; - mes "For the one that"; - mes "I love, I put all"; - mes "of my efforts into"; - mes "researching that one thing."; + mes "For the one that\r" + "I love, I put all\r" + "of my efforts into\r" + "researching that one thing."; next; mes "[Darwin]"; - mes "I won't tell you the details,"; - mes "but I was basically researching"; - mes "the relationship between"; - mes "wolves and flowers."; + mes "I won't tell you the details,\r" + "but I was basically researching\r" + "the relationship between\r" + "wolves and flowers."; next; mes "[Darwin]"; mes "But yes..."; mes "It was a flower."; - mes "With its shine, it was said"; - mes "to let you see paradise."; - mes "The ^551A8BIllusion Flower^000000..."; + mes "With its shine, it was said\r" + "to let you see paradise."; + mesf("The ^551A8B%s^000000...", getitemname(Illusion_Flower)); next; mes "[Darwin]"; mes "I even made"; @@ -1006,54 +1082,55 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ next; mes "[Darwin]"; mes "Ah..."; - mes "You are the one who"; - mes "wishes to learn Alchemy."; + mes "You are the one who\r" + "wishes to learn Alchemy."; mes "Have you prepared everything?"; next; if (countitem(Illusion_Flower) > 0) { mes "[Darwin]"; mes "Wait."; - mes "That Illusion Flower."; + mesf("That %s.", getitemname(Illusion_Flower)); mes "How did you get that?"; next; mes "[Darwin]"; mes "Where did you find it?!"; - mes "The flower that slowly"; - mes "blooms under the"; - mes "moonlight?"; + mes "The flower that slowly\r" + "blooms under the\r" + "moonlight?"; mes "It's beautiful...!"; next; mes "[Darwin]"; mes "Th-That flower..."; mes "Please let me see it."; - mes "The Illusion Flower!"; + mesf("The %s!", getitemname(Illusion_Flower)); mes "Uwaaaaaaah!!"; next; mes "[Darwin]"; - mes "Would you be so kind"; - mes "as to let me have this flower?"; + mes "Would you be so kind\r" + "as to let me have this flower?"; mes "I'm sure that this is the Moonlight Flower that I've been seeking!"; next; if (select("Sorry, I can't give it to you.", "I brought it to give to you.") == 1) { mes "[Darwin]"; mes "I understand."; - mes "You can't give"; - mes "such a precious"; - mes "flower to just anyone."; + mes "You can't give\r" + "such a precious\r" + "flower to just anyone."; mes "Well... It's okay."; next; mes "[Darwin]"; - mes "It just brought back old memories. I shouldn't have asked in the first place. In any case, please bring what is needed for the experiment."; + mes "It just brought back old memories. I shouldn't have asked in the first place. In " + "any case, please bring what is needed for the experiment."; next; mes "[Darwin]"; - mes "Please leave that flower"; - mes "somewhere else. It brings"; - mes "back too many memories..."; + mes "Please leave that flower\r" + "somewhere else. It brings\r" + "back too many memories..."; close; } mes "[Darwin]"; - mes "Are you"; - mes "serious?!"; + mes "Are you\r" + "serious?!"; mes "Thank you!"; mes "Such a precious flower."; mes "Ah, Harmona, my love..."; @@ -1064,72 +1141,76 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ mes "I shall plant all of my knowledge of Alchemy directly into your mind..."; next; mes "[Darwin]"; - mes "Open your eyes wide,"; - mes "and look into my eyes!!"; + mes "Open your eyes wide,\r" + "and look into my eyes!!"; mes "Don't stop until the end!!"; next; mes "Lorem ipsum dolor sit amet,"; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; mes "Aenean fermentum ullamcorper."; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; mes "Aenean fermentum ullamcorper."; mes "Vestibulum ante ipsum primis in"; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; mes "Aenean fermentum ullamcorper."; - mes "Vestibulum ante ipsum primis in"; - mes "faucibus orci luctus et ultrices"; + mes "Vestibulum ante ipsum primis in\r" + "faucibus orci luctus et ultrices"; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; mes "Aenean fermentum ullamcorper."; - mes "Vestibulum ante ipsum primis in"; - mes "faucibus orci luctus et ultrices"; - mes "posuere cubilia Curae; Morbi"; + mes "Vestibulum ante ipsum primis in\r" + "faucibus orci luctus et ultrices\r" + "posuere cubilia Curae; Morbi"; next; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit."; mes "Aenean fermentum ullamcorper."; - mes "Vestibulum ante ipsum primis in"; - mes "faucibus orci luctus et ultrices"; - mes "posuere cubilia Curae; Morbi"; - mes "massa, fermentum vitae..."; + mes "Vestibulum ante ipsum primis in\r" + "faucibus orci luctus et ultrices\r" + "posuere cubilia Curae; Morbi\r" + "massa, fermentum vitae..."; next; delitem Illusion_Flower,1; mes "[Darwin]"; mes "^666666*Gasp...*^000000"; - mes "You are now"; - mes "an Alchemist!!"; - mes "Go to the Union"; - mes "and cast away the last"; - mes "vestiges of Merchant life!!"; + mes "You are now\r" + "an Alchemist!!"; + mes "Go to the Union\r" + "and cast away the last\r" + "vestiges of Merchant life!!"; ALCH_Q = 40; changequest 2033,2034; close; } else if (countitem(Medicine_Bowl) > 2 && countitem(Empty_Bottle) > 2 && countitem(Red_Herb) > 0 && countitem(Yellow_Herb) > 0 && countitem(White_Herb) > 0) { mes "[Darwin]"; - mes "Seems like you have everything ready. As promised, I will teach you how to make simple medicine."; + mes "Seems like you have everything ready. As promised, I will teach you how to make simple " + "medicine."; next; mes "[Darwin]"; - mes "First, prepare the Medicine Bowl. Then, you put the Herbs inside, like this, and slowly crush them."; + mesf("First, prepare the %s. Then, you put the Herbs inside, like this, and slowly " + "crush them.", + getitemname(Medicine_Bowl)); next; mes "[Darwin]"; - mes "Pour small amounts"; - mes "of clean water and stir"; - mes "the mixture until it thickens."; + mes "Pour small amounts\r" + "of clean water and stir\r" + "the mixture until it thickens."; mes "Afterwards, add some more Herbs."; next; mes "[Darwin]"; - mes "That's how you make it. If you think you have enough, gently pour the mixture into an empty bottle."; + mes "That's how you make it. If you think you have enough, gently pour the mixture into an " + "empty bottle."; delitem Medicine_Bowl,3; delitem Empty_Bottle,3; delitem Red_Herb,1; @@ -1137,14 +1218,16 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ delitem White_Herb,1; next; mes "[Darwin]"; - mes "There you go,"; - mes "it's complete."; - mes "Now, make some medicine"; - mes "using the simple procedure"; - mes "I just explained to you."; + mes "There you go,\r" + "it's complete."; + mes "Now, make some medicine\r" + "using the simple procedure\r" + "I just explained to you."; .@w_point = 0; next; - switch(select("Prepare the Medicine Bowl.", "Put the Medicine Bowl on your head.", "Kick the Medicine Bowl.")) { + switch (select(sprintf(_$("Prepare the %s."), getitemname(Medicine_Bowl)), + sprintf(_$("Put the %s on your head."), getitemname(Medicine_Bowl)), + sprintf(_$("Kick the %s."), getitemname(Medicine_Bowl)))) { case 1: break; case 2: @@ -1160,13 +1243,15 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ next; break; } - switch(select("Put some dirt in the Medicine Bowl.", "Put some Herbs in the Medicine Bowl.", "Put a Harp in the Medicine Bowl.")) { + switch (select(sprintf(_$("Put some dirt in the %s."), getitemname(Medicine_Bowl)), + sprintf(_$("Put some Herbs in the %s."), getitemname(Medicine_Bowl)), + sprintf(_$("Put a Harp in the %s."), getitemname(Medicine_Bowl)))) { case 1: ++.@w_point; mes "[Darwin]"; mes "...Eh!?"; - mes "That's not"; - mes "medicine!"; + mes "That's not\r" + "medicine!"; next; break; case 2: @@ -1175,32 +1260,36 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ ++.@w_point; mes "[Darwin]"; mes "A Harp?"; - mes "And how would"; - mes "you do that?"; + mes "And how would\r" + "you do that?"; next; break; } - switch(select("Crush the Herbs.", "Crush the Medicine Bowl.", "Crush Darwin's foot.")) { + switch (select("Crush the Herbs.", + sprintf(_$("Crush the %s."), getitemname(Medicine_Bowl)), + "Crush Darwin's foot.")) { case 1: break; case 2: ++.@w_point; mes "[Darwin]"; - mes "Wh-What are"; - mes "you doing!?"; + mes "Wh-What are\r" + "you doing!?"; next; break; case 3: ++.@w_point; mes "[Darwin]"; mes "Agh...!"; - mes "What do you"; - mes "think you're"; - mes "doing?!"; + mes "What do you\r" + "think you're\r" + "doing?!"; next; break; } - switch(select("Spray clean water.", "Drink clean water.", "Pour clean water.")) { + switch (select("Spray clean water.", + "Drink clean water.", + "Pour clean water.")) { case 1: ++.@w_point; mes "[Darwin]"; @@ -1212,41 +1301,45 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ ++.@w_point; mes "[Darwin]"; mes "W-wait..."; - mes "Are you"; - mes "taking a break?"; + mes "Are you\r" + "taking a break?"; next; break; case 3: break; } - switch(select("Continue crushing the Herbs.", "Continue eating the Herbs.", "Continue dancing and singing.")) { + switch (select("Continue crushing the Herbs.", + "Continue eating the Herbs.", + "Continue dancing and singing.")) { case 1: break; case 2: ++.@w_point; mes "[Darwin]"; mes "Eat the Herbs?"; - mes "I think you need"; - mes "to focus on the"; - mes "task at hand..."; + mes "I think you need\r" + "to focus on the\r" + "task at hand..."; next; break; case 3: ++.@w_point; mes "[Darwin]"; - mes "Singing and"; - mes "dancing? Alchemists"; - mes "don't do that, have"; - mes "you gone crazy?"; + mes "Singing and\r" + "dancing? Alchemists\r" + "don't do that, have\r" + "you gone crazy?"; next; break; } - switch(select("Put noodles in and fry it.", "Pour it in an empty bottle.", "Hold the Medicine Bowl and drink it.")) { + switch (select("Put noodles in and fry it.", + "Pour it in an empty bottle.", + sprintf(_$("Hold the %s and drink it."), getitemname(Medicine_Bowl)))) { case 1: ++.@w_point; mes "[Darwin]"; - mes "We're Alchemists,"; - mes "not restaurant chefs."; + mes "We're Alchemists,\r" + "not restaurant chefs."; next; break; case 2: @@ -1265,9 +1358,9 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ mes "......"; next; mes "[Darwin]"; - mes "You messed up the mixture"; - mes "since you didn't follow the procedure! Get some more ingredients so you can try it"; - mes "again until you get it right."; + mes "You messed up the mixture\r" + "since you didn't follow the procedure! Get some more ingredients so you can " + "try it again until you get it right."; close; } getitem Red_Potion,1; @@ -1275,81 +1368,82 @@ alde_alche,13,15,7 script Studying Man#am 4_M_ALCHE_C,{ getitem White_Potion,1; mes "[Darwin]"; mes "Good job."; - mes "It came out pretty well considering it's your first time. Go ahead and keep the medicines that you've just made."; + mes "It came out pretty well considering it's your first time. Go ahead and keep the medicines " + "that you've just made."; ALCH_Q = 8; changequest 2033,2035; next; mes "[Darwin]"; - mes "Now, go into the next room"; - mes "and speak to Van Helmont to"; - mes "continue your training."; + mes "Now, go into the next room\r" + "and speak to Van Helmont to\r" + "continue your training."; next; mes "[Darwin]"; mes "Never forget..."; - mes "You must always protect"; - mes "what is most precious to you."; + mes "You must always protect\r" + "what is most precious to you."; close; } else { mes "[Darwin]"; - mes "Have you forgotten"; - mes "what you need to bring?"; - mes "Let me remind you once"; - mes "again. You must come"; - mes "back with..."; + mes "Have you forgotten\r" + "what you need to bring?"; + mes "Let me remind you once\r" + "again. You must come\r" + "back with..."; next; mes "[Darwin]"; - mes "^551A8B3 Medicine Bowls^000000,"; - mes "^551A8B3 Empty Bottle^000000,"; - mes "^551A8B1 Red Herb^000000,"; - mes "^551A8B1 Yellow Herb^000000 and"; - mes "^551A8B1 White Herb^000000."; + mesf("^551A8B3 %s^000000,", getitemname(Medicine_Bowl)); + mesf("^551A8B3 %s^000000,", getitemname(Empty_Bottle)); + mesf("^551A8B1 %s^000000,", getitemname(Red_Herb)); + mesf("^551A8B1 %s^000000 and", getitemname(Yellow_Herb)); + mesf("^551A8B1 %s^000000.", getitemname(White_Herb)); next; mes "[Darwin]"; - mes "Come back"; - mes "when you are"; - mes "ready..."; + mes "Come back\r" + "when you are\r" + "ready..."; close; } } else if (ALCH_Q == 8) { - mes "I said to go"; - mes "to Van Helmont."; - mes "I'd like to teach you"; - mes "more, but I can't."; + mes "I said to go\r" + "to Van Helmont."; + mes "I'd like to teach you\r" + "more, but I can't."; next; mes "[Darwin]"; mes "Aah..."; mes "Harmona, my love."; - mes "I can't even see the flower anymore. My soul quietly"; - mes "withers as well.."; + mes "I can't even see the flower anymore. My soul quietly\r" + "withers as well.."; close; } else if (ALCH_Q == 40) { - mes "I have already given you all of my knowledge and have nothing more"; - mes "to teach you."; + mes "I have already given you all of my knowledge and have nothing more\r" + "to teach you."; next; mes "[Darwin]"; - mes "Go to the second floor and talk to speak to our Union Leader. Once"; - mes "you do that, your life as an Alchemist will begin."; + mes "Go to the second floor and talk to speak to our Union Leader. Once\r" + "you do that, your life as an Alchemist will begin."; close; } else { mes "When you have"; - mes "your dreams, you"; - mes "have everything."; - mes "Without them, you have"; - mes "nothing more to lose."; + mes "your dreams, you\r" + "have everything."; + mes "Without them, you have\r" + "nothing more to lose."; next; mes "[Darwin]"; mes "These cursed eyes..."; - mes "They've lost sight of"; - mes "my dreams a long time ago."; + mes "They've lost sight of\r" + "my dreams a long time ago."; mes "Ha ha ha ha..."; next; mes "[Darwin]"; - mes "Does paradise"; - mes "really exist...?"; + mes "Does paradise\r" + "really exist...?"; mes "Not without my love..."; mes "Not without Harmona..."; close; @@ -1361,51 +1455,54 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ if (BaseJob != Job_Merchant) { if (BaseJob == Job_Alchemist) { mes "What do you want?"; - mes "I'm busy!! Don't"; - mes "bother me and get"; - mes "on your way."; + mes "I'm busy!! Don't\r" + "bother me and get\r" + "on your way."; next; mes "[Van Helmont]"; mes "Now, come on..."; - mes "You'll never get"; - mes "any research completed if you just slack off. Go out and learn all that you can."; + mes "You'll never get\r" + "any research completed if you just slack off. Go out and learn all that you can."; next; mes "[Van Helmont]"; - mes "Reading science journals and performing experiments. That's what Alchemy is all about. Now, let me get back to work!"; + mes "Reading science journals and performing experiments. That's what Alchemy is all about. " + "Now, let me get back to work!"; close; } else { mes "Just a little..."; mes "A little bit more..."; - mes "Nooo! Just a little"; - mes "bit more and it"; - mes "would've been done!"; + mes "Nooo! Just a little\r" + "bit more and it\r" + "would've been done!"; next; mes "[Van Helmont]"; mes "Why...?!"; mes "Why, another failure?!"; - mes "My calculations were"; - mes "all correct! W-Wait...!"; + mes "My calculations were\r" + "all correct! W-Wait...!"; next; mes "[Van Helmont]"; - mes "Perhaps, if I capacitated the thermal flux by using the neutronic gradient, it just might work...!"; + mes "Perhaps, if I capacitated the thermal flux by using the neutronic gradient, it just might " + "work...!"; close; } } if (ALCH_Q == 8) { mes "Arrrrgh...!"; - mes "Why isn't this formula working? What's wrong? In theory, it's all correct, but there must be an error in the formula somewhere..."; + mes "Why isn't this formula working? What's wrong? In theory, it's all correct, but there must be an " + "error in the formula somewhere..."; next; mes "[Van Helmont]"; - mes "I pour it in here, and it should stop. Wait, this is the wrong solution! How could I make such"; - mes "a dumb mistake?! When did these"; - mes "get switched?!"; + mes "I pour it in here, and it should stop. Wait, this is the wrong solution! How could I make such\r" + "a dumb mistake?! When did these\r" + "get switched?!"; next; mes "[Van Helmont]"; mes "Okay, okay..."; mes "I just need to fix this part."; - mes "No need to start over. I just"; - mes "need to fix it... But wait. Wait..."; + mes "No need to start over. I just\r" + "need to fix it... But wait. Wait..."; next; mes "[Van Helmont]"; mes "................."; @@ -1417,10 +1514,12 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ if (select("I want to become an Alchemist.", ".......") == 2) { mes "[Van Helmont]"; mes "Hmm...?"; - mes "What, did you just want to watch? Fine, fine, but do it quietly and leave right when you're done."; + mes "What, did you just want to watch? Fine, fine, but do it quietly and leave right when " + "you're done."; next; mes "[Van Helmont]"; - mes "Stay out of my way and don't go around touching stuff. There might be some volatile materials, so it'd be dangerous to have any accidents."; + mes "Stay out of my way and don't go around touching stuff. There might be some volatile " + "materials, so it'd be dangerous to have any accidents."; close; } mes "[Van Helmont]"; @@ -1429,9 +1528,9 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ mes "What a funny Merchant."; next; mes "[Van Helmont]"; - mes "Well, that's nice, but I have very urgent experiments that require"; - mes "my attention, so don't get"; - mes "in the way."; + mes "Well, that's nice, but I have very urgent experiments that require\r" + "my attention, so don't get\r" + "in the way."; next; if (select("Teach me something.", "...") == 1) { mes "[Van Helmont]"; @@ -1439,25 +1538,28 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ mes "Didn't I just tell you not to bother me? What's so hard to understand about that?"; next; mes "[Van Helmont]"; - mes "Fine, fine. I'll give you an assignment. Learn something"; - mes "new and come back. Let's see."; + mes "Fine, fine. I'll give you an assignment. Learn something\r" + "new and come back. Let's see."; mes "What would be good..."; next; mes "[Van Helmont]"; mes "Okay, I got it."; - mes "Go learn how to make"; - mes "a Counteragent and Mixture"; - mes "from Molgenstein."; + mesf("Go learn how to make\r" + "a %s and %s\r" + "from Molgenstein.", + getitemname(Counteragent), + getitemname(Mixture)); next; mes "[Van Helmont]"; - mes "You don't need to bring anything. Just go watch him at work and have him tell you how he makes those solutions. Got it?"; + mes "You don't need to bring anything. Just go watch him at work and have him tell you how he " + "makes those solutions. Got it?"; next; mes "[Van Helmont]"; ALCH_Q = 9; changequest 2035,2036; mes "Well then, see you later."; - mes "You'd better get going as"; - mes "soon as you can."; + mes "You'd better get going as\r" + "soon as you can."; close; } mes "[Van Helmont]"; @@ -1472,24 +1574,32 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ mes "......"; next; mes "[Van Helmont]"; - mes "So if I recalibrate the combustion rate of this compound, that should negate any cohesive tendencies in this particle flux..."; + mes "So if I recalibrate the combustion rate of this compound, that should negate any cohesive " + "tendencies in this particle flux..."; next; mes "[Van Helmont]"; - mes "But what am I going to do"; - mes "about all of this spontaneous"; - mes "crystallization?! I can't very well remove this matrix, I need it for the catalyst to reach the triple point."; + mes "But what am I going to do\r" + "about all of this spontaneous\r" + "crystallization?! I can't very well remove this matrix, I need it for the catalyst to reach " + "the triple point."; next; mes "[Van Helmont]"; mes "Damn!"; - mes "What am"; - mes "I going to do?!"; + mes "What am\r" + "I going to do?!"; close; } else if (ALCH_Q == 9) { - mes "Alright, if I make an incision here in the Tentacle, and add a Jellopy and Sticky Mucus solution into the... Where the hell did my Medicine Bowl go?"; + mesf("Alright, if I make an incision here in the %s, and add a %s and %s solution into the... " + "Where the hell did my %s go?", + getitemname(Tentacle), + getitemname(Jellopy), + getitemname(Sticky_Mucus), + getitemname(Medicine_Bowl)); next; mes "[Van Helmont]"; - mes "Did I use them all at a time like this?! I wonder if Nicholas has any left. Ugh, what a pain. Wait. Wait a minute..."; + mes "Did I use them all at a time like this?! I wonder if Nicholas has any left. Ugh, what a pain. " + "Wait. Wait a minute..."; next; mes "[Van Helmont]"; mes "..."; @@ -1502,108 +1612,123 @@ alde_alche,79,19,5 script Experiment Expert#am 4_M_ALCHE_A,{ if (select("I want to become an Alchemist?", ".......") == 2) { mes "[Van Helmont]"; mes "Hmm...?"; - mes "What, did you just want to watch? Fine, fine, but do it quietly and leave right when you're done."; + mes "What, did you just want to watch? Fine, fine, but do it quietly and leave right when " + "you're done."; next; mes "[Van Helmont]"; - mes "Stay out of my way and don't go around touching stuff. There might be some volatile materials, so it'd be dangerous to have any accidents."; + mes "Stay out of my way and don't go around touching stuff. There might be some volatile " + "materials, so it'd be dangerous to have any accidents."; close; } mes "[Van Helmont]"; - mes "Ah, of course. The Merchant from before. So what did you learn from Molgenstein? I didn't just send you there for fun, you know."; + mes "Ah, of course. The Merchant from before. So what did you learn from Molgenstein? I didn't just " + "send you there for fun, you know."; next; mes "[Van Helmont]"; - mes "Let me ask you"; - mes "some questions to"; - mes "check what you've"; - mes "learned."; + mes "Let me ask you\r" + "some questions to\r" + "check what you've\r" + "learned."; next; if(MISC_QUEST & 4) { mes "[Van Helmont]"; - mes "Which item is not"; - mes "necessary to make"; - mes "a Counteragent?"; + mesf("Which item is not\r" + "necessary to make\r" + "a %s?", + getitemname(Counteragent)); next; - if (select("Karvodailnirol", "Detrimindexta", "Alcohol") != 1) .@w_point += 1; + if (select(getitemname(Karvodailnirol), getitemname(Detrimindexta), getitemname(Alchol)) != 1) + .@w_point += 1; mes "[Van Helmont]"; - mes "What item is not"; - mes "necessary to make"; - mes "a Mixture?"; + mesf("What item is not\r" + "necessary to make\r" + "a %s?", + getitemname(Mixture)); next; - if (select("Karvodailnirol", "Detrimindexta", "Alcohol") != 2) .@w_point += 1; + if (select(getitemname(Karvodailnirol), getitemname(Detrimindexta), getitemname(Alchol)) != 2) + .@w_point += 1; if (.@w_point > 0) { mes "[Van Helmont]"; - mes "Weren't you listening to Molgenstein at all? Maybe you"; - mes "have to watch him make it again."; + mes "Weren't you listening to Molgenstein at all? Maybe you\r" + "have to watch him make it again."; next; mes "[Van Helmont]"; - mes "If you can't tell the exact items that you need in an experiment,"; - mes "you might end up hurting yourself!"; + mes "If you can't tell the exact items that you need in an experiment,\r" + "you might end up hurting yourself!"; close; } mes "[Van Helmont]"; mes "Good, you've learned well."; - mes "Okay, now you know something about experimentation. You're done here, so now I can continue with my experiments."; + mes "Okay, now you know something about experimentation. You're done here, so now I can " + "continue with my experiments."; next; mes "[Van Helmont]"; - mes "Go out and find the room next"; - mes "to this one and talk to Nicholas. He'll continue your training."; + mes "Go out and find the room next\r" + "to this one and talk to Nicholas. He'll continue your training."; next; ALCH_Q = 20; changequest 2036,2037; mes "[Van Helmont]"; - mes "What are you"; - mes "still doing here?"; - mes "Go! We both have"; - mes "more important"; - mes "things to do!"; + mes "What are you\r" + "still doing here?"; + mes "Go! We both have\r" + "more important\r" + "things to do!"; close; } else { mes "[Van Helmont]"; - mes "What item do"; - mes "you need to make"; - mes "a Counteragent?"; + mesf("What item do\r" + "you need to make\r" + "a %s?", + getitemname(Counteragent)); next; - select("Feather", "Sticky Mucus", "Animal Gore"); + select(getitemname(Feather), getitemname(Sticky_Mucus), getitemname(Animal_Blood)); mes "[Van Helmont]"; - mes "What item do"; - mes "you need to make"; - mes "a Mixture?"; - next; - select("Monster Feed", "Ancient Lips", "Rotten Bandage"); + mesf("What item do\r" + "you need to make\r" + "a %s?", + getitemname(Mixture)); + next; + select(getitemname(Monster's_Feed), + getitemname(Lip_Of_Ancient_Fish), + getitemname(Rotten_Bandage)); mes "[Van Helmont]"; - mes "Be honest. You don't know, do you?! Didn't I say to go to Molgenstein and have him teach you?!"; + mes "Be honest. You don't know, do you?! Didn't I say to go to Molgenstein and have him teach " + "you?!"; next; mes "[Van Helmont]"; - mes "Don't even think about coming back until you talk to him! Now stop bothering me and get out of here!"; + mes "Don't even think about coming back until you talk to him! Now stop bothering me and get " + "out of here!"; close; } } else if (ALCH_Q == 20) { mes "What...?"; - mes "I thought I told you to"; - mes "talk to Nicholas next door?"; + mes "I thought I told you to\r" + "talk to Nicholas next door?"; next; mes "[Van Helmont]"; - mes "I need to continue my research,"; - mes "and you need to finish becoming an Alchemist. Come on, get moving!"; + mes "I need to continue my research,\r" + "and you need to finish becoming an Alchemist. Come on, get moving!"; close; } else { mes "Just a little..."; mes "A little bit more..."; - mes "Nooo! Just a little"; - mes "bit more and it"; - mes "would've been done!"; + mes "Nooo! Just a little\r" + "bit more and it\r" + "would've been done!"; next; mes "[Van Helmont]"; mes "Why...?!"; mes "Why, another failure?!"; - mes "My calculations were"; - mes "all correct! Wait..."; + mes "My calculations were\r" + "all correct! Wait..."; next; mes "[Van Helmont]"; - mes "Perhaps, if I capacitated the thermal flux by using the neutronic gradient, it just might work..."; + mes "Perhaps, if I capacitated the thermal flux by using the neutronic gradient, it just might " + "work..."; close; } } @@ -1625,38 +1750,40 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ if (BaseJob != Job_Merchant) { if (BaseJob == Job_Alchemist) { mes "Welcome!"; - mes "So how is your"; - mes "research coming along?"; + mes "So how is your\r" + "research coming along?"; next; mes "[Vincent Carsciallo]"; - mes "At times you get results that are unexpected from an experiment. Although these may be setbacks in your research, such results can also lead to new discoveries."; + mes "At times you get results that are unexpected from an experiment. Although these may be " + "setbacks in your research, such results can also lead to new discoveries."; next; mes "[Vincent Carsciallo]"; - mes "If you discover something new,"; - mes "come and tell us. Don't forget that we are all working together to unlock the mysteries of science!"; + mes "If you discover something new,\r" + "come and tell us. Don't forget that we are all working together to unlock the " + "mysteries of science!"; } else if (BaseClass == Job_Novice) { mes "Hm..."; mes "A Novice?"; - mes "You shouldn't be"; - mes "playing in a place"; - mes "like this."; + mes "You shouldn't be\r" + "playing in a place\r" + "like this."; next; mes "[Vincent Carsciallo]"; - mes "There are a lot of volatile chemicals and dangerous"; - mes "materials in this building. It'd be a lot better if you just played outside."; + mes "There are a lot of volatile chemicals and dangerous\r" + "materials in this building. It'd be a lot better if you just played outside."; } else { mes "Hmm...?"; - mes "What's an adventurer"; - mes "doing here in the"; - mes "Alchemist Union?"; + mes "What's an adventurer\r" + "doing here in the\r" + "Alchemist Union?"; next; mes "[Vincent Carsciallo]"; - mes "I'm afraid there's"; - mes "not much we can offer"; - mes "you here if you're not"; - mes "a member of our Union."; + mes "I'm afraid there's\r" + "not much we can offer\r" + "you here if you're not\r" + "a member of our Union."; } close2; cutin "",255; @@ -1665,19 +1792,21 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ if (ALCH_Q == 0) { mes "Hmm...?"; mes "A Merchant?"; - mes "Are you interested"; - mes "in learning Alchemy?"; + mes "Are you interested\r" + "in learning Alchemy?"; next; mes "[Vincent Carsciallo]"; mes "This is the Alchemist Union."; - mes "We research and experiment with many different substances in order to create new materials without using magic."; + mes "We research and experiment with many different substances in order to create new materials " + "without using magic."; next; mes "[Vincent Carsciallo]"; - mes "Someday, we hope to unlock"; - mes "the secret of life, as well as the other mysteries of science."; + mes "Someday, we hope to unlock\r" + "the secret of life, as well as the other mysteries of science."; next; mes "[Vincent Carsciallo]"; - mes "After being traveling as a Merchant for a long time, you must have developed some scientific curiosity. If you'd like to learn Alchemy, why don't you try joining the Alchemist Union?"; + mes "After being traveling as a Merchant for a long time, you must have developed some scientific " + "curiosity. If you'd like to learn Alchemy, why don't you try joining the Alchemist Union?"; close2; cutin "",255; end; @@ -1692,17 +1821,17 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ end; } if (SkillPoint) { - mes "Ah, you're almost"; - mes "ready to become an"; - mes "Alchemist, but you must"; - mes "first allocate your unused"; - mes "Skill Points."; + mes "Ah, you're almost\r" + "ready to become an\r" + "Alchemist, but you must\r" + "first allocate your unused\r" + "Skill Points."; next; mes "[Vincent Carsciallo]"; - mes "Talk to me again"; - mes "once you have spent"; - mes "all of your extra"; - mes "Skill Points."; + mes "Talk to me again\r" + "once you have spent\r" + "all of your extra\r" + "Skill Points."; close2; cutin "",255; end; @@ -1714,9 +1843,9 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ changequest 2034,2040; } mes "Ah, well done."; - mes "I can see that you"; - mes "have learned all of"; - mes "the basics of Alchemy."; + mes "I can see that you\r" + "have learned all of" + "the basics of Alchemy."; next; ALCH_Q = 0; completequest 2040; @@ -1724,19 +1853,19 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ callfunc "Job_Change",Job_Alchemist; callfunc "F_ClearJobVar"; mes "[Vincent Carsciallo]"; - mes "Henceforth, you are"; - mes "now a member of our"; - mes "illustrious Union."; + mes "Henceforth, you are\r" + "now a member of our\r" + "illustrious Union."; mes "I hope you learn a lot..."; next; if (.@jlevel == 50) { getitem Slim_Potion_Create_Book,1; mes "[Vincent Carsciallo]"; - mes "Let me give you"; - mes "something special."; - mes "You can use this to"; - mes "begin your life"; - mes "of research."; + mes "Let me give you\r" + "something special."; + mes "You can use this to" + "begin your life" + "of research."; } else { switch(rand(1,6)) { @@ -1760,32 +1889,32 @@ alde_alche,101,184,4 script Master Alchemist#am 2_M_DYEINGER,{ } mes "[Vincent Carsciallo]"; mes "And..."; - mes "Here's a little"; - mes "something to help"; - mes "you begin your"; - mes "research."; + mes "Here's a little\r" + "something to help\r" + "you begin your\r" + "research."; } next; mes "[Vincent Carsciallo]"; - mes "I'll see"; - mes "you later then..."; - mes "Remember to carry"; - mes "yourself with pride"; - mes "as an Alchemist!"; + mes "I'll see\r" + "you later then..."; + mes "Remember to carry\r" + "yourself with pride\r" + "as an Alchemist!"; close2; cutin "",255; end; } else { mes "Ah..."; - mes "I believe you've"; - mes "already registered"; - mes "for training to become"; - mes "an Alchemist."; + mes "I believe you've\r" + "already registered\r" + "for training to become\r" + "an Alchemist."; next; mes "[Vincent Carsciallo]"; - mes "Please listen to the"; - mes "other Alchemists and follow their instructions carefully. You will learn much from them."; + mes "Please listen to the\r" + "other Alchemists and follow their instructions carefully. You will learn much from them."; close2; cutin "",255; end; @@ -1805,72 +1934,95 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ if (ALCH_Q == 20) { mes "[Nicholas Flamel]"; mes "Ooh..."; - mes "You're the upstart"; - mes "Merchant that wants"; - mes "to become an Alchemist?"; + mes "You're the upstart\r" + "Merchant that wants\r" + "to become an Alchemist?"; next; mes "[Nicholas Flamel]"; - mes "Not just anyone can become an Alchemist, you know. You've got to have motivation and clear goals and a strong sense of focus."; + mes "Not just anyone can become an Alchemist, you know. You've got to have motivation and " + "clear goals and a strong sense of focus."; next; mes "[Nicholas Flamel]"; - mes "Alchemists must memorize many chemical equations, scientific laws and a lot of other information. It's actually pretty tough."; + mes "Alchemists must memorize many chemical equations, scientific laws and a lot of other " + "information. It's actually pretty tough."; next; mes "[Nicholas Flamel]"; - mes "If you can't focus, you'll be confused later when you look at Alchemy charts. My test will judge your ability to do just that."; + mes "If you can't focus, you'll be confused later when you look at Alchemy charts. My test " + "will judge your ability to do just that."; next; } mes "[Nicholas Flamel]"; - mes "Find the words scrambled"; - mes "in the group of letters I give you. They can be made by using some"; - mes "or all of the letters."; + mes "Find the words scrambled\r" + "in the group of letters I give you. They can be made by using some\r" + "or all of the letters."; next; mes "[Nicholas Flamel]"; - mes "You pass if you"; - mes "choose the word"; - mes "that is ^551A8BIN^000000 the puzzle."; + mes "You pass if you\r" + "choose the word\r" + "that is ^551A8BIN^000000 the puzzle."; next; switch(rand(1,3)) { case 1: mes "t m y a n y e o b n e g p r i"; next; - if (select("Brake", "Brass", "Bug", "Broken", "Brigan?") == 5) .@alch_t += 10; + if (select("Brake", "Brass" "Bug", "Broken", "Brigan?") == 5) + .@alch_t += 10; mes "o n c u t a p j l e r s v m u"; next; - if (select("vendor", "storage", "weapon", "simple", "streetshop") == 1) .@alch_t += 10; + if (select("vendor", "storage", "weapon", "simple", "streetshop") == 1) + .@alch_t += 10; mes "t v a r m e g p h e u b o y l"; next; - if (select("molasses", "party", "leader", "sweets", "treacle") == 2) .@alch_t += 10; + if (select("molasses", "party", "leader", "sweets", "treacle") == 2) + .@alch_t += 10; mes "q z a h n a i n b r d p t n c"; next; - if (select("partisan", "partizan", "pato", "paros", "pack") == 2) .@alch_t += 10; + if (select("partisan", "partizan", "pato", "paros", "pack") == 2) + .@alch_t += 10; break; case 2: mes "m p d i c f a r o g n k w a s"; next; - if (select("packman", "sunshine", "ragnarok", "wonderland", "frost") == 1) .@alch_t += 10; + if (select("packman", "sunshine", "ragnarok", "wonderland", "frost") == 1) + .@alch_t += 10; mes "g b n o p r e f a r e t a s k"; next; - if (select("purple", "smoker", "ragnarok", "bolt", "burnt wood") == 3) .@alch_t += 10; + if (select("purple", "smoker", "ragnarok", "bolt", "burnt wood") == 3) + .@alch_t += 10; mes "u g n i s j e k c e o g n d p"; next; - if (select("scab", "kinship", "donate", "source", "opening") == 5) .@alch_t += 10; + if (select("scab", "kinship", "donate", "source", "opening") == 5) + .@alch_t += 10; mes "r o e h n r o m c a i n p t t"; next; - if (select("forgemerchant", "potionmerchant", "dcmerchant", "vendingmerchant", "battlemerchant") == 2) .@alch_t += 10; + if (select("forgemerchant", + "potionmerchant", + "dcmerchant", + "vendingmerchant", + "battlemerchant") == 2) + .@alch_t += 10; break; case 3: mes "s m i e x b w u n e t a g l r"; next; - if (select("tiger", "wolf", "pumpkin", "tripped", "tore") == 1) .@alch_t += 10; + if (select("tiger", "wolf", "pumpkin", "tripped", "tore") == 1) + .@alch_t += 10; mes "n i e g b o p d s o a u w r v"; next; - if (select("bash", "provoke", "endure", "stun", "abracadabra") == 3) .@alch_t += 10; + if (select("bash", "provoke", "endure", "stun", "abracadabra") == 3) + .@alch_t += 10; mes "l r m g r e x t a v i n e d e"; next; - if (select("alberta", "latifoliate", "crimson", "maple", "evergreen") == 5) .@alch_t += 10; + if (select("alberta", "latifoliate", "crimson", "maple", "evergreen") == 5) + .@alch_t += 10; mes "r o e h n r o m c a i n p t t"; next; - if (select("forgemerchant", "potionmerchant", "dcmerchant", "vendingmerchant", "battlemerchant") == 2) .@alch_t += 10; + if (select("forgemerchant", + "potionmerchant", + "dcmerchant", + "vendingmerchant", + "battlemerchant") == 2) + .@alch_t += 10; break; } mes "[Nicholas Flamel]"; @@ -1881,17 +2033,18 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ mes "Excellent job!"; next; mes "[Nicholas Flamel]"; - mes "Great, you found all of those hidden words. With that kind of concentration, you should have no problem memorizing information."; + mes "Great, you found all of those hidden words. With that kind of concentration, you should " + "have no problem memorizing information."; next; mes "[Nicholas Flamel]"; - mes "Come back in a little bit while"; - mes "I prepare the next assignment"; - mes "for your training."; + mes "Come back in a little bit while\r" + "I prepare the next assignment\r" + "for your training."; next; mes "[Nicholas Flamel]"; - mes "Oh, and before you talk to"; - mes "me again, make sure you have"; - mes "^551A8Bplenty of room in your inventory^000000."; + mes "Oh, and before you talk to\r" + "me again, make sure you have\r" + "^551A8Bplenty of room in your inventory^000000."; close; } else { @@ -1902,12 +2055,13 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ mes "Judging from these results, you obviously have a problem with concentrating."; next; mes "[Nicholas Flamel]"; - mes "If you can't even solve these easy word puzzles, how can you keep track of your experiments and research?"; + mes "If you can't even solve these easy word puzzles, how can you keep track of your " + "experiments and research?"; next; mes "[Nicholas Flamel]"; - mes "Why don't you relax"; - mes "and rest a bit before"; - mes "you take the test again?"; + mes "Why don't you relax\r" + "and rest a bit before\r" + "you take the test again?"; close; } @@ -1921,26 +2075,27 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ } mes "[Nicholas Flamel]"; mes "Alright..."; - mes "For your next"; - mes "assignment, you'll"; - mes "need to travel to ^551A8BJuno^000000."; + mes "For your next\r" + "assignment, you'll\r" + "need to travel to ^551A8BJuno^000000."; next; mes "[Nicholas Flamel]"; - mes "There, you'll need to talk to ^551A8BBain^000000 and ^551A8BBajin^000000. Those two are doing Alchemy research with the Sages"; - mes "in Juno. You'll learn something by assisting them with their project."; + mes "There, you'll need to talk to ^551A8BBain^000000 and ^551A8BBajin^000000. Those two are doing " + "Alchemy research with the Sages\r" + "in Juno. You'll learn something by assisting them with their project."; next; mes "[Nicholas Flamel]"; - mes "Come back here to me after you"; - mes "help them out. They'll need all of these items to continue their experiments."; + mes "Come back here to me after you\r" + "help them out. They'll need all of these items to continue their experiments."; next; ALCH_Q = 23; changequest 2037,2038; mes "[Nicholas Flamel]"; - mes "1 Mixture,"; - mes "5 Burnt Tree,"; - mes "5 Fine Sand,"; - mes "3 Rough Oridecon"; - mes "and 3 Rough Elunium."; + mesf("1 %s,", getitemname(Mixture)); + mesf("5 %s,", getitemname(Burn_Tree)); + mesf("5 %s,", getitemname(Fine_Sand)); + mesf("3 %s", getitemname(Oridecon_Stone)); + mesf("and 3 %s.", getitemname(Elunium_Stone)); getitem Mixture,1; getitem Burn_Tree,5; getitem Fine_Sand,5; @@ -1949,17 +2104,17 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ next; mes "[Nicholas Flamel]"; mes "Alright."; - mes "Have a safe trip"; - mes "and come back in"; - mes "one piece."; + mes "Have a safe trip\r" + "and come back in\r" + "one piece."; close; } else if (ALCH_Q == 23) { mes "[Nicholas Flamel]"; - mes "Didn't I say to"; - mes "go to Juno and help"; - mes "Bain and Bajin with"; - mes "their Alchemy research?"; + mes "Didn't I say to\r" + "go to Juno and help\r" + "Bain and Bajin with\r" + "their Alchemy research?"; close; } else if (ALCH_Q == 24) { @@ -1967,36 +2122,38 @@ alde_alche,145,19,1 script Chief Researcher#am 1_M_LIBRARYMASTER,{ changequest 2038,2039; mes "[Nicholas Flamel]"; mes "Ah, you're back!"; - mes "I just got a message from Bain"; - mes "and Bajin. They let me know that they were very happy with your assistance."; + mes "I just got a message from Bain\r" + "and Bajin. They let me know that they were very happy with your assistance."; next; mes "[Nicholas Flamel]"; - mes "If you were good enough"; - mes "to help out those brothers,"; - mes "you definitely qualify to be"; - mes "an Alchemist."; + mes "If you were good enough\r" + "to help out those brothers,\r" + "you definitely qualify to be\r" + "an Alchemist."; next; mes "[Nicholas Flamel]"; mes "Good work!"; - mes "All you have to do now is speak to the Union Leader on the 2nd floor! Congratulations, you'll become an Alchemist very soon!"; + mes "All you have to do now is speak to the Union Leader on the 2nd floor! Congratulations, you'll " + "become an Alchemist very soon!"; close; } else if (ALCH_Q == 40 && BaseJob == Job_Merchant) { mes "[Nicholas Flamel]"; - mes "All you have to do now is speak to the Union Leader on the 2nd floor! Congratulations, you'll become an Alchemist very soon!"; + mes "All you have to do now is speak to the Union Leader on the 2nd floor! Congratulations, you'll " + "become an Alchemist very soon!"; close; } else { mes "[Nicholas Flamel]"; - mes "Lorem ipsum dolor sit amet,"; - mes "consectetuer adipiscing elit."; - mes "Vivamus sem. Sed metus"; - mes "lacus, viverra id, rutrum eget,"; - mes "rhoncus sit amet, lectus."; + mes "Lorem ipsum dolor sit amet,\r" + "consectetuer adipiscing elit.\r" + "Vivamus sem. Sed metus\r" + "lacus, viverra id, rutrum eget,\r" + "rhoncus sit amet, lectus."; next; mes "[Nicholas Flamel]"; - mes "Suspendisse sit amet urna in"; - mes "nisl fringilla faucibus. Nulla scelerisque eros..."; + mes "Suspendisse sit amet urna in\r" + "nisl fringilla faucibus. Nulla scelerisque eros..."; mes "^666666*Mumble Mumble*^000000"; close; } diff --git a/npc/quests/bard_quest.txt b/npc/quests/bard_quest.txt index 7a2166836..7545d24e7 100644 --- a/npc/quests/bard_quest.txt +++ b/npc/quests/bard_quest.txt @@ -1458,8 +1458,8 @@ morocc,134,111,3 script Bard#3 2_M_BARD_ORIENT,{ next; mes "^3355FFKino Kitty coughed a few times, wiping his mouth with his sleeve. As he adjusts the guitar strings, you notice small stains of blood on his sleeve. Then, he began to sing.^000000"; next; - mes "^D43D1ABrave hero Siegfried "; - mes "Vanquished a mighty dragon "; + mes "^D43D1ABrave hero Siegfried"; + mes "Vanquished a mighty dragon"; mes "Its blood coated his skin"; mes "Making it impenetrable"; mes "Save for one tender spot"; diff --git a/npc/quests/newgears/2010_headgears.txt b/npc/quests/newgears/2010_headgears.txt index 660c82a87..bfdea103a 100644 --- a/npc/quests/newgears/2010_headgears.txt +++ b/npc/quests/newgears/2010_headgears.txt @@ -195,8 +195,8 @@ lhz_in02,276,281,1 script Drunken Man#Necktie 4_M_ALCHE_A,{ mes "[Drunken Man]"; mes "Once I wear the Necktie on my head,"; mes "I will be no match for you!"; - mes "You must be nervous¡¦"; - mes "Hmm¡¦ where is the Necktie?"; + mes "You must be nervous..."; + mes "Hmm... where is the Necktie?"; next; // If having the materials if ((countitem(Cobaltblue_Dyestuffs) > 0) && (countitem(Oil_Paper) > 29) && (countitem(Transparent_Cloth) > 99) && (countitem(Spool) > 19)) { @@ -310,7 +310,7 @@ comodo,236,164,0 script Hat Girl#Hair_Brush 1_F_04,{ mes "[Hat Girl]"; mes "Okay, I'll do it right away!"; next; - mes "Ch ch ch... combining...ch ch¡¦"; + mes "Ch ch ch... combining...ch ch..."; emotion e_swt2,1; next; mes "[Hat Girl]"; @@ -454,7 +454,7 @@ alberta,151,78,0 script Bebete#Baby_Angel_Status 4W_KID,{ mes "... ..."; next; mes "[" + strcharinfo(0) + "]"; - mes "Hmm... I guess I was fooled by that little kid."; + mes "Hmm... I guess I was fooled by that little kid."; close; } mes "[Bebete]"; @@ -943,7 +943,7 @@ alberta,120,206,3 script Alonie#Solo_Play_Box 4_M_UMKID,{ mes "For make it"; mes "the fruitful training,"; mes "Get around and kill"; - mes "^FF000020 Chung E and 50 Civil Servant^000000!"; + mes "^FF000020 Chung E and 50 Civil Servant^000000!"; next; if (select("What a bullshit!", "Let's go!") == 1) { mes "[Alonie]"; @@ -1033,7 +1033,7 @@ alberta,120,206,3 script Alonie#Solo_Play_Box 4_M_UMKID,{ mes "Hmm, It's not enough."; mes "Playing alone is not that easy!"; mes "Go and kill"; - mes "^FF000020 Chung E and 50 Civil Servant^000000!"; + mes "^FF000020 Chung E and 50 Civil Servant^000000!"; if (questprogress(1104,HUNTING) == 1) { erasequest 1104; setquest 1108; diff --git a/npc/quests/skills/assassin_skills.txt b/npc/quests/skills/assassin_skills.txt index 6f6a93488..c09660ed2 100644 --- a/npc/quests/skills/assassin_skills.txt +++ b/npc/quests/skills/assassin_skills.txt @@ -29,12 +29,6 @@ //= along with this program. If not, see <http://www.gnu.org/licenses/>. //========================================================================= //= Assassin Skills Quests -//================= File Encoding ========================================= -//= CP-949 (EUC-KR compatible). Do NOT read/save it as UTF-8. -//= -If the encoding is correct, the next three lines have the same length- -//= ============ ¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä ============ -//= ============ ============================================= ============ -//= ============ ¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á ============ //================= Description =========================================== //= Quests for skills: Venom Knife, Sonic Acceleration //================= Current Version ======================================= @@ -979,9 +973,7 @@ OnTouch: } } -// FIXME[Haru]: Why do we have a Korean name here? Can anyone translate it? -// Google translate says ¡¡ (jingjing) = Whining, but it doesn't make much sense to me. -moc_pryd04,85,96,0 script ¡¡#crypt FAKE_NPC,3,3,{ +moc_pryd04,85,96,0 script Glimmer#crypt FAKE_NPC,3,3,{ OnTouch: if (ASSN_SK == 4) { specialeffect EF_CONE; diff --git a/npc/re/cities/dicastes.txt b/npc/re/cities/dicastes.txt index f05d494f7..43571facb 100644 --- a/npc/re/cities/dicastes.txt +++ b/npc/re/cities/dicastes.txt @@ -53,11 +53,11 @@ dicastes01,194,159,5 script Excited Galten#a 4_MAN_GALTUN1,{ mes "will rule this land."; close; } - mes "¡ø¢²¢£ ¡Ð ¡ò¡ð¡ð"; - mes "¡÷¡ø¡ñ ¡ü ¡ü"; - mes "¡ù¢²¢³ ¢²"; - mes "¡ó¡õ¡ô ¢£ ¡Ð¡û¡ü ¡ò ¡ð¡ö¢£"; - mes "¢¤¡õ¡þ ¡÷ ¡ñ"; + mes sprintf("¡ø¢²¢£ ¡Ð ¡ò¡ð¡ð"); + mes sprintf("¡÷¡ø¡ñ ¡ü ¡ü"); + mes sprintf("¡ù¢²¢³ ¢²"); + mes sprintf("¡ó¡õ¡ô ¢£ ¡Ð¡û¡ü ¡ò ¡ð¡ö¢£"); + mes sprintf("¢¤¡õ¡þ ¡÷ ¡ñ"); close; } @@ -76,15 +76,15 @@ dicastes01,202,86,3 script Sentinel#a 4_MAN_GALTUN1,{ mes "Hey, you are an outsider!"; close; } - mes "¡ô¢±¢± ¡û ¡ó¡Ð¡ñ ¢£ ¢¤¡ú"; - mes "¡ø¡ó¢² ¢¤ "; - mes "¡õ¡ó¡Ð ¢³ ¡Ð¡õ¢£ ¡û ¡ú¡ï"; + mes sprintf("¡ô¢±¢± ¡û ¡ó¡Ð¡ñ ¢£ ¢¤¡ú"); + mes sprintf("¡ø¡ó¢² ¢¤ "); + mes sprintf("¡õ¡ó¡Ð ¢³ ¡Ð¡õ¢£ ¡û ¡ú¡ï"); next; mes "[Sentinel]"; - mes "¡ù"; + mes sprintf("¡ù"); next; mes "[Sentinel]"; - mes "¡ñ¡ö¡ï ¡ú ¡ó¢³¡ô"; + mes sprintf("¡ñ¡ö¡ï ¡ú ¡ó¢³¡ô"); close; } @@ -96,9 +96,9 @@ dicastes01,194,95,5 script Sentinel#b 4_MAN_GALTUN,{ mes "you won't know what hit you. Beware!"; close; } - mes "¡ø¡ô¡ü ¡ø ¡ó"; - mes "¡ø¡ï¡û ¡ó ¡û¢¤¢² ¡÷ ¢£"; - mes "¢¤¡ô¡ø ¢³ ¡÷¡û¡ö ¡õ ¡ø"; + mes sprintf("¡ø¡ô¡ü ¡ø ¡ó"); + mes sprintf("¡ø¡ï¡û ¡ó ¡û¢¤¢² ¡÷ ¢£"); + mes sprintf("¢¤¡ô¡ø ¢³ ¡÷¡û¡ö ¡õ ¡ø"); close; } @@ -109,8 +109,8 @@ dicastes01,234,158,0 script Training Galten#a 4_MAN_GALTUN,{ mes "if I keep up with my training every day."; close; } - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"; - mes "¡ô ¡ø"; + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"); + mes sprintf("¡ô ¡ø"); next; mes "Don't know what it means."; close; @@ -123,8 +123,8 @@ dicastes01,244,166,0 script Training Galten#b 4_MAN_GALTUN,{ mes "hard I am training."; close; } - mes "¡ø¡ô¡ü ¡ø"; - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"; + mes sprintf("¡ø¡ô¡ü ¡ø"); + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"); next; mes "Don't know what it means."; close; @@ -138,8 +138,8 @@ dicastes01,272,166,0 script Training Galten#c 4_MAN_GALTUN,{ mes "I am never lazy with my training."; close; } - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"; - mes "¡ø¡ô¡ü ¡ø"; + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"); + mes sprintf("¡ø¡ô¡ü ¡ø"); next; mes "Don't know what it means."; close; @@ -154,8 +154,8 @@ dicastes01,248,129,0 script Training Galten#d 4_MAN_GALTUN,{ mes "for trainees like me."; close; } - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü"; - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"; + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü"); + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü ¡ø"); next; mes "Don't know what it means."; close; @@ -169,8 +169,8 @@ dicastes01,271,152,0 script Training Galten#e 4_MAN_GALTUN,{ mes "if I do my best, right?"; close; } - mes "¡ø¢²¡û ¡ô ¢£¢³¡ô"; - mes "¡ü¡ô"; + mes sprintf("¡ø¢²¡û ¡ô ¢£¢³¡ô"); + mes sprintf("¡ü¡ô"); close; } */ @@ -182,9 +182,9 @@ dic_in01,349,282,4 script Waiting Galten#in_1 4_MAN_GALTUN1,{ mes "We are all tensed up to be ready for action."; close; } - mes "[¢²¡Ð¡û ¡ù ¡Ð]"; - mes "¡ñ¡õ¡ü ¢£ ¡ó"; - mes "¢¤¡ó¡õ ¢£ ¢£¡ò¡ô ¡ö ¡ú¢¤¡ú ¢¤ ¡ò¡ö¡õ ¢¤ "; + mes sprintf("[¢²¡Ð¡û ¡ù ¡Ð]"); + mes sprintf("¡ñ¡õ¡ü ¢£ ¡ó"); + mes sprintf("¢¤¡ó¡õ ¢£ ¢£¡ò¡ô ¡ö ¡ú¢¤¡ú ¢¤ ¡ò¡ö¡õ ¢¤ "); close; } @@ -194,8 +194,8 @@ dic_in01,370,261,1 script Waiting Galten#in_2 4_MAN_GALTUN1,{ mes "Boring."; close; } - mes "[¢²¡Ð¡û ¡ù ¡Ð]"; - mes "¡ù¢¤¢±"; + mes sprintf("[¢²¡Ð¡û ¡ù ¡Ð]"); + mes sprintf("¡ù¢¤¢±"); close; } @@ -205,8 +205,8 @@ dic_in01,381,261,1 script Waiting Galten#in_3 4_MAN_GALTUN1,{ mes "Zzzzz..."; close; } - mes "[¢²¡Ð¡û ¡ù ¡Ð]"; - mes "¡ú¡ô"; + mes sprintf("[¢²¡Ð¡û ¡ù ¡Ð]"); + mes sprintf("¡ú¡ô"); close; } @@ -216,8 +216,8 @@ dic_in01,370,282,4 script Waiting Galten#in_4 4_MAN_GALTUN1,{ mes "El Dicastes is the most peaceful place in this world as long as I am here."; close; } - mes "[¢²¡Ð¡û ¡ù ¡Ð]"; - mes "¡ï¡ï¢³ ¡þ ¡ö¢³¢£ ¢± ¢³¡û¡õ ¡ø ¡þ¡ï¡ï ¡ø ¡û"; + mes sprintf("[¢²¡Ð¡û ¡ù ¡Ð]"); + mes sprintf("¡ï¡ï¢³ ¡þ ¡ö¢³¢£ ¢± ¢³¡û¡õ ¡ø ¡þ¡ï¡ï ¡ø ¡û"); close; } @@ -227,8 +227,8 @@ dic_in01,354,219,4 script Resting Galten#in_5 4_MAN_GALTUN1,{ mes "Resting is always so sweet."; close; } - mes "[¡õ¡ø¡ò ¡ü ¢¤]"; - mes "¡ï¡õ¡ù ¡ö ¡ò¡ð¢² ¢³ ¡ö"; + mes sprintf("[¡õ¡ø¡ò ¡ü ¢¤]"); + mes sprintf("¡ï¡õ¡ù ¡ö ¡ò¡ð¢² ¢³ ¡ö"); close; } @@ -241,9 +241,9 @@ dic_in01,365,197,1 script Resting Galten#in_6 4_MAN_GALTUN1,{ mes "You say I don't look like I'm resting? But I'm already used to this."; close; } - mes "[¡õ¡ø¡ò ¡ü ¢¤]"; - mes "¡ô¡ï¢¤ ¡ö ¡ù¡ð¡ñ ¡ü ¡ó¡û¡û"; - mes "¡ï¢£¡ó ¡ù ¢³¡ô¡ð ¢£ ¡Ð¡û¡ô ¡ô ¡Ð¡ú¡ù ¡ô ¡ó"; + mes sprintf("[¡õ¡ø¡ò ¡ü ¢¤]"); + mes sprintf("¡ô¡ï¢¤ ¡ö ¡ù¡ð¡ñ ¡ü ¡ó¡û¡û"); + mes sprintf("¡ï¢£¡ó ¡ù ¢³¡ô¡ð ¢£ ¡Ð¡û¡ô ¡ô ¡Ð¡ú¡ù ¡ô ¡ó"); close; } @@ -257,8 +257,8 @@ dic_in01,29,119,4 script Resting Piom#04 4_MAN_PIOM6,{ mes "Why is it so noisy when I'm trying to get rest?"; close; } - mes "[¢£¡ù¡ò ¢¤ ¡ù]"; - mes "¡ü¢²¡ð ¡Ð ¡ò¡ø¢² ¡ô ¢²¡õ"; + mes sprintf("[¢£¡ù¡ò ¢¤ ¡ù]"); + mes sprintf("¡ü¢²¡ð ¡Ð ¡ò¡ø¢² ¡ô ¢²¡õ"); close; } @@ -289,8 +289,8 @@ dic_in01,91,113,5 script Suspicious Piom#a 4_MAN_PIOM6,{ mes "I am not going to say anything, either!"; close; } - mes "¡ó¢³¡ó ¡ó ¡ó¡þ¡ö"; - mes "¡õ ¢³¢²¡÷ ¡ó¡ó"; + mes sprintf("¡ó¢³¡ó ¡ó ¡ó¡þ¡ö"); + mes sprintf("¡õ ¢³¢²¡÷ ¡ó¡ó"); next; if(select("Can't tell what it means", "Is it a curse??") == 2) { mes "[Suspicious Piom]"; @@ -312,10 +312,10 @@ dic_in01,168,116,5 script Tired Piom#c 4_MAN_PIOM5,{ mes "But of course you'll have to pay the price."; close; } - mes "¡þ¡õ¡ð ¢³ ¢³¡þ"; - mes "¡þ¡ø¡ð ¡ö ¡ñ¡ú¡ð ¡ò"; - mes "¡ï¡ñ¡ú ¡ô ¡ö¡ö¡ò ¡û ¡ó¢¤¡ø ¡ø ¢² ¡ø"; - mes "¢¤¢²¡ø ¡ò ¡ú¡ó¢±"; + mes sprintf("¡þ¡õ¡ð ¢³ ¢³¡þ"); + mes sprintf("¡þ¡ø¡ð ¡ö ¡ñ¡ú¡ð ¡ò"); + mes sprintf("¡ï¡ñ¡ú ¡ô ¡ö¡ö¡ò ¡û ¡ó¢¤¡ø ¡ø ¢² ¡ø"); + mes sprintf("¢¤¢²¡ø ¡ò ¡ú¡ó¢±"); close; } @@ -329,10 +329,10 @@ dic_in01,149,104,5 script Tired Piom#b 4_MAN_PIOM2,{ emotion e_what; close; } - mes "¡ð¡Ð¡ú ¡ø ¢²"; - mes "¡ö¡õ¡ó ¢¤ ¡ò¡ò¢³ ¡ô ¡ô¡ó¡ñ"; - mes "¢£¡ñ¡þ ¡ü ¢²¡û¡ó ¡ò ¡ð¡þ"; - mes "¡ö¡ú¡ñ ¢³"; + mes sprintf("¡ð¡Ð¡ú ¡ø ¢²"); + mes sprintf("¡ö¡õ¡ó ¢¤ ¡ò¡ò¢³ ¡ô ¡ô¡ó¡ñ"); + mes sprintf("¢£¡ñ¡þ ¡ü ¢²¡û¡ó ¡ò ¡ð¡þ"); + mes sprintf("¡ö¡ú¡ñ ¢³"); emotion e_what; close; } @@ -354,17 +354,17 @@ dic_in01,341,113,3 script Tired Piom#a 4_MAN_PIOM5,{ mes "I'll be rejected again, right?"; close; } - mes "¡÷¡ò¡û ¡ó ¡ó¡Ð¢±"; - mes "¡ó¡õ¡ù ¡þ ¡ò¢±¡ñ ¡õ ¢£"; - mes "¡ü¡ð¢¤ ¡ù ¡ò¡ô¡õ ¡ò ¡ñ"; - mes "¢³¡ú¢³ ¡Ð ¡ñ¡õ¡ù ¡÷ ¡÷¢±"; + mes sprintf("¡÷¡ò¡û ¡ó ¡ó¡Ð¢±"); + mes sprintf("¡ó¡õ¡ù ¡þ ¡ò¢±¡ñ ¡õ ¢£"); + mes sprintf("¡ü¡ð¢¤ ¡ù ¡ò¡ô¡õ ¡ò ¡ñ"); + mes sprintf("¢³¡ú¢³ ¡Ð ¡ñ¡õ¡ù ¡÷ ¡÷¢±"); next; mes "[Tired Piom]"; - mes "¡þ"; + mes sprintf("¡þ"); next; emotion e_swt; mes "[Tired Piom]"; - mes "¡ø¡ú¡ø ¢± ¡ö¡ò"; + mes sprintf("¡ø¡ú¡ø ¢± ¡ö¡ò"); close; } @@ -391,9 +391,9 @@ dic_in01,32,54,5 script Venknick#el_01 4_MAN_BENKUNI,{ mes "The refined Bradium was the best ever. Do you want to try some?"; close; } - mes "[¡ó¡ò¡ð]"; - mes "¡ù¡ó¢¤ ¢± ¢£"; - mes "¡õ¡þ¡ï ¢£ ¡÷¡÷¢¤ ¡ú ¡ó¡ñ¡ö ¢² ¡þ¢²¢¤ ¢² ¢£?"; + mes sprintf("[¡ó¡ò¡ð]"); + mes sprintf("¡ù¡ó¢¤ ¢± ¢£"); + mes sprintf("¡õ¡þ¡ï ¢£ ¡÷¡÷¢¤ ¡ú ¡ó¡ñ¡ö ¢² ¡þ¢²¢¤ ¢² ¢£?"); close; } @@ -413,17 +413,17 @@ dic_in01,372,116,3 script Thrilled Piom#a 4_MAN_PIOM4,{ mes "blessing?"; close; } - mes "¡ò¡õ¢³ ¡õ ¡ô"; - mes "¢£¡ó¡ø ¢² ¡ô¡÷"; - mes "¡ò¡ô¢³ ¡ù ¢±¡ó¢± ¡õ"; - mes "¡ó¡ü¡Ð ¡ø ¢²¡ü¡Ð ¡õ ¡ï"; + mes sprintf("¡ò¡õ¢³ ¡õ ¡ô"); + mes sprintf("¢£¡ó¡ø ¢² ¡ô¡÷"); + mes sprintf("¡ò¡ô¢³ ¡ù ¢±¡ó¢± ¡õ"); + mes sprintf("¡ó¡ü¡Ð ¡ø ¢²¡ü¡Ð ¡õ ¡ï"); next; mes "[Thrilled Piom]"; - mes "¢£"; + mes sprintf("¢£"); next; mes "[Thrilled Piom]"; - mes "¡Ð¢¤¡ù ¢£ ¡ó¡ó"; - mes "¡ù¡ó¡÷ ¡û ¡þ¡ô"; + mes sprintf("¡Ð¢¤¡ù ¢£ ¡ó¡ó"); + mes sprintf("¡ù¡ó¡÷ ¡û ¡þ¡ô"); close; } @@ -435,9 +435,9 @@ dic_in01,360,125,5 script Serious Venknicka 4_MAN_BENKUNI,{ mes "I will have to get more factory lines running."; close; } - mes "¡û¡õ¡ñ ¢² ¢²¢¤¡Ð ¢² ¡ü¡ñ¡õ"; - mes "¡þ¡ó¡ö ¢²"; - mes "¡ö¡÷¡û ¡ú ¡÷¡Ð¢³ ¢³"; + mes sprintf("¡û¡õ¡ñ ¢² ¢²¢¤¡Ð ¢² ¡ü¡ñ¡õ"); + mes sprintf("¡þ¡ó¡ö ¢²"); + mes sprintf("¡ö¡÷¡û ¡ú ¡÷¡Ð¢³ ¢³"); close; } @@ -467,24 +467,24 @@ dic_in01,42,250,5 script Guide#diel_1 4_MAN_PIOM6,{ mes "- The guide looks at you with an alert expression. -"; close; } - mes "[¢³¡ñ]"; - mes "¡õ¢£¡ó ¡Ð ¡õ¡ñ¡ò ¢¤ ¡ø¡ø¢£ ¢± ¢²¢³¡÷ ¢±"; - mes "¡ö¡ò¡ð ¡ó ¡ô¡ô?"; + mes sprintf("[¢³¡ñ]"); + mes sprintf("¡õ¢£¡ó ¡Ð ¡õ¡ñ¡ò ¢¤ ¡ø¡ø¢£ ¢± ¢²¢³¡÷ ¢±"); + mes sprintf("¡ö¡ò¡ð ¡ó ¡ô¡ô?"); next; - mes "[¢³¡ñ]"; - mes "¡Ð¡ù¡ó ¡ù ¡ü¢²¡Ð ¢± ¡÷¡ö¡þ"; - mes "¡ñ¡þ¢² ¡ø ¡ó¡ï¡ï ¡ù ¡ð¡ñ¡Ð ¡ù ¢³¡ò¡þ ¡ù ¡ø¡ð¡õ ¡õ ¢¤"; + mes sprintf("[¢³¡ñ]"); + mes sprintf("¡Ð¡ù¡ó ¡ù ¡ü¢²¡Ð ¢± ¡÷¡ö¡þ"); + mes sprintf("¡ñ¡þ¢² ¡ø ¡ó¡ï¡ï ¡ù ¡ð¡ñ¡Ð ¡ù ¢³¡ò¡þ ¡ù ¡ø¡ð¡õ ¡õ ¢¤"); next; - mes "[¢³¡ñ]"; - mes "¡û¡ù¡ô ¡ø ¡ð¡þ¡÷ ¢³ ¡þ¡ù¡ñ ¡ú ¡ü¢¤¡ò ¡ú ¡ô¢£"; - mes "¡÷¡ò¢¤ ¡ø ¡û¢³"; + mes sprintf("[¢³¡ñ]"); + mes sprintf("¡û¡ù¡ô ¡ø ¡ð¡þ¡÷ ¢³ ¡þ¡ù¡ñ ¡ú ¡ü¢¤¡ò ¡ú ¡ô¢£"); + mes sprintf("¡÷¡ò¢¤ ¡ø ¡û¢³"); next; - mes "[¢³¡ñ]"; - mes "¡ô¡ð¡ñ ¢¤ ¡ó¡÷¢³ ¡þ ¡ó¡õ¡÷ ¡ö ¡ó ¡ö"; + mes sprintf("[¢³¡ñ]"); + mes sprintf("¡ô¡ð¡ñ ¢¤ ¡ó¡÷¢³ ¡þ ¡ó¡õ¡÷ ¡ö ¡ó ¡ö"); next; - mes "[¢³¡ñ]"; - mes "¡ò¡ô¡ø ¡÷ ¡õ¡ø¡ð ¡ó ¢¤¡Ð¡ô ¡ø ¡ñ¡ñ¡ñ ¡ø ¡ú¡ö¡ø ¡ü"; - mes "¡ï¢³¡ð ¢¤ ¡ð¡ö¢£ ¢± ¡ô¡ø"; + mes sprintf("[¢³¡ñ]"); + mes sprintf("¡ò¡ô¡ø ¡÷ ¡õ¡ø¡ð ¡ó ¢¤¡Ð¡ô ¡ø ¡ñ¡ñ¡ñ ¡ø ¡ú¡ö¡ø ¡ü"); + mes sprintf("¡ï¢³¡ð ¢¤ ¡ð¡ö¢£ ¢± ¡ô¡ø"); close; } @@ -499,12 +499,12 @@ dic_in01,335,34,5 script Talkative Piom#a 4_MAN_PIOM4,{ mes "here too."; close; } - mes "¡ü¡ù¢± ¢³"; - mes "¡÷¡ø¡ï ¡þ ¡ó¡ó"; - mes "¡ñ¡õ¡ò ¡ó ¡÷¡ü¡ù ¡ö"; - mes "¡ñ¡ø¡ü ¡ú ¡ô"; - mes "¡þ¡ú¡ò ¢± ¡û¡ò¡ò ¡ù ¡÷"; - mes "¢³¡ò¡ò ¡ù ¢±¢£¡ò"; + mes sprintf("¡ü¡ù¢± ¢³"); + mes sprintf("¡÷¡ø¡ï ¡þ ¡ó¡ó"); + mes sprintf("¡ñ¡õ¡ò ¡ó ¡÷¡ü¡ù ¡ö"); + mes sprintf("¡ñ¡ø¡ü ¡ú ¡ô"); + mes sprintf("¡þ¡ú¡ò ¢± ¡û¡ò¡ò ¡ù ¡÷"); + mes sprintf("¢³¡ò¡ò ¡ù ¢±¢£¡ò"); close; } @@ -515,8 +515,8 @@ dic_in01,387,30,1 script Manuk Piom#a 4_MAN_PIOM,{ mes "I've come to pick up the weapon I ordered."; close; } - mes "¡ü¡ó¡þ ¡ó ¡ï¡ð¢¤ ¡ü ¡ð¢±"; - mes "¡ù¡ô¡ï ¡ú ¡ñ¡ù¢³ ¡ó ¡ò¡ö¡ó ¡ô¡ô"; + mes sprintf("¡ü¡ó¡þ ¡ó ¡ï¡ð¢¤ ¡ü ¡ð¢±"); + mes sprintf("¡ù¡ô¡ï ¡ú ¡ñ¡ù¢³ ¡ó ¡ò¡ö¡ó ¡ô¡ô"); close; } @@ -530,11 +530,11 @@ dicastes01,282,210,4 script Free Knit#a 4_MAN_NITT,{ mes "which is short."; close; } - mes "¡ñ¡þ¡ð ¡ó ¡ü¡ò¡ö ¡÷"; - mes "¢³¡ð¡ï ¢£ ¡ù¡ô¡ò ¡ô ¡ó¡þ¡ñ ¢² ¡ñ¡û¢£ ¢²"; - mes "¡ô¡ó¡ð ¡þ ¢£¡ð¢¤ ¡õ ¡û¢³¡ü"; - mes "¡ó¢³¡ò ¢± ¡ô¢£¢² ¡÷ ¡÷¡ñ"; - mes "¡ò¢²¡ï ¢£ ¡ö¡ö"; + mes sprintf("¡ñ¡þ¡ð ¡ó ¡ü¡ò¡ö ¡÷"); + mes sprintf("¢³¡ð¡ï ¢£ ¡ù¡ô¡ò ¡ô ¡ó¡þ¡ñ ¢² ¡ñ¡û¢£ ¢²"); + mes sprintf("¡ô¡ó¡ð ¡þ ¢£¡ð¢¤ ¡õ ¡û¢³¡ü"); + mes sprintf("¡ó¢³¡ò ¢± ¡ô¢£¢² ¡÷ ¡÷¡ñ"); + mes sprintf("¡ò¢²¡ï ¢£ ¡ö¡ö"); close; } @@ -554,17 +554,17 @@ dicastes01,246,210,3 script Free Venknick#a 4_MAN_BENKUNI,{ mes "but why are you interested in it?"; close; } - mes "¡ô¡ï¢£ ¢¤ ¡÷¡õ¢± ¡ü ¡ñ¡õ"; - mes "¡ü¢³"; - mes "¡ö¡ù¢¤ ¢² ¡ù¡ó¡ô"; - mes "¡ü¢£¢³ ¡ø ¡û¡ð¡ü ¡õ"; + mes sprintf("¡ô¡ï¢£ ¢¤ ¡÷¡õ¢± ¡ü ¡ñ¡õ"); + mes sprintf("¡ü¢³"); + mes sprintf("¡ö¡ù¢¤ ¢² ¡ù¡ó¡ô"); + mes sprintf("¡ü¢£¢³ ¡ø ¡û¡ð¡ü ¡õ"); next; mes "[Free Venknick]"; - mes "¡ù"; + mes sprintf("¡ù"); next; mes "[Free Venknick]"; - mes "¡þ¢¤¢£ ¢± ¡ó¡ò¢³ ¡ü ¡ñ¡ð"; - mes "¢±¡û¢£ ¡ö ¡ü¡ò¡÷ ¡û ¡õ¡ò¡÷ ¢²¢²"; + mes sprintf("¡þ¢¤¢£ ¢± ¡ó¡ò¢³ ¡ü ¡ñ¡ð"); + mes sprintf("¢±¡û¢£ ¡ö ¡ü¡ò¡÷ ¡û ¡õ¡ò¡÷ ¢²¢²"); close; } @@ -577,9 +577,9 @@ dicastes01,235,245,4 script Excited Piom#a 4_MAN_PIOM4,{ close; } mes "[Excited Piom]"; - mes "¡ú¡þ¡ó ¢³ ¡ü¢²¡ñ ¢±"; + mes sprintf("¡ú¡þ¡ó ¢³ ¡ü¢²¡ñ ¢±"); emotion e_ho; - mes "¢³¡ó¡ñ ¡õ ¡ð¡ô¡þ ¡÷ ¡ú¡ò¡õ ¡ø ¢² ¡ø"; + mes sprintf("¢³¡ó¡ñ ¡õ ¡ð¡ô¡þ ¡÷ ¡ú¡ò¡õ ¡ø ¢² ¡ø"); close; } @@ -593,11 +593,11 @@ dicastes01,284,262,3 script Favorable Knit#a 4_MAN_NITT,{ mes "We never have any quarrels between classes."; close; } - mes "¡ô¢±¡ó ¡õ ¡ú¡÷¡Ð ¡õ"; - mes "¡ü¡ï¡Ð ¡õ ¡ô¡ó¡ü ¡ó ¢³"; - mes "¡ñ¡ô¡ü ¡þ ¢¤¡ñ¢¤ ¡ô ¡û¡ï¡ù"; - mes "¡ú¡ö¡ô ¡ó ¢£¡ú¡þ ¡ø ¡ø¡ò"; - mes "¢²¢³¡û ¢¤ ¡ú¡ñ¡ù ¡û ¢³¡ò¡ø ¡õ¡õ"; + mes sprintf("¡ô¢±¡ó ¡õ ¡ú¡÷¡Ð ¡õ"); + mes sprintf("¡ü¡ï¡Ð ¡õ ¡ô¡ó¡ü ¡ó ¢³"); + mes sprintf("¡ñ¡ô¡ü ¡þ ¢¤¡ñ¢¤ ¡ô ¡û¡ï¡ù"); + mes sprintf("¡ú¡ö¡ô ¡ó ¢£¡ú¡þ ¡ø ¡ø¡ò"); + mes sprintf("¢²¢³¡û ¢¤ ¡ú¡ñ¡ù ¡û ¢³¡ò¡ø ¡õ¡õ"); close; } @@ -612,11 +612,11 @@ dicastes01,164,180,4 script Limpy Piom#a 4_MAN_PIOM6,{ emotion e_dots; close; } - mes "¢²¡ô¡þ ¡ù ¡õ¡Ð"; - mes "¢³¡ô¡û ¡ú ¡ø"; - mes "¢³¡þ¢¤ ¡ó ¡õ¡÷¡Ð"; - mes "¡ñ¡ò¡ü ¡ü ¡ù¡þ¢±"; - mes "¢¤¡ò¡þ ¢¤ ¢£¡ñ ¢¤ ¢£¡ñ"; + mes sprintf("¢²¡ô¡þ ¡ù ¡õ¡Ð"); + mes sprintf("¢³¡ô¡û ¡ú ¡ø"); + mes sprintf("¢³¡þ¢¤ ¡ó ¡õ¡÷¡Ð"); + mes sprintf("¡ñ¡ò¡ü ¡ü ¡ù¡þ¢±"); + mes sprintf("¢¤¡ò¡þ ¢¤ ¢£¡ñ ¢¤ ¢£¡ñ"); emotion e_dots; close; } @@ -649,13 +649,13 @@ dicastes01,191,202,4 script Complaining Galten#fihs 4_MAN_GALTUN,{ mes "Just forget about it quickly for your own good."; close; } - mes "[¡õ¢£¡ö ¡ú ]"; - mes "¡õ¡ò¡û ¡ò ¢£¡û¡÷ ¡÷ "; - mes "¡û¡ù¡û ¡÷ ¡ü¡þ¡û ¢³ ¡ó"; + mes sprintf("[¡õ¢£¡ö ¡ú ]"); + mes sprintf("¡õ¡ò¡û ¡ò ¢£¡û¡÷ ¡÷ "); + mes sprintf("¡û¡ù¡û ¡÷ ¡ü¡þ¡û ¢³ ¡ó"); next; - mes "[¡õ¢£¡ö ¡ú ]"; - mes "¡ð¢±¡ü ¡û ¡õ¡÷¢¤"; - mes "¢¤¡þ¡ø ¢² ¡÷"; + mes sprintf("[¡õ¢£¡ö ¡ú ]"); + mes sprintf("¡ð¢±¡ü ¡û ¡õ¡÷¢¤"); + mes sprintf("¢¤¡þ¡ø ¢² ¡÷"); next; mes "Don't know what it means."; close; @@ -702,9 +702,9 @@ dicastes01,202,197,4 script Crazy Venknick#fihsing1 4_MAN_BENKUNI,{ mes "You feel outraged at being tricked."; close; } - mes "[¡ö¡ú¡ù ¢³ ]"; - mes "¢²¡û¡ó ¡ó ¡ù¢¤¡ø"; - mes "¢¤¡ð¢² ¢± ¡ñ¡ö¢² ¡ø ¡ï¡ö¡ü"; + mes sprintf("[¡ö¡ú¡ù ¢³ ]"); + mes sprintf("¢²¡û¡ó ¡ó ¡ù¢¤¡ø"); + mes sprintf("¢¤¡ð¢² ¢± ¡ñ¡ö¢² ¡ø ¡ï¡ö¡ü"); next; mes "Don't know what it means."; close; @@ -719,9 +719,9 @@ dic_in01,98,110,5 script Worried Piom#a 4_MAN_PIOM6,{ close; } mes "[Worried Piom]"; - mes "¡û¢±¡÷ ¢² ¡ï¡þ¡ò ¡ü ¡ï¡û¢²"; - mes "¡ï¡÷¢¤ ¡Ð ¡ï¡ï¡Ð ¢¤ ¢£"; - mes "¡÷¡þ¡ð ¡ó ¡ñ"; + mes sprintf("¡û¢±¡÷ ¢² ¡ï¡þ¡ò ¡ü ¡ï¡û¢²"); + mes sprintf("¡ï¡÷¢¤ ¡Ð ¡ï¡ï¡Ð ¢¤ ¢£"); + mes sprintf("¡÷¡þ¡ð ¡ó ¡ñ"); close; } @@ -734,8 +734,8 @@ dic_in01,98,96,3 script Lost Galten#a 4_MAN_GALTUN1,{ close; } mes "[Lost Galten]"; - mes "¡ó¡ô¡ï ¡û ¢³¡ú"; - mes "¡ü¡ø¡ñ ¢£ "; - mes "¡ö¡ï¢² ¡û ¡ö¡ó"; + mes sprintf("¡ó¡ô¡ï ¡û ¢³¡ú"); + mes sprintf("¡ü¡ø¡ñ ¢£ "); + mes sprintf("¡ö¡ï¢² ¡û ¡ö¡ó"); close; } diff --git a/npc/re/events/halloween_2013.txt b/npc/re/events/halloween_2013.txt index 3d72fc6b0..92050128a 100644 --- a/npc/re/events/halloween_2013.txt +++ b/npc/re/events/halloween_2013.txt @@ -472,7 +472,7 @@ niflheim,179,168,5 script Kentucky#2013HE 4_NFCOCK,{ close; } -niflheim,177,166,8 script Chicken#2013HE 4_NFCOCK,{ +niflheim,177,166,0 script Chicken#2013HE 4_NFCOCK,{ mes "[Chicken]"; mes "Hey Kentucky!!"; mes "You are eating alone too much!"; diff --git a/npc/re/events/halloween_2014.txt b/npc/re/events/halloween_2014.txt index 65afecedc..c0677b2ef 100644 --- a/npc/re/events/halloween_2014.txt +++ b/npc/re/events/halloween_2014.txt @@ -29,12 +29,6 @@ //= along with this program. If not, see <http://www.gnu.org/licenses/>. //========================================================================= //= Halloween Event (2014) -//================= File Encoding ========================================= -//= CP-949 (EUC-KR compatible). Do NOT read/save it as UTF-8. -//= -If the encoding is correct, the next three lines have the same length- -//= ============ ¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä ============ -//= ============ ============================================= ============ -//= ============ ¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á ============ //================= Description =========================================== //= The Official 2014 Halloween Event //= @@ -692,7 +686,7 @@ niflheim,196,185,3 script Bolak#14hal 4_M_DRAKE,{ mes "You could be a 'fake'!"; next; mes "[Nathan]"; - mes "Da...d¡¦?"; + mes "Da...d...?"; next; mes "[Bolak]"; mes "Nathan!! Even you doubt your own father?"; diff --git a/npc/re/instances/WolfchevLaboratory.txt b/npc/re/instances/WolfchevLaboratory.txt index 3b0b1c510..3860b35a3 100644 --- a/npc/re/instances/WolfchevLaboratory.txt +++ b/npc/re/instances/WolfchevLaboratory.txt @@ -27,12 +27,6 @@ //= along with this program. If not, see <http://www.gnu.org/licenses/>. //========================================================================= //= Wolfchev's Laboratory -//================= File Encoding ========================================= -//= CP-949 (EUC-KR compatible). Do NOT read/save it as UTF-8. -//= -If the encoding is correct, the next three lines have the same length- -//= ============ ¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä¡Ä ============ -//= ============ ============================================= ============ -//= ============ ¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á¡Á ============ //================= Description =========================================== //= Defeat Wolfchev's human experimentations. //================= Current Version ======================================= @@ -592,8 +586,7 @@ lighthalzen,342,291,4 script Weird old man#Bio4Reward 4_M_EINOLD,{ break; case 4: mes "<<Ygnus Stale[1]>>"; - // FIXME[Haru]: Anyone knows what ¹ßÈ means? - mes "When doing short distance attack, cast ¹ßÈ to the player and to the enemy with a certain chance."; + mes "When doing short distance attack, Chance of inflicting o rreceiving Burn status when dealing physical damage."; mes "Two-Handed Axe / ATK 250 / Weight 190 / Fire Property / Weapon Lv 4 / Required Lv 95 / Socket 1 / for High Swordman/Merchant Classes"; callsub L_Reward, Ygnus_Stale, 50, 100, 35; break; @@ -2803,7 +2796,7 @@ lhz_dun04,147,279,0 script Laboratory Entrance#memo CLEAR_NPC,{ //== The Lab No.3 >> Boss's Room Warp portal =============== 1@lhz,83,62,0 script #potal_03 WARPNPC,2,2,{ - end; + end; OnInstanceInit: disablenpc instance_npcname("#potal_03"); @@ -2990,9 +2983,9 @@ lhz_dun04,147,279,0 script Laboratory Entrance#memo CLEAR_NPC,{ //== Bosses ================================================ - script bio4FBoss FAKE_NPC,{ - end; + end; - OnEnable: +OnEnable: .@map$ = instance_mapname("1@lhz"); .@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead"; specialeffect EF_SUI_EXPLOSION; @@ -3038,7 +3031,7 @@ lhz_dun04,147,279,0 script Laboratory Entrance#memo CLEAR_NPC,{ disablenpc instance_npcname(strnpcinfo(0)); end; - OnDisable: +OnDisable: killmonster instance_mapname("1@lhz"),instance_npcname(strnpcinfo(0))+"::OnMyMobDead"; disablenpc instance_npcname(strnpcinfo(0)); end; diff --git a/npc/re/jobs/novice/academy.txt b/npc/re/jobs/novice/academy.txt index 949e6973d..4b970a86c 100644 --- a/npc/re/jobs/novice/academy.txt +++ b/npc/re/jobs/novice/academy.txt @@ -2839,7 +2839,7 @@ iz_ac01,134,47,5 script Trainer Mainz#ac 4_M_KY_KNT,4,4,{ mes "Please keep in mind that I really wanted to have it but since you look exhausted I offered it to you first!"; emotion e_no1; next; - mes "- You open the lunchbox and there is some type of food inside ¡©"; + mes "- You open the lunchbox and there is some type of food inside -"; next; mes "[Mainz]"; mes "Wahahahat! Don't hesitate and just take it!"; @@ -10875,7 +10875,7 @@ iz_ac02,49,134,5 script Vicente#ac 4_M_HUMAN_02,{ case 2: mes "[Vicente]"; mes "Correct!"; - mes "You have a good memory£¡"; + mes "You have a good memory!"; cutin "sc_vicente03.bmp", 2; next; break; @@ -10941,7 +10941,7 @@ iz_ac02,49,134,5 script Vicente#ac 4_M_HUMAN_02,{ case 2: mes "[Vicente]"; mes "Correct!"; - mes "You have a good memory£¡"; + mes "You have a good memory!"; cutin "sc_vicente03.bmp", 2; next; break; @@ -13297,7 +13297,7 @@ izlude,155,132,3 script Locas#iz 4_M_02,{ switch(select("refining price", "refining effect", "Finish the explanation.")) { case 1: mes "[Locas]"; - mes "©öFrom the word itself, refining price is ^3E86C3 the price for refining once^000000."; + mes "From the word itself, refining price is ^3E86C3 the price for refining once^000000."; next; mes "[Locas]"; mes "But, there are differences in the essential material according the (zeny) and weapon level."; diff --git a/npc/re/merchants/ninja_craftsman.txt b/npc/re/merchants/ninja_craftsman.txt index a78491f65..4a3744269 100644 --- a/npc/re/merchants/ninja_craftsman.txt +++ b/npc/re/merchants/ninja_craftsman.txt @@ -87,7 +87,7 @@ L_Menu: mes "[Gyo]"; mes "To make a ^ff0000"+getitemname(.@item_make)+", "+callsub(L_Ingredients,.@item_make)+".^000000"; if (.@item_make==Wolf_Armguard) - mes "Can you feel it? The throbbing of the wolf blood¡¦"; + mes "Can you feel it? The throbbing of the wolf blood..."; else if (.@item_make==Crescent_Armguard) mes "A crescent as beautiful and clear as a crystal will be engraved on it."; else if (.@item_make==Ninja_Scale_Armor) @@ -104,38 +104,38 @@ L_Menu: } else if (.@item_make == Crescent_Armguard){ mes "Decreases post skill delay for 2% for every enhancement."; - mes "Shield Type, Defense 70, Slot 1"; - mes "Required Level 100, Ninja Type Only"; + mes "Shield Type, Defense 70, Slot 1"; + mes "Required Level 100, Ninja Type Only"; } else if (.@item_make == Ninja_Scale_Armor){ - mes "MHP+15%, MSP-30%."; - mes "Armor Type, Defense 90, Slot 1"; - mes "Required Level 100, Ninja Type Only"; + mes "MHP+15%, MSP-30%."; + mes "Armor Type, Defense 90, Slot 1"; + mes "Required Level 100, Ninja Type Only"; } else if (.@item_make == Tenebris_Latitantes){ mes "Chance to activate Lvl. 1 Illusion - Shadow when attacked by melee attacks."; - mes "Armor Type, Defense 60, Slot 1"; - mes "Required Level 100, Ninja Type Only"; + mes "Armor Type, Defense 60, Slot 1"; + mes "Required Level 100, Ninja Type Only"; } break; case 3: mes "[Gyo]"; - mes "Make sure that ^ff0000you have the correct ingredients and equipment at hand.^000000"; - mes "No use crying over it later."; - next; - if (select("Combine.", "Quit.") == 2) { + mes "Make sure that ^ff0000you have the correct ingredients and equipment at hand.^000000"; + mes "No use crying over it later."; + next; + if (select("Combine.", "Quit.") == 2) { mes "[Gyo]"; mes "Looks like you need more time to decide."; close; } - if (checkweight(Knife,1) == 0 || (MaxWeight - Weight) < 2000) { + if (checkweight(Knife,1) == 0 || (MaxWeight - Weight) < 2000) { mes "- Hold on!! -"; mes "- You cannot receive items -"; mes "- because you carry too much. -"; mes "- Please try again -"; mes "- after lightening your burden. -"; close; - } + } mes "[Gyo]"; switch(.@item_make){ case 2172: //Wolf_Armguard @@ -144,7 +144,7 @@ L_Menu: delitem Wolf_Blood,10; //Wolf_Blood getitem Wolf_Armguard,1; //Wolf_Armguard mes "Can you feel the wolfish instinct?"; - mes "Wild, but beautiful¡¦"; + mes "Wild, but beautiful..."; } else { mes "You don't have enough ingredients."; @@ -272,82 +272,81 @@ L_Menu: mes "["+ getitemname(getarg(0)) +"]"; if (.@item_make == Raksasa_Dagger){ mes "INT+3 MATK+100."; - mes "Dagger Type, ATK 120, Slot 1"; - mes "Required Level 110, Ninja Type Only"; + mes "Dagger Type, ATK 120, Slot 1"; + mes "Required Level 110, Ninja Type Only"; } else if (.@item_make == Mikatsuki){ mes "MATK + 120, Fluctuated Casting and SP use decreased by 5% upon skill use."; - mes "Dagger Type, ATK 50, Weapon Lvl. 4"; - mes "Slot 1"; - mes "Required Level 100, Ninja Type Only"; + mes "Dagger Type, ATK 50, Weapon Lvl. 4"; + mes "Slot 1"; + mes "Required Level 100, Ninja Type Only"; } else if (.@item_make == Huuma_Swirling_Petal){ - mes "MATK + 50, Petal Shuriken skill damage increased by 20%."; - mes "Shuriken Type, ATK 150"; - mes "Weapon Lvl. 3, Slot 2"; - mes "Required Level 110, Ninja Type Only"; + mes "MATK + 50, Petal Shuriken skill damage increased by 20%."; + mes "Shuriken Type, ATK 150"; + mes "Weapon Lvl. 3, Slot 2"; + mes "Required Level 110, Ninja Type Only"; } break; case 3: mes "[Ki]"; - mes "Make sure that ^ff0000you have the correct ingredients and equipment at hand.^000000"; - mes "No use crying over it later."; - next; - if (select("Combine.", "Quit.") == 2) { + mes "Make sure that ^ff0000you have the correct ingredients and equipment at hand.^000000"; + mes "No use crying over it later."; + next; + if (select("Combine.", "Quit.") == 2) { mes "[Ki]"; mes "Think carefully~~"; close; } - if (checkweight(Knife,1) == 0 || (MaxWeight - Weight) < 2000) { + if (checkweight(Knife,1) == 0 || (MaxWeight - Weight) < 2000) { mes "- Hold on!! -"; mes "- You cannot receive items -"; mes "- because you carry too much. -"; mes "- Please try again -"; mes "- after lightening your burden. -"; close; - } + } mes "[Ki]"; switch(.@item_make){ case 13076: //Raksasa_Dagger - if (countitem(Murasame_) && countitem(Dark_Red_Jewel)) { - delitem Murasame_,1; //Murasame_ - delitem Dark_Red_Jewel,1; //Dark_Red_Jewel - getitem Raksasa_Dagger,1; //Raksasa_Dagger - mes "Oh yes..."; - mes "It is a beautiful glow..."; - } - else { - mes "Hmm... You do not have enough to make a Raksasa Dagger."; - mes "Why don't you check again?"; - mes "Some just can't give up what they hold."; - } + if (countitem(Murasame_) && countitem(Dark_Red_Jewel)) { + delitem Murasame_,1; //Murasame_ + delitem Dark_Red_Jewel,1; //Dark_Red_Jewel + getitem Raksasa_Dagger,1; //Raksasa_Dagger + mes "Oh yes..."; + mes "It is a beautiful glow..."; + } else { + mes "Hmm... You do not have enough to make a Raksasa Dagger."; + mes "Why don't you check again?"; + mes "Some just can't give up what they hold."; + } break; case 13078: //Mikatsuki - if (countitem(Hakujin_) && countitem(White_Jewel)) { - delitem Hakujin_,1; //Hakujin_ - delitem White_Jewel,1; //White_Jewel - getitem Mikatsuki,1; //Mikatsuki - mes "Splendid¡¦"; - mes "It is always mesmerizing to look upon such a beautiful weapon¡¦"; - } - else { - mes "Hmm... You do not have enough to make a Mikatsuki."; - mes "Why don't you check again?"; - mes "Some just can't give up what they hold."; - } - break; + if (countitem(Hakujin_) && countitem(White_Jewel)) { + delitem Hakujin_,1; //Hakujin_ + delitem White_Jewel,1; //White_Jewel + getitem Mikatsuki,1; //Mikatsuki + mes "Splendid..."; + mes "It is always mesmerizing to look upon such a beautiful weapon..."; + } + else { + mes "Hmm... You do not have enough to make a Mikatsuki."; + mes "Why don't you check again?"; + mes "Some just can't give up what they hold."; + } + break; case 13313: //Huuma_Swirling_Petal - if (countitem(Huuma_Calm_Mind) && countitem(Broken_Shuriken) > 99) { - delitem Huuma_Calm_Mind,1; //Huuma_Calm_Mind - delitem Broken_Shuriken,100; //Broken_Shuriken - getitem Huuma_Swirling_Petal,1; //Huuma_Swirling_Petal - mes "Swirling Petal!!"; - } - else { - mes "Hmm... You do not have enough to make Petal Shurikens."; - mes "Why don't you check again?"; - mes "Some just can't give up what they hold."; - } + if (countitem(Huuma_Calm_Mind) && countitem(Broken_Shuriken) > 99) { + delitem Huuma_Calm_Mind,1; //Huuma_Calm_Mind + delitem Broken_Shuriken,100; //Broken_Shuriken + getitem Huuma_Swirling_Petal,1; //Huuma_Swirling_Petal + mes "Swirling Petal!!"; + } + else { + mes "Hmm... You do not have enough to make Petal Shurikens."; + mes "Why don't you check again?"; + mes "Some just can't give up what they hold."; + } break; } close; diff --git a/npc/re/quests/eden/100-110.txt b/npc/re/quests/eden/100-110.txt index 0cbcb610b..2fa43097c 100644 --- a/npc/re/quests/eden/100-110.txt +++ b/npc/re/quests/eden/100-110.txt @@ -87,7 +87,7 @@ moc_para01,37,95,5 script Gelkah#1 4_F_GELKA,{ mes "That person standing next to me is my master... He came back after long journey of practice."; next; mes "[Gelkah]"; - mes "I understand you might wonder why a Sura wants an Archbishop as a teacher..."; + mes "I understand you might wonder why a Sura wants an Archbishop as a teacher..."; } else { cutin "gelca03",2; diff --git a/npc/re/quests/eden/111-120.txt b/npc/re/quests/eden/111-120.txt index 9f503666d..39b7de701 100644 --- a/npc/re/quests/eden/111-120.txt +++ b/npc/re/quests/eden/111-120.txt @@ -878,7 +878,7 @@ moc_para01,17,95,5 script Mingmin#1 4_F_GENETIC,{ case 3: mes "[Mingmin]"; if (questprogress(13098,PLAYTIME) == 1) - mes "They all look the same for me. I should research harder."; + mes "They all look the same for me. I should research harder."; else if (questprogress(13097,HUNTING) == 1) { cutin "º£³ªÅõ",3; //venatu_card mes "There is one more reason why many adventurers are sent to Juperos and that is my real request."; diff --git a/npc/re/quests/quests_dicastes.txt b/npc/re/quests/quests_dicastes.txt index 562d205d3..d52de0f70 100644 --- a/npc/re/quests/quests_dicastes.txt +++ b/npc/re/quests/quests_dicastes.txt @@ -52,9 +52,9 @@ manuk,321,182,5 script Entrance Manager#ep133 4_MAN_GALTUN,{ if (!isequipped(2782)) { mes "[Average Galten]"; - mes "¢¤¡ð¡ú? ¢£ ¡ù¡ð..."; - mes "¡ï¡ò¡Ð ¢¤ ?"; - mes "¡ñ¡ï..?"; + mes sprintf("¢¤¡ð¡ú? ¢£ ¡ù¡ð..."); + mes sprintf("¡ï¡ò¡Ð ¢¤ ?"); + mes sprintf("¡ñ¡ï..?"); close; } if (ep13_3_invite >= 4) { @@ -81,7 +81,7 @@ manuk,321,182,5 script Entrance Manager#ep133 4_MAN_GALTUN,{ dic_dun01,266,113,5 script Curious Sapha#ep13_3_ 4_MAN_BENKUNI,{ if (!isequipped(2782)) { mes "[Curious Sapha]"; - mes "¡ö¡ñ¡Ð ¡ò ¡õ?"; + mes sprintf("¡ö¡ñ¡Ð ¡ò ¡õ?"); next; mes "- Cannot understand a word. -"; close; @@ -207,8 +207,8 @@ sec_in02,16,43,5 script Scaraba Dungeon Entrance 4_MAN_BENKUNI,{ if (compare(strnpcinfo(0),"ep133_26")) { if (!isequipped(2782)) { mes "[Vigilante]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); next; mes "The Vigilante says something and then shakes his head."; mes "Looks like a negative reaction from the looks of his firm pose holding his shield in front of him."; @@ -231,9 +231,9 @@ sec_in02,16,43,5 script Scaraba Dungeon Entrance 4_MAN_BENKUNI,{ } if (!isequipped(2782)) { mes "[Vigilante]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..! "; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..! "); next; mes "Cannot communicate with him."; close; @@ -267,8 +267,8 @@ dic_dun01,30,216,5 duplicate(Vigilante#main) Vigilante#ep133_26 4_MAN_GALTUN1 dic_dun01,284,102,5 script Dirty Vigilante#ep13_3 4_MAN_GALTUN,{ if (!isequipped(2782)) { mes "[Vigilante]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û."; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..! "; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û."); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..! "); next; mes "Cannot understand a word."; close; @@ -361,8 +361,8 @@ OnEnable: - script Guard#ep133_11 4_MAN_GALTUN1,{ if (!isequipped(2782)) { mes "[Capital City Guard]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"); next; mes "- Cannot communicate with him. -"; close; @@ -502,8 +502,8 @@ dic_in01,48,263,5 script Hunting Dept. 1 Manager 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -572,8 +572,8 @@ dic_in01,51,266,6 script Hunting Dept. 2 Manager 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -641,8 +641,8 @@ dic_in01,51,270,7 script Supply Dept. 1 Manager 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -712,8 +712,8 @@ dic_in01,48,273,1 script Supply Dept. 2 Manager 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -779,8 +779,8 @@ dic_in01,43,273,1 script Transport Dept. 1 Mgr 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -853,8 +853,8 @@ dic_in01,40,270,2 script Transport Dept. 2 Mgr 4_MAN_BENKUNI,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -921,8 +921,8 @@ dic_in01,40,193,1 script Papyrus#0001 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -1204,9 +1204,9 @@ cmd_fild08,324,163,0 script Stone Hearts CLEAR_NPC,{ unknown_d(12215,953); } dic_in01,138,225,3 script Diel Guard#ep133_19 4_MAN_GALTUN1,{ if (!isequipped(2782)) { mes "[Diel Guard]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"); next; mes "Cannot communicate with him."; close; @@ -1267,9 +1267,9 @@ dic_in01,242,182,0 script Elevator#5f_to_4f CLEAR_NPC,{ dic_in01,263,193,3 script Diel Guard#ep133_20 4_MAN_GALTUN,{ if (!isequipped(2782)) { mes "[Diel Guard]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"); next; mes "Cannot communicate with him."; close; @@ -1804,8 +1804,8 @@ OnTouch: if (ep13_3_secret == 19) { if (!isequipped(2782)) { mes "[Quiet Voice]"; - mes "¡þ¡ù¡ó ¢¤¡ö¡ø...."; - mes "¡ò¡õ¡ú ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; + mes sprintf("¡þ¡ù¡ó ¢¤¡ö¡ø...."); + mes sprintf("¡ò¡õ¡ú ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); } else { mes "[Quiet Voice]"; @@ -1821,9 +1821,9 @@ OnTouch: dic_in01,158,188,3 script Jarute HesLanta#ep133_2 4_MAN_JERUTOO,{ if (!isequipped(2782)) { mes "[Jarute HesLanta]"; - mes "¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"; - mes "¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; - mes "¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"; + mes sprintf("¡ô¡ó¡ö ¡÷ ¡þ¡ù¡ó?"); + mes sprintf("¢¤¡ö¡ø ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); + mes sprintf("¡ð¡ú¢± ¡ô ¡ò¡õ¡ú ¡õ..!"); next; mes "Cannot communicate with him."; mes "Sapha's minister looks hopeless."; @@ -2331,8 +2331,8 @@ dicastes01,223,190,1 script Calyon#pa8029 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -2504,8 +2504,8 @@ dicastes01,211,178,2 script Moltuka#pa0829 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -2728,8 +2728,8 @@ dicastes01,175,217,5 script Kalipo#pa0829 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -2870,8 +2870,8 @@ dicastes01,187,230,5 script Laponte#pa0829 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -3041,8 +3041,8 @@ dicastes01,208,230,3 script Pura#pa0829 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -3232,8 +3232,8 @@ dicastes01,225,211,3 script Tragis#pa0829 4_MAN_NITT,{ close; } if (!isequipped(2782)) { - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "I don't feel confident in talking since you wouldn't understand anything."; close; @@ -4300,8 +4300,8 @@ dic_in01,245,119,4 script Shay#ep133_13 4_M_ACROSS,{ dicastes01,207,210,5 script Walking Knit#ep133_15 4_MAN_BENKUNI,{ if (!isequipped(2782)) { mes "[Knit]"; - mes "¡õ¢£¡ô"; - mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"; + mes sprintf("¡õ¢£¡ô"); + mes sprintf("¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£"); next; mes "Cannot communicate with him."; close; @@ -4398,9 +4398,9 @@ dicastes01,207,210,5 script Walking Knit#ep133_15 4_MAN_BENKUNI,{ dicastes01,112,248,5 script Resting Piom#ep133_16 4_MAN_PIOM5,{ mes "[Piom]"; if (!isequipped(2782)) { - mes "¡ñ¡÷¢¤ ¡ö ¢±¡ñ¡ú?"; - mes "¡ò¢³~!"; - mes "¡Ð¢²¢¤ ¢± ¡ü¡ñ¡õ ¢³ ¡ð !!!"; + mes sprintf("¡ñ¡÷¢¤ ¡ö ¢±¡ñ¡ú?"); + mes sprintf("¡ò¢³~!"); + mes sprintf("¡Ð¢²¢¤ ¢± ¡ü¡ñ¡õ ¢³ ¡ð !!!"); next; mes "Cannot communicate with him."; close; @@ -4471,8 +4471,8 @@ dicastes01,112,248,5 script Resting Piom#ep133_16 4_MAN_PIOM5,{ dicastes01,249,140,3 script Training Galten#ep133_17 4_MAN_GALTUN,{ if (!isequipped(2782)) { mes "[Galten]"; - mes "¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü"; - mes "¡ø¡ô¡ü"; + mes sprintf("¡ø¡ô¡ü ¡ø ¡ø¡ô¡ü"); + mes sprintf("¡ø¡ô¡ü"); next; mes "Cannot communicate with him."; close; @@ -5045,8 +5045,8 @@ dicastes01,117,262,0 script Frede#13_3 4_MAN_PIOM5,2,2,{ close; } mes "[Frede]"; - mes "¢£¡ô¡ñ ¡û"; - mes "¡ú¡ö¡ø ¢£ ¡ô"; + mes sprintf("¢£¡ô¡ñ ¡û"); + mes sprintf("¡ú¡ö¡ø ¢£ ¡ô"); close; OnTouch: if (isequipped(2782) && ep13_3_invite > 5 && ep13_3_bra < 1) { @@ -5352,8 +5352,8 @@ dic_in01,165,104,0 script Frede#13_3_in 4_MAN_PIOM,{ close; } mes "[Frede]"; - mes "¢£¡ô¡ñ ¡û "; - mes "¡ú¡ö¡ø ¢£ ¡ô"; + mes sprintf("¢£¡ô¡ñ ¡û "); + mes sprintf("¡ú¡ö¡ø ¢£ ¡ô"); close; } @@ -5450,9 +5450,9 @@ dic_dun01,205,43,5 script Brian#ep13_3_ 4_MAN_PIOM4,{ close; } mes "[Brian]"; - mes "¡ô¡õ¡ó ¡ø ¡ð¢±¡û ¡ö ¡ð"; - mes "¡ð¡þ¡þ ¡ù ¡Ð¡ñ¡ï ¢¤"; - mes "¡ô¡ò¢² ¡ø"; + mes sprintf("¡ô¡õ¡ó ¡ø ¡ð¢±¡û ¡ö ¡ð"); + mes sprintf("¡ð¡þ¡þ ¡ù ¡Ð¡ñ¡ï ¢¤"); + mes sprintf("¡ô¡ò¢² ¡ø"); close; } @@ -5576,9 +5576,9 @@ dic_dun01,153,107,4 script Tyler#13_3 4_MAN_PIOM6,{ close; } mes "[Tyler]"; - mes "¡ï¡þ¡÷"; - mes "¡þ¡ó¡Ð ¡þ ¡Ð¡ø¢± ¡ü "; - mes "¡ó¡ø¢¤ ¡ó "; + mes sprintf("¡ï¡þ¡÷"); + mes sprintf("¡þ¡ó¡Ð ¡þ ¡Ð¡ø¢± ¡ü "); + mes sprintf("¡ó¡ø¢¤ ¡ó "); close; } @@ -5679,8 +5679,8 @@ dic_dun01,235,243,0 script John#13_3 4_MAN_PIOM,{ close; } mes "[John]"; - mes "¡ù¡õ¡Ð ¢³ ¡ó"; - mes "¡ï¡ï¡ò ¡÷ ¡þ¡ð¡ö ¢£ ¡ñ¡ü¡ú ¡ó ¢¤¡ü ¡ó "; + mes sprintf("¡ù¡õ¡Ð ¢³ ¡ó"); + mes sprintf("¡ï¡ï¡ò ¡÷ ¡þ¡ð¡ö ¢£ ¡ñ¡ü¡ú ¡ó ¢¤¡ü ¡ó "); close; } @@ -5773,13 +5773,14 @@ dic_dun02,110,127,5 script Rose#13_3 4_MAN_PIOM6,{ next; mes "[Rose]"; mes "We must be connected?"; - mes "^f57d7dHahaha¢½^000000"; + mes sprintf("^f57d7d%s¢½^000000", + _("Hahaha"));; close; } mes "[Rose]"; - mes "¡ù¡ó¡ð ¢² ¡ð"; - mes "¡û¡ö¡÷ ¡ù ¢³"; - mes "¢£¡ó¢²"; + mes sprintf("¡ù¡ó¡ð ¢² ¡ð"); + mes sprintf("¡û¡ö¡÷ ¡ù ¢³"); + mes sprintf("¢£¡ó¢²"); close; } @@ -5872,8 +5873,8 @@ dic_dun01,64,107,7 script Bain#13_3 4_MAN_PIOM4,{ close; } mes "[Bain]"; - mes "¡ó¡ø¢± ¡÷ "; - mes "¡ö¡ñ¡Ð ¡ò ¡õ"; + mes sprintf("¡ó¡ø¢± ¡÷ "); + mes sprintf("¡ö¡ñ¡Ð ¡ò ¡õ"); close; } @@ -5970,11 +5971,11 @@ dic_dun01,58,225,4 script Lash#13_3 4_MAN_PIOM5,{ close; } mes "[Lash]"; - mes "¡ô¡õ¡ó ¡ø ¡ð¢±¡û ¡ö ¡ð"; - mes "¡ð¡þ¡þ ¡ù ¡Ð¡ñ¡ï ¢¤ "; - mes "¡ô¡ò¢² ¡ø "; - mes "¡÷"; - mes "¡õ¢³¡ñ ¡õ ¡ñ"; + mes sprintf("¡ô¡õ¡ó ¡ø ¡ð¢±¡û ¡ö ¡ð"); + mes sprintf("¡ð¡þ¡þ ¡ù ¡Ð¡ñ¡ï ¢¤ "); + mes sprintf("¡ô¡ò¢² ¡ø "); + mes sprintf("¡÷"); + mes sprintf("¡õ¢³¡ñ ¡õ ¡ñ"); close; } @@ -6095,9 +6096,9 @@ dic_in01,349,129,5 script Bouy#13_3 4_MAN_BENKUNI,{ close; } mes "[Bouy]"; - mes "¡ø¡ö¡þ ¡ù ¡ú¡ð¡ï ¡ø"; - mes "¡ï¡ú¡ö ¡ù"; - mes "¡õ¡ï¡õ ¡ò"; + mes sprintf("¡ø¡ö¡þ ¡ù ¡ú¡ð¡ï ¡ø"); + mes sprintf("¡ï¡ú¡ö ¡ù"); + mes sprintf("¡õ¡ï¡õ ¡ò"); close; } @@ -6591,9 +6592,9 @@ mid_campin,168,128,3 script Sapha from Manuk 4_MAN_JERUTOO,{ mes "That is it."; } mes "[Sapha]"; - mes "¢¤¡ð¡ú? ¢£ ¡ù¡ð..."; - mes "¡ï¡ò¡Ð ¢¤ ?"; - mes "¡ñ¡ï..?"; + mes sprintf("¢¤¡ð¡ú? ¢£ ¡ù¡ð..."); + mes sprintf("¡ï¡ò¡Ð ¢¤ ?"); + mes sprintf("¡ñ¡ï..?"); next; mes "[Hound]"; mes "Where is your interpreter ring?"; @@ -6673,9 +6674,9 @@ OnInit: man_in01,315,52,3 script Guard Captain Avalanche 4_MAN_GALTUN,{ mes "[Guard Captain Avalanche]"; if (!isequipped(2782)) { - mes "¢¤¡ð¡ú? ¢£ ¡ù¡ð..."; - mes "¡ï¡ò¡Ð ¢¤ ?"; - mes "¡ñ¡ï..?"; + mes sprintf("¢¤¡ð¡ú? ¢£ ¡ù¡ð..."); + mes sprintf("¡ï¡ò¡Ð ¢¤ ?"); + mes sprintf("¡ñ¡ï..?"); close; } if (ep13_3_invite == 4) { @@ -6751,8 +6752,8 @@ man_in01,315,52,3 script Guard Captain Avalanche 4_MAN_GALTUN,{ dic_in01,42,264,3 script Adventurer Clerk#ep133 4_MAN_NITT,{ if (!isequipped(2782)) { mes "[Clerk Knit]"; - mes "¡ð¡ñ¡ô ¡õ ¡ü¢±¢³ ¡ö ¡ò...?"; - mes "¢¤¡ö¡ø ... ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."; + mes sprintf("¡ð¡ñ¡ô ¡õ ¡ü¢±¢³ ¡ö ¡ò...?"); + mes sprintf("¢¤¡ö¡ø ... ¢³ ¡÷¢£¡ü ¡ø ¡Ð¡õ¡û..."); next; mes "- Cannot communicate with him. -"; close; diff --git a/npc/re/quests/quests_eclage.txt b/npc/re/quests/quests_eclage.txt index 79fbcd4b0..055d63e8f 100644 --- a/npc/re/quests/quests_eclage.txt +++ b/npc/re/quests/quests_eclage.txt @@ -12028,7 +12028,7 @@ ecl_in04,105,216,4 script Hiel's Workshop#pa0829 HIDDEN_NPC,{ next; cutin "EP14_etran1",1; mes "[Etran]"; - mes "Welcome welcomeow~! We are cat merchants, always serving guests as our kingeow~! Special sale! One piece of meat for 200æ´Ã!!"; + mes "Welcome welcomeow~! We are cat merchants, always serving guests as our kingeow~! Special sale! One piece of meat for 200meow!!"; next; cutin "EP14_robert1",1; mes "[Robert]"; diff --git a/npc/re/quests/quests_malangdo.txt b/npc/re/quests/quests_malangdo.txt index 54b2a00c0..9a3a3284f 100644 --- a/npc/re/quests/quests_malangdo.txt +++ b/npc/re/quests/quests_malangdo.txt @@ -825,7 +825,8 @@ mal_in02,174,64,5 script Linguist Devore#mal 4_CAT_MERMASTER,{ mes "If you see the words on the first page of this book, there's a sentence seeming like short conversation."; next; mes "[Linguist Devore]"; - mes "It's like this, for the question, ¬¬¬Ñ¬Ü ¬ã¬Ú?, it says, ¬¡¬Ù ¬ã¬ì¬Þ ¬Õ¬à¬Ò¬â¬Ö, ¬Ò¬Ý¬Ñ¬Ô¬à¬Õ¬Ñ¬â¬ñ. ¬¡ ¬£¬Ú¬Ö?"; + mes sprintf(_$("It's like this, for the question, %s, it says, %s"), + "¬¬¬Ñ¬Ü ¬ã¬Ú?", "¬¡¬Ù ¬ã¬ì¬Þ ¬Õ¬à¬Ò¬â¬Ö, ¬Ò¬Ý¬Ñ¬Ô¬à¬Õ¬Ñ¬â¬ñ. ¬¡ ¬£¬Ú¬Ö?"); next; mes "[Linguist Devore]"; mes "Though I tried talking to Biscuit like this, there was no feedback."; @@ -9649,7 +9650,7 @@ mal_in01,134,221,4 script KungKung#gamer 4_M_BABYCAT,{ case 1: // Attack mes "How would you like to attack?"; mes " "; - mes "¡¡ Tip !!"; + mes "- Tip -"; mes "Choose back: ^FF0000You win if the cat shows the back of its paw.^000000"; mes "Choose palm: ^FF0000You win if the cat shows the palm of its paw.^000000"; next; @@ -9695,7 +9696,7 @@ mal_in01,134,221,4 script KungKung#gamer 4_M_BABYCAT,{ case 2: // Defend mes "How would you like to defend?"; mes " "; - mes "¡¡ Tip !!"; + mes "- Tip -"; mes "Choose back: ^FF0000You win if the cat shows the back of its paw.^000000"; mes "Choose palm: ^FF0000You win if the cat shows the palm of its paw.^000000"; next; diff --git a/npc/re/quests/quests_mora.txt b/npc/re/quests/quests_mora.txt index 0d64f23d9..34999bbd8 100644 --- a/npc/re/quests/quests_mora.txt +++ b/npc/re/quests/quests_mora.txt @@ -3432,7 +3432,8 @@ L_ShowReport: mes "the mysterious power."; mes " "; mes "<Material analysis>"; - mes "*** Temperature ***** 33.5¡Æ"; + mes sprintf("*** %s ***** 33.5¡Æ", + _("Temperature")); mes "*** PH ************ 9.8"; mes "*** Solid residues *** 176"; mes "*** K+ ************ 0,23"; diff --git a/npc/re/warps/cities/dicastes.txt b/npc/re/warps/cities/dicastes.txt index 0d8922e51..e9b90614c 100644 --- a/npc/re/warps/cities/dicastes.txt +++ b/npc/re/warps/cities/dicastes.txt @@ -59,7 +59,7 @@ dic_in01,299,248,0 warp eldicastes0015 1,1,dic_in01,262,191 dic_in01,242,182,0 script #eldicastes0016 CLEAR_NPC,{ if (isequipped(2782)) select("Administrative Office"); - else select("¡÷¡ú¡ð"); + else select(sprintf("¡÷¡ú¡ð")); warp "dic_in01",138,221; end; } diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 3d25d7330..a0ec8fc7e 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -648,6 +648,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "casecheck_data", sizeof(struct casecheck_data), SERVER_TYPE_MAP }, { "reg_db", sizeof(struct reg_db), SERVER_TYPE_MAP }, { "script_array", sizeof(struct script_array), SERVER_TYPE_MAP }, + { "script_buf", sizeof(struct script_buf), SERVER_TYPE_MAP }, { "script_code", sizeof(struct script_code), SERVER_TYPE_MAP }, { "script_data", sizeof(struct script_data), SERVER_TYPE_MAP }, { "script_function", sizeof(struct script_function), SERVER_TYPE_MAP }, @@ -662,6 +663,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "script_syntax_data", sizeof(struct script_syntax_data), SERVER_TYPE_MAP }, { "str_data_struct", sizeof(struct str_data_struct), SERVER_TYPE_MAP }, { "string_translation", sizeof(struct string_translation), SERVER_TYPE_MAP }, + { "string_translation_entry", sizeof(struct string_translation_entry), SERVER_TYPE_MAP }, #else #define MAP_SCRIPT_H #endif // MAP_SCRIPT_H diff --git a/src/common/db.h b/src/common/db.h index d7d111c86..1c0955221 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -1395,6 +1395,16 @@ HPShared struct db_interface *DB; } while(false) /** + * Removes all values from the vector. + * + * Does not free the allocated data. + */ +#define VECTOR_TRUNCATE(_vec) \ + do { \ + VECTOR_LENGTH(_vec) = 0; \ + } while (false) + +/** * Clears the vector, freeing allocated data. * * @param _vec Vector. diff --git a/src/common/strlib.c b/src/common/strlib.c index 9690151b4..b67adb63c 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -772,6 +772,7 @@ size_t sv_escape_c(char* out_dest, const char* src, size_t len, const char* esca case '\v': out_dest[j++] = 'v'; break; case '\f': out_dest[j++] = 'f'; break; case '\?': out_dest[j++] = '?'; break; + case '\"': out_dest[j++] = '"'; break; default:// to octal out_dest[j++] = '0'+((char)(((unsigned char)src[i]&0700)>>6)); out_dest[j++] = '0'+((char)(((unsigned char)src[i]&0070)>>3)); diff --git a/src/config/core.h b/src/config/core.h index 09954e0cb..afd138a43 100644 --- a/src/config/core.h +++ b/src/config/core.h @@ -40,6 +40,17 @@ /// your map-server using more resources while this is active, comment the line #define SCRIPT_CALLFUNC_CHECK +/** + * Strip linebreaks from `mes` dialogs. + * + * Leave this line commented out to keep the hard line-breaks (`\r`) in the + * displayed `mes` dialogs (as in official servers). + * Uncomment it to strip the line-breaks and replace them with spaces, letting + * the client automatically wrap text in dialogs, depending on font size and + * dialog window size (may work better for clients using a non-standard font). + */ +//#define SCRIPT_MES_STRIP_LINEBREAK + /// Comment to disable Hercules' console_parse /// CONSOLE_INPUT allows you to type commands into the server's console, /// Disabling it saves one thread. diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 841cf855d..094e64e2a 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -132,7 +132,6 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { int msg_number; char line[1024], w1[1024], w2[1024]; FILE *fp; - static int called = 1; nullpo_retr(false, cfg_name); if ((fp = fopen(cfg_name, "r")) == NULL) { @@ -170,21 +169,6 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { } fclose(fp); - if( ++called == 1 ) { //Original - if( script->lang_export_fp ) { - int i; - for(i = 0; i < MAX_MSG;i++) { - if( atcommand->msg_table[0][i] != NULL ) { - fprintf(script->lang_export_fp, "msgctxt \"messages.conf\"\n" - "msgid \"%s\"\n" - "msgstr \"\"\n", - atcommand->msg_table[0][i] - ); - } - } - } - } - return true; } diff --git a/src/map/clif.c b/src/map/clif.c index 40545cd6d..13a7b0839 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1978,6 +1978,10 @@ void clif_selllist(struct map_session_data *sd) void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { int fd, slen; +#ifdef SCRIPT_MES_STRIP_LINEBREAK + char *stripmes = NULL; + int i; +#endif nullpo_retv(sd); nullpo_retv(mes); @@ -1992,7 +1996,17 @@ void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) WFIFOW(fd,0) = 0xb4; WFIFOW(fd,2) = slen; WFIFOL(fd,4) = npcid; +#ifdef SCRIPT_MES_STRIP_LINEBREAK + stripmes = aStrdup(mes); + for (i = 0; stripmes[i] != '\0'; ++i) { + if (stripmes[i] == '\r') + stripmes[i] = ' '; + } + memcpy(WFIFOP(fd,8), stripmes, slen-8); + aFree(stripmes); +#else // ! SCRIPT_MES_STRIP_LINEBREAK memcpy(WFIFOP(fd,8), mes, slen-8); +#endif // SCRIPT_MES_STRIP_LINEBREAK WFIFOSET(fd,WFIFOW(fd,2)); } diff --git a/src/map/map.c b/src/map/map.c index 3a7d752c3..779f8d601 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -6002,22 +6002,6 @@ static CMDLINEARG(loadscript) } /** - * --generate-translations - * - * Creates "./generated_translations.pot" - * @see cmdline->exec - **/ -static CMDLINEARG(generatetranslations) { - script->lang_export_file = aStrdup("./generated_translations.pot"); - - if( !(script->lang_export_fp = fopen(script->lang_export_file,"wb")) ) { - ShowError("export-dialog: failed to open '%s' for writing\n",script->lang_export_file); - } - core->runflag = CORE_ST_STOP; - return true; -} - -/** * Defines the local command line arguments */ void cmdline_args_init_local(void) @@ -6033,7 +6017,6 @@ void cmdline_args_init_local(void) CMDLINEARG_DEF2(log-config, logconfig, "Alternative logging configuration.", CMDLINE_OPT_NORMAL|CMDLINE_OPT_PARAM); CMDLINEARG_DEF2(script-check, scriptcheck, "Doesn't run the server, only tests the scripts passed through --load-script.", CMDLINE_OPT_SILENT); CMDLINEARG_DEF2(load-script, loadscript, "Loads an additional script (can be repeated).", CMDLINE_OPT_NORMAL|CMDLINE_OPT_PARAM); - CMDLINEARG_DEF2(generate-translations, generatetranslations, "Creates './generated_translations.pot' file with all translateable strings from scripts, server terminates afterwards.", CMDLINE_OPT_NORMAL); } int do_init(int argc, char *argv[]) diff --git a/src/map/npc.c b/src/map/npc.c index 6b55bf5ae..945a84957 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3759,7 +3759,7 @@ const char *npc_parse_function(const char *w1, const char *w2, const char *w3, c struct script_code *oldscript = (struct script_code*)DB->data2ptr(&old_data); ShowWarning("npc_parse_function: Overwriting user function [%s] in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer)); script->free_vars(oldscript->local.vars); - aFree(oldscript->script_buf); + VECTOR_CLEAR(oldscript->script_buf); aFree(oldscript); } @@ -5002,12 +5002,6 @@ int do_init_npc(bool minimal) { timer->add_func_list(npc->timerevent,"npc_timerevent"); } - if( script->lang_export_fp ) { - ShowInfo("Lang exported to '%s'\n",script->lang_export_file); - fclose(script->lang_export_fp); - script->lang_export_fp = NULL; - } - // Init dummy NPC CREATE(npc->fake_nd, struct npc_data, 1); npc->fake_nd->bl.m = -1; diff --git a/src/map/script.c b/src/map/script.c index 07b37571e..64966f987 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -83,36 +83,18 @@ struct script_interface script_s; struct script_interface *script; -static inline int GETVALUE(const unsigned char* buf, int i) { - return (int)MakeDWord(MakeWord(buf[i], buf[i+1]), MakeWord(buf[i+2], 0)); -} -static inline void SETVALUE(unsigned char* buf, int i, int n) { - buf[i] = GetByte(n, 0); - buf[i+1] = GetByte(n, 1); - buf[i+2] = GetByte(n, 2); -} - -static inline void script_string_buf_ensure(struct script_string_buf *buf, size_t ensure) { - if( buf->pos+ensure >= buf->size ) { - do { - buf->size += 512; - } while ( buf->pos+ensure >= buf->size ); - RECREATE(buf->ptr, char, buf->size); - } -} - -static inline void script_string_buf_addb(struct script_string_buf *buf,uint8 b) { - if( buf->pos+1 >= buf->size ) { - buf->size += 512; - RECREATE(buf->ptr, char, buf->size); - } - buf->ptr[buf->pos++] = b; +static inline int GETVALUE(const struct script_buf *buf, int i) +{ + Assert_ret(VECTOR_LENGTH(*buf) > i + 2); + return (int)MakeDWord(MakeWord(VECTOR_INDEX(*buf, i), VECTOR_INDEX(*buf, i+1)), + MakeWord(VECTOR_INDEX(*buf, i+2), 0)); } - -static inline void script_string_buf_destroy(struct script_string_buf *buf) { - if( buf->ptr ) - aFree(buf->ptr); - memset(buf,0,sizeof(struct script_string_buf)); +static inline void SETVALUE(struct script_buf *buf, int i, int n) +{ + Assert_retv(VECTOR_LENGTH(*buf) > i + 2); + VECTOR_INDEX(*buf, i) = GetByte(n, 0); + VECTOR_INDEX(*buf, i+1) = GetByte(n, 1); + VECTOR_INDEX(*buf, i+2) = GetByte(n, 2); } const char* script_op2name(int op) { @@ -606,21 +588,26 @@ int script_add_str(const char* p) return script->str_num++; } -/// Appends 1 byte to the script buffer. +/** + * Appends 1 byte to the script buffer. + * + * @param a The byte to append. + */ void add_scriptb(int a) { - if( script->pos+1 >= script->size ) - { - script->size += SCRIPT_BLOCK_SIZE; - RECREATE(script->buf,unsigned char,script->size); - } - script->buf[script->pos++] = (uint8)(a); + VECTOR_ENSURE(script->buf, 1, SCRIPT_BLOCK_SIZE); + VECTOR_PUSH(script->buf, (uint8)a); } -/// Appends a c_op value to the script buffer. -/// The value is variable-length encoded into 8-bit blocks. -/// The encoding scheme is ( 01?????? )* 00??????, LSB first. -/// All blocks but the last hold 7 bits of data, topmost bit is always 1 (carries). +/** + * Appends a c_op value to the script buffer. + * + * The value is variable-length encoded into 8-bit blocks. + * The encoding scheme is ( 01?????? )* 00??????, LSB first. + * All blocks but the last hold 7 bits of data, topmost bit is always 1 (carries). + * + * @param a The value to append. + */ void add_scriptc(int a) { while( a >= 0x40 ) @@ -632,10 +619,15 @@ void add_scriptc(int a) script->addb(a); } -/// Appends an integer value to the script buffer. -/// The value is variable-length encoded into 8-bit blocks. -/// The encoding scheme is ( 11?????? )* 10??????, LSB first. -/// All blocks but the last hold 7 bits of data, topmost bit is always 1 (carries). +/** + * Appends an integer value to the script buffer. + * + * The value is variable-length encoded into 8-bit blocks. + * The encoding scheme is ( 11?????? )* 10??????, LSB first. + * All blocks but the last hold 7 bits of data, topmost bit is always 1 (carries). + * + * @param a The value to append. + */ void add_scripti(int a) { while( a >= 0x40 ) @@ -646,11 +638,11 @@ void add_scripti(int a) script->addb(a|0x80); } -/// Appends a script->str_data object (label/function/variable/integer) to the script buffer. - -/// -/// @param l The id of the script->str_data entry -// Maximum up to 16M +/** + * Appends a script->str_data object (label/function/variable/integer) to the script buffer. + * + * @param l The id of the script->str_data entry (Maximum up to 16M) + */ void add_scriptl(int l) { int backpatch = script->str_data[l].backpatch; @@ -667,7 +659,7 @@ void add_scriptl(int l) case C_USERFUNC: // Embedded data backpatch there is a possibility of label script->addc(C_NAME); - script->str_data[l].backpatch = script->pos; + script->str_data[l].backpatch = VECTOR_LENGTH(script->buf); script->addb(backpatch); script->addb(backpatch>>8); script->addb(backpatch>>16); @@ -705,9 +697,9 @@ void set_label(int l,int pos, const char* script_pos) script->str_data[l].type=(script->str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS); script->str_data[l].label=pos; for (i = script->str_data[l].backpatch; i >= 0 && i != 0x00ffffff; ) { - int next = GETVALUE(script->buf,i); - script->buf[i-1]=(script->str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS); - SETVALUE(script->buf,i,pos); + int next = GETVALUE(&script->buf, i); + VECTOR_INDEX(script->buf, i-1) = (script->str_data[l].type == C_USERFUNC ? C_USERFUNC_POS : C_POS); + SETVALUE(&script->buf, i, pos); i = next; } } @@ -811,26 +803,25 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom) char *arg = NULL; char null_arg = '\0'; int func; - bool nested_call = false, macro = false; + bool macro = false; // is need add check for arg null pointer below? func = script->add_word(p); - if( script->str_data[func].type == C_FUNC ) { - /** only when unset (-1), valid values are >= 0 **/ - if( script->syntax.last_func == -1 ) - script->syntax.last_func = script->str_data[func].val; - else { //Nested function call - script->syntax.nested_call++; - nested_call = true; - - if( script->str_data[func].val == script->buildin_lang_macro_offset ) { + if (script->str_data[func].type == C_FUNC) { + script->syntax.nested_call++; + if (script->syntax.last_func != -1) { + if (script->str_data[func].val == script->buildin_lang_macro_offset) { script->syntax.lang_macro_active = true; macro = true; + } else if (script->str_data[func].val == script->buildin_lang_macro_fmtstring_offset) { + script->syntax.lang_macro_fmtstring_active = true; + macro = true; } } if( !macro ) { // buildin function + script->syntax.last_func = script->str_data[func].val; script->addl(func); script->addc(C_ARG); } @@ -919,18 +910,17 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom) disp_error_message("parse_callfunc: expected ')' to close argument list",p); ++p; - if( script->str_data[func].val == script->buildin_lang_macro_offset ) + if (script->str_data[func].val == script->buildin_lang_macro_offset) script->syntax.lang_macro_active = false; + else if (script->str_data[func].val == script->buildin_lang_macro_fmtstring_offset) + script->syntax.lang_macro_fmtstring_active = false; } - if( nested_call ) - script->syntax.nested_call--; - - if( !script->syntax.nested_call ) - script->syntax.last_func = -1; - - if( !macro ) + if (!macro) { + if (0 == --script->syntax.nested_call) + script->syntax.last_func = -1; script->addc(C_FUNC); + } return p; } @@ -942,7 +932,7 @@ void parse_nextline(bool first, const char* p) if( !first ) { script->addc(C_EOL); // mark end of line for stack cleanup - script->set_label(LABEL_NEXTLINE, script->pos, p); // fix up '-' labels + script->set_label(LABEL_NEXTLINE, VECTOR_LENGTH(script->buf), p); // fix up '-' labels } // initialize data for new '-' label fix up scheduling @@ -1066,6 +1056,8 @@ const char* parse_variable(const char* p) } // push the set function onto the stack + script->syntax.nested_call++; + script->syntax.last_func = script->str_data[script->buildin_set_ref].val; script->addl(script->buildin_set_ref); script->addc(C_ARG); @@ -1117,6 +1109,8 @@ const char* parse_variable(const char* p) // close the script by appending the function operator script->addc(C_FUNC); + if (--script->syntax.nested_call == 0) + script->syntax.last_func = -1; // push the buffer from the method return p; @@ -1159,13 +1153,19 @@ bool is_number(const char *p) { } /** + * Duplicates a script string into the script string list. * - **/ -int script_string_dup(char *str) { - size_t len = strlen(str); + * Grows the script string list as needed. + * + * @param str The string to insert. + * @return the string position in the script string list. + */ +int script_string_dup(char *str) +{ + int len = (int)strlen(str); int pos = script->string_list_pos; - while( pos+len+1 >= script->string_list_size ) { + while (pos+len+1 >= script->string_list_size) { script->string_list_size += (1024*1024)/2; RECREATE(script->string_list,char,script->string_list_size); } @@ -1179,231 +1179,194 @@ int script_string_dup(char *str) { /*========================================== * Analysis section *------------------------------------------*/ -const char* parse_simpleexpr(const char *p) +const char *parse_simpleexpr(const char *p) { p=script->skip_space(p); - if(*p==';' || *p==',') + if (*p == ';' || *p == ',') disp_error_message("parse_simpleexpr: unexpected end of expression",p); - if(*p=='(') { - int i = script->syntax.curly_count-1; - if (i >= 0 && script->syntax.curly[i].type == TYPE_ARGLIST) - ++script->syntax.curly[i].count; - p=script->parse_subexpr(p+1,-1); - p=script->skip_space(p); - if( (i=script->syntax.curly_count-1) >= 0 && script->syntax.curly[i].type == TYPE_ARGLIST - && script->syntax.curly[i].flag == ARGLIST_UNDEFINED && --script->syntax.curly[i].count == 0 - ) { - if( *p == ',' ) { - script->syntax.curly[i].flag = ARGLIST_PAREN; - return p; - } else { - script->syntax.curly[i].flag = ARGLIST_NO_PAREN; - } - } - if( *p != ')' ) - disp_error_message("parse_simpleexpr: unmatched ')'",p); - ++p; - } else if(is_number(p)) { - char *np; - long long lli; - while(*p == '0' && ISDIGIT(p[1])) p++; // Skip leading zeros, we don't support octal literals - lli=strtoll(p,&np,0); - if( lli < INT_MIN ) { - lli = INT_MIN; - script->disp_warning_message("parse_simpleexpr: underflow detected, capping value to INT_MIN",p); - } else if( lli > INT_MAX ) { - lli = INT_MAX; - script->disp_warning_message("parse_simpleexpr: overflow detected, capping value to INT_MAX",p); - } - script->addi((int)lli); // Cast is safe, as it's already been checked for overflows - p=np; - } else if(*p=='"') { - struct string_translation *st = NULL; - const char *start_point = p; - bool duplicate = true; - struct script_string_buf *sbuf = &script->parse_simpleexpr_str; - - do { - p++; - while( *p && *p != '"' ) { - if( (unsigned char)p[-1] <= 0x7e && *p == '\\' ) { - char buf[8]; - size_t len = sv->skip_escaped_c(p) - p; - size_t n = sv->unescape_c(buf, p, len); - if( n != 1 ) - ShowDebug("parse_simpleexpr: unexpected length %d after unescape (\"%.*s\" -> %.*s)\n", (int)n, (int)len, p, (int)n, buf); - p += len; - script_string_buf_addb(sbuf, *buf); - continue; - } else if( *p == '\n' ) { - disp_error_message("parse_simpleexpr: unexpected newline @ string",p); - } - script_string_buf_addb(sbuf, *p++); - } - if(!*p) - disp_error_message("parse_simpleexpr: unexpected end of file @ string",p); - p++; //'"' - p = script->skip_space(p); - } while( *p && *p == '"' ); - - script_string_buf_addb(sbuf, 0); - - if (!(script->syntax.translation_db && (st = strdb_get(script->syntax.translation_db, sbuf->ptr)) != NULL)) { - script->addc(C_STR); - - if( script->pos+sbuf->pos >= script->size ) { - do { - script->size += SCRIPT_BLOCK_SIZE; - } while( script->pos+sbuf->pos >= script->size ); - RECREATE(script->buf,unsigned char,script->size); - } + if (*p == '(') { + return script->parse_simpleexpr_paren(p); + } else if (is_number(p)) { + return script->parse_simpleexpr_number(p); + } else if(*p == '"') { + return script->parse_simpleexpr_string(p); + } else { + return script->parse_simpleexpr_name(p); + } +} - memcpy(script->buf+script->pos, sbuf->ptr, sbuf->pos); - script->pos += sbuf->pos; +const char *parse_simpleexpr_paren(const char *p) +{ + int i = script->syntax.curly_count - 1; + if (i >= 0 && script->syntax.curly[i].type == TYPE_ARGLIST) + ++script->syntax.curly[i].count; + p = script->parse_subexpr(p + 1, -1); + p = script->skip_space(p); + if ((i = script->syntax.curly_count - 1) >= 0 + && script->syntax.curly[i].type == TYPE_ARGLIST + && script->syntax.curly[i].flag == ARGLIST_UNDEFINED + && --script->syntax.curly[i].count == 0 + ) { + if (*p == ',') { + script->syntax.curly[i].flag = ARGLIST_PAREN; + return p; } else { - int expand = sizeof(int) + sizeof(uint8); - unsigned char j; - unsigned int st_cursor = 0; + script->syntax.curly[i].flag = ARGLIST_NO_PAREN; + } + } + if (*p != ')') + disp_error_message("parse_simpleexpr: unmatched ')'", p); - script->addc(C_LSTR); + return p + 1; +} - expand += (sizeof(char*) + sizeof(uint8)) * st->translations; +const char *parse_simpleexpr_number(const char *p) +{ + char *np = NULL; + long long lli; - while( script->pos+expand >= script->size ) { - script->size += SCRIPT_BLOCK_SIZE; - RECREATE(script->buf,unsigned char,script->size); - } + while (*p == '0' && ISDIGIT(p[1])) + p++; // Skip leading zeros, we don't support octal literals - *((int *)(&script->buf[script->pos])) = st->string_id; - *((uint8 *)(&script->buf[script->pos + sizeof(int)])) = st->translations; + lli = strtoll(p, &np, 0); + if (lli < INT_MIN) { + lli = INT_MIN; + script->disp_warning_message("parse_simpleexpr: underflow detected, capping value to INT_MIN", p); + } else if (lli > INT_MAX) { + lli = INT_MAX; + script->disp_warning_message("parse_simpleexpr: overflow detected, capping value to INT_MAX", p); + } + script->addi((int)lli); // Cast is safe, as it's already been checked for overflows - script->pos += sizeof(int) + sizeof(uint8); + return np; +} - for(j = 0; j < st->translations; j++) { - *((uint8 *)(&script->buf[script->pos])) = RBUFB(st->buf, st_cursor); - *((char **)(&script->buf[script->pos+sizeof(uint8)])) = &st->buf[st_cursor + sizeof(uint8)]; - script->pos += sizeof(char*) + sizeof(uint8); - st_cursor += sizeof(uint8); - while(st->buf[st_cursor++]); - st_cursor += sizeof(uint8); - } - } +const char *parse_simpleexpr_string(const char *p) +{ + const char *start_point = p; - /* When exporting we don't know what is a translation and what isn't */ - if( script->lang_export_fp && sbuf->pos > 1 ) {//sbuf->pos will always be at least 1 because of the '\0' - if( !script->syntax.strings ) { - script->syntax.strings = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, 0); + do { + p++; + while (*p != '\0' && *p != '"') { + if ((unsigned char)p[-1] <= 0x7e && *p == '\\') { + char buf[8]; + size_t len = sv->skip_escaped_c(p) - p; + size_t n = sv->unescape_c(buf, p, len); + if (n != 1) + ShowDebug("parse_simpleexpr: unexpected length %d after unescape (\"%.*s\" -> %.*s)\n", (int)n, (int)len, p, (int)n, buf); + p += len; + VECTOR_ENSURE(script->parse_simpleexpr_strbuf, 1, 512); + VECTOR_PUSH(script->parse_simpleexpr_strbuf, buf[0]); + continue; } - - if( !strdb_exists(script->syntax.strings,sbuf->ptr) ) { - strdb_put(script->syntax.strings, sbuf->ptr, NULL); - duplicate = false; + if (*p == '\n') { + disp_error_message("parse_simpleexpr: unexpected newline @ string", p); } + VECTOR_ENSURE(script->parse_simpleexpr_strbuf, 1, 512); + VECTOR_PUSH(script->parse_simpleexpr_strbuf, *p++); } + if (*p == '\0') + disp_error_message("parse_simpleexpr: unexpected end of file @ string", p); + p++; //'"' + p = script->skip_space(p); + } while (*p != '\0' && *p == '"'); - if( script->lang_export_fp && !duplicate && - ( ( ( script->syntax.last_func == script->buildin_mes_offset || - script->syntax.last_func == script->buildin_select_offset ) && !script->syntax.nested_call - ) || script->syntax.lang_macro_active ) ) { - const char *line_start = start_point; - const char *line_end = start_point; - struct script_string_buf *lbuf = &script->lang_export_line_buf; - struct script_string_buf *ubuf = &script->lang_export_unescaped_buf; - size_t line_length, cursor; + VECTOR_ENSURE(script->parse_simpleexpr_strbuf, 1, 512); + VECTOR_PUSH(script->parse_simpleexpr_strbuf, '\0'); - while( line_start > script->parser_current_src ) { - if( *line_start != '\n' ) - line_start--; - else - break; - } + script->add_translatable_string(&script->parse_simpleexpr_strbuf, start_point); - while( *line_end != '\n' && *line_end != '\0' ) - line_end++; + VECTOR_TRUNCATE(script->parse_simpleexpr_strbuf); - line_length = (size_t)(line_end - line_start); - if( line_length > 0 ) { - script_string_buf_ensure(lbuf,line_length + 1); + return p; +} - memcpy(lbuf->ptr, line_start, line_length); - lbuf->pos = line_length; - script_string_buf_addb(lbuf, 0); +const char *parse_simpleexpr_name(const char *p) +{ + int l; + const char *pv = NULL; - normalize_name(lbuf->ptr, "\r\n\t "); - } + // label , register , function etc + if (script->skip_word(p) == p) + disp_error_message("parse_simpleexpr: unexpected character", p); - for(cursor = 0; cursor < sbuf->pos; cursor++) { - if( sbuf->ptr[cursor] == '"' ) - script_string_buf_addb(ubuf, '\\'); - script_string_buf_addb(ubuf, sbuf->ptr[cursor]); - } - script_string_buf_addb(ubuf, 0); - - fprintf(script->lang_export_fp, "#: %s\n" - "# %s\n" - "msgctxt \"%s\"\n" - "msgid \"%s\"\n" - "msgstr \"\"\n", - script->parser_current_file ? script->parser_current_file : "Unknown File", - lbuf->ptr, - script->parser_current_npc_name ? script->parser_current_npc_name : "Unknown NPC", - ubuf->ptr - ); - lbuf->pos = 0; - ubuf->pos = 0; + l = script->add_word(p); + if (script->str_data[l].type == C_FUNC || script->str_data[l].type == C_USERFUNC || script->str_data[l].type == C_USERFUNC_POS) { + return script->parse_callfunc(p,1,0); +#ifdef SCRIPT_CALLFUNC_CHECK + } else { + const char *name = script->get_str(l); + if (strdb_get(script->userfunc_db,name) != NULL) { + return script->parse_callfunc(p, 1, 1); } - sbuf->pos = 0; +#endif + } + + if ((pv = script->parse_variable(p)) != NULL) { + // successfully processed a variable assignment + return pv; + } + + if (script->str_data[l].type == C_INT && script->str_data[l].deprecated) { + disp_warning_message("This constant is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", p); + } + + p = script->skip_word(p); + if (*p == '[') { + // array(name[i] => getelementofarray(name,i) ) + script->addl(script->buildin_getelementofarray_ref); + script->addc(C_ARG); + script->addl(l); + + p = script->parse_subexpr(p + 1, -1); + p = script->skip_space(p); + if (*p != ']') + disp_error_message("parse_simpleexpr: unmatched ']'", p); + ++p; + script->addc(C_FUNC); } else { - int l; - const char* pv; + script->addl(l); + } - // label , register , function etc - if(script->skip_word(p)==p) - disp_error_message("parse_simpleexpr: unexpected character",p); + return p; +} - l=script->add_word(p); - if( script->str_data[l].type == C_FUNC || script->str_data[l].type == C_USERFUNC || script->str_data[l].type == C_USERFUNC_POS) { - return script->parse_callfunc(p,1,0); -#ifdef SCRIPT_CALLFUNC_CHECK - } else { - const char* name = script->get_str(l); - if( strdb_get(script->userfunc_db,name) != NULL ) { - return script->parse_callfunc(p,1,1); - } -#endif - } +void script_add_translatable_string(const struct script_string_buf *string, const char *start_point) +{ + struct string_translation *st = NULL; - if( (pv = script->parse_variable(p)) ) { - // successfully processed a variable assignment - return pv; - } + if (script->syntax.translation_db == NULL + || (st = strdb_get(script->syntax.translation_db, VECTOR_DATA(*string))) == NULL) { + script->addc(C_STR); - if (script->str_data[l].type == C_INT && script->str_data[l].deprecated) { - disp_warning_message("This constant is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", p); - } + VECTOR_ENSURE(script->buf, VECTOR_LENGTH(*string), SCRIPT_BLOCK_SIZE); - p=script->skip_word(p); - if( *p == '[' ) { - // array(name[i] => getelementofarray(name,i) ) - script->addl(script->buildin_getelementofarray_ref); - script->addc(C_ARG); - script->addl(l); + VECTOR_PUSHARRAY(script->buf, VECTOR_DATA(*string), VECTOR_LENGTH(*string)); + } else { + unsigned char u; + int st_cursor = 0; - p=script->parse_subexpr(p+1,-1); - p=script->skip_space(p); - if( *p != ']' ) - disp_error_message("parse_simpleexpr: unmatched ']'",p); - ++p; - script->addc(C_FUNC); - } else { - script->addl(l); - } + script->addc(C_LSTR); - } + VECTOR_ENSURE(script->buf, (int)(sizeof(st->string_id) + sizeof(st->translations)), SCRIPT_BLOCK_SIZE); + VECTOR_PUSHARRAY(script->buf, (void *)&st->string_id, sizeof(st->string_id)); + VECTOR_PUSHARRAY(script->buf, (void *)&st->translations, sizeof(st->translations)); - return p; + for (u = 0; u != st->translations; u++) { + struct string_translation_entry *entry = (void *)(st->buf+st_cursor); + char *stringptr = &entry->string[0]; + st_cursor += sizeof(*entry); + VECTOR_ENSURE(script->buf, (int)(sizeof(entry->lang_id) + sizeof(char *)), SCRIPT_BLOCK_SIZE); + VECTOR_PUSHARRAY(script->buf, (void *)&entry->lang_id, sizeof(entry->lang_id)); + VECTOR_PUSHARRAY(script->buf, (void *)&stringptr, sizeof(stringptr)); + st_cursor += sizeof(uint8); // FIXME: What are we skipping here? + while (st->buf[st_cursor++] != 0) + (void)0; // Skip string + st_cursor += sizeof(uint8); // FIXME: What are we skipping here? + } + } } /*========================================== @@ -1582,7 +1545,7 @@ const char* parse_curly_close(const char* p) // You are here labeled sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); - script->set_label(l,script->pos, p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); if(script->syntax.curly[pos].flag) { //Exists default @@ -1595,7 +1558,7 @@ const char* parse_curly_close(const char* p) // Label end sprintf(label,"__SW%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos, p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); linkdb_final(&script->syntax.curly[pos].case_label); // free the list of case label script->syntax.curly_count--; //Closing decision if, for , while @@ -1674,7 +1637,7 @@ const char* parse_syntax(const char* p) // You are here labeled sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); - script->set_label(l,script->pos, p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); } //Decision statement switch p = script->skip_space(p2); @@ -1714,7 +1677,7 @@ const char* parse_syntax(const char* p) // Label after the completion of FALLTHRU sprintf(label, "__SW%x_%xJ", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); } // check duplication of case label [Rayce] if(linkdb_search(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v)) != NULL) @@ -1781,7 +1744,7 @@ const char* parse_syntax(const char* p) } sprintf(label, "__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); // Skip to the next link w/o condition sprintf(label, "goto __SW%x_%x;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count + 1); @@ -1792,7 +1755,7 @@ const char* parse_syntax(const char* p) // The default label sprintf(label, "__SW%x_DEF", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly[script->syntax.curly_count - 1].flag = 1; script->syntax.curly[pos].count++; @@ -1810,7 +1773,7 @@ const char* parse_syntax(const char* p) // Label of the (do) form here sprintf(label, "__DO%x_BGN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly_count++; return p; } @@ -1841,7 +1804,7 @@ const char* parse_syntax(const char* p) // Form the start of label decision sprintf(label, "__FR%x_J", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); p=script->skip_space(p); if(*p == ';') { @@ -1870,7 +1833,7 @@ const char* parse_syntax(const char* p) // Labels to form the next loop sprintf(label, "__FR%x_NXT", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); // Process the next time you enter the loop // A ')' last for; flag to be treated as' @@ -1889,7 +1852,7 @@ const char* parse_syntax(const char* p) // Loop start labeling sprintf(label, "__FR%x_BGN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); return p; } else if( p2 - p == 8 && strncmp(p, "function", 8) == 0 ) { // internal script function @@ -1939,9 +1902,9 @@ const char* parse_syntax(const char* p) if( script->str_data[l].type == C_NOP || script->str_data[l].type == C_USERFUNC )// register only, if the name was not used by something else { script->str_data[l].type = C_USERFUNC; - script->set_label(l, script->pos, p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); if( script->parse_options&SCRIPT_USE_LABEL_DB ) - script->label_add(l,script->pos); + script->label_add(l, VECTOR_LENGTH(script->buf)); } else disp_error_message("parse_syntax:function: function name is invalid", func_name); @@ -2021,7 +1984,7 @@ const char* parse_syntax(const char* p) // Form the start of label decision sprintf(label, "__WL%x_NXT", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); // Skip to the end point if the condition is false sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index); @@ -2078,7 +2041,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // Put the label of the location sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly[pos].count++; p = script->skip_space(p); @@ -2116,7 +2079,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // Put the label of the final location sprintf(label, "__IF%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); if(script->syntax.curly[pos].flag == 1) { // Because the position of the pointer is the same if not else for this return bp; @@ -2129,7 +2092,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // (Come here continue) to form the label here sprintf(label, "__DO%x_NXT", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); } // Skip to the end point if the condition is false @@ -2164,7 +2127,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // Form label of the end point conditions sprintf(label, "__DO%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); p = script->skip_space(p); if(*p != ';') { disp_error_message("parse_syntax: need ';'",p); @@ -2186,7 +2149,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // End for labeling sprintf(label, "__FR%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly_count--; return p; } else if(script->syntax.curly[pos].type == TYPE_WHILE) { @@ -2202,7 +2165,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // End while labeling sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly_count--; return p; } else if(script->syntax.curly[pos].type == TYPE_USERFUNC) { @@ -2215,7 +2178,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) // Put the label of the location sprintf(label, "__FN%x_FIN", (unsigned int)script->syntax.curly[pos].index); l=script->add_str(label); - script->set_label(l,script->pos,p); + script->set_label(l, VECTOR_LENGTH(script->buf), p); script->syntax.curly_count--; return p; } else { @@ -2544,9 +2507,6 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o script->parse_cleanup_timer_id = timer->add(timer->gettick() + 10, script->parse_cleanup_timer, 0, 0); } - if( script->syntax.strings ) /* used only when generating translation file */ - db_destroy(script->syntax.strings); - memset(&script->syntax,0,sizeof(script->syntax)); script->syntax.last_func = -1;/* as valid values are >= 0 */ if( script->parser_current_npc_name ) { @@ -2556,11 +2516,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o script->syntax.translation_db = strdb_get(script->translation_db, script->parser_current_npc_name); } - if( !script->buf ) { - script->buf = (unsigned char *)aMalloc(SCRIPT_BLOCK_SIZE*sizeof(unsigned char)); - script->size = SCRIPT_BLOCK_SIZE; - } - script->pos=0; + VECTOR_TRUNCATE(script->buf); script->parse_nextline(true, NULL); // who called parse_script is responsible for clearing the database after using it, but just in case... lets clear it here @@ -2574,7 +2530,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o if( script->error_report ) script->error(src,file,line,script->error_msg,script->error_pos); aFree( script->error_msg ); - script->pos = 0; + VECTOR_TRUNCATE(script->buf); for(i=LABEL_START;i<script->str_num;i++) if(script->str_data[i].type == C_NOP) script->str_data[i].type = C_NAME; for(i=0; i<size; i++) @@ -2594,9 +2550,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o p=script->skip_space(p); if( options&SCRIPT_IGNORE_EXTERNAL_BRACKETS ) {// does not require brackets around the script - if( *p == '\0' && !(options&SCRIPT_RETURN_EMPTY_SCRIPT) ) - {// empty script and can return NULL - script->pos = 0; + if (*p == '\0' && !(options&SCRIPT_RETURN_EMPTY_SCRIPT)) { + // empty script and can return NULL + VECTOR_TRUNCATE(script->buf); #ifdef ENABLE_CASE_CHECK script->local_casecheck.clear(); script->parser_current_src = NULL; @@ -2614,9 +2570,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o if (retval) *retval = EXIT_FAILURE; } p = script->skip_space(p+1); - if( *p == '}' && !(options&SCRIPT_RETURN_EMPTY_SCRIPT) ) - {// empty script and can return NULL - script->pos = 0; + if (*p == '}' && !(options&SCRIPT_RETURN_EMPTY_SCRIPT)) { + // empty script and can return NULL + VECTOR_TRUNCATE(script->buf); #ifdef ENABLE_CASE_CHECK script->local_casecheck.clear(); script->parser_current_src = NULL; @@ -2648,9 +2604,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o tmpp=script->skip_space(script->skip_word(p)); if(*tmpp==':' && !(strncmp(p,"default:",8) == 0 && p + 7 == tmpp)) { i=script->add_word(p); - script->set_label(i,script->pos,p); + script->set_label(i, VECTOR_LENGTH(script->buf), p); if( script->parse_options&SCRIPT_USE_LABEL_DB ) - script->label_add(i,script->pos); + script->label_add(i, VECTOR_LENGTH(script->buf)); p=tmpp+1; p=script->skip_space(p); continue; @@ -2672,8 +2628,8 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o script->str_data[i].type=C_NAME; script->str_data[i].label=i; for (j = script->str_data[i].backpatch; j >= 0 && j != 0x00ffffff; ) { - int next = GETVALUE(script->buf,j); - SETVALUE(script->buf,j,i); + int next = GETVALUE(&script->buf, j); + SETVALUE(&script->buf, j, i); j = next; } } else if(script->str_data[i].type == C_USERFUNC) { @@ -2690,37 +2646,39 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o } #ifdef SCRIPT_DEBUG_DISP - for(i=0;i<script->pos;i++) { - if((i&15)==0) ShowMessage("%04x : ",i); - ShowMessage("%02x ",script->buf[i]); - if((i&15)==15) ShowMessage("\n"); + for (i = 0; i < VECTOR_LENGTH(script->buf); i++) { + if ((i&15) == 0) + ShowMessage("%04x : ",i); + ShowMessage("%02x ", VECTOR_INDEX(script->buf, i)); + if ((i&15) == 15) + ShowMessage("\n"); } ShowMessage("\n"); #endif #ifdef SCRIPT_DEBUG_DISASM i = 0; - while (i < script->pos) { - c_op op = script->get_com(script->buf, &i); + while (i < VECTOR_LENGTH(script->buf)) { + c_op op = script->get_com(&script->buf, &i); int j = i; // Note: i is modified in the line above. ShowMessage("%06x %s", i, script->op2name(op)); switch (op) { case C_INT: - ShowMessage(" %d", script->get_num(script->buf,&i)); + ShowMessage(" %d", script->get_num(&script->buf, &i)); break; case C_POS: - ShowMessage(" 0x%06x", *(int*)(script->buf+i)&0xffffff); + ShowMessage(" 0x%06x", *(int*)(&VECTOR_INDEX(script->buf, i))&0xffffff); i += 3; break; case C_NAME: - j = (*(int*)(script->buf+i)&0xffffff); + j = (*(int*)(&VECTOR_INDEX(script->buf, i))&0xffffff); ShowMessage(" %s", ( j == 0xffffff ) ? "?? unknown ??" : script->get_str(j)); i += 3; break; case C_STR: - j = (int)strlen((char*)script->buf + i); - ShowMessage(" %s", script->buf + i); + j = (int)strlen((char*)&VECTOR_INDEX(script->buf, i)); + ShowMessage(" %s", &VECTOR_INDEX(script->buf, i)); i += j+1; break; } @@ -2729,9 +2687,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o #endif CREATE(code,struct script_code,1); - code->script_buf = (unsigned char *)aMalloc(script->pos*sizeof(unsigned char)); - memcpy(code->script_buf, script->buf, script->pos); - code->script_size = script->pos; + VECTOR_INIT(code->script_buf); + VECTOR_ENSURE(code->script_buf, VECTOR_LENGTH(script->buf), 1); + VECTOR_PUSHARRAY(code->script_buf, VECTOR_DATA(script->buf), VECTOR_LENGTH(script->buf)); code->local.vars = NULL; code->local.arrays = NULL; #ifdef ENABLE_CASE_CHECK @@ -3624,7 +3582,7 @@ void script_free_code(struct script_code* code) script->free_vars(code->local.vars); if (code->local.arrays) code->local.arrays->destroy(code->local.arrays,script->array_free_db); - aFree(code->script_buf); + VECTOR_CLEAR(code->script_buf); aFree(code); } @@ -3749,32 +3707,32 @@ void script_add_pending_ref(struct script_state *st, struct reg_db *ref) { /*========================================== * Read command *------------------------------------------*/ -c_op get_com(unsigned char *scriptbuf,int *pos) +c_op get_com(const struct script_buf *scriptbuf, int *pos) { int i = 0, j = 0; - if(scriptbuf[*pos]>=0x80) { + if (VECTOR_INDEX(*scriptbuf, *pos) >= 0x80) { return C_INT; } - while(scriptbuf[*pos]>=0x40) { - i=scriptbuf[(*pos)++]<<j; + while (VECTOR_INDEX(*scriptbuf, *pos) >= 0x40) { + i = VECTOR_INDEX(*scriptbuf, (*pos)++) << j; j+=6; } - return (c_op)(i+(scriptbuf[(*pos)++]<<j)); + return (c_op)(i+(VECTOR_INDEX(*scriptbuf, (*pos)++)<<j)); } /*========================================== * Income figures *------------------------------------------*/ -int get_num(unsigned char *scriptbuf,int *pos) +int get_num(const struct script_buf *scriptbuf, int *pos) { int i,j; i=0; j=0; - while(scriptbuf[*pos]>=0xc0) { - i+=(scriptbuf[(*pos)++]&0x7f)<<j; + while (VECTOR_INDEX(*scriptbuf, *pos) >= 0xc0) { + i+= (VECTOR_INDEX(*scriptbuf, (*pos)++)&0x7f)<<j; j+=6; } - return i+((scriptbuf[(*pos)++]&0x7f)<<j); + return i+((VECTOR_INDEX(*scriptbuf, (*pos)++)&0x7f)<<j); } /// Ternary operators @@ -4394,7 +4352,7 @@ void run_script_main(struct script_state *st) { st->state = RUN; while( st->state == RUN ) { - enum c_op c = script->get_com(st->script->script_buf,&st->pos); + enum c_op c = script->get_com(&st->script->script_buf, &st->pos); switch(c) { case C_EOL: if( stack->defsp > stack->sp ) @@ -4403,27 +4361,29 @@ void run_script_main(struct script_state *st) { script->pop_stack(st, stack->defsp, stack->sp);// pop unused stack data. (unused return value) break; case C_INT: - script->push_val(stack,C_INT,script->get_num(st->script->script_buf,&st->pos),NULL); + script->push_val(stack,C_INT,script->get_num(&st->script->script_buf, &st->pos), NULL); break; case C_POS: case C_NAME: - script->push_val(stack,c,GETVALUE(st->script->script_buf,st->pos),NULL); + script->push_val(stack,c,GETVALUE(&st->script->script_buf, st->pos), NULL); st->pos+=3; break; case C_ARG: script->push_val(stack,c,0,NULL); break; case C_STR: - script->push_conststr(stack, (const char *)(st->script->script_buf+st->pos)); - while(st->script->script_buf[st->pos++]); + script->push_conststr(stack, (const char *)&VECTOR_INDEX(st->script->script_buf, st->pos)); + while (VECTOR_INDEX(st->script->script_buf, st->pos++) != 0) + (void)0; // Skip string break; case C_LSTR: { - int string_id = *((int *)(&st->script->script_buf[st->pos])); - uint8 translations = *((uint8 *)(&st->script->script_buf[st->pos+sizeof(int)])); struct map_session_data *lsd = NULL; - - st->pos += sizeof(int) + sizeof(uint8); + uint8 translations = 0; + int string_id = *((int *)(&VECTOR_INDEX(st->script->script_buf, st->pos))); + st->pos += sizeof(string_id); + translations = *((uint8 *)(&VECTOR_INDEX(st->script->script_buf, st->pos))); + st->pos += sizeof(translations); if( (!st->rid || !(lsd = map->id2sd(st->rid)) || !lsd->lang_id) && !map->default_lang_id ) script->push_conststr(stack, script->string_list+string_id); @@ -4432,7 +4392,7 @@ void run_script_main(struct script_state *st) { int offset = st->pos; for(k = 0; k < translations; k++) { - uint8 lang_id = *(uint8 *)(&st->script->script_buf[offset]); + uint8 lang_id = *(uint8 *)(&VECTOR_INDEX(st->script->script_buf, offset)); offset += sizeof(uint8); if( lang_id == wlang_id ) break; @@ -4441,7 +4401,7 @@ void run_script_main(struct script_state *st) { if (k == translations) script->push_conststr(stack, script->string_list+string_id); else - script->push_conststr(stack, *(const char**)(&st->script->script_buf[offset]) ); + script->push_conststr(stack, *(const char**)(&VECTOR_INDEX(st->script->script_buf, offset))); } st->pos += ( ( sizeof(char*) + sizeof(uint8) ) * translations ); } @@ -4855,9 +4815,6 @@ void do_final_script(void) script->clear_translations(false); script->parser_clean_leftovers(); - - if( script->lang_export_file ) - aFree(script->lang_export_file); } /** @@ -4879,7 +4836,7 @@ void script_load_translations(void) { const char *config_filename = "db/translations.conf"; // FIXME hardcoded name struct config_setting_t *translations = NULL; int i, size; - uint32 total = 0; + int total = 0; uint8 lang_id = 0, k; if (map->minimal) // No translations in minimal mode @@ -4916,24 +4873,22 @@ void script_load_translations(void) { for(i = 0; i < size; i++) { const char *translation_file = libconfig->setting_get_string_elem(translations, i); - script->load_translation(translation_file, ++lang_id, &total); + total += script->load_translation(translation_file, ++lang_id); } libconfig->destroy(&translations_conf); - if( total ) { + if (total != 0) { struct DBIterator *main_iter; struct DBMap *string_db; struct string_translation *st = NULL; - uint32 j = 0; - CREATE(script->translation_buf, char *, total); - script->translation_buf_size = total; + VECTOR_ENSURE(script->translation_buf, total, 1); main_iter = db_iterator(script->translation_db); for (string_db = dbi_first(main_iter); dbi_exists(main_iter); string_db = dbi_next(main_iter)) { struct DBIterator *sub_iter = db_iterator(string_db); for (st = dbi_first(sub_iter); dbi_exists(sub_iter); st = dbi_next(sub_iter)) { - script->translation_buf[j++] = st->buf; + VECTOR_PUSH(script->translation_buf, st->buf); } dbi_destroy(sub_iter); } @@ -4955,47 +4910,69 @@ void script_load_translations(void) { } /** + * Generates a language name from a translation filename. * - **/ + * @param file The filename. + * @return The corresponding translation name. + */ const char *script_get_translation_file_name(const char *file) { - int i, len = (int)strlen(file), last_bar = -1, last_dot = -1; + const char *basename = NULL, *last_dot = NULL; + + nullpo_retr("Unknown", file); - for(i = 0; i < len; i++) { - if( file[i] == '/' || file[i] == '\\' ) - last_bar = i; - else if ( file[i] == '.' ) - last_dot = i; + basename = strrchr(file, '/');; +#ifdef WIN32 + { + const char *basename_windows = strrchr(file, '\\'); + if (basename_windows > basename) + basename = basename_windows; } +#endif // WIN32 + if (basename == NULL) + basename = file; + else + basename++; // Skip slash + Assert_retr("Unknown", *basename != '\0'); - if( last_bar != -1 || last_dot != -1 ) { + last_dot = strrchr(basename, '.'); + if (last_dot != NULL) { static char file_name[200]; - if( last_bar != -1 && last_dot < last_bar ) - last_dot = -1; - safestrncpy(file_name, file+(last_bar >= 0 ? last_bar+1 : 0), ( last_dot >= 0 ? ( last_bar >= 0 ? last_dot - last_bar : last_dot ) : sizeof(file_name) )); + if (last_dot == basename) + return basename + 1; + + safestrncpy(file_name, basename, last_dot - basename + 1); return file_name; } - return file; + return basename; } /** - * Parses a individual translation file - **/ -void script_load_translation(const char *file, uint8 lang_id, uint32 *total) { - uint32 translations = 0; + * Parses an individual translation file. + * + * @param file The filename to parse. + * @param lang_id The language identifier. + * @return The amount of strings loaded. + */ +int script_load_translation(const char *file, uint8 lang_id) +{ + int translations = 0; char line[1024]; char msgctxt[NAME_LENGTH*2+1] = { 0 }; struct DBMap *string_db; size_t i; FILE *fp; - struct script_string_buf msgid = { 0 }, msgstr = { 0 }; + struct script_string_buf msgid, msgstr; if( !(fp = fopen(file,"rb")) ) { ShowError("load_translation: failed to open '%s' for reading\n",file); - return; + return 0; } + VECTOR_INIT(msgid); + VECTOR_INIT(msgstr); + script->add_language(script->get_translation_file_name(file)); if( lang_id >= atcommand->max_message_table ) atcommand->expand_message_table(); @@ -5023,39 +5000,45 @@ void script_load_translation(const char *file, uint8 lang_id, uint32 *total) { } msgctxt[cursor] = '\0'; } else if ( strncasecmp(line, "msgid \"", 7) == 0 ) { - msgid.pos = 0; + VECTOR_TRUNCATE(msgid); for(i = 7; i < len - 2; i++) { + VECTOR_ENSURE(msgid, 1, 512); if( line[i] == '\\' && line[i+1] == '"' ) { - script_string_buf_addb(&msgid, '"'); + VECTOR_PUSH(msgid, '"'); i++; - } else - script_string_buf_addb(&msgid, line[i]); + } else { + VECTOR_PUSH(msgid, line[i]); + } } - script_string_buf_addb(&msgid,0); + VECTOR_ENSURE(msgid, 1, 512); + VECTOR_PUSH(msgid, '\0'); } else if ( len > 9 && line[9] != '"' && strncasecmp(line, "msgstr \"",8) == 0 ) { - msgstr.pos = 0; + VECTOR_TRUNCATE(msgstr); for(i = 8; i < len - 2; i++) { + VECTOR_ENSURE(msgstr, 1, 512); if( line[i] == '\\' && line[i+1] == '"' ) { - script_string_buf_addb(&msgstr, '"'); + VECTOR_PUSH(msgstr, '"'); i++; - } else - script_string_buf_addb(&msgstr, line[i]); + } else { + VECTOR_PUSH(msgstr, line[i]); + } } - script_string_buf_addb(&msgstr,0); + VECTOR_ENSURE(msgstr, 1, 512); + VECTOR_PUSH(msgstr, '\0'); } - if( msgctxt[0] && msgid.pos > 1 && msgstr.pos > 1 ) { - size_t msgstr_len = msgstr.pos; + if( msgctxt[0] && VECTOR_LENGTH(msgid) > 1 && VECTOR_LENGTH(msgstr) > 1 ) { + int msgstr_len = VECTOR_LENGTH(msgstr); unsigned int inner_len = 1 + (uint32)msgstr_len + 1; //uint8 lang_id + msgstr_len + '\0' if( strcasecmp(msgctxt, "messages.conf") == 0 ) { int k; for(k = 0; k < MAX_MSG; k++) { - if( atcommand->msg_table[0][k] && strcmpi(atcommand->msg_table[0][k],msgid.ptr) == 0 ) { + if( atcommand->msg_table[0][k] && strcmpi(atcommand->msg_table[0][k], VECTOR_DATA(msgid)) == 0 ) { if( atcommand->msg_table[lang_id][k] ) aFree(atcommand->msg_table[lang_id][k]); - atcommand->msg_table[lang_id][k] = aStrdup(msgstr.ptr); + atcommand->msg_table[lang_id][k] = aStrdup(VECTOR_DATA(msgstr)); break; } } @@ -5067,33 +5050,33 @@ void script_load_translation(const char *file, uint8 lang_id, uint32 *total) { strdb_put(script->translation_db, msgctxt, string_db); } - if( !(st = strdb_get(string_db, msgid.ptr) ) ) { + if ((st = strdb_get(string_db, VECTOR_DATA(msgid))) == NULL) { CREATE(st, struct string_translation, 1); - st->string_id = script->string_dup(msgid.ptr); - strdb_put(string_db, msgid.ptr, st); + st->string_id = script->string_dup(VECTOR_DATA(msgid)); + strdb_put(string_db, VECTOR_DATA(msgid), st); } - RECREATE(st->buf, char, st->len + inner_len); + RECREATE(st->buf, uint8, st->len + inner_len); WBUFB(st->buf, st->len) = lang_id; - safestrncpy(WBUFP(st->buf, st->len + 1), msgstr.ptr, msgstr_len + 1); + safestrncpy(WBUFP(st->buf, st->len + 1), VECTOR_DATA(msgstr), msgstr_len + 1); st->translations++; st->len += inner_len; } msgctxt[0] = '\0'; - msgid.pos = msgstr.pos = 0; + VECTOR_TRUNCATE(msgid); + VECTOR_TRUNCATE(msgstr); translations++; } } - *total += translations; - fclose(fp); - script_string_buf_destroy(&msgid); - script_string_buf_destroy(&msgstr); + VECTOR_CLEAR(msgid); + VECTOR_CLEAR(msgstr); - ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' translations in '"CL_WHITE"%s"CL_RESET"'.\n", translations, file); + ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' translations in '"CL_WHITE"%s"CL_RESET"'.\n", translations, file); + return translations; } /** @@ -5109,15 +5092,10 @@ void script_clear_translations(bool reload) { script->string_list_pos = 0; script->string_list_size = 0; - if( script->translation_buf ) { - for(i = 0; i < script->translation_buf_size; i++) { - aFree(script->translation_buf[i]); - } - aFree(script->translation_buf); + while (VECTOR_LENGTH(script->translation_buf) > 0) { + aFree(VECTOR_POP(script->translation_buf)); } - - script->translation_buf = NULL; - script->translation_buf_size = 0; + VECTOR_CLEAR(script->translation_buf); if( script->languages ) { for(i = 0; i < script->max_lang_id; i++) @@ -5159,26 +5137,16 @@ int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_lis /** * **/ -void script_parser_clean_leftovers(void) { - if( script->buf ) - aFree(script->buf); - - script->buf = NULL; - script->size = 0; +void script_parser_clean_leftovers(void) +{ + VECTOR_CLEAR(script->buf); if( script->translation_db ) { script->translation_db->destroy(script->translation_db,script->translation_db_destroyer); script->translation_db = NULL; } - if( script->syntax.strings ) { /* used only when generating translation file */ - db_destroy(script->syntax.strings); - script->syntax.strings = NULL; - } - - script_string_buf_destroy(&script->parse_simpleexpr_str); - script_string_buf_destroy(&script->lang_export_line_buf); - script_string_buf_destroy(&script->lang_export_unescaped_buf); + VECTOR_CLEAR(script->parse_simpleexpr_strbuf); } /** @@ -5197,6 +5165,7 @@ int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { *------------------------------------------*/ void do_init_script(bool minimal) { script->parse_cleanup_timer_id = INVALID_TIMER; + VECTOR_INIT(script->parse_simpleexpr_strbuf); script->st_db = idb_alloc(DB_OPT_BASE); script->userfunc_db = strdb_alloc(DB_OPT_DUP_KEY,0); @@ -5283,6 +5252,232 @@ const char *script_getfuncname(struct script_state *st) { return NULL; } +/** + * Writes a string to a StringBuf by combining a format string and a set of + * arguments taken from the current script state (caller script function + * arguments). + * + * @param[in] st Script state (must have at least a string at index + * 'start'). + * @param[in] start Index of the format string argument. + * @param[out] out Output string buffer (managed by the caller, must be + * already initialized) + * @retval false if an error occurs. + */ +bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) +{ + const char *format = NULL; + const char *p = NULL, *np = NULL; + char *buf = NULL; + int buf_len = 0; + int lastarg = start; + int argc = script_lastdata(st) + 1; + + Assert_retr(-1, start >= 2 && start <= argc); + Assert_retr(-1, script_hasdata(st, start)); + + p = format = script_getstr(st, start); + + /* + * format-string = "" / *(text / placeholder) + * placeholder = "%%" / "%n" / std-placeholder + * std-placeholder = "%" [pos-parameter] [flags] [width] [precision] [length] type + * pos-parameter = number "$" + * flags = *("-" / "+" / "0" / SP) + * width = number / ("*" [pos-parameter]) + * precision = "." (number / ("*" [pos-parameter])) + * length = "hh" / "h" / "l" / "ll" / "L" / "z" / "j" / "t" + * type = "d" / "i" / "u" / "f" / "F" / "e" / "E" / "g" / "G" / "x" / "X" / "o" / "s" / "c" / "p" / "a" / "A" + * number = digit-nonzero *DIGIT + * digit-nonzero = "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" + */ + + while ((np = strchr(p, '%')) != NULL) { + bool flag_plus = false, flag_minus = false, flag_zero = false, flag_space = false; + bool positional_arg = false; + int width = 0, nextarg = lastarg + 1, thisarg = nextarg; + + if (p != np) { + int len = (int)(np - p + 1); + if (buf_len < len) { + RECREATE(buf, char, len); + buf_len = len; + } + safestrncpy(buf, p, len); + StrBuf->AppendStr(out, buf); + } + + p = np; + np++; + + // placeholder = "%%" ; (special case) + if (*np == '%') { + StrBuf->AppendStr(out, "%"); + p = np + 1; + continue; + } + // placeholder = "%n" ; (ignored) + if (*np == 'n') { + ShowWarning("script_sprintf: Format %%n not supported! Skipping...\n"); + script->reportsrc(st); + lastarg = nextarg; + p = np + 1; + continue; + } + + // std-placeholder = "%" [pos-parameter] [flags] [width] [precision] [length] type + + // pos-parameter = number "$" + if (ISDIGIT(*np) && *np != '0') { + const char *pp = np; + while (ISDIGIT(*pp)) + pp++; + if (*pp == '$') { + thisarg = atoi(np) + start; + positional_arg = true; + np = pp + 1; + } + } + + if (thisarg >= argc) { + ShowError("buildin_sprintf: Not enough arguments passed!\n"); + if (buf != NULL) + aFree(buf); + return false; + } + + // flags = *("-" / "+" / "0" / SP) + while (true) { + if (*np == '-') { + flag_minus = true; + } else if (*np == '+') { + flag_plus = true; + } else if (*np == ' ') { + flag_space = true; + } else if (*np == '0') { + flag_zero = true; + } else { + break; + } + np++; + } + + // width = number / ("*" [pos-parameter]) + if (ISDIGIT(*np)) { + width = atoi(np); + while (ISDIGIT(*np)) + np++; + } else if (*np == '*') { + bool positional_widtharg = false; + int width_arg; + np++; + // pos-parameter = number "$" + if (ISDIGIT(*np) && *np != '0') { + const char *pp = np; + while (ISDIGIT(*pp)) + pp++; + if (*pp == '$') { + width_arg = atoi(np) + start; + positional_widtharg = true; + np = pp + 1; + } + } + if (!positional_widtharg) { + width_arg = nextarg; + nextarg++; + if (!positional_arg) + thisarg++; + } + + if (width_arg >= argc || thisarg >= argc) { + ShowError("buildin_sprintf: Not enough arguments passed!\n"); + if (buf != NULL) + aFree(buf); + return false; + } + width = script_getnum(st, width_arg); + } + + // precision = "." (number / ("*" [pos-parameter])) ; (not needed/implemented) + + // length = "hh" / "h" / "l" / "ll" / "L" / "z" / "j" / "t" ; (not needed/implemented) + + // type = "d" / "i" / "u" / "f" / "F" / "e" / "E" / "g" / "G" / "x" / "X" / "o" / "s" / "c" / "p" / "a" / "A" + if (buf_len < 16) { + RECREATE(buf, char, 16); + buf_len = 16; + } + { + int i = 0; + memset(buf, '\0', buf_len); + buf[i++] = '%'; + if (flag_minus) + buf[i++] = '-'; + if (flag_plus) + buf[i++] = '+'; + else if (flag_space) // ignored if '+' is specified + buf[i++] = ' '; + if (flag_zero) + buf[i++] = '0'; + if (width > 0) + safesnprintf(buf + i, buf_len - i - 1, "%d", width); + } + buf[(int)strlen(buf)] = *np; + switch (*np) { + case 'd': + case 'i': + case 'u': + case 'x': + case 'X': + case 'o': + // Piggyback printf + StrBuf->Printf(out, buf, script_getnum(st, thisarg)); + break; + case 's': + // Piggyback printf + StrBuf->Printf(out, buf, script_getstr(st, thisarg)); + break; + case 'c': + { + const char *str = script_getstr(st, thisarg); + // Piggyback printf + StrBuf->Printf(out, buf, str[0]); + } + break; + case 'f': + case 'F': + case 'e': + case 'E': + case 'g': + case 'G': + case 'p': + case 'a': + case 'A': + ShowWarning("buildin_sprintf: Format %%%c not supported! Skipping...\n", *np); + script->reportsrc(st); + lastarg = nextarg; + p = np + 1; + continue; + default: + ShowError("buildin_sprintf: Invalid format string.\n"); + if (buf != NULL) + aFree(buf); + return false; + } + lastarg = nextarg; + p = np + 1; + } + + // Append the remaining part + if (p != NULL) + StrBuf->AppendStr(out, p); + + if (buf != NULL) + aFree(buf); + + return true; +} + //----------------------------------------------------------------------------- // buildin functions // @@ -5298,20 +5493,42 @@ const char *script_getfuncname(struct script_state *st) { BUILDIN(mes) { struct map_session_data *sd = script->rid2sd(st); - if( sd == NULL ) + if (sd == NULL) return true; - if( !script_hasdata(st, 3) ) {// only a single line detected in the script - clif->scriptmes(sd, st->oid, script_getstr(st, 2)); - } else {// parse multiple lines as they exist - int i; + clif->scriptmes(sd, st->oid, script_getstr(st, 2)); - for( i = 2; script_hasdata(st, i); i++ ) { - // send the message to the client - clif->scriptmes(sd, st->oid, script_getstr(st, i)); - } + return true; +} + +/** + * Appends a message to the npc dialog, applying format string conversions (see + * sprintf). + * + * If a dialog doesn't exist yet, one is created. + * + * @code + * mes "<message>"; + * @endcode + */ +BUILDIN(mesf) +{ + struct map_session_data *sd = script->rid2sd(st); + struct StringBuf buf; + + if (sd == NULL) + return true; + + StrBuf->Init(&buf); + + if (!script_sprintf(st, 2, &buf)) { + StrBuf->Destroy(&buf); + return false; } + clif->scriptmes(sd, st->oid, StrBuf->Value(&buf)); + StrBuf->Destroy(&buf); + return true; } @@ -15242,130 +15459,19 @@ BUILDIN(implode) // Implements C sprintf, except format %n. The resulting string is // returned, instead of being saved in variable by reference. //------------------------------------------------------- -BUILDIN(sprintf) { - unsigned int argc = 0, arg = 0; - const char* format; - char* p; - char* q; - char* buf = NULL; - char* buf2 = NULL; - struct script_data* data; - size_t len, buf2_len = 0; - StringBuf final_buf; - - // Fetch init data - format = script_getstr(st, 2); - argc = script_lastdata(st)-2; - len = strlen(format); - - // Skip parsing, where no parsing is required. - if(len==0) { - script_pushconststr(st,""); - return true; - } - - // Pessimistic alloc - CREATE(buf, char, len+1); - - // Need not be parsed, just solve stuff like %%. - if(argc==0) { - memcpy(buf,format,len+1); - script_pushstrcopy(st, buf); - aFree(buf); - return true; - } - - safestrncpy(buf, format, len+1); - - // Issue sprintf for each parameter - StrBuf->Init(&final_buf); - q = buf; - while((p = strchr(q, '%'))!=NULL) { - if(p!=q) { - len = p-q+1; - if(buf2_len<len) { - RECREATE(buf2, char, len); - buf2_len = len; - } - safestrncpy(buf2, q, len); - StrBuf->AppendStr(&final_buf, buf2); - q = p; - } - p = q+1; - if(*p=='%') { // %% - StrBuf->AppendStr(&final_buf, "%"); - q+=2; - continue; - } - if(*p=='n') { // %n - ShowWarning("buildin_sprintf: Format %%n not supported! Skipping...\n"); - script->reportsrc(st); - q+=2; - continue; - } - if(arg>=argc) { - ShowError("buildin_sprintf: Not enough arguments passed!\n"); - aFree(buf); - if(buf2) aFree(buf2); - StrBuf->Destroy(&final_buf); - script_pushconststr(st,""); - return false; - } - if((p = strchr(q+1, '%'))==NULL) { - p = strchr(q, 0); // EOS - } - len = p-q+1; - if(buf2_len<len) { - RECREATE(buf2, char, len); - buf2_len = len; - } - safestrncpy(buf2, q, len); - q = p; - - // Note: This assumes the passed value being the correct - // type to the current format specifier. If not, the server - // probably crashes or returns anything else, than expected, - // but it would behave in normal code the same way so it's - // the scripter's responsibility. - data = script_getdata(st, arg+3); - if(data_isstring(data)) { // String - StrBuf->Printf(&final_buf, buf2, script_getstr(st, arg+3)); - } else if(data_isint(data)) { // Number - StrBuf->Printf(&final_buf, buf2, script_getnum(st, arg+3)); - } else if(data_isreference(data)) { // Variable - char* name = reference_getname(data); - if(name[strlen(name)-1]=='$') { // var Str - StrBuf->Printf(&final_buf, buf2, script_getstr(st, arg+3)); - } else { // var Int - StrBuf->Printf(&final_buf, buf2, script_getnum(st, arg+3)); - } - } else { // Unsupported type - ShowError("buildin_sprintf: Unknown argument type!\n"); - aFree(buf); - if(buf2) aFree(buf2); - StrBuf->Destroy(&final_buf); - script_pushconststr(st,""); - return false; - } - arg++; - } - - // Append anything left - if(*q) { - StrBuf->AppendStr(&final_buf, q); - } +BUILDIN(sprintf) +{ + struct StringBuf buf; + StrBuf->Init(&buf); - // Passed more, than needed - if(arg<argc) { - ShowWarning("buildin_sprintf: Unused arguments passed.\n"); - script->reportsrc(st); + if (!script_sprintf(st, 2, &buf)) { + StrBuf->Destroy(&buf); + script_pushconststr(st, ""); + return false; } - script_pushstrcopy(st, StrBuf->Value(&final_buf)); - - aFree(buf); - if(buf2) aFree(buf2); - StrBuf->Destroy(&final_buf); + script_pushstrcopy(st, StrBuf->Value(&buf)); + StrBuf->Destroy(&buf); return true; } @@ -20214,8 +20320,10 @@ bool script_add_builtin(const struct script_function *buildin, bool override) { else if( strcmp(buildin->name, "callfunc") == 0 ) script->buildin_callfunc_ref = n; else if( strcmp(buildin->name, "getelementofarray") == 0 ) script->buildin_getelementofarray_ref = n; else if( strcmp(buildin->name, "mes") == 0 ) script->buildin_mes_offset = script->buildin_count; + else if( strcmp(buildin->name, "mesf") == 0 ) script->buildin_mesf_offset = script->buildin_count; else if( strcmp(buildin->name, "select") == 0 ) script->buildin_select_offset = script->buildin_count; else if( strcmp(buildin->name, "_") == 0 ) script->buildin_lang_macro_offset = script->buildin_count; + else if( strcmp(buildin->name, "_$") == 0 ) script->buildin_lang_macro_fmtstring_offset = script->buildin_count; offset = script->buildin_count; @@ -20309,7 +20417,8 @@ void script_parse_builtin(void) { BUILDIN_DEF(__setr,"rv?"), // NPC interaction - BUILDIN_DEF(mes,"s*"), + BUILDIN_DEF(mes,"s"), + BUILDIN_DEF(mesf,"s*"), BUILDIN_DEF(next,""), BUILDIN_DEF(close,""), BUILDIN_DEF(close2,""), @@ -20821,6 +20930,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(showscript, "s?"), BUILDIN_DEF(mergeitem,""), BUILDIN_DEF(_,"s"), + BUILDIN_DEF2(_, "_$", "s"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up @@ -21054,8 +21164,8 @@ void script_defaults(void) { script->label_count = 0; script->labels_size = 0; - script->buf = NULL; - script->pos = 0, script->size = 0; + VECTOR_INIT(script->buf); + VECTOR_INIT(script->translation_buf); script->parse_options = 0; script->buildin_set_ref = 0; @@ -21181,6 +21291,11 @@ void script_defaults(void) { script->parse_nextline = parse_nextline; script->parse_variable = parse_variable; script->parse_simpleexpr = parse_simpleexpr; + script->parse_simpleexpr_paren = parse_simpleexpr_paren; + script->parse_simpleexpr_number = parse_simpleexpr_number; + script->parse_simpleexpr_string = parse_simpleexpr_string; + script->parse_simpleexpr_name = parse_simpleexpr_name; + script->add_translatable_string = script_add_translatable_string; script->parse_expr = parse_expr; script->parse_line = parse_line; script->read_constdb = read_constdb; diff --git a/src/map/script.h b/src/map/script.h index a1fbe31f0..61c6a4583 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -394,11 +394,20 @@ struct script_data { struct reg_db *ref; ///< Reference to the scope's variables }; +/** + * A script string buffer, used to hold strings used by the script engine. + */ +VECTOR_STRUCT_DECL(script_string_buf, char); + +/** + * Script buffer, used to hold parsed script data. + */ +VECTOR_STRUCT_DECL(script_buf, unsigned char); + // Moved defsp from script_state to script_stack since // it must be saved when script state is RERUNLINE. [Eoe / jA 1094] struct script_code { - int script_size; - unsigned char *script_buf; + struct script_buf script_buf; struct reg_db local; ///< Local (npc) vars unsigned short instances; }; @@ -493,8 +502,8 @@ struct script_syntax_data { int index; // Number of the syntax used in the script int last_func; // buildin index of the last parsed function unsigned int nested_call; //Dont really know what to call this - bool lang_macro_active; - struct DBMap *strings; // string map parsed (used when exporting strings only) + bool lang_macro_active; // Used to generate translation strings + bool lang_macro_fmtstring_active; // Used to generate translation strings struct DBMap *translation_db; //non-null if this npc has any translated strings to be linked }; @@ -517,16 +526,16 @@ struct script_array { unsigned int *members;/* member list */ }; -struct script_string_buf { - char *ptr; - size_t pos,size; +struct string_translation_entry { + uint8 lang_id; + char string[]; }; struct string_translation { int string_id; uint8 translations; - unsigned int len; - char *buf; + int len; + uint8 *buf; // Array of struct string_translation_entry }; /** @@ -576,8 +585,7 @@ struct script_interface { /* */ /// temporary buffer for passing around compiled bytecode /// @see add_scriptb, set_label, parse_script - unsigned char* buf; - int pos, size; + struct script_buf buf; /* */ struct script_syntax_data syntax; /* */ @@ -611,26 +619,22 @@ struct script_interface { /* */ unsigned int *generic_ui_array; unsigned int generic_ui_array_size; - /* Set during startup when attempting to export the lang, unset after server initialization is over */ - FILE *lang_export_fp; - char *lang_export_file;/* for lang_export_fp */ /* set and unset on npc_parse_script */ const char *parser_current_npc_name; /* */ int buildin_mes_offset; + int buildin_mesf_offset; int buildin_select_offset; int buildin_lang_macro_offset; + int buildin_lang_macro_fmtstring_offset; /* */ struct DBMap *translation_db;/* npc_name => DBMap (strings) */ - char **translation_buf;/* */ - uint32 translation_buf_size; + VECTOR_DECL(uint8 *) translation_buf; /* */ char **languages; uint8 max_lang_id; /* */ - struct script_string_buf parse_simpleexpr_str; - struct script_string_buf lang_export_line_buf; - struct script_string_buf lang_export_unescaped_buf; + struct script_string_buf parse_simpleexpr_strbuf; /* */ int parse_cleanup_timer_id; /* */ @@ -706,8 +710,8 @@ struct script_interface { const char * (*parse_syntax_close) (const char *p); const char * (*parse_syntax_close_sub) (const char *p, int *flag); const char * (*parse_syntax) (const char *p); - c_op (*get_com) (unsigned char *scriptbuf, int *pos); - int (*get_num) (unsigned char *scriptbuf, int *pos); + c_op (*get_com) (const struct script_buf *scriptbuf, int *pos); + int (*get_num) (const struct script_buf *scriptbuf, int *pos); const char* (*op2name) (int op); void (*reportsrc) (struct script_state *st); void (*reportdata) (struct script_data *data); @@ -724,10 +728,15 @@ struct script_interface { int (*add_word) (const char *p); const char* (*parse_callfunc) (const char *p, int require_paren, int is_custom); void (*parse_nextline) (bool first, const char *p); - const char* (*parse_variable) (const char *p); - const char* (*parse_simpleexpr) (const char *p); - const char* (*parse_expr) (const char *p); - const char* (*parse_line) (const char *p); + const char *(*parse_variable) (const char *p); + const char *(*parse_simpleexpr) (const char *p); + const char *(*parse_simpleexpr_paren) (const char *p); + const char *(*parse_simpleexpr_number) (const char *p); + const char *(*parse_simpleexpr_string) (const char *p); + const char *(*parse_simpleexpr_name) (const char *p); + void (*add_translatable_string) (const struct script_string_buf *string, const char *start_point); + const char *(*parse_expr) (const char *p); + const char *(*parse_line) (const char *p); void (*read_constdb) (void); void (*constdb_comment) (const char *comment); void (*load_parameters) (void); @@ -807,7 +816,7 @@ struct script_interface { unsigned short (*mapindexname2id) (struct script_state *st, const char* name); int (*string_dup) (char *str); void (*load_translations) (void); - void (*load_translation) (const char *file, uint8 lang_id, uint32 *total); + int (*load_translation) (const char *file, uint8 lang_id); int (*translation_db_destroyer) (union DBKey key, struct DBData *data, va_list ap); void (*clear_translations) (bool reload); int (*parse_cleanup_timer) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 65bc2bd82..8a6f34e2e 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -5796,10 +5796,10 @@ typedef const char* (*HPMHOOK_pre_script_parse_syntax_close_sub) (const char **p typedef const char* (*HPMHOOK_post_script_parse_syntax_close_sub) (const char* retVal___, const char *p, int *flag); typedef const char* (*HPMHOOK_pre_script_parse_syntax) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_syntax) (const char* retVal___, const char *p); -typedef c_op (*HPMHOOK_pre_script_get_com) (unsigned char **scriptbuf, int **pos); -typedef c_op (*HPMHOOK_post_script_get_com) (c_op retVal___, unsigned char *scriptbuf, int *pos); -typedef int (*HPMHOOK_pre_script_get_num) (unsigned char **scriptbuf, int **pos); -typedef int (*HPMHOOK_post_script_get_num) (int retVal___, unsigned char *scriptbuf, int *pos); +typedef c_op (*HPMHOOK_pre_script_get_com) (const struct script_buf **scriptbuf, int **pos); +typedef c_op (*HPMHOOK_post_script_get_com) (c_op retVal___, const struct script_buf *scriptbuf, int *pos); +typedef int (*HPMHOOK_pre_script_get_num) (const struct script_buf **scriptbuf, int **pos); +typedef int (*HPMHOOK_post_script_get_num) (int retVal___, const struct script_buf *scriptbuf, int *pos); typedef const char* (*HPMHOOK_pre_script_op2name) (int *op); typedef const char* (*HPMHOOK_post_script_op2name) (const char* retVal___, int op); typedef void (*HPMHOOK_pre_script_reportsrc) (struct script_state **st); @@ -5836,6 +5836,16 @@ typedef const char* (*HPMHOOK_pre_script_parse_variable) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_variable) (const char* retVal___, const char *p); typedef const char* (*HPMHOOK_pre_script_parse_simpleexpr) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_simpleexpr) (const char* retVal___, const char *p); +typedef const char* (*HPMHOOK_pre_script_parse_simpleexpr_paren) (const char **p); +typedef const char* (*HPMHOOK_post_script_parse_simpleexpr_paren) (const char* retVal___, const char *p); +typedef const char* (*HPMHOOK_pre_script_parse_simpleexpr_number) (const char **p); +typedef const char* (*HPMHOOK_post_script_parse_simpleexpr_number) (const char* retVal___, const char *p); +typedef const char* (*HPMHOOK_pre_script_parse_simpleexpr_string) (const char **p); +typedef const char* (*HPMHOOK_post_script_parse_simpleexpr_string) (const char* retVal___, const char *p); +typedef const char* (*HPMHOOK_pre_script_parse_simpleexpr_name) (const char **p); +typedef const char* (*HPMHOOK_post_script_parse_simpleexpr_name) (const char* retVal___, const char *p); +typedef void (*HPMHOOK_pre_script_add_translatable_string) (const struct script_string_buf **string, const char **start_point); +typedef void (*HPMHOOK_post_script_add_translatable_string) (const struct script_string_buf *string, const char *start_point); typedef const char* (*HPMHOOK_pre_script_parse_expr) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_expr) (const char* retVal___, const char *p); typedef const char* (*HPMHOOK_pre_script_parse_line) (const char **p); @@ -5978,8 +5988,8 @@ typedef int (*HPMHOOK_pre_script_string_dup) (char **str); typedef int (*HPMHOOK_post_script_string_dup) (int retVal___, char *str); typedef void (*HPMHOOK_pre_script_load_translations) (void); typedef void (*HPMHOOK_post_script_load_translations) (void); -typedef void (*HPMHOOK_pre_script_load_translation) (const char **file, uint8 *lang_id, uint32 **total); -typedef void (*HPMHOOK_post_script_load_translation) (const char *file, uint8 lang_id, uint32 *total); +typedef int (*HPMHOOK_pre_script_load_translation) (const char **file, uint8 *lang_id); +typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *file, uint8 lang_id); typedef int (*HPMHOOK_pre_script_translation_db_destroyer) (union DBKey *key, struct DBData **data, va_list ap); typedef int (*HPMHOOK_post_script_translation_db_destroyer) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef void (*HPMHOOK_pre_script_clear_translations) (bool *reload); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 5c2ead5ef..776099871 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4672,6 +4672,16 @@ struct { struct HPMHookPoint *HP_script_parse_variable_post; struct HPMHookPoint *HP_script_parse_simpleexpr_pre; struct HPMHookPoint *HP_script_parse_simpleexpr_post; + struct HPMHookPoint *HP_script_parse_simpleexpr_paren_pre; + struct HPMHookPoint *HP_script_parse_simpleexpr_paren_post; + struct HPMHookPoint *HP_script_parse_simpleexpr_number_pre; + struct HPMHookPoint *HP_script_parse_simpleexpr_number_post; + struct HPMHookPoint *HP_script_parse_simpleexpr_string_pre; + struct HPMHookPoint *HP_script_parse_simpleexpr_string_post; + struct HPMHookPoint *HP_script_parse_simpleexpr_name_pre; + struct HPMHookPoint *HP_script_parse_simpleexpr_name_post; + struct HPMHookPoint *HP_script_add_translatable_string_pre; + struct HPMHookPoint *HP_script_add_translatable_string_post; struct HPMHookPoint *HP_script_parse_expr_pre; struct HPMHookPoint *HP_script_parse_expr_post; struct HPMHookPoint *HP_script_parse_line_pre; @@ -10575,6 +10585,16 @@ struct { int HP_script_parse_variable_post; int HP_script_parse_simpleexpr_pre; int HP_script_parse_simpleexpr_post; + int HP_script_parse_simpleexpr_paren_pre; + int HP_script_parse_simpleexpr_paren_post; + int HP_script_parse_simpleexpr_number_pre; + int HP_script_parse_simpleexpr_number_post; + int HP_script_parse_simpleexpr_string_pre; + int HP_script_parse_simpleexpr_string_post; + int HP_script_parse_simpleexpr_name_pre; + int HP_script_parse_simpleexpr_name_post; + int HP_script_add_translatable_string_pre; + int HP_script_add_translatable_string_post; int HP_script_parse_expr_pre; int HP_script_parse_expr_post; int HP_script_parse_line_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 77ee32f2f..573ef06c5 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2391,6 +2391,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->parse_nextline, HP_script_parse_nextline) }, { HP_POP(script->parse_variable, HP_script_parse_variable) }, { HP_POP(script->parse_simpleexpr, HP_script_parse_simpleexpr) }, + { HP_POP(script->parse_simpleexpr_paren, HP_script_parse_simpleexpr_paren) }, + { HP_POP(script->parse_simpleexpr_number, HP_script_parse_simpleexpr_number) }, + { HP_POP(script->parse_simpleexpr_string, HP_script_parse_simpleexpr_string) }, + { HP_POP(script->parse_simpleexpr_name, HP_script_parse_simpleexpr_name) }, + { HP_POP(script->add_translatable_string, HP_script_add_translatable_string) }, { HP_POP(script->parse_expr, HP_script_parse_expr) }, { HP_POP(script->parse_line, HP_script_parse_line) }, { HP_POP(script->read_constdb, HP_script_read_constdb) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 48fae567f..dc4df803c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -61773,11 +61773,11 @@ const char* HP_script_parse_syntax(const char *p) { } return retVal___; } -c_op HP_script_get_com(unsigned char *scriptbuf, int *pos) { +c_op HP_script_get_com(const struct script_buf *scriptbuf, int *pos) { int hIndex = 0; c_op retVal___ = C_NOP; if( HPMHooks.count.HP_script_get_com_pre ) { - c_op (*preHookFunc) (unsigned char **scriptbuf, int **pos); + c_op (*preHookFunc) (const struct script_buf **scriptbuf, int **pos); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_com_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_script_get_com_pre[hIndex].func; @@ -61792,7 +61792,7 @@ c_op HP_script_get_com(unsigned char *scriptbuf, int *pos) { retVal___ = HPMHooks.source.script.get_com(scriptbuf, pos); } if( HPMHooks.count.HP_script_get_com_post ) { - c_op (*postHookFunc) (c_op retVal___, unsigned char *scriptbuf, int *pos); + c_op (*postHookFunc) (c_op retVal___, const struct script_buf *scriptbuf, int *pos); for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_com_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_script_get_com_post[hIndex].func; retVal___ = postHookFunc(retVal___, scriptbuf, pos); @@ -61800,11 +61800,11 @@ c_op HP_script_get_com(unsigned char *scriptbuf, int *pos) { } return retVal___; } -int HP_script_get_num(unsigned char *scriptbuf, int *pos) { +int HP_script_get_num(const struct script_buf *scriptbuf, int *pos) { int hIndex = 0; int retVal___ = 0; if( HPMHooks.count.HP_script_get_num_pre ) { - int (*preHookFunc) (unsigned char **scriptbuf, int **pos); + int (*preHookFunc) (const struct script_buf **scriptbuf, int **pos); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_num_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_script_get_num_pre[hIndex].func; @@ -61819,7 +61819,7 @@ int HP_script_get_num(unsigned char *scriptbuf, int *pos) { retVal___ = HPMHooks.source.script.get_num(scriptbuf, pos); } if( HPMHooks.count.HP_script_get_num_post ) { - int (*postHookFunc) (int retVal___, unsigned char *scriptbuf, int *pos); + int (*postHookFunc) (int retVal___, const struct script_buf *scriptbuf, int *pos); for(hIndex = 0; hIndex < HPMHooks.count.HP_script_get_num_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_script_get_num_post[hIndex].func; retVal___ = postHookFunc(retVal___, scriptbuf, pos); @@ -62302,6 +62302,140 @@ const char* HP_script_parse_simpleexpr(const char *p) { } return retVal___; } +const char* HP_script_parse_simpleexpr_paren(const char *p) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_script_parse_simpleexpr_paren_pre ) { + const char* (*preHookFunc) (const char **p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_paren_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_paren_pre[hIndex].func; + retVal___ = preHookFunc(&p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_simpleexpr_paren(p); + } + if( HPMHooks.count.HP_script_parse_simpleexpr_paren_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_paren_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_paren_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +const char* HP_script_parse_simpleexpr_number(const char *p) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_script_parse_simpleexpr_number_pre ) { + const char* (*preHookFunc) (const char **p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_number_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_number_pre[hIndex].func; + retVal___ = preHookFunc(&p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_simpleexpr_number(p); + } + if( HPMHooks.count.HP_script_parse_simpleexpr_number_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_number_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_number_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +const char* HP_script_parse_simpleexpr_string(const char *p) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_script_parse_simpleexpr_string_pre ) { + const char* (*preHookFunc) (const char **p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_string_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_string_pre[hIndex].func; + retVal___ = preHookFunc(&p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_simpleexpr_string(p); + } + if( HPMHooks.count.HP_script_parse_simpleexpr_string_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_string_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_string_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +const char* HP_script_parse_simpleexpr_name(const char *p) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_script_parse_simpleexpr_name_pre ) { + const char* (*preHookFunc) (const char **p); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_name_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_name_pre[hIndex].func; + retVal___ = preHookFunc(&p); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_simpleexpr_name(p); + } + if( HPMHooks.count.HP_script_parse_simpleexpr_name_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *p); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_simpleexpr_name_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_parse_simpleexpr_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p); + } + } + return retVal___; +} +void HP_script_add_translatable_string(const struct script_string_buf *string, const char *start_point) { + int hIndex = 0; + if( HPMHooks.count.HP_script_add_translatable_string_pre ) { + void (*preHookFunc) (const struct script_string_buf **string, const char **start_point); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_add_translatable_string_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_add_translatable_string_pre[hIndex].func; + preHookFunc(&string, &start_point); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.add_translatable_string(string, start_point); + } + if( HPMHooks.count.HP_script_add_translatable_string_post ) { + void (*postHookFunc) (const struct script_string_buf *string, const char *start_point); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_add_translatable_string_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_add_translatable_string_post[hIndex].func; + postHookFunc(string, start_point); + } + } + return; +} const char* HP_script_parse_expr(const char *p) { int hIndex = 0; const char* retVal___ = NULL; @@ -64326,31 +64460,32 @@ void HP_script_load_translations(void) { } return; } -void HP_script_load_translation(const char *file, uint8 lang_id, uint32 *total) { +int HP_script_load_translation(const char *file, uint8 lang_id) { int hIndex = 0; + int retVal___ = 0; if( HPMHooks.count.HP_script_load_translation_pre ) { - void (*preHookFunc) (const char **file, uint8 *lang_id, uint32 **total); + int (*preHookFunc) (const char **file, uint8 *lang_id); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_script_load_translation_pre[hIndex].func; - preHookFunc(&file, &lang_id, &total); + retVal___ = preHookFunc(&file, &lang_id); } if( *HPMforce_return ) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.script.load_translation(file, lang_id, total); + retVal___ = HPMHooks.source.script.load_translation(file, lang_id); } if( HPMHooks.count.HP_script_load_translation_post ) { - void (*postHookFunc) (const char *file, uint8 lang_id, uint32 *total); + int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id); for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_script_load_translation_post[hIndex].func; - postHookFunc(file, lang_id, total); + retVal___ = postHookFunc(retVal___, file, lang_id); } } - return; + return retVal___; } int HP_script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) { int hIndex = 0; diff --git a/src/plugins/generate-translations.c b/src/plugins/generate-translations.c new file mode 100644 index 000000000..50a0f162c --- /dev/null +++ b/src/plugins/generate-translations.c @@ -0,0 +1,256 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016 Hercules Dev Team + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "config/core.h" + +#include "common/hercules.h" +#include "common/cbasetypes.h" +#include "common/memmgr.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "map/atcommand.h" +#include "map/map.h" +#include "map/script.h" + +#include "plugins/HPMHooking.h" +#include "common/HPMDataCheck.h" + +#include <stdio.h> +#include <stdlib.h> + +HPExport struct hplugin_info pinfo = { + "generate-translations", // Plugin name + SERVER_TYPE_MAP, // Which server types this plugin works with? + "0.1", // Plugin version + HPM_VERSION, // HPM Version (don't change, macro is automatically updated) +}; + +struct DBMap *translatable_strings; // string map parsed (used when exporting strings only) +/* Set during startup when attempting to export the lang, unset after server initialization is over */ +FILE *lang_export_fp; +char *lang_export_file;/* for lang_export_fp */ +struct script_string_buf lang_export_line_buf; +struct script_string_buf lang_export_escaped_buf; + +/// Whether the translations template generator will automatically run. +bool generating_translations = false; + +/** + * --generate-translations + * + * Creates "./generated_translations.pot" + * @see cmdline->exec + */ +CMDLINEARG(generatetranslations) +{ + lang_export_file = aStrdup("./generated_translations.pot"); + + if ((lang_export_fp = fopen(lang_export_file, "wb")) == NULL) { + ShowError("export-dialog: failed to open '%s' for writing\n", lang_export_file); + } else { + time_t t = time(NULL); + struct tm *lt = localtime(&t); + int year = lt->tm_year+1900; + fprintf(lang_export_fp, + "# This file is part of Hercules.\n" + "# http://herc.ws - http://github.com/HerculesWS/Hercules\n" + "#\n" + "# Copyright (C) 2013-%d Hercules Dev Team\n" + "#\n" + "# Hercules is free software: you can redistribute it and/or modify\n" + "# it under the terms of the GNU General Public License as published by\n" + "# the Free Software Foundation, either version 3 of the License, or\n" + "# (at your option) any later version.\n" + "#\n" + "# This program is distributed in the hope that it will be useful,\n" + "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "# GNU General Public License for more details.\n" + "#\n" + "# You should have received a copy of the GNU General Public License\n" + "# along with this program. If not, see <http://www.gnu.org/licenses/>.\n", + year); + } + generating_translations = true; + return true; +} + +void script_add_translatable_string_posthook(const struct script_string_buf *string, const char *start_point) +{ + bool duplicate = true; + bool is_translatable_string = false; + bool is_translatable_fmtstring = false; + + if (!generating_translations || lang_export_fp == NULL) + return; + + /* When exporting we don't know what is a translation and what isn't */ + if (VECTOR_LENGTH(*string) > 1) { + // The length of *string will always be at least 1 because of the '\0' + if (translatable_strings == NULL) { + translatable_strings = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA, 0); + } + + if (!strdb_exists(translatable_strings, VECTOR_DATA(*string))) { + strdb_put(translatable_strings, VECTOR_DATA(*string), NULL); + duplicate = false; + } + } + + if (!duplicate) { + if (script->syntax.last_func == script->buildin_mes_offset + || script->syntax.last_func == script->buildin_select_offset + || script->syntax.lang_macro_active + ) { + is_translatable_string = true; + } else if (script->syntax.last_func == script->buildin_mesf_offset + || script->syntax.lang_macro_fmtstring_active + ) { + is_translatable_fmtstring = true; + } + } + + if (is_translatable_string || is_translatable_fmtstring) { + const char *line_start = start_point; + const char *line_end = start_point; + int line_length; + bool has_percent_sign = false; + + if (!is_translatable_fmtstring && strchr(VECTOR_DATA(*string), '%') != NULL) { + has_percent_sign = true; + } + + while (line_start > script->parser_current_src && *line_start != '\n') + line_start--; + + while (*line_end != '\n' && *line_end != '\0') + line_end++; + + line_length = (int)(line_end - line_start); + if (line_length > 0) { + VECTOR_ENSURE(lang_export_line_buf, line_length + 1, 512); + VECTOR_PUSHARRAY(lang_export_line_buf, line_start, line_length); + VECTOR_PUSH(lang_export_line_buf, '\0'); + + normalize_name(VECTOR_DATA(lang_export_line_buf), "\r\n\t "); // [!] Note: VECTOR_LENGTH() will lie. + } + + VECTOR_ENSURE(lang_export_escaped_buf, 4*VECTOR_LENGTH(*string)+1, 1); + VECTOR_LENGTH(lang_export_escaped_buf) = (int)sv->escape_c(VECTOR_DATA(lang_export_escaped_buf), + VECTOR_DATA(*string), + VECTOR_LENGTH(*string)-1, /* exclude null terminator */ + "\""); + VECTOR_PUSH(lang_export_escaped_buf, '\0'); + + fprintf(lang_export_fp, "\n#: %s\n" + "# %s\n" + "%s" + "msgctxt \"%s\"\n" + "msgid \"%s\"\n" + "msgstr \"\"\n", + script->parser_current_file ? script->parser_current_file : "Unknown File", + VECTOR_DATA(lang_export_line_buf), + is_translatable_fmtstring ? "#, c-format\n" : (has_percent_sign ? "#, no-c-format\n" : ""), + script->parser_current_npc_name ? script->parser_current_npc_name : "Unknown NPC", + VECTOR_DATA(lang_export_escaped_buf) + ); + VECTOR_TRUNCATE(lang_export_line_buf); + VECTOR_TRUNCATE(lang_export_escaped_buf); + } +} + +struct script_code *parse_script_prehook(const char **src, const char **file, int *line, int *options, int **retval) +{ + if (translatable_strings != NULL) { + db_destroy(translatable_strings); + translatable_strings = NULL; + } + return NULL; +} + +void script_parser_clean_leftovers_posthook(void) +{ + if (translatable_strings != NULL) { + db_destroy(translatable_strings); + translatable_strings = NULL; + } + + VECTOR_CLEAR(lang_export_line_buf); + VECTOR_CLEAR(lang_export_escaped_buf); +} + +bool msg_config_read_posthook(bool retVal, const char *cfg_name, bool allow_override) +{ + static int called = 1; + + if (!generating_translations || lang_export_fp == NULL) + return retVal; + + if (!retVal) + return retVal; + + if (++called == 1) { // Original + int i; + for (i = 0; i < MAX_MSG; i++) { + if (atcommand->msg_table[0][i] == NULL) + continue; + fprintf(lang_export_fp, "msgctxt \"messages.conf\"\n" + "msgid \"%s\"\n" + "msgstr \"\"\n", + atcommand->msg_table[0][i] + ); + } + } + + return retVal; +} + +HPExport void server_preinit(void) +{ + addArg("--generate-translations", false, generatetranslations, + "Creates './generated_translations.pot' file with all translateable strings from scripts, server terminates afterwards."); + VECTOR_INIT(lang_export_line_buf); + VECTOR_INIT(lang_export_escaped_buf); + addHookPost(script, add_translatable_string, script_add_translatable_string_posthook); + addHookPre(script, parse, parse_script_prehook); + addHookPost(script, parser_clean_leftovers, script_parser_clean_leftovers_posthook); + addHookPost(atcommand, msg_read, msg_config_read_posthook); +} + +HPExport void plugin_init(void) +{ +} + +HPExport void server_online(void) +{ + if (generating_translations && lang_export_fp != NULL) { + ShowInfo("Lang exported to '%s'\n", lang_export_file); + fclose(lang_export_fp); + lang_export_fp = NULL; + } + core->runflag = CORE_ST_STOP; +} + +HPExport void plugin_final(void) +{ + if (lang_export_file != NULL) { + aFree(lang_export_file); + lang_export_file = NULL; + } +} @@ -75,7 +75,7 @@ case "$MODE" in ;; build) (cd tools && ./validateinterfaces.py silent) || aborterror "Interface validation error." - ./configure $@ || aborterror "Configure error, aborting build." + ./configure $@ || (cat config.log && aborterror "Configure error, aborting build.") make sql -j3 || aborterror "Build failed." make plugin.script_mapquit -j3 || aborterror "Build failed." ;; |