Updates Packets & Randomizer (#43)
* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand. * WIP - Rewriting packets. * Cleanup and updates README * Converts more packets * Fixes header * Converts Effects packets. * Forgot the send command * Adds the start of containers packets. * Adds message packets with caching * Extends the send methods * Starts to add Acquire methods * Converted the packets * Cleanup * Cleanup * Adds more packets * Adds more packets * Fixes clearing arrays from pool. Adds Mobile Incoming * Converts more packets. * Moves more packets * Moves more packets * Test compression * Merges * Migrating to an idiomatic syntax that also supports compression, and proxying. * Optimize the stack alloc. Changes attributes * Converted container packets * Visual Studio doesn't auto save files. I am still getting used to subpar IDEs. * Adds static packet caching. Will profile later. Converts more packets * Fixes packets and changes how compression is configured * WIP - Adds basics for Gumps. Not finished though. * Fix file * Fixes formatting * Changed SpanWriter to be more idiomatic. * Fixes Span vs RawSpan and missing stackallocs * Converts over some more gumps * WIP - Deletes 32bit support. * Drops RDRand32 support. * Fixes gump compilation * Converting gump components * Removes old huffman compression function * Revert signature for backwards compatibility * WIP - Converting more gump components * Creates ArraySet for the strings. Updates AppendTo to reference that. * Converts the maining gump components * Cleans up gump components * Cleans up directives * Cleans up ArraySet and moves it. Adds null-coalescing-assignment * Cleanup, Target Packets, and C# 8 changes. * Removed OPL Packet * World packets * Fixing packet uses * Cleans up code. Fixes packet uses in various places. * More cleanup for packets * Code cleanup * Converts more packet uses and cleans up more code * More code cleanup * Finishes fixing the packets in Item * Updates secure trade packets * Updates core and gets it to compile. * Moved packets to scripts. Fixed account handler use of packets * Code cleanup * Updates chat packets * Code cleanuo * Adds party packets, but need to implement them. * Party packets WIP * Finishes party packets * Rearrange movement namespaces and classes * Finishes plant packets * Code Formatting * Fixes moving effects * Code cleanup, eliminates equipinfo * Adds more packets. Fixes bugs with various packets. * Finishes mahjon packets * Fixes mahjong packet * Code cleanup * Finishes mahjong packets * Adds Map packets * Add multifacet maps and charts * Cleans up some packets with UTF8 * Optimizes packets * Cleans up more packets. Moves the MessageHelper * Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets. * Updates protocol extensions packet receiver * Fixes a few bugs. Fixes a few more packets. * Code cleanup and fixing more packets * Fixes packet effects * Cleaned up more code * Buff Icon cleanup * Removed unused constructors * Code Cleanup. Adds BoatHS Packets * Moves house files. Updates house foundation packets. * Deployment cleanup * Fixes: * Code cleanup * More code cleanup * More code cleanup * Cleaned up BaseHouse * Enforces styling * Converts foreach to linq where possible. * Dont need that * Goals/Readme updates * Removes 32bit support at the highest level. Turns on HRT by default. * Code cleanup. Fixes extended features packet. * Fixes various bugs * Code cleanup * Code cleanup * Code cleanup. Fixes gump X/Y assignment. * Code cleanup using |= operator * More code cleanup * Cleanup * Fixes spacing issues. Thanks Visual Studio. You suck. * Compiler error * Fixes NPE from RunUO 2.7 * Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README * Fixes more packets. Stupid trailing nulls. * Fixes various bugs. * Fixes for gumps * Fixes more gump stuff. Going to split it out later since it is getting insane * Recoded the gump writing * WIP * *Added output path of scripts project to dev branch *Activated debugging in code
This commit is contained in:
parent
7aa8fd3df1
commit
179cb50557
588 changed files with 10843 additions and 16177 deletions
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,14 +26,8 @@ namespace Server.Items
|
|||
m_Timer.Start();
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x2DD9:
|
||||
case 0x101C:
|
||||
case 0x10A4:
|
||||
++c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x2DD9 || c.ItemID == 0x101C || c.ItemID == 0x10A4)
|
||||
++c.ItemID;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -69,15 +63,8 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1016:
|
||||
case 0x101A:
|
||||
case 0x101D:
|
||||
case 0x10A5:
|
||||
--c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1016 || c.ItemID == 0x101A || c.ItemID == 0x101D || c.ItemID == 0x10A5)
|
||||
--c.ItemID;
|
||||
|
||||
callback?.Invoke(this, from, hue);
|
||||
}
|
||||
|
|
@ -134,4 +121,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,8 @@ namespace Server.Items
|
|||
m_Timer.Start();
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1015:
|
||||
case 0x1019:
|
||||
case 0x101C:
|
||||
case 0x10A4:
|
||||
++c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1015 || c.ItemID == 0x1019 || c.ItemID == 0x101C || c.ItemID == 0x10A4)
|
||||
++c.ItemID;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -71,15 +64,8 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1016:
|
||||
case 0x101A:
|
||||
case 0x101D:
|
||||
case 0x10A5:
|
||||
--c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1016 || c.ItemID == 0x101A || c.ItemID == 0x101D || c.ItemID == 0x10A5)
|
||||
--c.ItemID;
|
||||
|
||||
callback?.Invoke(this, from, hue);
|
||||
}
|
||||
|
|
@ -136,4 +122,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,11 +130,10 @@ namespace Server.Items
|
|||
{
|
||||
List<AddonComponent> components = Components;
|
||||
|
||||
int[][] stageTable = m_StageTable;
|
||||
|
||||
for (int i = 0; i < components.Count; ++i)
|
||||
{
|
||||
if (!(components[i] is AddonComponent component))
|
||||
AddonComponent component = components[i];
|
||||
if (component == null)
|
||||
continue;
|
||||
|
||||
int[] itemTable = FindItemTable(component.ItemID);
|
||||
|
|
@ -210,4 +209,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,11 +118,10 @@ namespace Server.Items
|
|||
{
|
||||
List<AddonComponent> components = Components;
|
||||
|
||||
int[][] stageTable = m_StageTable;
|
||||
|
||||
for (int i = 0; i < components.Count; ++i)
|
||||
{
|
||||
if (!(components[i] is AddonComponent component))
|
||||
AddonComponent component = components[i];
|
||||
if (component == null)
|
||||
continue;
|
||||
|
||||
int[] itemTable = FindItemTable(component.ItemID);
|
||||
|
|
@ -198,4 +197,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,15 +39,7 @@ namespace Server.Items
|
|||
|
||||
public override bool ShareHue => false;
|
||||
|
||||
private AddonComponent GetComponent(int itemID, int hue)
|
||||
{
|
||||
AddonComponent ac = new AddonComponent(itemID);
|
||||
|
||||
ac.Hue = hue;
|
||||
ac.Name = "jack-o-lantern";
|
||||
|
||||
return ac;
|
||||
}
|
||||
private AddonComponent GetComponent(int itemID, int hue) => new AddonComponent(itemID) {Hue = hue, Name = "jack-o-lantern"};
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
|
|
@ -66,17 +58,23 @@ namespace Server.Items
|
|||
Timer.DelayCall(TimeSpan.Zero, delegate
|
||||
{
|
||||
for (int i = 0; i < Components.Count; ++i)
|
||||
if (Components[i] is AddonComponent ac && ac.Hue == 2118)
|
||||
{
|
||||
AddonComponent ac = Components[i];
|
||||
if (ac?.Hue == 2118)
|
||||
ac.Hue = 1161;
|
||||
}
|
||||
});
|
||||
|
||||
if (version <= 1)
|
||||
Timer.DelayCall(TimeSpan.Zero, delegate
|
||||
{
|
||||
for (int i = 0; i < Components.Count; ++i)
|
||||
if (Components[i] is AddonComponent ac)
|
||||
{
|
||||
AddonComponent ac = Components[i];
|
||||
if (ac != null)
|
||||
ac.Name = "jack-o-lantern";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,15 +34,8 @@ namespace Server.Items
|
|||
m_Timer.Start();
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1015:
|
||||
case 0x1019:
|
||||
case 0x101C:
|
||||
case 0x10A4:
|
||||
++c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1015 || c.ItemID == 0x1019 || c.ItemID == 0x101C || c.ItemID == 0x10A4)
|
||||
++c.ItemID;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -79,15 +72,8 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1016:
|
||||
case 0x101A:
|
||||
case 0x101D:
|
||||
case 0x10A5:
|
||||
--c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1016 || c.ItemID == 0x101A || c.ItemID == 0x101D || c.ItemID == 0x10A5)
|
||||
--c.ItemID;
|
||||
|
||||
callback?.Invoke(this, from, hue);
|
||||
}
|
||||
|
|
@ -144,4 +130,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,8 @@ namespace Server.Items
|
|||
m_Timer.Start();
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1015:
|
||||
case 0x1019:
|
||||
case 0x101C:
|
||||
case 0x10A4:
|
||||
++c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1015 || c.ItemID == 0x1019 || c.ItemID == 0x101C || c.ItemID == 0x10A4)
|
||||
++c.ItemID;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -71,15 +64,8 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
|
||||
foreach (AddonComponent c in Components)
|
||||
switch (c.ItemID)
|
||||
{
|
||||
case 0x1016:
|
||||
case 0x101A:
|
||||
case 0x101D:
|
||||
case 0x10A5:
|
||||
--c.ItemID;
|
||||
break;
|
||||
}
|
||||
if (c.ItemID == 0x1016 || c.ItemID == 0x101A || c.ItemID == 0x101D || c.ItemID == 0x10A5)
|
||||
--c.ItemID;
|
||||
|
||||
callback?.Invoke(this, from, hue);
|
||||
}
|
||||
|
|
@ -136,4 +122,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -597,8 +597,7 @@ namespace Server.Items
|
|||
UpdateWaterState();
|
||||
|
||||
// reward
|
||||
if (LiveCreatures > 0)
|
||||
m_RewardAvailable = true;
|
||||
m_RewardAvailable |= LiveCreatures > 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -606,12 +605,12 @@ namespace Server.Items
|
|||
if (OptimalState && LiveCreatures < MaxLiveCreatures)
|
||||
if (Utility.RandomDouble() < 0.005 * LiveCreatures)
|
||||
{
|
||||
BaseFish fish = null;
|
||||
int message = 0;
|
||||
BaseFish fish;
|
||||
int message;
|
||||
|
||||
switch (Utility.Random(6))
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
{
|
||||
message = 1074371; // Brine shrimp have hatched overnight in the tank.
|
||||
fish = new BrineShrimp();
|
||||
|
|
|
|||
|
|
@ -436,9 +436,8 @@ namespace Server.Items
|
|||
BaseEnergyResistance + GetProtOffset() + GetResourceAttrs().ArmorEnergyResist + m_EnergyBonus;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ArmorBodyType BodyPosition
|
||||
{
|
||||
get
|
||||
public ArmorBodyType BodyPosition =>
|
||||
Layer switch
|
||||
{
|
||||
return Layer switch
|
||||
{
|
||||
|
|
@ -1144,8 +1143,7 @@ namespace Server.Items
|
|||
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
|
||||
SkillBonuses = new AosSkillBonuses(this, reader);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
|
||||
PlayerConstructed = true;
|
||||
PlayerConstructed |= GetSaveFlag(flags, SaveFlag.PlayerConstructed);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1271,8 +1269,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (SkillBonuses == null)
|
||||
SkillBonuses = new AosSkillBonuses(this);
|
||||
SkillBonuses ??= new AosSkillBonuses(this);
|
||||
|
||||
Mobile m = Parent as Mobile;
|
||||
|
||||
|
|
@ -1299,17 +1296,11 @@ namespace Server.Items
|
|||
|
||||
m?.CheckStatTimers();
|
||||
|
||||
if (version < 7)
|
||||
PlayerConstructed = true; // we don't know, so, assume it's crafted
|
||||
PlayerConstructed |= version < 7; // we don't know, so, assume it's crafted
|
||||
}
|
||||
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
|
||||
{
|
||||
if (!Ethic.CheckTrade(from, to, newOwner, this))
|
||||
return false;
|
||||
|
||||
return base.AllowSecureTrade(from, to, newOwner, accepted);
|
||||
}
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted) =>
|
||||
Ethic.CheckTrade(@from, to, newOwner, this) && base.AllowSecureTrade(@from, to, newOwner, accepted);
|
||||
|
||||
public override bool CanEquip(Mobile from)
|
||||
{
|
||||
|
|
@ -1374,19 +1365,10 @@ namespace Server.Items
|
|||
return base.CanEquip(from);
|
||||
}
|
||||
|
||||
public override bool CheckPropertyConfliction(Mobile m)
|
||||
{
|
||||
if (base.CheckPropertyConfliction(m))
|
||||
return true;
|
||||
|
||||
if (Layer == Layer.Pants)
|
||||
return m.FindItemOnLayer(Layer.InnerLegs) != null;
|
||||
|
||||
if (Layer == Layer.Shirt)
|
||||
return m.FindItemOnLayer(Layer.InnerTorso) != null;
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool CheckPropertyConfliction(Mobile m) =>
|
||||
base.CheckPropertyConfliction(m) || (Layer == Layer.Pants
|
||||
? m.FindItemOnLayer(Layer.InnerLegs) != null
|
||||
: Layer == Layer.Shirt && m.FindItemOnLayer(Layer.InnerTorso) != null);
|
||||
|
||||
public override bool OnEquip(Mobile from)
|
||||
{
|
||||
|
|
@ -1477,25 +1459,9 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override bool AllowEquippedCast(Mobile from)
|
||||
{
|
||||
if (base.AllowEquippedCast(from))
|
||||
return true;
|
||||
public override bool AllowEquippedCast(Mobile from) => base.AllowEquippedCast(@from) || Attributes.SpellChanneling != 0;
|
||||
|
||||
return Attributes.SpellChanneling != 0;
|
||||
}
|
||||
|
||||
public virtual int GetLuckBonus()
|
||||
{
|
||||
CraftResourceInfo resInfo = CraftResources.GetInfo(m_Resource);
|
||||
|
||||
CraftAttributeInfo attrInfo = resInfo?.AttributeInfo;
|
||||
|
||||
if (attrInfo == null)
|
||||
return 0;
|
||||
|
||||
return attrInfo.ArmorLuck;
|
||||
}
|
||||
public virtual int GetLuckBonus() => CraftResources.GetInfo(m_Resource)?.AttributeInfo?.ArmorLuck ?? 0;
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
|
|
@ -1665,9 +1631,7 @@ namespace Server.Items
|
|||
if (attrs.Count == 0 && Crafter == null && Name != null)
|
||||
return;
|
||||
|
||||
EquipmentInfo eqInfo = new EquipmentInfo(number, m_Crafter, false, attrs.ToArray());
|
||||
|
||||
from.Send(new DisplayEquipmentInfo(this, eqInfo));
|
||||
EquipmentPackets.SendDisplayEquipmentInfo(from.NetState, this, number, m_Crafter, false, attrs);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ElvenGlasses : BaseArmor
|
||||
|
|
@ -120,16 +122,14 @@ namespace Server.Items
|
|||
|
||||
SaveFlag flags = (SaveFlag)reader.ReadInt();
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.WeaponAttributes))
|
||||
WeaponAttributes = new AosWeaponAttributes(this, reader);
|
||||
else
|
||||
WeaponAttributes = new AosWeaponAttributes(this);
|
||||
WeaponAttributes = GetSaveFlag(flags, SaveFlag.WeaponAttributes) ? new AosWeaponAttributes(this, reader) : new AosWeaponAttributes(this);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum SaveFlag
|
||||
{
|
||||
None = 0x00000000,
|
||||
WeaponAttributes = 0x00000001
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ namespace Server.Items
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HeadType HeadType{ get; set; }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
public override string DefaultName =>
|
||||
PlayerName == null ? base.DefaultName : HeadType switch
|
||||
{
|
||||
if (PlayerName == null)
|
||||
return base.DefaultName;
|
||||
|
|
|
|||
|
|
@ -57,19 +57,17 @@ namespace Server.Items
|
|||
|
||||
if (content == null)
|
||||
{
|
||||
Pages = new BookPageInfo[pageCount];
|
||||
Pages = new BookPageInfo[Math.Min(pageCount, 255)];
|
||||
|
||||
for (int i = 0; i < Pages.Length; ++i)
|
||||
Pages[i] = new BookPageInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
Pages = content.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
// Intended for defined books only
|
||||
public BaseBook(int itemID, bool writable) : this(itemID, 0)
|
||||
public BaseBook(int itemID, bool writable) : this(itemID, 0, writable)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -230,12 +228,7 @@ namespace Server.Items
|
|||
Pages[i] = new BookPageInfo(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (content != null)
|
||||
Pages = content.Copy();
|
||||
else
|
||||
Pages = new BookPageInfo[0];
|
||||
}
|
||||
Pages = content?.Copy() ?? new BookPageInfo[0];
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -254,14 +247,7 @@ namespace Server.Items
|
|||
Pages[i] = new BookPageInfo(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
BookContent content = DefaultContent;
|
||||
|
||||
if (content != null)
|
||||
Pages = content.Copy();
|
||||
else
|
||||
Pages = new BookPageInfo[0];
|
||||
}
|
||||
Pages = DefaultContent?.Copy() ?? new BookPageInfo[0];
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -307,8 +293,8 @@ namespace Server.Items
|
|||
Author = from.Name;
|
||||
}
|
||||
|
||||
from.Send(new BookHeader(from, this));
|
||||
from.Send(new BookPageDetails(this));
|
||||
BookPackets.SendBookHeader(from.NetState, from, this);
|
||||
BookPackets.SendBookPageDetails(from.NetState, this);
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
|
|
@ -350,14 +336,14 @@ namespace Server.Items
|
|||
if (titleLength > 60)
|
||||
return;
|
||||
|
||||
string title = pvSrc.ReadUTF8StringSafe(titleLength);
|
||||
string title = pvSrc.ReadStringSafe(titleLength);
|
||||
|
||||
int authorLength = pvSrc.ReadUInt16();
|
||||
|
||||
if (authorLength > 30)
|
||||
return;
|
||||
|
||||
string author = pvSrc.ReadUTF8StringSafe(authorLength);
|
||||
string author = pvSrc.ReadStringSafe(authorLength);
|
||||
|
||||
book.Title = Utility.FixHtml(title);
|
||||
book.Author = Utility.FixHtml(author);
|
||||
|
|
@ -380,31 +366,23 @@ namespace Server.Items
|
|||
{
|
||||
int index = pvSrc.ReadUInt16();
|
||||
|
||||
if (index >= 1 && index <= book.PagesCount)
|
||||
{
|
||||
--index;
|
||||
|
||||
int lineCount = pvSrc.ReadUInt16();
|
||||
|
||||
if (lineCount <= 8)
|
||||
{
|
||||
string[] lines = new string[lineCount];
|
||||
|
||||
for (int j = 0; j < lineCount; ++j)
|
||||
if ((lines[j] = pvSrc.ReadUTF8StringSafe()).Length >= 80)
|
||||
return;
|
||||
|
||||
book.Pages[index].Lines = lines;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index < 1 || index > book.PagesCount)
|
||||
return;
|
||||
}
|
||||
|
||||
--index;
|
||||
|
||||
int lineCount = pvSrc.ReadUInt16();
|
||||
|
||||
if (lineCount > 8)
|
||||
return;
|
||||
|
||||
string[] lines = new string[lineCount];
|
||||
|
||||
for (int j = 0; j < lineCount; ++j)
|
||||
if ((lines[j] = pvSrc.ReadUTF8StringSafe()).Length >= 80)
|
||||
return;
|
||||
|
||||
book.Pages[index].Lines = lines;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -418,58 +396,4 @@ namespace Server.Items
|
|||
Content = 0x08
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BookPageDetails : Packet
|
||||
{
|
||||
public BookPageDetails(BaseBook book) : base(0x66)
|
||||
{
|
||||
EnsureCapacity(256);
|
||||
|
||||
m_Stream.Write(book.Serial);
|
||||
m_Stream.Write((ushort)book.PagesCount);
|
||||
|
||||
for (int i = 0; i < book.PagesCount; ++i)
|
||||
{
|
||||
BookPageInfo page = book.Pages[i];
|
||||
|
||||
m_Stream.Write((ushort)(i + 1));
|
||||
m_Stream.Write((ushort)page.Lines.Length);
|
||||
|
||||
for (int j = 0; j < page.Lines.Length; ++j)
|
||||
{
|
||||
byte[] buffer = Utility.UTF8.GetBytes(page.Lines[j]);
|
||||
|
||||
m_Stream.Write(buffer, 0, buffer.Length);
|
||||
m_Stream.Write((byte)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class BookHeader : Packet
|
||||
{
|
||||
public BookHeader(Mobile from, BaseBook book) : base(0xD4)
|
||||
{
|
||||
string title = book.Title ?? "";
|
||||
string author = book.Author ?? "";
|
||||
|
||||
byte[] titleBuffer = Utility.UTF8.GetBytes(title);
|
||||
byte[] authorBuffer = Utility.UTF8.GetBytes(author);
|
||||
|
||||
EnsureCapacity(15 + titleBuffer.Length + authorBuffer.Length);
|
||||
|
||||
m_Stream.Write(book.Serial);
|
||||
m_Stream.Write(true);
|
||||
m_Stream.Write(book.Writable && from.InRange(book.GetWorldLocation(), 1));
|
||||
m_Stream.Write((ushort)book.PagesCount);
|
||||
|
||||
m_Stream.Write((ushort)(titleBuffer.Length + 1));
|
||||
m_Stream.Write(titleBuffer, 0, titleBuffer.Length);
|
||||
m_Stream.Write((byte)0); // terminate
|
||||
|
||||
m_Stream.Write((ushort)(authorBuffer.Length + 1));
|
||||
m_Stream.Write(authorBuffer, 0, authorBuffer.Length);
|
||||
m_Stream.Write((byte)0); // terminate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[Constructible]
|
||||
public BrownBook(string title, string author, int pageCount, bool writable) : base(0xFEF, title, author, pageCount,
|
||||
writable)
|
||||
public BrownBook(string title, string author, int pageCount, bool writable) :
|
||||
base(0xFEF, title, author, pageCount, writable)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -41,4 +41,4 @@ namespace Server.Items
|
|||
writer.Write(0); // version
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
80
Projects/Scripts/Items/Books/Packets.cs
Normal file
80
Projects/Scripts/Items/Books/Packets.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using Server.Buffers;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public static class BookPackets
|
||||
{
|
||||
public static void SendBookPageDetails(NetState ns, BaseBook book)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
// 80 chars per line (240 bytes)
|
||||
// 8 lines per page
|
||||
// Max: 77049 bytes
|
||||
int length = 9;
|
||||
|
||||
for (int i = 0; i < book.PagesCount; i++)
|
||||
length += 1926 * book.Pages[i].Lines.Length;
|
||||
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x66); // Packet ID
|
||||
writer.Position += 2; // Dynamic Length
|
||||
|
||||
writer.Write(book.Serial);
|
||||
writer.Write((ushort)book.PagesCount);
|
||||
|
||||
for (int i = 0; i < book.PagesCount; i++)
|
||||
{
|
||||
BookPageInfo page = book.Pages[i];
|
||||
length = Math.Min(page.Lines.Length, 8);
|
||||
|
||||
writer.Write((ushort)(i + 1));
|
||||
writer.Write((ushort)length);
|
||||
|
||||
for (int j = 0; j < length; j++)
|
||||
{
|
||||
string line = page.Lines[j];
|
||||
writer.WriteUTF8Null(line);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Position = 1;
|
||||
writer.Write((ushort)writer.WrittenCount);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendBookHeader(NetState ns, Mobile from, BaseBook book)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
string title = book.Title ?? "";
|
||||
string author = book.Author ?? "";
|
||||
|
||||
int length = 17 + title.Length + author.Length;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0xD4); // Packet ID
|
||||
writer.Position += 2; // Dynamic Length
|
||||
|
||||
writer.Write(book.Serial);
|
||||
writer.Write((byte)0x1); // true
|
||||
writer.Write(book.Writable && from.InRange(book.GetWorldLocation(), 1));
|
||||
writer.Write((ushort)book.PagesCount);
|
||||
|
||||
writer.Write((ushort)title.Length + 1);
|
||||
writer.WriteAsciiNull(title);
|
||||
|
||||
writer.Write((ushort)author.Length + 1);
|
||||
writer.WriteAsciiNull(author);
|
||||
|
||||
writer.Position = 1;
|
||||
writer.Write((ushort)writer.WrittenCount);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,8 +13,8 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[Constructible]
|
||||
public RedBook(string title, string author, int pageCount, bool writable) : base(0xFF1, title, author, pageCount,
|
||||
writable)
|
||||
public RedBook(string title, string author, int pageCount, bool writable) :
|
||||
base(0xFF1, title, author, pageCount, writable)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -41,4 +41,4 @@ namespace Server.Items
|
|||
writer.Write(0); // version
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[Constructible]
|
||||
public TanBook(string title, string author, int pageCount, bool writable) : base(0xFF0, title, author, pageCount,
|
||||
writable)
|
||||
public TanBook(string title, string author, int pageCount, bool writable) :
|
||||
base(0xFF0, title, author, pageCount, writable)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -41,4 +41,4 @@ namespace Server.Items
|
|||
writer.Write(0); // version
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -724,9 +724,7 @@ namespace Server.Items
|
|||
int number;
|
||||
|
||||
if (Name == null)
|
||||
{
|
||||
number = LabelNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
|
|
@ -736,9 +734,7 @@ namespace Server.Items
|
|||
if (attrs.Count == 0 && Crafter == null && Name != null)
|
||||
return;
|
||||
|
||||
EquipmentInfo eqInfo = new EquipmentInfo(number, m_Crafter, false, attrs.ToArray());
|
||||
|
||||
from.Send(new DisplayEquipmentInfo(this, eqInfo));
|
||||
EquipmentPackets.SendDisplayEquipmentInfo(from.NetState, this, number, m_Crafter, false, attrs);
|
||||
}
|
||||
|
||||
public virtual void AddEquipInfoAttributes(Mobile from, List<EquipInfoAttribute> attrs)
|
||||
|
|
@ -904,25 +900,13 @@ namespace Server.Items
|
|||
else
|
||||
m_Resource = DefaultResource;
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Attributes))
|
||||
Attributes = new AosAttributes(this, reader);
|
||||
else
|
||||
Attributes = new AosAttributes(this);
|
||||
Attributes = GetSaveFlag(flags, SaveFlag.Attributes) ? new AosAttributes(this, reader) : new AosAttributes(this);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.ClothingAttributes))
|
||||
ClothingAttributes = new AosArmorAttributes(this, reader);
|
||||
else
|
||||
ClothingAttributes = new AosArmorAttributes(this);
|
||||
ClothingAttributes = GetSaveFlag(flags, SaveFlag.ClothingAttributes) ? new AosArmorAttributes(this, reader) : new AosArmorAttributes(this);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
|
||||
SkillBonuses = new AosSkillBonuses(this, reader);
|
||||
else
|
||||
SkillBonuses = new AosSkillBonuses(this);
|
||||
SkillBonuses = GetSaveFlag(flags, SaveFlag.SkillBonuses) ? new AosSkillBonuses(this, reader) : new AosSkillBonuses(this);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Resistances))
|
||||
Resistances = new AosElementAttributes(this, reader);
|
||||
else
|
||||
Resistances = new AosElementAttributes(this);
|
||||
Resistances = GetSaveFlag(flags, SaveFlag.Resistances) ? new AosElementAttributes(this, reader) : new AosElementAttributes(this);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
|
||||
m_MaxHitPoints = reader.ReadEncodedInt();
|
||||
|
|
@ -943,8 +927,7 @@ namespace Server.Items
|
|||
else
|
||||
m_StrReq = -1;
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
|
||||
PlayerConstructed = true;
|
||||
PlayerConstructed |= GetSaveFlag(flags, SaveFlag.PlayerConstructed);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -982,8 +965,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (version < 2)
|
||||
PlayerConstructed = true; // we don't know, so, assume it's crafted
|
||||
PlayerConstructed |= version < 2; // we don't know, so, assume it's crafted
|
||||
|
||||
if (version < 3)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.ContextMenus;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
|
@ -16,40 +17,17 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
public override int DefaultMaxWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsSecure)
|
||||
return 0;
|
||||
public override int DefaultMaxWeight => IsSecure ? 0 : base.DefaultMaxWeight;
|
||||
|
||||
return base.DefaultMaxWeight;
|
||||
}
|
||||
}
|
||||
public override bool IsAccessibleTo(Mobile m) =>
|
||||
BaseHouse.CheckAccessible(m, this) && base.IsAccessibleTo(m);
|
||||
|
||||
public override bool IsAccessibleTo(Mobile m)
|
||||
{
|
||||
if (!BaseHouse.CheckAccessible(m, this))
|
||||
return false;
|
||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight) =>
|
||||
(!IsSecure || BaseHouse.CheckHold(m, this, item, message, checkItems, plusItems, plusWeight)) &&
|
||||
base.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
||||
|
||||
return base.IsAccessibleTo(m);
|
||||
}
|
||||
|
||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
||||
{
|
||||
if (IsSecure && !BaseHouse.CheckHold(m, this, item, message, checkItems, plusItems, plusWeight))
|
||||
return false;
|
||||
|
||||
return base.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
||||
}
|
||||
|
||||
public override bool CheckItemUse(Mobile from, Item item)
|
||||
{
|
||||
if (IsDecoContainer && item is BaseBook)
|
||||
return true;
|
||||
|
||||
return base.CheckItemUse(from, item);
|
||||
}
|
||||
public override bool CheckItemUse(Mobile from, Item item) =>
|
||||
IsDecoContainer && item is BaseBook || base.CheckItemUse(from, item);
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
|
|
@ -79,13 +57,8 @@ namespace Server.Items
|
|||
|
||||
List<Item> list = Items;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if (!(item is Container) && item.StackWith(from, dropped, false))
|
||||
return true;
|
||||
}
|
||||
if (list.Any(item => !(item is Container) && item.StackWith(from, dropped, false)))
|
||||
return true;
|
||||
|
||||
DropItem(dropped);
|
||||
|
||||
|
|
@ -936,4 +909,4 @@ namespace Server.Items
|
|||
Weight = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -95,14 +96,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public int GetItemsCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
foreach (Item item in Items) count += item.Amount;
|
||||
|
||||
return count;
|
||||
}
|
||||
public int GetItemsCount() => Items.Sum(item => item.Amount);
|
||||
|
||||
public void CheckRespawn()
|
||||
{
|
||||
|
|
@ -1507,7 +1501,9 @@ namespace Server.Items
|
|||
Mobile nearest = null;
|
||||
FillableContent content = null;
|
||||
|
||||
foreach (Mobile mob in map.GetMobilesInRange(loc, 20))
|
||||
IPooledEnumerable eable = map.GetMobilesInRange(loc, 20);
|
||||
|
||||
foreach (Mobile mob in eable)
|
||||
{
|
||||
if (nearest != null && mob.GetDistanceToSqrt(loc) > nearest.GetDistanceToSqrt(loc) &&
|
||||
!(nearest is Cobbler && mob is Provisioner))
|
||||
|
|
@ -1520,6 +1516,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ namespace Server.Items
|
|||
inaccessible = true;
|
||||
}
|
||||
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", ""));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3, number);
|
||||
}
|
||||
|
||||
return inaccessible;
|
||||
|
|
@ -323,4 +323,4 @@ namespace Server.Items
|
|||
LabelTo(from, 1041645); //recovered from a shipwreck
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,16 +126,11 @@ namespace Server.Items
|
|||
|
||||
#region Checks
|
||||
|
||||
private bool Resmeltables() //Where context menu checks for metal items and dragon barding deeds
|
||||
{
|
||||
foreach (Item i in Items)
|
||||
return i?.Deleted == false && (
|
||||
i is BaseWeapon weapon && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal ||
|
||||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Metal ||
|
||||
i is DragonBardingDeed);
|
||||
|
||||
return false;
|
||||
}
|
||||
private bool Resmeltables() => //Where context menu checks for metal items and dragon barding deeds
|
||||
Items.Select(i => i?.Deleted == false &&
|
||||
(i is BaseWeapon weapon && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal ||
|
||||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Metal ||
|
||||
i is DragonBardingDeed)).FirstOrDefault();
|
||||
|
||||
private bool Scissorables() //Where context menu checks for Leather items and cloth items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Server.Items
|
|||
if (Deleted || !to.CanSee(this))
|
||||
return;
|
||||
|
||||
to.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, hue, 3, number, "", ""));
|
||||
Packets.SendMessageLocalized(to.NetState, Serial, ItemID, MessageType.Regular, hue, 3, number);
|
||||
}
|
||||
|
||||
private void SendMessageTo(Mobile to, string text, int hue)
|
||||
|
|
@ -54,7 +54,7 @@ namespace Server.Items
|
|||
if (Deleted || !to.CanSee(this))
|
||||
return;
|
||||
|
||||
to.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, hue, 3, "ENU", "", text));
|
||||
Packets.SendUnicodeMessage(to.NetState,Serial, ItemID, MessageType.Regular, hue, 3, "ENU", "", text);
|
||||
}
|
||||
|
||||
public virtual bool ExecuteTrap(Mobile from)
|
||||
|
|
@ -91,7 +91,7 @@ namespace Server.Items
|
|||
from.LocalOverheadMessage(MessageType.Regular, 0x2A, 503000);
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
|
||||
Effects.SendLocationEffect(loc, facet, 0x36BD, 15);
|
||||
Effects.PlaySound(loc, facet, 0x307);
|
||||
|
||||
break;
|
||||
|
|
@ -129,7 +129,7 @@ namespace Server.Items
|
|||
|
||||
AOS.Damage(from, damage, 100, 0, 0, 0, 0);
|
||||
|
||||
// A dart imbeds itself in your flesh!
|
||||
// A dart embeds itself in your flesh!
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x62, 502998);
|
||||
}
|
||||
|
||||
|
|
@ -221,4 +221,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Gumps;
|
||||
|
|
@ -39,7 +40,7 @@ namespace Server.Items
|
|||
|
||||
public override int LabelNumber => 3000541;
|
||||
|
||||
public static Type[] Artifacts{ get; } =
|
||||
public static Type[] Artifacts { get; } =
|
||||
{
|
||||
typeof(CandelabraOfSouls), typeof(GoldBricks), typeof(PhillipsWoodenSteed),
|
||||
typeof(ArcticDeathDealer), typeof(BlazeOfDeath), typeof(BurglarsBandana),
|
||||
|
|
@ -51,18 +52,18 @@ namespace Server.Items
|
|||
};
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Level{ get; set; }
|
||||
public int Level { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner{ get; set; }
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime DeleteTime{ get; private set; }
|
||||
public DateTime DeleteTime { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Temporary{ get; set; }
|
||||
public bool Temporary { get; set; }
|
||||
|
||||
public List<Mobile> Guardians{ get; private set; }
|
||||
public List<Mobile> Guardians { get; private set; }
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
|
|
@ -196,18 +197,11 @@ namespace Server.Items
|
|||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
numberItems = level * 6;
|
||||
}
|
||||
|
||||
for (int i = 0; i < numberItems; ++i)
|
||||
{
|
||||
Item item;
|
||||
|
||||
if (Core.AOS)
|
||||
item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
|
||||
else
|
||||
item = Loot.RandomArmorOrShieldOrWeapon();
|
||||
Item item = Core.AOS ? Loot.RandomArmorOrShieldOrWeaponOrJewelry() : Loot.RandomArmorOrShieldOrWeapon();
|
||||
|
||||
if (item is BaseWeapon weapon)
|
||||
{
|
||||
|
|
@ -296,13 +290,12 @@ namespace Server.Items
|
|||
|
||||
if (Level == 0 && from.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
foreach (Mobile m in Guardians)
|
||||
if (m.Alive)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1046448); // You must first kill the guardians before you may open this chest.
|
||||
return true;
|
||||
}
|
||||
if (Guardians.Any(m => m.Alive))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1046448); // You must first kill the guardians before you may open this chest.
|
||||
return true;
|
||||
}
|
||||
|
||||
LockPick(from);
|
||||
return false;
|
||||
|
|
@ -395,29 +388,29 @@ namespace Server.Items
|
|||
switch (version)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
Guardians = reader.ReadStrongMobileList();
|
||||
Temporary = reader.ReadBool();
|
||||
{
|
||||
Guardians = reader.ReadStrongMobileList();
|
||||
Temporary = reader.ReadBool();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Owner = reader.ReadMobile();
|
||||
{
|
||||
Owner = reader.ReadMobile();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Level = reader.ReadInt();
|
||||
DeleteTime = reader.ReadDeltaTime();
|
||||
m_Lifted = reader.ReadStrongItemList();
|
||||
{
|
||||
Level = reader.ReadInt();
|
||||
DeleteTime = reader.ReadDeltaTime();
|
||||
m_Lifted = reader.ReadStrongItemList();
|
||||
|
||||
if (version < 2)
|
||||
Guardians = new List<Mobile>();
|
||||
if (version < 2)
|
||||
Guardians = new List<Mobile>();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Temporary)
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ namespace Server.Items
|
|||
new[] { 1074393, 1074390, 0x2fd0, 0x2fcd, 0xedde, 0xc6cb } // buns, long
|
||||
};
|
||||
|
||||
/*
|
||||
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
|
||||
*/
|
||||
// racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
|
||||
private int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
|
||||
{
|
||||
new[] { 0 },
|
||||
|
|
@ -73,10 +71,8 @@ namespace Server.Items
|
|||
new[] { 1011050, 1011050, 0x204A, 0x204A, 0xED29, 0xED29 }, // Topknot
|
||||
new[] { 1011396, 1011396, 0x2047, 0x2047, 0xed25, 0xc618 } // Curly
|
||||
};
|
||||
/*
|
||||
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
|
||||
*/
|
||||
|
||||
// gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
|
||||
private int[][] LayoutArray =
|
||||
{
|
||||
new[] { 0 }, /* padding: its more efficient than code to ++ the index/buttonid */
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ namespace Server.Items
|
|||
Point3D loc = new Point3D(p);
|
||||
|
||||
if (p is StaticTarget target)
|
||||
loc.Z -= TileData.ItemTable[target.ItemID]
|
||||
.CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
|
||||
* A side affect is that you can only place on floors (due to the CanFit call).
|
||||
* That functionality may be desired. And so, it's included in this script.
|
||||
*/
|
||||
loc.Z -= TileData.ItemTable[target.ItemID].CalcHeight;
|
||||
/* NOTE: OSI does not properly normalize Z positioning here.
|
||||
* A side affect is that you can only place on floors (due to the CanFit call).
|
||||
* That functionality may be desired. And so, it's included in this script.
|
||||
*/
|
||||
|
||||
if (ValidatePlacement(from, loc))
|
||||
EndPlace(from, type, loc);
|
||||
|
|
|
|||
15
Projects/Scripts/Items/Equipment/EquipmentInfoAttribute.cs
Normal file
15
Projects/Scripts/Items/Equipment/EquipmentInfoAttribute.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class EquipInfoAttribute
|
||||
{
|
||||
public EquipInfoAttribute(int number, int charges = -1)
|
||||
{
|
||||
Number = number;
|
||||
Charges = charges;
|
||||
}
|
||||
|
||||
public int Number { get; }
|
||||
|
||||
public int Charges { get; }
|
||||
}
|
||||
}
|
||||
56
Projects/Scripts/Items/Equipment/Packets.cs
Normal file
56
Projects/Scripts/Items/Equipment/Packets.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Buffers;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public static class EquipmentPackets
|
||||
{
|
||||
public static void SendDisplayEquipmentInfo(NetState ns, Item item, int number, Mobile crafter, bool unidentified, ICollection<EquipInfoAttribute> attrs)
|
||||
{
|
||||
int packetLength = 17 +
|
||||
(crafter != null ? 6 + crafter.RawName?.Length ?? 0 : 0) +
|
||||
(unidentified ? 4 : 0) + attrs.Count * 6;
|
||||
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[packetLength]);
|
||||
|
||||
writer.Write((byte)0xBF); // Extended Command Packet ID
|
||||
writer.Write((ushort)packetLength); // Dynamic Length
|
||||
|
||||
writer.Write((short)0x10); // Command
|
||||
writer.Write(item.Serial);
|
||||
writer.Write(number);
|
||||
|
||||
if (crafter != null)
|
||||
{
|
||||
// TODO: We should not be referencing the crafter.
|
||||
// They could have been deleted and the crafted by should still show up.
|
||||
string name = crafter.RawName;
|
||||
|
||||
writer.Write(-3);
|
||||
|
||||
if (name == null)
|
||||
writer.Write((ushort)0);
|
||||
else
|
||||
{
|
||||
int length = name.Length;
|
||||
writer.Write((ushort)length);
|
||||
writer.WriteAsciiFixed(name, length);
|
||||
}
|
||||
}
|
||||
|
||||
if (unidentified)
|
||||
writer.Write(-4);
|
||||
|
||||
foreach (EquipInfoAttribute attr in attrs)
|
||||
{
|
||||
writer.Write(attr.Number);
|
||||
writer.Write((short)attr.Charges);
|
||||
}
|
||||
|
||||
writer.Write(-1);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -43,13 +43,13 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
#if false
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsHeatSource(object targeted)
|
||||
|
|
@ -63,22 +63,13 @@ namespace Server.Items
|
|||
else
|
||||
return false;
|
||||
|
||||
if (itemID >= 0xDE3 && itemID <= 0xDE9)
|
||||
return true; // Campfire
|
||||
if (itemID >= 0x461 && itemID <= 0x48E)
|
||||
return true; // Sandstone oven/fireplace
|
||||
if (itemID >= 0x92B && itemID <= 0x96C)
|
||||
return true; // Stone oven/fireplace
|
||||
if (itemID == 0xFAC)
|
||||
return true; // Firepit
|
||||
if (itemID >= 0x184A && itemID <= 0x184C)
|
||||
return true; // Heating stand (left)
|
||||
if (itemID >= 0x184E && itemID <= 0x1850)
|
||||
return true; // Heating stand (right)
|
||||
if (itemID >= 0x398C && itemID <= 0x399F)
|
||||
return true; // Fire field
|
||||
|
||||
return false;
|
||||
return itemID == 0xFAC ||
|
||||
itemID >= 0xDE3 && itemID <= 0xDE9 ||
|
||||
itemID >= 0x461 && itemID <= 0x48E ||
|
||||
itemID >= 0x92B && itemID <= 0x96C ||
|
||||
itemID >= 0x184A && itemID <= 0x184C ||
|
||||
itemID >= 0x184E && itemID <= 0x1850 ||
|
||||
itemID >= 0x398C && itemID <= 0x399F;
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
|
|
@ -103,9 +94,7 @@ namespace Server.Items
|
|||
t.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500119); // You must wait to perform another action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,9 +132,7 @@ namespace Server.Items
|
|||
m_From.PlaySound(0x57);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(500686); // You burn the food to a crisp! It's ruined.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
#if false
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
#endif
|
||||
|
||||
private class InternalTarget : Target
|
||||
|
|
@ -135,13 +135,13 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
#if false
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !Movable )
|
||||
return;
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
#endif
|
||||
|
||||
private class InternalTarget : Target
|
||||
|
|
@ -454,9 +454,9 @@ namespace Server.Items
|
|||
++ItemID;
|
||||
|
||||
#if false
|
||||
this.Delete();
|
||||
this.Delete();
|
||||
|
||||
from.AddToBackpack( new SackFlourOpen() );
|
||||
from.AddToBackpack( new SackFlourOpen() );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,17 +72,13 @@ namespace Server.Items
|
|||
{
|
||||
if (dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto(from, dropped, point))
|
||||
{
|
||||
Packet p = new PlaySound(0x127, GetWorldLocation());
|
||||
|
||||
p.Acquire();
|
||||
Point3D loc = GetWorldLocation();
|
||||
|
||||
if (RootParent == from)
|
||||
from.Send(p);
|
||||
Packets.SendPlaySound(from.NetState, 0x127, loc);
|
||||
else
|
||||
foreach (NetState state in GetClientsInRange(2))
|
||||
state.Send(p);
|
||||
|
||||
p.Release();
|
||||
Packets.SendPlaySound(state, 0x127, loc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
return;
|
||||
|
||||
Roll(from);
|
||||
if (from.InRange(GetWorldLocation(), 2))
|
||||
Roll(from);
|
||||
}
|
||||
|
||||
public void Roll(Mobile from)
|
||||
|
|
@ -45,4 +43,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace Server.Engines.Mahjong
|
|||
m_SpectatorVision = value;
|
||||
|
||||
if (Players.IsInGamePlayer(Players.DealerPosition))
|
||||
Players.Dealer.Send(new MahjongGeneralInfo(this));
|
||||
MahjongPackets.SendMahjongGeneralInfo(Players.Dealer.NetState, this);
|
||||
|
||||
Players.SendTilesPacket(false, true);
|
||||
|
||||
|
|
@ -292,4 +292,4 @@ namespace Server.Engines.Mahjong
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Engines.Mahjong
|
|||
|
||||
public sealed class MahjongPacketHandlers
|
||||
{
|
||||
private static OnMahjongPacketReceive[] m_SubCommandDelegates = new OnMahjongPacketReceive[0x100];
|
||||
private static readonly OnMahjongPacketReceive[] m_SubCommandDelegates = new OnMahjongPacketReceive[0x100];
|
||||
|
||||
public static void RegisterSubCommand(int subCmd, OnMahjongPacketReceive onReceive)
|
||||
{
|
||||
|
|
@ -80,12 +80,7 @@ namespace Server.Engines.Mahjong
|
|||
|
||||
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
{
|
||||
if (game == null)
|
||||
return;
|
||||
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
game.Players.LeaveGame(from);
|
||||
game?.Players.LeaveGame(state.Mobile);
|
||||
}
|
||||
|
||||
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
|
||||
|
|
@ -230,4 +225,4 @@ namespace Server.Engines.Mahjong
|
|||
game.DealerIndicator.Move(new Point2D(x, y), direction, wind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Engines.Mahjong
|
||||
{
|
||||
|
|
@ -82,28 +83,13 @@ namespace Server.Engines.Mahjong
|
|||
return m_InGame[index];
|
||||
}
|
||||
|
||||
public bool IsInGamePlayer(Mobile mobile)
|
||||
{
|
||||
int index = GetPlayerIndex(mobile);
|
||||
|
||||
return IsInGamePlayer(index);
|
||||
}
|
||||
public bool IsInGamePlayer(Mobile mobile) => IsInGamePlayer(GetPlayerIndex(mobile));
|
||||
|
||||
public bool IsSpectator(Mobile mobile) => m_Spectators.Contains(mobile);
|
||||
|
||||
public int GetScore(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_Scores.Length)
|
||||
return 0;
|
||||
return m_Scores[index];
|
||||
}
|
||||
public bool IsSpectator(Mobile mobile) => m_Spectators.Contains(mobile);
|
||||
|
||||
public bool IsPublic(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_PublicHand.Length)
|
||||
return false;
|
||||
return m_PublicHand[index];
|
||||
}
|
||||
public bool IsPublic(int index) => index >= 0 && index < m_PublicHand.Length && m_PublicHand[index];
|
||||
|
||||
public void SetPublic(int index, bool value)
|
||||
{
|
||||
|
|
@ -122,10 +108,7 @@ namespace Server.Engines.Mahjong
|
|||
{
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
|
||||
if (players)
|
||||
for (int i = 0; i < m_Players.Length; i++)
|
||||
if (IsInGamePlayer(i))
|
||||
list.Add(m_Players[i]);
|
||||
if (players) list.AddRange(m_Players.Where((t, i) => IsInGamePlayer(i)));
|
||||
|
||||
if (spectators)
|
||||
list.AddRange(m_Spectators);
|
||||
|
|
@ -169,7 +152,7 @@ namespace Server.Engines.Mahjong
|
|||
{
|
||||
m_InGame[i] = false;
|
||||
|
||||
player.Send(new MahjongRelieve(Game));
|
||||
MahjongPackets.SendMahjongRelieve(player.NetState, Game);
|
||||
|
||||
SendPlayerExitMessage(player);
|
||||
UpdateDealer(true);
|
||||
|
|
@ -184,20 +167,16 @@ namespace Server.Engines.Mahjong
|
|||
Mobile mobile = m_Spectators[i];
|
||||
|
||||
if (mobile.NetState == null || mobile.Deleted)
|
||||
{
|
||||
m_Spectators.RemoveAt(i);
|
||||
}
|
||||
else if (!Game.IsAccessibleTo(mobile) || mobile.Map != Game.Map ||
|
||||
!mobile.InRange(Game.GetWorldLocation(), 5))
|
||||
{
|
||||
m_Spectators.RemoveAt(i);
|
||||
|
||||
mobile.Send(new MahjongRelieve(Game));
|
||||
MahjongPackets.SendMahjongRelieve(mobile.NetState, Game);
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (removed && !UpdateSpectators())
|
||||
|
|
@ -276,12 +255,12 @@ namespace Server.Engines.Mahjong
|
|||
UpdateDealer(false);
|
||||
|
||||
if (sendJoinGame)
|
||||
player.Send(new MahjongJoinGame(Game));
|
||||
MahjongPackets.SendMahjongJoinGame(player.NetState, Game);
|
||||
|
||||
SendPlayersPacket(true, true);
|
||||
|
||||
player.Send(new MahjongGeneralInfo(Game));
|
||||
player.Send(new MahjongTilesInfo(Game, player));
|
||||
MahjongPackets.SendMahjongGeneralInfo(player.NetState, Game);
|
||||
MahjongPackets.SendMahjongTilesInfo(player.NetState, Game, player);
|
||||
|
||||
if (DealerPosition == index)
|
||||
SendLocalizedMessage(1062773, player.Name); // ~1_name~ has entered the game as the dealer.
|
||||
|
|
@ -289,14 +268,14 @@ namespace Server.Engines.Mahjong
|
|||
SendLocalizedMessage(1062772, player.Name); // ~1_name~ has entered the game as a player.
|
||||
}
|
||||
|
||||
private void AddSpectator(Mobile mobile)
|
||||
private void AddSpectator(Mobile m)
|
||||
{
|
||||
if (!IsSpectator(mobile)) m_Spectators.Add(mobile);
|
||||
if (!IsSpectator(m)) m_Spectators.Add(m);
|
||||
|
||||
mobile.Send(new MahjongJoinGame(Game));
|
||||
mobile.Send(new MahjongPlayersInfo(Game, mobile));
|
||||
mobile.Send(new MahjongGeneralInfo(Game));
|
||||
mobile.Send(new MahjongTilesInfo(Game, mobile));
|
||||
MahjongPackets.SendMahjongJoinGame(m.NetState, Game);
|
||||
MahjongPackets.SendMahjongPlayersInfo(m.NetState, Game, m);
|
||||
MahjongPackets.SendMahjongGeneralInfo(m.NetState, Game);
|
||||
MahjongPackets.SendMahjongTilesInfo(m.NetState, Game, m);
|
||||
}
|
||||
|
||||
public void Join(Mobile mobile)
|
||||
|
|
@ -304,9 +283,7 @@ namespace Server.Engines.Mahjong
|
|||
int index = GetPlayerIndex(mobile);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
AddPlayer(mobile, index, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nextSeat = GetNextSeat();
|
||||
|
|
@ -331,9 +308,7 @@ namespace Server.Engines.Mahjong
|
|||
SendPlayersPacket(true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Spectators.Remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetScores(int value)
|
||||
|
|
@ -357,13 +332,11 @@ namespace Server.Engines.Mahjong
|
|||
m_Scores[toPosition] += amount;
|
||||
|
||||
if (Game.ShowScores)
|
||||
{
|
||||
SendPlayersPacket(true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Send(new MahjongPlayersInfo(Game, from));
|
||||
to.Send(new MahjongPlayersInfo(Game, to));
|
||||
MahjongPackets.SendMahjongPlayersInfo(from.NetState, Game, from);
|
||||
MahjongPackets.SendMahjongPlayersInfo(to.NetState, Game, to);
|
||||
}
|
||||
|
||||
SendLocalizedMessage(1062774,
|
||||
|
|
@ -377,7 +350,7 @@ namespace Server.Engines.Mahjong
|
|||
return;
|
||||
|
||||
if (m_InGame[index])
|
||||
player.Send(new MahjongRelieve(Game));
|
||||
MahjongPackets.SendMahjongRelieve(player.NetState, Game);
|
||||
|
||||
m_Players[index] = null;
|
||||
|
||||
|
|
@ -401,9 +374,9 @@ namespace Server.Engines.Mahjong
|
|||
DealerPosition = index;
|
||||
|
||||
if (IsInGamePlayer(oldDealer))
|
||||
m_Players[oldDealer].Send(new MahjongPlayersInfo(Game, m_Players[oldDealer]));
|
||||
MahjongPackets.SendMahjongPlayersInfo(m_Players[oldDealer].NetState, Game, m_Players[oldDealer]);
|
||||
|
||||
to.Send(new MahjongPlayersInfo(Game, to));
|
||||
MahjongPackets.SendMahjongPlayersInfo(to.NetState, Game, to);
|
||||
|
||||
SendDealerChangedMessage();
|
||||
}
|
||||
|
|
@ -422,36 +395,25 @@ namespace Server.Engines.Mahjong
|
|||
public void SendPlayersPacket(bool players, bool spectators)
|
||||
{
|
||||
foreach (Mobile mobile in GetInGameMobiles(players, spectators))
|
||||
mobile.Send(new MahjongPlayersInfo(Game, mobile));
|
||||
MahjongPackets.SendMahjongPlayersInfo(mobile.NetState, Game, mobile);
|
||||
}
|
||||
|
||||
public void SendGeneralPacket(bool players, bool spectators)
|
||||
{
|
||||
List<Mobile> mobiles = GetInGameMobiles(players, spectators);
|
||||
|
||||
if (mobiles.Count == 0)
|
||||
return;
|
||||
|
||||
MahjongGeneralInfo generalInfo = new MahjongGeneralInfo(Game);
|
||||
|
||||
generalInfo.Acquire();
|
||||
|
||||
foreach (Mobile mobile in mobiles)
|
||||
mobile.Send(generalInfo);
|
||||
|
||||
generalInfo.Release();
|
||||
foreach (Mobile mobile in GetInGameMobiles(players, spectators))
|
||||
MahjongPackets.SendMahjongGeneralInfo(mobile.NetState, Game);
|
||||
}
|
||||
|
||||
public void SendTilesPacket(bool players, bool spectators)
|
||||
{
|
||||
foreach (Mobile mobile in GetInGameMobiles(players, spectators))
|
||||
mobile.Send(new MahjongTilesInfo(Game, mobile));
|
||||
MahjongPackets.SendMahjongTilesInfo(mobile.NetState, Game, mobile);
|
||||
}
|
||||
|
||||
public void SendTilePacket(MahjongTile tile, bool players, bool spectators)
|
||||
{
|
||||
foreach (Mobile mobile in GetInGameMobiles(players, spectators))
|
||||
mobile.Send(new MahjongTileInfo(tile, mobile));
|
||||
MahjongPackets.SendMahjongTileInfo(mobile.NetState, tile, mobile);
|
||||
}
|
||||
|
||||
public void SendRelievePacket(bool players, bool spectators)
|
||||
|
|
@ -461,14 +423,8 @@ namespace Server.Engines.Mahjong
|
|||
if (mobiles.Count == 0)
|
||||
return;
|
||||
|
||||
MahjongRelieve relieve = new MahjongRelieve(Game);
|
||||
|
||||
relieve.Acquire();
|
||||
|
||||
foreach (Mobile mobile in mobiles)
|
||||
mobile.Send(relieve);
|
||||
|
||||
relieve.Release();
|
||||
MahjongPackets.SendMahjongRelieve(mobile.NetState, Game);
|
||||
}
|
||||
|
||||
public void SendLocalizedMessage(int number)
|
||||
|
|
|
|||
|
|
@ -1,76 +1,78 @@
|
|||
using System.IO;
|
||||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Mahjong
|
||||
{
|
||||
public sealed class MahjongJoinGame : Packet
|
||||
public static class MahjongPackets
|
||||
{
|
||||
public MahjongJoinGame(MahjongGame game) : base(0xDA)
|
||||
public static void SendMahjongJoinGame(NetState ns, MahjongGame game)
|
||||
{
|
||||
EnsureCapacity(9);
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
m_Stream.Write(game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x19);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[9]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Write((ushort)0x09); // Dynamic Length
|
||||
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x19);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MahjongPlayersInfo : Packet
|
||||
{
|
||||
public MahjongPlayersInfo(MahjongGame game, Mobile to) : base(0xDA)
|
||||
public static void SendMahjongPlayersInfo(NetState ns, MahjongGame game, Mobile to)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
MahjongPlayers players = game.Players;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[11 + 45 * players.Seats]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Position += 2; // Dynamic Length
|
||||
|
||||
EnsureCapacity(11 + 45 * players.Seats);
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x02);
|
||||
writer.Write((short)players.Seats);
|
||||
|
||||
m_Stream.Write(game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x2);
|
||||
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)players.Seats);
|
||||
|
||||
int n = 0;
|
||||
short n = 0;
|
||||
for (int i = 0; i < players.Seats; i++)
|
||||
{
|
||||
Mobile mobile = players.GetPlayer(i);
|
||||
|
||||
if (mobile != null)
|
||||
{
|
||||
m_Stream.Write(mobile.Serial);
|
||||
m_Stream.Write(players.DealerPosition == i ? (byte)0x1 : (byte)0x2);
|
||||
m_Stream.Write((byte)i);
|
||||
writer.Write(mobile.Serial);
|
||||
writer.Write(players.DealerPosition == i ? (byte)0x1 : (byte)0x2);
|
||||
writer.Write((byte)i);
|
||||
|
||||
if (game.ShowScores || mobile == to)
|
||||
m_Stream.Write(players.GetScore(i));
|
||||
writer.Write(players.GetScore(i));
|
||||
else
|
||||
m_Stream.Write(0);
|
||||
writer.Position++; // writer.Write(0);
|
||||
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0);
|
||||
writer.Position += 3;
|
||||
|
||||
m_Stream.Write(players.IsPublic(i));
|
||||
writer.Write(players.IsPublic(i));
|
||||
|
||||
m_Stream.WriteAsciiFixed(mobile.Name, 30);
|
||||
m_Stream.Write(!players.IsInGamePlayer(i));
|
||||
writer.WriteAsciiFixed(mobile.Name, 30);
|
||||
writer.Write(!players.IsInGamePlayer(i));
|
||||
|
||||
n++;
|
||||
}
|
||||
else if (game.ShowScores)
|
||||
{
|
||||
m_Stream.Write(0);
|
||||
m_Stream.Write((byte)0x2);
|
||||
m_Stream.Write((byte)i);
|
||||
writer.Position++; // writer.Write(0);
|
||||
writer.Write((byte)0x2);
|
||||
writer.Write((byte)i);
|
||||
|
||||
m_Stream.Write(players.GetScore(i));
|
||||
writer.Write(players.GetScore(i));
|
||||
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0);
|
||||
writer.Position += 3;
|
||||
|
||||
m_Stream.Write(players.IsPublic(i));
|
||||
writer.Write(players.IsPublic(i));
|
||||
|
||||
m_Stream.WriteAsciiFixed("", 30);
|
||||
m_Stream.Write(true);
|
||||
writer.Position += 30; //writer.WriteAsciiFixed("", 30);
|
||||
writer.Write((byte)0x1); // true
|
||||
|
||||
n++;
|
||||
}
|
||||
|
|
@ -78,58 +80,66 @@ namespace Server.Engines.Mahjong
|
|||
|
||||
if (n != players.Seats)
|
||||
{
|
||||
m_Stream.Seek(10, SeekOrigin.Begin);
|
||||
m_Stream.Write((byte)n);
|
||||
writer.Position = 9;
|
||||
writer.Write(n);
|
||||
}
|
||||
|
||||
writer.Position = 1;
|
||||
writer.Write((short)writer.WrittenCount);
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MahjongGeneralInfo : Packet
|
||||
{
|
||||
public MahjongGeneralInfo(MahjongGame game) : base(0xDA)
|
||||
public static void SendMahjongGeneralInfo(NetState ns, MahjongGame game)
|
||||
{
|
||||
EnsureCapacity(13);
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
m_Stream.Write(game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x5);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[25]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Write((ushort)25); // Dynamic Length
|
||||
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0);
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x05);
|
||||
|
||||
m_Stream.Write((byte)((game.ShowScores ? 0x1 : 0x0) | (game.SpectatorVision ? 0x2 : 0x0)));
|
||||
writer.Position += 3;
|
||||
|
||||
m_Stream.Write((byte)game.Dices.First);
|
||||
m_Stream.Write((byte)game.Dices.Second);
|
||||
writer.Write((byte)((game.ShowScores ? 0x1 : 0x0) | (game.SpectatorVision ? 0x2 : 0x0)));
|
||||
|
||||
m_Stream.Write((byte)game.DealerIndicator.Wind);
|
||||
m_Stream.Write((short)game.DealerIndicator.Position.Y);
|
||||
m_Stream.Write((short)game.DealerIndicator.Position.X);
|
||||
m_Stream.Write((byte)game.DealerIndicator.Direction);
|
||||
writer.Write((byte)game.Dices.First);
|
||||
writer.Write((byte)game.Dices.Second);
|
||||
|
||||
m_Stream.Write((short)game.WallBreakIndicator.Position.Y);
|
||||
m_Stream.Write((short)game.WallBreakIndicator.Position.X);
|
||||
writer.Write((byte)game.DealerIndicator.Wind);
|
||||
writer.Write((short)game.DealerIndicator.Position.Y);
|
||||
writer.Write((short)game.DealerIndicator.Position.X);
|
||||
writer.Write((byte)game.DealerIndicator.Direction);
|
||||
|
||||
writer.Write((short)game.WallBreakIndicator.Position.Y);
|
||||
writer.Write((short)game.WallBreakIndicator.Position.X);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MahjongTilesInfo : Packet
|
||||
{
|
||||
public MahjongTilesInfo(MahjongGame game, Mobile to) : base(0xDA)
|
||||
public static void SendMahjongTilesInfo(NetState ns, MahjongGame game, Mobile to)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
MahjongTile[] tiles = game.Tiles;
|
||||
MahjongPlayers players = game.Players;
|
||||
|
||||
EnsureCapacity(11 + 9 * tiles.Length);
|
||||
int length = 11 + 9 * tiles.Length;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Write((short)length); // Dynamic Length
|
||||
|
||||
m_Stream.Write(game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x4);
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x4);
|
||||
|
||||
m_Stream.Write((short)tiles.Length);
|
||||
writer.Write((short)tiles.Length);
|
||||
|
||||
foreach (MahjongTile tile in tiles)
|
||||
{
|
||||
m_Stream.Write((byte)tile.Number);
|
||||
writer.Write((byte)tile.Number);
|
||||
|
||||
if (tile.Flipped)
|
||||
{
|
||||
|
|
@ -137,39 +147,40 @@ namespace Server.Engines.Mahjong
|
|||
|
||||
if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to ||
|
||||
game.SpectatorVision && players.IsSpectator(to))
|
||||
m_Stream.Write((byte)tile.Value);
|
||||
writer.Write((byte)tile.Value);
|
||||
else
|
||||
m_Stream.Write((byte)0);
|
||||
writer.Position++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Stream.Write((byte)0);
|
||||
}
|
||||
writer.Position++;
|
||||
|
||||
m_Stream.Write((short)tile.Position.Y);
|
||||
m_Stream.Write((short)tile.Position.X);
|
||||
m_Stream.Write((byte)tile.StackLevel);
|
||||
m_Stream.Write((byte)tile.Direction);
|
||||
writer.Write((short)tile.Position.Y);
|
||||
writer.Write((short)tile.Position.X);
|
||||
writer.Write((byte)tile.StackLevel);
|
||||
writer.Write((byte)tile.Direction);
|
||||
|
||||
m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||
writer.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MahjongTileInfo : Packet
|
||||
{
|
||||
public MahjongTileInfo(MahjongTile tile, Mobile to) : base(0xDA)
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendMahjongTileInfo(NetState ns, MahjongTile tile, Mobile to)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
MahjongGame game = tile.Game;
|
||||
MahjongPlayers players = game.Players;
|
||||
|
||||
EnsureCapacity(18);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[18]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Write((short)18); // Dynamic Length
|
||||
|
||||
m_Stream.Write(tile.Game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x3);
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x3);
|
||||
|
||||
m_Stream.Write((byte)tile.Number);
|
||||
writer.Write((byte)tile.Number);
|
||||
|
||||
if (tile.Flipped)
|
||||
{
|
||||
|
|
@ -177,33 +188,36 @@ namespace Server.Engines.Mahjong
|
|||
|
||||
if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to ||
|
||||
game.SpectatorVision && players.IsSpectator(to))
|
||||
m_Stream.Write((byte)tile.Value);
|
||||
writer.Write((byte)tile.Value);
|
||||
else
|
||||
m_Stream.Write((byte)0);
|
||||
writer.Position++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Stream.Write((byte)0);
|
||||
}
|
||||
writer.Position++;
|
||||
|
||||
m_Stream.Write((short)tile.Position.Y);
|
||||
m_Stream.Write((short)tile.Position.X);
|
||||
m_Stream.Write((byte)tile.StackLevel);
|
||||
m_Stream.Write((byte)tile.Direction);
|
||||
writer.Write((short)tile.Position.Y);
|
||||
writer.Write((short)tile.Position.X);
|
||||
writer.Write((byte)tile.StackLevel);
|
||||
writer.Write((byte)tile.Direction);
|
||||
|
||||
m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||
writer.Write(tile.Flipped ? (byte)0x10 : (byte)0x0);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MahjongRelieve : Packet
|
||||
{
|
||||
public MahjongRelieve(MahjongGame game) : base(0xDA)
|
||||
public static void SendMahjongRelieve(NetState ns, MahjongGame game)
|
||||
{
|
||||
EnsureCapacity(9);
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
m_Stream.Write(game.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0x1A);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[18]);
|
||||
writer.Write((byte)0xDA); // Packet ID
|
||||
writer.Write((short)18); // Dynamic Length
|
||||
|
||||
writer.Write(game.Serial);
|
||||
writer.Write((short)0x1A);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Server.Guilds;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ namespace Server.Items
|
|||
if (Guild.NewGuildSystem && ItemID == 0xED4)
|
||||
ItemID = 0xED6;
|
||||
|
||||
if (version <= 2)
|
||||
m_BeforeChangeover = true;
|
||||
m_BeforeChangeover |= version <= 2;
|
||||
|
||||
if (Guild.NewGuildSystem && m_BeforeChangeover)
|
||||
Timer.DelayCall(TimeSpan.Zero, AddToHouse);
|
||||
|
|
@ -251,10 +250,8 @@ namespace Server.Items
|
|||
from.SendGump(new GuildGump(from, Guild));
|
||||
}
|
||||
else if (from.AccessLevel < AccessLevel.GameMaster && !Guild.IsMember(from))
|
||||
{
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, 501158, "",
|
||||
"")); // You are not a member ...
|
||||
}
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3,
|
||||
501158); // You are not a member ...
|
||||
else
|
||||
{
|
||||
GuildGump.EnsureClosed(from);
|
||||
|
|
@ -262,8 +259,6 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
#region IAddon Members
|
||||
|
||||
public Item Deed => new GuildstoneDeed(Guild, m_GuildName, m_GuildAbbrev);
|
||||
|
||||
public bool CouldFit(IPoint3D p, Map map) => map.CanFit(p.X, p.Y, p.Z, ItemData.Height);
|
||||
|
|
@ -376,9 +371,7 @@ namespace Server.Items
|
|||
list.Add(1060802, $"{Utility.FixHtml(name)} [{Utility.FixHtml(abbr)}]");
|
||||
}
|
||||
else if (m_GuildName != null && m_GuildAbbrev != null)
|
||||
{
|
||||
list.Add(1060802, $"{Utility.FixHtml(m_GuildName)} [{Utility.FixHtml(m_GuildAbbrev)}]");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -393,14 +386,10 @@ namespace Server.Items
|
|||
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502092); // You must be in your house to do this.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public void Placement_OnTarget(Mobile from, object targeted)
|
||||
|
|
@ -424,14 +413,10 @@ namespace Server.Items
|
|||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042036); // That location is not in your house.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,7 @@ namespace Server.Items
|
|||
public class IndecipherableMap : MapItem
|
||||
{
|
||||
[Constructible]
|
||||
public IndecipherableMap()
|
||||
{
|
||||
if (Utility.RandomDouble() < 0.2)
|
||||
Hue = 0x965;
|
||||
else
|
||||
Hue = 0x961;
|
||||
}
|
||||
public IndecipherableMap() => Hue = Utility.RandomDouble() < 0.2 ? 0x965 : 0x961;
|
||||
|
||||
public IndecipherableMap(Serial serial) : base(serial)
|
||||
{
|
||||
|
|
@ -36,4 +30,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,16 @@ namespace Server.Items
|
|||
{
|
||||
private const int MaxUserPins = 50;
|
||||
private bool m_Editable;
|
||||
private Map m_Facet;
|
||||
|
||||
[Constructible]
|
||||
public MapItem() : base(0x14EC)
|
||||
public MapItem(Map facet = null) : base(0x14EC)
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
Width = 200;
|
||||
Height = 200;
|
||||
m_Facet = facet;
|
||||
}
|
||||
|
||||
public MapItem(Serial serial) : base(serial)
|
||||
|
|
@ -38,6 +40,13 @@ namespace Server.Items
|
|||
|
||||
public List<Point2D> Pins{ get; } = new List<Point2D>();
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual Map Facet
|
||||
{
|
||||
get => m_Facet;
|
||||
set => m_Facet = value;
|
||||
}
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
|
|
@ -83,13 +92,24 @@ namespace Server.Items
|
|||
|
||||
public virtual void DisplayTo(Mobile from)
|
||||
{
|
||||
from.Send(new MapDetails(this));
|
||||
from.Send(new MapDisplay(this));
|
||||
NetState ns = from.NetState;
|
||||
|
||||
if (ns.NewCharacterList) // 7.0.13.0+ supports maps on all facets
|
||||
MapItemPackets.SendMapDetailsNew(ns, this);
|
||||
else if (Facet != null && Facet != Map.Felucca && Facet != Map.Trammel) // Is it Felucca and Trammel, or just Felucca?
|
||||
{
|
||||
from.SendMessage("You must have client 7.0.13.0 or higher to display this map.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
MapItemPackets.SendMapDetailsOld(ns, this);
|
||||
|
||||
MapItemPackets.SendMapDisplay(from.NetState, this);
|
||||
|
||||
for (int i = 0; i < Pins.Count; ++i)
|
||||
from.Send(new MapAddPin(this, Pins[i]));
|
||||
MapItemPackets.SendMapAddPin(from.NetState, this, Pins[i]);
|
||||
|
||||
from.Send(new MapSetEditable(this, ValidateEdit(from)));
|
||||
MapItemPackets.SendMapSetEditable(from.NetState, this, ValidateEdit(from));
|
||||
}
|
||||
|
||||
public virtual void OnAddPin(Mobile from, int x, int y)
|
||||
|
|
@ -144,7 +164,7 @@ namespace Server.Items
|
|||
if (Validate(from))
|
||||
m_Editable = !m_Editable;
|
||||
|
||||
from.Send(new MapSetEditable(this, Validate(from) && m_Editable));
|
||||
MapItemPackets.SendMapSetEditable(from.NetState, this, m_Editable && ValidateEdit(from));
|
||||
}
|
||||
|
||||
public virtual void Validate(ref int x, ref int y)
|
||||
|
|
@ -226,7 +246,9 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
writer.Write(1);
|
||||
|
||||
writer.Write(m_Facet);
|
||||
|
||||
writer.Write(Bounds);
|
||||
|
||||
|
|
@ -248,6 +270,9 @@ namespace Server.Items
|
|||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
m_Facet = reader.ReadMap();
|
||||
goto case 0;
|
||||
case 0:
|
||||
{
|
||||
Bounds = reader.ReadRect2D();
|
||||
|
|
@ -306,71 +331,5 @@ namespace Server.Items
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class MapDetails : Packet
|
||||
{
|
||||
public MapDetails(MapItem map) : base(0x90, 19)
|
||||
{
|
||||
m_Stream.Write(map.Serial);
|
||||
m_Stream.Write((short)0x139D);
|
||||
m_Stream.Write((short)map.Bounds.Start.X);
|
||||
m_Stream.Write((short)map.Bounds.Start.Y);
|
||||
m_Stream.Write((short)map.Bounds.End.X);
|
||||
m_Stream.Write((short)map.Bounds.End.Y);
|
||||
m_Stream.Write((short)map.Width);
|
||||
m_Stream.Write((short)map.Height);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private sealed class MapDetailsNew : Packet
|
||||
{
|
||||
public MapDetailsNew( MapItem map ) : base ( 0xF5, 21 )
|
||||
{
|
||||
m_Stream.Write( (int) map.Serial );
|
||||
m_Stream.Write( (short) 0x139D );
|
||||
m_Stream.Write( (short) map.Bounds.Start.X );
|
||||
m_Stream.Write( (short) map.Bounds.Start.Y );
|
||||
m_Stream.Write( (short) map.Bounds.End.X );
|
||||
m_Stream.Write( (short) map.Bounds.End.Y );
|
||||
m_Stream.Write( (short) map.Width );
|
||||
m_Stream.Write( (short) map.Height );
|
||||
m_Stream.Write( (short) ( map.Facet == null ? 0 : map.Facet.MapID ) );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private abstract class MapCommand : Packet
|
||||
{
|
||||
public MapCommand(MapItem map, int command, int number, int x, int y) : base(0x56, 11)
|
||||
{
|
||||
m_Stream.Write(map.Serial);
|
||||
m_Stream.Write((byte)command);
|
||||
m_Stream.Write((byte)number);
|
||||
m_Stream.Write((short)x);
|
||||
m_Stream.Write((short)y);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class MapDisplay : MapCommand
|
||||
{
|
||||
public MapDisplay(MapItem map) : base(map, 5, 0, 0, 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class MapAddPin : MapCommand
|
||||
{
|
||||
public MapAddPin(MapItem map, Point2D point) : base(map, 1, 0, point.X, point.Y)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class MapSetEditable : MapCommand
|
||||
{
|
||||
public MapSetEditable(MapItem map, bool editable) : base(map, 7, editable ? 1 : 0, 0, 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
81
Projects/Scripts/Items/Maps/Packets.cs
Normal file
81
Projects/Scripts/Items/Maps/Packets.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using Server.Buffers;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public static class MapItemPackets
|
||||
{
|
||||
public static void SendMapDetailsOld(NetState ns, MapItem map)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[19]);
|
||||
writer.Write((byte)0x90); // Packet ID
|
||||
|
||||
writer.Write(map.Serial);
|
||||
writer.Write((short)0x139D);
|
||||
writer.Write((short)map.Bounds.Start.X);
|
||||
writer.Write((short)map.Bounds.Start.Y);
|
||||
writer.Write((short)map.Bounds.End.X);
|
||||
writer.Write((short)map.Bounds.End.Y);
|
||||
writer.Write((short)map.Width);
|
||||
writer.Write((short)map.Height);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendMapDetailsNew(NetState ns, MapItem map)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[21]);
|
||||
writer.Write((byte)0xF5); // Packet ID
|
||||
|
||||
writer.Write(map.Serial);
|
||||
writer.Write((short)0x139D);
|
||||
writer.Write((short)map.Bounds.Start.X);
|
||||
writer.Write((short)map.Bounds.Start.Y);
|
||||
writer.Write((short)map.Bounds.End.X);
|
||||
writer.Write((short)map.Bounds.End.Y);
|
||||
writer.Write((short)map.Width);
|
||||
writer.Write((short)map.Height);
|
||||
writer.Write( (short)(map.Facet?.MapID ?? 0) );
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendMapDisplay(NetState ns, MapItem map)
|
||||
{
|
||||
SendMapCommand(ns, map, 5);
|
||||
}
|
||||
|
||||
public static void SendMapAddPin(NetState ns, MapItem map, Point2D p)
|
||||
{
|
||||
SendMapCommand(ns, map, 1, 0, p.X, p.Y);
|
||||
}
|
||||
|
||||
public static void SendMapSetEditable(NetState ns, MapItem map, bool editable)
|
||||
{
|
||||
SendMapCommand(ns, map, 7, editable ? 1 : 0);
|
||||
}
|
||||
|
||||
public static void SendMapCommand(NetState ns, MapItem map, int command, int number = 0, int x = 0, int y = 0)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[11]);
|
||||
writer.Write((byte)0x56); // Packet ID
|
||||
|
||||
writer.Write(map.Serial);
|
||||
writer.Write((byte)command);
|
||||
writer.Write((byte)number);
|
||||
writer.Write((short)x);
|
||||
writer.Write((short)y);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ namespace Server.Items
|
|||
|
||||
public Rectangle2D Bounds{ get; }
|
||||
|
||||
public static PresetMapEntry[] Table{ get; } =
|
||||
public static readonly PresetMapEntry[] Table =
|
||||
{
|
||||
new PresetMapEntry(1041189, 200, 200, 1092, 1396, 1736, 1924), // map of Britain
|
||||
new PresetMapEntry(1041203, 200, 200, 0256, 1792, 1736, 2560), // map of Britain to Skara Brae
|
||||
|
|
@ -142,4 +142,4 @@ namespace Server.Items
|
|||
Yew,
|
||||
YewToBritain
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Server.Items
|
|||
private static Point2D[] m_Locations;
|
||||
private static Point2D[] m_HavenLocations;
|
||||
|
||||
private static Type[][] m_SpawnTypes =
|
||||
private static readonly Type[][] m_SpawnTypes =
|
||||
{
|
||||
new[] { typeof(HeadlessOne), typeof(Skeleton) },
|
||||
new[] { typeof(Mongbat), typeof(Ratman), typeof(HeadlessOne), typeof(Skeleton), typeof(Zombie) },
|
||||
|
|
@ -32,18 +32,13 @@ namespace Server.Items
|
|||
private Mobile m_CompletedBy;
|
||||
private Mobile m_Decoder;
|
||||
private int m_Level;
|
||||
private Map m_Map;
|
||||
|
||||
[Constructible]
|
||||
public TreasureMap(int level, Map map)
|
||||
public TreasureMap(int level, Map facet = null) : base(facet)
|
||||
{
|
||||
m_Level = level;
|
||||
m_Map = map;
|
||||
|
||||
if (level == 0)
|
||||
ChestLocation = GetRandomHavenLocation();
|
||||
else
|
||||
ChestLocation = GetRandomLocation();
|
||||
ChestLocation = level == 0 ? GetRandomHavenLocation() : GetRandomLocation();
|
||||
|
||||
Width = 300;
|
||||
Height = 300;
|
||||
|
|
@ -127,12 +122,12 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Map ChestMap
|
||||
public override Map Facet
|
||||
{
|
||||
get => m_Map;
|
||||
get => base.Facet;
|
||||
set
|
||||
{
|
||||
m_Map = value;
|
||||
base.Facet = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
|
@ -145,15 +140,9 @@ namespace Server.Items
|
|||
get
|
||||
{
|
||||
if (m_Decoder != null)
|
||||
{
|
||||
if (m_Level == 6)
|
||||
return 1063453;
|
||||
return 1041516 + m_Level;
|
||||
}
|
||||
return m_Level == 6 ? 1063453 : 1041516 + m_Level;
|
||||
|
||||
if (m_Level == 6)
|
||||
return 1063452;
|
||||
return 1041510 + m_Level;
|
||||
return m_Level == 6 ? 1063452 : 1041510 + m_Level;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,10 +151,8 @@ namespace Server.Items
|
|||
if (m_Locations == null)
|
||||
LoadLocations();
|
||||
|
||||
if (m_Locations.Length > 0)
|
||||
return m_Locations[Utility.Random(m_Locations.Length)];
|
||||
|
||||
return Point2D.Zero;
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
return m_Locations.Length > 0 ? m_Locations[Utility.Random(m_Locations.Length)] : Point2D.Zero;
|
||||
}
|
||||
|
||||
public static Point2D GetRandomHavenLocation()
|
||||
|
|
@ -173,10 +160,8 @@ namespace Server.Items
|
|||
if (m_HavenLocations == null)
|
||||
LoadLocations();
|
||||
|
||||
if (m_HavenLocations.Length > 0)
|
||||
return m_HavenLocations[Utility.Random(m_HavenLocations.Length)];
|
||||
|
||||
return Point2D.Zero;
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
return m_HavenLocations.Length > 0 ? m_HavenLocations[Utility.Random(m_HavenLocations.Length)] : Point2D.Zero;
|
||||
}
|
||||
|
||||
private static void LoadLocations()
|
||||
|
|
@ -325,7 +310,7 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage(503020); // You are already digging treasure.
|
||||
}
|
||||
else if (from.Map != m_Map)
|
||||
else if (from.Map != Facet)
|
||||
{
|
||||
from.SendLocalizedMessage(1010479); // You seem to be in the right place, but may be on the wrong facet!
|
||||
}
|
||||
|
|
@ -473,7 +458,7 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(m_Map == Map.Felucca ? 1041502 : 1041503); // for somewhere in Felucca : for somewhere in Trammel
|
||||
list.Add(Facet == Map.Felucca ? 1041502 : 1041503); // for somewhere in Felucca : for somewhere in Trammel
|
||||
|
||||
if (m_Completed)
|
||||
list.Add(1041507, m_CompletedBy == null ? "someone" : m_CompletedBy.Name); // completed by ~1_val~
|
||||
|
|
@ -483,9 +468,8 @@ namespace Server.Items
|
|||
{
|
||||
if (m_Completed)
|
||||
{
|
||||
from.Send(new MessageLocalizedAffix(Serial, ItemID, MessageType.Label, 0x3B2, 3, 1048030, "",
|
||||
AffixType.Append,
|
||||
$" completed by {(m_CompletedBy == null ? "someone" : m_CompletedBy.Name)}", ""));
|
||||
Packets.SendMessageLocalizedAffix(from.NetState, Serial, ItemID, MessageType.Label, 0x3B2, 3, 1048030, "",
|
||||
AffixType.Append, $" completed by {m_CompletedBy?.Name ?? "someone"}");
|
||||
}
|
||||
else if (m_Decoder != null)
|
||||
{
|
||||
|
|
@ -496,10 +480,10 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_Level == 6)
|
||||
LabelTo(from, 1041522, $"#{1063452}\t \t#{(m_Map == Map.Felucca ? 1041502 : 1041503)}");
|
||||
else
|
||||
LabelTo(from, 1041522, $"#{1041510 + m_Level}\t \t#{(m_Map == Map.Felucca ? 1041502 : 1041503)}");
|
||||
LabelTo(from, 1041522,
|
||||
m_Level == 6
|
||||
? $"#{1063452}\t \t#{(Facet == Map.Felucca ? 1041502 : 1041503)}"
|
||||
: $"#{1041510 + m_Level}\t \t#{(Facet == Map.Felucca ? 1041502 : 1041503)}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -507,14 +491,13 @@ namespace Server.Items
|
|||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1);
|
||||
writer.Write(2);
|
||||
|
||||
writer.Write(m_CompletedBy);
|
||||
|
||||
writer.Write(m_Level);
|
||||
writer.Write(m_Completed);
|
||||
writer.Write(m_Decoder);
|
||||
writer.Write(m_Map);
|
||||
writer.Write(ChestLocation);
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +520,8 @@ namespace Server.Items
|
|||
m_Level = reader.ReadInt();
|
||||
m_Completed = reader.ReadBool();
|
||||
m_Decoder = reader.ReadMobile();
|
||||
m_Map = reader.ReadMap();
|
||||
if (version < 2)
|
||||
Facet = reader.ReadMap();
|
||||
ChestLocation = reader.ReadPoint2D();
|
||||
|
||||
if (version == 0 && m_Completed)
|
||||
|
|
@ -562,12 +546,10 @@ namespace Server.Items
|
|||
if (m_Map.Deleted)
|
||||
return;
|
||||
|
||||
Map map = m_Map.m_Map;
|
||||
Map facet = m_Map.Facet;
|
||||
|
||||
if (m_Map.m_Completed)
|
||||
{
|
||||
from.SendLocalizedMessage(503028); // The treasure for this map has already been found.
|
||||
}
|
||||
/*
|
||||
else if ( from != m_Map.m_Decoder )
|
||||
{
|
||||
|
|
@ -575,22 +557,14 @@ namespace Server.Items
|
|||
}
|
||||
*/
|
||||
else if (m_Map.m_Decoder != from && !m_Map.HasRequiredSkill(from))
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
503031); // You did not decode this map and have no clue where to look for the treasure.
|
||||
}
|
||||
else if (!from.CanBeginAction<TreasureMap>())
|
||||
{
|
||||
from.SendLocalizedMessage(503020); // You are already digging treasure.
|
||||
}
|
||||
else if (!HasDiggingTool(from))
|
||||
{
|
||||
from.SendMessage("You must have a digging tool to dig for treasure.");
|
||||
}
|
||||
else if (from.Map != map)
|
||||
{
|
||||
from.SendLocalizedMessage(1114416); // You must have a digging tool to dig for treasure.
|
||||
else if (from.Map != facet)
|
||||
from.SendLocalizedMessage(1010479); // You seem to be in the right place, but may be on the wrong facet!
|
||||
}
|
||||
else
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
|
|
@ -617,19 +591,17 @@ namespace Server.Items
|
|||
if (Utility.InRange(targ3D, chest3D0, maxRange))
|
||||
{
|
||||
if (from.Location.X == x && from.Location.Y == y)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
503030); // The chest can't be dug up because you are standing on top of it.
|
||||
}
|
||||
else if (map != null)
|
||||
else if (facet != null)
|
||||
{
|
||||
int z = map.GetAverageZ(x, y);
|
||||
int z = facet.GetAverageZ(x, y);
|
||||
|
||||
if (!map.CanFit(x, y, z, 16, true))
|
||||
if (!facet.CanFit(x, y, z, 16, true))
|
||||
from.SendLocalizedMessage(
|
||||
503021); // You have found the treasure chest but something is keeping it from being dug up.
|
||||
else if (from.BeginAction<TreasureMap>())
|
||||
new DigTimer(from, m_Map, new Point3D(x, y, z), map).Start();
|
||||
new DigTimer(from, m_Map, new Point3D(x, y, z), facet).Start();
|
||||
else
|
||||
from.SendLocalizedMessage(503020); // You are already digging treasure.
|
||||
}
|
||||
|
|
@ -644,9 +616,7 @@ namespace Server.Items
|
|||
else
|
||||
{
|
||||
if (Utility.InRange(targ3D, chest3D0, 8)) // We're close, but not quite
|
||||
{
|
||||
from.SendAsciiMessage(0x44, "The treasure chest is very close!");
|
||||
}
|
||||
from.SendLocalizedMessage(1080030, "", 0x44); // The treasure chest is very close!
|
||||
else
|
||||
{
|
||||
Direction dir = Utility.GetDirection(targ3D, chest3D0);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Server.Accounting;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -13,14 +14,21 @@ namespace Server.Items
|
|||
|
||||
public override int LabelNumber => 503057; // Impassable!
|
||||
|
||||
protected override Packet GetWorldPacketFor(NetState state)
|
||||
protected override void SendWorldPacketFor(NetState state)
|
||||
{
|
||||
Mobile mob = state.Mobile;
|
||||
|
||||
if (mob?.AccessLevel >= AccessLevel.GameMaster)
|
||||
return new GMItemPacket(this);
|
||||
{
|
||||
if (state.HighSeas)
|
||||
SendGMItemHS(state);
|
||||
else if (state.StygianAbyss)
|
||||
SendGMItemSA(state);
|
||||
else
|
||||
SendGMItem(state);
|
||||
}
|
||||
|
||||
return base.GetWorldPacketFor(state);
|
||||
base.SendWorldPacketFor(state);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -37,66 +45,138 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public sealed class GMItemPacket : Packet
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
public GMItemPacket(Item item) : base(0x1A)
|
||||
{
|
||||
EnsureCapacity(20);
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
// 14 base length
|
||||
// +2 - Amount
|
||||
// +2 - Hue
|
||||
// +1 - Flags
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[20]);
|
||||
w.Write((byte)0x1A); // Packet ID
|
||||
w.Position += 2; // Dynamic Length
|
||||
|
||||
uint serial = item.Serial.Value;
|
||||
int itemID = 0x1183;
|
||||
int amount = item.Amount;
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = item.Hue;
|
||||
int flags = item.GetPacketFlags();
|
||||
int direction = (int)item.Direction;
|
||||
uint serial = Serial.Value;
|
||||
int itemId = 0x1183;
|
||||
int amount = Amount;
|
||||
Point3D loc = Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = Hue;
|
||||
int flags = GetPacketFlags();
|
||||
int direction = (int)Direction;
|
||||
|
||||
if (amount != 0)
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
if (amount != 0)
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
|
||||
m_Stream.Write(serial);
|
||||
m_Stream.Write((short)(itemID & 0x7FFF));
|
||||
w.Write(serial);
|
||||
|
||||
if (amount != 0)
|
||||
m_Stream.Write((short)amount);
|
||||
w.Write((short)itemId);
|
||||
|
||||
x &= 0x7FFF;
|
||||
if (amount != 0)
|
||||
w.Write((short)amount);
|
||||
|
||||
if (direction != 0)
|
||||
x |= 0x8000;
|
||||
x &= 0x7FFF;
|
||||
|
||||
m_Stream.Write((short)x);
|
||||
if (direction != 0) x |= 0x8000;
|
||||
|
||||
y &= 0x3FFF;
|
||||
w.Write((short)x);
|
||||
|
||||
if (hue != 0)
|
||||
y |= 0x8000;
|
||||
y &= 0x3FFF;
|
||||
|
||||
if (flags != 0)
|
||||
y |= 0x4000;
|
||||
if (hue != 0) y |= 0x8000;
|
||||
|
||||
m_Stream.Write((short)y);
|
||||
if (flags != 0) y |= 0x4000;
|
||||
|
||||
if (direction != 0)
|
||||
m_Stream.Write((byte)direction);
|
||||
w.Write((short)y);
|
||||
|
||||
m_Stream.Write((sbyte)loc.Z);
|
||||
if (direction != 0)
|
||||
w.Write((byte)direction);
|
||||
|
||||
if (hue != 0)
|
||||
m_Stream.Write((ushort)hue);
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
if (flags != 0)
|
||||
m_Stream.Write((byte)flags);
|
||||
}
|
||||
if (hue != 0)
|
||||
w.Write((ushort)hue);
|
||||
|
||||
if (flags != 0)
|
||||
w.Write((byte)flags);
|
||||
|
||||
w.Position = 1;
|
||||
w.Write((ushort)w.WrittenCount);
|
||||
|
||||
ns.Send(w.Span);
|
||||
}
|
||||
|
||||
public void SendGMItemSA(NetState ns)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[24]);
|
||||
w.Write((byte)0xF3); // Packet ID
|
||||
|
||||
w.Write((short)0x01);
|
||||
|
||||
int itemId = 0x1183;
|
||||
|
||||
w.Position++; // w.Write((byte)0);
|
||||
|
||||
w.Write(Serial);
|
||||
|
||||
w.Write((short)itemId);
|
||||
|
||||
w.Write((byte)Direction);
|
||||
|
||||
short amount = (short)Amount;
|
||||
w.Write(amount);
|
||||
w.Write(amount);
|
||||
|
||||
Point3D loc = Location;
|
||||
w.Write((short)(loc.X & 0x7FFF));
|
||||
w.Write((short)(loc.Y & 0x3FFF));
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
w.Write((byte)Light);
|
||||
w.Write((short)Hue);
|
||||
w.Write((byte)GetPacketFlags());
|
||||
|
||||
ns.Send(w.RawSpan);
|
||||
}
|
||||
|
||||
public void SendGMItemHS(NetState ns)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[26]);
|
||||
w.Write((byte)0xF3); // Packet ID
|
||||
|
||||
w.Write((short)0x01);
|
||||
|
||||
int itemId = 0x1183;
|
||||
|
||||
w.Position++; // w.Write((byte)0);
|
||||
|
||||
w.Write(Serial);
|
||||
|
||||
w.Write((short)itemId);
|
||||
|
||||
w.Write((byte)Direction);
|
||||
|
||||
short amount = (short)Amount;
|
||||
w.Write(amount);
|
||||
w.Write(amount);
|
||||
|
||||
Point3D loc = Location;
|
||||
w.Write((short)(loc.X & 0x7FFF));
|
||||
w.Write((short)(loc.Y & 0x3FFF));
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
w.Write((byte)Light);
|
||||
w.Write((short)Hue);
|
||||
w.Write((byte)GetPacketFlags());
|
||||
|
||||
ns.Send(w.RawSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string BoardName{ get; set; }
|
||||
public string BoardName { get; set; }
|
||||
|
||||
public static bool CheckTime(DateTime time, TimeSpan range) => time + range < DateTime.UtcNow;
|
||||
|
||||
|
|
@ -66,8 +67,10 @@ namespace Server.Items
|
|||
|
||||
if (minutes != 0 && seconds != 0)
|
||||
return $"{minutes} minute{(minutes == 1 ? "" : "s")} and {seconds} second{(seconds == 1 ? "" : "s")}";
|
||||
|
||||
if (minutes != 0)
|
||||
return $"{minutes} minute{(minutes == 1 ? "" : "s")}";
|
||||
|
||||
return $"{seconds} second{(seconds == 1 ? "" : "s")}";
|
||||
}
|
||||
|
||||
|
|
@ -146,11 +149,8 @@ namespace Server.Items
|
|||
|
||||
NetState state = from.NetState;
|
||||
|
||||
state.Send(new BBDisplayBoard(this));
|
||||
if (state.ContainerGridLines)
|
||||
state.Send(new ContainerContent6017(from, this));
|
||||
else
|
||||
state.Send(new ContainerContent(from, this));
|
||||
BBPackets.SendBBDisplayBoard(state, this);
|
||||
Packets.SendContainerContent(state, from, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -232,18 +232,14 @@ namespace Server.Items
|
|||
|
||||
public static void BBRequestContent(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
{
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
return;
|
||||
|
||||
from.Send(new BBMessageContent(board, msg));
|
||||
if (World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg && msg.Parent == board)
|
||||
BBPackets.SendBBMessageContent(from.NetState, board, msg);
|
||||
}
|
||||
|
||||
public static void BBRequestHeader(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
{
|
||||
if (!(World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg) || msg.Parent != board)
|
||||
return;
|
||||
|
||||
from.Send(new BBMessageHeader(board, msg));
|
||||
if (World.FindItem(pvSrc.ReadUInt32()) is BulletinMessage msg && msg.Parent == board)
|
||||
BBPackets.SendBBMessageHeader(from.NetState, board, msg);
|
||||
}
|
||||
|
||||
public static void BBPostMessage(Mobile from, BaseBulletinBoard board, PacketReader pvSrc)
|
||||
|
|
@ -271,7 +267,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
string subject = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());
|
||||
string subject = pvSrc.ReadStringSafe(pvSrc.ReadByte());
|
||||
|
||||
if (subject.Length == 0)
|
||||
return;
|
||||
|
|
@ -282,7 +278,7 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
for (int i = 0; i < lines.Length; ++i)
|
||||
lines[i] = pvSrc.ReadUTF8StringSafe(pvSrc.ReadByte());
|
||||
lines[i] = pvSrc.ReadStringSafe(pvSrc.ReadByte());
|
||||
|
||||
board.PostMessage(from, thread, subject, lines);
|
||||
}
|
||||
|
|
@ -344,25 +340,25 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
public Mobile Poster{ get; private set; }
|
||||
public Mobile Poster { get; private set; }
|
||||
|
||||
public BulletinMessage Thread{ get; private set; }
|
||||
public BulletinMessage Thread { get; private set; }
|
||||
|
||||
public string Subject{ get; private set; }
|
||||
public string Subject { get; private set; }
|
||||
|
||||
public DateTime Time{ get; private set; }
|
||||
public DateTime Time { get; private set; }
|
||||
|
||||
public DateTime LastPostTime{ get; set; }
|
||||
public DateTime LastPostTime { get; set; }
|
||||
|
||||
public string PostedName{ get; private set; }
|
||||
public string PostedName { get; private set; }
|
||||
|
||||
public int PostedBody{ get; private set; }
|
||||
public int PostedBody { get; private set; }
|
||||
|
||||
public int PostedHue{ get; private set; }
|
||||
public int PostedHue { get; private set; }
|
||||
|
||||
public BulletinEquip[] PostedEquip{ get; private set; }
|
||||
public BulletinEquip[] PostedEquip { get; private set; }
|
||||
|
||||
public string[] Lines{ get; private set; }
|
||||
public string[] Lines { get; private set; }
|
||||
|
||||
public string GetTimeAsString() => Time.ToString("MMM dd, yyyy");
|
||||
|
||||
|
|
@ -452,70 +448,64 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public class BBDisplayBoard : Packet
|
||||
public static class BBPackets
|
||||
{
|
||||
public BBDisplayBoard(BaseBulletinBoard board) : base(0x71)
|
||||
public static void SendBBDisplayBoard(NetState ns, BaseBulletinBoard board)
|
||||
{
|
||||
EnsureCapacity(38);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[38]);
|
||||
writer.Write((byte)0x71); // Packet ID
|
||||
writer.Write((ushort)38); // Dynamic Length
|
||||
|
||||
byte[] buffer = Utility.UTF8.GetBytes(board.BoardName ?? "");
|
||||
writer.Position++; // writer.Write((byte)0); // Command
|
||||
writer.Write(board.Serial);
|
||||
writer.WriteAsciiNull(board.BoardName ?? "", 29);
|
||||
|
||||
m_Stream.Write((byte)0x00); // PacketID
|
||||
m_Stream.Write(board.Serial); // Bulletin board serial
|
||||
|
||||
// Bulletin board name
|
||||
if (buffer.Length >= 29)
|
||||
{
|
||||
m_Stream.Write(buffer, 0, 29);
|
||||
m_Stream.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Stream.Write(buffer, 0, buffer.Length);
|
||||
m_Stream.Fill(30 - buffer.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BBMessageHeader : Packet
|
||||
{
|
||||
public BBMessageHeader(BaseBulletinBoard board, BulletinMessage msg) : base(0x71)
|
||||
{
|
||||
string poster = SafeString(msg.PostedName);
|
||||
string subject = SafeString(msg.Subject);
|
||||
string time = SafeString(msg.GetTimeAsString());
|
||||
|
||||
EnsureCapacity(22 + poster.Length + subject.Length + time.Length);
|
||||
|
||||
m_Stream.Write((byte)0x01); // PacketID
|
||||
m_Stream.Write(board.Serial); // Bulletin board serial
|
||||
m_Stream.Write(msg.Serial); // Message serial
|
||||
|
||||
BulletinMessage thread = msg.Thread;
|
||||
|
||||
if (thread == null)
|
||||
m_Stream.Write(0); // Thread serial--root
|
||||
else
|
||||
m_Stream.Write(thread.Serial); // Thread serial--parent
|
||||
|
||||
WriteString(poster);
|
||||
WriteString(subject);
|
||||
WriteString(time);
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public void WriteString(string v)
|
||||
public static void SendBBMessageHeader(NetState ns, BaseBulletinBoard board, BulletinMessage msg)
|
||||
{
|
||||
byte[] buffer = Utility.UTF8.GetBytes(v);
|
||||
int len = buffer.Length + 1;
|
||||
string poster = msg.PostedName ?? "";
|
||||
string subject = msg.Subject ?? "";
|
||||
string time = msg.GetTimeAsString() ?? "";
|
||||
|
||||
if (len > 255)
|
||||
len = 255;
|
||||
byte posterLength = Math.Min((byte)poster.Length, (byte)254);
|
||||
byte subjectLength = Math.Min((byte)subject.Length, (byte)254);
|
||||
byte timeLength = Math.Min((byte)time.Length, (byte)254);
|
||||
|
||||
m_Stream.Write((byte)len);
|
||||
m_Stream.Write(buffer, 0, len - 1);
|
||||
m_Stream.Write((byte)0);
|
||||
int length = 22 + posterLength + subjectLength + timeLength;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x71); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
|
||||
writer.Write((byte)0x01); // Command
|
||||
writer.Write(board.Serial); // Bulletin board serial
|
||||
writer.Write(msg.Serial); // Message serial
|
||||
writer.Write(msg.Thread?.Serial ?? 0);
|
||||
|
||||
writer.Write(posterLength);
|
||||
writer.WriteAsciiNull(poster, posterLength + 1);
|
||||
writer.Write(subjectLength);
|
||||
writer.WriteAsciiNull(subject, subjectLength + 1);
|
||||
writer.Write(timeLength);
|
||||
writer.WriteAsciiNull(time, timeLength + 1);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendBBMessageContent(NetState ns, BaseBulletinBoard board, BulletinMessage msg)
|
||||
{
|
||||
string poster = msg.PostedName ?? "";
|
||||
string subject = msg.Subject ?? "";
|
||||
string time = msg.GetTimeAsString() ?? "";
|
||||
|
||||
byte posterLength = Math.Min((byte)poster.Length, (byte)254);
|
||||
byte subjectLength = Math.Min((byte)subject.Length, (byte)254);
|
||||
byte timeLength = Math.Min((byte)time.Length, (byte)254);
|
||||
|
||||
int equipLength = Math.Min(msg.PostedEquip.Length, 255);
|
||||
int msgLength = Math.Min(msg.Lines.Length, 255);
|
||||
|
||||
public string SafeString(string v) => v ?? string.Empty;
|
||||
}
|
||||
|
||||
|
|
@ -529,72 +519,43 @@ namespace Server.Items
|
|||
|
||||
EnsureCapacity(22 + poster.Length + subject.Length + time.Length);
|
||||
|
||||
m_Stream.Write((byte)0x02); // PacketID
|
||||
m_Stream.Write(board.Serial); // Bulletin board serial
|
||||
m_Stream.Write(msg.Serial); // Message serial
|
||||
writer.Write((byte)0x02); // Command
|
||||
writer.Write(board.Serial); // Bulletin board serial
|
||||
writer.Write(msg.Serial); // Message serial
|
||||
|
||||
WriteString(poster);
|
||||
WriteString(subject);
|
||||
WriteString(time);
|
||||
writer.Write(posterLength);
|
||||
writer.WriteAsciiNull(poster, posterLength + 1);
|
||||
writer.Write(subjectLength);
|
||||
writer.WriteAsciiNull(subject, subjectLength + 1);
|
||||
writer.Write(timeLength);
|
||||
writer.WriteAsciiNull(time, timeLength + 1);
|
||||
|
||||
m_Stream.Write((short)msg.PostedBody);
|
||||
m_Stream.Write((short)msg.PostedHue);
|
||||
writer.Write((short)msg.PostedBody);
|
||||
writer.Write((short)msg.PostedHue);
|
||||
|
||||
int len = msg.PostedEquip.Length;
|
||||
writer.Write((byte)equipLength);
|
||||
|
||||
if (len > 255)
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write((byte)len);
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
for (int i = 0; i < equipLength; ++i)
|
||||
{
|
||||
BulletinEquip eq = msg.PostedEquip[i];
|
||||
|
||||
m_Stream.Write((short)eq.itemID);
|
||||
m_Stream.Write((short)eq.hue);
|
||||
writer.Write((short)eq.itemID);
|
||||
writer.Write((short)eq.hue);
|
||||
}
|
||||
|
||||
len = msg.Lines.Length;
|
||||
writer.Write((byte)msgLength);
|
||||
|
||||
if (len > 255)
|
||||
len = 255;
|
||||
for (int i = 0; i < msgLength; ++i)
|
||||
{
|
||||
string line = msg.Lines[i];
|
||||
byte len = Math.Min((byte)line.Length, (byte)254);
|
||||
writer.WriteAsciiNull(line, len);
|
||||
}
|
||||
|
||||
m_Stream.Write((byte)len);
|
||||
writer.Position = 1;
|
||||
writer.Write((ushort)writer.WrittenCount);
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
WriteString(msg.Lines[i], true);
|
||||
}
|
||||
|
||||
public void WriteString(string v)
|
||||
{
|
||||
WriteString(v, false);
|
||||
}
|
||||
|
||||
public void WriteString(string v, bool padding)
|
||||
{
|
||||
byte[] buffer = Utility.UTF8.GetBytes(v);
|
||||
int tail = padding ? 2 : 1;
|
||||
int len = buffer.Length + tail;
|
||||
|
||||
if (len > 255)
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write((byte)len);
|
||||
m_Stream.Write(buffer, 0, len - tail);
|
||||
|
||||
if (padding)
|
||||
m_Stream.Write((short)0); // padding compensates for a client bug
|
||||
else
|
||||
m_Stream.Write((byte)0);
|
||||
}
|
||||
|
||||
public string SafeString(string v)
|
||||
{
|
||||
if (v == null)
|
||||
return string.Empty;
|
||||
|
||||
return v;
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
@ -29,14 +30,7 @@ namespace Server.Items
|
|||
|
||||
public int Amount{ get; }
|
||||
|
||||
public static CrystalRechargeInfo Get(Type type)
|
||||
{
|
||||
foreach (CrystalRechargeInfo info in Table)
|
||||
if (info.Type == type)
|
||||
return info;
|
||||
|
||||
return null;
|
||||
}
|
||||
public static CrystalRechargeInfo Get(Type type) => Table.FirstOrDefault(info => info.Type == type);
|
||||
}
|
||||
|
||||
public class BroadcastCrystal : Item
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace Server.Items
|
|||
public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> equipItems)
|
||||
: base(0x2006)
|
||||
{
|
||||
// To supress console warnings, stackable must be true
|
||||
// To suppress console warnings, stackable must be true
|
||||
Stackable = true;
|
||||
Amount = owner.Body; // protocol defines that for itemid 0x2006, amount=body
|
||||
Stackable = false;
|
||||
|
|
@ -193,16 +193,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool InstancedCorpse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Core.SE)
|
||||
return false;
|
||||
|
||||
return DateTime.UtcNow < TimeOfDeath + InstancedCorpseTime;
|
||||
}
|
||||
}
|
||||
public virtual bool InstancedCorpse => Core.SE && DateTime.UtcNow < TimeOfDeath + InstancedCorpseTime;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
|
|
@ -302,9 +293,7 @@ namespace Server.Items
|
|||
Mobile dead = Owner;
|
||||
|
||||
if (GetFlag(CorpseFlag.Carved) || dead == null)
|
||||
{
|
||||
from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
|
||||
}
|
||||
else if (((Body)Amount).IsHuman && ItemID == 0x2006)
|
||||
{
|
||||
new Blood(0x122D).MoveToWorld(Location, Map);
|
||||
|
|
@ -328,13 +317,9 @@ namespace Server.Items
|
|||
from.CriminalAction(true);
|
||||
}
|
||||
else if (dead is BaseCreature creature)
|
||||
{
|
||||
creature.OnCarve(from, this, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsChildVisibleTo(Mobile m, Item child) =>
|
||||
|
|
@ -347,8 +332,7 @@ namespace Server.Items
|
|||
if (Aggressors.Count == 0 || Items.Count == 0)
|
||||
return;
|
||||
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
List<Item> m_Stackables = new List<Item>();
|
||||
List<Item> m_Unstackables = new List<Item>();
|
||||
|
|
@ -401,7 +385,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (remainder == 0)
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[^1]));
|
||||
else
|
||||
m_Unstackables.Add(item);
|
||||
}
|
||||
|
|
@ -427,9 +411,7 @@ namespace Server.Items
|
|||
|
||||
if (InstancedCorpse)
|
||||
{
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems.Add(carved, new InstancedItemInfo(carved, carver));
|
||||
}
|
||||
}
|
||||
|
|
@ -464,7 +446,6 @@ namespace Server.Items
|
|||
public override void OnAfterDelete()
|
||||
{
|
||||
m_DecayTimer?.Stop();
|
||||
|
||||
m_DecayTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -543,29 +524,23 @@ namespace Server.Items
|
|||
|
||||
writer.WriteDeltaTime(TimeOfDeath);
|
||||
|
||||
List<KeyValuePair<Item, Point3D>> list = m_RestoreTable == null
|
||||
? null
|
||||
: new List<KeyValuePair<Item, Point3D>>(m_RestoreTable);
|
||||
int count = list?.Count ?? 0;
|
||||
|
||||
writer.Write(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
if (m_RestoreTable == null)
|
||||
writer.Write(0);
|
||||
else
|
||||
{
|
||||
KeyValuePair<Item, Point3D> kvp = list[i];
|
||||
Item item = kvp.Key;
|
||||
Point3D loc = kvp.Value;
|
||||
writer.Write(m_RestoreTable.Count);
|
||||
|
||||
writer.Write(item);
|
||||
foreach (var (item, loc) in m_RestoreTable)
|
||||
{
|
||||
writer.Write(item);
|
||||
|
||||
if (item.Location == loc)
|
||||
{
|
||||
writer.Write(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(true);
|
||||
writer.Write(loc);
|
||||
if (item.Location == loc)
|
||||
writer.Write(false);
|
||||
else
|
||||
{
|
||||
writer.Write(true);
|
||||
writer.Write(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -757,12 +732,8 @@ namespace Server.Items
|
|||
if (!(((Body)Amount).IsHuman && ItemID == 0x2006))
|
||||
return;
|
||||
|
||||
if (state.ContainerGridLines)
|
||||
state.Send(new CorpseContent6017(state.Mobile, this));
|
||||
else
|
||||
state.Send(new CorpseContent(state.Mobile, this));
|
||||
|
||||
state.Send(new CorpseEquip(state.Mobile, this));
|
||||
CorpsePackets.SendCorpseContent(state, state.Mobile, this);
|
||||
CorpsePackets.SendCorpseEquip(state, state.Mobile, this);
|
||||
}
|
||||
|
||||
public bool IsCriminalAction(Mobile from)
|
||||
|
|
@ -836,8 +807,7 @@ namespace Server.Items
|
|||
if (item == null)
|
||||
return;
|
||||
|
||||
if (m_RestoreTable == null)
|
||||
m_RestoreTable = new Dictionary<Item, Point3D>();
|
||||
m_RestoreTable ??= new Dictionary<Item, Point3D>();
|
||||
|
||||
m_RestoreTable[item] = loc;
|
||||
}
|
||||
|
|
@ -1065,7 +1035,7 @@ namespace Server.Items
|
|||
ObjectPropertyList opl = PropertyList;
|
||||
|
||||
if (opl.Header > 0)
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs);
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -1075,14 +1045,12 @@ namespace Server.Items
|
|||
if (ItemID == 0x2006) // Corpse form
|
||||
{
|
||||
if (m_CorpseName != null)
|
||||
from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName));
|
||||
Packets.SendAsciiMessage(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName);
|
||||
else
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
|
||||
}
|
||||
else // Bone form
|
||||
{
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
|
||||
}
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
|
||||
}
|
||||
|
||||
private class InstancedItemInfo
|
||||
|
|
|
|||
|
|
@ -1,24 +1,29 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Buffers;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public sealed class CorpseEquip : Packet
|
||||
public static class CorpsePackets
|
||||
{
|
||||
public CorpseEquip(Mobile beholder, Corpse beheld) : base(0x89)
|
||||
public static void SendCorpseEquip(NetState ns, Mobile beholder, Corpse beheld)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
List<Item> list = beheld.EquipItems;
|
||||
|
||||
int count = list.Count;
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
int length = 8 + list.Count * 5;
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
length += 5;
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
length += 5;
|
||||
|
||||
EnsureCapacity(8 + count * 5);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x89); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
|
||||
m_Stream.Write(beheld.Serial);
|
||||
writer.Write(beheld.Serial);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
|
|
@ -26,173 +31,180 @@ namespace Server.Network
|
|||
|
||||
if (!item.Deleted && beholder.CanSee(item) && item.Parent == beheld)
|
||||
{
|
||||
m_Stream.Write((byte)(item.Layer + 1));
|
||||
m_Stream.Write(item.Serial);
|
||||
writer.Write((byte)(item.Layer + 1));
|
||||
writer.Write(item.Serial);
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((byte)(Layer.Hair + 1));
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
writer.Write((byte)(Layer.Hair + 1));
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((byte)(Layer.FacialHair + 1));
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
writer.Write((byte)(Layer.FacialHair + 1));
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
|
||||
m_Stream.Write((byte)Layer.Invalid);
|
||||
writer.Position++; // writer.Write((byte)Layer.Invalid);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent : Packet
|
||||
{
|
||||
public CorpseContent(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
public static void SendCorpseContent(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
if (ns.ContainerGridLines)
|
||||
SendCorpseContentNew(ns, beholder, corpse);
|
||||
else
|
||||
SendCorpseContentOld(ns, beholder, corpse);
|
||||
}
|
||||
|
||||
EnsureCapacity(5 + count * 19);
|
||||
public static void SendCorpseContentOld(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
List<Item> items = corpse.EquipItems;
|
||||
int length = 5 + items.Count * 19;
|
||||
|
||||
int written = 0;
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
length += 19;
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
length += 19;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x3C); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
writer.Position += 2;
|
||||
|
||||
ushort written = 0;
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
if (!child.Deleted && child.Parent == corpse && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write(child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
writer.Write(child.Serial);
|
||||
writer.Write((ushort)child.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)child.Amount);
|
||||
writer.Write((short)child.X);
|
||||
writer.Write((short)child.Y);
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
writer.Write(HairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.Hair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 4;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
writer.Write(FacialHairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.FacialHair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 4;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
writer.Position = 3;
|
||||
writer.Write(written);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent6017 : Packet
|
||||
{
|
||||
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
public static void SendCorpseContentNew(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
List<Item> items = corpse.EquipItems;
|
||||
int length = 5 + items.Count * 20;
|
||||
|
||||
EnsureCapacity(5 + count * 20);
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
length += 20;
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
length += 20;
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x3C); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
writer.Position += 2;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
ushort written = 0;
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
if (!child.Deleted && child.Parent == corpse && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write(child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
writer.Write(child.Serial);
|
||||
writer.Write((ushort)child.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)child.Amount);
|
||||
writer.Write((short)child.X);
|
||||
writer.Write((short)child.Y);
|
||||
writer.Position++; // grid location
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
writer.Write(HairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.Hair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 5;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
writer.Write(FacialHairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.FacialHair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 5;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
writer.Position = 3;
|
||||
writer.Write(written);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ namespace Server.Items
|
|||
{
|
||||
case ECEffectType.Lightning:
|
||||
{
|
||||
Effects.SendBoltEffect(from, false, EffectHue);
|
||||
Effects.SendBoltEffect(from, false);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Location:
|
||||
|
|
@ -334,4 +334,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,4 +83,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage(1060581); // You've already lit it! Better throw it now!
|
||||
}
|
||||
|
||||
if (m_Users == null)
|
||||
m_Users = new List<Mobile>();
|
||||
m_Users ??= new List<Mobile>();
|
||||
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -182,8 +182,7 @@ namespace Server.Items
|
|||
|
||||
if (addon != null)
|
||||
{
|
||||
if (count == 1 && Core.SE)
|
||||
isDecorableComponent = true;
|
||||
isDecorableComponent |= count == 1 && Core.SE;
|
||||
|
||||
if (m_Decorator.Command == DecorateCommand.Turn)
|
||||
{
|
||||
|
|
@ -191,8 +190,7 @@ namespace Server.Items
|
|||
(FlippableAddonAttribute[])addon.GetType()
|
||||
.GetCustomAttributes(typeof(FlippableAddonAttribute), false);
|
||||
|
||||
if (attributes.Length > 0)
|
||||
isDecorableComponent = true;
|
||||
isDecorableComponent = attributes.Length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -204,14 +203,9 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
string desc;
|
||||
string desc = m_KeyVal == 0 ? "(blank)" : m_Description?.Trim() ?? "";
|
||||
|
||||
if (m_KeyVal == 0)
|
||||
desc = "(blank)";
|
||||
else if ((desc = m_Description) == null || (desc = desc.Trim()).Length <= 0)
|
||||
desc = null;
|
||||
|
||||
if (desc != null)
|
||||
if (desc != "")
|
||||
list.Add(desc);
|
||||
}
|
||||
|
||||
|
|
@ -219,15 +213,10 @@ namespace Server.Items
|
|||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
string desc;
|
||||
|
||||
if (m_KeyVal == 0)
|
||||
desc = "(blank)";
|
||||
else if ((desc = m_Description) == null || (desc = desc.Trim()).Length <= 0)
|
||||
desc = "";
|
||||
string desc = m_KeyVal == 0 ? "(blank)" : m_Description?.Trim() ?? "";
|
||||
|
||||
if (desc.Length > 0)
|
||||
from.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", "", desc));
|
||||
Packets.SendUnicodeMessage(from.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", "", desc);
|
||||
}
|
||||
|
||||
public bool UseOn(Mobile from, ILockable o)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -109,14 +110,7 @@ namespace Server.Items
|
|||
UpdateItemID();
|
||||
}
|
||||
|
||||
public bool ContainsKey(uint keyValue)
|
||||
{
|
||||
foreach (Key key in Keys)
|
||||
if (key.KeyValue == keyValue)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool ContainsKey(uint keyValue) => Keys.Any(key => key.KeyValue == keyValue);
|
||||
|
||||
private void UpdateItemID()
|
||||
{
|
||||
|
|
@ -169,9 +163,7 @@ namespace Server.Items
|
|||
}
|
||||
else if (targeted is ILockable o)
|
||||
{
|
||||
foreach (Key key in m_KeyRing.Keys)
|
||||
if (key.UseOn(from, o))
|
||||
return;
|
||||
if (m_KeyRing.Keys.Any(key => key.UseOn(from, o))) return;
|
||||
|
||||
from.SendLocalizedMessage(1008140); // You do not have a key for that.
|
||||
}
|
||||
|
|
@ -182,4 +174,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -19,13 +20,21 @@ namespace Server.Items
|
|||
TileData.ItemTable[0x21A2].Height = 20;
|
||||
}
|
||||
|
||||
protected override Packet GetWorldPacketFor(NetState state)
|
||||
protected override void SendWorldPacketFor(NetState state)
|
||||
{
|
||||
Mobile mob = state.Mobile;
|
||||
|
||||
if (mob?.AccessLevel >= AccessLevel.GameMaster) return new GMItemPacket(this);
|
||||
if (mob?.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
if (state.HighSeas)
|
||||
SendGMItemHS(state);
|
||||
else if (state.StygianAbyss)
|
||||
SendGMItemSA(state);
|
||||
else
|
||||
SendGMItem(state);
|
||||
}
|
||||
|
||||
return base.GetWorldPacketFor(state);
|
||||
base.SendWorldPacketFor(state);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -45,66 +54,138 @@ namespace Server.Items
|
|||
ItemID = 0x21A2;
|
||||
}
|
||||
|
||||
public sealed class GMItemPacket : Packet
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
public GMItemPacket(Item item) : base(0x1A)
|
||||
{
|
||||
EnsureCapacity(20);
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
// 14 base length
|
||||
// +2 - Amount
|
||||
// +2 - Hue
|
||||
// +1 - Flags
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[20]);
|
||||
w.Write((byte)0x1A); // Packet ID
|
||||
w.Position += 2; // Dynamic Length
|
||||
|
||||
uint serial = item.Serial.Value;
|
||||
int itemID = 0x36FF;
|
||||
int amount = item.Amount;
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = item.Hue;
|
||||
int flags = item.GetPacketFlags();
|
||||
int direction = (int)item.Direction;
|
||||
uint serial = Serial.Value;
|
||||
int itemId = 0x36FF;
|
||||
int amount = Amount;
|
||||
Point3D loc = Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = Hue;
|
||||
int flags = GetPacketFlags();
|
||||
int direction = (int)Direction;
|
||||
|
||||
if (amount != 0)
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
if (amount != 0)
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
|
||||
m_Stream.Write(serial);
|
||||
m_Stream.Write((short)(itemID & 0x7FFF));
|
||||
w.Write(serial);
|
||||
|
||||
if (amount != 0)
|
||||
m_Stream.Write((short)amount);
|
||||
w.Write((short)itemId);
|
||||
|
||||
x &= 0x7FFF;
|
||||
if (amount != 0)
|
||||
w.Write((short)amount);
|
||||
|
||||
if (direction != 0)
|
||||
x |= 0x8000;
|
||||
x &= 0x7FFF;
|
||||
|
||||
m_Stream.Write((short)x);
|
||||
if (direction != 0) x |= 0x8000;
|
||||
|
||||
y &= 0x3FFF;
|
||||
w.Write((short)x);
|
||||
|
||||
if (hue != 0)
|
||||
y |= 0x8000;
|
||||
y &= 0x3FFF;
|
||||
|
||||
if (flags != 0)
|
||||
y |= 0x4000;
|
||||
if (hue != 0) y |= 0x8000;
|
||||
|
||||
m_Stream.Write((short)y);
|
||||
if (flags != 0) y |= 0x4000;
|
||||
|
||||
if (direction != 0)
|
||||
m_Stream.Write((byte)direction);
|
||||
w.Write((short)y);
|
||||
|
||||
m_Stream.Write((sbyte)loc.Z);
|
||||
if (direction != 0)
|
||||
w.Write((byte)direction);
|
||||
|
||||
if (hue != 0)
|
||||
m_Stream.Write((ushort)hue);
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
if (flags != 0)
|
||||
m_Stream.Write((byte)flags);
|
||||
}
|
||||
if (hue != 0)
|
||||
w.Write((ushort)hue);
|
||||
|
||||
if (flags != 0)
|
||||
w.Write((byte)flags);
|
||||
|
||||
w.Position = 1;
|
||||
w.Write((ushort)w.WrittenCount);
|
||||
|
||||
ns.Send(w.Span);
|
||||
}
|
||||
|
||||
public void SendGMItemSA(NetState ns)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[24]);
|
||||
w.Write((byte)0xF3); // Packet ID
|
||||
|
||||
w.Write((short)0x01);
|
||||
|
||||
int itemId = 0x36FF;
|
||||
|
||||
w.Position++; // w.Write((byte)0);
|
||||
|
||||
w.Write(Serial);
|
||||
|
||||
w.Write((short)itemId);
|
||||
|
||||
w.Write((byte)Direction);
|
||||
|
||||
short amount = (short)Amount;
|
||||
w.Write(amount);
|
||||
w.Write(amount);
|
||||
|
||||
Point3D loc = Location;
|
||||
w.Write((short)(loc.X & 0x7FFF));
|
||||
w.Write((short)(loc.Y & 0x3FFF));
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
w.Write((byte)Light);
|
||||
w.Write((short)Hue);
|
||||
w.Write((byte)GetPacketFlags());
|
||||
|
||||
ns.Send(w.RawSpan);
|
||||
}
|
||||
|
||||
public void SendGMItemHS(NetState ns)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
SpanWriter w = new SpanWriter(stackalloc byte[26]);
|
||||
w.Write((byte)0xF3); // Packet ID
|
||||
|
||||
w.Write((short)0x01);
|
||||
|
||||
int itemId = 0x36FF;
|
||||
|
||||
w.Position++; // w.Write((byte)0);
|
||||
|
||||
w.Write(Serial);
|
||||
|
||||
w.Write((short)itemId);
|
||||
|
||||
w.Write((byte)Direction);
|
||||
|
||||
short amount = (short)Amount;
|
||||
w.Write(amount);
|
||||
w.Write(amount);
|
||||
|
||||
Point3D loc = Location;
|
||||
w.Write((short)(loc.X & 0x7FFF));
|
||||
w.Write((short)(loc.Y & 0x3FFF));
|
||||
w.Write((sbyte)loc.Z);
|
||||
|
||||
w.Write((byte)Light);
|
||||
w.Write((short)Hue);
|
||||
w.Write((byte)GetPacketFlags());
|
||||
|
||||
ns.Send(w.RawSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@ namespace Server.Items
|
|||
|
||||
private void AddGeneratorComponent(int itemID, int x, int y, int z)
|
||||
{
|
||||
AddonComponent component = new AddonComponent(itemID);
|
||||
component.Name = "a power generator";
|
||||
component.Hue = 0x451;
|
||||
|
||||
AddComponent(component, x, y, z);
|
||||
AddComponent(new AddonComponent(itemID){ Name = "a power generator", Hue = 0x451 }, x, y, z);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -148,9 +144,7 @@ namespace Server.Items
|
|||
visited[current.X, current.Y] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = stack[--stackSize - 1];
|
||||
}
|
||||
}
|
||||
|
||||
Path = new Node[stackSize];
|
||||
|
|
@ -197,9 +191,8 @@ namespace Server.Items
|
|||
|
||||
public void DoDamage(Mobile to)
|
||||
{
|
||||
to.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, 0x3B2, 3, "", "",
|
||||
"The generator shoots an arc of electricity at you!"));
|
||||
to.BoltEffect(0);
|
||||
Packets.SendMessageLocalized(to.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3, 1152372); // The Nexus shoots an arc of energy at you!
|
||||
to.BoltEffect();
|
||||
to.LocalOverheadMessage(MessageType.Regular, 0xC9, true, "* Your body convulses from electric shock *");
|
||||
to.NonlocalOverheadMessage(MessageType.Regular, 0xC9, true, $"* {to.Name} spasms from electric shock *");
|
||||
|
||||
|
|
@ -358,7 +351,7 @@ namespace Server.Items
|
|||
hues[n.X, n.Y] = NodeHue.Blue;
|
||||
}
|
||||
|
||||
Node lastNode = path[path.Length - 1];
|
||||
Node lastNode = path[^1];
|
||||
hues[lastNode.X, lastNode.Y] = NodeHue.Red;
|
||||
|
||||
for (int i = 0; i < sideLength; i++)
|
||||
|
|
|
|||
|
|
@ -119,11 +119,7 @@ namespace Server.Items
|
|||
|
||||
private static void DeleteAll()
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
foreach (Item item in World.Items.Values)
|
||||
if (item is PublicMoongate)
|
||||
list.Add(item);
|
||||
List<Item> list = World.Items.Values.OfType<PublicMoongate>().Cast<Item>().ToList();
|
||||
|
||||
foreach (Item item in list)
|
||||
item.Delete();
|
||||
|
|
@ -349,7 +345,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 0) // Cancel
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -157,10 +157,7 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_Active)
|
||||
list.Add(1060742); // active
|
||||
else
|
||||
list.Add(1060743); // inactive
|
||||
list.Add(m_Active ? 1060742 : 1060743);
|
||||
|
||||
if (m_MapDest != null)
|
||||
list.Add(1060658, "Map\t{0}", m_MapDest);
|
||||
|
|
@ -234,12 +231,12 @@ namespace Server.Items
|
|||
bool sendEffect = !m.Hidden || m.AccessLevel == AccessLevel.Player;
|
||||
|
||||
if (m_SourceEffect && sendEffect)
|
||||
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
|
||||
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
|
||||
|
||||
m.MoveToWorld(p, map);
|
||||
|
||||
if (m_DestEffect && sendEffect)
|
||||
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
|
||||
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
|
||||
|
||||
if (m_SoundID > 0 && sendEffect)
|
||||
Effects.PlaySound(m.Location, m.Map, m_SoundID);
|
||||
|
|
@ -395,11 +392,10 @@ namespace Server.Items
|
|||
if (m.BeginAction(this))
|
||||
{
|
||||
if (m_MessageString != null)
|
||||
m.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", null,
|
||||
m_MessageString));
|
||||
Packets.SendUnicodeMessage(m.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", "",
|
||||
m_MessageString);
|
||||
else if (m_MessageNumber != 0)
|
||||
m.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber, null,
|
||||
""));
|
||||
Packets.SendMessageLocalized(m.NetState, Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => m.EndAction(this));
|
||||
}
|
||||
|
|
@ -525,12 +521,7 @@ namespace Server.Items
|
|||
if (!m.InRange(GetWorldLocation(), m_Range))
|
||||
return;
|
||||
|
||||
bool isMatch = false;
|
||||
|
||||
if (m_Keyword >= 0 && e.HasKeyword(m_Keyword))
|
||||
isMatch = true;
|
||||
else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0)
|
||||
isMatch = true;
|
||||
bool isMatch = m_Keyword >= 0 && e.HasKeyword(m_Keyword) || m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower()) >= 0;
|
||||
|
||||
if (!isMatch || !CanTeleport(m))
|
||||
return;
|
||||
|
|
@ -820,10 +811,10 @@ namespace Server.Items
|
|||
writer.Write(TimeoutDelay);
|
||||
writer.Write(m_Teleporting.Count);
|
||||
|
||||
foreach (KeyValuePair<Mobile, Timer> kvp in m_Teleporting)
|
||||
foreach (var (key, value) in m_Teleporting)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
writer.Write(kvp.Value.Next);
|
||||
writer.Write(key);
|
||||
writer.Write(value.Next);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1063,9 +1054,7 @@ namespace Server.Items
|
|||
case Layer.Backpack:
|
||||
case Layer.Mount:
|
||||
case Layer.Bank:
|
||||
{
|
||||
continue; // ignore
|
||||
}
|
||||
default:
|
||||
{
|
||||
m.SendMessage("You must remove all of your equipment before proceeding.");
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Server.Items
|
|||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, message, "");
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, message);
|
||||
|
||||
for (int i = items.Count - 1; i >= 0; --i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Items
|
|||
public void Carve(Mobile from, Item item)
|
||||
{
|
||||
Effects.PlaySound(GetWorldLocation(), Map, 0x48F);
|
||||
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0);
|
||||
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10);
|
||||
|
||||
if (0.3 > Utility.RandomDouble())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ namespace Server.Items
|
|||
if ((prop = Attributes.RegenMana) != 0)
|
||||
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
|
||||
|
||||
if ((prop = Attributes.NightSight) != 0)
|
||||
if (Attributes.NightSight != 0)
|
||||
list.Add(1060441); // night sight
|
||||
|
||||
if ((prop = Attributes.ReflectPhysical) != 0)
|
||||
|
|
|
|||
|
|
@ -54,10 +54,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
int number = Amount == 1 ? 1049122 : 1049121;
|
||||
|
||||
from.Send(
|
||||
new MessageLocalized(Serial, ItemID, MessageType.Label, 0x3B2, 3, number, "", (Amount * 50).ToString()));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x3B2, 3,
|
||||
Amount == 1 ? 1049122 : 1049121, "", (Amount * 50).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
int number = Amount == 1 ? 1049124 : 1049123;
|
||||
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString()));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x3B2, 3,
|
||||
Amount == 1 ? 1049124 : 1049123, "", Amount.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,10 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Resource >= CraftResource.SpinedLeather && m_Resource <= CraftResource.BarbedLeather)
|
||||
return 1049684 + (m_Resource - CraftResource.SpinedLeather);
|
||||
|
||||
return 1047022;
|
||||
}
|
||||
}
|
||||
public override int LabelNumber =>
|
||||
m_Resource >= CraftResource.SpinedLeather && m_Resource <= CraftResource.BarbedLeather
|
||||
? 1049684 + (m_Resource - CraftResource.SpinedLeather)
|
||||
: 1047022;
|
||||
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => true;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,8 @@ namespace Server.Items
|
|||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
int number = Amount == 1 ? 1049124 : 1049123;
|
||||
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString()));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, 0x3B2, 3,
|
||||
Amount == 1 ? 1049124 : 1049123, "", Amount.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Server.Items
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CampfireStatus Status
|
||||
{
|
||||
get
|
||||
get => ItemID switch
|
||||
{
|
||||
return ItemID switch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -233,21 +233,19 @@ namespace Server.Items
|
|||
bool xEast = false, ySouth = false;
|
||||
string fmt;
|
||||
|
||||
if (Sextant.Format(loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
|
||||
fmt = $"{yLat}°{yMins}'{(ySouth ? "S" : "N")},{xLong}°{xMins}'{(xEast ? "E" : "W")}";
|
||||
else
|
||||
fmt = "?????";
|
||||
fmt = Sextant.Format(loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth) ?
|
||||
$"{yLat}°{yMins}'{(ySouth ? "S" : "N")},{xLong}°{xMins}'{(xEast ? "E" : "W")}" : "?????";
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 40, 350, 300, 2520);
|
||||
|
||||
AddHtmlLocalized(30, 80, 285, 160, 1018326, true,
|
||||
true); /* This is a message hastily scribbled by a passenger aboard a sinking ship.
|
||||
* While it is probably too late to save the passengers and crew,
|
||||
* perhaps some treasure went down with the ship!
|
||||
* The message gives the ship's last known sextant co-ordinates.
|
||||
*/
|
||||
AddHtmlLocalized(30, 80, 285, 160, 1018326, true, true);
|
||||
/* This is a message hastily scribbled by a passenger aboard a sinking ship.
|
||||
* While it is probably too late to save the passengers and crew,
|
||||
* perhaps some treasure went down with the ship!
|
||||
* The message gives the ship's last known sextant co-ordinates.=
|
||||
*/
|
||||
|
||||
AddHtml(35, 240, 230, 20, fmt);
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ namespace Server.Items
|
|||
switch (Utility.Random(8))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
x = -1;
|
||||
y = -1;
|
||||
break;
|
||||
|
|
@ -405,4 +404,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,9 +159,7 @@ namespace Server.Items
|
|||
if (!(from is PlayerMobile pm))
|
||||
return;
|
||||
|
||||
ContextMenuEntry miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178);
|
||||
miningEntry.Color = 0x421F;
|
||||
list.Add(miningEntry);
|
||||
list.Add(new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178) {Color = 0x421F});
|
||||
|
||||
list.Add(new ToggleMiningStoneEntry(pm, false, 6176));
|
||||
list.Add(new ToggleMiningStoneEntry(pm, true, 6177));
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ namespace Server.Items
|
|||
from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning)
|
||||
{
|
||||
if (from.AccessLevel == AccessLevel.Player || !from.Hidden)
|
||||
from.Send(new PlaySound(0x20E, from.Location));
|
||||
Packets.SendPlaySound(from.NetState, 0x20E, from.Location);
|
||||
from.CloseGump<MoongateConfirmGump>();
|
||||
from.SendGump(new MoongateConfirmGump(from, this));
|
||||
}
|
||||
|
|
@ -381,7 +381,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_Gate.EndConfirmation(m_From);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@ namespace Server.Items
|
|||
|
||||
from.RevealingAction();
|
||||
|
||||
if (Users == null)
|
||||
Users = new List<Mobile>();
|
||||
Users ??= new List<Mobile>();
|
||||
|
||||
if (!Users.Contains(from))
|
||||
Users.Add(from);
|
||||
|
|
@ -169,7 +168,7 @@ namespace Server.Items
|
|||
|
||||
Effects.PlaySound(loc, map, 0x307);
|
||||
|
||||
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
|
||||
Effects.SendLocationEffect(loc, map, 0x36B0, 9);
|
||||
int alchemyBonus = 0;
|
||||
|
||||
if (direct)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Server.Items
|
|||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.BeginAction<LightCycle>())
|
||||
if (from.BeginAction<LightCycle.NightSightTimer>())
|
||||
{
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
|
|
@ -43,9 +43,7 @@ namespace Server.Items
|
|||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You already have nightsight.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,13 +355,9 @@ namespace Server.Items
|
|||
if (dropped is RecallRune rune)
|
||||
{
|
||||
if (IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
|
||||
}
|
||||
else if (IsOpen(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1005571); // You cannot place objects in the book while viewing the contents.
|
||||
}
|
||||
else if (Entries.Count < 16)
|
||||
{
|
||||
if (rune.Marked && rune.TargetMap != null)
|
||||
|
|
@ -370,12 +366,12 @@ namespace Server.Items
|
|||
|
||||
rune.Delete();
|
||||
|
||||
from.Send(new PlaySound(0x42, GetWorldLocation()));
|
||||
Packets.SendPlaySound(from.NetState, 0x42, GetWorldLocation());
|
||||
|
||||
string desc = rune.Description;
|
||||
|
||||
if (desc == null || (desc = desc.Trim()).Length == 0)
|
||||
desc = "(indescript)";
|
||||
desc = "(nondescript)";
|
||||
|
||||
from.SendMessage(desc);
|
||||
|
||||
|
|
@ -385,15 +381,13 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage(502409); // This rune does not have a marked location.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502401); // This runebook is full.
|
||||
}
|
||||
}
|
||||
else if (dropped is RecallScroll)
|
||||
{
|
||||
if (CurCharges < MaxCharges)
|
||||
{
|
||||
from.Send(new PlaySound(0x249, GetWorldLocation()));
|
||||
Packets.SendPlaySound(from.NetState, 0x259, GetWorldLocation());
|
||||
|
||||
int amount = dropped.Amount;
|
||||
|
||||
|
|
@ -411,9 +405,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502410); // This book already has the maximum amount of charges.
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ namespace Server.Items
|
|||
|
||||
scroll.Delete();
|
||||
|
||||
from.Send(new PlaySound(0x249, GetWorldLocation()));
|
||||
Packets.SendPlaySound(from.NetState, 0x249, GetWorldLocation());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -569,49 +569,16 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
if (Parent == null)
|
||||
{
|
||||
to.Send(WorldPacket);
|
||||
}
|
||||
SendWorldPacketFor(ns);
|
||||
else if (Parent is Item)
|
||||
{
|
||||
// What will happen if the client doesn't know about our parent?
|
||||
if (ns.ContainerGridLines)
|
||||
to.Send(new ContainerContentUpdate6017(this));
|
||||
else
|
||||
to.Send(new ContainerContentUpdate(this));
|
||||
}
|
||||
Packets.SendContainerContentUpdate(ns, this);
|
||||
else if (Parent is Mobile)
|
||||
{
|
||||
// What will happen if the client doesn't know about our parent?
|
||||
to.Send(new EquipUpdate(this));
|
||||
}
|
||||
Packets.SendEquipUpdate(ns, this);
|
||||
|
||||
if (ns.HighSeas)
|
||||
to.Send(new DisplaySpellbookHS(this));
|
||||
else
|
||||
to.Send(new DisplaySpellbook(this));
|
||||
|
||||
if (ObjectPropertyList.Enabled)
|
||||
{
|
||||
if (ns.NewSpellbook)
|
||||
{
|
||||
to.Send(new NewSpellbookContent(this, ItemID, BookOffset + 1, m_Content));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ns.ContainerGridLines)
|
||||
to.Send(new SpellbookContent6017(SpellCount, BookOffset + 1, m_Content, this));
|
||||
else
|
||||
to.Send(new SpellbookContent(SpellCount, BookOffset + 1, m_Content, this));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ns.ContainerGridLines)
|
||||
to.Send(new SpellbookContent6017(SpellCount, BookOffset + 1, m_Content, this));
|
||||
else
|
||||
to.Send(new SpellbookContent(SpellCount, BookOffset + 1, m_Content, this));
|
||||
}
|
||||
Packets.SendDisplayContainer(ns, Serial);
|
||||
Packets.SendSpellbookContent(ns, Serial, ItemID, BookOffset + 1, m_Content);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
|
|
@ -810,11 +777,9 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
if (Attributes == null)
|
||||
Attributes = new AosAttributes(this);
|
||||
Attributes ??= new AosAttributes(this);
|
||||
|
||||
if (SkillBonuses == null)
|
||||
SkillBonuses = new AosSkillBonuses(this);
|
||||
SkillBonuses ??= new AosSkillBonuses(this);
|
||||
|
||||
if (Core.AOS && Parent is Mobile mobile)
|
||||
SkillBonuses.AddTo(mobile);
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ namespace Server.Items
|
|||
double toHeal = min + Utility.RandomDouble() * (max - min);
|
||||
|
||||
if (Patient.Body.IsMonster || Patient.Body.IsAnimal)
|
||||
toHeal += Patient.HitsMax / 100;
|
||||
toHeal += Patient.HitsMax / 100.0;
|
||||
|
||||
if (Core.AOS)
|
||||
toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm
|
||||
|
|
|
|||
|
|
@ -79,9 +79,8 @@ namespace Server.Items
|
|||
from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);
|
||||
|
||||
from.PlaySound(0x15F);
|
||||
Effects.SendPacket(from, from.Map,
|
||||
new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0,
|
||||
0));
|
||||
|
||||
Effects.SendMovingEffect(from, loc, from.Map, 0x36D4, 5, 0, false, true);
|
||||
|
||||
IPooledEnumerable<Mobile> eable = from.Map.GetMobilesInRange(new Point3D(loc), 2);
|
||||
|
||||
|
|
@ -92,11 +91,9 @@ namespace Server.Items
|
|||
|| Core.AOS && !from.InLOS(m))
|
||||
return false;
|
||||
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
playerVsPlayer |= m.Player;
|
||||
|
||||
return true;
|
||||
|
||||
}).ToList();
|
||||
|
||||
eable.Free();
|
||||
|
|
|
|||
|
|
@ -406,13 +406,8 @@ namespace Server.Items
|
|||
number = 1041000;
|
||||
}
|
||||
|
||||
if (attrs.Count == 0 && Crafter == null && Name != null)
|
||||
return;
|
||||
|
||||
EquipmentInfo eqInfo = new EquipmentInfo(number, m_Crafter, false,
|
||||
attrs.ToArray());
|
||||
|
||||
from.Send(new DisplayEquipmentInfo(this, eqInfo));
|
||||
if (attrs.Count > 0 || Crafter != null || Name == null)
|
||||
EquipmentPackets.SendDisplayEquipmentInfo(from.NetState, this, number, m_Crafter, false, attrs);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Mobiles;
|
|||
namespace Server.Items
|
||||
{
|
||||
[Flippable(0x2790, 0x27DB)]
|
||||
public class LeatherNinjaBelt : BaseWaist, IDyable, INinjaWeapon
|
||||
public class LeatherNinjaBelt : BaseWaist, INinjaWeapon
|
||||
{
|
||||
private Poison m_Poison;
|
||||
private int m_PoisonCharges;
|
||||
|
|
@ -27,18 +27,18 @@ namespace Server.Items
|
|||
|
||||
public override CraftResource DefaultResource => CraftResource.RegularLeather;
|
||||
|
||||
public virtual int WrongAmmoMessage => 1063301; //You can only place shuriken in a ninja belt.
|
||||
public virtual int NoFreeHandMessage => 1063299; //You must have a free hand to throw shuriken.
|
||||
public virtual int EmptyWeaponMessage => 1063297; //You have no shuriken in your ninja belt!
|
||||
public virtual int RecentlyUsedMessage => 1063298; //You cannot throw another shuriken yet.
|
||||
public virtual int FullWeaponMessage => 1063302; //You cannot add any more shuriken.
|
||||
public int WrongAmmoMessage => 1063301; //You can only place shuriken in a ninja belt.
|
||||
public int NoFreeHandMessage => 1063299; //You must have a free hand to throw shuriken.
|
||||
public int EmptyWeaponMessage => 1063297; //You have no shuriken in your ninja belt!
|
||||
public int RecentlyUsedMessage => 1063298; //You cannot throw another shuriken yet.
|
||||
public int FullWeaponMessage => 1063302; //You cannot add any more shuriken.
|
||||
|
||||
public virtual int WeaponMinRange => 2;
|
||||
public virtual int WeaponMaxRange => 10;
|
||||
public int WeaponMinRange => 2;
|
||||
public int WeaponMaxRange => 10;
|
||||
|
||||
public virtual int WeaponDamage => Utility.RandomMinMax(3, 5);
|
||||
public int WeaponDamage => Utility.RandomMinMax(3, 5);
|
||||
|
||||
public virtual Type AmmoType => typeof(Shuriken);
|
||||
public Type AmmoType => typeof(Shuriken);
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
|
|
@ -81,7 +81,8 @@ namespace Server.Items
|
|||
|
||||
public void AttackAnimation(Mobile from, Mobile to)
|
||||
{
|
||||
if (from.Body.IsHuman) from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
|
||||
if (from.Body.IsHuman)
|
||||
from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);
|
||||
|
||||
from.PlaySound(0x23A);
|
||||
from.MovingEffect(to, 0x27AC, 1, 0, false, false);
|
||||
|
|
@ -156,4 +157,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Server.HuePickers;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
@ -31,12 +30,10 @@ namespace Server.Items
|
|||
|
||||
writer.Write(timerCount);
|
||||
|
||||
foreach (KeyValuePair<Mobile, Timer> entry in DisguiseTimers.Timers)
|
||||
foreach (var (m, value) in DisguiseTimers.Timers)
|
||||
{
|
||||
Mobile m = entry.Key;
|
||||
|
||||
writer.Write(m);
|
||||
writer.Write(entry.Value.Next - DateTime.UtcNow);
|
||||
writer.Write(value.Next - DateTime.UtcNow);
|
||||
writer.Write(m.NameMod);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ namespace Server.Items
|
|||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
|
||||
1008155); // You peer into the heavens, seeking the moons...
|
||||
|
||||
from.Send(new MessageLocalizedAffix(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3,
|
||||
1008146 + (int)Clock.GetMoonPhase(Map.Trammel, from.X, from.Y), "", AffixType.Prepend, "Trammel : ", ""));
|
||||
from.Send(new MessageLocalizedAffix(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3,
|
||||
1008146 + (int)Clock.GetMoonPhase(Map.Felucca, from.X, from.Y), "", AffixType.Prepend, "Felucca : ", ""));
|
||||
Packets.SendMessageLocalizedAffix(from.NetState, from.Serial, from.Body, MessageType.Regular, 0x3B2, 3,
|
||||
1008146 + (int)Clock.GetMoonPhase(Map.Trammel, from.X, from.Y), "", AffixType.Prepend, "Trammel : ");
|
||||
Packets.SendMessageLocalizedAffix(from.NetState, from.Serial, from.Body, MessageType.Regular, 0x3B2, 3,
|
||||
1008146 + (int)Clock.GetMoonPhase(Map.Felucca, from.X, from.Y), "", AffixType.Prepend, "Felucca : ");
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
|
|
@ -33,7 +33,7 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
FindIngredientObjective obj = qs.FindObjective<FindIngredientObjective>();
|
||||
|
||||
|
||||
if (obj?.Completed == false && obj.Ingredient == Ingredient.StarChart)
|
||||
{
|
||||
Clock.GetTime(from.Map, from.X, from.Y, out int hours, out int _);
|
||||
|
|
@ -68,4 +68,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,6 @@ using Server.Network;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public sealed class StopMusic : Packet
|
||||
{
|
||||
public static readonly Packet Instance = SetStatic(new StopMusic());
|
||||
|
||||
public StopMusic() : base(0x6D, 3)
|
||||
{
|
||||
m_Stream.Write((short)0x1FFF);
|
||||
}
|
||||
}
|
||||
|
||||
[Flippable(0x2AF9, 0x2AFD)]
|
||||
public class DawnsMusicBox : Item, ISecurable
|
||||
{
|
||||
|
|
@ -158,7 +148,7 @@ namespace Server.Items
|
|||
else
|
||||
m_ItemID = ItemID;
|
||||
|
||||
m.Send(new PlayMusic(music));
|
||||
Packets.SendPlayMusic(m.NetState, music);
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 4, Animate);
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +157,7 @@ namespace Server.Items
|
|||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
|
||||
m.Send(StopMusic.Instance);
|
||||
Packets.SendStopMusic(m.NetState);
|
||||
|
||||
if (m_Count > 0)
|
||||
ItemID = m_ItemID;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace Server.Items
|
|||
Point3D location = Location;
|
||||
location.Z += 10;
|
||||
|
||||
Effects.SendLocationEffect(location, Map, 0x3709, 10, 10, 0x356, 0);
|
||||
Effects.SendLocationEffect(location, Map, 0x3709, 10, 10, 0x356);
|
||||
Effects.PlaySound(location, Map, 0x32E);
|
||||
|
||||
if (Items.Count > 0)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Server.Accounting;
|
||||
|
|
@ -290,22 +291,9 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
private bool HasEntered(Mobile from)
|
||||
{
|
||||
if (!(from.Account is Account acc))
|
||||
return false;
|
||||
|
||||
foreach (RaffleEntry entry in Entries)
|
||||
if (entry.From != null)
|
||||
{
|
||||
Account entryAcc = entry.From.Account as Account;
|
||||
|
||||
if (entryAcc == acc)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
private bool HasEntered(Mobile from) =>
|
||||
from.Account is Account acc &&
|
||||
(from entry in Entries select entry.From?.Account as Account).Any(entryAcc => entryAcc == acc);
|
||||
|
||||
private bool IsAtIPLimit(Mobile from)
|
||||
{
|
||||
|
|
@ -315,12 +303,7 @@ namespace Server.Items
|
|||
IPAddress address = from.NetState.Address;
|
||||
int tickets = 0;
|
||||
|
||||
foreach (RaffleEntry entry in Entries)
|
||||
if (Utility.IPMatchClassC(entry.Address, address))
|
||||
if (++tickets >= EntryLimitPerIP)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return Entries.Where(entry => Utility.IPMatchClassC(entry.Address, address)).Any(entry => ++tickets >= EntryLimitPerIP);
|
||||
}
|
||||
|
||||
public static string FormatLocation(Point3D loc, Map map, bool displayMap)
|
||||
|
|
|
|||
|
|
@ -219,54 +219,34 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
if (from.Region.IsPartOf<Jail>())
|
||||
{
|
||||
from.SendMessage("You may not do that in jail.");
|
||||
}
|
||||
else if (!m_Bag.IsChildOf(from.Backpack))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1062334,
|
||||
0x59); // The bag of sending must be in your backpack. 1054107 is gone from client, using generic response
|
||||
}
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054107,
|
||||
0x59); // This item must be in your backpack.
|
||||
else if (m_Bag.Charges == 0)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1042544, 0x59); // This item is out of charges.
|
||||
}
|
||||
else if (targeted is Item item)
|
||||
{
|
||||
int reqCharges = (int)Math.Max(1, Math.Ceiling(item.TotalWeight / 10.0));
|
||||
|
||||
if (!item.IsChildOf(from.Backpack))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054152,
|
||||
0x59); // You may only send items from your backpack to your bank box.
|
||||
}
|
||||
else if (item is BagOfSending || item is Container)
|
||||
{
|
||||
from.Send(new AsciiMessage(m_Bag.Serial, m_Bag.ItemID, MessageType.Regular, 0x3B2, 3, "",
|
||||
"You cannot send a container through the bag of sending."));
|
||||
}
|
||||
Packets.SendAsciiMessage(from.NetState, m_Bag.Serial, m_Bag.ItemID, MessageType.Regular, 0x3B2, 3, "",
|
||||
"You cannot send a container through the bag of sending." );
|
||||
else if (item.LootType == LootType.Cursed)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054108,
|
||||
0x59); // The bag of sending rejects the cursed item.
|
||||
}
|
||||
else if (!item.VerifyMove(from) || item is QuestItem || item.Nontransferable)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054109,
|
||||
0x59); // The bag of sending rejects that item.
|
||||
}
|
||||
else if (SpellHelper.IsDoomGauntlet(from.Map, from.Location))
|
||||
{
|
||||
from.SendLocalizedMessage(1062089); // You cannot use that here.
|
||||
}
|
||||
else if (!from.BankBox.TryDropItem(from, item, false))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054110, 0x59); // Your bank box is full.
|
||||
}
|
||||
else if (Core.ML && reqCharges > m_Bag.Charges)
|
||||
{
|
||||
from.SendLocalizedMessage(1079932); //You don't have enough charges to send that much weight
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Bag.Charges -= Core.ML ? reqCharges : 1;
|
||||
|
|
@ -278,4 +258,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,41 +177,27 @@ namespace Server.Items
|
|||
return;
|
||||
|
||||
if (Charges == 0)
|
||||
{
|
||||
SendLocalizedMessageTo(from,
|
||||
1054122); // The Crystal Ball darkens. It must be charged before it can be used again.
|
||||
}
|
||||
else if (pet is BaseMount mount && mount.Rider == from)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1054124,
|
||||
0x36); // The Crystal Ball fills with a yellow mist. Why would you summon your pet while riding it?
|
||||
}
|
||||
else if (pet.Map == Map.Internal && (!pet.IsStabled || from.Followers + pet.ControlSlots > from.FollowersMax))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1054125,
|
||||
0x5); // The Crystal Ball fills with a blue mist. Your pet is not responding to the summons.
|
||||
}
|
||||
else if ((!pet.Controlled || pet.ControlMaster != from) && !from.Stabled.Contains(pet))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1054126,
|
||||
0x8FD); // The Crystal Ball fills with a grey mist. You are not the owner of the pet you are attempting to summon.
|
||||
}
|
||||
else if (!pet.IsBonded)
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1054127,
|
||||
0x22); // The Crystal Ball fills with a red mist. You appear to have let your bond to your pet deteriorate.
|
||||
}
|
||||
else if (from.Map == Map.Ilshenar || from.Region.IsPartOf<DungeonRegion>() ||
|
||||
from.Region.IsPartOf<Jail>() || from.Region.IsPartOf<SafeZone>())
|
||||
{
|
||||
from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0x22, 3, "",
|
||||
"You cannot summon your pet to this location."));
|
||||
}
|
||||
Packets.SendAsciiMessage(from.NetState, Serial, ItemID, MessageType.Regular, 0x22, 3, "",
|
||||
"You cannot summon your pet to this location.");
|
||||
else if (Core.ML && from is PlayerMobile mobile && DateTime.UtcNow < mobile.LastPetBallTime.AddSeconds(15.0))
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo(this, mobile, 1080072,
|
||||
0x22); // You must wait a few seconds before you can summon your pet.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Core.ML)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using Server.Factions;
|
|||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class MessageHelper
|
||||
{
|
||||
public static void SendLocalizedMessageTo(Item from, Mobile to, int number, int hue)
|
||||
{
|
||||
SendLocalizedMessageTo(from, to, number, "", hue);
|
||||
}
|
||||
|
||||
public static void SendLocalizedMessageTo(Item from, Mobile to, int number, string args, int hue)
|
||||
{
|
||||
to.Send(new MessageLocalized(from.Serial, from.ItemID, MessageType.Regular, hue, 3, number, "", args));
|
||||
}
|
||||
|
||||
public static void SendMessageTo(Item from, Mobile to, string text, int hue)
|
||||
{
|
||||
to.Send(new UnicodeMessage(from.Serial, from.ItemID, MessageType.Regular, hue, 3, "ENU", "", text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Accounting;
|
||||
using Server.Engines.VeteranRewards;
|
||||
using Server.Factions;
|
||||
|
|
@ -579,7 +580,6 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
SkillName skill = m_Stone.Skill;
|
||||
double skillValue = m_Stone.SkillValue;
|
||||
Skill fromSkill = from.Skills[m_Stone.Skill];
|
||||
|
||||
|
|
@ -589,27 +589,8 @@ namespace Server.Items
|
|||
*/
|
||||
int requiredAmount = (int)(skillValue * 10) - fromSkill.BaseFixedPoint - (from.SkillsCap - from.SkillsTotal);
|
||||
|
||||
bool cannotAbsorb = false;
|
||||
|
||||
if (fromSkill.Lock != SkillLock.Up)
|
||||
{
|
||||
cannotAbsorb = true;
|
||||
}
|
||||
else if (requiredAmount > 0)
|
||||
{
|
||||
int available = 0;
|
||||
|
||||
for (int i = 0; i < from.Skills.Length; ++i)
|
||||
{
|
||||
if (from.Skills[i].Lock != SkillLock.Down)
|
||||
continue;
|
||||
|
||||
available += from.Skills[i].BaseFixedPoint;
|
||||
}
|
||||
|
||||
if (requiredAmount > available)
|
||||
cannotAbsorb = true;
|
||||
}
|
||||
bool cannotAbsorb = fromSkill.Lock != SkillLock.Up || requiredAmount > 0 &&
|
||||
requiredAmount > from.Skills.Where(t => t.Lock == SkillLock.Down).Sum(t => t.BaseFixedPoint);
|
||||
|
||||
if (cannotAbsorb)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -81,10 +81,12 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
public override int Message =>
|
||||
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
|
||||
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
|
||||
* You can view your maximum skill values in your skills window.
|
||||
* You can view your maximum statistic value in your statistics window. */
|
||||
1049469;
|
||||
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
|
||||
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
|
||||
* You can view your maximum skill values in your skills window.
|
||||
* You can view your maximum statistic value in your statistics window.
|
||||
*/
|
||||
|
||||
public override int Title
|
||||
{
|
||||
|
|
@ -93,10 +95,12 @@ namespace Server.Items
|
|||
double level = (Value - 105.0) / 5.0;
|
||||
|
||||
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
|
||||
return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR
|
||||
* Exalted Scroll (110 Skill): OR
|
||||
* Mythical Scroll (115 Skill): OR
|
||||
* Legendary Scroll (120 Skill): */
|
||||
return 1049635 + (int)level;
|
||||
/* Wonderous Scroll (105 Skill): OR
|
||||
* Exalted Scroll (110 Skill): OR
|
||||
* Mythical Scroll (115 Skill): OR
|
||||
* Legendary Scroll (120 Skill):
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -154,10 +158,12 @@ namespace Server.Items
|
|||
double level = (Value - 105.0) / 5.0;
|
||||
|
||||
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
|
||||
list.Add(1049639 + (int)level, GetNameLocalized()); /* a wonderous scroll of ~1_type~ (105 Skill) OR
|
||||
* an exalted scroll of ~1_type~ (110 Skill) OR
|
||||
* a mythical scroll of ~1_type~ (115 Skill) OR
|
||||
* a legendary scroll of ~1_type~ (120 Skill) */
|
||||
list.Add(1049639 + (int)level, GetNameLocalized());
|
||||
/* a wonderous scroll of ~1_type~ (105 Skill) OR
|
||||
* an exalted scroll of ~1_type~ (110 Skill) OR
|
||||
* a mythical scroll of ~1_type~ (115 Skill) OR
|
||||
* a legendary scroll of ~1_type~ (120 Skill)
|
||||
*/
|
||||
else
|
||||
list.Add("a power scroll of {0} ({1} Skill)", GetName(), Value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Engines.MLQuests;
|
||||
using Server.Engines.MLQuests.Objectives;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -21,9 +22,11 @@ namespace Server.Items
|
|||
public override int LabelNumber => 1078604; // Scroll of Alacrity
|
||||
|
||||
public override int Message =>
|
||||
1078602; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
|
||||
*level in that skill by the amount of points displayed on the scroll.
|
||||
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
|
||||
1078602;
|
||||
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
|
||||
* level in that skill by the amount of points displayed on the scroll.
|
||||
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
|
||||
*/
|
||||
|
||||
public override string DefaultTitle => "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>";
|
||||
|
||||
|
|
@ -74,8 +77,10 @@ namespace Server.Items
|
|||
if (tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
|
||||
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
|
||||
1094935);
|
||||
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
|
||||
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Engines.MLQuests;
|
||||
using Server.Engines.MLQuests.Objectives;
|
||||
using Server.Mobiles;
|
||||
|
|
@ -21,9 +22,11 @@ namespace Server.Items
|
|||
public override int LabelNumber => 1094934; // Scroll of Transcendence
|
||||
|
||||
public override int Message =>
|
||||
1094933; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
|
||||
*level in that skill by the amount of points displayed on the scroll.
|
||||
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
|
||||
1094933;
|
||||
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
|
||||
* level in that skill by the amount of points displayed on the scroll.
|
||||
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
|
||||
*/
|
||||
|
||||
public override string DefaultTitle =>
|
||||
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
|
||||
|
|
@ -112,8 +115,10 @@ namespace Server.Items
|
|||
if (!canGain)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
|
||||
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
|
||||
1094935);
|
||||
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
|
||||
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ namespace Server.Items
|
|||
AddHtmlLocalized(310, 20, 120, 20, AosSkillBonuses.GetLabel(m_Scroll.Skill), 0xFFFFFF);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (info.ButtonID == 1)
|
||||
m_Scroll.Use(m_Mobile);
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
public override int Message =>
|
||||
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
|
||||
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
|
||||
* You can view your maximum skill values in your skills window.
|
||||
* You can view your maximum statistic value in your statistics window. */
|
||||
1049469;
|
||||
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
|
||||
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
|
||||
* You can view your maximum skill values in your skills window.
|
||||
* You can view your maximum statistic value in your statistics window.
|
||||
*/
|
||||
|
||||
public override int Title
|
||||
{
|
||||
|
|
@ -24,11 +26,13 @@ namespace Server.Items
|
|||
int level = ((int)Value - 230) / 5;
|
||||
|
||||
if (level >= 0 && level <= 4 && Value % 5 == 0)
|
||||
return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR
|
||||
* Exalted Scroll (+10 Maximum Stats): OR
|
||||
* Mythical Scroll (+15 Maximum Stats): OR
|
||||
* Legendary Scroll (+20 Maximum Stats): OR
|
||||
* Ultimate Scroll (+25 Maximum Stats): */
|
||||
return 1049458 + level;
|
||||
/* Wonderous Scroll (+5 Maximum Stats): OR
|
||||
* Exalted Scroll (+10 Maximum Stats): OR
|
||||
* Mythical Scroll (+15 Maximum Stats): OR
|
||||
* Legendary Scroll (+20 Maximum Stats): OR
|
||||
* Ultimate Scroll (+25 Maximum Stats):
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -42,11 +46,13 @@ namespace Server.Items
|
|||
int level = ((int)Value - 230) / 5;
|
||||
|
||||
if (level >= 0 && level <= 4 && (int)Value % 5 == 0)
|
||||
list.Add(1049463 + level, "#1049476"); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
|
||||
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
|
||||
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
|
||||
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
|
||||
* an ultimate scroll of ~1_type~ (+25 Maximum Stats) */
|
||||
list.Add(1049463 + level, "#1049476");
|
||||
/* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
|
||||
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
|
||||
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
|
||||
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
|
||||
* an ultimate scroll of ~1_type~ (+25 Maximum Stats)
|
||||
*/
|
||||
else
|
||||
list.Add("a scroll of power ({0}{1} Maximum Stats)", Value - 225 >= 0 ? "+" : "", Value - 225);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if (info.ButtonID == 1 || info.ButtonID == 2)
|
||||
{
|
||||
|
|
@ -147,9 +147,10 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile mobile) mobile.AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours(1);
|
||||
if (from is PlayerMobile mobile)
|
||||
mobile.AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours(1);
|
||||
|
||||
base.OnResponse(state, info);
|
||||
base.OnResponse(sender, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue