Fixes packet length & PropertyList (#82)
This commit is contained in:
parent
1f1ceade8c
commit
27e8d823bd
20 changed files with 251 additions and 225 deletions
|
|
@ -1370,9 +1370,9 @@ namespace Server.Items
|
||||||
return base.CanEquip(from);
|
return base.CanEquip(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckPropertyConfliction(Mobile m)
|
public override bool CheckPropertyConflict(Mobile m)
|
||||||
{
|
{
|
||||||
if (base.CheckPropertyConfliction(m))
|
if (base.CheckPropertyConflict(m))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Layer == Layer.Pants)
|
if (Layer == Layer.Pants)
|
||||||
|
|
|
||||||
|
|
@ -544,9 +544,9 @@ namespace Server.Items
|
||||||
return Attributes.SpellChanneling != 0;
|
return Attributes.SpellChanneling != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckPropertyConfliction(Mobile m)
|
public override bool CheckPropertyConflict(Mobile m)
|
||||||
{
|
{
|
||||||
if (base.CheckPropertyConfliction(m))
|
if (base.CheckPropertyConflict(m))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Layer == Layer.Pants)
|
if (Layer == Layer.Pants)
|
||||||
|
|
|
||||||
|
|
@ -541,31 +541,22 @@ namespace Server.Items
|
||||||
|
|
||||||
writer.WriteDeltaTime(TimeOfDeath);
|
writer.WriteDeltaTime(TimeOfDeath);
|
||||||
|
|
||||||
List<KeyValuePair<Item, Point3D>> list = m_RestoreTable == null
|
int count = m_RestoreTable?.Count ?? 0;
|
||||||
? null
|
|
||||||
: new List<KeyValuePair<Item, Point3D>>(m_RestoreTable);
|
|
||||||
int count = list?.Count ?? 0;
|
|
||||||
|
|
||||||
writer.Write(count);
|
writer.Write(count);
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
if (m_RestoreTable != null)
|
||||||
{
|
foreach (var (item, loc) in m_RestoreTable)
|
||||||
KeyValuePair<Item, Point3D> kvp = list[i];
|
|
||||||
Item item = kvp.Key;
|
|
||||||
Point3D loc = kvp.Value;
|
|
||||||
|
|
||||||
writer.Write(item);
|
|
||||||
|
|
||||||
if (item.Location == loc)
|
|
||||||
{
|
{
|
||||||
writer.Write(false);
|
writer.Write(item);
|
||||||
|
|
||||||
|
if (item.Location == loc)
|
||||||
|
writer.Write(false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.Write(true);
|
||||||
|
writer.Write(loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
writer.Write(true);
|
|
||||||
writer.Write(loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.Write(m_DecayTimer != null);
|
writer.Write(m_DecayTimer != null);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<WarningsAsErrors />
|
<WarningsAsErrors />
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<LangVersion>8.0</LangVersion>
|
||||||
<OutDir>..\..\Distribution\Assemblies</OutDir>
|
<OutDir>..\..\Distribution\Assemblies</OutDir>
|
||||||
<OutputPath>..\..\Distribution\Assemblies</OutputPath>
|
<OutputPath>..\..\Distribution\Assemblies</OutputPath>
|
||||||
<PublishDir>..\..\Distribution\Assemblies</PublishDir>
|
<PublishDir>..\..\Distribution\Assemblies</PublishDir>
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
/***************************************************************************
|
/*************************************************************************
|
||||||
* AssemblyHandler.cs
|
* ModernUO *
|
||||||
* --------------------
|
* Copyright (C) 2019 - ModernUO Development Team *
|
||||||
* begin : May 1, 2002
|
* Email: hi@modernuo.com *
|
||||||
* copyright : (C) The RunUO Software Team
|
* File: AssemblyHandler.cs - Created: 2019/08/02 - Updated: 2020/01/19 *
|
||||||
* email : info@runuo.com
|
* *
|
||||||
*
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
* $Id$
|
* it under the terms of the GNU General Public License as published by *
|
||||||
*
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
***************************************************************************/
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
/***************************************************************************
|
* This program is distributed in the hope that it will be useful, *
|
||||||
*
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* it under the terms of the GNU General Public License as published by
|
* GNU General Public License for more details. *
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* You should have received a copy of the GNU General Public License *
|
||||||
*
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
***************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright (C) 2019 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: CityInfo.cs - Created: 2019/10/04 - Updated: 2020/01/19 *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
{
|
{
|
||||||
public sealed class CityInfo
|
public sealed class CityInfo
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright (C) 2019 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: Configuration.cs - Created: 2019/10/04 - Updated: 2020/01/19 *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -67,7 +87,7 @@ namespace Server
|
||||||
public void Flush()
|
public void Flush()
|
||||||
{
|
{
|
||||||
using FileStream fs = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write);
|
using FileStream fs = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write);
|
||||||
string configJson = JsonSerializer.Serialize(this, new JsonSerializerOptions {WriteIndented = true});
|
string configJson = JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true });
|
||||||
Span<byte> data = stackalloc byte[Utility.UTF8WithEncoding.GetMaxByteCount(configJson.Length)];
|
Span<byte> data = stackalloc byte[Utility.UTF8WithEncoding.GetMaxByteCount(configJson.Length)];
|
||||||
int bytesWritten = Utility.UTF8WithEncoding.GetBytes(configJson, data);
|
int bytesWritten = Utility.UTF8WithEncoding.GetBytes(configJson, data);
|
||||||
fs.Write(data.Slice(0, bytesWritten));
|
fs.Write(data.Slice(0, bytesWritten));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Server.Guilds
|
namespace Server.Guilds
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +33,7 @@ namespace Server.Guilds
|
||||||
public abstract class BaseGuild : ISerializable
|
public abstract class BaseGuild : ISerializable
|
||||||
{
|
{
|
||||||
private BufferWriter m_SaveBuffer;
|
private BufferWriter m_SaveBuffer;
|
||||||
public BufferWriter SaveBuffer { get { return m_SaveBuffer; } }
|
public BufferWriter SaveBuffer => m_SaveBuffer;
|
||||||
|
|
||||||
private static uint m_NextID = 1;
|
private static uint m_NextID = 1;
|
||||||
|
|
||||||
|
|
@ -83,23 +84,9 @@ namespace Server.Guilds
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BaseGuild FindByName(string name)
|
public static BaseGuild FindByName(string name) => List.Values.FirstOrDefault(g => g.Name == name);
|
||||||
{
|
|
||||||
foreach (BaseGuild g in List.Values)
|
|
||||||
if (g.Name == name)
|
|
||||||
return g;
|
|
||||||
|
|
||||||
return null;
|
public static BaseGuild FindByAbbrev(string abbr) => List.Values.FirstOrDefault(g => g.Abbreviation == abbr);
|
||||||
}
|
|
||||||
|
|
||||||
public static BaseGuild FindByAbbrev(string abbr)
|
|
||||||
{
|
|
||||||
foreach (BaseGuild g in List.Values)
|
|
||||||
if (g.Abbreviation == abbr)
|
|
||||||
return g;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<BaseGuild> Search(string find)
|
public static List<BaseGuild> Search(string find)
|
||||||
{
|
{
|
||||||
|
|
@ -108,16 +95,9 @@ namespace Server.Guilds
|
||||||
|
|
||||||
foreach (BaseGuild g in List.Values)
|
foreach (BaseGuild g in List.Values)
|
||||||
{
|
{
|
||||||
bool match = true;
|
|
||||||
string name = g.Name.ToLower();
|
string name = g.Name.ToLower();
|
||||||
for (int i = 0; i < words.Length; i++)
|
|
||||||
if (name.IndexOf(words[i]) == -1)
|
|
||||||
{
|
|
||||||
match = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match)
|
if (words.All(t => name.IndexOf(t) != -1))
|
||||||
results.Add(g);
|
results.Add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,18 @@ namespace Server
|
||||||
|
|
||||||
public Packet RemovePacket => StaticPacketHandlers.GetRemoveEntityPacket(this);
|
public Packet RemovePacket => StaticPacketHandlers.GetRemoveEntityPacket(this);
|
||||||
public OPLInfo OPLPacket => StaticPacketHandlers.GetOPLInfoPacket(this);
|
public OPLInfo OPLPacket => StaticPacketHandlers.GetOPLInfoPacket(this);
|
||||||
public ObjectPropertyList PropertyList => StaticPacketHandlers.GetOPLPacket(this);
|
|
||||||
|
private ObjectPropertyList m_PropertyList;
|
||||||
|
public ObjectPropertyList PropertyList => m_PropertyList ??= NewObjectPropertyList();
|
||||||
|
|
||||||
|
public void ReleaseOPLPacket()
|
||||||
|
{
|
||||||
|
if (m_PropertyList == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Packet.Release(m_PropertyList);
|
||||||
|
m_PropertyList = null;
|
||||||
|
}
|
||||||
|
|
||||||
// World packets need to be invalidated when any of the following changes:
|
// World packets need to be invalidated when any of the following changes:
|
||||||
// - ItemID
|
// - ItemID
|
||||||
|
|
@ -960,17 +971,16 @@ namespace Server
|
||||||
{
|
{
|
||||||
NetState ns = rootParent.NetState;
|
NetState ns = rootParent.NetState;
|
||||||
|
|
||||||
if (ns != null)
|
if (ns != null && rootParent.CanSee(this) && rootParent.InRange(worldLoc, GetUpdateRange(rootParent)))
|
||||||
if (rootParent.CanSee(this) && rootParent.InRange(worldLoc, GetUpdateRange(rootParent)))
|
{
|
||||||
{
|
if (ns.ContainerGridLines)
|
||||||
if (ns.ContainerGridLines)
|
ns.Send(new ContainerContentUpdate6017(this));
|
||||||
ns.Send(new ContainerContentUpdate6017(this));
|
else
|
||||||
else
|
ns.Send(new ContainerContentUpdate(this));
|
||||||
ns.Send(new ContainerContentUpdate(this));
|
|
||||||
|
|
||||||
if (ObjectPropertyList.Enabled)
|
if (ObjectPropertyList.Enabled)
|
||||||
ns.Send(OPLPacket);
|
ns.Send(OPLPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SecureTrade st = GetSecureTradeCont()?.Trade;
|
SecureTrade st = GetSecureTradeCont()?.Trade;
|
||||||
|
|
@ -1013,9 +1023,7 @@ namespace Server
|
||||||
int range = GetUpdateRange(mob);
|
int range = GetUpdateRange(mob);
|
||||||
|
|
||||||
if (mob.Map != map || !mob.InRange(worldLoc, range))
|
if (mob.Map != map || !mob.InRange(worldLoc, range))
|
||||||
{
|
|
||||||
openers.RemoveAt(i--);
|
openers.RemoveAt(i--);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mob == rootParent || mob == tradeRecip)
|
if (mob == rootParent || mob == tradeRecip)
|
||||||
|
|
@ -1051,44 +1059,43 @@ namespace Server
|
||||||
{
|
{
|
||||||
Mobile m = state.Mobile;
|
Mobile m = state.Mobile;
|
||||||
|
|
||||||
if (m.CanSee(this) && m.InRange(worldLoc, GetUpdateRange(m)))
|
if (!m.CanSee(this) || !m.InRange(worldLoc, GetUpdateRange(m))) continue;
|
||||||
|
|
||||||
|
if (update)
|
||||||
{
|
{
|
||||||
if (update)
|
if (m_Parent == null)
|
||||||
|
SendInfoTo(state, ObjectPropertyList.Enabled);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (m_Parent == null)
|
if (p != null)
|
||||||
SendInfoTo(state, ObjectPropertyList.Enabled);
|
state.Send(p);
|
||||||
else
|
else if (m_Parent is Item)
|
||||||
{
|
{
|
||||||
if (p != null)
|
if (state.ContainerGridLines)
|
||||||
state.Send(p);
|
state.Send(new ContainerContentUpdate6017(this));
|
||||||
else if (m_Parent is Item)
|
else
|
||||||
{
|
state.Send(new ContainerContentUpdate(this));
|
||||||
if (state.ContainerGridLines)
|
}
|
||||||
state.Send(new ContainerContentUpdate6017(this));
|
else if (m_Parent is Mobile)
|
||||||
else
|
{
|
||||||
state.Send(new ContainerContentUpdate(this));
|
p = new EquipUpdate(this);
|
||||||
}
|
p.Acquire();
|
||||||
else if (m_Parent is Mobile)
|
|
||||||
{
|
state.Send(p);
|
||||||
p = new EquipUpdate(this);
|
|
||||||
p.Acquire();
|
|
||||||
|
|
||||||
state.Send(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectPropertyList.Enabled)
|
|
||||||
state.Send(OPLPacket);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if ((flags & ItemDelta.EquipOnly) != 0 && m_Parent is Mobile)
|
|
||||||
{
|
|
||||||
state.Send(p ?? (p = Packet.Acquire(new EquipUpdate(this))));
|
|
||||||
|
|
||||||
if (ObjectPropertyList.Enabled)
|
if (ObjectPropertyList.Enabled)
|
||||||
state.Send(OPLPacket);
|
state.Send(OPLPacket);
|
||||||
} else if (ObjectPropertyList.Enabled && (flags & ItemDelta.Properties) != 0)
|
}
|
||||||
state.Send(OPLPacket);
|
|
||||||
}
|
}
|
||||||
|
else if ((flags & ItemDelta.EquipOnly) != 0 && m_Parent is Mobile)
|
||||||
|
{
|
||||||
|
state.Send(p ??= Packet.Acquire(new EquipUpdate(this)));
|
||||||
|
|
||||||
|
if (ObjectPropertyList.Enabled)
|
||||||
|
state.Send(OPLPacket);
|
||||||
|
} else if (ObjectPropertyList.Enabled && (flags & ItemDelta.Properties) != 0)
|
||||||
|
state.Send(OPLPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
Packet.Release(p);
|
Packet.Release(p);
|
||||||
|
|
@ -1273,7 +1280,7 @@ namespace Server
|
||||||
writer.Write((byte)m_Direction);
|
writer.Write((byte)m_Direction);
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.Bounce))
|
if (GetSaveFlag(flags, SaveFlag.Bounce))
|
||||||
BounceInfo.Serialize(info.m_Bounce, writer);
|
BounceInfo.Serialize(info?.m_Bounce, writer);
|
||||||
|
|
||||||
if (GetSaveFlag(flags, SaveFlag.LootType))
|
if (GetSaveFlag(flags, SaveFlag.LootType))
|
||||||
writer.Write((byte)m_LootType);
|
writer.Write((byte)m_LootType);
|
||||||
|
|
@ -1414,7 +1421,7 @@ namespace Server
|
||||||
|
|
||||||
private CompactInfo LookupCompactInfo() => m_CompactInfo;
|
private CompactInfo LookupCompactInfo() => m_CompactInfo;
|
||||||
|
|
||||||
private CompactInfo AcquireCompactInfo() => m_CompactInfo ?? (m_CompactInfo = new CompactInfo());
|
private CompactInfo AcquireCompactInfo() => m_CompactInfo ??= new CompactInfo();
|
||||||
|
|
||||||
private void ReleaseCompactInfo()
|
private void ReleaseCompactInfo()
|
||||||
{
|
{
|
||||||
|
|
@ -1531,17 +1538,17 @@ namespace Server
|
||||||
/// <item>
|
/// <item>
|
||||||
/// <term>True</term>
|
/// <term>True</term>
|
||||||
/// <description>
|
/// <description>
|
||||||
/// There is a confliction. The elemental resistance bonuses of this Item should not be applied to the
|
/// There is a conflict. The elemental resistance bonuses of this Item should not be applied to the
|
||||||
/// <see cref="Mobile" />
|
/// <see cref="Mobile" />
|
||||||
/// </description>
|
/// </description>
|
||||||
/// </item>
|
/// </item>
|
||||||
/// <item>
|
/// <item>
|
||||||
/// <term>False</term>
|
/// <term>False</term>
|
||||||
/// <description>There is no confliction. The bonuses should be applied.</description>
|
/// <description>There is no conflict. The bonuses should be applied.</description>
|
||||||
/// </item>
|
/// </item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public virtual bool CheckPropertyConfliction(Mobile m) => false;
|
public virtual bool CheckPropertyConflict(Mobile m) => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overridable. Sends the <see cref="PropertyList">object property list</see> to <paramref name="from" />.
|
/// Overridable. Sends the <see cref="PropertyList">object property list</see> to <paramref name="from" />.
|
||||||
|
|
@ -2008,9 +2015,21 @@ namespace Server
|
||||||
mobile.GetChildNameProperties(list, this);
|
mobile.GetChildNameProperties(list, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ObjectPropertyList NewObjectPropertyList()
|
||||||
|
{
|
||||||
|
ObjectPropertyList list = new ObjectPropertyList(this);
|
||||||
|
|
||||||
|
GetProperties(list);
|
||||||
|
AppendChildProperties(list);
|
||||||
|
|
||||||
|
list.Terminate();
|
||||||
|
list.SetStatic();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearProperties()
|
public void ClearProperties()
|
||||||
{
|
{
|
||||||
StaticPacketHandlers.FreeOPLPacket(this);
|
ReleaseOPLPacket();
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2021,9 +2040,10 @@ namespace Server
|
||||||
|
|
||||||
if (m_Map != null && m_Map != Map.Internal && !World.Loading)
|
if (m_Map != null && m_Map != Map.Internal && !World.Loading)
|
||||||
{
|
{
|
||||||
ObjectPropertyList oldList = StaticPacketHandlers.FreeOPLPacket(this);
|
ObjectPropertyList oldList = m_PropertyList;
|
||||||
|
m_PropertyList = null;
|
||||||
|
|
||||||
if (oldList?.Hash != PropertyList.Hash)
|
if (oldList != null && oldList.Hash != PropertyList.Hash)
|
||||||
{
|
{
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
Delta(ItemDelta.Properties);
|
Delta(ItemDelta.Properties);
|
||||||
|
|
@ -2398,8 +2418,8 @@ namespace Server
|
||||||
{
|
{
|
||||||
List<Item> items = reader.ReadStrongItemList();
|
List<Item> items = reader.ReadStrongItemList();
|
||||||
|
|
||||||
if (this is Container)
|
if (this is Container cont)
|
||||||
(this as Container).m_Items = items;
|
cont.m_Items = items;
|
||||||
else
|
else
|
||||||
AcquireCompactInfo().m_Items = items;
|
AcquireCompactInfo().m_Items = items;
|
||||||
}
|
}
|
||||||
|
|
@ -2500,8 +2520,8 @@ namespace Server
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this is Container)
|
if (this is Container cont)
|
||||||
(this as Container).m_Items = items;
|
cont.m_Items = items;
|
||||||
else
|
else
|
||||||
AcquireCompactInfo().m_Items = items;
|
AcquireCompactInfo().m_Items = items;
|
||||||
}
|
}
|
||||||
|
|
@ -2765,7 +2785,7 @@ namespace Server
|
||||||
ReleaseWorldPackets();
|
ReleaseWorldPackets();
|
||||||
StaticPacketHandlers.FreeRemoveItemPacket(this);
|
StaticPacketHandlers.FreeRemoveItemPacket(this);
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
StaticPacketHandlers.FreeOPLPacket(this);
|
ReleaseOPLPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PublicOverheadMessage(MessageType type, int hue, bool ascii, string text)
|
public void PublicOverheadMessage(MessageType type, int hue, bool ascii, string text)
|
||||||
|
|
|
||||||
|
|
@ -111,19 +111,9 @@ namespace Server.Items
|
||||||
&& mcl.Tiles[x][y].Length > 0;
|
&& mcl.Tiles[x][y].Length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(Mobile m)
|
public bool Contains(Mobile m) => m.Map == Map && Contains(m.X, m.Y);
|
||||||
{
|
|
||||||
if (m.Map == Map)
|
|
||||||
return Contains(m.X, m.Y);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Contains(Item item)
|
public bool Contains(Item item) => item.Map == Map && Contains(item.X, item.Y);
|
||||||
{
|
|
||||||
if (item.Map == Map)
|
|
||||||
return Contains(item.X, item.Y);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
public override void Serialize(IGenericWriter writer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items
|
||||||
|
|
@ -1322,10 +1323,7 @@ namespace Server.Items
|
||||||
for (int j = 0; j < groups.Count; ++j)
|
for (int j = 0; j < groups.Count; ++j)
|
||||||
{
|
{
|
||||||
Item[] items = groups[j].ToArray();
|
Item[] items = groups[j].ToArray();
|
||||||
int total = 0;
|
int total = items.Sum(t => t.Amount);
|
||||||
|
|
||||||
for (int k = 0; k < items.Length; ++k)
|
|
||||||
total += items[k].Amount;
|
|
||||||
|
|
||||||
if (total >= best)
|
if (total >= best)
|
||||||
best = total;
|
best = total;
|
||||||
|
|
@ -1387,29 +1385,9 @@ namespace Server.Items
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetAmount(Type type, bool recurse = true)
|
public int GetAmount(Type type, bool recurse = true) => FindItemsByType(type, recurse).Sum(t => t.Amount);
|
||||||
{
|
|
||||||
Item[] items = FindItemsByType(type, recurse);
|
|
||||||
|
|
||||||
int amount = 0;
|
public int GetAmount(Type[] types, bool recurse = true) => FindItemsByType(types, recurse).Sum(t => t.Amount);
|
||||||
|
|
||||||
for (int i = 0; i < items.Length; ++i)
|
|
||||||
amount += items[i].Amount;
|
|
||||||
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetAmount(Type[] types, bool recurse = true)
|
|
||||||
{
|
|
||||||
Item[] items = FindItemsByType(types, recurse);
|
|
||||||
|
|
||||||
int amount = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < items.Length; ++i)
|
|
||||||
amount += items[i].Amount;
|
|
||||||
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,7 @@ namespace Server
|
||||||
public HairEquipUpdate(Mobile parent)
|
public HairEquipUpdate(Mobile parent)
|
||||||
: base(0x2E, 15)
|
: base(0x2E, 15)
|
||||||
{
|
{
|
||||||
int hue = parent.HairHue;
|
int hue = parent.SolidHueOverride >= 0 ? parent.SolidHueOverride : parent.HairHue;
|
||||||
|
|
||||||
if (parent.SolidHueOverride >= 0)
|
|
||||||
hue = parent.SolidHueOverride;
|
|
||||||
|
|
||||||
m_Stream.Write(HairInfo.FakeSerial(parent));
|
m_Stream.Write(HairInfo.FakeSerial(parent));
|
||||||
m_Stream.Write((short)parent.HairItemID);
|
m_Stream.Write((short)parent.HairItemID);
|
||||||
|
|
@ -125,10 +122,7 @@ namespace Server
|
||||||
public FacialHairEquipUpdate(Mobile parent)
|
public FacialHairEquipUpdate(Mobile parent)
|
||||||
: base(0x2E, 15)
|
: base(0x2E, 15)
|
||||||
{
|
{
|
||||||
int hue = parent.FacialHairHue;
|
int hue = parent.SolidHueOverride >= 0 ? parent.SolidHueOverride : parent.FacialHairHue;
|
||||||
|
|
||||||
if (parent.SolidHueOverride >= 0)
|
|
||||||
hue = parent.SolidHueOverride;
|
|
||||||
|
|
||||||
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
||||||
m_Stream.Write((short)parent.FacialHairItemID);
|
m_Stream.Write((short)parent.FacialHairItemID);
|
||||||
|
|
@ -156,4 +150,4 @@ namespace Server
|
||||||
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright (C) 2019 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: Layer.cs - Created: 2019/03/15 - Updated: 2020/01/19 *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright (C) 2019 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: LightType.cs - Created: 2019/03/15 - Updated: 2020/01/19 *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
namespace Server
|
namespace Server
|
||||||
{
|
{
|
||||||
public enum LightType
|
public enum LightType
|
||||||
|
|
|
||||||
|
|
@ -1759,7 +1759,17 @@ namespace Server
|
||||||
|
|
||||||
public Packet RemovePacket => StaticPacketHandlers.GetRemoveEntityPacket(this);
|
public Packet RemovePacket => StaticPacketHandlers.GetRemoveEntityPacket(this);
|
||||||
public OPLInfo OPLPacket => StaticPacketHandlers.GetOPLInfoPacket(this);
|
public OPLInfo OPLPacket => StaticPacketHandlers.GetOPLInfoPacket(this);
|
||||||
public ObjectPropertyList PropertyList => StaticPacketHandlers.GetOPLPacket(this);
|
private ObjectPropertyList m_PropertyList;
|
||||||
|
public ObjectPropertyList PropertyList => m_PropertyList ??= NewObjectPropertyList();
|
||||||
|
|
||||||
|
public void ReleaseOPLPacket()
|
||||||
|
{
|
||||||
|
if (m_PropertyList == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Packet.Release(m_PropertyList);
|
||||||
|
m_PropertyList = null;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int SolidHueOverride
|
public int SolidHueOverride
|
||||||
|
|
@ -2902,7 +2912,7 @@ namespace Server
|
||||||
{
|
{
|
||||||
Item item = Items[i];
|
Item item = Items[i];
|
||||||
|
|
||||||
if (item.CheckPropertyConfliction(this))
|
if (item.CheckPropertyConflict(this))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Resistances[0] += item.PhysicalResistance;
|
Resistances[0] += item.PhysicalResistance;
|
||||||
|
|
@ -6525,12 +6535,23 @@ namespace Server
|
||||||
{
|
{
|
||||||
StaticPacketHandlers.FreeRemoveItemPacket(this);
|
StaticPacketHandlers.FreeRemoveItemPacket(this);
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
StaticPacketHandlers.FreeOPLPacket(this);
|
ReleaseOPLPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectPropertyList NewObjectPropertyList()
|
||||||
|
{
|
||||||
|
ObjectPropertyList list = new ObjectPropertyList(this);
|
||||||
|
|
||||||
|
GetProperties(list);
|
||||||
|
|
||||||
|
list.Terminate();
|
||||||
|
list.SetStatic();
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearProperties()
|
public void ClearProperties()
|
||||||
{
|
{
|
||||||
StaticPacketHandlers.FreeOPLPacket(this);
|
ReleaseOPLPacket();
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6541,9 +6562,10 @@ namespace Server
|
||||||
|
|
||||||
if (m_Map != null && m_Map != Map.Internal && !World.Loading)
|
if (m_Map != null && m_Map != Map.Internal && !World.Loading)
|
||||||
{
|
{
|
||||||
ObjectPropertyList oldList = StaticPacketHandlers.FreeOPLPacket(this);
|
ObjectPropertyList oldList = m_PropertyList;
|
||||||
|
m_PropertyList = null;
|
||||||
|
|
||||||
if (oldList?.Hash != PropertyList.Hash)
|
if (oldList != null && oldList.Hash != PropertyList.Hash)
|
||||||
{
|
{
|
||||||
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
StaticPacketHandlers.FreeOPLInfoPacket(this);
|
||||||
Delta(MobileDelta.Properties);
|
Delta(MobileDelta.Properties);
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,8 @@ namespace Server.Network
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = pvSrc.ReadUInt16();
|
int count = pvSrc.ReadUInt16();
|
||||||
if (count < 100 && pvSrc.Length == 1 + 2 + 4 + 2 + count * 6)
|
|
||||||
|
if (count < 100 && pvSrc.Length == 4 + 2 + count * 6)
|
||||||
{
|
{
|
||||||
List<SellItemResponse> sellList = new List<SellItemResponse>(count);
|
List<SellItemResponse> sellList = new List<SellItemResponse>(count);
|
||||||
|
|
||||||
|
|
@ -662,7 +663,7 @@ namespace Server.Network
|
||||||
huePicker.OnResponse(hue);
|
huePicker.OnResponse(hue);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SystemInfo(NetState state, PacketReader pvSrc)
|
public static void SystemInfo(NetState state, PacketReader pvSrc)
|
||||||
|
|
@ -1490,7 +1491,7 @@ namespace Server.Network
|
||||||
{
|
{
|
||||||
if (state.Mobile == null)
|
if (state.Mobile == null)
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
"Client: {0}: Sent ingame packet (0xBFx{1:X2}) before having been attached to a mobile", state,
|
"Client: {0}: Sent in-game packet (0xBFx{1:X2}) before having been attached to a mobile", state,
|
||||||
packetID);
|
packetID);
|
||||||
state.Dispose();
|
state.Dispose();
|
||||||
}
|
}
|
||||||
|
|
@ -1556,7 +1557,7 @@ namespace Server.Network
|
||||||
|
|
||||||
Mobile from = state.Mobile;
|
Mobile from = state.Mobile;
|
||||||
|
|
||||||
long length = pvSrc.Length - 3;
|
long length = pvSrc.Length;
|
||||||
|
|
||||||
if (length < 0 || length % 4 != 0)
|
if (length < 0 || length % 4 != 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -2122,7 +2123,7 @@ namespace Server.Network
|
||||||
name, female, hue,
|
name, female, hue,
|
||||||
str, dex, intl,
|
str, dex, intl,
|
||||||
info[cityIndex],
|
info[cityIndex],
|
||||||
new SkillNameValue[]
|
new[]
|
||||||
{
|
{
|
||||||
new SkillNameValue((SkillName)is1, vs1),
|
new SkillNameValue((SkillName)is1, vs1),
|
||||||
new SkillNameValue((SkillName)is2, vs2),
|
new SkillNameValue((SkillName)is2, vs2),
|
||||||
|
|
@ -2239,7 +2240,7 @@ namespace Server.Network
|
||||||
name, female, hue,
|
name, female, hue,
|
||||||
str, dex, intl,
|
str, dex, intl,
|
||||||
info[cityIndex],
|
info[cityIndex],
|
||||||
new SkillNameValue[]
|
new[]
|
||||||
{
|
{
|
||||||
new SkillNameValue((SkillName)is1, vs1),
|
new SkillNameValue((SkillName)is1, vs1),
|
||||||
new SkillNameValue((SkillName)is2, vs2),
|
new SkillNameValue((SkillName)is2, vs2),
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace Server.Network
|
namespace Server.Network
|
||||||
|
|
@ -26,7 +27,6 @@ namespace Server.Network
|
||||||
public static class StaticPacketHandlers
|
public static class StaticPacketHandlers
|
||||||
{
|
{
|
||||||
private static ConcurrentDictionary<IPropertyListObject,OPLInfo> OPLInfoPackets = new ConcurrentDictionary<IPropertyListObject,OPLInfo>();
|
private static ConcurrentDictionary<IPropertyListObject,OPLInfo> OPLInfoPackets = new ConcurrentDictionary<IPropertyListObject,OPLInfo>();
|
||||||
private static ConcurrentDictionary<IPropertyListObject,ObjectPropertyList> ObjectPropertyListPackets = new ConcurrentDictionary<IPropertyListObject,ObjectPropertyList>();
|
|
||||||
private static ConcurrentDictionary<IEntity,RemoveEntity> RemoveEntityPackets = new ConcurrentDictionary<IEntity,RemoveEntity>();
|
private static ConcurrentDictionary<IEntity,RemoveEntity> RemoveEntityPackets = new ConcurrentDictionary<IEntity,RemoveEntity>();
|
||||||
|
|
||||||
private static ConcurrentDictionary<Item,WorldItem> WorldItemPackets = new ConcurrentDictionary<Item,WorldItem>();
|
private static ConcurrentDictionary<Item,WorldItem> WorldItemPackets = new ConcurrentDictionary<Item,WorldItem>();
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Server.Network
|
||||||
{
|
{
|
||||||
return OPLInfoPackets.GetOrAdd(obj, value =>
|
return OPLInfoPackets.GetOrAdd(obj, value =>
|
||||||
{
|
{
|
||||||
OPLInfo packet = new OPLInfo(value.PropertyList);
|
OPLInfo packet = new OPLInfo(value.PropertyList.Entity.Serial, value.PropertyList.Hash);
|
||||||
packet.SetStatic();
|
packet.SetStatic();
|
||||||
return packet;
|
return packet;
|
||||||
});
|
});
|
||||||
|
|
@ -51,30 +51,6 @@ namespace Server.Network
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ObjectPropertyList GetOPLPacket(IPropertyListObject obj)
|
|
||||||
{
|
|
||||||
return ObjectPropertyListPackets.GetOrAdd(obj, value =>
|
|
||||||
{
|
|
||||||
ObjectPropertyList list = new ObjectPropertyList(value);
|
|
||||||
|
|
||||||
value.GetProperties(list);
|
|
||||||
if (value is Item item)
|
|
||||||
item.AppendChildProperties(list);
|
|
||||||
|
|
||||||
list.Terminate();
|
|
||||||
list.SetStatic();
|
|
||||||
return list;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ObjectPropertyList FreeOPLPacket(IPropertyListObject obj)
|
|
||||||
{
|
|
||||||
if (ObjectPropertyListPackets.TryRemove(obj, out ObjectPropertyList list))
|
|
||||||
Packet.Release(list);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RemoveEntity GetRemoveEntityPacket(IEntity entity)
|
public static RemoveEntity GetRemoveEntityPacket(IEntity entity)
|
||||||
{
|
{
|
||||||
return RemoveEntityPackets.GetOrAdd(entity, value =>
|
return RemoveEntityPackets.GetOrAdd(entity, value =>
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,8 @@ namespace Server
|
||||||
0x035
|
0x035
|
||||||
};
|
};
|
||||||
|
|
||||||
public static int GetHue(int noto)
|
public static int GetHue(int noto) => noto < 0 || noto >= Hues.Length ? 0 : Hues[noto];
|
||||||
{
|
|
||||||
if (noto < 0 || noto >= Hues.Length)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return Hues[noto];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Compute(Mobile source, Mobile target) => Handler?.Invoke(source, target) ?? CanBeAttacked;
|
public static int Compute(Mobile source, Mobile target) => Handler?.Invoke(source, target) ?? CanBeAttacked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ namespace Server
|
||||||
{
|
{
|
||||||
public interface IPropertyListObject : IEntity
|
public interface IPropertyListObject : IEntity
|
||||||
{
|
{
|
||||||
ObjectPropertyList PropertyList{ get; }
|
ObjectPropertyList PropertyList { get; }
|
||||||
OPLInfo OPLPacket{ get; }
|
OPLInfo OPLPacket { get; }
|
||||||
|
|
||||||
void GetProperties(ObjectPropertyList list);
|
void GetProperties(ObjectPropertyList list);
|
||||||
}
|
}
|
||||||
|
|
@ -189,10 +189,10 @@ namespace Server
|
||||||
m_Stream.Write( (int) list.Hash );
|
m_Stream.Write( (int) list.Hash );
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public OPLInfo(ObjectPropertyList list) : base(0xDC, 9)
|
public OPLInfo(Serial serial, int hash) : base(0xDC, 9)
|
||||||
{
|
{
|
||||||
m_Stream.Write(list.Entity.Serial);
|
m_Stream.Write(serial);
|
||||||
m_Stream.Write(list.Hash);
|
m_Stream.Write(hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
0
Publish-OSX.sh
Normal file → Executable file
0
Publish-OSX.sh
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue