Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gossip handling to store data in database and add new features #51

Merged
merged 57 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
c58d769
refactor: sql style to match acore standards
sogladev Oct 24, 2024
ca2bec6
fix: typo Ballance to Balance
sogladev Oct 24, 2024
7a2b74a
refactor: rename generic sql names to specific module
sogladev Oct 24, 2024
279ff6c
refactor: remove not needed headers
sogladev Oct 24, 2024
42dadb8
feat: re-enable gear destroy, gyph reset, talent reset
sogladev Oct 25, 2024
c3796d9
fix: typo successfully
sogladev Oct 25, 2024
f54ce68
refactor: remove gossiphello comment
sogladev Oct 25, 2024
e8a29c0
fix: typo? npc entry to 55009
sogladev Oct 25, 2024
84bb5bf
refactor: use define instead of hardcoded npc entry
sogladev Oct 25, 2024
8fb3834
change icon of destroy gear, re-order menu
sogladev Oct 25, 2024
30e2e24
fixup! refactor: use define instead of hardcoded npc entry
sogladev Oct 25, 2024
d2bbe95
change reset talents icon to engi wheel
sogladev Oct 25, 2024
e6264b2
remove redundant "select your spec" from gossip
sogladev Oct 25, 2024
dd310ea
feat: add config to enable/disable additional gossip options
sogladev Oct 25, 2024
a58f08c
use EnumUtils to convert class to string
sogladev Oct 25, 2024
1964472
fixup! feat: re-enable gear destroy, gyph reset, talent reset
sogladev Oct 25, 2024
d7e2f25
learn highest rank
sogladev Oct 25, 2024
91a697f
WIP commands
sogladev Oct 25, 2024
f9560f3
export for 1 class+spec done
sogladev Oct 25, 2024
596eabb
update destroy equipment
sogladev Oct 25, 2024
c74eecb
extend export for all specs
sogladev Oct 25, 2024
3379c6f
use racemask for gear instead of human, alliance, horde
sogladev Oct 26, 2024
9fd80c0
allow loading of generic index
sogladev Oct 26, 2024
ec52981
update for mysql v8.0
sogladev Oct 27, 2024
e681f20
modernize, use enum for gear/talent flag
sogladev Oct 27, 2024
a19692a
add copy cmd skeleton
sogladev Oct 27, 2024
c231db1
use generic ApplyTemplate
sogladev Oct 27, 2024
9daf91a
Merge branch 'master' into pr-rework
sogladev Oct 27, 2024
02a6e41
add spec info to gossip text e.g., "S6 PvP"
sogladev Oct 31, 2024
d66cc69
style
sogladev Oct 31, 2024
0ece44c
allow re-use of talents by adding override columns
sogladev Oct 31, 2024
bb9381d
maybe fix: set state to ITEM_CHANGED when destroying
sogladev Nov 14, 2024
fc309de
sql var text
sogladev Nov 15, 2024
6d4c0e7
change player to be after nullcheck
sogladev Nov 15, 2024
1f77715
remove redundant check
sogladev Nov 15, 2024
6a1ade1
declare str parameter as const
sogladev Nov 15, 2024
448c3e9
fixup! refactor: apply clang-tidy
sogladev Nov 15, 2024
91e7f94
fixup! fixup! refactor: apply clang-tidy
sogladev Nov 15, 2024
d581169
update readme
sogladev Nov 19, 2024
a98f3ba
remove unused vars
sogladev Nov 19, 2024
18315a4
add closegossip to default
sogladev Nov 19, 2024
a22fd0f
refactor to use find_if
sogladev Nov 19, 2024
7550754
Revert "refactor to use find_if"
sogladev Nov 19, 2024
d30bc81
remove unfinished copy command, refactor
sogladev Nov 19, 2024
6077824
encapsulate talent specification
sogladev Nov 19, 2024
1cace70
refactor: hungarian notation
sogladev Nov 19, 2024
1fc9a41
comment
sogladev Nov 19, 2024
444fb7e
readme: sql
sogladev Nov 19, 2024
386b13c
fix headers
sogladev Nov 19, 2024
9e0de9a
style: fix tab
sogladev Nov 19, 2024
e41572e
rename gearMask to mask
sogladev Nov 19, 2024
2b2d56b
rename playerSpecStr to playerSpec
sogladev Nov 19, 2024
3967db9
uncomment
sogladev Nov 19, 2024
4c5a12c
style
sogladev Nov 19, 2024
2b28fdd
fix lvl80 feral names
sogladev Nov 19, 2024
1bdfc60
revert changing npc text
sogladev Nov 19, 2024
34cda2d
style: replace \t with " "
sogladev Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore

## TemplateNPC-azerothcore
## mod-npc-talent-template

- Latest build status with azerothcore:

[![Build Status](https://github.com/azerothcore/mod-npc-talent-template/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-npc-talent-template)

Template NPC for AzerothCore 3.3.5
## Description
This mod introduces an NPC that allows players to instantly apply pre-configured character templates that gear up, gem, set talents, and apply glyphs for any class. Ideal for quick character optimization for various roles and scenarios.

* templates for level 80 PvP S6 and level 70 PvE T6
* race-specific gear options (e.g., humans receive no PvP trinket)
* administrator command for creating custom templates. Templates are managed directly through the database and config. No C++ edits needed

![](https://i.ibb.co/27WPR5j/Wo-WScrn-Shot-021219-000220.jpg)

Video Showcase:
https://streamable.com/yxv1m

## Creating custom gear sets
This process can only be done by an administrator and is error-prone. Creating gear sets should be done on a local development server and exporting sets from the DB to a `.sql` is recommended.

1. Setup a character with the desired gear set, gems, enchants, talents and glyphs.
2. `.templatenpc create [TemplateName]` creates database entries for gear, talents, glyphs and an entry in the index table for your class. A template name needs to be unique for that class and is case-sensitive. For example, when creating a PvP set for a lvl80 Restoration Druid `.templatenpc create Restoration80PvPS8`.
3. export to `.sql`
4. some manual changes are needed

The following entries are created in the `acore_characters` db:
a. `mod_npc_talent_template_gear`: gear for your class, spec and race. When exporting, modify the raceMask as needed. When creating spec set for multiple races, create a template for one race, export to sql then create template for a new race. Modify the raceMask as needed
b. `mod_npc_talent_template_talents`: no modifying needed
c. `mod_npc_talent_template_glyphs`: no modifying needed
d. `mod_npc_talent_template_index`: modify gossipText, actionId needs to be unique per spec. Gossip options are displayed according to their ID with the lowest ID at the top. You can override a column to re-use talents or glyphs or gear from another template. For example, talents and glyphs from `Restoration80PvP` can be re-used

`.templatenpc reload` to reload changes. Test with dropping `acore_characters.mod_npc_talent_template*` tables and updates from character db as needed
```sql
DELETE FROM acore_characters.updates WHERE name='npc_talent_template_data_1_80_pvp_s6.sql';
DELETE FROM acore_characters.updates WHERE name='npc_talent_template_data_2_70_pve_t6.sql';
DELETE FROM acore_characters.updates WHERE name='npc_talent_template.sql';
DROP TABLE IF EXISTS acore_characters.mod_npc_talent_template_gear;
DROP TABLE IF EXISTS acore_characters.mod_npc_talent_template_glyphs;
DROP TABLE IF EXISTS acore_characters.mod_npc_talent_template_index;
DROP TABLE IF EXISTS acore_characters.mod_npc_talent_template_talents;
```
19 changes: 16 additions & 3 deletions conf/npc_talent_template.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#
# NpcTalentTemplate.EnableResetTalents
# Description: Enables Gossip Option to reset talents
# Default: 0 - Disabled
# 1 - Enabled
# Default: 1 - Enabled
# 0 - Disabled
#

NpcTalentTemplate.EnableResetTalents = 0
NpcTalentTemplate.EnableResetTalents = 1

#
# NpcTalentTemplate.EnableRemoveAllGlyphs
Expand All @@ -31,3 +31,16 @@ NpcTalentTemplate.EnableRemoveAllGlyphs = 1
#

NpcTalentTemplate.EnableDestroyEquippedGear = 1

#
# NpcTalentTemplate.AllianceMount
# NpcTalentTemplate.HordeMount
# Description:
# Default: 51412 - BigBattleBear
# 43688 - AmaniWarBear
# 19902 - SwiftZulianTiger
# 0 - Disable
#

NpcTalentTemplate.AllianceMount = 51412
NpcTalentTemplate.HordeMount = 51412
2,473 changes: 30 additions & 2,443 deletions data/sql/db-characters/base/npc_talent_template.sql

Large diffs are not rendered by default.

2,465 changes: 2,465 additions & 0 deletions data/sql/db-characters/base/npc_talent_template_data_1_80_pvp_s6.sql

Large diffs are not rendered by default.

1,473 changes: 1,473 additions & 0 deletions data/sql/db-characters/base/npc_talent_template_data_2_70_pve_t6.sql

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions data/sql/db-world/base/npc_talent_template_command.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- COMMAND
DELETE FROM `command` WHERE `name`='templatenpc reload';
DELETE FROM `command` WHERE `name` IN ('templatenpc reload', 'templatenpc create');
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('templatenpc reload', 3, 'Syntax: .templatenpc reload\nType .templatenpc reload to reload Template NPC database changes');
('templatenpc reload', 3, 'Syntax: .templatenpc reload\nType .templatenpc reload to reload Template NPC database changes'),
('templatenpc create', 3, 'Syntax: .templatenpc create\nType .templatenpc create [name] to create a Template for your class with the desired name. This name is case-sensitive');
27 changes: 25 additions & 2 deletions data/sql/db-world/base/npc_talent_template_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,43 @@
SET @ENTRY := 55009;
SET @NAME := 'Pick a spec';
SET @SUBNAME := 'AzerothCore Template';
SET @TEXT := 'Here you can select a character template which will gear up, gem up, set talent specialization, and set glyphs for your character instantly.';
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');
(@ENTRY, @NAME , @SUBNAME, 'Speak', 0, 80, 80, 35, 1, 1, 1.14286, 1, 0, 1, 2, 7, 138936390, 1, 2, 'npc_talent_template');

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.');
(@ENTRY, @TEXT, @TEXT);

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);

-- module string
SET @MODULE_STRING := 'npc-talent-template';
DELETE FROM `module_string` WHERE `module` = @module_string;
INSERT INTO `module_string` (`module`, `id`, `string`) VALUES
(@MODULE_STRING, 1, 'You need to remove all your equipped items in order to use this feature!'),
(@MODULE_STRING, 2, 'You have already spent some talent points. You need to reset your talents first!'),
(@MODULE_STRING, 3, 'Successfully equipped {} {} template!'),
(@MODULE_STRING, 4, 'Your equipped gear has been destroyed.'),
(@MODULE_STRING, 5, 'Your glyphs have been removed.'),
(@MODULE_STRING, 6, 'NYI: Copied character {} successfully'),
(@MODULE_STRING, 7, 'You have unspent talent points. Please spend all your talent points and re-extract the template.'),
(@MODULE_STRING, 8, 'Get glyphs and re-extract the template!'),
(@MODULE_STRING, 9, 'Template successfully created!'),
(@MODULE_STRING, 10, 'Template skeleton successfully created! You can `.templatenpc reload` to test your template. WARNING: Templates need to be manually exported to `.sql`. See documentation for more info.'),
(@MODULE_STRING, 11, 'Reloading templates for Template NPC table...'),
(@MODULE_STRING, 12, 'Template NPC templates reloaded.');

-- 'deDE', 'ruRU', 'ruRU', 'koKR', 'frFR', 'zhCN', 'zhTW', 'esES', 'esMX',
DELETE FROM `module_string_locale` WHERE `module` = @MODULE_STRING;
-- INSERT INTO `module_string_locale` (`module`, `id`, `locale`, `string`) VALUES
-- (@MODULE_STRING, 0 , 'deDE', ''),
Loading
Loading