Make ClientExpertiseManager and CuiExpertise respect God Mode

This commit is contained in:
AconiteGodOfSWG
2020-12-04 21:34:02 -05:00
parent 12ade09660
commit 312b1b020f
2 changed files with 15 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
#include "clientGame/CreatureObject.h"
#include "clientGame/Game.h"
#include "clientGame/GameNetwork.h"
#include "clientGame/PlayerObject.h"
#include "clientUserInterface/CuiSkillManager.h"
#include "sharedFoundation/ExitChain.h"
#include "sharedNetworkMessages/ExpertiseRequestMessage.h"
@@ -588,7 +589,12 @@ int ClientExpertiseManager::getExpertisePointsSpentForPlayerInTreeUpToTier(int t
*/
int ClientExpertiseManager::getExpertisePointsRemainingForPlayer()
{
return getExpertisePointsTotalForPlayer() - getExpertisePointsSpentForPlayer();
if (PlayerObject::isAdmin()) {
return 999; // gods always have infinite expertise points
}
else {
return getExpertisePointsTotalForPlayer() - getExpertisePointsSpentForPlayer();
}
}
//----------------------------------------------------------------------
@@ -1083,6 +1089,11 @@ bool ClientExpertiseManager::canAllocateExpertise(std::string const & expertiseN
CreatureObject const * const player = Game::getPlayerCreature();
if (!player)
return false;
// you can allocate the expertise if you're in god mode
if (PlayerObject::isAdmin()) {
return true;
}
//Check if the player has all the prerequisites
SkillObject::SkillVector const prereqs = skill->getPrerequisiteSkills();

View File

@@ -905,6 +905,9 @@ void SwgCuiExpertise::updateExpertiseDisplayName()
m_expertiseDisplayName->SetLocalText(localizedDisplayName);
Unicode::String localizedDisplayDescription;
ClientExpertiseManager::localizeExpertiseDescription(m_currentBaseSkillName, localizedDisplayDescription);
if (PlayerObject::isAdmin()) {
localizedDisplayDescription.append(Unicode::narrowToWide("\n\\#ffff00 ***God Mode Override is On***\\#."));
}
m_expertiseDisplayDescription->SetLocalText(localizedDisplayDescription);
std::string const & iconPath = RoadmapManager::getIconPathForSkill(m_currentSkillName);