mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Code Cleaning - Error Messages - Progression Level Fixes (#820)
- removing some duplicate code - adding some error messages - removing achievements if player decides to go down in progression level. - on login your progression level will no longer go down, if it's currently higher than the highest kill achievement you got
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include "IndividualProgression.h"
|
||||
#include "naxxramas_40.h"
|
||||
|
||||
IndividualProgression* IndividualProgression::instance()
|
||||
{
|
||||
@@ -128,6 +129,14 @@ uint8 IndividualProgression::GetAccountProgression(uint32 accountId)
|
||||
return progressionLevel;
|
||||
}
|
||||
|
||||
void IndividualProgression::RemovePlayerAchievement(uint16 playerGUID, uint16 achievementId)
|
||||
{
|
||||
if (playerGUID && achievementId)
|
||||
{
|
||||
CharacterDatabase.Query("DELETE FROM `character_achievement` WHERE `guid` = {} AND `achievement` = {}", playerGUID, achievementId);
|
||||
}
|
||||
}
|
||||
|
||||
void IndividualProgression::LoadCustomProgressionEntries(std::string const& customProgressionString)
|
||||
{
|
||||
std::string delimitedValue;
|
||||
@@ -154,6 +163,30 @@ bool IndividualProgression::hasCustomProgressionValue(uint32 creatureEntry)
|
||||
return (customProgressionMap.find(creatureEntry) != customProgressionMap.end());
|
||||
}
|
||||
|
||||
bool IndividualProgression::isAttuned(Player* player)
|
||||
{
|
||||
if ((player->GetQuestStatus(NAXX40_ATTUNEMENT_1) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_2) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_3) == QUEST_STATUS_REWARDED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IndividualProgression::isExcludedFromProgression(Player* player)
|
||||
{
|
||||
if(!sIndividualProgression->excludeAccounts) {
|
||||
return false;
|
||||
}
|
||||
std::string accountName;
|
||||
bool accountNameFound = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
|
||||
std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex);
|
||||
return (accountNameFound && std::regex_match(accountName, excludedAccountsRegex));
|
||||
}
|
||||
|
||||
void IndividualProgression::checkIPProgression(Player* killer)
|
||||
{
|
||||
@@ -162,69 +195,110 @@ void IndividualProgression::checkIPProgression(Player* killer)
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 currentState = killer->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
|
||||
if (killer->HasAchieved(HALION_KILL)) // 4815
|
||||
{
|
||||
if (currentState < PROGRESSION_WOTLK_TIER_5)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_5);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(LICH_KING_KILL)) // 4597
|
||||
{
|
||||
if (currentState < PROGRESSION_WOTLK_TIER_4)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_4);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(ANUB_ARAK_KILL)) // 3916
|
||||
{
|
||||
if (currentState < PROGRESSION_WOTLK_TIER_3)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(KEL_THUZAD_KILL)) // 575
|
||||
{
|
||||
if (currentState < PROGRESSION_WOTLK_TIER_1)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_WOTLK_TIER_1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(KIL_JAEDEN_KILL)) // 698
|
||||
{
|
||||
if (currentState < PROGRESSION_TBC_TIER_5)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_5);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(ZUL_JIN_KILL)) // 691
|
||||
{
|
||||
if (currentState < PROGRESSION_TBC_TIER_4)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_4);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(ILLIDAN_KILL)) // 697
|
||||
{
|
||||
if (currentState < PROGRESSION_TBC_TIER_3)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_3);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(KAEL_THAS_KILL)) // 696
|
||||
{
|
||||
if (currentState < PROGRESSION_TBC_TIER_2)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(MALCHEZAAR_KILL)) // 690
|
||||
{
|
||||
if (currentState < PROGRESSION_TBC_TIER_1)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_TBC_TIER_1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(C_THUN_KILL)) // 687
|
||||
{
|
||||
if (currentState < PROGRESSION_AQ)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_AQ);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(NEFARIAN_KILL)) // 685
|
||||
{
|
||||
if (currentState < PROGRESSION_BLACKWING_LAIR)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_BLACKWING_LAIR);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(ONYXIAS_KILL)) // 684
|
||||
{
|
||||
if (currentState < PROGRESSION_ONYXIA)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_ONYXIA);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (killer->HasAchieved(RAGNAROS_KILL)) // 686
|
||||
{
|
||||
if (currentState < PROGRESSION_MOLTEN_CORE)
|
||||
{
|
||||
UpdateProgressionState(killer, PROGRESSION_MOLTEN_CORE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,10 +267,13 @@ public:
|
||||
void AdjustTBCStats(Player* player) const;
|
||||
void AdjustWotLKStats(Player* player) const;
|
||||
bool hasCustomProgressionValue(uint32 creatureEntry);
|
||||
bool isExcludedFromProgression(Player* player);
|
||||
bool isAttuned(Player* player);
|
||||
void checkIPProgression(Player* player);
|
||||
void UpdateProgressionQuests(Player* player);
|
||||
void checkKillProgression(Player* player, Creature* killed);
|
||||
static void LoadCustomProgressionEntries(const std::string& customProgressionString);
|
||||
static void RemovePlayerAchievement(uint16 playerGUID, uint16 achievementId);
|
||||
static void AdjustStats(Player* player, float computedPowerAdjustment, float computedHealthAdjustment);
|
||||
static float ComputeVanillaAdjustment(uint8 playerLevel, float configAdjustmentValue);
|
||||
static uint8 GetAccountProgression(uint32 accountId);
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
if (player->getClass() == CLASS_DEATH_KNIGHT && sIndividualProgression->deathKnightStartingProgression && !sIndividualProgression->hasPassedProgression(player, static_cast<ProgressionState>(sIndividualProgression->deathKnightStartingProgression)))
|
||||
{
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
if (isExcludedFromProgression(player))
|
||||
if (sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
sIndividualProgression->UpdateProgressionState(player, static_cast<ProgressionState>(0));
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
void OnPlayerSetMaxLevel(Player* player, uint32& maxPlayerLevel) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
void OnPlayerQuestComputeXP(Player* player, Quest const* quest, uint32& xpValue) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || !sIndividualProgression->questXpFix || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || !sIndividualProgression->questXpFix || sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
|
||||
void OnPlayerGiveXP(Player* player, uint32& amount, Unit* /*victim*/, uint8 xpSource) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -152,17 +152,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isExcludedFromProgression(Player* player)
|
||||
{
|
||||
if(!sIndividualProgression->excludeAccounts) {
|
||||
return false;
|
||||
}
|
||||
std::string accountName;
|
||||
bool accountNameFound = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
|
||||
std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex);
|
||||
return (accountNameFound && std::regex_match(accountName, excludedAccountsRegex));
|
||||
}
|
||||
|
||||
static bool isAttuned(Player* player)
|
||||
{
|
||||
if ((player->GetQuestStatus(NAXX40_ATTUNEMENT_1) == QUEST_STATUS_REWARDED) ||
|
||||
@@ -179,28 +168,28 @@ public:
|
||||
|
||||
bool OnPlayerBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float /*orientation*/, uint32 /*options*/, Unit* /*target*/) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || player->IsGameMaster() || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || player->IsGameMaster() || sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (mapid == MAP_ONYXIAS_LAIR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5) && !player->HasItemCount(ITEM_DRAKEFIRE_AMULET))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_BLACKWING_LAIR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_MOLTEN_CORE))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_MOLTEN_CORE);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_ZUL_GURUB && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_BLACKWING_LAIR))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_BLACKWING_LAIR);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_AHN_QIRAJ_TEMPLE && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_AQ))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_PRE_AQ);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_RUINS_OF_AHN_QIRAJ && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_AQ))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_PRE_AQ);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_OUTLAND)
|
||||
@@ -214,31 +203,39 @@ public:
|
||||
uint32 zoneId = map->GetZoneId(0, x, y, z);
|
||||
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_4) && zoneId == ZONE_QUELDANAS)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_4);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (mapid == MAP_ZUL_AMAN && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_3))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_3);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_NORTHREND && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_TBC_TIER_5);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_ULDUAR && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_1))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_1);
|
||||
return false;
|
||||
}
|
||||
if ((mapid == MAP_TRIAL_OF_THE_CHAMPION || mapid == MAP_TRIAL_OF_THE_CRUSADER) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_2)){
|
||||
if ((mapid == MAP_TRIAL_OF_THE_CHAMPION || mapid == MAP_TRIAL_OF_THE_CRUSADER) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_2))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_2);
|
||||
return false;
|
||||
}
|
||||
// This will also restrict other Frozen Halls dungeons, because Forge of Souls must be completed first to access them
|
||||
if ((mapid == MAP_ICECROWN_CITADEL || mapid == MAP_THE_FORGE_OF_SOULS) && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_3))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_3);
|
||||
return false;
|
||||
}
|
||||
if (mapid == MAP_THE_RUBY_SANCTUM && !sIndividualProgression->hasPassedProgression(player, PROGRESSION_WOTLK_TIER_4))
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("Progression Level Required = |cff00ffff{}|r", PROGRESSION_WOTLK_TIER_4);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -263,7 +260,7 @@ public:
|
||||
|
||||
void OnPlayerCompleteQuest(Player* player, Quest const* quest) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -323,9 +320,9 @@ public:
|
||||
|
||||
if (sIndividualProgression->enforceGroupRules) // enforceGroupRules enabled
|
||||
{
|
||||
if (!isExcludedFromProgression(player)) // player has a normal account
|
||||
if (!sIndividualProgression->isExcludedFromProgression(player)) // player has a normal account
|
||||
{
|
||||
if (isExcludedFromProgression(otherPlayer)) // RNDbot
|
||||
if (sIndividualProgression->isExcludedFromProgression(otherPlayer)) // RNDbot
|
||||
{
|
||||
if (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_PRE_TBC)) // player is in vanilla
|
||||
{
|
||||
@@ -371,7 +368,7 @@ public:
|
||||
}
|
||||
else // player has an excluded account
|
||||
{
|
||||
if (isExcludedFromProgression(otherPlayer)) // RNDbot
|
||||
if (sIndividualProgression->isExcludedFromProgression(otherPlayer)) // RNDbot
|
||||
{
|
||||
if (player->GetLevel() <= IP_LEVEL_VANILLA) // player is in vanilla
|
||||
{
|
||||
@@ -430,7 +427,7 @@ public:
|
||||
uint8 currentState = player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
uint8 otherPlayerState = groupLeader->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
|
||||
if (isExcludedFromProgression(player))
|
||||
if (sIndividualProgression->isExcludedFromProgression(player))
|
||||
{
|
||||
if (currentState != otherPlayerState)
|
||||
{
|
||||
@@ -471,7 +468,7 @@ public:
|
||||
|
||||
bool OnPlayerUpdateFishingSkill(Player* player, int32 /*skill*/, int32 /*zone_skill*/, int32 chance, int32 roll) override
|
||||
{
|
||||
if (!sIndividualProgression->enabled || !sIndividualProgression->fishingFix || isExcludedFromProgression(player))
|
||||
if (!sIndividualProgression->enabled || !sIndividualProgression->fishingFix || sIndividualProgression->isExcludedFromProgression(player))
|
||||
return true;
|
||||
if (chance < roll)
|
||||
return false;
|
||||
|
||||
@@ -16,10 +16,10 @@ public:
|
||||
{
|
||||
static ChatCommandTable individualProgressionTable =
|
||||
{
|
||||
{ "get", HandleGetIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "set", HandleSetIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "tele", HandleTeleIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "view", HandleViewIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "get", HandleViewIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
{ "view", HandleGetIndividualProgressionCommand, SEC_GAMEMASTER, Console::Yes },
|
||||
};
|
||||
|
||||
static ChatCommandTable commandTable =
|
||||
@@ -31,6 +31,17 @@ public:
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleGetIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
||||
{
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
uint32 progressionLevel = target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
std::string playername = target->GetName();
|
||||
|
||||
handler->PSendSysMessage("Progression Level for |cff00ffff{}|r = |cff00ffff{}|r", playername, progressionLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleSetIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, uint32 progressionLevel)
|
||||
{
|
||||
if (progressionLevel > PROGRESSION_WOTLK_TIER_5)
|
||||
@@ -42,6 +53,67 @@ public:
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
std::string playername = target->GetName();
|
||||
uint16 playerGUID = target->GetGUID().GetCounter();
|
||||
uint8 currentState = target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
|
||||
if (progressionLevel < currentState)
|
||||
{
|
||||
for (uint8 i = progressionLevel; i < currentState; ++i)
|
||||
{
|
||||
if (i == 0 && target->HasAchieved(RAGNAROS_KILL)) // 686
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, RAGNAROS_KILL);
|
||||
}
|
||||
else if (i == 1 && target->HasAchieved(ONYXIAS_KILL)) // 684
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, ONYXIAS_KILL);
|
||||
}
|
||||
else if (i == 2 && target->HasAchieved(NEFARIAN_KILL)) // 685
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, NEFARIAN_KILL);
|
||||
}
|
||||
else if (i == 5 && target->HasAchieved(C_THUN_KILL)) // 687
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, C_THUN_KILL);
|
||||
}
|
||||
else if (i == 8 && target->HasAchieved(MALCHEZAAR_KILL)) // 690
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, MALCHEZAAR_KILL);
|
||||
}
|
||||
else if (i == 9 && target->HasAchieved(KAEL_THAS_KILL)) // 696
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, KAEL_THAS_KILL);
|
||||
}
|
||||
else if (i == 10 && target->HasAchieved(ILLIDAN_KILL)) // 697
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, ILLIDAN_KILL);
|
||||
}
|
||||
else if (i == 11 && target->HasAchieved(ZUL_JIN_KILL)) // 691
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, ZUL_JIN_KILL);
|
||||
}
|
||||
else if (i == 12 && target->HasAchieved(KIL_JAEDEN_KILL)) // 698
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, KIL_JAEDEN_KILL);
|
||||
}
|
||||
else if (i == 13 && target->HasAchieved(KEL_THUZAD_KILL)) // 575
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, KEL_THUZAD_KILL);
|
||||
}
|
||||
else if (i == 15 && target->HasAchieved(ANUB_ARAK_KILL)) // 3916
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, ANUB_ARAK_KILL);
|
||||
}
|
||||
else if (i == 16 && target->HasAchieved(LICH_KING_KILL)) // 4597
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, LICH_KING_KILL);
|
||||
}
|
||||
else if (i == 17 && target->HasAchieved(HALION_KILL)) // 4815
|
||||
{
|
||||
sIndividualProgression->RemovePlayerAchievement(playerGUID, HALION_KILL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sIndividualProgression->ForceUpdateProgressionState(target, static_cast<ProgressionState>(progressionLevel));
|
||||
sIndividualProgression->UpdateProgressionQuests(target);
|
||||
@@ -50,31 +122,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleViewIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
||||
{
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
uint32 progressionLevel = target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
std::string playername = target->GetName();
|
||||
|
||||
handler->PSendSysMessage("Progression Level for |cff00ffff{}|r = |cff00ffff{}|r", playername, progressionLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool isAttuned(Player* player)
|
||||
{
|
||||
if ((player->GetQuestStatus(NAXX40_ATTUNEMENT_1) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_2) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_3) == QUEST_STATUS_REWARDED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool HandleTeleIndividualProgressionCommand(ChatHandler* handler, Optional<PlayerIdentifier> player, std::string location)
|
||||
{
|
||||
if (location != "naxx40" && location != "onyxia40" && location != "naxx" && location != "onyxia")
|
||||
@@ -88,7 +135,7 @@ public:
|
||||
uint32 progressionLevel = target->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
std::string playername = target->GetName();
|
||||
|
||||
if ((location == "naxx" || location == "naxx40" ) && ((progressionLevel < PROGRESSION_TBC_TIER_5 && isAttuned(target)) || target->IsGameMaster()))
|
||||
if ((location == "naxx" || location == "naxx40" ) && ((progressionLevel < PROGRESSION_TBC_TIER_5 && sIndividualProgression->isAttuned(target)) || target->IsGameMaster()))
|
||||
{
|
||||
target->SetRaidDifficulty(RAID_DIFFICULTY_10MAN_HEROIC);
|
||||
target->TeleportTo(533, 3005.51f, -3434.64f, 304.195f, 6.2831f);
|
||||
|
||||
@@ -9,21 +9,6 @@
|
||||
|
||||
class gobject_naxx40_tele : public GameObjectScript
|
||||
{
|
||||
private:
|
||||
static bool isAttuned(Player* player)
|
||||
{
|
||||
if ((player->GetQuestStatus(NAXX40_ATTUNEMENT_1) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_2) == QUEST_STATUS_REWARDED) ||
|
||||
(player->GetQuestStatus(NAXX40_ATTUNEMENT_3) == QUEST_STATUS_REWARDED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
gobject_naxx40_tele() : GameObjectScript("gobject_naxx40_tele") { }
|
||||
|
||||
@@ -38,25 +23,14 @@ public:
|
||||
return new gobject_naxx40_teleAI(object);
|
||||
}
|
||||
|
||||
bool isExcludedFromProgression(Player* player)
|
||||
{
|
||||
if(!sIndividualProgression->excludeAccounts) {
|
||||
return false;
|
||||
}
|
||||
std::string accountName;
|
||||
bool accountNameFound = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
|
||||
std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex);
|
||||
return (accountNameFound && std::regex_match(accountName, excludedAccountsRegex));
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* /*go*/) override
|
||||
{
|
||||
if ((isExcludedFromProgression(player) && (player->GetLevel() <= IP_LEVEL_TBC)) ||
|
||||
if ((sIndividualProgression->isExcludedFromProgression(player) && (player->GetLevel() <= IP_LEVEL_TBC)) ||
|
||||
((!sIndividualProgression->requireNaxxStrath || player->GetQuestStatus(NAXX40_ENTRANCE_FLAG) == QUEST_STATUS_REWARDED) && (!sIndividualProgression->hasPassedProgression(player, PROGRESSION_TBC_TIER_5))))
|
||||
{
|
||||
player->SetRaidDifficulty(RAID_DIFFICULTY_10MAN_HEROIC);
|
||||
|
||||
if (isAttuned(player) || isExcludedFromProgression(player))
|
||||
if (sIndividualProgression->isAttuned(player) || sIndividualProgression->isExcludedFromProgression(player))
|
||||
player->TeleportTo(533, 3005.51f, -3434.64f, 304.195f, 6.2831f);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -134,28 +134,17 @@ class onyxia_entrance_trigger : public AreaTriggerScript
|
||||
public:
|
||||
onyxia_entrance_trigger() : AreaTriggerScript("onyxia_entrance_trigger") { }
|
||||
|
||||
bool isExcludedFromProgression(Player* player)
|
||||
{
|
||||
if(!sIndividualProgression->excludeAccounts) {
|
||||
return false;
|
||||
}
|
||||
std::string accountName;
|
||||
bool accountNameFound = AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName);
|
||||
std::regex excludedAccountsRegex (sIndividualProgression->excludedAccountsRegex);
|
||||
return (accountNameFound && std::regex_match(accountName, excludedAccountsRegex));
|
||||
}
|
||||
|
||||
bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/) override
|
||||
{
|
||||
ChatHandler handler(player->GetSession());
|
||||
uint32 progressionLevel = player->GetPlayerSetting("mod-individual-progression", SETTING_PROGRESSION_STATE).value;
|
||||
|
||||
if (player->GetLevel() <= IP_LEVEL_TBC && progressionLevel < PROGRESSION_TBC_TIER_5 && (player->HasItemCount(ITEM_DRAKEFIRE_AMULET) || isExcludedFromProgression(player)))
|
||||
if (player->GetLevel() <= IP_LEVEL_TBC && progressionLevel < PROGRESSION_TBC_TIER_5 && (player->HasItemCount(ITEM_DRAKEFIRE_AMULET) || sIndividualProgression->isExcludedFromProgression(player)))
|
||||
{
|
||||
player->SetRaidDifficulty(RAID_DIFFICULTY_10MAN_HEROIC);
|
||||
player->TeleportTo(249, 29.1607f, -71.3372f, -8.18032f, 4.58f);
|
||||
}
|
||||
else if (player->GetLevel() == IP_LEVEL_WOTLK && (player->HasItemCount(ITEM_DRAKEFIRE_AMULET) || isExcludedFromProgression(player)))
|
||||
else if (player->GetLevel() == IP_LEVEL_WOTLK && (player->HasItemCount(ITEM_DRAKEFIRE_AMULET) || sIndividualProgression->isExcludedFromProgression(player)))
|
||||
{
|
||||
player->TeleportTo(249, 29.1607f, -71.3372f, -8.18032f, 4.58f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user