Core/Currency: Add support of Conquest points cap for arena and bg
Remove obselete code for arena points distribution Thanks to @Zakamurite
This commit is contained in:
1 parent
1ecc55272e
commit
f205bc9b4f
27 files changed
+520
-346
No files matched your search
@@ -0,0 +1 @@
|
||||
UPDATE `worldstates` SET `comment` = 'NextCurrencyDistributionTime' WHERE `entry` =20001;
|
||||
@@ -0,0 +1 @@
|
||||
DELETE FROM `command` WHERE `name`='flusharenapoints';
|
||||
@@ -0,0 +1 @@
|
||||
DELETE FROM `trinity_string` WHERE `entry` IN ('741','742','743','744','745','746');
|
||||
@@ -567,32 +567,6 @@ bool ArenaTeam::IsMember(uint64 guid) const
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 ArenaTeam::GetPoints(uint32 memberRating)
|
||||
{
|
||||
// Returns how many points would be awarded with this team type with this rating
|
||||
float points;
|
||||
|
||||
uint32 rating = memberRating + 150 < Stats.Rating ? memberRating : Stats.Rating;
|
||||
|
||||
if (rating <= 1500)
|
||||
{
|
||||
if (sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) < 6)
|
||||
points = (float)rating * 0.22f + 14.0f;
|
||||
else
|
||||
points = 344;
|
||||
}
|
||||
else
|
||||
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
||||
|
||||
// Type penalties for teams < 5v5
|
||||
if (Type == ARENA_TEAM_2v2)
|
||||
points *= 0.76f;
|
||||
else if (Type == ARENA_TEAM_3v3)
|
||||
points *= 0.88f;
|
||||
|
||||
return (uint32) points;
|
||||
}
|
||||
|
||||
uint32 ArenaTeam::GetAverageMMR(Group* group) const
|
||||
{
|
||||
if (!group)
|
||||
@@ -820,36 +794,6 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& playerPoints)
|
||||
{
|
||||
// Called after a match has ended and the stats are already modified
|
||||
// Helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
|
||||
// 10 played games per week is a minimum
|
||||
if (Stats.WeekGames < 10)
|
||||
return;
|
||||
|
||||
// To get points, a player has to participate in at least 30% of the matches
|
||||
uint32 requiredGames = (uint32)ceil(Stats.WeekGames * 0.3f);
|
||||
|
||||
for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
|
||||
{
|
||||
// The player participated in enough games, update his points
|
||||
uint32 pointsToAdd = 0;
|
||||
if (itr->WeekGames >= requiredGames)
|
||||
pointsToAdd = GetPoints(itr->PersonalRating);
|
||||
|
||||
std::map<uint32, uint32>::iterator plr_itr = playerPoints.find(GUID_LOPART(itr->Guid));
|
||||
if (plr_itr != playerPoints.end())
|
||||
{
|
||||
// Check if there is already more points
|
||||
if (plr_itr->second < pointsToAdd)
|
||||
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
|
||||
}
|
||||
else
|
||||
playerPoints[GUID_LOPART(itr->Guid)] = pointsToAdd;
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::SaveToDB()
|
||||
{
|
||||
// Save team and member stats to db
|
||||
|
||||
@@ -172,7 +172,6 @@ class ArenaTeam
|
||||
void SendStats(WorldSession* session);
|
||||
void Inspect(WorldSession* session, uint64 guid);
|
||||
|
||||
uint32 GetPoints(uint32 MemberRating);
|
||||
int32 GetMatchmakerRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
int32 GetRatingMod(uint32 ownRating, uint32 opponentRating, bool won);
|
||||
float GetChanceAgainst(uint32 ownRating, uint32 opponentRating);
|
||||
@@ -182,8 +181,6 @@ class ArenaTeam
|
||||
void MemberLost(Player* player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
|
||||
void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange = -12);
|
||||
|
||||
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
||||
|
||||
void FinishWeek();
|
||||
void FinishGame(int32 mod);
|
||||
|
||||
|
||||
@@ -134,61 +134,3 @@ void ArenaTeamMgr::LoadArenaTeams()
|
||||
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void ArenaTeamMgr::DistributeArenaPoints()
|
||||
{
|
||||
// Used to distribute arena points based on last week's stats
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_START);
|
||||
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
|
||||
|
||||
// Temporary structure for storing maximum points to add values for all players
|
||||
std::map<uint32, uint32> PlayerPoints;
|
||||
|
||||
// At first update all points for all team members
|
||||
for (ArenaTeamContainer::iterator teamItr = GetArenaTeamMapBegin(); teamItr != GetArenaTeamMapEnd(); ++teamItr)
|
||||
if (ArenaTeam* at = teamItr->second)
|
||||
at->UpdateArenaPointsHelper(PlayerPoints);
|
||||
|
||||
/*
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
// Cycle that gives points to all players
|
||||
PreparedStatement* stmt;
|
||||
|
||||
for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
|
||||
{
|
||||
// Add points to player if online
|
||||
if (Player* player = HashMapHolder<Player>::Find(playerItr->first))
|
||||
player->ModifyConquestPoints(playerItr->second, &trans);
|
||||
else // Update database
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS);
|
||||
stmt->setUInt32(0, playerItr->second);
|
||||
stmt->setUInt32(1, playerItr->first);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
*/
|
||||
|
||||
PlayerPoints.clear();
|
||||
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
|
||||
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
|
||||
for (ArenaTeamContainer::iterator titr = GetArenaTeamMapBegin(); titr != GetArenaTeamMapEnd(); ++titr)
|
||||
{
|
||||
if (ArenaTeam* at = titr->second)
|
||||
{
|
||||
at->FinishWeek();
|
||||
at->SaveToDB();
|
||||
at->NotifyStatsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
|
||||
|
||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_END);
|
||||
}
|
||||
@@ -40,8 +40,6 @@ public:
|
||||
ArenaTeamContainer::iterator GetArenaTeamMapBegin() { return ArenaTeamStore.begin(); }
|
||||
ArenaTeamContainer::iterator GetArenaTeamMapEnd() { return ArenaTeamStore.end(); }
|
||||
|
||||
void DistributeArenaPoints();
|
||||
|
||||
uint32 GenerateArenaTeamId();
|
||||
void SetNextArenaTeamId(uint32 Id) { NextArenaTeamId = Id; }
|
||||
|
||||
|
||||
@@ -907,6 +907,7 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
|
||||
player->ModifyCurrency(CURRENCY_TYPE_CONQUEST_META_ARENA, sWorld->getIntConfig(CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD));
|
||||
|
||||
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
}
|
||||
@@ -932,11 +933,15 @@ void Battleground::EndBattleground(uint32 winner)
|
||||
if (IsRandom() || BattlegroundMgr::IsBGWeekend(GetTypeID()))
|
||||
{
|
||||
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
|
||||
/*if (CanAwardArenaPoints())
|
||||
player->ModifyConquestPoints(player->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST);*/
|
||||
if (!player->GetRandomWinner())
|
||||
{
|
||||
// 100cp awarded for the first rated battleground won each day
|
||||
player->ModifyCurrency(CURRENCY_TYPE_CONQUEST_META_BG, BG_REWARD_WINNER_CONQUEST_FIRST);
|
||||
player->SetRandomWinner(true);
|
||||
}
|
||||
}
|
||||
else // 50cp awarded for each non-rated battleground won
|
||||
player->ModifyCurrency(CURRENCY_TYPE_CONQUEST_META_BG, BG_REWARD_WINNER_CONQUEST_LAST );
|
||||
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
|
||||
if (!guildAwarded)
|
||||
|
||||
@@ -134,14 +134,15 @@ enum BattlegroundBuffObjects
|
||||
BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905
|
||||
};
|
||||
|
||||
/// Battleground currency rewards. Should be with precision mod.
|
||||
enum BattlegroundRandomRewards
|
||||
{
|
||||
BG_REWARD_WINNER_HONOR_FIRST = 270,
|
||||
BG_REWARD_WINNER_CONQUEST_FIRST = 100,
|
||||
BG_REWARD_WINNER_HONOR_LAST = 135,
|
||||
BG_REWARD_WINNER_CONQUEST_LAST = 50,
|
||||
BG_REWARD_LOSER_HONOR_FIRST = 45,
|
||||
BG_REWARD_LOSER_HONOR_LAST = 35
|
||||
BG_REWARD_WINNER_HONOR_FIRST = 27000,
|
||||
BG_REWARD_WINNER_CONQUEST_FIRST = 10000,
|
||||
BG_REWARD_WINNER_HONOR_LAST = 13500,
|
||||
BG_REWARD_WINNER_CONQUEST_LAST = 5000,
|
||||
BG_REWARD_LOSER_HONOR_FIRST = 4500,
|
||||
BG_REWARD_LOSER_HONOR_LAST = 3500
|
||||
};
|
||||
|
||||
const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
BattlegroundMgr::BattlegroundMgr() :
|
||||
m_NextRatedArenaUpdate(sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)),
|
||||
m_AutoDistributionTimeChecker(0), m_ArenaTesting(false), m_Testing(false)
|
||||
m_ArenaTesting(false), m_Testing(false)
|
||||
{ }
|
||||
|
||||
BattlegroundMgr::~BattlegroundMgr()
|
||||
@@ -146,22 +146,6 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
else
|
||||
m_NextRatedArenaUpdate -= diff;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (time(NULL) > m_NextAutoDistributionTime)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
|
||||
}
|
||||
m_AutoDistributionTimeChecker = 600000; // check 10 minutes
|
||||
}
|
||||
else
|
||||
m_AutoDistributionTimeChecker -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, Player * player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype)
|
||||
@@ -1110,24 +1094,6 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
return;
|
||||
|
||||
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
time_t curtime = time(NULL);
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Initializing Automatic Arena Point Distribution");
|
||||
if (wstime < curtime)
|
||||
{
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: Next arena point distribution time in the past, reseting it now.");
|
||||
}
|
||||
else
|
||||
m_NextAutoDistributionTime = wstime;
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
if (!player)
|
||||
|
||||
@@ -30,8 +30,7 @@ typedef std::set<uint32> BattlegroundClientIdsContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
|
||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
|
||||
#define WS_ARENA_DISTRIBUTION_TIME 20001 // Custom worldstate
|
||||
#define WS_CURRENCY_RESET_TIME 20001 // Custom worldstate
|
||||
|
||||
struct CreateBattlegroundData
|
||||
{
|
||||
@@ -124,7 +123,6 @@ class BattlegroundMgr
|
||||
|
||||
uint32 GetMaxRatingDifference() const;
|
||||
uint32 GetRatingDiscardTimer() const;
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void LoadBattleMastersEntry();
|
||||
BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
@@ -150,8 +148,6 @@ class BattlegroundMgr
|
||||
BattlegroundSelectionWeightMap m_BGSelectionWeights;
|
||||
std::vector<uint64> m_QueueUpdateScheduler;
|
||||
uint32 m_NextRatedArenaUpdate;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
|
||||
@@ -525,10 +525,12 @@ enum VehicleSeatFlagsB
|
||||
// CurrencyTypes.dbc
|
||||
enum CurrencyTypes
|
||||
{
|
||||
CURRENCY_TYPE_CONQUEST_POINTS = 390,
|
||||
CURRENCY_TYPE_HONOR_POINTS = 392,
|
||||
CURRENCY_TYPE_JUSTICE_POINTS = 395,
|
||||
CURRENCY_TYPE_VALOR_POINTS = 396
|
||||
CURRENCY_TYPE_CONQUEST_POINTS = 390,
|
||||
CURRENCY_TYPE_HONOR_POINTS = 392,
|
||||
CURRENCY_TYPE_JUSTICE_POINTS = 395,
|
||||
CURRENCY_TYPE_VALOR_POINTS = 396,
|
||||
CURRENCY_TYPE_CONQUEST_META_ARENA = 483,
|
||||
CURRENCY_TYPE_CONQUEST_META_BG = 484,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -848,8 +848,8 @@ struct CurrencyCategoryEntry
|
||||
|
||||
struct CurrencyTypesEntry
|
||||
{
|
||||
uint32 ID; // 0 not used
|
||||
//uint32 Category; // 1 may be category
|
||||
uint32 ID; // 0 not used
|
||||
uint32 Category; // 1 may be category
|
||||
//char* name; // 2
|
||||
//char* iconName; // 3
|
||||
//uint32 unk4; // 4 all 0
|
||||
|
||||
@@ -49,7 +49,7 @@ char const CreatureModelDatafmt[]="nxxxxxxxxxxxxxffxxxxxxxxxxxxxxx";
|
||||
char const CreatureFamilyfmt[]="nfifiiiiixsx";
|
||||
char const CreatureSpellDatafmt[]="niiiixxxx";
|
||||
char const CreatureTypefmt[]="nxx";
|
||||
char const CurrencyTypesfmt[]="nxxxxxiiiix";
|
||||
char const CurrencyTypesfmt[]="nixxxxiiiix";
|
||||
|
||||
char const DestructibleModelDatafmt[]="ixxixxxixxxixxxixxxxxxxx";
|
||||
char const DungeonEncounterfmt[]="iiixisxx";
|
||||
|
||||
@@ -219,6 +219,13 @@ enum CurrencyFlags
|
||||
CURRENCY_FLAG_COUNT_SEASON_TOTAL = 0x80,
|
||||
};
|
||||
|
||||
enum CurrencyCategory
|
||||
{
|
||||
// ...
|
||||
CURRENCY_CATEGORY_META_CONQUEST = 89,
|
||||
// ...
|
||||
};
|
||||
|
||||
enum ItemVendorType
|
||||
{
|
||||
ITEM_VENDOR_TYPE_ITEM = 1,
|
||||
|
||||
@@ -858,6 +858,8 @@ Player::Player(WorldSession* session): Unit(true), phaseMgr(this)
|
||||
SetPendingBind(0, 0);
|
||||
|
||||
_activeCheats = CHEAT_NONE;
|
||||
_maxPersonalArenaRate = 0;
|
||||
_ConquestCurrencyTotalWeekCap = 0;
|
||||
|
||||
memset(_voidStorageItems, 0, VOID_STORAGE_MAX_SLOT * sizeof(VoidStorageItem*));
|
||||
memset(_CUFProfiles, 0, MAX_CUF_PROFILES * sizeof(CUFProfile*));
|
||||
@@ -1022,9 +1024,9 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
|
||||
InitRunes();
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_COINAGE, sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY));
|
||||
SetCurrency(CURRENCY_TYPE_HONOR_POINTS, sWorld->getIntConfig(CONFIG_START_HONOR_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_JUSTICE_POINTS, sWorld->getIntConfig(CONFIG_START_JUSTICE_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, sWorld->getIntConfig(CONFIG_START_ARENA_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_HONOR_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_HONOR_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_JUSTICE_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_JUSTICE_POINTS));
|
||||
SetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_CONQUEST_POINTS));
|
||||
|
||||
// start with every map explored
|
||||
if (sWorld->getBoolConfig(CONFIG_START_ALL_EXPLORED))
|
||||
@@ -7255,6 +7257,14 @@ void Player::_LoadCurrency(PreparedQueryResult result)
|
||||
|
||||
_currencyStorage.insert(PlayerCurrenciesMap::value_type(currencyID, cur));
|
||||
|
||||
// load total conquest cap. should be after insert.
|
||||
if (currency->Category == CURRENCY_CATEGORY_META_CONQUEST)
|
||||
{
|
||||
uint32 cap = _GetCurrencyWeekCap(currency);
|
||||
if (cap > _ConquestCurrencyTotalWeekCap)
|
||||
_ConquestCurrencyTotalWeekCap = cap;
|
||||
}
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -7336,12 +7346,16 @@ void Player::SendCurrencies() const
|
||||
{
|
||||
ByteBuffer currencyData;
|
||||
WorldPacket packet(SMSG_INIT_CURRENCY, 4 + _currencyStorage.size()*(5*4 + 1));
|
||||
size_t count_pos = packet.bitwpos();
|
||||
packet.WriteBits(_currencyStorage.size(), 23);
|
||||
|
||||
size_t count = 0;
|
||||
for (PlayerCurrenciesMap::const_iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
|
||||
{
|
||||
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(itr->first);
|
||||
if (!entry) // should never happen
|
||||
|
||||
// not send init meta currencies.
|
||||
if (!entry || entry->Category == CURRENCY_CATEGORY_META_CONQUEST)
|
||||
continue;
|
||||
|
||||
uint32 precision = (entry->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1;
|
||||
@@ -7363,17 +7377,59 @@ void Player::SendCurrencies() const
|
||||
currencyData << uint32(entry->ID);
|
||||
if (weekCount)
|
||||
currencyData << uint32(weekCount);
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
packet.FlushBits();
|
||||
packet.append(currencyData);
|
||||
packet.PutBits(count_pos, count, 23);
|
||||
GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
uint32 Player::GetCurrency(uint32 id) const
|
||||
void Player::SendPvpRewards() const
|
||||
{
|
||||
WorldPacket packet(SMSG_REQUEST_PVP_REWARDS_RESPONSE, 24);
|
||||
packet << GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
packet << GetCurrencyOnWeek(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
packet << GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_ARENA, true);
|
||||
packet << GetCurrencyOnWeek(CURRENCY_TYPE_CONQUEST_META_ARENA, true);
|
||||
packet << GetCurrencyOnWeek(CURRENCY_TYPE_CONQUEST_META_BG, true);
|
||||
packet << GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
packet << GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_BG, true);
|
||||
GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
uint32 Player::GetCurrency(uint32 id, bool precision) const
|
||||
{
|
||||
PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
|
||||
return itr != _currencyStorage.end() ? itr->second.totalCount : 0;
|
||||
if (itr == _currencyStorage.end())
|
||||
return 0;
|
||||
|
||||
if (!precision)
|
||||
return itr->second.totalCount;
|
||||
|
||||
CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id);
|
||||
ASSERT(currency);
|
||||
|
||||
int32 mod = currency->Flags & CURRENCY_FLAG_HIGH_PRECISION ? 100 : 1;
|
||||
return itr->second.totalCount / mod;
|
||||
}
|
||||
|
||||
uint32 Player::GetCurrencyOnWeek(uint32 id, bool precision) const
|
||||
{
|
||||
PlayerCurrenciesMap::const_iterator itr = _currencyStorage.find(id);
|
||||
if (itr == _currencyStorage.end())
|
||||
return 0;
|
||||
|
||||
if (!precision)
|
||||
return itr->second.weekCount;
|
||||
|
||||
CurrencyTypesEntry const* currency = sCurrencyTypesStore.LookupEntry(id);
|
||||
ASSERT(currency);
|
||||
|
||||
int32 mod = currency->Flags & CURRENCY_FLAG_HIGH_PRECISION ? 100 : 1;
|
||||
return itr->second.weekCount / mod;
|
||||
}
|
||||
|
||||
bool Player::HasCurrency(uint32 id, uint32 count) const
|
||||
@@ -7412,9 +7468,9 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
oldWeekCount = itr->second.weekCount;
|
||||
}
|
||||
|
||||
// count can't be more then weekCap.
|
||||
// count can't be more then weekCap if used (weekCap > 0)
|
||||
uint32 weekCap = _GetCurrencyWeekCap(currency);
|
||||
if (count > int32(weekCap))
|
||||
if (weekCap && count > int32(weekCap))
|
||||
count = weekCap;
|
||||
|
||||
int32 newTotalCount = int32(oldTotalCount) + count;
|
||||
@@ -7427,7 +7483,6 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
|
||||
ASSERT(weekCap >= oldWeekCount);
|
||||
|
||||
// TODO: fix conquest points
|
||||
// if we get more then weekCap just set to limit
|
||||
if (weekCap && int32(weekCap) < newWeekCount)
|
||||
{
|
||||
@@ -7457,6 +7512,16 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
if (count > 0)
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CURRENCY, id, count);
|
||||
|
||||
if (currency->Category == CURRENCY_CATEGORY_META_CONQUEST)
|
||||
{
|
||||
//original conquest cap is highest of bg/arena conquest cap.
|
||||
if(weekCap > _ConquestCurrencyTotalWeekCap)
|
||||
_ConquestCurrencyTotalWeekCap = weekCap;
|
||||
// count was changed to week limit, now we can modify original points.
|
||||
ModifyCurrency(CURRENCY_TYPE_CONQUEST_POINTS, count, printLog );
|
||||
return;
|
||||
}
|
||||
|
||||
// on new case just set init.
|
||||
if(itr->second.state == PLAYERCURRENCY_NEW)
|
||||
{
|
||||
@@ -7484,45 +7549,94 @@ void Player::ModifyCurrency(uint32 id, int32 count, bool printLog/* = true*/, bo
|
||||
|
||||
void Player::SetCurrency(uint32 id, uint32 count, bool printLog /*= true*/)
|
||||
{
|
||||
ModifyCurrency(id, int32(count) - GetCurrency(id), printLog);
|
||||
PlayerCurrenciesMap::iterator itr = _currencyStorage.find(id);
|
||||
if (itr == _currencyStorage.end())
|
||||
{
|
||||
PlayerCurrency cur;
|
||||
cur.state = PLAYERCURRENCY_NEW;
|
||||
cur.totalCount = count;
|
||||
cur.weekCount = 0;
|
||||
_currencyStorage[id] = cur;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Player::GetCurrencyWeekCap(uint32 id, bool usePrecision) const
|
||||
{
|
||||
CurrencyTypesEntry const* entry = sCurrencyTypesStore.LookupEntry(id);
|
||||
if (!entry)
|
||||
return 0;
|
||||
|
||||
uint32 cap = _GetCurrencyWeekCap(entry);
|
||||
if(usePrecision && entry->Flags & CURRENCY_FLAG_HIGH_PRECISION)
|
||||
cap /= 100;
|
||||
|
||||
return cap;
|
||||
}
|
||||
|
||||
void Player::ResetCurrencyWeekCap()
|
||||
{
|
||||
for (uint32 arenaSlot = 0; arenaSlot < MAX_ARENA_SLOT; arenaSlot++)
|
||||
{
|
||||
if (uint32 arenaTeamId = GetArenaTeamId(arenaSlot))
|
||||
{
|
||||
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
|
||||
arenaTeam->FinishWeek(); // set played this week etc values to 0 in memory, too
|
||||
arenaTeam->SaveToDB(); // save changes
|
||||
arenaTeam->NotifyStatsChanged(); // notify the players of the changes
|
||||
}
|
||||
}
|
||||
|
||||
for (PlayerCurrenciesMap::iterator itr = _currencyStorage.begin(); itr != _currencyStorage.end(); ++itr)
|
||||
{
|
||||
itr->second.weekCount = 0;
|
||||
itr->second.state = PLAYERCURRENCY_CHANGED;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_WEEKLY_RESET_CURRENCY, 0);
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
uint32 Player::_GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const
|
||||
{
|
||||
uint32 cap = currency->WeekCap;
|
||||
switch (currency->ID)
|
||||
{
|
||||
case CURRENCY_TYPE_CONQUEST_POINTS:
|
||||
{
|
||||
// TODO: implement
|
||||
cap = 0;
|
||||
break;
|
||||
}
|
||||
case CURRENCY_TYPE_HONOR_POINTS:
|
||||
{
|
||||
uint32 honorcap = sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS);
|
||||
if (honorcap > 0)
|
||||
cap = honorcap;
|
||||
break;
|
||||
}
|
||||
case CURRENCY_TYPE_JUSTICE_POINTS:
|
||||
{
|
||||
uint32 justicecap = sWorld->getIntConfig(CONFIG_MAX_JUSTICE_POINTS);
|
||||
if (justicecap > 0)
|
||||
cap = justicecap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32 cap = currency->WeekCap;
|
||||
|
||||
switch (currency->ID)
|
||||
{
|
||||
//original conquest not have week cap
|
||||
case CURRENCY_TYPE_CONQUEST_POINTS:
|
||||
return _ConquestCurrencyTotalWeekCap;
|
||||
case CURRENCY_TYPE_CONQUEST_META_ARENA:
|
||||
// should add precision mod = 100
|
||||
return Trinity::Currency::ConquestRatingCalculator(_maxPersonalArenaRate) * 100;
|
||||
case CURRENCY_TYPE_CONQUEST_META_BG:
|
||||
// should add precision mod = 100
|
||||
return Trinity::Currency::BgConquestRatingCalculator(GetRBGPersonalRating()) * 100;
|
||||
case CURRENCY_TYPE_HONOR_POINTS:
|
||||
{
|
||||
uint32 honorcap = sWorld->getIntConfig(CONFIG_CURRENCY_MAX_HONOR_POINTS);
|
||||
if (honorcap > 0)
|
||||
cap = honorcap;
|
||||
break;
|
||||
}
|
||||
case CURRENCY_TYPE_JUSTICE_POINTS:
|
||||
{
|
||||
uint32 justicecap = sWorld->getIntConfig(CONFIG_CURRENCY_MAX_JUSTICE_POINTS);
|
||||
if (justicecap > 0)
|
||||
cap = justicecap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cap != currency->WeekCap && IsInWorld() && !GetSession()->PlayerLoading())
|
||||
{
|
||||
WorldPacket packet(SMSG_UPDATE_CURRENCY_WEEK_LIMIT, 8);
|
||||
packet << uint32(cap / ((currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? 100 : 1));
|
||||
packet << uint32(currency->ID);
|
||||
GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
return cap;
|
||||
|
||||
if (cap != currency->WeekCap && IsInWorld() && !GetSession()->PlayerLoading())
|
||||
{
|
||||
WorldPacket packet(SMSG_UPDATE_CURRENCY_WEEK_LIMIT, 8);
|
||||
packet << uint32(cap / ((currency->Flags & CURRENCY_FLAG_HIGH_PRECISION) ? CURRENCY_PRECISION : 1));
|
||||
packet << uint32(currency->ID);
|
||||
GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
return cap;
|
||||
}
|
||||
|
||||
void Player::SetInGuild(uint32 guildId)
|
||||
@@ -7556,6 +7670,13 @@ uint8 Player::GetRankFromDB(uint64 guid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
|
||||
if (type == ARENA_TEAM_PERSONAL_RATING && value > _maxPersonalArenaRate)
|
||||
_maxPersonalArenaRate = value;
|
||||
}
|
||||
|
||||
uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENA_TEAM_ID_BY_PLAYER_GUID);
|
||||
@@ -20720,6 +20841,11 @@ void Player::LeaveAllArenaTeams(uint64 guid)
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
uint32 Player::GetRBGPersonalRating() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Player::SetRestBonus (float rest_bonus_new)
|
||||
{
|
||||
// Prevent resting on max level
|
||||
|
||||
@@ -1454,12 +1454,19 @@ class Player : public Unit, public GridObject<Player>
|
||||
void SendNewCurrency(uint32 id) const;
|
||||
/// send full data about all currencies to client
|
||||
void SendCurrencies() const;
|
||||
/// send conquest currency points and their cap week/arena
|
||||
void SendPvpRewards() const;
|
||||
/// return count of currency witch has plr
|
||||
uint32 GetCurrency(uint32 id) const;
|
||||
uint32 GetCurrency(uint32 id, bool precision) const;
|
||||
/// return count of currency gaind on current week
|
||||
uint32 GetCurrencyOnWeek(uint32 id, bool precision) const;
|
||||
/// return week cap by currency id
|
||||
uint32 GetCurrencyWeekCap(uint32 id, bool usePrecision) const;
|
||||
/// return presence related currency
|
||||
bool HasCurrency(uint32 id, uint32 count) const;
|
||||
/// @todo: not understand why it subtract from total count and for what it used. It should be remove and replaced by ModifyCurrency
|
||||
/// initialize currency count for custom initialization at create character
|
||||
void SetCurrency(uint32 id, uint32 count, bool printLog = true);
|
||||
void ResetCurrencyWeekCap();
|
||||
|
||||
/**
|
||||
* @name ModifyCurrency
|
||||
@@ -2045,16 +2052,14 @@ class Player : public Unit, public GridObject<Player>
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_ID, ArenaTeamId);
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, type);
|
||||
}
|
||||
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + type, value);
|
||||
}
|
||||
void SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value);
|
||||
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
|
||||
static void LeaveAllArenaTeams(uint64 guid);
|
||||
uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
|
||||
uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
|
||||
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
|
||||
uint32 GetRBGPersonalRating() const;
|
||||
|
||||
Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
|
||||
Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
|
||||
@@ -2890,6 +2895,13 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint32 m_currentBuybackSlot;
|
||||
|
||||
PlayerCurrenciesMap _currencyStorage;
|
||||
|
||||
/**
|
||||
* @name _GetCurrencyWeekCap
|
||||
* @brief return week cap for selected currency
|
||||
|
||||
* @param currency CurrencyTypesEntry witch should get week cap
|
||||
*/
|
||||
uint32 _GetCurrencyWeekCap(const CurrencyTypesEntry* currency) const;
|
||||
|
||||
VoidStorageItem* _voidStorageItems[VOID_STORAGE_MAX_SLOT];
|
||||
@@ -3096,6 +3108,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint32 _pendingBindTimer;
|
||||
|
||||
uint32 _activeCheats;
|
||||
uint32 _maxPersonalArenaRate;
|
||||
uint32 _ConquestCurrencyTotalWeekCap;
|
||||
|
||||
PhaseMgr phaseMgr;
|
||||
};
|
||||
|
||||
@@ -784,3 +784,78 @@ void WorldSession::HandleReportPvPAFK(WorldPacket & recvData)
|
||||
|
||||
reportedPlayer->ReportedAfkBy(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestRatedBgInfo(WorldPacket & recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REQUEST_RATED_BG_INFO");
|
||||
|
||||
uint8 unk;
|
||||
recvData >> unk;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleRequestRatedBgInfo: get unk = %u", unk);
|
||||
|
||||
/// @Todo: perfome research in this case
|
||||
/// The unk fields are related to arenas
|
||||
WorldPacket data(SMSG_RATED_BG_STATS, 72);
|
||||
data << uint32(0); // BgWeeklyWins20vs20
|
||||
data << uint32(0); // BgWeeklyPlayed20vs20
|
||||
data << uint32(0); // BgWeeklyPlayed15vs15
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyWins10vs10
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyWins15vs15
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0); // BgWeeklyPlayed10vs10
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestPvpOptions(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REQUEST_PVP_OPTIONS_ENABLED");
|
||||
|
||||
/// @Todo: perfome research in this case
|
||||
WorldPacket data(SMSG_PVP_OPTIONS_ENABLED, 1);
|
||||
data.WriteBit(1);
|
||||
data.WriteBit(1); // WargamesEnabled
|
||||
data.WriteBit(1);
|
||||
data.WriteBit(1); // RatedBGsEnabled
|
||||
data.WriteBit(1); // RatedArenasEnabled
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestPvpReward(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REQUEST_PVP_REWARDS");
|
||||
|
||||
_player->SendPvpRewards();
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestRatedBgStats(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REQUEST_RATED_BG_STATS");
|
||||
|
||||
WorldPacket data(SMSG_BATTLEFIELD_RATED_INFO, 29);
|
||||
data << uint32(0); // Reward
|
||||
data << uint8(3); // unk
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
data << _player->GetCurrencyWeekCap(CURRENCY_TYPE_CONQUEST_META_BG, true);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(0); // unk
|
||||
data << _player->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, true);
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -224,6 +224,26 @@ namespace Trinity
|
||||
return rate;
|
||||
}
|
||||
} // namespace Trinity::XP
|
||||
|
||||
namespace Currency
|
||||
{
|
||||
inline uint32 ConquestRatingCalculator(uint32 rate)
|
||||
{
|
||||
if (rate <= 1500)
|
||||
return 1350; // Default conquest points
|
||||
else if (rate > 3000)
|
||||
rate = 3000;
|
||||
|
||||
// http://www.arenajunkies.com/topic/179536-conquest-point-cap-vs-personal-rating-chart/page__st__60#entry3085246
|
||||
return 1.4326 * ((1511.26 / (1 + 1639.28 / exp(0.00412 * rate))) + 850.15);
|
||||
}
|
||||
|
||||
inline uint32 BgConquestRatingCalculator(uint32 rate)
|
||||
{
|
||||
// WowWiki: Battleground ratings receive a bonus of 22.2% to the cap they generate
|
||||
return ConquestRatingCalculator(rate)*1.222f;
|
||||
}
|
||||
} // namespace Trinity::Currency
|
||||
} // namespace Trinity
|
||||
|
||||
#endif
|
||||
@@ -707,12 +707,12 @@ enum TrinityStrings
|
||||
LANG_DEBUG_ARENA_OFF = 738,
|
||||
LANG_DEBUG_BG_ON = 739,
|
||||
LANG_DEBUG_BG_OFF = 740,
|
||||
LANG_DIST_ARENA_POINTS_START = 741,
|
||||
LANG_DIST_ARENA_POINTS_ONLINE_START = 742,
|
||||
LANG_DIST_ARENA_POINTS_ONLINE_END = 743,
|
||||
LANG_DIST_ARENA_POINTS_TEAM_START = 744,
|
||||
LANG_DIST_ARENA_POINTS_TEAM_END = 745,
|
||||
LANG_DIST_ARENA_POINTS_END = 746,
|
||||
// LANG_DIST_ARENA_POINTS_START = 741,
|
||||
// LANG_DIST_ARENA_POINTS_ONLINE_START = 742,
|
||||
// LANG_DIST_ARENA_POINTS_ONLINE_END = 743,
|
||||
// LANG_DIST_ARENA_POINTS_TEAM_START = 744,
|
||||
// LANG_DIST_ARENA_POINTS_TEAM_END = 745,
|
||||
// LANG_DIST_ARENA_POINTS_END = 746,
|
||||
LANG_BG_DISABLED = 747,
|
||||
LANG_ARENA_DISABLED = 748,
|
||||
// = 749, not used
|
||||
|
||||
@@ -453,11 +453,11 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_INSPECT_RATED_BG_STATS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PARTY_MEMBER_STATS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPartyMemberStatsOpcode);
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PET_INFO, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPetInfoOpcode );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PVP_OPTIONS_ENABLED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PVP_REWARDS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PVP_OPTIONS_ENABLED, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestPvpOptions );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_PVP_REWARDS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestPvpReward );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RAID_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestRaidInfoOpcode );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RATED_BG_INFO, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RATED_BG_STATS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RATED_BG_INFO, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestRatedBgInfo );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RATED_BG_STATS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleRequestRatedBgStats );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_RESEARCH_HISTORY, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_VEHICLE_EXIT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestVehicleExit );
|
||||
DEFINE_OPCODE_HANDLER(CMSG_REQUEST_VEHICLE_NEXT_SEAT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleChangeSeatsOnControlledVehicle);
|
||||
@@ -673,7 +673,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_MGR_STATE_CHANGE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_PLAYER_POSITIONS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_PORT_DENIED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_RATED_INFO, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_RATED_INFO, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_QUEUED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_BATTLEFIELD_STATUS_ACTIVE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
@@ -1089,7 +1089,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER(SMSG_PROPOSE_LEVEL_GRANT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_PVP_CREDIT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_PVP_LOG_DATA, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_PVP_OPTIONS_ENABLED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_PVP_OPTIONS_ENABLED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_QUERY_QUESTS_COMPLETED_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_QUERY_TIME_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_QUESTGIVER_OFFER_REWARD, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
@@ -1120,7 +1120,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RAID_SUMMON_FAILED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RANDOMIZE_CHAR_NAME, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RATED_BG_RATING, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RATED_BG_STATS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RATED_BG_STATS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_READ_ITEM_FAILED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_READ_ITEM_OK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REALM_SPLIT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
@@ -1133,7 +1133,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REMOVED_SPELL, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REPORT_PVP_AFK_RESULT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REQUEST_PVP_REWARDS_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_REQUEST_PVP_REWARDS_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RESEARCH_COMPLETE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RESEARCH_SETUP_HISTORY, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
DEFINE_OPCODE_HANDLER(SMSG_RESET_COMPRESSION_CONTEXT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
|
||||
|
||||
@@ -772,6 +772,10 @@ class WorldSession
|
||||
void HandleBattlefieldLeaveOpcode(WorldPacket& recvData);
|
||||
void HandleBattlemasterJoinArena(WorldPacket& recvData);
|
||||
void HandleReportPvPAFK(WorldPacket& recvData);
|
||||
void HandleRequestRatedBgInfo(WorldPacket& recvData);
|
||||
void HandleRequestPvpOptions(WorldPacket& recvData);
|
||||
void HandleRequestPvpReward(WorldPacket& recvData);
|
||||
void HandleRequestRatedBgStats(WorldPacket& recvData);
|
||||
|
||||
void HandleWardenDataOpcode(WorldPacket& recvData);
|
||||
void HandleWorldTeleportOpcode(WorldPacket& recvData);
|
||||
|
||||
+105
-49
@@ -108,6 +108,7 @@ World::World()
|
||||
m_MaxPlayerCount = 0;
|
||||
m_NextDailyQuestReset = 0;
|
||||
m_NextWeeklyQuestReset = 0;
|
||||
m_NextCurrencyReset = 0;
|
||||
|
||||
m_defaultDbcLocale = LOCALE_enUS;
|
||||
m_availableDbcLocaleMask = 0;
|
||||
@@ -782,67 +783,78 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0x7FFFFFFF-1;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
|
||||
if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_HOUR] = ConfigMgr::GetIntDefault("Currency.ResetHour", 3);
|
||||
if (m_int_configs[CONFIG_CURRENCY_RESET_HOUR] > 23)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
|
||||
m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0;
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_CURRENCY_RESET_HOUR]);
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_HOUR] = 3;
|
||||
}
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_DAY] = ConfigMgr::GetIntDefault("Currency.ResetDay", 3);
|
||||
if (m_int_configs[CONFIG_CURRENCY_RESET_DAY] > 6)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.ResetDay (%i) can't be load. Set to 3.", m_int_configs[CONFIG_CURRENCY_RESET_DAY]);
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_DAY] = 3;
|
||||
}
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL] = ConfigMgr::GetIntDefault("Currency.ResetInterval", 7);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL]) <= 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.ResetInterval (%i) must be > 0, set to default 7.", m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL]);
|
||||
m_int_configs[CONFIG_CURRENCY_RESET_INTERVAL] = 7;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("Currency.StartHonorPoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.StartHonorPoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS]);
|
||||
m_int_configs[CONFIG_CURRENCY_START_HONOR_POINTS] = 0;
|
||||
}
|
||||
m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("Currency.MaxHonorPoints", 40000);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS]);
|
||||
m_int_configs[CONFIG_CURRENCY_MAX_HONOR_POINTS] = 0;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0)
|
||||
m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS] = ConfigMgr::GetIntDefault("Currency.StartConquestPoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0);
|
||||
m_int_configs[CONFIG_START_HONOR_POINTS] = 0;
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.StartConquestPoints (%i) must be >= 0, set to default 0.", m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS]);
|
||||
m_int_configs[CONFIG_CURRENCY_START_CONQUEST_POINTS] = 0;
|
||||
}
|
||||
else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS])
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] = ConfigMgr::GetIntDefault("Currency.ConquestPointsWeekCap", 1650);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP]) <= 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]);
|
||||
m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS];
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.ConquestPointsWeekCap (%i) must be > 0, set to default 1650.", m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP]);
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] = 1650;
|
||||
}
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP] *= 100; //precision mod
|
||||
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] = ConfigMgr::GetIntDefault("Currency.ConquestPointsArenaReward", 150);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD]) <= 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "Currency.ConquestPointsArenaReward (%i) must be > 0, set to default 180.", m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD]);
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] = 150;
|
||||
}
|
||||
m_int_configs[CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] *= 100; //precision mod
|
||||
|
||||
m_int_configs[CONFIG_MAX_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("MaxJusticePoints", 400000);
|
||||
if (int32(m_int_configs[CONFIG_MAX_JUSTICE_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxJusticePoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_JUSTICE_POINTS]);
|
||||
m_int_configs[CONFIG_MAX_JUSTICE_POINTS] = 0;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_START_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("StartJusticePoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_START_JUSTICE_POINTS]) < 0)
|
||||
m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("StartJusticePoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartJusticePoints (%i) must be in range 0..MaxJusticePoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_JUSTICE_POINTS], m_int_configs[CONFIG_MAX_JUSTICE_POINTS], 0);
|
||||
m_int_configs[CONFIG_START_JUSTICE_POINTS] = 0;
|
||||
m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS], m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS], 0);
|
||||
m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = 0;
|
||||
}
|
||||
else if (m_int_configs[CONFIG_START_JUSTICE_POINTS] > m_int_configs[CONFIG_MAX_JUSTICE_POINTS])
|
||||
else if (m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] > m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS])
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartJusticePoints (%i) must be in range 0..MaxJusticePoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_JUSTICE_POINTS], m_int_configs[CONFIG_MAX_JUSTICE_POINTS], m_int_configs[CONFIG_MAX_JUSTICE_POINTS]);
|
||||
m_int_configs[CONFIG_START_JUSTICE_POINTS] = m_int_configs[CONFIG_MAX_JUSTICE_POINTS];
|
||||
m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS], m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS], m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]);
|
||||
m_int_configs[CONFIG_CURRENCY_START_JUSTICE_POINTS] = m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS];
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000);
|
||||
if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
|
||||
m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = ConfigMgr::GetIntDefault("MaxJusticePoints", 400000);
|
||||
if (int32(m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
|
||||
m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0);
|
||||
if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0);
|
||||
m_int_configs[CONFIG_START_ARENA_POINTS] = 0;
|
||||
}
|
||||
else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS])
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
|
||||
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]);
|
||||
m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS];
|
||||
sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxJusticePoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS]);
|
||||
m_int_configs[CONFIG_CURRENCY_MAX_JUSTICE_POINTS] = 0;
|
||||
}
|
||||
|
||||
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60);
|
||||
@@ -1048,8 +1060,6 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = ConfigMgr::GetIntDefault ("Arena.MaxRatingDifference", 150);
|
||||
m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
|
||||
m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = ConfigMgr::GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS);
|
||||
m_bool_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = ConfigMgr::GetBoolDefault("Arena.AutoDistributePoints", false);
|
||||
m_int_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = ConfigMgr::GetIntDefault ("Arena.AutoDistributeInterval", 7);
|
||||
m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = ConfigMgr::GetBoolDefault("Arena.QueueAnnouncer.Enable", false);
|
||||
m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY] = ConfigMgr::GetBoolDefault("Arena.QueueAnnouncer.PlayerOnly", false);
|
||||
m_int_configs[CONFIG_ARENA_SEASON_ID] = ConfigMgr::GetIntDefault ("Arena.ArenaSeason.ID", 1);
|
||||
@@ -1777,7 +1787,6 @@ void World::SetInitialWorldSettings()
|
||||
///- Initialize Battlegrounds
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System");
|
||||
sBattlegroundMgr->CreateInitialBattlegrounds();
|
||||
sBattlegroundMgr->InitAutomaticArenaPointDistribution();
|
||||
|
||||
///- Initialize outdoor pvp
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System");
|
||||
@@ -1815,6 +1824,9 @@ void World::SetInitialWorldSettings()
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate Guild cap reset time...");
|
||||
InitGuildResetTime();
|
||||
|
||||
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next currency reset time...");
|
||||
InitCurrencyResetTime();
|
||||
|
||||
LoadCharacterNameData();
|
||||
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Opcodes...");
|
||||
@@ -1975,6 +1987,9 @@ void World::Update(uint32 diff)
|
||||
if (m_gameTime > m_NextGuildReset)
|
||||
ResetGuildCap();
|
||||
|
||||
if (m_gameTime > m_NextCurrencyReset)
|
||||
ResetCurrencyWeekCap();
|
||||
|
||||
/// <ul><li> Handle auctions when the timer has passed
|
||||
if (m_timers[WUPDATE_AUCTIONS].Passed())
|
||||
{
|
||||
@@ -2822,6 +2837,35 @@ void World::InitGuildResetTime()
|
||||
sWorld->setWorldState(WS_GUILD_DAILY_RESET_TIME, uint64(m_NextGuildReset));
|
||||
}
|
||||
|
||||
void World::InitCurrencyResetTime()
|
||||
{
|
||||
time_t currencytime = uint64(sWorld->getWorldState(WS_CURRENCY_RESET_TIME));
|
||||
if (!currencytime)
|
||||
m_NextCurrencyReset = time_t(time(NULL)); // game time not yet init
|
||||
|
||||
// generate time by config
|
||||
time_t curTime = time(NULL);
|
||||
tm localTm = *localtime(&curTime);
|
||||
|
||||
localTm.tm_wday = getIntConfig(CONFIG_CURRENCY_RESET_DAY);
|
||||
localTm.tm_hour = getIntConfig(CONFIG_CURRENCY_RESET_HOUR);
|
||||
localTm.tm_min = 0;
|
||||
localTm.tm_sec = 0;
|
||||
|
||||
// current week reset time
|
||||
time_t nextWeekResetTime = mktime(&localTm);
|
||||
|
||||
// next reset time before current moment
|
||||
if (curTime >= nextWeekResetTime)
|
||||
nextWeekResetTime += getIntConfig(CONFIG_CURRENCY_RESET_INTERVAL) * DAY;
|
||||
|
||||
// normalize reset time
|
||||
m_NextCurrencyReset = currencytime < curTime ? nextWeekResetTime - getIntConfig(CONFIG_CURRENCY_RESET_INTERVAL) * DAY : nextWeekResetTime;
|
||||
|
||||
if (!currencytime)
|
||||
sWorld->setWorldState(WS_CURRENCY_RESET_TIME, uint64(m_NextCurrencyReset));
|
||||
}
|
||||
|
||||
void World::ResetDailyQuests()
|
||||
{
|
||||
sLog->outInfo(LOG_FILTER_GENERAL, "Daily quests reset for all characters.");
|
||||
@@ -2837,6 +2881,18 @@ void World::ResetDailyQuests()
|
||||
sPoolMgr->ChangeDailyQuests();
|
||||
}
|
||||
|
||||
void World::ResetCurrencyWeekCap()
|
||||
{
|
||||
CharacterDatabase.Execute("UPDATE `character_currency` SET `week_count` = 0");
|
||||
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
if (itr->second->GetPlayer())
|
||||
itr->second->GetPlayer()->ResetCurrencyWeekCap();
|
||||
|
||||
m_NextCurrencyReset = time_t(m_NextCurrencyReset + DAY * getIntConfig(CONFIG_CURRENCY_RESET_INTERVAL));
|
||||
sWorld->setWorldState(WS_CURRENCY_RESET_TIME, uint64(m_NextCurrencyReset));
|
||||
}
|
||||
|
||||
void World::LoadDBAllowedSecurityLevel()
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL);
|
||||
|
||||
@@ -139,7 +139,6 @@ enum WorldBoolConfigs
|
||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,
|
||||
CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,
|
||||
CONFIG_BG_XP_FOR_KILL,
|
||||
CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS,
|
||||
CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE,
|
||||
CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY,
|
||||
CONFIG_ARENA_SEASON_IN_PROGRESS,
|
||||
@@ -225,12 +224,16 @@ enum WorldIntConfigs
|
||||
CONFIG_START_PLAYER_LEVEL,
|
||||
CONFIG_START_HEROIC_PLAYER_LEVEL,
|
||||
CONFIG_START_PLAYER_MONEY,
|
||||
CONFIG_MAX_HONOR_POINTS,
|
||||
CONFIG_START_HONOR_POINTS,
|
||||
CONFIG_MAX_JUSTICE_POINTS,
|
||||
CONFIG_START_JUSTICE_POINTS,
|
||||
CONFIG_MAX_ARENA_POINTS,//todo: remove
|
||||
CONFIG_START_ARENA_POINTS,//todo: remove
|
||||
CONFIG_CURRENCY_START_JUSTICE_POINTS,
|
||||
CONFIG_CURRENCY_MAX_JUSTICE_POINTS,
|
||||
CONFIG_CURRENCY_START_HONOR_POINTS,
|
||||
CONFIG_CURRENCY_MAX_HONOR_POINTS,
|
||||
CONFIG_CURRENCY_START_CONQUEST_POINTS,
|
||||
CONFIG_CURRENCY_CONQUEST_POINTS_WEEK_CAP,
|
||||
CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD,
|
||||
CONFIG_CURRENCY_RESET_HOUR,
|
||||
CONFIG_CURRENCY_RESET_DAY,
|
||||
CONFIG_CURRENCY_RESET_INTERVAL,
|
||||
CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL,
|
||||
CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE,
|
||||
CONFIG_INSTANCE_RESET_TIME_HOUR,
|
||||
@@ -290,7 +293,6 @@ enum WorldIntConfigs
|
||||
CONFIG_ARENA_MAX_RATING_DIFFERENCE,
|
||||
CONFIG_ARENA_RATING_DISCARD_TIMER,
|
||||
CONFIG_ARENA_RATED_UPDATE_TIMER,
|
||||
CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS,
|
||||
CONFIG_ARENA_SEASON_ID,
|
||||
CONFIG_ARENA_START_RATING,
|
||||
CONFIG_ARENA_START_PERSONAL_RATING,
|
||||
@@ -764,10 +766,12 @@ class World
|
||||
void InitWeeklyQuestResetTime();
|
||||
void InitRandomBGResetTime();
|
||||
void InitGuildResetTime();
|
||||
void InitCurrencyResetTime();
|
||||
void ResetDailyQuests();
|
||||
void ResetWeeklyQuests();
|
||||
void ResetRandomBG();
|
||||
void ResetGuildCap();
|
||||
void ResetCurrencyWeekCap();
|
||||
private:
|
||||
static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
|
||||
static uint8 m_ExitCode;
|
||||
@@ -824,11 +828,12 @@ class World
|
||||
// CLI command holder to be thread safe
|
||||
ACE_Based::LockedQueue<CliCommandHolder*, ACE_Thread_Mutex> cliCmdQueue;
|
||||
|
||||
// next daily quests and random bg reset time
|
||||
// scheduled reset times
|
||||
time_t m_NextDailyQuestReset;
|
||||
time_t m_NextWeeklyQuestReset;
|
||||
time_t m_NextRandomBGReset;
|
||||
time_t m_NextGuildReset;
|
||||
time_t m_NextCurrencyReset;
|
||||
|
||||
//Player Queue
|
||||
Queue m_QueuedPlayer;
|
||||
|
||||
@@ -106,7 +106,6 @@ public:
|
||||
{ "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
|
||||
{ "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
|
||||
{ "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
|
||||
{ "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
|
||||
{ "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
|
||||
{ "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
|
||||
{ "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
|
||||
@@ -2125,12 +2124,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* target;
|
||||
|
||||
@@ -1134,7 +1134,7 @@ public:
|
||||
|
||||
target->ModifyCurrency(CURRENCY_TYPE_HONOR_POINTS, amount, true, true);
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_HONOR_POINTS));
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_HONOR_POINTS, false));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ public:
|
||||
|
||||
target->ModifyCurrency(CURRENCY_TYPE_CONQUEST_POINTS, amount, true, true);
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_ARENA, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS));
|
||||
handler->PSendSysMessage(LANG_COMMAND_MODIFY_ARENA, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, false));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
# CHARACTER DELETE OPTIONS
|
||||
# CUSTOM SERVER OPTIONS
|
||||
# LOGGING SYSTEM SETTINGS
|
||||
# CURRENCIES SETTINGS
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
@@ -778,48 +779,6 @@ StartHeroicPlayerLevel = 55
|
||||
|
||||
StartPlayerMoney = 0
|
||||
|
||||
#
|
||||
# MaxHonorPoints
|
||||
# Description: Maximum honor points a character can have.
|
||||
# Default: 75000
|
||||
|
||||
MaxHonorPoints = 75000
|
||||
|
||||
#
|
||||
# StartHonorPoints
|
||||
# Description: Amount of honor points that characters have after creation.
|
||||
# Default: 0
|
||||
|
||||
StartHonorPoints = 0
|
||||
|
||||
#
|
||||
# MaxJusticePoints
|
||||
# Description: Maximum justice points a character can have.
|
||||
# Default: 400000
|
||||
|
||||
MaxJusticePoints = 400000
|
||||
|
||||
#
|
||||
# StartJusticePoints
|
||||
# Description: Amount of justice points that characters have after creation.
|
||||
# Default: 0
|
||||
|
||||
StartJusticePoints = 0
|
||||
|
||||
#
|
||||
# MaxArenaPoints
|
||||
# Description: Maximum arena points a character can have.
|
||||
# Default: 10000
|
||||
|
||||
MaxArenaPoints = 10000
|
||||
|
||||
#
|
||||
# StartArenaPoints
|
||||
# Description: Amount of arena points that characters has after creation.
|
||||
# Default: 0
|
||||
|
||||
StartArenaPoints = 0
|
||||
|
||||
#
|
||||
# RecruitAFriend.MaxLevel
|
||||
# Description: Highest level up to which a character can benefit from the Recruit-A-Friend
|
||||
@@ -2905,3 +2864,64 @@ Guild.WeeklyReputationCap = 4375
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
###################################################################################################
|
||||
# CURRENCIES SETTINGS
|
||||
#
|
||||
# Currency.StartHonorPoints
|
||||
# Amount of honor that new players will start with
|
||||
# Default: 0 (with precision)
|
||||
#
|
||||
|
||||
Currency.StartHonorPoints = 0
|
||||
|
||||
#
|
||||
# Currency.StartConquestPoints
|
||||
# Amount of conquest points that new players will start with
|
||||
# Default: 0 (with precision)
|
||||
#
|
||||
|
||||
Currency.StartConquestPoints = 0
|
||||
|
||||
#
|
||||
# Currency.ResetInterval
|
||||
# How often should currency week count reset (days)
|
||||
# Default: 7 (weekly)
|
||||
#
|
||||
|
||||
Currency.ResetInterval = 7
|
||||
|
||||
#
|
||||
# Currency.ResetWeekDay
|
||||
# Week day when currency week count is reset (0..6) 0 == Sunday
|
||||
# Default: 3 (Wednesday)
|
||||
#
|
||||
|
||||
Currency.ResetWeekDay = 3
|
||||
|
||||
#
|
||||
# Currency.ResetHour
|
||||
# Hour of a day when currency week count is reset (0..23)
|
||||
# Default: 6
|
||||
#
|
||||
|
||||
Currency.ResetHour = 6
|
||||
|
||||
#
|
||||
# Currency.ConquestPointsDefaultWeekCap
|
||||
# Amount of conquest points that player can earn per week
|
||||
# Default: 1350
|
||||
#
|
||||
|
||||
Currency.ConquestPointsDefaultWeekCap = 1350
|
||||
|
||||
#
|
||||
# Currency.ConquestPointsArenaReward
|
||||
# Amount of conquest points rewarded by winning arenas
|
||||
# Default: 150
|
||||
#
|
||||
|
||||
Currency.ConquestPointsArenaReward = 150
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
Reference in new issue
Block a user