Core/PacketIO: Implemented SMSG_BROADCAST_SUMMON_CAST and SMSG_BROADCAST_SUMMON_RESPONSE

Port From (https://github.com/TrinityCore/TrinityCore/commit/a12f93907083c1c7a8e6a33a3c1724625395af7e)
This commit is contained in:
hondacrx
2022-06-02 20:19:55 -04:00
parent 30a287503f
commit 69970e6acd
2 changed files with 62 additions and 3 deletions
+27
View File
@@ -2082,7 +2082,16 @@ namespace Game.Entities
summonRequest.SummonerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress(); summonRequest.SummonerVirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
summonRequest.AreaID = (int)summoner.GetZoneId(); summonRequest.AreaID = (int)summoner.GetZoneId();
SendPacket(summonRequest); SendPacket(summonRequest);
Group group = GetGroup();
if (group != null)
{
BroadcastSummonCast summonCast = new();
summonCast.Target = GetGUID();
group.BroadcastPacket(summonCast, false, -1, GetGUID());
}
} }
public bool IsInAreaTriggerRadius(AreaTriggerRecord trigger) public bool IsInAreaTriggerRadius(AreaTriggerRecord trigger)
{ {
if (trigger == null) if (trigger == null)
@@ -2114,15 +2123,31 @@ namespace Game.Entities
public void SummonIfPossible(bool agree) public void SummonIfPossible(bool agree)
{ {
void broadcastSummonResponse(bool accepted)
{
Group group = GetGroup();
if (group != null)
{
BroadcastSummonResponse summonResponse = new();
summonResponse.Target = GetGUID();
summonResponse.Accepted = accepted;
group.BroadcastPacket(summonResponse, false, -1, GetGUID());
}
}
if (!agree) if (!agree)
{ {
m_summon_expire = 0; m_summon_expire = 0;
broadcastSummonResponse(false);
return; return;
} }
// expire and auto declined // expire and auto declined
if (m_summon_expire < GameTime.GetGameTime()) if (m_summon_expire < GameTime.GetGameTime())
{
broadcastSummonResponse(false);
return; return;
}
// stop taxi flight at summon // stop taxi flight at summon
FinishTaxiFlight(); FinishTaxiFlight();
@@ -2140,6 +2165,8 @@ namespace Game.Entities
m_summon_location.SetOrientation(GetOrientation()); m_summon_location.SetOrientation(GetOrientation());
TeleportTo(m_summon_location); TeleportTo(m_summon_location);
broadcastSummonResponse(true);
} }
public override void OnPhaseChange() public override void OnPhaseChange()
+35 -3
View File
@@ -16,7 +16,7 @@
*/ */
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Game.DataStorage;
using Game.Entities; using Game.Entities;
using Game.Groups; using Game.Groups;
using Game.Spells; using Game.Spells;
@@ -285,8 +285,13 @@ namespace Game.Networking.Packets
MemberStats.WmoDoodadPlacementID = 0; MemberStats.WmoDoodadPlacementID = 0;
// Vehicle // Vehicle
if (player.GetVehicle() && player.GetVehicle().GetVehicleInfo() != null) Vehicle vehicle = player.GetVehicle();
MemberStats.VehicleSeat = player.GetVehicle().GetVehicleInfo().SeatID[player.m_movementInfo.transport.seat]; if (vehicle != null)
{
VehicleSeatRecord vehicleSeat = vehicle.GetSeatForPassenger(player);
if (vehicleSeat != null)
MemberStats.VehicleSeat = (int)vehicleSeat.Id;
}
// Auras // Auras
foreach (AuraApplication aurApp in player.GetVisibleAuras()) foreach (AuraApplication aurApp in player.GetVisibleAuras())
@@ -874,6 +879,33 @@ namespace Game.Networking.Packets
public ObjectGuid Victim; public ObjectGuid Victim;
} }
class BroadcastSummonCast : ServerPacket
{
public ObjectGuid Target;
public BroadcastSummonCast() : base(ServerOpcodes.BroadcastSummonCast) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Target);
}
}
class BroadcastSummonResponse : ServerPacket
{
public ObjectGuid Target;
public bool Accepted;
public BroadcastSummonResponse() : base(ServerOpcodes.BroadcastSummonResponse) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Target);
_worldPacket.WriteBit(Accepted);
_worldPacket.FlushBits();
}
}
//Structs //Structs
public struct PartyMemberPhase public struct PartyMemberPhase
{ {