Core/RaF: Remove level granting (new RaF doesn't support this)

This commit is contained in:
Shauren
2019-11-03 14:25:39 +01:00
parent f689f6e9bd
commit 9ea577da13
11 changed files with 15 additions and 177 deletions

View File

@@ -1725,7 +1725,6 @@ CREATE TABLE `characters` (
`equipmentCache` longtext,
`knownTitles` longtext,
`actionBars` tinyint(3) unsigned NOT NULL DEFAULT '0',
`grantableLevels` tinyint(3) unsigned NOT NULL DEFAULT '0',
`deleteInfos_Account` int(10) unsigned DEFAULT NULL,
`deleteInfos_Name` varchar(12) DEFAULT NULL,
`deleteDate` int(10) unsigned DEFAULT NULL,
@@ -3570,7 +3569,8 @@ INSERT INTO `updates` VALUES
('2019_06_25_00_characters.sql','B8CBF79DEE02B40B01424327D31E52C70335BEC6','RELEASED','2019-06-25 22:40:37',0),
('2019_07_15_00_characters.sql','E1C77F604FB2A2FE8B32258CD0C9EC71BEA4F0FF','RELEASED','2019-06-25 22:40:37',0),
('2019_10_26_00_characters.sql','F1090ACDEB876A7BB5ED8829373F6305A217949A','RELEASED','2019-10-25 23:04:42',0),
('2019_10_26_01_characters.sql','59D5860930D02AB77D2AAA704C564957A9143760','RELEASED','2019-10-26 22:04:46',0);
('2019_10_26_01_characters.sql','59D5860930D02AB77D2AAA704C564957A9143760','RELEASED','2019-10-26 22:04:46',0),
('2019_11_03_00_characters.sql','DC789597F85B890E9A7901B4443DAD9CAEE2A02A','RELEASED','2019-11-03 14:13:27',0);
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES;

View File

@@ -0,0 +1 @@
ALTER TABLE `characters` DROP `grantableLevels`;

View File

@@ -80,7 +80,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
"resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, "
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, grantableLevels, raidDifficulty, legacyRaidDifficulty, fishingSteps, "
"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, fishingSteps, "
"honor, honorLevel, honorRestState, honorRestBonus "
"FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?", CONNECTION_ASYNC);
@@ -425,14 +425,14 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"extra_flags, stable_slots, at_login, zone, "
"death_expire_time, taxi_path, totalKills, "
"todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, "
"power4, power5, power6, latency, activeTalentGroup, lootSpecId, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, lastLoginBuild) VALUES "
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
"power4, power5, power6, latency, activeTalentGroup, lootSpecId, exploredZones, equipmentCache, knownTitles, actionBars, lastLoginBuild) VALUES "
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,skin=?,face=?,hairStyle=?,hairColor=?,facialStyle=?,customDisplay1=?,customDisplay2=?,customDisplay3=?,inventorySlots=?,bankSlots=?,restState=?,playerFlags=?,playerFlagsEx=?,"
"map=?,instance_id=?,dungeonDifficulty=?,raidDifficulty=?,legacyRaidDifficulty=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
"logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,primarySpecialization=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
"totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,"
"watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,latency=?,activeTalentGroup=?,lootSpecId=?,exploredZones=?,"
"equipmentCache=?,knownTitles=?,actionBars=?,grantableLevels=?,online=?,honor=?,honorLevel=?,honorRestState=?,honorRestBonus=?,lastLoginBuild=? WHERE guid=?", CONNECTION_ASYNC);
"equipmentCache=?,knownTitles=?,actionBars=?,online=?,honor=?,honorLevel=?,honorRestState=?,honorRestBonus=?,lastLoginBuild=? WHERE guid=?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG, "UPDATE characters SET at_login = at_login | ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_REM_AT_LOGIN_FLAG, "UPDATE characters set at_login = at_login & ~ ? WHERE guid = ?", CONNECTION_ASYNC);

View File

@@ -309,7 +309,6 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
m_lastFallTime = 0;
m_lastFallZ = 0;
m_grantableLevels = 0;
m_fishingSteps = 0;
m_ControlledByPlayer = true;
@@ -2490,20 +2489,6 @@ void Player::GiveLevel(uint8 level)
UpdateCriteria(CRITERIA_TYPE_REACH_LEVEL);
// Refer-A-Friend
if (GetSession()->GetRecruiterId())
{
if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
{
if (level % 2 == 0)
{
++m_grantableLevels;
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::GrantableLevels), 1);
}
}
}
sScriptMgr->OnPlayerLevelChanged(this, oldLevel);
}
@@ -17599,9 +17584,9 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
//"resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, "
// 50 51 52 53 54 55
//"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
// 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
//"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, grantableLevels, raidDifficulty, legacyRaidDifficulty, fishing_steps "
// 73 74 75 76 77
// 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
//"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, fishing_steps "
// 72 73 74 75 76
//"honor, honorLevel, prestigeLevel, honor_rest_state, honor_rest_bonus "
//
//"FROM characters WHERE guid = ?", CONNECTION_ASYNC);
@@ -17736,7 +17721,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
SetMultiActionBars(fields[68].GetUInt8());
m_fishingSteps = fields[72].GetUInt8();
m_fishingSteps = fields[71].GetUInt8();
InitDisplayIds();
@@ -17773,8 +17758,8 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
uint32 instanceId = fields[63].GetUInt32();
SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID(Difficulty(fields[49].GetUInt8())));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID(Difficulty(fields[70].GetUInt8())));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID(Difficulty(fields[71].GetUInt8())));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID(Difficulty(fields[69].GetUInt8())));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID(Difficulty(fields[70].GetUInt8())));
std::string taxi_nodes = fields[48].GetString();
@@ -18300,13 +18285,9 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
}
// RaF stuff.
m_grantableLevels = fields[69].GetUInt8();
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
AddDynamicFlag(UNIT_DYNFLAG_REFER_A_FRIEND);
if (m_grantableLevels > 0)
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::GrantableLevels), 1);
_LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES));
_LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS));
@@ -18322,9 +18303,9 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GARRISON_FOLLOWER_ABILITIES)))
_garrison = std::move(garrison);
_InitHonorLevelOnLoadFromDB(fields[73].GetUInt32(), fields[74].GetUInt32());
_InitHonorLevelOnLoadFromDB(fields[72].GetUInt32(), fields[73].GetUInt32());
_restMgr->LoadRestBonus(REST_TYPE_HONOR, PlayerRestState(fields[75].GetUInt8()), fields[76].GetFloat());
_restMgr->LoadRestBonus(REST_TYPE_HONOR, PlayerRestState(fields[74].GetUInt8()), fields[75].GetFloat());
if (time_diff > 0)
{
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
@@ -20090,7 +20071,6 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setString(index++, ss.str());
stmt->setUInt8(index++, m_activePlayerData->MultiActionBars);
stmt->setUInt32(index++, m_grantableLevels);
stmt->setUInt32(index++, sRealmList->GetMinorMajorBugfixVersionForBuild(realm.Build));
}
else
@@ -20240,7 +20220,6 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setString(index++, ss.str());
stmt->setUInt8(index++, m_activePlayerData->MultiActionBars);
stmt->setUInt32(index++, m_grantableLevels);
stmt->setUInt8(index++, IsInWorld() && !GetSession()->PlayerLogout() ? 1 : 0);
stmt->setUInt32(index++, m_activePlayerData->Honor);

View File

@@ -1917,8 +1917,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool isHonorOrXPTarget(Unit const* victim) const;
bool GetsRecruitAFriendBonus(bool forXP);
uint8 GetGrantableLevels() const { return m_grantableLevels; }
void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
@@ -2698,8 +2696,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
uint8 m_grantableLevels;
uint8 m_fishingSteps;
std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WorldSession.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ReferAFriendPackets.h"
#include "World.h"
void WorldSession::HandleGrantLevel(WorldPackets::RaF::GrantLevel& grantLevel)
{
Player* target = ObjectAccessor::GetPlayer(*_player, grantLevel.Target);
// check cheating
uint8 levels = _player->GetGrantableLevels();
uint8 error = 0;
if (!target)
error = ERR_REFER_A_FRIEND_NO_TARGET;
else if (levels == 0)
error = ERR_REFER_A_FRIEND_INSUFFICIENT_GRANTABLE_LEVELS;
else if (GetRecruiterId() != target->GetSession()->GetAccountId())
error = ERR_REFER_A_FRIEND_NOT_REFERRED_BY;
else if (target->GetTeamId() != _player->GetTeamId())
error = ERR_REFER_A_FRIEND_DIFFERENT_FACTION;
else if (target->getLevel() >= _player->getLevel())
error = ERR_REFER_A_FRIEND_TARGET_TOO_HIGH;
else if (target->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
error = ERR_REFER_A_FRIEND_GRANT_LEVEL_MAX_I;
else if (target->GetGroup() != _player->GetGroup())
error = ERR_REFER_A_FRIEND_NOT_IN_GROUP;
else if (target->getLevel() >= GetMaxLevelForExpansion(target->GetSession()->GetExpansion()))
error = ERR_REFER_A_FRIEND_INSUF_EXPAN_LVL;
if (error)
{
WorldPackets::RaF::ReferAFriendFailure failure;
failure.Reason = error;
if (error == ERR_REFER_A_FRIEND_NOT_IN_GROUP)
failure.Str = target->GetName();
SendPacket(failure.Write());
return;
}
WorldPackets::RaF::ProposeLevelGrant proposeLevelGrant;
proposeLevelGrant.Sender = _player->GetGUID();
target->SendDirectMessage(proposeLevelGrant.Write());
}
void WorldSession::HandleAcceptGrantLevel(WorldPackets::RaF::AcceptLevelGrant& acceptLevelGrant)
{
Player* other = ObjectAccessor::GetPlayer(*_player, acceptLevelGrant.Granter);
if (!(other && other->GetSession()))
return;
if (GetAccountId() != other->GetSession()->GetRecruiterId())
return;
if (other->GetGrantableLevels())
other->SetGrantableLevels(other->GetGrantableLevels() - 1);
else
return;
_player->GiveLevel(_player->getLevel() + 1);
}

View File

@@ -17,23 +17,6 @@
#include "ReferAFriendPackets.h"
void WorldPackets::RaF::AcceptLevelGrant::Read()
{
_worldPacket >> Granter;
}
void WorldPackets::RaF::GrantLevel::Read()
{
_worldPacket >> Target;
}
WorldPacket const* WorldPackets::RaF::ProposeLevelGrant::Write()
{
_worldPacket << Sender;
return &_worldPacket;
}
WorldPacket const* WorldPackets::RaF::ReferAFriendFailure::Write()
{
_worldPacket << int32(Reason);

View File

@@ -19,42 +19,11 @@
#define ReferAFriendPackets_h__
#include "Packet.h"
#include "ObjectGuid.h"
namespace WorldPackets
{
namespace RaF
{
class AcceptLevelGrant final : public ClientPacket
{
public:
AcceptLevelGrant(WorldPacket&& packet) : ClientPacket(CMSG_ACCEPT_LEVEL_GRANT, std::move(packet)) { }
void Read() override;
ObjectGuid Granter;
};
class GrantLevel final : public ClientPacket
{
public:
GrantLevel(WorldPacket&& packet) : ClientPacket(CMSG_GRANT_LEVEL, std::move(packet)) { }
void Read() override;
ObjectGuid Target;
};
class ProposeLevelGrant final : public ServerPacket
{
public:
ProposeLevelGrant() : ServerPacket(SMSG_PROPOSE_LEVEL_GRANT, 16) { }
WorldPacket const* Write() override;
ObjectGuid Sender;
};
class ReferAFriendFailure final : public ServerPacket
{
public:

View File

@@ -145,7 +145,6 @@ void OpcodeTable::Initialize()
ValidateAndSetClientOpcode<decltype(handler), handler>(opcode, #opcode, status, processing)
DEFINE_HANDLER(CMSG_ACCEPT_GUILD_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildAcceptInvite);
//DEFINE_HANDLER(CMSG_ACCEPT_LEVEL_GRANT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptGrantLevel);
DEFINE_HANDLER(CMSG_ACCEPT_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAcceptTradeOpcode);
DEFINE_HANDLER(CMSG_ACCEPT_WARGAME_INVITE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_ACTIVATE_TAXI, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleActivateTaxiOpcode);
@@ -432,7 +431,6 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_GM_TICKET_GET_CASE_STATUS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleGMTicketGetCaseStatusOpcode);
DEFINE_HANDLER(CMSG_GM_TICKET_GET_SYSTEM_STATUS, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleGMTicketSystemStatusOpcode);
DEFINE_HANDLER(CMSG_GOSSIP_SELECT_OPTION, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGossipSelectOptionOpcode);
//DEFINE_HANDLER(CMSG_GRANT_LEVEL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGrantLevel);
DEFINE_HANDLER(CMSG_GUILD_ADD_BATTLENET_FRIEND, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_GUILD_ADD_RANK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildAddRank);
DEFINE_HANDLER(CMSG_GUILD_ASSIGN_MEMBER_RANK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGuildAssignRank);
@@ -1625,7 +1623,6 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PRE_RESSURECT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PRINT_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PROC_RESIST, STATUS_NEVER, CONNECTION_TYPE_REALM);
//DEFINE_SERVER_OPCODE_HANDLER(SMSG_PROPOSE_LEVEL_GRANT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PUSH_SPELL_TO_ACTION_BAR, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_CREDIT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_LOG_DATA, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);

View File

@@ -781,11 +781,9 @@ enum OpcodeClient : uint16
CMSG_WORLD_PORT_RESPONSE = 0x35FA,
CMSG_WRAP_ITEM = 0x3994,
CMSG_ACCEPT_LEVEL_GRANT = 0xBADD,
CMSG_BF_MGR_ENTRY_INVITE_RESPONSE = 0xBADD,
CMSG_BF_MGR_QUEUE_INVITE_RESPONSE = 0xBADD,
CMSG_BF_MGR_QUEUE_EXIT_REQUEST = 0xBADD,
CMSG_GRANT_LEVEL = 0xBADD,
};
enum OpcodeServer : uint16
@@ -1830,7 +1828,6 @@ enum OpcodeServer : uint16
SMSG_BF_MGR_ENTRY_INVITE = 0xBADD,
SMSG_BF_MGR_QUEUE_INVITE = 0xBADD,
SMSG_BF_MGR_QUEUE_REQUEST_RESPONSE = 0xBADD,
SMSG_PROPOSE_LEVEL_GRANT = 0xBADD,
};
inline bool IsInstanceOnlyOpcode(uint32 opcode)

View File

@@ -1605,10 +1605,6 @@ class TC_GAME_API WorldSession
void HandleGuildBankTextQuery(WorldPackets::Guild::GuildBankTextQuery& packet);
void HandleGuildBankSetTabText(WorldPackets::Guild::GuildBankSetTabText& packet);
// Refer-a-Friend
void HandleGrantLevel(WorldPackets::RaF::GrantLevel& grantLevel);
void HandleAcceptGrantLevel(WorldPackets::RaF::AcceptLevelGrant& acceptLevelGrant);
// Calendar
void HandleCalendarGetCalendar(WorldPackets::Calendar::CalendarGetCalendar& calendarGetCalendar);
void HandleCalendarGetEvent(WorldPackets::Calendar::CalendarGetEvent& calendarGetEvent);