mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Code cleanup, add chat command
This commit is contained in:
3
sql/world/base/cs_individualProgression.sql
Normal file
3
sql/world/base/cs_individualProgression.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
DELETE FROM `command` WHERE `name` IN ('individualProgression set');
|
||||||
|
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||||
|
('individualProgression set', 2, 'Syntax: .individualProgression set $player $progressionLevel\nSets the player to the given progression level.');
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -108,5 +108,28 @@ enum ProgressionState : uint8
|
|||||||
PROGRESSION_WOTLK_TIER_5 = 16 // Ruby Sanctum
|
PROGRESSION_WOTLK_TIER_5 = 16 // Ruby Sanctum
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IndividualProgression
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static IndividualProgression* instance();
|
||||||
|
|
||||||
|
questXpMapType questXpMap;
|
||||||
|
float vanillaPowerAdjustment, vanillaHealthAdjustment, tbcPowerAdjustment, tbcHealthAdjustment, vanillaHealingAdjustment, tbcHealingAdjustment, previousGearTuning;
|
||||||
|
bool enabled, questXpFix, hunterPetLevelFix, requirePreAQQuests, enforceGroupRules, fishingFix, simpleConfigOverride, questMoneyAtLevelCap;
|
||||||
|
int progressionLimit, startingProgression;
|
||||||
|
|
||||||
|
bool hasPassedProgression(Player* player, ProgressionState state) const;
|
||||||
|
bool isBeforeProgression(Player* player, ProgressionState state) const;
|
||||||
|
void UpdateProgressionState(Player* player, ProgressionState newState) const;
|
||||||
|
void CheckAdjustments(Player* player) const;
|
||||||
|
void ApplyGearStatsTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
||||||
|
void ApplyGearHealthTuning(Player* player, float& computedAdjustment, ItemTemplate const* item) const;
|
||||||
|
void AdjustVanillaStats(Player* player) const;
|
||||||
|
void AdjustTBCStats(Player* player) const;
|
||||||
|
void AdjustWotLKStats(Player* player) const;
|
||||||
|
static void AdjustStats(Player* player, float computedAdjustment, float computedHealingAdjustment);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define sIndividualProgression IndividualProgression::instance()
|
||||||
|
|
||||||
#endif //AZEROTHCORE_INDIVIDUALPROGRESSION_H
|
#endif //AZEROTHCORE_INDIVIDUALPROGRESSION_H
|
||||||
|
|||||||
51
src/cs_individualProgression.cpp
Normal file
51
src/cs_individualProgression.cpp
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#include "Chat.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
#include "Tokenize.h"
|
||||||
|
#include "IndividualProgression.h"
|
||||||
|
|
||||||
|
using namespace Acore::ChatCommands;
|
||||||
|
|
||||||
|
class individualProgression_commandscript : public CommandScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
individualProgression_commandscript() : CommandScript("individualProgression_commandscript") { }
|
||||||
|
|
||||||
|
ChatCommandTable GetCommands() const override
|
||||||
|
{
|
||||||
|
static ChatCommandTable individualProgressionTable =
|
||||||
|
{
|
||||||
|
{ "set", HandleSetIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||||
|
};
|
||||||
|
|
||||||
|
static ChatCommandTable commandTable =
|
||||||
|
{
|
||||||
|
{ "individualProgression", individualProgressionTable },
|
||||||
|
};
|
||||||
|
|
||||||
|
return commandTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleSetIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint32 progressionLevel)
|
||||||
|
{
|
||||||
|
if (progressionLevel > PROGRESSION_WOTLK_TIER_5)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage("Invalid progression level.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player* target = player->GetConnectedPlayer();
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
sIndividualProgression->UpdateProgressionState(target, static_cast<ProgressionState>(progressionLevel));
|
||||||
|
handler->SendSysMessage("Progression state updated successfully");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddSC_individualProgression_commandscript()
|
||||||
|
{
|
||||||
|
new individualProgression_commandscript();
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||||
return target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value < PROGRESSION_NAXX40;
|
return sIndividualProgression->isBeforeProgression(target, PROGRESSION_NAXX40);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||||
return target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value >= PROGRESSION_TBC_TIER_5;
|
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_TBC_TIER_5);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventMap events;
|
EventMap events;
|
||||||
|
|||||||
Reference in New Issue
Block a user