Skip to content

Commit

Permalink
add small infrastructure for spec spells at lvl 10; add error catch a…
Browse files Browse the repository at this point in the history
…nd log; update message for level 10 spec
  • Loading branch information
hatersgit committed Nov 1, 2023
1 parent 367ec18 commit ccc9ee6
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DROP TABLE IF EXISTS `acore_world`.`forge_character_spec_spells`;
CREATE TABLE `acore_world`.`forge_character_spec_spells` (
`classId` INT(10) UNSIGNED NOT NULL,
`tabId` INT(10) UNSIGNED NOT NULL,
`level` INT(10) UNSIGNED NOT NULL,
`spell` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`tabId`, `level`)
) COLLATE='utf8_general_ci' ENGINE=InnoDB;
69 changes: 38 additions & 31 deletions modules/mod-Forge/src/ForgeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,37 +947,44 @@ class ForgeCache : public DatabaseScript
}
}

GetCharacters();
GetConfig();
AddTalentTrees();
AddTalentsToTrees();
AddTalentPrereqs();
AddTalentChoiceNodes();
AddTalentRanks();
AddTalentUnlearn();
AddCharacterSpecs();
AddTalentSpent();
AddCharacterTalents();
AddCharacterChoiceNodes();

LOG_INFO("server.load", "Loading characters points...");
AddCharacterPointsFromDB();
AddCharacterClassSpecs();
AddCharacterXmogSets();

LOG_INFO("server.load", "Loading m+ difficulty multipliers...");
sObjectMgr->LoadInstanceDifficultyMultiplier();
LOG_INFO("server.load", "Loading m+ difficulty level scales...");
sObjectMgr->LoadMythicLevelScale();
LOG_INFO("server.load", "Loading m+ minion values...");
sObjectMgr->LoadMythicMinionValue();
LOG_INFO("server.load", "Loading m+ keys...");
sObjectMgr->LoadMythicDungeonKeyMap();
LOG_INFO("server.load", "Loading m+ affixes...");
sObjectMgr->LoadMythicAffixes();

LOG_INFO("server.load", "Loading npc sounds...");
sObjectMgr->LoadNpcSounds();
try {
GetCharacters();
GetConfig();
AddTalentTrees();
AddTalentsToTrees();
AddTalentPrereqs();
AddTalentChoiceNodes();
AddTalentRanks();
AddTalentUnlearn();
AddCharacterSpecs();
AddTalentSpent();
AddCharacterTalents();
AddCharacterChoiceNodes();

LOG_INFO("server.load", "Loading characters points...");
AddCharacterPointsFromDB();
AddCharacterClassSpecs();
AddCharacterXmogSets();

LOG_INFO("server.load", "Loading m+ difficulty multipliers...");
sObjectMgr->LoadInstanceDifficultyMultiplier();
LOG_INFO("server.load", "Loading m+ difficulty level scales...");
sObjectMgr->LoadMythicLevelScale();
LOG_INFO("server.load", "Loading m+ minion values...");
sObjectMgr->LoadMythicMinionValue();
LOG_INFO("server.load", "Loading m+ keys...");
sObjectMgr->LoadMythicDungeonKeyMap();
LOG_INFO("server.load", "Loading m+ affixes...");
sObjectMgr->LoadMythicAffixes();

LOG_INFO("server.load", "Loading npc sounds...");
sObjectMgr->LoadNpcSounds();
}
catch (std::exception & ex) {
std::string error = ex.what();
LOG_ERROR("server.load", "ERROR IN FORGE CACHE BUILD: " + error);
throw ex;
}
}

void GetCharacters()
Expand Down
28 changes: 28 additions & 0 deletions modules/mod-Forge/src/ForgeCommonMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ bool ForgeCommonMessage::CanLearnTalent(Player* player, uint32 tabId, uint32 spe
fc->TryGetTalentTab(player, tabId, tab) &&
fc->TryGetCharacterActiveSpec(player, spec))
{
if (sConfigMgr->GetBoolDefault("Forge.StrictSpecs", false) && (!spec->CharacterSpecTabId || spec->CharacterSpecTabId != tabId /*|| not the class generic tree*/))
return false;

ForgeCharacterPoint* curPoints = fc->GetSpecPoints(player, tabType, spec->Id);

if (curPoints->Sum == 0)
Expand Down Expand Up @@ -546,3 +549,28 @@ void ForgeCommonMessage::SendActiveSpecInfo(Player* player)
player->SendForgeUIMsg(ForgeTopic::GET_CHARACTER_SPECS, msg);
}
}

void ForgeCommonMessage::SendSpecSelectInfo(Player* player)
{

std::list<ForgeTalentTab*> tabs;
if (fc->TryGetForgeTalentTabs(player, CharacterPointType::TALENT_TREE, tabs))
{
int i = 0;
std::string out = ""; // tabId;iconId;name;description?;spell~spell~spell~mastery?*
for (auto tab : tabs)
{
std::string sep = ";";
std::string delim = "*";
if (!i)
delim = "";

out += delim + std::to_string(tab->Id) + sep + std::to_string(tab->SpellIconId) + sep
+ tab->Name + sep + "TODO: hater add descriptions" + sep;

// get spells from forge_character_spec_spells where level = 10
}


}
}
1 change: 1 addition & 0 deletions modules/mod-Forge/src/ForgeCommonMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ForgeCommonMessage
void SendTalentTreeLayout(Player*, uint32);
void SendSpecInfo(Player*);
void SendActiveSpecInfo(Player* player);
void SendSpecSelectInfo(Player* player);
std::string BuildTree(Player*, CharacterPointType pointType, std::list<ForgeTalentTab*> tabs);
void ApplyKnownForgeSpells(Player*);
bool CanLearnTalent(Player*, uint32, uint32);
Expand Down
11 changes: 7 additions & 4 deletions modules/mod-Forge/src/ForgePlayerMessageHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class ForgePlayerMessageHandler : public PlayerScript
}

// If Remote Address matches, remove the player from the world
if (player->GetSession()->GetRemoteAddress() == _player->GetSession()->GetRemoteAddress() && ++count > 1)
{
player->GetSession()->KickPlayer();
}
//if (player->GetSession()->GetRemoteAddress() == _player->GetSession()->GetRemoteAddress() && ++count > 1)
//{
// player->GetSession()->KickPlayer();
//}
}

fc->ApplyAccountBoundTalents(player);
Expand Down Expand Up @@ -155,6 +155,9 @@ class ForgePlayerMessageHandler : public PlayerScript
cm->SendActiveSpecInfo(player);
cm->SendTalentTreeLayout(player);
cm->SendTalents(player);

if (!spec->CharacterSpecTabId) // Main spec not selected yet, prompt user
cm->SendSpecSelectInfo(player);
}

if (currentLevel == 80)
Expand Down

0 comments on commit ccc9ee6

Please sign in to comment.