Skip to content

Commit

Permalink
Refactor, fix minor issues, add config (#50)
Browse files Browse the repository at this point in the history
* refactor: sql style to match acore standards

* fix: typo Ballance to Balance

* refactor: rename generic sql names to specific module

identifiable module from table `updates`

* refactor: remove not needed headers

* feat: re-enable gear destroy, gyph reset, talent reset

TODO: config

* fix: typo successfully

* refactor: remove gossiphello comment

* fix: typo? npc entry to 55009

* refactor: use define instead of hardcoded npc entry

* change icon of destroy gear, re-order menu

* fixup! refactor: use define instead of hardcoded npc entry

use GetEntry() instead

* change reset talents icon to engi wheel

* remove redundant "select your spec" from gossip

its in the title of the npc and should be obvious from icons

allows bottom icons to be visible

* feat: add config to enable/disable additional gossip options

* use EnumUtils to convert class to string

rename "DeathKnight" to "Death Knight" according to enum defines

do not catch out of range exception, this should never happen

* fixup! feat: re-enable gear destroy, gyph reset, talent reset

pet talents

* fix crash when destroying items

use destroyitem to destroy items

occurs when trying to delete while wearing an empty head slot, segfaults
SetUInt64Value(ITEM_FIELD_CONTAINED...

* codestyle: remove extra empty line
  • Loading branch information
sogladev authored Oct 27, 2024
1 parent 8f8dcbf commit 41c13b6
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 432 deletions.
Empty file added conf/.gitkeep
Empty file.
33 changes: 33 additions & 0 deletions conf/npc_talent_template.conf.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#

[worldserver]

##########################################
# Npc Talent Template module configuration
##########################################
#
# NpcTalentTemplate.EnableResetTalents
# Description: Enables Gossip Option to reset talents
# Default: 0 - Disabled
# 1 - Enabled
#

NpcTalentTemplate.EnableResetTalents = 0

#
# NpcTalentTemplate.EnableRemoveAllGlyphs
# Description: Enables Gossip Option to Remove All Glyphs
# Default: 1 - Enabled
# 0 - Disabled
#

NpcTalentTemplate.EnableRemoveAllGlyphs = 1

#
# NpcTalentTemplate.EnableDestroyEquippedGear
# Description: Enables Gossip Option to Destroy Equipped Gear
# Default: 1 - Enabled
# 0 - Disabled
#

NpcTalentTemplate.EnableDestroyEquippedGear = 1

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions data/sql/db-world/base/development.sql

This file was deleted.

File renamed without changes.
21 changes: 21 additions & 0 deletions data/sql/db-world/base/npc_talent_template_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- DATA
SET @ENTRY := 55009;
SET @NAME := 'Pick a spec';
SET @SUBNAME := 'AzerothCore Template';
SET @DISPLAY_ID := 24877;

DELETE FROM `creature_template` WHERE `entry` = @ENTRY;
INSERT INTO `creature_template` (`entry`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `unit_class`, `unit_flags`, `type`, `type_flags`, `RegenHealth`, `flags_extra`, `ScriptName`) VALUES
(@ENTRY, @NAME , @SUBNAME, 'Speak', 0, 80, 80, 35, 1, 1, 1.14286, 1, 0, 1, 2, 7, 138936390, 1, 2, 'TemplateNPC');

DELETE FROM `creature_template_model` WHERE `CreatureID` = @ENTRY;
INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES
(@ENTRY, 0, @DISPLAY_ID, 1, 1, 0);

DELETE FROM `npc_text` WHERE `ID` = @ENTRY;
INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`) VALUES
(@ENTRY, 'Here you can select a character template which will gear up, gem up, set talent specialization, and set glyphs for your character instantly.', 'Here you can select a character template which will gear up, gem up, set talent specialization, and set glyphs for your character instantly.');

DELETE FROM `creature_template_movement` WHERE `CreatureId` = @ENTRY;
INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`, `InteractionPauseTimer`) VALUES
(@ENTRY, 1, 1, 0, 0, 0, 0, NULL);
125 changes: 37 additions & 88 deletions src/TemplateNPC.cpp

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions src/TemplateNPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
#include "Define.h"
#include "Player.h"
#include "Item.h"
#include "DBCStores.h"
#include "Log.h"
#include "DatabaseEnv.h"
#include "WorldSession.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "GossipDef.h"
#include "Creature.h"
#include "ObjectMgr.h"

Expand Down Expand Up @@ -273,6 +267,10 @@ class sTemplateNPC
HumanGearContainer m_HumanGearContainer;
AllianceGearContainer m_AllianceGearContainer;
HordeGearContainer m_HordeGearContainer;

bool enableResetTalents;
bool enableRemoveAllGlyphs;
bool enableDestroyEquippedGear;
};

#define sTemplateNpcMgr sTemplateNPC::instance()
Expand Down

0 comments on commit 41c13b6

Please sign in to comment.