Let ServerPacket Handle the writting of packet data.

This commit is contained in:
hondacrx
2017-07-06 11:01:31 -04:00
parent a6b30c73e4
commit 210a2958ff
18 changed files with 73 additions and 80 deletions
+2 -3
View File
@@ -376,11 +376,10 @@ namespace Game.Entities
DuelComplete duelCompleted = new DuelComplete();
duelCompleted.Started = type != DuelCompleteType.Interrupted;
duelCompleted.Write();
SendPacket(duelCompleted, false);
SendPacket(duelCompleted);
if (duel.opponent.GetSession() != null)
duel.opponent.SendPacket(duelCompleted, false);
duel.opponent.SendPacket(duelCompleted);
if (type != DuelCompleteType.Interrupted)
{
+4 -4
View File
@@ -982,9 +982,9 @@ namespace Game.Entities
new PlayerAI GetAI() { return (PlayerAI)i_AI; }
//Network
public void SendPacket(ServerPacket data, bool writePacket = true)
public void SendPacket(ServerPacket data)
{
Session.SendPacket(data, writePacket);
Session.SendPacket(data);
}
//Time
@@ -5298,6 +5298,8 @@ namespace Game.Entities
if (WorldConfig.GetBoolValue(WorldCfg.AlwaysMaxskill)) // Max weapon skill when leveling up
UpdateSkillsToMaxSkillsForLevel();
_ApplyAllLevelScaleItemMods(true); // Moved to above SetFullHealth so player will have full health from Heirlooms
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
@@ -5306,8 +5308,6 @@ namespace Game.Entities
SetPower(PowerType.Rage, GetMaxPower(PowerType.Rage));
SetPower(PowerType.Focus, 0);
_ApplyAllLevelScaleItemMods(true);
// update level to hunter/summon pet
Pet pet = GetPet();
if (pet)
+2 -2
View File
@@ -64,7 +64,7 @@ namespace Game.Entities
playScene.Location = position;
playScene.TransportGUID = GetPlayer().GetTransGUID();
GetPlayer().SendPacket(playScene, true);
GetPlayer().SendPacket(playScene);
AddInstanceIdToSceneMap(sceneInstanceID, sceneTemplate);
@@ -91,7 +91,7 @@ namespace Game.Entities
CancelScene cancelScene = new CancelScene();
cancelScene.SceneInstanceID = sceneInstanceID;
GetPlayer().SendPacket(cancelScene, true);
GetPlayer().SendPacket(cancelScene);
}
public void OnSceneTrigger(uint sceneInstanceID, string triggerName)
+1 -3
View File
@@ -94,8 +94,6 @@ namespace Game.Entities
if (!player)
return;
packet.Write();
AccountTypes gmSecLevel = (AccountTypes)WorldConfig.GetIntValue(WorldCfg.GmLevelInWhoList);
foreach (var pair in _socialMap)
{
@@ -114,7 +112,7 @@ namespace Game.Entities
continue;
if (player.IsVisibleGloballyFor(target))
session.SendPacket(packet, false);
session.SendPacket(packet);
}
}
}