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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
WIP commands
  • Loading branch information
sogladev committed Oct 25, 2024
commit 91a697f005cece4570847024397fde250e90293c
54 changes: 45 additions & 9 deletions src/TemplateNPC.cpp
Original file line number Diff line number Diff line change
@@ -353,25 +353,25 @@ bool sTemplateNPC::OverwriteTemplate(Player* player, std::string& playerSpecStr)
{
// Delete old talent and glyph templates before extracting new ones
CharacterDatabase.Execute("DELETE FROM `template_npc_talents` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
CharacterDatabase.Execute("DELETE FROM `template_npc_glyphs` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
// CharacterDatabase.Execute("DELETE FROM `template_npc_glyphs` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());

// Delete old gear templates before extracting new ones
if (player->getRace() == RACE_HUMAN)
{
CharacterDatabase.Execute("DELETE FROM `template_npc_human` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
player->GetSession()->SendAreaTriggerMessage("Template successfuly created!");
player->GetSession()->SendAreaTriggerMessage("Template successfully created!");
return false;
}
else if (player->GetTeamId() == TEAM_ALLIANCE && player->getRace() != RACE_HUMAN)
{
CharacterDatabase.Execute("DELETE FROM `template_npc_alliance` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
player->GetSession()->SendAreaTriggerMessage("Template successfuly created!");
// CharacterDatabase.Execute("DELETE FROM `template_npc_alliance` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
player->GetSession()->SendAreaTriggerMessage("Template successfully created!");
return false;
}
else if (player->GetTeamId() == TEAM_HORDE)
{
CharacterDatabase.Execute("DELETE FROM `template_npc_horde` WHERE `playerClass`='{}' AND `playerSpec`='{}'", GetClassString(player).c_str(), playerSpecStr.c_str());
player->GetSession()->SendAreaTriggerMessage("Template successfuly created!");
player->GetSession()->SendAreaTriggerMessage("Template successfully created!");
return false;
}
return true;
@@ -403,7 +403,7 @@ void sTemplateNPC::ExtractGearTemplateToDB(Player* player, std::string& playerSp

void sTemplateNPC::ExtractTalentTemplateToDB(Player* player, std::string& playerSpecStr)
{
QueryResult result = CharacterDatabase.Query("SELECT `spell` FROM `character_talent` WHERE `guid`={} AND `talentGroup`={}", player->GetGUID().GetCounter(), player->GetActiveSpecMask());
QueryResult result = CharacterDatabase.Query("SELECT `spell` FROM `character_talent` WHERE `guid`={} AND `specMask`={}", player->GetGUID().GetCounter(), player->GetActiveSpecMask());

if (!result)
{
@@ -1167,14 +1167,50 @@ class TemplateNPC_command : public CommandScript

ChatCommandTable GetCommands() const override
{
static ChatCommandTable createMageItemSetTable =
{
{ "fire", HandleCreateMageFireItemSetCommand, SEC_ADMINISTRATOR, Console::No },
};

static ChatCommandTable createItemSetCommandTable =
{
{ "mage", createMageItemSetTable, SEC_ADMINISTRATOR, Console::No },
};

static ChatCommandTable TemplateNPCTable =
{
{ "reload", HandleReloadTemplateNPCCommand, SEC_ADMINISTRATOR, Console::No },
{ "create", createItemSetCommandTable, SEC_ADMINISTRATOR, Console::No },
// {"copy", SEC_ADMINISTRATOR, false, &HandleCopyCommand, "Copies your target's gear onto your character. example: `.template copy`"},
// {"save", SEC_ADMINISTRATOR, false, nullptr, "", saveTable},
};

static ChatCommandTable commandTable =
{
{"templatenpc reload", HandleReloadTemplateNPCCommand, SEC_ADMINISTRATOR, Console::No},
};
{
{ "template", TemplateNPCTable},
};

return commandTable;
}

static bool HandleCreateMageFireItemSetCommand(ChatHandler* handler, const char* args)
{
Player* player = handler->GetSession()->GetPlayer();
if (player->getClass() != CLASS_MAGE)
{
player->GetSession()->SendAreaTriggerMessage("You're not a mage!");
return false;
}
player->SaveToDB(false, false);
sTemplateNpcMgr->sTalentsSpec = "Fire";
sTemplateNpcMgr->OverwriteTemplate(player, sTemplateNpcMgr->sTalentsSpec);
// sTemplateNpcMgr->ExtractGearTemplateToDB(player, sTemplateNpcMgr->sTalentsSpec);
sTemplateNpcMgr->ExtractTalentTemplateToDB(player, sTemplateNpcMgr->sTalentsSpec);
// sTemplateNpcMgr->ExtractGlyphsTemplateToDB(player, sTemplateNpcMgr->sTalentsSpec);
return true;
}


static bool HandleReloadTemplateNPCCommand(ChatHandler *handler)
{
LOG_INFO("module", "Reloading templates for Template NPC table...");