Core/Player: implement ResetCoolDownAfterDuel configurable feature
This commit is contained in:
1 parent
ba009ea2e2
commit
24b41a5211
10 files changed
+57
-2
No files matched your search
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `trinity_string` WHERE `entry` = 11010;
|
||||
INSERT INTO `trinity_string` VALUES
|
||||
(11010, 'You had cooldowns before starting the duel, so your cooldowns haven\'t been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
@@ -7610,6 +7610,20 @@ void Player::DuelComplete(DuelCompleteType type)
|
||||
duel->opponent->SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid::Empty);
|
||||
duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_RESET_COOLDOWN_AFTER_DUEL) &&
|
||||
type != DUEL_INTERRUPTED)
|
||||
{
|
||||
if (!HasCoolDownBeforeDuel())
|
||||
RemoveArenaSpellCooldowns(true);
|
||||
else
|
||||
ChatHandler(GetSession()).PSendSysMessage(LANG_COOLDOWN_NOT_RESET_AFTER_DUEL);
|
||||
|
||||
if (!duel->opponent->HasCoolDownBeforeDuel())
|
||||
duel->opponent->RemoveArenaSpellCooldowns(true);
|
||||
else
|
||||
ChatHandler(duel->opponent->GetSession()).PSendSysMessage(LANG_COOLDOWN_NOT_RESET_AFTER_DUEL);
|
||||
}
|
||||
|
||||
delete duel->opponent->duel;
|
||||
duel->opponent->duel = NULL;
|
||||
delete duel;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "PetDefines.h"
|
||||
#include "QuestDef.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "Unit.h"
|
||||
|
||||
#include <limits>
|
||||
@@ -284,7 +285,7 @@ struct PvPInfo
|
||||
|
||||
struct DuelInfo
|
||||
{
|
||||
DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0), isMounted(false) { }
|
||||
DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0), isMounted(false), hasCoolDownBeforeDuel(false) { }
|
||||
|
||||
Player* initiator;
|
||||
Player* opponent;
|
||||
@@ -292,6 +293,7 @@ struct DuelInfo
|
||||
time_t startTime;
|
||||
time_t outOfBound;
|
||||
bool isMounted;
|
||||
bool hasCoolDownBeforeDuel;
|
||||
};
|
||||
|
||||
struct Areas
|
||||
@@ -1946,6 +1948,9 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SetHonorPoints(uint32 value);
|
||||
void SetArenaPoints(uint32 value);
|
||||
|
||||
bool HasCoolDownBeforeDuel() const { return duel->hasCoolDownBeforeDuel; }
|
||||
void UpdateHasCoolDownBeforeDuel() { duel->hasCoolDownBeforeDuel = GetSpellHistory()->GetArenaCooldownsSize() > 0; }
|
||||
|
||||
//End of PvP System
|
||||
|
||||
void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
|
||||
|
||||
@@ -43,6 +43,9 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
TC_LOG_DEBUG("network", "Player 1 is: %u (%s)", player->GetGUID().GetCounter(), player->GetName().c_str());
|
||||
TC_LOG_DEBUG("network", "Player 2 is: %u (%s)", plTarget->GetGUID().GetCounter(), plTarget->GetName().c_str());
|
||||
|
||||
player->UpdateHasCoolDownBeforeDuel();
|
||||
plTarget->UpdateHasCoolDownBeforeDuel();
|
||||
|
||||
time_t now = time(NULL);
|
||||
player->duel->startTimer = now;
|
||||
plTarget->duel->startTimer = now;
|
||||
|
||||
@@ -1202,6 +1202,8 @@ enum TrinityStrings
|
||||
LANG_BAN_ACCOUNT_YOUPERMBANNEDMESSAGE_WORLD = 11007,
|
||||
|
||||
LANG_NPCINFO_INHABIT_TYPE = 11008,
|
||||
LANG_NPCINFO_FLAGS_EXTRA = 11009
|
||||
LANG_NPCINFO_FLAGS_EXTRA = 11009,
|
||||
|
||||
LANG_COOLDOWN_NOT_RESET_AFTER_DUEL = 11010
|
||||
};
|
||||
#endif
|
||||
@@ -637,6 +637,23 @@ void SpellHistory::BuildCooldownPacket(WorldPacket& data, uint8 flags, PacketCoo
|
||||
}
|
||||
}
|
||||
|
||||
uint16 SpellHistory::GetArenaCooldownsSize()
|
||||
{
|
||||
uint16 count = 0;
|
||||
|
||||
for (auto itr = _spellCooldowns.begin(); itr != _spellCooldowns.end();)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
|
||||
|
||||
if (spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS &&
|
||||
spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS)
|
||||
++count;
|
||||
++itr;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
template void SpellHistory::LoadFromDB<Player>(PreparedQueryResult cooldownsResult);
|
||||
template void SpellHistory::LoadFromDB<Pet>(PreparedQueryResult cooldownsResult);
|
||||
template void SpellHistory::SaveToDB<Player>(SQLTransaction& trans);
|
||||
|
||||
@@ -117,6 +117,7 @@ public:
|
||||
void BuildCooldownPacket(WorldPacket& data, uint8 flags, uint32 spellId, uint32 cooldown) const;
|
||||
|
||||
CooldownStorageType::size_type GetCooldownsSizeForPacket() const { return _spellCooldowns.size(); }
|
||||
uint16 GetArenaCooldownsSize();
|
||||
|
||||
private:
|
||||
Player* GetPlayerOwner() const;
|
||||
|
||||
@@ -1190,6 +1190,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49);
|
||||
m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false);
|
||||
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0);
|
||||
m_bool_configs[CONFIG_RESET_COOLDOWN_AFTER_DUEL] = sConfigMgr->GetBoolDefault("ResetCoolDownAfterDuel", 0);
|
||||
m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false);
|
||||
m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false);
|
||||
m_bool_configs[CONFIG_ALWAYS_MAXSKILL] = sConfigMgr->GetBoolDefault("AlwaysMaxWeaponSkill", false);
|
||||
|
||||
@@ -161,6 +161,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_ALLOW_TRACK_BOTH_RESOURCES,
|
||||
CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA,
|
||||
CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA,
|
||||
CONFIG_RESET_COOLDOWN_AFTER_DUEL,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -2604,6 +2604,14 @@ PlayerStart.MapsExplored = 0
|
||||
|
||||
HonorPointsAfterDuel = 0
|
||||
|
||||
#
|
||||
# ResetCoolDownAfterDuel
|
||||
# Description: Reset all cooldowns after duel, but only if player has no cooldowns before the duel.
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
ResetCoolDownAfterDuel = 0
|
||||
|
||||
#
|
||||
# AlwaysMaxWeaponSkill
|
||||
# Description: Players will automatically gain max weapon/defense skill when logging in,
|
||||
|
||||
Reference in new issue
Block a user