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

Port From (https://github.com/TrinityCore/TrinityCore/commit/9ea577da136f970e327029480cbe9928c18033dc)
This commit is contained in:
hondacrx
2019-11-03 16:55:24 -05:00
parent 8b3c04bc15
commit 191e2c7a67
8 changed files with 13 additions and 130 deletions
@@ -77,9 +77,8 @@ namespace Framework.Database
PrepareStatement(CharStatements.SEL_CHARACTER, "SELECT c.guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, customDisplay1, customDisplay2, customDisplay3, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " + PrepareStatement(CharStatements.SEL_CHARACTER, "SELECT c.guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, customDisplay1, customDisplay2, customDisplay3, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " +
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " + "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, " + "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, " + "totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, " +
"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, grantableLevels, raidDifficulty, legacyRaidDifficulty, fishingSteps, " + "knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, fishingSteps, honor, honorLevel, honorRestState, honorRestBonus " +
"honor, honorLevel, honorRestState, honorRestBonus " +
"FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?"); "FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?");
PrepareStatement(CharStatements.SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?"); PrepareStatement(CharStatements.SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?");
@@ -419,14 +418,14 @@ namespace Framework.Database
"map, instance_id, dungeonDifficulty, raidDifficulty, legacyRaidDifficulty, position_x, position_y, position_z, orientation, trans_x, trans_y, trans_z, trans_o, transguid, " + "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, " + "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, " + "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 " + "power4, power5, power6, latency, activeTalentGroup, lootSpecId, exploredZones, equipmentCache, knownTitles, actionBars, lastLoginBuild) VALUES " +
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
PrepareStatement(CharStatements.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=?," + PrepareStatement(CharStatements.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=?," + "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=?," + "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=?," + "totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?," +
"watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,latency=?,activeTalentGroup=?,lootSpecId=?,exploredZones=?," + "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=?"); "equipmentCache=?,knownTitles=?,actionBars=?,online=?,honor=?,honorLevel=?,honorRestState=?,honorRestBonus=?,lastLoginBuild=? WHERE guid=?");
PrepareStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG, "UPDATE characters SET at_login = at_login | ? WHERE guid = ?"); PrepareStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG, "UPDATE characters SET at_login = at_login | ? WHERE guid = ?");
PrepareStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG, "UPDATE characters set at_login = at_login & ~ ? WHERE guid = ?"); PrepareStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG, "UPDATE characters set at_login = at_login & ~ ? WHERE guid = ?");
+5 -11
View File
@@ -2458,7 +2458,7 @@ namespace Game.Entities
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise) // set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
SetMultiActionBars(result.Read<byte>(68)); SetMultiActionBars(result.Read<byte>(68));
m_fishingSteps = result.Read<byte>(72); m_fishingSteps = result.Read<byte>(71);
InitDisplayIds(); InitDisplayIds();
@@ -2493,8 +2493,8 @@ namespace Game.Entities
var RelocateToHomebind = new Action(() => { mapId = homebind.GetMapId(); instanceId = 0; Relocate(homebind); }); var RelocateToHomebind = new Action(() => { mapId = homebind.GetMapId(); instanceId = 0; Relocate(homebind); });
SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID((Difficulty)result.Read<byte>(49))); SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID((Difficulty)result.Read<byte>(49)));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(70))); SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(69)));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(71))); SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(70)));
string taxi_nodes = result.Read<string>(48); string taxi_nodes = result.Read<string>(48);
@@ -3020,13 +3020,9 @@ namespace Game.Entities
} }
// RaF stuff. // RaF stuff.
m_grantableLevels = result.Read<byte>(69);
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0)) if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
AddDynamicFlag(UnitDynFlags.ReferAFriend); AddDynamicFlag(UnitDynFlags.ReferAFriend);
if (m_grantableLevels > 0)
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.GrantableLevels), (byte)1);
_LoadDeclinedNames(holder.GetResult(PlayerLoginQueryLoad.DeclinedNames)); _LoadDeclinedNames(holder.GetResult(PlayerLoginQueryLoad.DeclinedNames));
_LoadEquipmentSets(holder.GetResult(PlayerLoginQueryLoad.EquipmentSets)); _LoadEquipmentSets(holder.GetResult(PlayerLoginQueryLoad.EquipmentSets));
@@ -3042,9 +3038,9 @@ namespace Game.Entities
holder.GetResult(PlayerLoginQueryLoad.GarrisonFollowerAbilities))) holder.GetResult(PlayerLoginQueryLoad.GarrisonFollowerAbilities)))
_garrison = garrison; _garrison = garrison;
_InitHonorLevelOnLoadFromDB(result.Read<uint>(73), result.Read<uint>(74)); _InitHonorLevelOnLoadFromDB(result.Read<uint>(72), result.Read<uint>(73));
_restMgr.LoadRestBonus(RestTypes.Honor, (PlayerRestState)result.Read<byte>(75), result.Read<float>(76)); _restMgr.LoadRestBonus(RestTypes.Honor, (PlayerRestState)result.Read<byte>(74), result.Read<float>(75));
if (time_diff > 0) if (time_diff > 0)
{ {
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour) //speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
@@ -3224,7 +3220,6 @@ namespace Game.Entities
stmt.AddValue(index++, ss.ToString()); stmt.AddValue(index++, ss.ToString());
stmt.AddValue(index++, (byte)m_activePlayerData.MultiActionBars); stmt.AddValue(index++, (byte)m_activePlayerData.MultiActionBars);
stmt.AddValue(index++, m_grantableLevels);
stmt.AddValue(index++, Global.RealmMgr.GetMinorMajorBugfixVersionForBuild(Global.WorldMgr.GetRealm().Build)); stmt.AddValue(index++, Global.RealmMgr.GetMinorMajorBugfixVersionForBuild(Global.WorldMgr.GetRealm().Build));
} }
else else
@@ -3373,7 +3368,6 @@ namespace Game.Entities
stmt.AddValue(index++, ss.ToString()); stmt.AddValue(index++, ss.ToString());
stmt.AddValue(index++, (byte)m_activePlayerData.MultiActionBars); stmt.AddValue(index++, (byte)m_activePlayerData.MultiActionBars);
stmt.AddValue(index++, m_grantableLevels);
stmt.AddValue(index++, IsInWorld && !GetSession().PlayerLogout() ? 1 : 0); stmt.AddValue(index++, IsInWorld && !GetSession().PlayerLogout() ? 1 : 0);
stmt.AddValue(index++, (uint)m_activePlayerData.Honor); stmt.AddValue(index++, (uint)m_activePlayerData.Honor);
@@ -218,7 +218,6 @@ namespace Game.Entities
uint m_zoneUpdateTimer; uint m_zoneUpdateTimer;
uint m_ChampioningFaction; uint m_ChampioningFaction;
byte m_grantableLevels;
byte m_fishingSteps; byte m_fishingSteps;
// Recall position // Recall position
-16
View File
@@ -5398,20 +5398,6 @@ namespace Game.Entities
UpdateCriteria(CriteriaTypes.ReachLevel); UpdateCriteria(CriteriaTypes.ReachLevel);
// Refer-A-Friend
if (GetSession().GetRecruiterId() != 0)
{
if (level < WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
{
if (level % 2 == 0)
{
++m_grantableLevels;
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.GrantableLevels), (byte)1);
}
}
}
Global.ScriptMgr.OnPlayerLevelChanged(this, (byte)oldLevel); Global.ScriptMgr.OnPlayerLevelChanged(this, (byte)oldLevel);
} }
@@ -6987,8 +6973,6 @@ namespace Game.Entities
GetSession().SendDoFlight(mountDisplayId, path, startNode); GetSession().SendDoFlight(mountDisplayId, path, startNode);
} }
public byte GetGrantableLevels() { return m_grantableLevels; }
public void SetGrantableLevels(int val) { m_grantableLevels = (byte)val; }
public bool GetsRecruitAFriendBonus(bool forXP) public bool GetsRecruitAFriendBonus(bool forXP)
{ {
bool recruitAFriend = false; bool recruitAFriend = false;
-58
View File
@@ -24,63 +24,5 @@ namespace Game
{ {
public partial class WorldSession public partial class WorldSession
{ {
//[WorldPacketHandler(ClientOpcodes.GrantLevel)]
void HandleGrantLevel(GrantLevel grantLevel)
{
Player target = Global.ObjAccessor.GetPlayer(GetPlayer(), grantLevel.Target);
// check cheating
byte levels = GetPlayer().GetGrantableLevels();
ReferAFriendError error = 0;
if (!target)
error = ReferAFriendError.NoTarget;
if (levels == 0)
error = ReferAFriendError.InsufficientGrantableLevels;
else if (GetRecruiterId() != target.GetSession().GetAccountId())
error = ReferAFriendError.NotReferredBy;
else if (target.GetTeamId() != GetPlayer().GetTeamId())
error = ReferAFriendError.DifferentFaction;
else if (target.GetLevel() >= GetPlayer().GetLevel())
error = ReferAFriendError.TargetTooHigh;
else if (target.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
error = ReferAFriendError.GrantLevelMaxI;
else if (target.GetGroup() != GetPlayer().GetGroup())
error = ReferAFriendError.NotInGroup;
else if (target.GetLevel() >= Global.ObjectMgr.GetMaxLevelForExpansion(target.GetSession().GetExpansion()))
error = ReferAFriendError.InsufExpanLvl;
if (error != 0)
{
ReferAFriendFailure failure = new ReferAFriendFailure();
failure.Reason = error;
if (error == ReferAFriendError.NotInGroup)
failure.Str = target.GetName();
SendPacket(failure);
return;
}
//ProposeLevelGrant proposeLevelGrant = new ProposeLevelGrant();
//proposeLevelGrant.Sender = GetPlayer().GetGUID();
//target.SendPacket(proposeLevelGrant);
}
//[WorldPacketHandler(ClientOpcodes.AcceptLevelGrant)]
void HandleAcceptGrantLevel(AcceptLevelGrant acceptLevelGrant)
{
Player other = Global.ObjAccessor.GetPlayer(GetPlayer(), acceptLevelGrant.Granter);
if (!(other && other.GetSession() != null))
return;
if (GetAccountId() != other.GetSession().GetRecruiterId())
return;
if (other.GetGrantableLevels() != 0)
other.SetGrantableLevels(other.GetGrantableLevels() - 1);
else
return;
GetPlayer().GiveLevel(GetPlayer().GetLevel() + 1);
}
} }
} }
@@ -21,42 +21,6 @@ using System;
namespace Game.Network.Packets namespace Game.Network.Packets
{ {
public class AcceptLevelGrant : ClientPacket
{
public AcceptLevelGrant(WorldPacket packet) : base(packet) { }
public override void Read()
{
Granter = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Granter;
}
public class GrantLevel : ClientPacket
{
public GrantLevel(WorldPacket packet) : base(packet) { }
public override void Read()
{
Target = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Target;
}
/*public class ProposeLevelGrant : ServerPacket
{
public ProposeLevelGrant() : base(ServerOpcodes.ProposeLevelGrant) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Sender);
}
public ObjectGuid Sender;
}*/
public class ReferAFriendFailure : ServerPacket public class ReferAFriendFailure : ServerPacket
{ {
public ReferAFriendFailure() : base(ServerOpcodes.ReferAFriendFailure) { } public ReferAFriendFailure() : base(ServerOpcodes.ReferAFriendFailure) { }
+2 -2
View File
@@ -1725,7 +1725,6 @@ CREATE TABLE `characters` (
`equipmentCache` longtext, `equipmentCache` longtext,
`knownTitles` longtext, `knownTitles` longtext,
`actionBars` tinyint(3) unsigned NOT NULL DEFAULT '0', `actionBars` tinyint(3) unsigned NOT NULL DEFAULT '0',
`grantableLevels` tinyint(3) unsigned NOT NULL DEFAULT '0',
`deleteInfos_Account` int(10) unsigned DEFAULT NULL, `deleteInfos_Account` int(10) unsigned DEFAULT NULL,
`deleteInfos_Name` varchar(12) DEFAULT NULL, `deleteInfos_Name` varchar(12) DEFAULT NULL,
`deleteDate` int(10) unsigned 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_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_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_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 */; /*!40000 ALTER TABLE `updates` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -0,0 +1 @@
ALTER TABLE `characters` DROP `grantableLevels`;