summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/map/battle/guild.conf3
-rw-r--r--conf/messages.conf50
-rw-r--r--db/pre-re/item_db.conf2
-rw-r--r--db/re/item_db.conf2
-rw-r--r--db/translations.conf10
-rw-r--r--npc/other/arena/arena_party.txt2
-rw-r--r--npc/quests/quests_umbala.txt5
-rw-r--r--sql-files/item_db.sql2
-rw-r--r--sql-files/item_db_re.sql2
-rw-r--r--src/common/utils.c15
-rw-r--r--src/common/utils.h2
-rw-r--r--src/map/atcommand.c16
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/battleground.c22
-rw-r--r--src/map/channel.c4
-rw-r--r--src/map/clif.c8
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/irc-bot.c8
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/pc.c10
-rw-r--r--src/map/script.c131
-rw-r--r--src/map/script.h5
-rw-r--r--src/map/skill.c6
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc10
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc3
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc63
-rw-r--r--src/plugins/generate-translations.c242
-rwxr-xr-xtools/configconverter.pl1
30 files changed, 447 insertions, 202 deletions
diff --git a/conf/map/battle/guild.conf b/conf/map/battle/guild.conf
index 101349a85..2cb74c2dd 100644
--- a/conf/map/battle/guild.conf
+++ b/conf/map/battle/guild.conf
@@ -45,9 +45,6 @@ guild_max_castles: 0
// 2 - like 1, but your logged off time is also decreased from the remaining cooldown (Aegis)
guild_skill_relog_delay: 2
-// Damage adjustments for WOE battles against defending Guild monsters (Note 2)
-castle_defense_rate: 100
-
// Flee penalty on gvg grounds. Official value is 20 (Note 2)
// NOTE: It's %, not absolute, so 20 is -20% of your total flee
gvg_flee_penalty: 20
diff --git a/conf/messages.conf b/conf/messages.conf
index f616335fa..42214167a 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -450,8 +450,28 @@
// Return pet to egg message
451: You can't return your pet because your inventory is full.
452: usage @camerainfo range rotation latitude
+
+// Refinary
453: Refinery UI is not available
-//454-497 FREE
+
+// Battlegrounds
+454: Server : %s is leaving the battlefield...
+455: Server : %s has been afk-kicked from the battlefield...
+456: You are a deserter! Wait %u minute(s) before you can apply again
+457: You are a deserter! Wait %u seconds before you can apply again
+458: You can't reapply to this arena so fast. Apply to the different arena or wait %u minute(s)
+459: You can't reapply to this arena so fast. Apply to the different arena or wait %u seconds
+460: Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d
+461: Can't apply: not enough members in your team/guild, minimum is %d
+462: Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d
+463: Can't apply: not enough members in your team/party, minimum is %d
+464: Server : %s has quit the game...
+// IRC
+465: [ #%s ] User IRC.%s left the channel. [Quit: %s]
+466: [ #%s ] User IRC.%s left the channel. [%s]
+467: [ #%s ] User IRC.%s is now known as IRC.%s
+468: [ #%s ] User IRC.%s joined the channel.
+// 469-497 FREE
// Messages of others (not for GM commands)
// ----------------------------------------
@@ -479,7 +499,8 @@
// mail system
//----------------------
510: You have %d new emails (%d unread)
-//511-537 FREE
+511: Inbox is full (Max %d). Delete some mails.
+// 512-537 FREE
// Trade Spoof Messages
538: Hack on trade: character '%s' (account: %d) try to trade more items that he has.
@@ -662,7 +683,28 @@
879: You have become the Guild Master!
880: You have been recovered!
881: Shop is out of stock! Come again later!
-//882-899 FREE
+
+// Frost Joker / Scream text for monster (MobName : SkillName !!)
+882: %s : %s !!
+// Cursed Circle
+883: You are too close to a stone or emperium to do this skill
+//
+884: Skill Failed. [%s] requires %dx %s.
+885: Removed %dz.
+886: Gained %dz.
+887: %s stole an Unknown Item (id: %i).
+888: %s stole %s.
+889: Experience Gained Base:%"PRIu64" (%.2f%%) Job:%"PRIu64" (%.2f%%)
+890: [KS Warning!! - Owner : %s]
+891: [Watch out! %s is trying to KS you!]
+892: Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f)
+893: [ Kill Steal Protection Disabled. KS is allowed in this map ]
+894: %s is in autotrade mode and cannot receive whispered messages.
+// 895 FREE
+896: Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%
+897: #%s '%s' joined
+898: #%s '%s' left
+// 899 FREE
//------------------------------------
// More atcommands message
@@ -1574,7 +1616,7 @@
// @dropall
1500: Usage: @dropall {<type>}
1501: Type List: (default) all = -1, healing = 0, usable = 2, etc = 3, weapon = 4, armor = 5, card = 6, petegg = 7, petarmor = 8, ammo = 10, delayed-consumable = 11, cash = 18
-1502: %d items are dropped!
+1502: %d items are dropped (%d skipped)!
// @refine - Part 2
1503: %d: Costume Headgear (Top)
diff --git a/db/pre-re/item_db.conf b/db/pre-re/item_db.conf
index d6b22e9fb..199416825 100644
--- a/db/pre-re/item_db.conf
+++ b/db/pre-re/item_db.conf
@@ -42897,7 +42897,7 @@ item_db: (
Script: <"
bonus bMdef,15;
bonus2 bResEff,Eff_Curse,4000;
- bonus2 bResEff,Eff_Curse,1000;
+ bonus2 bResEff,Eff_Stun,1000;
">
},
{
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 19e3d2f99..4996e587c 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -58466,7 +58466,7 @@ item_db: (
Script: <"
bonus bMdef,15;
bonus2 bResEff,Eff_Curse,4000;
- bonus2 bResEff,Eff_Curse,1000;
+ bonus2 bResEff,Eff_Stun,1000;
">
},
{
diff --git a/db/translations.conf b/db/translations.conf
index e786a72ac..72288ea63 100644
--- a/db/translations.conf
+++ b/db/translations.conf
@@ -31,6 +31,12 @@
//=========================================================================
translations: (
- //"path/to/my/Language.po",
- //"db/Spanish.po", //(Example)
+ //"db/translations/Foo",
+ // "db/Spanish", // (Example)
+ // The .po files in the language folder should have the same directory
+ // structure as the generating scripts:
+ // - db/Spanish/conf/messages_conf.po
+ // - db/Spanish/npc/MOTD_txt.po
+ // - db/Spanish/npc/airports/airship_txt.po
+ // - ...
)
diff --git a/npc/other/arena/arena_party.txt b/npc/other/arena/arena_party.txt
index 67c69f8e8..f3362687d 100644
--- a/npc/other/arena/arena_party.txt
+++ b/npc/other/arena/arena_party.txt
@@ -165,6 +165,8 @@ OnTouch:
}
force_1-2,99,31,4 script Slipslowrun#party 4_F_TELEPORTER,{
+ end;
+
OnStart:
initnpctimer;
$arena_minptst = gettime(GETTIME_MINUTE);
diff --git a/npc/quests/quests_umbala.txt b/npc/quests/quests_umbala.txt
index e23089698..e9d48c6fa 100644
--- a/npc/quests/quests_umbala.txt
+++ b/npc/quests/quests_umbala.txt
@@ -773,6 +773,10 @@ um_in,44,71,2 script Utan Shaman 4_F_UMOLDWOMAN,{
.@shaman_max += rand(6,10);
++.@sha_man;
}
+ if (countitem(.@divide) < .@input) {
+ close;
+ }
+ delitem .@divide, .@input;
switch(.@divide) {
case 994:
getitem Boody_Red,.@shaman_max;
@@ -786,7 +790,6 @@ um_in,44,71,2 script Utan Shaman 4_F_UMOLDWOMAN,{
case 997:
getitem Yellow_Live,.@shaman_max;
}
- delitem .@divide,.@input;
close;
}
mes "[Puchuchartan]";
diff --git a/sql-files/item_db.sql b/sql-files/item_db.sql
index cf30566dc..01f02a091 100644
--- a/sql-files/item_db.sql
+++ b/sql-files/item_db.sql
@@ -2525,7 +2525,7 @@ REPLACE INTO `item_db` VALUES ('5326','Masquerade_C','Masquerade C','5','0','1',
REPLACE INTO `item_db` VALUES ('5327','Orc_Hero_Helm_C','Refined Helmet of Orc Hero','5','0','1','0','0','0','0','10','0','0','18446744073709551614','63','2','768','0','0',NULL,'0','0','178','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bStr,5; bonus bVit,3;','','');
REPLACE INTO `item_db` VALUES ('5328','Evil_Wing_Ears_C','Evil Wing Ears C','5','0','1','0','0','0','0','2','0','0','18446744073709551615','63','2','512','0','0',NULL,'0','0','152','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bStr,1;','','');
REPLACE INTO `item_db` VALUES ('5329','Dark_Blindfold_C','Dark Blindfold C','5','0','1','0','0','0','0','1','0','0','18446744073709551615','63','2','512','0','0',NULL,'0','0','187','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus2 bResEff,Eff_Blind,10000; bonus2 bResEff,Eff_Stun,500;','','');
-REPLACE INTO `item_db` VALUES ('5330','kRO_Drooping_Kitty_C','kRO Drooping Kitty C','5','0','1','0','0','0','0','6','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','142','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,15; bonus2 bResEff,Eff_Curse,4000; bonus2 bResEff,Eff_Curse,1000;','','');
+REPLACE INTO `item_db` VALUES ('5330','kRO_Drooping_Kitty_C','kRO Drooping Kitty C','5','0','1','0','0','0','0','6','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','142','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,15; bonus2 bResEff,Eff_Curse,4000; bonus2 bResEff,Eff_Stun,1000;','','');
REPLACE INTO `item_db` VALUES ('5331','Corsair_C','Corsair C','5','0','1','0','0','0','0','10','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','105','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bVit,3; bonus bInt,3;','','');
REPLACE INTO `item_db` VALUES ('5332','Loki_Mask','Loki Mask','5','0','0','0','200','0','0','0','0','0','18446744073709551615','63','2','513','0','20',NULL,'0','0','346','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bFlee2,3;','','');
REPLACE INTO `item_db` VALUES ('5333','Radio_Antenna','Radio Antenna','5','0','0','0','1500','0','0','2','0','0','18446744073709551615','63','2','256','0','50',NULL,'1','0','347','0','0','0','0','457',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,5; bonus bCritical,5; bonus bFlee,5; skill MG_LIGHTNINGBOLT,1; bonus4 bAutoSpellWhenHit,MG_THUNDERSTORM,5,30,1;','','');
diff --git a/sql-files/item_db_re.sql b/sql-files/item_db_re.sql
index a6605c6fc..3f4654324 100644
--- a/sql-files/item_db_re.sql
+++ b/sql-files/item_db_re.sql
@@ -3433,7 +3433,7 @@ REPLACE INTO `item_db` VALUES ('5326','Masquerade_C','Masquerade C','5','0','1',
REPLACE INTO `item_db` VALUES ('5327','Orc_Hero_Helm_C','Refined Helmet of Orc Hero','5','0','1','0','0','0','0','10','0','0','18446744073709551614','63','2','768','0','0',NULL,'0','0','178','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus bStr,5; bonus bVit,3;','','');
REPLACE INTO `item_db` VALUES ('5328','Evil_Wing_Ears_C','Evil Wing Ears C','5','0','1','0','0','0','0','4','0','0','18446744073709551615','63','2','512','0','0',NULL,'0','0','152','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus bStr,1;','','');
REPLACE INTO `item_db` VALUES ('5329','Dark_Blindfold_C','Costume Dark Blindfold','5','0','1','0','0','0','0','1','0','0','18446744073709551615','63','2','512','0','0',NULL,'0','0','187','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus2 bResEff,Eff_Blind,10000; bonus2 bResEff,Eff_Stun,500;','','');
-REPLACE INTO `item_db` VALUES ('5330','kRO_Drooping_Kitty_C','kRO Drooping Kitty C','5','0','1','0','0','0','0','9','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','142','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,15; bonus2 bResEff,Eff_Curse,4000; bonus2 bResEff,Eff_Curse,1000;','','');
+REPLACE INTO `item_db` VALUES ('5330','kRO_Drooping_Kitty_C','kRO Drooping Kitty C','5','0','1','0','0','0','0','9','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','142','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,15; bonus2 bResEff,Eff_Curse,4000; bonus2 bResEff,Eff_Stun,1000;','','');
REPLACE INTO `item_db` VALUES ('5331','Corsair_C','Corsair C','5','0','1','0','0','0','0','14','0','0','18446744073709551614','63','2','256','0','0',NULL,'0','0','105','0','0','0','0','507',NULL,'0',NULL,'0',NULL,'0','bonus bVit,3; bonus bInt,3;','','');
REPLACE INTO `item_db` VALUES ('5332','Loki_Mask','Loki Mask','5','0','0','0','200','0','0','2','0','0','18446744073709551615','63','2','513','0','20',NULL,'0','0','346','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bFlee2,3;','','');
REPLACE INTO `item_db` VALUES ('5333','Radio_Antenna','Radio Antenna','5','0','0','0','1500','0','0','2','0','0','18446744073709551615','63','2','256','0','50',NULL,'1','0','347','0','0','0','0','0',NULL,'0',NULL,'0',NULL,'0','bonus bMdef,5; bonus bCritical,5; bonus bFlee,5; skill MG_LIGHTNINGBOLT,1; bonus4 bAutoSpellWhenHit,MG_THUNDERSTORM,5,30,1;','','');
diff --git a/src/common/utils.c b/src/common/utils.c
index d4c838b56..238ebe65d 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -128,7 +128,7 @@ static char *checkpath(char *path, const char *srcpath)
return path;
}
-void findfile(const char *p, const char *pat, void (func)(const char *))
+void findfile(const char *p, const char *pat, void (func)(const char *, void *context), void *context)
{
WIN32_FIND_DATAA FindFileData;
HANDLE hFind;
@@ -155,12 +155,11 @@ void findfile(const char *p, const char *pat, void (func)(const char *))
sprintf(tmppath,"%s%c%s",path,PATHSEP,FindFileData.cFileName);
if (strstr(FindFileData.cFileName, pattern)) {
- func( tmppath );
+ func(tmppath, context);
}
- if( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
- {
- findfile(tmppath, pat, func);
+ if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+ findfile(tmppath, pat, func, context);
}
}while (FindNextFileA(hFind, &FindFileData) != 0);
FindClose(hFind);
@@ -190,7 +189,7 @@ static char *checkpath(char *path, const char *srcpath)
return path;
}
-void findfile(const char *p, const char *pat, void (func)(const char *))
+void findfile(const char *p, const char *pat, void (func)(const char *, void *context), void *context)
{
DIR* dir; ///< pointer to the scanned directory.
struct dirent* entry; ///< pointer to one directory entry.
@@ -220,7 +219,7 @@ void findfile(const char *p, const char *pat, void (func)(const char *))
// check if the pattern matches.
if (strstr(entry->d_name, pattern)) {
- func( tmppath );
+ func(tmppath, context);
}
// check if it is a directory.
if (stat(tmppath, &dir_stat) == -1) {
@@ -230,7 +229,7 @@ void findfile(const char *p, const char *pat, void (func)(const char *))
// is this a directory?
if (S_ISDIR(dir_stat.st_mode)) {
// decent recursively
- findfile(tmppath, pat, func);
+ findfile(tmppath, pat, func, context);
}
}//end while
diff --git a/src/common/utils.h b/src/common/utils.h
index f564dcf29..81234c843 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -39,7 +39,7 @@
void WriteDump(FILE* fp, const void* buffer, size_t length);
void ShowDump(const void* buffer, size_t length);
-void findfile(const char *p, const char *pat, void (func)(const char*));
+void findfile(const char *p, const char *pat, void (func)(const char *, void *), void *context);
bool exists(const char* filename);
/// calculates the value of A / B, in percent (rounded down)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 145a5c95d..f57583cfc 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5369,7 +5369,6 @@ ACMD(follow)
ACMD(dropall)
{
int type = -1;
- int count = 0;
if (message[0] != '\0') {
type = atoi(message);
@@ -5380,25 +5379,32 @@ ACMD(dropall)
}
}
+ int count = 0, count_skipped = 0;
for (int i = 0; i < sd->status.inventorySize; i++) {
- if (sd->status.inventory[i].amount) {
+ if (sd->status.inventory[i].amount > 0) {
struct item_data *item_data = itemdb->exists(sd->status.inventory[i].nameid);
if (item_data == NULL) {
ShowWarning("Non-existant item %d on dropall list (account_id: %d, char_id: %d)\n", sd->status.inventory[i].nameid, sd->status.account_id, sd->status.char_id);
continue;
}
+
if (!pc->candrop(sd, &sd->status.inventory[i]))
continue;
+
if (type == -1 || type == item_data->type) {
if (sd->status.inventory[i].equip != 0)
pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC | PCUNEQUIPITEM_FORCE);
- count += sd->status.inventory[i].amount;
- pc->dropitem(sd, i, sd->status.inventory[i].amount);
+
+ int amount = sd->status.inventory[i].amount;
+ if (pc->dropitem(sd, i, amount) != 0)
+ count += amount;
+ else
+ count_skipped += amount;
}
}
}
- sprintf(atcmd_output, msg_fd(fd, 1502), count); // %d items are dropped!
+ sprintf(atcmd_output, msg_fd(fd, 1502), count, count_skipped); // %d items are dropped (%d skipped)!
clif->message(fd, atcmd_output);
return true;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 37fc03bca..726547c66 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3467,11 +3467,6 @@ static int64 battle_calc_gvg_damage(struct block_list *src, struct block_list *b
case NC_SELFDESTRUCTION:
break;
default:
- /* Uncomment if you want god-mode Emperiums at 100 defense. [Kisuka]
- if (md && md->guardian_data) {
- damage -= damage * (md->guardian_data->castle->defense/100) * battle_config.castle_defense_rate/100;
- }
- */
break;
}
return damage;
@@ -7188,7 +7183,6 @@ static const struct battle_data {
{ "skill_removetrap_type", &battle_config.skill_removetrap_type, 0, 0, 1, },
{ "disp_experience", &battle_config.disp_experience, 0, 0, 1, },
{ "disp_zeny", &battle_config.disp_zeny, 0, 0, 1, },
- { "castle_defense_rate", &battle_config.castle_defense_rate, 100, 0, 100, },
{ "bone_drop", &battle_config.bone_drop, 0, 0, 2, },
{ "buyer_name", &battle_config.buyer_name, 1, 0, 1, },
{ "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, },
diff --git a/src/map/battle.h b/src/map/battle.h
index 4400d37d1..e9bc6b258 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -342,7 +342,6 @@ struct Battle_Config {
int skill_removetrap_type;
int disp_experience;
int disp_zeny;
- int castle_defense_rate;
int backstab_bow_penalty;
int hp_rate;
int sp_rate;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index c2772a2b9..e0d2e8003 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -169,13 +169,13 @@ static int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type fl
switch (flag) {
default:
case BGTL_QUIT:
- sprintf(output, "Server : %s has quit the game...", sd->status.name);
+ sprintf(output, msg_txt(464), sd->status.name); // Server : %s has quit the game...
break;
case BGTL_LEFT:
- sprintf(output, "Server : %s is leaving the battlefield...", sd->status.name);
+ sprintf(output, msg_txt(454), sd->status.name); // Server : %s is leaving the battlefield...
break;
case BGTL_AFK:
- sprintf(output, "Server : %s has been afk-kicked from the battlefield...", sd->status.name);
+ sprintf(output, msg_txt(455), sd->status.name); // Server : %s has been afk-kicked from the battlefield...
break;
}
clif->bg_message(bgd, 0, "Server", output);
@@ -860,9 +860,9 @@ static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, str
if ( ( tick = pc_readglobalreg(sd, script->add_variable(bg->gdelay_var)) ) && tsec < tick ) {
char response[100];
if( (tick-tsec) > 60 )
- sprintf(response, "You are a deserter! Wait %u minute(s) before you can apply again", (tick - tsec) / 60);
+ sprintf(response, msg_sd(sd, 456), (tick - tsec) / 60); // You are a deserter! Wait %u minute(s) before you can apply again
else
- sprintf(response, "You are a deserter! Wait %u seconds before you can apply again", (tick - tsec));
+ sprintf(response, msg_sd(sd, 457), (tick - tsec)); // You are a deserter! Wait %u seconds before you can apply again
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_DESERTER;
}
@@ -870,9 +870,9 @@ static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, str
if ( ( tick = pc_readglobalreg(sd, script->add_variable(arena->delay_var)) ) && tsec < tick ) {
char response[100];
if( (tick-tsec) > 60 )
- sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u minute(s)", (tick - tsec) / 60);
+ sprintf(response, msg_sd(sd, 458), (tick - tsec) / 60); // You can't reapply to this arena so fast. Apply to the different arena or wait %u minute(s)
else
- sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u seconds", (tick - tsec));
+ sprintf(response, msg_sd(sd, 459), (tick - tsec)); // You can't reapply to this arena so fast. Apply to the different arena or wait %u seconds
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_COOLDOWN;
}
@@ -894,9 +894,9 @@ static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, str
if ( count < arena->min_team_players ) {
char response[121];
if( count != sd->guild->connect_member && sd->guild->connect_member >= arena->min_team_players )
- sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d", arena->min_team_players);
+ sprintf(response, msg_sd(sd, 460), arena->min_team_players); // Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d
else
- sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d", arena->min_team_players);
+ sprintf(response, msg_sd(sd, 461), arena->min_team_players); // Can't apply: not enough members in your team/guild, minimum is %d
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_TEAM_COUNT;
}
@@ -926,9 +926,9 @@ static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, str
if( count < arena->min_team_players ) {
char response[121];
if( count != p->party.count && p->party.count >= arena->min_team_players )
- sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d", arena->min_team_players);
+ sprintf(response, msg_sd(sd, 462), arena->min_team_players); // Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d
else
- sprintf(response, "Can't apply: not enough members in your team/party, minimum is %d",arena->min_team_players);
+ sprintf(response, msg_sd(sd, 463), arena->min_team_players); // Can't apply: not enough members in your team/party, minimum is %d
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_TEAM_COUNT;
}
diff --git a/src/map/channel.c b/src/map/channel.c
index e27e9fb0b..c87e425eb 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -324,7 +324,7 @@ static void channel_join_sub(struct channel_data *chan, struct map_session_data
if (!stealth && (chan->options&HCS_OPT_ANNOUNCE_JOIN)) {
char message[60];
- sprintf(message, "#%s '%s' joined",chan->name,sd->status.name);
+ sprintf(message, msg_txt(897), chan->name, sd->status.name); // #%s '%s' joined
clif->channel_msg(chan,sd,message);
}
@@ -442,7 +442,7 @@ static void channel_leave(struct channel_data *chan, struct map_session_data *sd
channel->delete(chan);
} else if (!channel->config->closing && (chan->options & HCS_OPT_ANNOUNCE_JOIN)) {
char message[60];
- sprintf(message, "#%s '%s' left",chan->name,sd->status.name);
+ sprintf(message, msg_txt(898), chan->name, sd->status.name); // #%s '%s' left
clif->channel_msg(chan,sd,message);
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 7456dc351..ace733b75 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10769,7 +10769,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd)
if( map->list[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) ) {
char output[128];
- sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]");
+ sprintf(output, "%s", msg_sd(sd, 893)); // [ Kill Steal Protection Disabled. KS is allowed in this map ]
clif->broadcast(&sd->bl, output, (int)strlen(output) + 1, BC_BLUE, SELF);
}
@@ -11664,7 +11664,7 @@ static void clif_parse_WisMessage(int fd, struct map_session_data *sd)
// if player is autotrading
if (dstsd->state.autotrade) {
char output[256];
- sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
+ sprintf(output, msg_fd(fd, 894), dstsd->status.name); // %s is in autotrade mode and cannot receive whispered messages.
clif->wis_message(fd, map->wisp_server_name, output, (int)strlen(output));
return;
}
@@ -16683,7 +16683,7 @@ static void clif_Mail_refreshinbox(struct map_session_data *sd)
if( md->full ) {// TODO: is this official?
char output[100];
- sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
+ sprintf(output, msg_sd(sd, 511), MAIL_MAX_INBOX); // Inbox is full (Max %d). Delete some mails.
clif_disp_onlyself(sd, output);
}
}
@@ -20599,7 +20599,7 @@ static void clif_show_modifiers(struct map_session_data *sd)
if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) {
char output[128];
- snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%",
+ snprintf(output,128, msg_sd(sd, 896), // Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%
sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death);
clif->broadcast2(&sd->bl, output, (int)strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF);
}
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 43cb8d84b..fbb94334c 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -401,7 +401,7 @@ static bool homunculus_levelup(struct homun_data *hd)
if ( battle_config.homunculus_show_growth ) {
char output[256] ;
sprintf(output,
- "Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ",
+ msg_sd(hd->master, 892), // Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f)
growth_max_hp, growth_max_sp,
growth_str/10.0, growth_agi/10.0, growth_vit/10.0,
growth_int/10.0, growth_dex/10.0, growth_luk/10.0);
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 996107fea..a0c7276a9 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -396,7 +396,7 @@ static void irc_userjoin(int fd, char *cmd, char *source, char *target, char *ms
ircbot->parse_source(source,source_nick,source_ident,source_host);
if( ircbot->channel ) {
- snprintf(send_string, 150, "[ #%s ] User IRC.%s joined the channel.",ircbot->channel->name,source_nick);
+ snprintf(send_string, 150, msg_txt(468), ircbot->channel->name, source_nick); // [ #%s ] User IRC.%s joined the channel.
clif->channel_msg2(ircbot->channel,send_string);
}
}
@@ -414,9 +414,9 @@ static void irc_userleave(int fd, char *cmd, char *source, char *target, char *m
if( ircbot->channel ) {
if (!strcmpi(cmd, "QUIT"))
- snprintf(send_string, 150, "[ #%s ] User IRC.%s left the channel. [Quit: %s]",ircbot->channel->name,source_nick,msg);
+ snprintf(send_string, 150, msg_txt(465), ircbot->channel->name, source_nick, msg); // [ #%s ] User IRC.%s left the channel. [Quit: %s]
else
- snprintf(send_string, 150, "[ #%s ] User IRC.%s left the channel. [%s]",ircbot->channel->name,source_nick,msg);
+ snprintf(send_string, 150, msg_txt(466), ircbot->channel->name, source_nick, msg); // [ #%s ] User IRC.%s left the channel. [%s]
clif->channel_msg2(ircbot->channel,send_string);
}
}
@@ -433,7 +433,7 @@ static void irc_usernick(int fd, char *cmd, char *source, char *target, char *ms
ircbot->parse_source(source,source_nick,source_ident,source_host);
if( ircbot->channel ) {
- snprintf(send_string, 150, "[ #%s ] User IRC.%s is now known as IRC.%s",ircbot->channel->name,source_nick,msg);
+ snprintf(send_string, 150, msg_txt(467), ircbot->channel->name, source_nick, msg); // [ #%s ] User IRC.%s is now known as IRC.%s
clif->channel_msg2(ircbot->channel,send_string);
}
}
diff --git a/src/map/mob.c b/src/map/mob.c
index e04d6944e..215f82f5f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -479,7 +479,7 @@ static bool mob_ksprotected(struct block_list *src, struct block_list *target)
// Message to KS
if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 )
{
- sprintf(output, "[KS Warning!! - Owner : %s]", pl_sd->status.name);
+ sprintf(output, msg_sd(sd, 890), pl_sd->status.name); // [KS Warning!! - Owner : %s]
clif_disp_onlyself(sd, output);
sd->ks_floodprotect_tick = tick + 2000;
@@ -488,7 +488,7 @@ static bool mob_ksprotected(struct block_list *src, struct block_list *target)
// Message to Owner
if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 )
{
- sprintf(output, "[Watch out! %s is trying to KS you!]", sd->status.name);
+ sprintf(output, msg_sd(pl_sd, 891), sd->status.name); // [Watch out! %s is trying to KS you!]
clif_disp_onlyself(pl_sd, output);
pl_sd->ks_floodprotect_tick = tick + 2000;
diff --git a/src/map/pc.c b/src/map/pc.c
index 2cefa7674..5eccfbaf6 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4441,7 +4441,7 @@ static int pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ
if (sd->state.showzeny) {
char output[255];
- sprintf(output, "Removed %dz.", zeny);
+ sprintf(output, msg_sd(sd, 885), zeny); // Removed %dz.
clif_disp_onlyself(sd, output);
}
}
@@ -4580,7 +4580,7 @@ static int pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ
if (sd->state.showzeny) {
char output[255];
- sprintf(output, "Gained %dz.", zeny);
+ sprintf(output, msg_sd(sd, 886), zeny); // Gained %dz.
clif_disp_onlyself(sd, output);
}
}
@@ -5535,9 +5535,9 @@ static int pc_show_steal(struct block_list *bl, va_list ap)
nullpo_ret(sd);
if((item=itemdb->exists(itemid))==NULL)
- sprintf(output,"%s stole an Unknown Item (id: %i).",sd->status.name, itemid);
+ sprintf(output, msg_sd(sd, 887), sd->status.name, itemid); // %s stole an Unknown Item (id: %i).
else
- sprintf(output,"%s stole %s.",sd->status.name,item->jname);
+ sprintf(output, msg_sd(sd, 888), sd->status.name, item->jname); // %s stole %s.
clif->message(tsd->fd, output);
return 0;
@@ -7084,7 +7084,7 @@ static bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint
if(sd->state.showexp) {
char output[256];
sprintf(output,
- "Experience Gained Base:%"PRIu64" (%.2f%%) Job:%"PRIu64" (%.2f%%)",
+ msg_sd(sd, 889), // Experience Gained Base:%"PRIu64" (%.2f%%) Job:%"PRIu64" (%.2f%%)
base_exp, nextbp * (float)100, job_exp, nextjp * (float)100);
clif_disp_onlyself(sd, output);
}
diff --git a/src/map/script.c b/src/map/script.c
index 0fe97574c..ab7513ede 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5189,8 +5189,8 @@ static void script_load_translations(void)
size = libconfig->setting_length(translations);
for(i = 0; i < size; i++) {
- const char *translation_file = libconfig->setting_get_string_elem(translations, i);
- total += script->load_translation(translation_file, ++lang_id);
+ const char *translation_dir = libconfig->setting_get_string_elem(translations, i);
+ total += script->load_translation(translation_dir, ++lang_id);
}
libconfig->destroy(&translations_conf);
@@ -5227,39 +5227,39 @@ static void script_load_translations(void)
}
/**
- * Generates a language name from a translation filename.
+ * Generates a language name from a translation directory name.
*
- * @param file The filename.
+ * @param directory The directory name.
* @return The corresponding translation name.
*/
-static const char *script_get_translation_file_name(const char *file)
+static const char *script_get_translation_dir_name(const char *directory)
{
const char *basename = NULL, *last_dot = NULL;
- nullpo_retr("Unknown", file);
+ nullpo_retr("Unknown", directory);
- basename = strrchr(file, '/');;
+ basename = strrchr(directory, '/');
#ifdef WIN32
{
- const char *basename_windows = strrchr(file, '\\');
+ const char *basename_windows = strrchr(directory, '\\');
if (basename_windows > basename)
basename = basename_windows;
}
#endif // WIN32
if (basename == NULL)
- basename = file;
+ basename = directory;
else
basename++; // Skip slash
Assert_retr("Unknown", *basename != '\0');
last_dot = strrchr(basename, '.');
if (last_dot != NULL) {
- static char file_name[200];
+ static char dir_name[200];
if (last_dot == basename)
return basename + 1;
- safestrncpy(file_name, basename, last_dot - basename + 1);
- return file_name;
+ safestrncpy(dir_name, basename, last_dot - basename + 1);
+ return dir_name;
}
return basename;
@@ -5340,18 +5340,19 @@ static bool script_load_translation_addstring(const char *file, uint8 lang_id, c
/**
* Parses an individual translation file.
*
- * @param file The filename to parse.
+ * @param directory The directory structure to read.
* @param lang_id The language identifier.
* @return The amount of strings loaded.
*/
-static int script_load_translation(const char *file, uint8 lang_id)
+static int script_load_translation_file(const char *file, uint8 lang_id)
{
- int translations = 0;
char line[1024];
- char msgctxt[NAME_LENGTH*2+1] = { 0 };
- FILE *fp;
- int lineno = 0;
+ char msgctxt[NAME_LENGTH*2+1] = "";
struct script_string_buf msgid, msgstr;
+ struct script_string_buf *msg_ptr;
+ int translations = 0;
+ int lineno = 0;
+ FILE *fp;
nullpo_ret(file);
@@ -5363,46 +5364,50 @@ static int script_load_translation(const char *file, uint8 lang_id)
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();
-
while (fgets(line, sizeof(line), fp) != NULL) {
int len = (int)strlen(line);
int i;
lineno++;
- if(len <= 1)
+ if (len <= 1) {
+ if (VECTOR_LENGTH(msgid) > 0 && VECTOR_LENGTH(msgstr) > 0) {
+ // Add string
+ if (script->load_translation_addstring(file, lang_id, msgctxt, &msgid, &msgstr))
+ translations++;
+
+ msgctxt[0] = '\0';
+ VECTOR_TRUNCATE(msgid);
+ VECTOR_TRUNCATE(msgstr);
+ }
continue;
+ }
if (line[0] == '#')
continue;
- if (VECTOR_LENGTH(msgid) > 0 && VECTOR_LENGTH(msgstr) > 0) {
+ if (VECTOR_LENGTH(msgid) > 0) {
+ if (VECTOR_LENGTH(msgstr) > 0) {
+ msg_ptr = &msgstr;
+ } else {
+ msg_ptr = &msgid;
+ }
if (line[0] == '"') {
// Continuation line
- (void)VECTOR_POP(msgstr); // Pop final '\0'
- for (i = 8; i < len - 2; i++) {
- VECTOR_ENSURE(msgstr, 1, 512);
+ (void)VECTOR_POP(*msg_ptr); // Pop final '\0'
+ for (i = 1; i < len - 2; i++) {
+ VECTOR_ENSURE(*msg_ptr, 1, 512);
if (line[i] == '\\' && line[i+1] == '"') {
- VECTOR_PUSH(msgstr, '"');
+ VECTOR_PUSH(*msg_ptr, '"');
i++;
} else {
- VECTOR_PUSH(msgstr, line[i]);
+ VECTOR_PUSH(*msg_ptr, line[i]);
}
}
- VECTOR_ENSURE(msgstr, 1, 512);
- VECTOR_PUSH(msgstr, '\0');
+ VECTOR_ENSURE(*msg_ptr, 1, 512);
+ VECTOR_PUSH(*msg_ptr, '\0');
continue;
}
- // Add string
- if (script->load_translation_addstring(file, lang_id, msgctxt, &msgid, &msgstr))
- translations++;
-
- msgctxt[0] = '\0';
- VECTOR_TRUNCATE(msgid);
- VECTOR_TRUNCATE(msgstr);
}
if (strncasecmp(line,"msgctxt \"", 9) == 0) {
@@ -5477,10 +5482,47 @@ static int script_load_translation(const char *file, uint8 lang_id)
VECTOR_CLEAR(msgid);
VECTOR_CLEAR(msgstr);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' translations in '"CL_WHITE"%s"CL_RESET"'.\n", translations, file);
return translations;
}
+struct load_translation_data {
+ uint8 lang_id;
+ int translation_count;
+};
+
+static void script_load_translation_sub(const char *filename, void *context)
+{
+ nullpo_retv(context);
+
+ struct load_translation_data *data = context;
+
+ data->translation_count += script->load_translation_file(filename, data->lang_id);
+}
+
+/**
+ * Loads a translations directory
+ *
+ * @param directory The directory structure to read.
+ * @param lang_id The language identifier.
+ * @return The amount of strings loaded.
+ */
+static int script_load_translation(const char *directory, uint8 lang_id)
+{
+ struct load_translation_data data = { 0 };
+ data.lang_id = lang_id;
+
+ nullpo_ret(directory);
+
+ script->add_language(script->get_translation_dir_name(directory));
+ if (lang_id >= atcommand->max_message_table)
+ atcommand->expand_message_table();
+
+ findfile(directory, ".po", script_load_translation_sub, &data);
+
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' translations in '"CL_WHITE"%s"CL_RESET"'.\n", data.translation_count, directory);
+ return data.translation_count;
+}
+
/**
*
**/
@@ -18494,10 +18536,12 @@ static BUILDIN(npcshopdelitem)
unsigned int nameid = script_getnum(st,i);
ARR_FIND(0, size, n, nd->u.shop.shop_item[n].nameid == nameid);
- if (n < size) {
- memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0])*(size-n));
- size--;
+ if (n == size) {
+ continue;
+ } else if (n < size - 1) {
+ memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0]) * (size - n - 1));
}
+ size--;
}
RECREATE(nd->u.shop.shop_item, struct npc_item_list, size);
@@ -27512,12 +27556,13 @@ void script_defaults(void)
script->string_dup = script_string_dup;
script->load_translations = script_load_translations;
script->load_translation_addstring = script_load_translation_addstring;
+ script->load_translation_file = script_load_translation_file;
script->load_translation = script_load_translation;
script->translation_db_destroyer = script_translation_db_destroyer;
script->clear_translations = script_clear_translations;
script->parse_cleanup_timer = script_parse_cleanup_timer;
script->add_language = script_add_language;
- script->get_translation_file_name = script_get_translation_file_name;
+ script->get_translation_dir_name = script_get_translation_dir_name;
script->parser_clean_leftovers = script_parser_clean_leftovers;
script->run_use_script = script_run_use_script;
diff --git a/src/map/script.h b/src/map/script.h
index 57652e77a..1cec02b97 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -1039,12 +1039,13 @@ struct script_interface {
int (*string_dup) (char *str);
void (*load_translations) (void);
bool (*load_translation_addstring) (const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr);
- int (*load_translation) (const char *file, uint8 lang_id);
+ int (*load_translation_file) (const char *file, uint8 lang_id);
+ int (*load_translation) (const char *directory, 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);
uint8 (*add_language) (const char *name);
- const char *(*get_translation_file_name) (const char *file);
+ const char *(*get_translation_dir_name) (const char *directory);
void (*parser_clean_leftovers) (void);
void (*run_use_script) (struct map_session_data *sd, struct item_data *data, int oid);
void (*run_item_equip_script) (struct map_session_data *sd, struct item_data *data, int oid);
diff --git a/src/map/skill.c b/src/map/skill.c
index ad27ef0e3..60d5a397d 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -7205,7 +7205,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
// custom hack to make the mob display the skill, because these skills don't show the skill use text themselves
//NOTE: mobs don't have the sprite animation that is used when performing this skill (will cause glitches)
char temp[70];
- snprintf(temp, sizeof(temp), "%s : %s !!", md->name, skill->get_desc(skill_id));
+ snprintf(temp, sizeof(temp), msg_txt(882), md->name, skill->get_desc(skill_id)); // %s : %s !!
clif->disp_overhead(&md->bl, temp, AREA_CHAT_WOC, NULL);
}
break;
@@ -14669,7 +14669,7 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
if (map->foreachinrange(mob->count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
MOBID_EMPELIUM, MOBID_S_EMPEL_1, MOBID_S_EMPEL_2)) {
char output[128];
- sprintf(output, "You're too close to a stone or emperium to do this skill"); /* TODO official response? or message.conf it */
+ sprintf(output, "%s", msg_txt(883)); /* TODO official response */ // You are too close to a stone or emperium to do this skill
clif->messagecolor_self(sd->fd, COLOR_RED, output);
return 0;
}
@@ -15116,7 +15116,7 @@ static int skill_check_condition_castend(struct map_session_data *sd, uint16 ski
return 0;
} else if( sd->status.inventory[i].amount < require.ammo_qty ) {
char e_msg[100];
- sprintf(e_msg,"Skill Failed. [%s] requires %dx %s.",
+ sprintf(e_msg, msg_txt(884), // Skill Failed. [%s] requires %dx %s.
skill->get_desc(skill_id),
require.ammo_qty,
itemdb_jname(sd->status.inventory[i].nameid));
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 61de7bbc6..b207e52ba 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -7056,8 +7056,10 @@ typedef void (*HPMHOOK_pre_script_load_translations) (void);
typedef void (*HPMHOOK_post_script_load_translations) (void);
typedef bool (*HPMHOOK_pre_script_load_translation_addstring) (const char **file, uint8 *lang_id, const char **msgctxt, const struct script_string_buf **msgid, const struct script_string_buf **msgstr);
typedef bool (*HPMHOOK_post_script_load_translation_addstring) (bool retVal___, const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr);
-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_load_translation_file) (const char **file, uint8 *lang_id);
+typedef int (*HPMHOOK_post_script_load_translation_file) (int retVal___, const char *file, uint8 lang_id);
+typedef int (*HPMHOOK_pre_script_load_translation) (const char **directory, uint8 *lang_id);
+typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *directory, 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);
@@ -7066,8 +7068,8 @@ typedef int (*HPMHOOK_pre_script_parse_cleanup_timer) (int *tid, int64 *tick, in
typedef int (*HPMHOOK_post_script_parse_cleanup_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data);
typedef uint8 (*HPMHOOK_pre_script_add_language) (const char **name);
typedef uint8 (*HPMHOOK_post_script_add_language) (uint8 retVal___, const char *name);
-typedef const char* (*HPMHOOK_pre_script_get_translation_file_name) (const char **file);
-typedef const char* (*HPMHOOK_post_script_get_translation_file_name) (const char* retVal___, const char *file);
+typedef const char* (*HPMHOOK_pre_script_get_translation_dir_name) (const char **directory);
+typedef const char* (*HPMHOOK_post_script_get_translation_dir_name) (const char* retVal___, const char *directory);
typedef void (*HPMHOOK_pre_script_parser_clean_leftovers) (void);
typedef void (*HPMHOOK_post_script_parser_clean_leftovers) (void);
typedef void (*HPMHOOK_pre_script_run_use_script) (struct map_session_data **sd, struct item_data **data, int *oid);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 0b3e9b923..6b3cee6b5 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -5590,6 +5590,8 @@ struct {
struct HPMHookPoint *HP_script_load_translations_post;
struct HPMHookPoint *HP_script_load_translation_addstring_pre;
struct HPMHookPoint *HP_script_load_translation_addstring_post;
+ struct HPMHookPoint *HP_script_load_translation_file_pre;
+ struct HPMHookPoint *HP_script_load_translation_file_post;
struct HPMHookPoint *HP_script_load_translation_pre;
struct HPMHookPoint *HP_script_load_translation_post;
struct HPMHookPoint *HP_script_translation_db_destroyer_pre;
@@ -5600,8 +5602,8 @@ struct {
struct HPMHookPoint *HP_script_parse_cleanup_timer_post;
struct HPMHookPoint *HP_script_add_language_pre;
struct HPMHookPoint *HP_script_add_language_post;
- struct HPMHookPoint *HP_script_get_translation_file_name_pre;
- struct HPMHookPoint *HP_script_get_translation_file_name_post;
+ struct HPMHookPoint *HP_script_get_translation_dir_name_pre;
+ struct HPMHookPoint *HP_script_get_translation_dir_name_post;
struct HPMHookPoint *HP_script_parser_clean_leftovers_pre;
struct HPMHookPoint *HP_script_parser_clean_leftovers_post;
struct HPMHookPoint *HP_script_run_use_script_pre;
@@ -12403,6 +12405,8 @@ struct {
int HP_script_load_translations_post;
int HP_script_load_translation_addstring_pre;
int HP_script_load_translation_addstring_post;
+ int HP_script_load_translation_file_pre;
+ int HP_script_load_translation_file_post;
int HP_script_load_translation_pre;
int HP_script_load_translation_post;
int HP_script_translation_db_destroyer_pre;
@@ -12413,8 +12417,8 @@ struct {
int HP_script_parse_cleanup_timer_post;
int HP_script_add_language_pre;
int HP_script_add_language_post;
- int HP_script_get_translation_file_name_pre;
- int HP_script_get_translation_file_name_post;
+ int HP_script_get_translation_dir_name_pre;
+ int HP_script_get_translation_dir_name_post;
int HP_script_parser_clean_leftovers_pre;
int HP_script_parser_clean_leftovers_post;
int HP_script_run_use_script_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index c6e887d08..ad9e7e123 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2861,12 +2861,13 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(script->string_dup, HP_script_string_dup) },
{ HP_POP(script->load_translations, HP_script_load_translations) },
{ HP_POP(script->load_translation_addstring, HP_script_load_translation_addstring) },
+ { HP_POP(script->load_translation_file, HP_script_load_translation_file) },
{ HP_POP(script->load_translation, HP_script_load_translation) },
{ HP_POP(script->translation_db_destroyer, HP_script_translation_db_destroyer) },
{ HP_POP(script->clear_translations, HP_script_clear_translations) },
{ HP_POP(script->parse_cleanup_timer, HP_script_parse_cleanup_timer) },
{ HP_POP(script->add_language, HP_script_add_language) },
- { HP_POP(script->get_translation_file_name, HP_script_get_translation_file_name) },
+ { HP_POP(script->get_translation_dir_name, HP_script_get_translation_dir_name) },
{ HP_POP(script->parser_clean_leftovers, HP_script_parser_clean_leftovers) },
{ HP_POP(script->run_use_script, HP_script_run_use_script) },
{ HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index daa1b9d7a..6dd6cb34f 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -74589,15 +74589,42 @@ bool HP_script_load_translation_addstring(const char *file, uint8 lang_id, const
}
return retVal___;
}
-int HP_script_load_translation(const char *file, uint8 lang_id) {
+int HP_script_load_translation_file(const char *file, uint8 lang_id) {
int hIndex = 0;
int retVal___ = 0;
- if (HPMHooks.count.HP_script_load_translation_pre > 0) {
+ if (HPMHooks.count.HP_script_load_translation_file_pre > 0) {
int (*preHookFunc) (const char **file, uint8 *lang_id);
*HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_load_translation_file_pre[hIndex].func;
+ retVal___ = preHookFunc(&file, &lang_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.script.load_translation_file(file, lang_id);
+ }
+ if (HPMHooks.count.HP_script_load_translation_file_post > 0) {
+ int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_load_translation_file_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, file, lang_id);
+ }
+ }
+ return retVal___;
+}
+int HP_script_load_translation(const char *directory, uint8 lang_id) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_script_load_translation_pre > 0) {
+ int (*preHookFunc) (const char **directory, 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;
- retVal___ = preHookFunc(&file, &lang_id);
+ retVal___ = preHookFunc(&directory, &lang_id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74605,13 +74632,13 @@ int HP_script_load_translation(const char *file, uint8 lang_id) {
}
}
{
- retVal___ = HPMHooks.source.script.load_translation(file, lang_id);
+ retVal___ = HPMHooks.source.script.load_translation(directory, lang_id);
}
if (HPMHooks.count.HP_script_load_translation_post > 0) {
- int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id);
+ int (*postHookFunc) (int retVal___, const char *directory, 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;
- retVal___ = postHookFunc(retVal___, file, lang_id);
+ retVal___ = postHookFunc(retVal___, directory, lang_id);
}
}
return retVal___;
@@ -74729,15 +74756,15 @@ uint8 HP_script_add_language(const char *name) {
}
return retVal___;
}
-const char* HP_script_get_translation_file_name(const char *file) {
+const char* HP_script_get_translation_dir_name(const char *directory) {
int hIndex = 0;
const char* retVal___ = NULL;
- if (HPMHooks.count.HP_script_get_translation_file_name_pre > 0) {
- const char* (*preHookFunc) (const char **file);
+ if (HPMHooks.count.HP_script_get_translation_dir_name_pre > 0) {
+ const char* (*preHookFunc) (const char **directory);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_script_get_translation_file_name_pre[hIndex].func;
- retVal___ = preHookFunc(&file);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_pre[hIndex].func;
+ retVal___ = preHookFunc(&directory);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74745,13 +74772,13 @@ const char* HP_script_get_translation_file_name(const char *file) {
}
}
{
- retVal___ = HPMHooks.source.script.get_translation_file_name(file);
+ retVal___ = HPMHooks.source.script.get_translation_dir_name(directory);
}
- if (HPMHooks.count.HP_script_get_translation_file_name_post > 0) {
- const char* (*postHookFunc) (const char* retVal___, const char *file);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_script_get_translation_file_name_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, file);
+ if (HPMHooks.count.HP_script_get_translation_dir_name_post > 0) {
+ const char* (*postHookFunc) (const char* retVal___, const char *directory);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, directory);
}
}
return retVal___;
diff --git a/src/plugins/generate-translations.c b/src/plugins/generate-translations.c
index 759e788a2..14a3c0a4d 100644
--- a/src/plugins/generate-translations.c
+++ b/src/plugins/generate-translations.c
@@ -22,11 +22,13 @@
#include "common/hercules.h"
#include "common/cbasetypes.h"
#include "common/memmgr.h"
+#include "common/nullpo.h"
#include "common/showmsg.h"
#include "common/strlib.h"
#include "common/sysinfo.h"
#include "map/atcommand.h"
#include "map/map.h"
+#include "map/npc.h"
#include "map/script.h"
#include "plugins/HPMHooking.h"
@@ -34,6 +36,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
+#include <time.h>
HPExport struct hplugin_info pinfo = {
"generate-translations", // Plugin name
@@ -45,14 +49,33 @@ HPExport struct hplugin_info pinfo = {
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 */
+char *lang_export_filepath;
+#define DIRECTORYNAME "generated_translations"
struct script_string_buf lang_export_line_buf;
struct script_string_buf lang_export_escaped_buf;
-int lang_export_stringcount;
+int lang_export_stringcount_total;
+int lang_export_stringcount_current;
/// Whether the translations template generator will automatically run.
bool generating_translations = false;
+bool createdirectory(const char *dirname)
+{
+#ifdef WIN32
+ if (!CreateDirectory(dirname, NULL)) {
+ if (ERROR_ALREADY_EXISTS != GetLastError())
+ return false;
+ }
+#else /* Not WIN32 */
+ struct stat st = { 0 };
+ if (stat(dirname, &st) == -1 ) {
+ if (mkdir(dirname, 0755) != 0)
+ return false;
+ }
+#endif // WIN32 check
+ return true;
+}
+
/**
* --generate-translations
*
@@ -61,49 +84,9 @@ bool generating_translations = false;
*/
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;
- char timestring[128] = "";
- strftime(timestring, sizeof(timestring), "%Y-%m-%d %H:%M:%S%z", lt);
- 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\n"
-
- "#,fuzzy\n"
- "msgid \"\"\n"
- "msgstr \"\"\n"
- "\"Project-Id-Version: %s\\n\"\n"
- "\"Report-Msgid-Bugs-To: dev@herc.ws\\n\"\n"
- "\"POT-Creation-Date: %s\\n\"\n"
- "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
- "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
- "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
- "\"Language: \\n\"\n"
- "\"MIME-Version: 1.0\\n\"\n"
- "\"Content-Type: text/plain; charset=ISO-8859-1\\n\"\n"
- "\"Content-Transfer-Encoding: 8bit\\n\"\n\n",
- year, sysinfo->vcsrevision_scripts(), timestring);
+ if (!createdirectory(DIRECTORYNAME)) {
+ ShowError("generatetranslations: Unable to create output directory '%s'.\n", DIRECTORYNAME);
+ return false;
}
generating_translations = true;
return true;
@@ -188,7 +171,8 @@ void script_add_translatable_string_posthook(const struct script_string_buf *str
script->parser_current_npc_name ? script->parser_current_npc_name : "Unknown NPC",
VECTOR_DATA(lang_export_escaped_buf)
);
- lang_export_stringcount++;
+ lang_export_stringcount_total++;
+ lang_export_stringcount_current++;
VECTOR_TRUNCATE(lang_export_line_buf);
VECTOR_TRUNCATE(lang_export_escaped_buf);
}
@@ -214,44 +198,184 @@ void script_parser_clean_leftovers_posthook(void)
VECTOR_CLEAR(lang_export_escaped_buf);
}
+bool translations_enter_file(const char *filepath)
+{
+ const char *p = NULL;
+ int len, i;
+
+ if (!generating_translations)
+ return false;
+
+ p = filepath;
+ len = (int)strlen(filepath) + (int)strlen(DIRECTORYNAME) + (int)strlen(PATHSEP_STR);
+ lang_export_filepath = aCalloc(len + 4 + 1, sizeof(char)); // + ".pot"
+ strncat(lang_export_filepath, DIRECTORYNAME PATHSEP_STR, len);
+ lang_export_stringcount_current = 0;
+
+ i = (int)strlen(lang_export_filepath);
+ while (*p != '\0') {
+ if (Assert_chk(i < len)) {
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+ if (*p == '.') {
+ lang_export_filepath[i] = '_';
+ } else if (*p == PATHSEP) {
+ if (!createdirectory(lang_export_filepath)) {
+ ShowError("generatetranslations: Unable to create output directory '%s'.\n", lang_export_filepath);
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+ lang_export_filepath[i] = PATHSEP;
+ } else {
+ lang_export_filepath[i] = *p;
+ }
+ i++;
+ p++;
+ }
+ strncat(lang_export_filepath, ".pot", len + 4);
+
+ if ((lang_export_fp = fopen(lang_export_filepath, "wb")) == NULL) {
+ ShowError("export-dialog: failed to open '%s' for writing\n", lang_export_filepath);
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ return false;
+ }
+
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+ int year = lt->tm_year+1900;
+ char timestring[128] = "";
+ strftime(timestring, sizeof(timestring), "%Y-%m-%d %H:%M:%S%z", lt);
+ 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\n"
+
+ "#,fuzzy\n"
+ "msgid \"\"\n"
+ "msgstr \"\"\n"
+ "\"Project-Id-Version: %s\\n\"\n"
+ "\"Report-Msgid-Bugs-To: dev@herc.ws\\n\"\n"
+ "\"POT-Creation-Date: %s\\n\"\n"
+ "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
+ "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
+ "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
+ "\"Language: \\n\"\n"
+ "\"MIME-Version: 1.0\\n\"\n"
+ "\"Content-Type: text/plain; charset=ISO-8859-1\\n\"\n"
+ "\"Content-Transfer-Encoding: 8bit\\n\"\n\n",
+ year, sysinfo->vcsrevision_scripts(), timestring);
+ }
+ return true;
+}
+
+bool translations_leave_file(const char *filepath)
+{
+ if (lang_export_fp != NULL) {
+ fclose(lang_export_fp);
+ lang_export_fp = NULL;
+ }
+ if (lang_export_filepath != NULL) {
+ if (lang_export_stringcount_current == 0) {
+ remove(lang_export_filepath);
+ } else {
+ ShowMessage("\r");
+ ShowInfo("%s => %s (%d strings)\n", filepath, lang_export_filepath, lang_export_stringcount_current);
+ }
+ aFree(lang_export_filepath);
+ lang_export_filepath = NULL;
+ }
+ lang_export_stringcount_current = 0;
+ return true;
+}
+
+bool msg_config_read_prehook(const char **cfg_name, bool *allow_override)
+{
+ if (*allow_override) // allow_override is true in nested calls
+ return false;
+
+ translations_enter_file(*cfg_name);
+ return true;
+}
+
bool msg_config_read_posthook(bool retVal, const char *cfg_name, bool allow_override)
{
- static int called = 1;
+ int i;
if (!generating_translations || lang_export_fp == NULL)
return retVal;
- if (!retVal)
+ if (allow_override) // allow_override is true in nested calls
return retVal;
- if (++called == 1) { // Original
- int i;
+ if (retVal) {
for (i = 0; i < MAX_MSG; i++) {
if (atcommand->msg_table[0][i] == NULL)
continue;
- fprintf(lang_export_fp, "msgctxt \"messages.conf\"\n"
+ fprintf(lang_export_fp, "\n#: conf/messages.conf\n"
+ "# %d: %s\n"
+ "#, c-format\n"
+ "msgctxt \"messages.conf\"\n"
"msgid \"%s\"\n"
"msgstr \"\"\n",
+ i, atcommand->msg_table[0][i],
atcommand->msg_table[0][i]
);
- lang_export_stringcount++;
+ lang_export_stringcount_total++;
+ lang_export_stringcount_current++;
}
}
+ translations_leave_file(cfg_name);
+
+ return retVal;
+}
+
+int npc_parsesrcfile_prehook(const char **filepath, bool *runOnInit)
+{
+ translations_enter_file(*filepath);
+ return 0;
+}
+
+int npc_parsesrcfile_posthook(int retVal, const char *filepath, bool runOnInit)
+{
+ translations_leave_file(filepath);
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.");
+ "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);
+ addHookPre(atcommand, msg_read, msg_config_read_prehook);
addHookPost(atcommand, msg_read, msg_config_read_posthook);
- lang_export_stringcount = 0;
+ addHookPre(npc, parsesrcfile, npc_parsesrcfile_prehook);
+ addHookPost(npc, parsesrcfile, npc_parsesrcfile_posthook);
+ lang_export_stringcount_total = 0;
+ lang_export_stringcount_current = 0;
}
HPExport void plugin_init(void)
@@ -260,18 +384,12 @@ HPExport void plugin_init(void)
HPExport void server_online(void)
{
- if (generating_translations && lang_export_fp != NULL) {
- ShowInfo("Translations template exported to '%s' with %d strings.\n", lang_export_file, lang_export_stringcount);
- fclose(lang_export_fp);
- lang_export_fp = NULL;
+ if (generating_translations) {
+ ShowInfo("Translations template exported to '%s' with %d strings.\n", DIRECTORYNAME, lang_export_stringcount_total);
}
core->runflag = CORE_ST_STOP;
}
HPExport void plugin_final(void)
{
- if (lang_export_file != NULL) {
- aFree(lang_export_file);
- lang_export_file = NULL;
- }
}
diff --git a/tools/configconverter.pl b/tools/configconverter.pl
index dc511aaef..20f5f4cfb 100755
--- a/tools/configconverter.pl
+++ b/tools/configconverter.pl
@@ -554,7 +554,6 @@ my @defaults = (
guild_exp_limit => {parse => \&parsecfg_int, print => \&printcfg_int, path => "guild:", default => 50},
guild_max_castles => {parse => \&parsecfg_int, print => \&printcfg_int, path => "guild:", default => 0},
guild_skill_relog_delay => {parse => \&parsecfg_bool, print => \&printcfg_bool, path => "guild:", default => "false"},
- castle_defense_rate => {parse => \&parsecfg_int, print => \&printcfg_int, path => "guild:", default => 100},
gvg_flee_penalty => {parse => \&parsecfg_int, print => \&printcfg_int, path => "guild:", default => 20},
require_glory_guild => {parse => \&parsecfg_bool, print => \&printcfg_bool, path => "guild:", default => "false"},
max_guild_alliance => {parse => \&parsecfg_int, print => \&printcfg_int, path => "guild:", default => 3},