Skip to content

Commit

Permalink
last batch hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Mag-nus committed Feb 13, 2024
1 parent 20dc8eb commit 57e2635
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 47 deletions.
6 changes: 3 additions & 3 deletions Source/ACE.Server/Command/Handlers/DeveloperCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param
if (value.ObjMaint.RemoveKnownObject(kvp.Value, false))
{
if (log.IsDebugEnabled)
log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [ObjectTable]");
log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [ObjectTable]");
objectTableErrors++;
}
}
Expand All @@ -2259,7 +2259,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param
if (value.ObjMaint.RemoveVisibleObject(kvp.Value, false))
{
if (log.IsDebugEnabled)
log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VisibleObjectTable]");
log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VisibleObjectTable]");
visibleObjectTableErrors++;
}
}
Expand All @@ -2272,7 +2272,7 @@ public static void HandleAuditObjectMaint(Session session, params string[] param
if (value.ObjMaint.RemoveKnownPlayer(kvp.Value))
{
if (log.IsDebugEnabled)
log.DebugFormat($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VoyeurTable]");
log.Debug($"AuditObjectMaint removed 0x{kvp.Value.ID:X8}:{kvp.Value.Name} (IsDestroyed:{kvp.Value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{kvp.Value.Position}) from 0x{value.ID:X8}:{value.Name} (IsDestroyed:{value.WeenieObj?.WorldObject?.IsDestroyed}, Position:{value.Position}) [VoyeurTable]");
voyeurTableErrors++;
}
}
Expand Down
18 changes: 9 additions & 9 deletions Source/ACE.Server/Entity/GeneratorProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void Enqueue(int numObjects = 1)
{
/*if (MaxObjectsSpawned)
{
log.DebugFormat($"{_generator.Name}.Enqueue({numObjects}): max objects reached");
log.DebugFormat("{0}.Enqueue({1}): max objects reached", _generator.Name, numObjects);
break;
}*/
SpawnQueue.Add(GetSpawnTime());
Expand Down Expand Up @@ -275,7 +275,7 @@ public List<WorldObject> Spawn()

foreach (var obj in objects)
{
//log.DebugFormat($"{_generator.Name}.Spawn({obj.Name})");
//log.DebugFormat("{0}.Spawn({1})", _generator.Name, obj.Name);

obj.Generator = Generator;
obj.GeneratorId = Generator.Guid.Full;
Expand Down Expand Up @@ -306,7 +306,7 @@ public List<WorldObject> Spawn()
if (!success)
{
if (log.IsDebugEnabled)
log.DebugFormat($"[GENERATOR] 0x{Generator.Guid}:{Generator.WeenieClassId} {Generator.Name}.Spawn(): failed to spawn {obj.Name} (0x{obj.Guid}:{obj.WeenieClassId}) from profile {LinkId} at {RegenLocationType}{(obj.Location != null ? $"\n Gen LOC: {Generator.Location?.ToLOCString()}\n Obj LOC: {obj.Location.ToLOCString()}" : "")}");
log.Debug($"[GENERATOR] 0x{Generator.Guid}:{Generator.WeenieClassId} {Generator.Name}.Spawn(): failed to spawn {obj.Name} (0x{obj.Guid}:{obj.WeenieClassId}) from profile {LinkId} at {RegenLocationType}{(obj.Location != null ? $"\n Gen LOC: {Generator.Location?.ToLOCString()}\n Obj LOC: {obj.Location.ToLOCString()}" : "")}");
obj.Destroy();
}
}
Expand Down Expand Up @@ -418,7 +418,7 @@ public bool Spawn_Shop(WorldObject obj)
public bool Spawn_Default(WorldObject obj)
{
// default location handler?
//log.DebugFormat($"{_generator.Name}.Spawn_Default({obj.Name}): default handler for RegenLocationType {RegenLocationType}");
//log.DebugFormat("{0}.Spawn_Default({1}): default handler for RegenLocationType {2}", _generator.Name, obj.Name, RegenLocationType);

obj.Location = new ACE.Entity.Position(Generator.Location);

Expand All @@ -429,7 +429,7 @@ public bool VerifyLandblock(WorldObject obj)
{
if (obj.Location == null || obj.Location.Landblock != Generator.Location.Landblock)
{
//log.DebugFormat($"{_generator.Name}.VerifyLandblock({obj.Name}) - spawn location is invalid landblock");
//log.DebugFormat("{0}.VerifyLandblock({1}) - spawn location is invalid landblock", _generator.Name, obj.Name);
return false;
}
return true;
Expand All @@ -439,7 +439,7 @@ public bool VerifyWalkableSlope(WorldObject obj)
{
if (!obj.Location.Indoors && !obj.Location.IsWalkable() && !VerifyWalkableSlopeExcludedLandblocks.Contains(obj.Location.LandblockId.Landblock))
{
//log.DebugFormat($"{_generator.Name}.VerifyWalkableSlope({obj.Name}) - spawn location is unwalkable slope");
//log.DebugFormat("{0}.VerifyWalkableSlope({1}) - spawn location is unwalkable slope", _generator.Name, obj.Name);
return false;
}
return true;
Expand Down Expand Up @@ -470,7 +470,7 @@ public List<WorldObject> TreasureGenerator()
if (deathTreasure != null)
{
// TODO: get randomly generated death treasure from LootGenerationFactory
//log.DebugFormat($"{_generator.Name}.TreasureGenerator(): found death treasure {Biota.WeenieClassId}");
//log.DebugFormat("{0}.TreasureGenerator(): found death treasure {1}", _generator.Name, Biota.WeenieClassId);
return LootGenerationFactory.CreateRandomLootObjects(deathTreasure);
}
else
Expand All @@ -479,7 +479,7 @@ public List<WorldObject> TreasureGenerator()
if (wieldedTreasure != null)
{
// TODO: get randomly generated wielded treasure from LootGenerationFactory
//log.DebugFormat($"{_generator.Name}.TreasureGenerator(): found wielded treasure {Biota.WeenieClassId}");
//log.DebugFormat("{0}.TreasureGenerator(): found wielded treasure {1}", _generator.Name, Biota.WeenieClassId);

// roll into the wielded treasure table
//var table = new TreasureWieldedTable(wieldedTreasure);
Expand Down Expand Up @@ -525,7 +525,7 @@ public void RemoveTreasure()
/// </summary>
public void NotifyGenerator(ObjectGuid target, RegenerationType eventType)
{
//log.DebugFormat($"{_generator.Name}.NotifyGenerator({target:X8}, {eventType})");
//log.DebugFormat("{0}.NotifyGenerator({1:X8}, {2})", _generator.Name, target, eventType);

Spawned.TryGetValue(target.Full, out var woi);

Expand Down
12 changes: 8 additions & 4 deletions Source/ACE.Server/Entity/Landblock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public EnvironChangeType FogColor

public Landblock(LandblockId id)
{
//log.DebugFormat($"Landblock({(id.Raw | 0xFFFF):X8})");
//log.DebugFormat("Landblock({0:X8})", (id.Raw | 0xFFFF));

Id = id;

Expand Down Expand Up @@ -866,11 +866,15 @@ private bool AddWorldObjectInternal(WorldObject wo)

if (wo.Generator != null)
{
log.DebugFormat($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()} from generator {wo.Generator.WeenieClassId} - 0x{wo.Generator.Guid}:{wo.Generator.Name}");
if (log.IsDebugEnabled)
log.Debug($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()} from generator {wo.Generator.WeenieClassId} - 0x{wo.Generator.Guid}:{wo.Generator.Name}");
wo.NotifyOfEvent(RegenerationType.PickUp); // Notify generator the generated object is effectively destroyed, use Pickup to catch both cases.
}
else if (wo.IsGenerator) // Some generators will fail random spawns if they're circumference spans over water or cliff edges
log.DebugFormat($"AddWorldObjectInternal: couldn't spawn generator 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}");
{
if (log.IsDebugEnabled)
log.Debug($"AddWorldObjectInternal: couldn't spawn generator 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}");
}
else if (wo.ProjectileTarget == null && !(wo is SpellProjectile))
log.Warn($"AddWorldObjectInternal: couldn't spawn 0x{wo.Guid}:{wo.Name} [{wo.WeenieClassId} - {wo.WeenieType}] at {wo.Location.ToLOCString()}");

Expand Down Expand Up @@ -1118,7 +1122,7 @@ public void Unload()
{
var landblockID = Id.Raw | 0xFFFF;

//log.DebugFormat($"Landblock.Unload({landblockID:X8})");
//log.DebugFormat("Landblock.Unload({0:X8})", landblockID);

ProcessPendingWorldObjectAdditionsAndRemovals();

Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Server/Managers/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static bool StartEvent(string e, WorldObject source, WorldObject target)
}

if (log.IsDebugEnabled)
log.DebugFormat($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} started an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been started.") : "")}");
log.Debug($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} started an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been started.") : "")}");

return true;
}
Expand Down Expand Up @@ -90,7 +90,7 @@ public static bool StopEvent(string e, WorldObject source, WorldObject target)
}

if (log.IsDebugEnabled)
log.DebugFormat($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} stopped an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been stopped.") : "")}");
log.Debug($"[EVENT] {(source == null ? "SYSTEM" : $"{source.Name} (0x{source.Guid}|{source.WeenieClassId})")}{(target == null ? "" : $", triggered by {target.Name} (0x{target.Guid}|{target.WeenieClassId}),")} stopped an event: {evnt.Name}{((int)state == evnt.State ? (source == null ? ", which is the default state for this event." : ", which had already been stopped.") : "")}");

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Server/Managers/HouseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ private static bool IsRentPaid(PlayerHouse playerHouse)
if (rentItem.Paid < rentItem.Num)
{
if (log.IsDebugEnabled)
log.DebugFormat($"[HOUSE] {playerHouse.PlayerName}.IsRentPaid() - required {rentItem.Num:N0}x {(rentItem.Num > 1 ? $"{rentItem.PluralName}" : $"{rentItem.Name}")} ({rentItem.WeenieID}), found {rentItem.Paid:N0}");
log.Debug($"[HOUSE] {playerHouse.PlayerName}.IsRentPaid() - required {rentItem.Num:N0}x {(rentItem.Num > 1 ? $"{rentItem.PluralName}" : $"{rentItem.Name}")} ({rentItem.WeenieID}), found {rentItem.Paid:N0}");
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/ACE.Server/Managers/LandblockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ private static void UnloadLandblocks()
swTrySplitEach.Stop();

if (swTrySplitEach.Elapsed.TotalMilliseconds > 3)
log.Warn($"[LANDBLOCK GROUP] TrySplit for {landblockGroups[i]} took: {swTrySplitEach.Elapsed.TotalMilliseconds:N2} ms");
log.WarnFormat("[LANDBLOCK GROUP] TrySplit for {0} took: {1:N2} ms", landblockGroups[i], swTrySplitEach.Elapsed.TotalMilliseconds);
else if (swTrySplitEach.Elapsed.TotalMilliseconds > 1)
log.DebugFormat("[LANDBLOCK GROUP] TrySplit for {0} took: {1:N2} ms", landblockGroups[i], swTrySplitEach.Elapsed.TotalMilliseconds);

Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Server/Managers/RecipeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ public static HashSet<uint> CreateDestroyItems(Player player, Recipe recipe, Wor
player.Session.Network.EnqueueSend(new GameMessageSystemChat(message, ChatMessageType.Craft));

if (log.IsDebugEnabled)
log.DebugFormat($"[CRAFTING] {player.Name} used {source.NameWithMaterial} on {target.NameWithMaterial} {(success ? "" : "un")}successfully. {(destroySource ? $"| {source.NameWithMaterial} was destroyed " : "")}{(destroyTarget ? $"| {target.NameWithMaterial} was destroyed " : "")}| {message}");
log.Debug($"[CRAFTING] {player.Name} used {source.NameWithMaterial} on {target.NameWithMaterial} {(success ? "" : "un")}successfully. {(destroySource ? $"| {source.NameWithMaterial} was destroyed " : "")}{(destroyTarget ? $"| {target.NameWithMaterial} was destroyed " : "")}| {message}");
}
else
BroadcastTinkering(player, source, target, successChance, success);
Expand All @@ -1088,7 +1088,7 @@ public static void BroadcastTinkering(Player player, WorldObject tool, WorldObje
player.EnqueueBroadcast(new GameMessageSystemChat($"{player.Name} fails to apply the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}. The target is destroyed.", ChatMessageType.Craft), WorldObject.LocalBroadcastRange, ChatMessageType.Craft);

if (log.IsDebugEnabled)
log.DebugFormat($"[TINKERING] {player.Name} {(success ? "successfully applies" : "fails to apply")} the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}.{(!success ? " The target is destroyed." : "")} | Chance: {chance}");
log.Debug($"[TINKERING] {player.Name} {(success ? "successfully applies" : "fails to apply")} the {sourceName} (workmanship {(tool.Workmanship ?? 0):#.00}) to the {target.NameWithMaterial}.{(!success ? " The target is destroyed." : "")} | Chance: {chance}");
}

public static WorldObject CreateItem(Player player, uint wcid, uint amount)
Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Server/Managers/ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ private static void ShutdownServer()
if (playerCount > 0 && DateTime.UtcNow - playerLogoffStart > TimeSpan.FromMinutes(5))
{
playerLogoffStart = DateTime.UtcNow;
log.Warn($"5 minute log off failsafe reached and there are {playerCount} player{(playerCount > 1 ? "s" : "")} still online.");
log.WarnFormat("5 minute log off failsafe reached and there are {0} player{1} still online.", playerCount, (playerCount > 1 ? "s" : ""));
foreach (var player in PlayerManager.GetAllOnline())
{
log.Warn($"Player {player.Name} (0x{player.Guid}) appears to be stuck in world and unable to log off normally. Requesting Forced Logoff...");
log.WarnFormat("Player {0} (0x{1}) appears to be stuck in world and unable to log off normally. Requesting Forced Logoff...", player.Name, player.Guid);
player.ForcedLogOffRequested = true;
player.ForceLogoff();
}
Expand Down
12 changes: 8 additions & 4 deletions Source/ACE.Server/Network/NetworkSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ public void EnqueueSend(params ServerPacket[] packets)

foreach (var packet in packets)
{
packetLog.DebugFormat("[{0}] Enqueuing Packet {1}", session.LoggingIdentifier, packet.GetHashCode());
if (packetLog.IsDebugEnabled)
packetLog.DebugFormat("[{0}] Enqueuing Packet {1}", session.LoggingIdentifier, packet.GetHashCode());
packetQueue.Enqueue(packet);
}
}
Expand Down Expand Up @@ -396,7 +397,8 @@ private void DoRequestForRetransmission(uint rcvdSeq)
EnqueueSend(reqPacket);

LastRequestForRetransmitTime = DateTime.UtcNow;
packetLog.DebugFormat("[{0}] Requested retransmit of {1}", session.LoggingIdentifier, needSeq.Select(k => k.ToString()).Aggregate((a, b) => a + ", " + b));
if (packetLog.IsDebugEnabled)
packetLog.DebugFormat("[{0}] Requested retransmit of {1}", session.LoggingIdentifier, needSeq.Select(k => k.ToString()).Aggregate((a, b) => a + ", " + b));
NetworkStatistics.S2C_RequestsForRetransmit_Aggregate_Increment();
}

Expand Down Expand Up @@ -708,13 +710,15 @@ private void FlushPackets()

private void SendPacket(ServerPacket packet)
{
packetLog.DebugFormat("[{0}] Sending packet {1}", session.LoggingIdentifier, packet.GetHashCode());
if (packetLog.IsDebugEnabled)
packetLog.DebugFormat("[{0}] Sending packet {1}", session.LoggingIdentifier, packet.GetHashCode());
NetworkStatistics.S2C_Packets_Aggregate_Increment();

if (packet.Header.HasFlag(PacketHeaderFlags.EncryptedChecksum))
{
uint issacXor = ConnectionData.IssacServer.Next();
packetLog.DebugFormat("[{0}] Setting Issac for packet {1} to {2}", session.LoggingIdentifier, packet.GetHashCode(), issacXor);
if (packetLog.IsDebugEnabled)
packetLog.DebugFormat("[{0}] Setting Issac for packet {1} to {2}", session.LoggingIdentifier, packet.GetHashCode(), issacXor);
packet.IssacXor = issacXor;
}

Expand Down
Loading

0 comments on commit 57e2635

Please sign in to comment.