From 07dd4b3c7bfba77ed6f4e79fed67e9358436f347 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Thu, 15 Jun 2023 20:19:40 -0300 Subject: [PATCH] Adding translations to the module (#35) * Adding translations to the module * Update enum --- .gitattributes | 10 ++--- README.md => .github/README.md | 0 conf/Individual-XP.conf.dist | 15 +++++-- conf/conf.sh.dist | 13 ------ .../sql/db-auth/base}/.gitkeep | 0 data/sql/db-auth/updates/.gitkeep | 0 data/sql/db-characters/base/.gitkeep | 0 .../base/mod_individual_xp_IndividualXP.sql | 0 data/sql/db-characters/updates/.gitkeep | 0 data/sql/db-world/base/.gitkeep | 0 .../base/mod_individual_xp_command.sql | 2 +- data/sql/db-world/updates/.gitkeep | 0 .../mod_individual_xp_acore_string.sql | 13 ++++++ include.sh | 9 ---- src/Individual_XP.cpp | 44 ++++++++++++------- 15 files changed, 59 insertions(+), 47 deletions(-) rename README.md => .github/README.md (100%) delete mode 100644 conf/conf.sh.dist rename {sql/characters => data/sql/db-auth/base}/.gitkeep (100%) create mode 100644 data/sql/db-auth/updates/.gitkeep create mode 100644 data/sql/db-characters/base/.gitkeep rename sql/characters/IndividualXP.sql => data/sql/db-characters/base/mod_individual_xp_IndividualXP.sql (100%) create mode 100644 data/sql/db-characters/updates/.gitkeep create mode 100644 data/sql/db-world/base/.gitkeep rename sql/world/command.sql => data/sql/db-world/base/mod_individual_xp_command.sql (83%) create mode 100644 data/sql/db-world/updates/.gitkeep create mode 100644 data/sql/db-world/updates/mod_individual_xp_acore_string.sql diff --git a/.gitattributes b/.gitattributes index 823b0b0..023f734 100644 --- a/.gitattributes +++ b/.gitattributes @@ -35,16 +35,16 @@ ## For documentation # Documents -*.doc diff=astextplain -*.DOC diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain *.docx diff=astextplain *.DOCX diff=astextplain *.dot diff=astextplain *.DOT diff=astextplain *.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain # Graphics diff --git a/README.md b/.github/README.md similarity index 100% rename from README.md rename to .github/README.md diff --git a/conf/Individual-XP.conf.dist b/conf/Individual-XP.conf.dist index f92402f..ef2370b 100644 --- a/conf/Individual-XP.conf.dist +++ b/conf/Individual-XP.conf.dist @@ -1,26 +1,33 @@ [worldserver] # -# IndividualXp.Enabled +# IndividualXp.Enabled # Description: Enable or Disable the IndividualXP Module. # Default: IndividualXp.Enabled = 1 # + IndividualXp.Enabled = 1 # -# IndividualXp.Announce +# IndividualXp.Announce # Description: Announce the IndividualXP Module at logon. # Default: IndividualXp.Announce = 1 # + IndividualXp.Announce = 1 # -# MaxXPRate +# MaxXPRate # Description: This is the max amount a player can set their xp to. # Default: Default = 1 +# + +MaxXPRate = 10 + +# # DefaultXPRate # Description: This is the default rate players start with. # Default: Default = 1 # -MaxXPRate = 10 + DefaultXPRate = 1 diff --git a/conf/conf.sh.dist b/conf/conf.sh.dist deleted file mode 100644 index 60e1211..0000000 --- a/conf/conf.sh.dist +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# -# CUSTOM -# - -DB_CHARACTERS_CUSTOM_PATHS+=( - $MOD_INDIVIDUAL_XP_ROOT"/sql/characters/" -) - -DB_WORLD_CUSTOM_PATHS+=( - $MOD_INDIVIDUAL_XP_ROOT"/sql/world/" -) \ No newline at end of file diff --git a/sql/characters/.gitkeep b/data/sql/db-auth/base/.gitkeep similarity index 100% rename from sql/characters/.gitkeep rename to data/sql/db-auth/base/.gitkeep diff --git a/data/sql/db-auth/updates/.gitkeep b/data/sql/db-auth/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/sql/db-characters/base/.gitkeep b/data/sql/db-characters/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sql/characters/IndividualXP.sql b/data/sql/db-characters/base/mod_individual_xp_IndividualXP.sql similarity index 100% rename from sql/characters/IndividualXP.sql rename to data/sql/db-characters/base/mod_individual_xp_IndividualXP.sql diff --git a/data/sql/db-characters/updates/.gitkeep b/data/sql/db-characters/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/sql/db-world/base/.gitkeep b/data/sql/db-world/base/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sql/world/command.sql b/data/sql/db-world/base/mod_individual_xp_command.sql similarity index 83% rename from sql/world/command.sql rename to data/sql/db-world/base/mod_individual_xp_command.sql index e9f26a7..f78f981 100644 --- a/sql/world/command.sql +++ b/data/sql/db-world/base/mod_individual_xp_command.sql @@ -1,4 +1,4 @@ -DELETE FROM `command` WHERE name IN ('xp', 'xp set', 'xp view', 'xp default', 'xp enable', 'xp disable'); +DELETE FROM `command` WHERE `name` IN ('xp', 'xp set', 'xp view', 'xp default', 'xp enable', 'xp disable'); INSERT INTO `command` (`name`, `security`, `help`) VALUES ('xp', 0, 'Syntax: .xp $subcommand\nType .help xp to see a list of subcommands\nor .help xp $subcommand to see info on the subcommand.'), diff --git a/data/sql/db-world/updates/.gitkeep b/data/sql/db-world/updates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/sql/db-world/updates/mod_individual_xp_acore_string.sql b/data/sql/db-world/updates/mod_individual_xp_acore_string.sql new file mode 100644 index 0000000..621b268 --- /dev/null +++ b/data/sql/db-world/updates/mod_individual_xp_acore_string.sql @@ -0,0 +1,13 @@ +SET @ENTRY:=35411; +DELETE FROM `acore_string` WHERE `entry` BETWEEN @ENTRY+0 AND @ENTRY+9; +INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES +(@ENTRY+0, 'This server is running the |cff4CFF00IndividualXpRate |rmodule.', '', '', '', '', '', 'Este servidor está ejecutando el módulo |cff4CFF00 mod-individual-xp.', 'Este servidor está ejecutando el módulo |cff4CFF00 mod-individual-xp.', ''), +(@ENTRY+1, '[XP] The Individual XP module is deactivated.', '', '', '', '', '', '[XP] El módulo XP individual está desactivado.', '[XP] El módulo XP individual está desactivado.', ''), +(@ENTRY+2, '[XP] Your Individual XP is currently disabled. Use .xp enable to re-enable it.', '', '', '', '', '', '[XP] Su XP individual está actualmente desactivado. Utilice .xp enable para volver a activarlo.', '[XP] Su XP individual está actualmente desactivado. Utilice .xp enable para volver a activarlo.', ''), +(@ENTRY+3, '[XP] Your current XP rate is %u.', '', '', '', '', '', '[XP] Su experiencia actual es %u.', '[XP] su experiencia actual es %u.', ''), +(@ENTRY+4, '[XP] The maximum rate limit is %u.', '', '', '', '', '', '[XP] El límite máximo de XP es %u.', '[XP] El límite máximo de XP es %u.', ''), +(@ENTRY+5, '[XP] The minimum rate limit is 1.', '', '', '', '', '', '[XP] El límite mínimo de XP es 1.', '[XP] El límite mínimo de XP es 1.', ''), +(@ENTRY+6, '[XP] You have updated your XP rate to %u.', '', '', '', '', '', '[XP] Has actualizado tu XP a %u', '[XP] Has actualizado tu XP a %u', ''), +(@ENTRY+7, '[XP] You have disabled your XP gain.', '', '', '', '', '', '[XP] Has desactivado tu ganancia de XP.', '[XP] Has desactivado tu ganancia de XP.', ''), +(@ENTRY+8, '[XP] You have enabled your XP gain.', '', '', '', '', '', '[XP] Has activado tu ganancia de XP.', '[XP] Has activado tu ganancia de XP.', ''), +(@ENTRY+9, '[XP] You have restored your XP rate to the default value of %u.', '', '', '', '', '', '[XP] Has restaurado tu tasa de XP al valor por defecto de %u.', '[XP] Has restaurado tu tasa de XP al valor por defecto de %u.', ''); diff --git a/include.sh b/include.sh index 033d637..e69de29 100644 --- a/include.sh +++ b/include.sh @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -MOD_INDIVIDUAL_XP_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )" - -source $MOD_INDIVIDUAL_XP_ROOT"/conf/conf.sh.dist" - -if [ -f $MOD_INDIVIDUAL_XP_ROOT"/conf/conf.sh" ]; then - source $MOD_INDIVIDUAL_XP_ROOT"/conf/conf.sh" -fi \ No newline at end of file diff --git a/src/Individual_XP.cpp b/src/Individual_XP.cpp index c10ca7a..15fcb35 100644 --- a/src/Individual_XP.cpp +++ b/src/Individual_XP.cpp @@ -36,6 +36,20 @@ public: } }; +enum IndividualXP +{ + ACORE_STRING_CREDIT = 35411, + ACORE_STRING_MODULE_DISABLED, + ACORE_STRING_RATES_DISABLED, + ACORE_STRING_COMMAND_VIEW, + ACORE_STRING_MAX_RATE, + ACORE_STRING_MIN_RATE, + ACORE_STRING_COMMAND_SET, + ACORE_STRING_COMMAND_DISABLED, + ACORE_STRING_COMMAND_ENABLED, + ACORE_STRING_COMMAND_DEFAULT +}; + class Individual_Xp_Announce : public PlayerScript { public: @@ -47,7 +61,7 @@ public: // Announce Module if (IndividualXpEnabled & IndividualXpAnnounceModule) { - ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00IndividualXpRate |rmodule"); + ChatHandler(player->GetSession()).SendSysMessage(ACORE_STRING_CREDIT); } } }; @@ -126,7 +140,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -141,7 +155,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -152,13 +166,13 @@ public: if (me->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN)) { - handler->PSendSysMessage("[XP] Your Individual XP is currently disabled. Use .xp enable to re-enable it."); + handler->PSendSysMessage(ACORE_STRING_RATES_DISABLED); handler->SetSentErrorMessage(true); return false; } else { - me->GetSession()->SendAreaTriggerMessage("Your current XP rate is %u", me->CustomData.GetDefault("Individual_XP")->XPRate); + me->GetSession()->SendAreaTriggerMessage(ACORE_STRING_COMMAND_VIEW, me->CustomData.GetDefault("Individual_XP")->XPRate); } return true; } @@ -168,7 +182,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -183,19 +197,19 @@ public: uint32 rate = (uint32)atol(args); if (rate > MaxRate) { - handler->PSendSysMessage("[XP] The maximum rate limit is %u.", MaxRate); + handler->PSendSysMessage(ACORE_STRING_MAX_RATE, MaxRate); handler->SetSentErrorMessage(true); return false; } else if (rate == 0) { - handler->PSendSysMessage("[XP] The minimum rate limit is 1."); + handler->PSendSysMessage(ACORE_STRING_MIN_RATE); handler->SetSentErrorMessage(true); return false; } me->CustomData.GetDefault("Individual_XP")->XPRate = rate; - me->GetSession()->SendAreaTriggerMessage("You have updated your XP rate to %u", rate); + me->GetSession()->SendAreaTriggerMessage(ACORE_STRING_COMMAND_SET, rate); return true; } @@ -204,7 +218,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -215,7 +229,7 @@ public: // Turn Disabled On But Don't Change Value... me->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); - me->GetSession()->SendAreaTriggerMessage("You have disabled your XP gain."); + me->GetSession()->SendAreaTriggerMessage(ACORE_STRING_COMMAND_DISABLED); return true; } @@ -224,7 +238,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -234,7 +248,7 @@ public: return false; me->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); - me->GetSession()->SendAreaTriggerMessage("You have enabled your XP gain."); + me->GetSession()->SendAreaTriggerMessage(ACORE_STRING_COMMAND_ENABLED); return true; } @@ -243,7 +257,7 @@ public: { if (!IndividualXpEnabled) { - handler->PSendSysMessage("[XP] The Individual XP module is deactivated."); + handler->PSendSysMessage(ACORE_STRING_MODULE_DISABLED); handler->SetSentErrorMessage(true); return false; } @@ -253,7 +267,7 @@ public: return false; me->CustomData.GetDefault("Individual_XP")->XPRate = DefaultRate; - me->GetSession()->SendAreaTriggerMessage("You have restored your XP rate to the default value of %u", DefaultRate); + me->GetSession()->SendAreaTriggerMessage(ACORE_STRING_COMMAND_DEFAULT, DefaultRate); return true; } };