fix: Fixes various minor issues (#943)

This commit is contained in:
Kamron Batman 2022-02-26 23:43:25 -08:00 • committed by GitHub
parent dc2b00ec5b
commit 5db8b1354c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

View file

@ -9,6 +9,7 @@ using Server.Guilds;
using Server.Gumps;
using Server.HuePickers;
using Server.Items;
using Server.Logging;
using Server.Menus;
using Server.Mobiles;
using Server.Network;
@ -408,6 +409,8 @@ namespace Server
// Allow four warmode changes in 0.5 seconds, any more will be delay for two seconds
private const int WarmodeCatchCount = 4;
private static readonly ILogger logger = LogFactory.GetLogger(typeof(Mobile));
// TODO: Make these configurations
private static readonly TimeSpan WarmodeSpamCatch = TimeSpan.FromSeconds(Core.SE ? 1.0 : 0.5);
private static readonly TimeSpan WarmodeSpamDelay = TimeSpan.FromSeconds(Core.SE ? 4.0 : 2.0);
@ -5191,13 +5194,20 @@ namespace Server
item.Spawner = null;
}
amount = Math.Clamp(amount, 1, item.Amount);
var oldAmount = item.Amount;
if (amount < oldAmount)
if (oldAmount <= 0)
{
LiftItemDupe(item, amount);
logger.Error($"Item {item.GetType()} ({item.Serial}) has amount of {oldAmount}, but must be at least 1");
}
else
{
amount = Math.Clamp(amount, 1, oldAmount);
if (amount < oldAmount)
{
LiftItemDupe(item, amount);
}
}
var map = from.Map;

View file

@ -318,6 +318,8 @@ namespace Server.Network
state.SendSeasonChange((byte)m.GetSeason(), true);
state.SendMapChange(m.Map);
state.SendPlayMusic(m.Region.Music);
EventSink.InvokeLogin(m);
}

View file

@ -72,7 +72,7 @@ namespace Server.Commands
if (attr == null)
{
failReason = $"Property '${propertyName}' not found.";
failReason = $"Property '{propertyName}' not found.";
return null;
}

View file

@ -272,7 +272,7 @@ namespace Server.Gumps
{
focus.Say("I've been kicked!");
m_State.Disconnect($"Kicked by ${from}.");
m_State.Disconnect($"Kicked by {from}.");
CommandLogging.WriteLine(
from,