Core/PacketIO: Renamed a bunch of opcodes based on more research (only those added after 6.0)
Port From (https://github.com/TrinityCore/TrinityCore/commit/f922c6e7a46a7c712daaaef9b1a72ca865fbe94b)
This commit is contained in:
@@ -157,13 +157,13 @@ namespace Game.Entities
|
||||
|
||||
if (GetTemplate().HasFlag(AreaTriggerFlags.HasCircularMovement))
|
||||
{
|
||||
AreaTriggerCircularMovementInfo cmi = GetMiscTemplate().CircularMovementInfo;
|
||||
AreaTriggerOrbitInfo cmi = GetMiscTemplate().OrbitInfo;
|
||||
if (target && GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
cmi.PathTarget.Set(target.GetGUID());
|
||||
else
|
||||
cmi.Center.Set(new Vector3(pos.posX, pos.posY, pos.posZ));
|
||||
|
||||
InitCircularMovement(cmi, timeToTarget);
|
||||
InitOrbit(cmi, timeToTarget);
|
||||
}
|
||||
else if (GetMiscTemplate().HasSplines())
|
||||
{
|
||||
@@ -186,8 +186,8 @@ namespace Game.Entities
|
||||
AI_Initialize();
|
||||
|
||||
// Relocate areatriggers with circular movement again
|
||||
if (HasCircularMovement())
|
||||
Relocate(CalculateCircularMovementPosition());
|
||||
if (HasOrbit())
|
||||
Relocate(CalculateOrbitPosition());
|
||||
|
||||
if (!GetMap().AddToMap(this))
|
||||
{ // Returning false will cause the object to be deleted - remove from transport
|
||||
@@ -208,10 +208,10 @@ namespace Game.Entities
|
||||
base.Update(diff);
|
||||
_timeSinceCreated += diff;
|
||||
|
||||
// "If" order matter here, Circular Movement > Attached > Splines
|
||||
if (HasCircularMovement())
|
||||
// "If" order matter here, Orbit > Attached > Splines
|
||||
if (HasOrbit())
|
||||
{
|
||||
UpdateCircularMovementPosition(diff);
|
||||
UpdateOrbitPosition(diff);
|
||||
}
|
||||
else if(GetTemplate().HasFlag(AreaTriggerFlags.HasAttached))
|
||||
{
|
||||
@@ -657,7 +657,7 @@ namespace Game.Entities
|
||||
_reachedDestination = false;
|
||||
}
|
||||
|
||||
void InitCircularMovement(AreaTriggerCircularMovementInfo cmi, uint timeToTarget)
|
||||
void InitOrbit(AreaTriggerOrbitInfo cmi, uint timeToTarget)
|
||||
{
|
||||
// Circular movement requires either a center position or an attached unit
|
||||
Cypher.Assert(cmi.Center.HasValue || cmi.PathTarget.HasValue);
|
||||
@@ -666,51 +666,51 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_areaTriggerData).ModifyValue(m_areaTriggerData.TimeToTarget), timeToTarget);
|
||||
m_areaTriggerData.ClearChanged(m_areaTriggerData.TimeToTarget);
|
||||
|
||||
_circularMovementInfo.Set(cmi);
|
||||
_orbitInfo.Set(cmi);
|
||||
|
||||
_circularMovementInfo.Value.TimeToTarget = timeToTarget;
|
||||
_circularMovementInfo.Value.ElapsedTimeForMovement = 0;
|
||||
_orbitInfo.Value.TimeToTarget = timeToTarget;
|
||||
_orbitInfo.Value.ElapsedTimeForMovement = 0;
|
||||
|
||||
if (IsInWorld)
|
||||
{
|
||||
AreaTriggerRePath reshape = new AreaTriggerRePath();
|
||||
reshape.TriggerGUID = GetGUID();
|
||||
reshape.AreaTriggerCircularMovement = _circularMovementInfo;
|
||||
reshape.AreaTriggerOrbit = _orbitInfo;
|
||||
|
||||
SendMessageToSet(reshape, true);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasCircularMovement()
|
||||
public bool HasOrbit()
|
||||
{
|
||||
return _circularMovementInfo.HasValue;
|
||||
return _orbitInfo.HasValue;
|
||||
}
|
||||
|
||||
Position GetCircularMovementCenterPosition()
|
||||
Position GetOrbitCenterPosition()
|
||||
{
|
||||
if (!_circularMovementInfo.HasValue)
|
||||
if (!_orbitInfo.HasValue)
|
||||
return null;
|
||||
|
||||
if (_circularMovementInfo.Value.PathTarget.HasValue)
|
||||
if (_orbitInfo.Value.PathTarget.HasValue)
|
||||
{
|
||||
WorldObject center = Global.ObjAccessor.GetWorldObject(this, _circularMovementInfo.Value.PathTarget.Value);
|
||||
WorldObject center = Global.ObjAccessor.GetWorldObject(this, _orbitInfo.Value.PathTarget.Value);
|
||||
if (center)
|
||||
return center;
|
||||
}
|
||||
|
||||
if (_circularMovementInfo.Value.Center.HasValue)
|
||||
return new Position(_circularMovementInfo.Value.Center.Value);
|
||||
if (_orbitInfo.Value.Center.HasValue)
|
||||
return new Position(_orbitInfo.Value.Center.Value);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Position CalculateCircularMovementPosition()
|
||||
Position CalculateOrbitPosition()
|
||||
{
|
||||
Position centerPos = GetCircularMovementCenterPosition();
|
||||
Position centerPos = GetOrbitCenterPosition();
|
||||
if (centerPos == null)
|
||||
return GetPosition();
|
||||
|
||||
AreaTriggerCircularMovementInfo cmi = _circularMovementInfo.Value;
|
||||
AreaTriggerOrbitInfo cmi = _orbitInfo.Value;
|
||||
|
||||
// AreaTrigger make exactly "Duration / TimeToTarget" loops during his life time
|
||||
float pathProgress = (float)cmi.ElapsedTimeForMovement / cmi.TimeToTarget;
|
||||
@@ -741,14 +741,14 @@ namespace Game.Entities
|
||||
return new Position(x, y, z, angle);
|
||||
}
|
||||
|
||||
void UpdateCircularMovementPosition(uint diff)
|
||||
void UpdateOrbitPosition(uint diff)
|
||||
{
|
||||
if (_circularMovementInfo.Value.StartDelay > GetElapsedTimeForMovement())
|
||||
if (_orbitInfo.Value.StartDelay > GetElapsedTimeForMovement())
|
||||
return;
|
||||
|
||||
_circularMovementInfo.Value.ElapsedTimeForMovement = (int)(GetElapsedTimeForMovement() - _circularMovementInfo.Value.StartDelay);
|
||||
_orbitInfo.Value.ElapsedTimeForMovement = (int)(GetElapsedTimeForMovement() - _orbitInfo.Value.StartDelay);
|
||||
|
||||
Position pos = CalculateCircularMovementPosition();
|
||||
Position pos = CalculateOrbitPosition();
|
||||
|
||||
GetMap().AreaTriggerRelocation(this, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
|
||||
@@ -939,7 +939,7 @@ namespace Game.Entities
|
||||
public Spline GetSpline() { return _spline; }
|
||||
public uint GetElapsedTimeForMovement() { return GetTimeSinceCreated(); } // @todo: research the right value, in sniffs both timers are nearly identical
|
||||
|
||||
public Optional<AreaTriggerCircularMovementInfo> GetCircularMovementInfo() { return _circularMovementInfo; }
|
||||
public Optional<AreaTriggerOrbitInfo> GetCircularMovementInfo() { return _orbitInfo; }
|
||||
|
||||
AreaTriggerFieldData m_areaTriggerData;
|
||||
|
||||
@@ -962,7 +962,7 @@ namespace Game.Entities
|
||||
int _lastSplineIndex;
|
||||
uint _movementTime;
|
||||
|
||||
Optional<AreaTriggerCircularMovementInfo> _circularMovementInfo;
|
||||
Optional<AreaTriggerOrbitInfo> _orbitInfo;
|
||||
|
||||
AreaTriggerMiscTemplate _areaTriggerMiscTemplate;
|
||||
List<ObjectGuid> _insideUnits = new List<ObjectGuid>();
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public struct AreaTriggerCircularMovementInfo
|
||||
public struct AreaTriggerOrbitInfo
|
||||
{
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ namespace Game.Entities
|
||||
|
||||
public AreaTriggerScaleInfo OverrideScale = new AreaTriggerScaleInfo();
|
||||
public AreaTriggerScaleInfo ExtraScale = new AreaTriggerScaleInfo();
|
||||
public AreaTriggerCircularMovementInfo CircularMovementInfo;
|
||||
public AreaTriggerOrbitInfo OrbitInfo;
|
||||
|
||||
public AreaTriggerTemplate Template;
|
||||
public List<Vector3> SplinePoints = new List<Vector3>();
|
||||
|
||||
@@ -1942,10 +1942,10 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
ArtifactForgeOpened artifactForgeOpened = new ArtifactForgeOpened();
|
||||
artifactForgeOpened.ArtifactGUID = item.GetGUID();
|
||||
artifactForgeOpened.ForgeGUID = GetGUID();
|
||||
player.SendPacket(artifactForgeOpened);
|
||||
OpenArtifactForge openArtifactForge = new OpenArtifactForge();
|
||||
openArtifactForge.ArtifactGUID = item.GetGUID();
|
||||
openArtifactForge.ForgeGUID = GetGUID();
|
||||
player.SendPacket(openArtifactForge);
|
||||
break;
|
||||
}
|
||||
case 2: // Heart Forge
|
||||
@@ -1954,9 +1954,9 @@ namespace Game.Entities
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
AzeriteEssenceForgeOpened azeriteEssenceForgeOpened = new AzeriteEssenceForgeOpened();
|
||||
azeriteEssenceForgeOpened.ForgeGUID = GetGUID();
|
||||
player.SendPacket(azeriteEssenceForgeOpened);
|
||||
OpenHeartForge openHeartForge = new OpenHeartForge();
|
||||
openHeartForge.ForgeGUID = GetGUID();
|
||||
player.SendPacket(openHeartForge);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1970,10 +1970,10 @@ namespace Game.Entities
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
GameObjectUIAction gameObjectUIAction = new GameObjectUIAction();
|
||||
gameObjectUIAction.ObjectGUID = GetGUID();
|
||||
gameObjectUIAction.UILink = (int)GetGoInfo().UILink.UILinkType;
|
||||
player.SendPacket(gameObjectUIAction);
|
||||
GameObjectUILink gameObjectUILink = new GameObjectUILink();
|
||||
gameObjectUILink.ObjectGUID = GetGUID();
|
||||
gameObjectUILink.UILink = (int)GetGoInfo().UILink.UILinkType;
|
||||
player.SendPacket(gameObjectUILink);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace Game.Entities
|
||||
SetState(ItemUpdateState.Changed, owner);
|
||||
}
|
||||
|
||||
AzeriteXpGain xpGain = new AzeriteXpGain();
|
||||
PlayerAzeriteItemGains xpGain = new PlayerAzeriteItemGains();
|
||||
xpGain.ItemGUID = GetGUID();
|
||||
xpGain.XP = xp;
|
||||
owner.SendPacket(xpGain);
|
||||
|
||||
@@ -1116,7 +1116,7 @@ namespace Game.Entities
|
||||
|
||||
public void SendUpdateSockets()
|
||||
{
|
||||
SocketGemsResult socketGems = new SocketGemsResult();
|
||||
SocketGemsSuccess socketGems = new SocketGemsSuccess();
|
||||
socketGems.Item = GetGUID();
|
||||
|
||||
GetOwner().SendPacket(socketGems);
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace Game.Entities
|
||||
bool hasAreaTriggerPolygon = areaTriggerTemplate.IsPolygon();
|
||||
bool hasAreaTriggerCylinder = areaTriggerTemplate.IsCylinder();
|
||||
bool hasAreaTriggerSpline = areaTrigger.HasSplines();
|
||||
bool hasCircularMovement = areaTrigger.HasCircularMovement();
|
||||
bool hasOrbit = areaTrigger.HasOrbit();
|
||||
|
||||
data.WriteBit(hasAbsoluteOrientation);
|
||||
data.WriteBit(hasDynamicShape);
|
||||
@@ -488,7 +488,7 @@ namespace Game.Entities
|
||||
data.WriteBit(hasAreaTriggerPolygon);
|
||||
data.WriteBit(hasAreaTriggerCylinder);
|
||||
data.WriteBit(hasAreaTriggerSpline);
|
||||
data.WriteBit(hasCircularMovement);
|
||||
data.WriteBit(hasOrbit);
|
||||
|
||||
if (hasUnk3)
|
||||
data.WriteBit(0);
|
||||
@@ -571,7 +571,7 @@ namespace Game.Entities
|
||||
data.WriteFloat(areaTriggerTemplate.CylinderDatas.LocationZOffsetTarget);
|
||||
}
|
||||
|
||||
if (hasCircularMovement)
|
||||
if (hasOrbit)
|
||||
areaTrigger.GetCircularMovementInfo().Value.Write(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -809,23 +809,23 @@ namespace Game.Entities
|
||||
|
||||
_favoriteAppearances[itemModifiedAppearanceId] = apperanceState;
|
||||
|
||||
TransmogCollectionUpdate transmogCollectionUpdate = new TransmogCollectionUpdate();
|
||||
transmogCollectionUpdate.IsFullUpdate = false;
|
||||
transmogCollectionUpdate.IsSetFavorite = apply;
|
||||
transmogCollectionUpdate.FavoriteAppearances.Add(itemModifiedAppearanceId);
|
||||
AccountTransmogUpdate accountTransmogUpdate = new AccountTransmogUpdate();
|
||||
accountTransmogUpdate.IsFullUpdate = false;
|
||||
accountTransmogUpdate.IsSetFavorite = apply;
|
||||
accountTransmogUpdate.FavoriteAppearances.Add(itemModifiedAppearanceId);
|
||||
|
||||
_owner.SendPacket(transmogCollectionUpdate);
|
||||
_owner.SendPacket(accountTransmogUpdate);
|
||||
}
|
||||
|
||||
public void SendFavoriteAppearances()
|
||||
{
|
||||
TransmogCollectionUpdate transmogCollectionUpdate = new TransmogCollectionUpdate();
|
||||
transmogCollectionUpdate.IsFullUpdate = true;
|
||||
AccountTransmogUpdate accountTransmogUpdate = new AccountTransmogUpdate();
|
||||
accountTransmogUpdate.IsFullUpdate = true;
|
||||
foreach (var pair in _favoriteAppearances)
|
||||
if (pair.Value != FavoriteAppearanceState.Removed)
|
||||
transmogCollectionUpdate.FavoriteAppearances.Add(pair.Key);
|
||||
accountTransmogUpdate.FavoriteAppearances.Add(pair.Key);
|
||||
|
||||
_owner.SendPacket(transmogCollectionUpdate);
|
||||
_owner.SendPacket(accountTransmogUpdate);
|
||||
}
|
||||
|
||||
public void AddTransmogSet(uint transmogSetId)
|
||||
|
||||
@@ -6202,7 +6202,7 @@ namespace Game.Entities
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
SendPacket(new CharacterInventoryOverflowWarning());
|
||||
SendPacket(new InventoryFullOverflow());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5651,10 +5651,10 @@ namespace Game.Entities
|
||||
SendPacket(mountUpdate);
|
||||
|
||||
// SMSG_ACCOUNT_TOYS_UPDATE
|
||||
AccountToysUpdate toysUpdate = new AccountToysUpdate();
|
||||
toysUpdate.IsFullUpdate = true;
|
||||
toysUpdate.Toys = GetSession().GetCollectionMgr().GetAccountToys();
|
||||
SendPacket(toysUpdate);
|
||||
AccountToyUpdate toyUpdate = new AccountToyUpdate();
|
||||
toyUpdate.IsFullUpdate = true;
|
||||
toyUpdate.Toys = GetSession().GetCollectionMgr().GetAccountToys();
|
||||
SendPacket(toyUpdate);
|
||||
|
||||
// SMSG_ACCOUNT_HEIRLOOM_UPDATE
|
||||
AccountHeirloomUpdate heirloomUpdate = new AccountHeirloomUpdate();
|
||||
|
||||
Reference in New Issue
Block a user