Skip to content

Commit

Permalink
chore. Update module and fix bugs in build (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Pagani Walter <paganiwalter@gmail.com>
  • Loading branch information
jorge990125 and pangolp authored Aug 31, 2024
1 parent a85c227 commit 7366b45
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 50 deletions.
10 changes: 5 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 1 addition & 4 deletions .github/README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion data/sql/db-world/base/npc_promotion_creature.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET @ID:=100000;
SET @ID:=100002;
SET @GUID:=3110360;

DELETE FROM `creature` WHERE `id1`=@ID;
Expand Down
18 changes: 8 additions & 10 deletions data/sql/db-world/base/npc_promotion_creature_template.sql
Original file line number Diff line number Diff line change
@@ -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);
40 changes: 13 additions & 27 deletions src/NpcPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -515,34 +512,23 @@ class NpcPromotionCommand : public CommandScript
accountId = (*result)[0].Get<int32>();
}

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)
{
Expand Down Expand Up @@ -571,7 +557,7 @@ class NpcPromotionCommand : public CommandScript
std::string characterName = promotion[3].Get<std::string>();
std::string ip = promotion[4].Get<std::string>();
std::string date = promotion[5].Get<std::string>();
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());
}
Expand Down

0 comments on commit 7366b45

Please sign in to comment.