diff --git a/.gitattributes b/.gitattributes index 7ef9001..a20e449 100644 --- a/.gitattributes +++ b/.gitattributes @@ -32,16 +32,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 ## DOCUMENTATION *.markdown text diff --git a/.github/README.md b/.github/README.md index 71f2773..a4cf095 100644 --- a/.github/README.md +++ b/.github/README.md @@ -12,8 +12,5 @@ Soon I will be making a video in Spanish, to explain how it works. * [Nefertum](https://gitlab.com/Nefertum) (module author) * [Stevej / Pangolp](https://github.com/pangolp) (module author) -* [BarbzYHOOL](https://github.com/barbzyhool) -* [Talamortis](https://github.com/talamortis) - * [Translator](https://www.deepl.com/translator) * AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/.github/README_ES.md b/.github/README_ES.md index df5c236..f7c1894 100644 --- a/.github/README_ES.md +++ b/.github/README_ES.md @@ -12,7 +12,4 @@ Pronto haré un video en español, para explicar cómo funciona. * [Nefertum](https://gitlab.com/Nefertum) (autor del módulo) * [Stevej / Pangolp](https://github.com/pangolp) (autor del módulo) -* [BarbzYHOOL](https://github.com/barbzyhool) -* [Talamortis](https://github.com/talamortis) - -AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) +* AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/data/sql/db-world/base/npc_promotion_creature.sql b/data/sql/db-world/base/npc_promotion_creature.sql index aaff09e..b948991 100644 --- a/data/sql/db-world/base/npc_promotion_creature.sql +++ b/data/sql/db-world/base/npc_promotion_creature.sql @@ -1,4 +1,4 @@ -SET @ID:=100000; +SET @ID:=100002; SET @GUID:=3110360; DELETE FROM `creature` WHERE `id1`=@ID; diff --git a/data/sql/db-world/base/npc_promotion_creature_template.sql b/data/sql/db-world/base/npc_promotion_creature_template.sql index 16a56c6..8d1ce98 100644 --- a/data/sql/db-world/base/npc_promotion_creature_template.sql +++ b/data/sql/db-world/base/npc_promotion_creature_template.sql @@ -1,13 +1,11 @@ -SET @ENTRY:=100000; -SET @NAME:="AzerothCore"; -SET @SUBNAME:="Promotion"; -SET @GOSSIP:=62000; -SET @MODELID1:=22234; +DELETE FROM `creature_template` WHERE `entry`=100002; +INSERT INTO `creature_template`(`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES +(100002, 0, 0, 0, 0, 0, 'AzerothCore', 'Promotion', NULL, 62000, 80, 80, 0, 35, 1, 1, 1.14286, 1, 1, 20, 1.5, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'npc_promocion', NULL); -DELETE FROM `creature_template` WHERE `entry`=@ENTRY; -INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES -(@ENTRY, 0, 0, 0, 0, 0, @MODELID1, 0, 0, 0, @NAME, @SUBNAME, NULL, @GOSSIP, 83, 83, 0, 35, 1, 1, 1, 0, 0, 20, 2, 0, 0, 0, 0, 0, 1, 1, 1, 768, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 'npc_promocion', 12340); +DELETE FROM `creature_template_model` WHERE `CreatureID`=100002; +INSERT INTO `creature_template_model`(`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES +(100002, 0, 22234, 1, 1, 0); -DELETE FROM `creature_template_locale` WHERE `entry`=@ENTRY; +DELETE FROM `creature_template_locale` WHERE `entry`=100002; INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`) VALUES -(@ENTRY, "zhCN", "新人伴手礼", "直升服务", 18019); +(100002, "zhCN", "新人伴手礼", "直升服务", 18019); diff --git a/src/NpcPromotion.cpp b/src/NpcPromotion.cpp index 92edff8..6cdad04 100644 --- a/src/NpcPromotion.cpp +++ b/src/NpcPromotion.cpp @@ -11,10 +11,7 @@ #include "NpcPromotion.h" #include "GossipDef.h" #include "ScriptedGossip.h" - -#if AC_COMPILER == AC_COMPILER_GNU -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif +#include "SpellMgr.h" struct NpcPromotion { @@ -228,7 +225,7 @@ class npc_promocion : public CreatureScript countAccount = -1; } - if ((player->getLevel() < npcPromotion.LEVEL) && (((countAccount < npcPromotion.COUNT)) || (countIp < npcPromotion.IP_COUNT))) + if ((player->GetLevel() < npcPromotion.LEVEL) && (((countAccount < npcPromotion.COUNT)) || (countIp < npcPromotion.IP_COUNT))) { switch (player->getClass()) { @@ -284,7 +281,7 @@ class npc_promocion : public CreatureScript AddGossipItemFor(player, GOSSIP_MENU_PROMOTION, GOSSIP_MENU_CLOSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - if (player->getLevel() >= npcPromotion.LEVEL) + if (player->GetLevel() >= npcPromotion.LEVEL) { AddGossipItemFor(player, GOSSIP_MENU_PROMOTION, GOSSIP_MENU_TP_DALARAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); } @@ -498,12 +495,12 @@ class NpcPromotionCommand : public CommandScript { static ChatCommandTable promotionSetCommandTable = { - { "view", SEC_MODERATOR, false, &HandleViewNpcPromotionCommand, "" } + { "view", HandleViewNpcPromotionCommand, SEC_MODERATOR, Console::No } }; static ChatCommandTable commandTable = { - { "promotion", SEC_MODERATOR, false, nullptr, "", promotionSetCommandTable} + { "promotion", promotionSetCommandTable } }; return commandTable; @@ -515,34 +512,23 @@ class NpcPromotionCommand : public CommandScript accountId = (*result)[0].Get(); } - static bool HandleViewNpcPromotionCommand(ChatHandler* handler, const char* args) + static bool HandleViewNpcPromotionCommand(ChatHandler* handler, std::string playerName) { - if (!*args) + if (!normalizePlayerName(playerName)) { return false; } - Player* target = nullptr; - std::string playerName; + ObjectGuid targetGuid = sCharacterCache->GetCharacterGuidByName(playerName); + uint32 targetAccountId = sCharacterCache->GetCharacterAccountIdByGuid(targetGuid); - if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName)) + if (!targetGuid) { return false; } - uint32 playerAccountId; - - if (target) - { - playerAccountId = target->GetSession()->GetAccountId(); - } - else - { - getTargetAccountIdByName(playerName, playerAccountId); - } - - QueryResult result = LoginDatabase.Query("SELECT * FROM `account` WHERE `id`={};", playerAccountId); - QueryResult resultPromotion = LoginDatabase.Query("SELECT * FROM `mod_npc_promotion_log` WHERE `accountId`={};", playerAccountId); + QueryResult result = LoginDatabase.Query("SELECT * FROM `account` WHERE `id`={};", targetAccountId); + QueryResult resultPromotion = LoginDatabase.Query("SELECT * FROM `mod_npc_promotion_log` WHERE `accountId`={};", targetAccountId); if (result) { @@ -571,7 +557,7 @@ class NpcPromotionCommand : public CommandScript std::string characterName = promotion[3].Get(); std::string ip = promotion[4].Get(); std::string date = promotion[5].Get(); - handler->PSendSysMessage("Character: {}, {}: {}, date: {}", characterName.c_str(), ip.c_str(), date.c_str()); + handler->PSendSysMessage("Character: {} - IP: {} - date: {}", characterName.c_str(), ip.c_str(), date.c_str()); } while (resultPromotion->NextRow()); }