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, " +
"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, " +
"honor, honorLevel, honorRestState, honorRestBonus " +
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, 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 = ?");
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, " +
"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, 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=?," +
"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=?");
"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_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)
SetMultiActionBars(result.Read<byte>(68));
m_fishingSteps = result.Read<byte>(72);
m_fishingSteps = result.Read<byte>(71);
InitDisplayIds();
@@ -2493,8 +2493,8 @@ namespace Game.Entities
var RelocateToHomebind = new Action(() => { mapId = homebind.GetMapId(); instanceId = 0; Relocate(homebind); });
SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID((Difficulty)result.Read<byte>(49)));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(70)));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(71)));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(69)));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(70)));
string taxi_nodes = result.Read<string>(48);
@@ -3020,13 +3020,9 @@ namespace Game.Entities
}
// RaF stuff.
m_grantableLevels = result.Read<byte>(69);
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
AddDynamicFlag(UnitDynFlags.ReferAFriend);
if (m_grantableLevels > 0)
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.GrantableLevels), (byte)1);
_LoadDeclinedNames(holder.GetResult(PlayerLoginQueryLoad.DeclinedNames));
_LoadEquipmentSets(holder.GetResult(PlayerLoginQueryLoad.EquipmentSets));
@@ -3042,9 +3038,9 @@ namespace Game.Entities
holder.GetResult(PlayerLoginQueryLoad.GarrisonFollowerAbilities)))
_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)
{
//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++, (byte)m_activePlayerData.MultiActionBars);
stmt.AddValue(index++, m_grantableLevels);
stmt.AddValue(index++, Global.RealmMgr.GetMinorMajorBugfixVersionForBuild(Global.WorldMgr.GetRealm().Build));
}
else
@@ -3373,7 +3368,6 @@ namespace Game.Entities
stmt.AddValue(index++, ss.ToString());
stmt.AddValue(index++, (byte)m_activePlayerData.MultiActionBars);
stmt.AddValue(index++, m_grantableLevels);
stmt.AddValue(index++, IsInWorld && !GetSession().PlayerLogout() ? 1 : 0);
stmt.AddValue(index++, (uint)m_activePlayerData.Honor);
@@ -218,7 +218,6 @@ namespace Game.Entities
uint m_zoneUpdateTimer;
uint m_ChampioningFaction;
byte m_grantableLevels;
byte m_fishingSteps;
// Recall position
-16
View File
@@ -5398,20 +5398,6 @@ namespace Game.Entities
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);
}
@@ -6987,8 +6973,6 @@ namespace Game.Entities
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)
{
bool recruitAFriend = false;
-58
View File
@@ -24,63 +24,5 @@ namespace Game
{
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
{
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 ReferAFriendFailure() : base(ServerOpcodes.ReferAFriendFailure) { }