fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350)
This commit is contained in:
parent
22376cfc20
commit
42012538bc
177 changed files with 994 additions and 1262 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
*************************************************************************/
|
||||
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Microsoft.Toolkit.HighPerformance;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Server.Gumps;
|
|||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using Server.Factions;
|
|||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Bushido;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Text;
|
|||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Text;
|
|||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
public class TournamentBracketItem : Item
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.ConPVP
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Engines.Doom
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics
|
||||
{
|
||||
public abstract class Power
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Evil
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Ethics.Evil
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Evil
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Evil
|
||||
{
|
||||
public sealed class UnholyShield : Power
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Evil
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Ethics.Hero
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Buffers;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Hero
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Hero
|
||||
{
|
||||
public sealed class HolyShield : Power
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Hero
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Ethics.Hero
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Factions;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.IO;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using Server.Factions.AI;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace Server.Factions
|
|||
private const int ManaReserve = 30;
|
||||
private readonly BaseFactionGuard m_Guard;
|
||||
|
||||
private BandageContext m_Bandage;
|
||||
private BandageContext _bandage;
|
||||
private DateTime m_BandageStart;
|
||||
|
||||
private SpellCombo m_Combo;
|
||||
|
|
@ -123,21 +123,21 @@ namespace Server.Factions
|
|||
{
|
||||
get
|
||||
{
|
||||
if (m_Bandage != null && m_Bandage.Timer == null)
|
||||
if (_bandage != null && !_bandage.Running)
|
||||
{
|
||||
m_Bandage = null;
|
||||
_bandage = null;
|
||||
}
|
||||
|
||||
if (m_Bandage == null)
|
||||
if (_bandage == null)
|
||||
{
|
||||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
var ts = m_BandageStart + m_Bandage.Timer.Delay - Core.Now;
|
||||
var ts = m_BandageStart + _bandage.Delay - Core.Now;
|
||||
|
||||
if (ts < TimeSpan.FromSeconds(-1.0))
|
||||
{
|
||||
m_Bandage = null;
|
||||
_bandage = null;
|
||||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
|
|
@ -174,16 +174,15 @@ namespace Server.Factions
|
|||
|
||||
public bool StartBandage()
|
||||
{
|
||||
m_Bandage = null;
|
||||
_bandage = null;
|
||||
|
||||
if (m_Guard.Backpack?.FindItemByType<Bandage>() == null)
|
||||
if (m_Guard.Backpack?.FindItemByType<Bandage>() != null)
|
||||
{
|
||||
return false;
|
||||
_bandage = BandageContext.BeginHeal(m_Guard, m_Guard);
|
||||
m_BandageStart = Core.Now;
|
||||
}
|
||||
|
||||
m_Bandage = BandageContext.BeginHeal(m_Guard, m_Guard);
|
||||
m_BandageStart = Core.Now;
|
||||
return m_Bandage != null;
|
||||
return _bandage != null;
|
||||
}
|
||||
|
||||
public bool UseItemByType(Type type)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.Harvest
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.MLQuests.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Server.Engines.MLQuests;
|
||||
using Server.Engines.MLQuests.Definitions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.MLQuests.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using Server.Engines.MLQuests.Objectives;
|
|||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Engines.MLQuests
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Server.Engines.MLQuests.Definitions;
|
|||
using Server.Engines.MLQuests.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.MLQuests.Mobiles
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Utilities;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Collector
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Ninja
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Logging;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Doom
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Server.Engines.Help;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Haven
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Hag
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Runtime.CompilerServices;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ public partial class BaseArmor
|
|||
_identified = content.Identified;
|
||||
_maxHitPoints = content.MaxHitPoints ?? 0;
|
||||
_hitPoints = content.HitPoints ?? 0;
|
||||
var crafter = content.Crafter;
|
||||
Timer.StartTimer(() => _crafter = crafter?.RawName);
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, content.Crafter);
|
||||
_quality = content.Quality ?? ArmorQuality.Regular;
|
||||
_durability = content.Durability ?? ArmorDurabilityLevel.Regular;
|
||||
_resource = content.RawResource ?? DefaultResource;
|
||||
|
|
@ -91,8 +90,7 @@ public partial class BaseArmor
|
|||
|
||||
if (GetSaveFlag(flags, OldSaveFlag.Crafter))
|
||||
{
|
||||
var crafter = reader.ReadEntity<Mobile>();
|
||||
Timer.StartTimer(() => _crafter = crafter?.RawName);
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, OldSaveFlag.Quality))
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ public partial class BaseClothing
|
|||
_resistances = content.Resistances ?? ResistancesDefaultValue();
|
||||
_maxHitPoints = content.MaxHitPoints ?? 0;
|
||||
_playerConstructed = content.PlayerConstructed;
|
||||
var crafter = content.Crafter;
|
||||
Timer.StartTimer(() => _crafter = crafter?.RawName);
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, content.Crafter);
|
||||
_quality = content.Quality ?? ClothingQuality.Regular;
|
||||
_strReq = content.StrRequirement ?? -1;
|
||||
}
|
||||
|
|
@ -71,8 +70,7 @@ public partial class BaseClothing
|
|||
|
||||
if (GetSaveFlag(flags, OldSaveFlag.Crafter))
|
||||
{
|
||||
var crafter = reader.ReadEntity<Mobile>();
|
||||
Timer.StartTimer(() => _crafter = crafter?.RawName);
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
}
|
||||
|
||||
if (GetSaveFlag(flags, OldSaveFlag.Quality))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using ModernUO.Serialization;
|
|||
using Server.ContextMenus;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ public partial class DragonBardingDeed : Item, ICraftable
|
|||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
_exceptional = reader.ReadBool();
|
||||
var crafter = reader.ReadEntity<Mobile>();
|
||||
Timer.StartTimer(() => _craftedBy = crafter?.RawName);
|
||||
Timer.DelayCall((item, crafter) => item._craftedBy = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
|
||||
if (version < 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using Server.Engines.Quests.Hag;
|
|||
using Server.Engines.Quests.Matriarch;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells.Ninjitsu;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Fourth;
|
||||
using Server.Targeting;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using ModernUO.Serialization;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ public partial class BaseQuiver : Container, ICraftable, IAosItem
|
|||
|
||||
if ((flags & 0x10) != 0)
|
||||
{
|
||||
_crafter = reader.ReadEntity<Mobile>()?.RawName;
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
}
|
||||
|
||||
if ((flags & 0x20) != 0)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public partial class TrophyAddon : Item, IAddon
|
|||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
_hunter = reader.ReadEntity<Mobile>()?.RawName;
|
||||
Timer.DelayCall((item, crafter) => item._hunter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
_animalWeight = reader.ReadInt();
|
||||
_westId = reader.ReadInt();
|
||||
_northId = reader.ReadInt();
|
||||
|
|
@ -355,7 +355,7 @@ public partial class TrophyDeed : Item
|
|||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
_hunter = reader.ReadEntity<Mobile>()?.RawName;
|
||||
Timer.DelayCall((item, crafter) => item._hunter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
_animalWeight = reader.ReadInt();
|
||||
_westId = reader.ReadInt();
|
||||
_northId = reader.ReadInt();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
|||
using ModernUO.Serialization;
|
||||
using Server.ContextMenus;
|
||||
using Server.Engines.Harvest;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public partial class Runebook : Item, ISecurable, ICraftable
|
|||
base.Deserialize(reader);
|
||||
|
||||
_quality = (BookQuality)reader.ReadByte();
|
||||
_crafter = reader.ReadEntity<Mobile>()?.RawName;
|
||||
Timer.DelayCall(crafter => _crafter = crafter?.RawName, reader.ReadEntity<Mobile>());
|
||||
_level = (SecureLevel)reader.ReadInt();
|
||||
|
||||
var count = reader.ReadInt();
|
||||
|
|
|
|||
|
|
@ -831,7 +831,7 @@ public partial class Spellbook : Item, ICraftable, ISlayer, IAosItem
|
|||
{
|
||||
_quality = (BookQuality)reader.ReadByte();
|
||||
_engravedText = reader.ReadString();
|
||||
_crafter = reader.ReadEntity<Mobile>()?.RawName;
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
_slayer = (SlayerName)reader.ReadInt();
|
||||
_slayer2 = (SlayerName)reader.ReadInt();
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,245 +1,227 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0)]
|
||||
public partial class FireHorn : Item
|
||||
{
|
||||
public class FireHorn : Item
|
||||
[Constructible]
|
||||
public FireHorn() : base(0xFC7)
|
||||
{
|
||||
[Constructible]
|
||||
public FireHorn() : base(0xFC7)
|
||||
Hue = 0x466;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1060456; // fire horn
|
||||
|
||||
private bool CheckUse(Mobile from)
|
||||
{
|
||||
if (!IsAccessibleTo(from))
|
||||
{
|
||||
Hue = 0x466;
|
||||
Weight = 1.0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public FireHorn(Serial serial) : base(serial)
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1060456; // fire horn
|
||||
|
||||
private bool CheckUse(Mobile from)
|
||||
if (!from.CanBeginAction<FireHorn>())
|
||||
{
|
||||
if (!IsAccessibleTo(from))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!from.CanBeginAction<FireHorn>())
|
||||
{
|
||||
from.SendLocalizedMessage(1049615); // You must take a moment to catch your breath.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from.Backpack?.GetAmount(typeof(SulfurousAsh)) >= (Core.AOS ? 4 : 15))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
from.SendLocalizedMessage(1049615); // You must take a moment to catch your breath.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from.Backpack?.GetAmount(typeof(SulfurousAsh)) < (Core.AOS ? 4 : 15))
|
||||
{
|
||||
from.SendLocalizedMessage(1049617); // You do not have enough sulfurous ash.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (CheckUse(from))
|
||||
{
|
||||
if (CheckUse(from))
|
||||
from.SendLocalizedMessage(1049620); // Select an area to incinerate.
|
||||
from.Target = new InternalTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Use(Mobile from, Point3D loc)
|
||||
{
|
||||
if (!CheckUse(from))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from.BeginAction<FireHorn>();
|
||||
Timer.StartTimer(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0),
|
||||
() =>
|
||||
{
|
||||
from.SendLocalizedMessage(1049620); // Select an area to incinerate.
|
||||
from.Target = new InternalTarget(this);
|
||||
from.EndAction<FireHorn>();
|
||||
from.SendLocalizedMessage(1049621); // You catch your breath.
|
||||
}
|
||||
);
|
||||
|
||||
var music = from.Skills.Musicianship.Fixed;
|
||||
|
||||
var sucChance = 500 + (music - 775) * 2;
|
||||
var dSucChance = sucChance / 1000.0;
|
||||
|
||||
if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
|
||||
{
|
||||
from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
|
||||
from.PlaySound(0x18A);
|
||||
return;
|
||||
}
|
||||
|
||||
var sulfAsh = Core.AOS ? 4 : 15;
|
||||
from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);
|
||||
|
||||
from.PlaySound(0x15F);
|
||||
Effects.SendMovingEffect(
|
||||
from,
|
||||
loc,
|
||||
0x36D4,
|
||||
5,
|
||||
0,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
var playerVsPlayer = false;
|
||||
var eable = from.Map.GetMobilesInRange(loc, 2);
|
||||
|
||||
using var targets = PooledRefQueue<Mobile>.Create();
|
||||
foreach (var m in eable)
|
||||
{
|
||||
if (from != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) &&
|
||||
(!Core.AOS || from.InLOS(m)))
|
||||
{
|
||||
targets.Enqueue(m);
|
||||
|
||||
if (m.Player)
|
||||
{
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Use(Mobile from, Point3D loc)
|
||||
eable.Free();
|
||||
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
if (!CheckUse(from))
|
||||
var prov = from.Skills.Provocation.Fixed;
|
||||
var disc = from.Skills.Discordance.Fixed;
|
||||
var peace = from.Skills.Peacemaking.Fixed;
|
||||
|
||||
int minDamage, maxDamage;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
var musicScaled = music + Math.Max(0, music - 900) * 2;
|
||||
var provScaled = prov + Math.Max(0, prov - 900) * 2;
|
||||
var discScaled = disc + Math.Max(0, disc - 900) * 2;
|
||||
var peaceScaled = peace + Math.Max(0, peace - 900) * 2;
|
||||
|
||||
var weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;
|
||||
|
||||
int avgDamage;
|
||||
if (playerVsPlayer)
|
||||
{
|
||||
avgDamage = weightAvg / 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
avgDamage = weightAvg / 2;
|
||||
}
|
||||
|
||||
minDamage = avgDamage * 9 / 10;
|
||||
maxDamage = avgDamage * 10 / 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
var total = prov + disc / 5 + peace / 5;
|
||||
|
||||
if (playerVsPlayer)
|
||||
{
|
||||
total /= 3;
|
||||
}
|
||||
|
||||
maxDamage = total * 2 / 30;
|
||||
minDamage = maxDamage * 7 / 10;
|
||||
}
|
||||
|
||||
double damage = Utility.RandomMinMax(minDamage, maxDamage);
|
||||
|
||||
if (Core.AOS && targets.Count > 1)
|
||||
{
|
||||
damage = damage * 2 / targets.Count;
|
||||
}
|
||||
else if (!Core.AOS)
|
||||
{
|
||||
damage /= targets.Count;
|
||||
}
|
||||
|
||||
while (targets.Count > 0)
|
||||
{
|
||||
var m = targets.Dequeue();
|
||||
|
||||
var toDeal = damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0))
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
from.DoHarmful(m);
|
||||
SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);
|
||||
|
||||
Effects.SendTargetEffect(m, 0x3709, 10, 30);
|
||||
}
|
||||
}
|
||||
|
||||
var breakChance = Core.AOS ? 0.01 : 0.16;
|
||||
if (Utility.RandomDouble() < breakChance)
|
||||
{
|
||||
from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly FireHorn m_Horn;
|
||||
|
||||
public InternalTarget(FireHorn horn) : base(Core.AOS ? 3 : 2, true, TargetFlags.Harmful) => m_Horn = horn;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Horn.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from.BeginAction<FireHorn>();
|
||||
Timer.StartTimer(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0),
|
||||
() =>
|
||||
{
|
||||
from.EndAction<FireHorn>();
|
||||
from.SendLocalizedMessage(1049621); // You catch your breath.
|
||||
}
|
||||
);
|
||||
|
||||
var music = from.Skills.Musicianship.Fixed;
|
||||
|
||||
var sucChance = 500 + (music - 775) * 2;
|
||||
var dSucChance = sucChance / 1000.0;
|
||||
|
||||
if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
|
||||
Point3D loc;
|
||||
if (targeted is Item item)
|
||||
{
|
||||
from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
|
||||
from.PlaySound(0x18A);
|
||||
return;
|
||||
loc = item.GetWorldLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = new Point3D(targeted as IPoint3D);
|
||||
}
|
||||
|
||||
var sulfAsh = Core.AOS ? 4 : 15;
|
||||
from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh);
|
||||
|
||||
from.PlaySound(0x15F);
|
||||
Effects.SendMovingEffect(
|
||||
from,
|
||||
loc,
|
||||
0x36D4,
|
||||
5,
|
||||
0,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
var playerVsPlayer = false;
|
||||
var eable = from.Map.GetMobilesInRange(loc, 2);
|
||||
|
||||
using var targets = PooledRefQueue<Mobile>.Create();
|
||||
foreach (var m in eable)
|
||||
{
|
||||
if (from != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) &&
|
||||
(!Core.AOS || from.InLOS(m)))
|
||||
{
|
||||
targets.Enqueue(m);
|
||||
|
||||
if (m.Player)
|
||||
{
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
var prov = from.Skills.Provocation.Fixed;
|
||||
var disc = from.Skills.Discordance.Fixed;
|
||||
var peace = from.Skills.Peacemaking.Fixed;
|
||||
|
||||
int minDamage, maxDamage;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
var musicScaled = music + Math.Max(0, music - 900) * 2;
|
||||
var provScaled = prov + Math.Max(0, prov - 900) * 2;
|
||||
var discScaled = disc + Math.Max(0, disc - 900) * 2;
|
||||
var peaceScaled = peace + Math.Max(0, peace - 900) * 2;
|
||||
|
||||
var weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;
|
||||
|
||||
int avgDamage;
|
||||
if (playerVsPlayer)
|
||||
{
|
||||
avgDamage = weightAvg / 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
avgDamage = weightAvg / 2;
|
||||
}
|
||||
|
||||
minDamage = avgDamage * 9 / 10;
|
||||
maxDamage = avgDamage * 10 / 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
var total = prov + disc / 5 + peace / 5;
|
||||
|
||||
if (playerVsPlayer)
|
||||
{
|
||||
total /= 3;
|
||||
}
|
||||
|
||||
maxDamage = total * 2 / 30;
|
||||
minDamage = maxDamage * 7 / 10;
|
||||
}
|
||||
|
||||
double damage = Utility.RandomMinMax(minDamage, maxDamage);
|
||||
|
||||
if (Core.AOS && targets.Count > 1)
|
||||
{
|
||||
damage = damage * 2 / targets.Count;
|
||||
}
|
||||
else if (!Core.AOS)
|
||||
{
|
||||
damage /= targets.Count;
|
||||
}
|
||||
|
||||
while (targets.Count > 0)
|
||||
{
|
||||
var m = targets.Dequeue();
|
||||
|
||||
var toDeal = damage;
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0))
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
from.DoHarmful(m);
|
||||
SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);
|
||||
|
||||
Effects.SendTargetEffect(m, 0x3709, 10, 30);
|
||||
}
|
||||
}
|
||||
|
||||
var breakChance = Core.AOS ? 0.01 : 0.16;
|
||||
if (Utility.RandomDouble() < breakChance)
|
||||
{
|
||||
from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private readonly FireHorn m_Horn;
|
||||
|
||||
public InternalTarget(FireHorn horn) : base(Core.AOS ? 3 : 2, true, TargetFlags.Harmful) => m_Horn = horn;
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Horn.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point3D loc;
|
||||
if (targeted is Item item)
|
||||
{
|
||||
loc = item.GetWorldLocation();
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = new Point3D(targeted as IPoint3D);
|
||||
}
|
||||
|
||||
m_Horn.Use(from, loc);
|
||||
}
|
||||
m_Horn.Use(from, loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,124 +1,85 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class RecipeScroll : Item
|
||||
{
|
||||
public class RecipeScroll : Item
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _recipeID;
|
||||
|
||||
public RecipeScroll(Recipe r) : this(r.ID)
|
||||
{
|
||||
private int m_RecipeID;
|
||||
}
|
||||
|
||||
public RecipeScroll(Recipe r) : this(r.ID)
|
||||
[Constructible]
|
||||
public RecipeScroll(int recipeID) : base(0x2831) => _recipeID = recipeID;
|
||||
|
||||
public override int LabelNumber => 1074560; // recipe scroll
|
||||
|
||||
public Recipe Recipe
|
||||
{
|
||||
get
|
||||
{
|
||||
Recipe.Recipes.TryGetValue(_recipeID, out var recipe);
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RecipeScroll(int recipeID) : base(0x2831) => m_RecipeID = recipeID;
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
public RecipeScroll(Serial serial)
|
||||
: base(serial)
|
||||
var r = Recipe;
|
||||
|
||||
if (r != null)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1074560; // recipe scroll
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int RecipeID
|
||||
{
|
||||
get => m_RecipeID;
|
||||
set
|
||||
if (r.TextDefinition.Number > 0)
|
||||
{
|
||||
m_RecipeID = value;
|
||||
InvalidateProperties();
|
||||
list.Add(1049644, r.TextDefinition.Number); // [~1_stuff~]
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(1049644, r.TextDefinition.String); // [~1_stuff~]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Recipe Recipe
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
get
|
||||
{
|
||||
Recipe.Recipes.TryGetValue(m_RecipeID, out var recipe);
|
||||
return recipe;
|
||||
}
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
var r = Recipe;
|
||||
|
||||
if (r != null && from is PlayerMobile pm)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
var r = Recipe;
|
||||
|
||||
if (r != null)
|
||||
if (!pm.HasRecipe(r))
|
||||
{
|
||||
if (r.TextDefinition.Number > 0)
|
||||
var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
list.Add(1049644, r.TextDefinition.Number); // [~1_stuff~]
|
||||
// You have learned a new recipe: ~1_RECIPE~
|
||||
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
|
||||
pm.AcquireRecipe(r);
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(1049644, r.TextDefinition.String); // [~1_stuff~]
|
||||
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
var r = Recipe;
|
||||
|
||||
if (r != null && from is PlayerMobile pm)
|
||||
{
|
||||
if (!pm.HasRecipe(r))
|
||||
{
|
||||
var chance = r.CraftItem.GetSuccessChance(pm, null, r.CraftSystem, false, out var allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
// You have learned a new recipe: ~1_RECIPE~
|
||||
pm.SendLocalizedMessage(1073451, r.TextDefinition.ToString());
|
||||
pm.AcquireRecipe(r);
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1073427); // You already know this recipe.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_RecipeID);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_RecipeID = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
pm.SendLocalizedMessage(1073427); // You already know this recipe.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,276 +1,227 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Engines.Craft;
|
||||
using Server.Factions;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(1, false)]
|
||||
public partial class RepairDeed : Item
|
||||
{
|
||||
public class RepairDeed : Item
|
||||
public enum RepairSkillType
|
||||
{
|
||||
public enum RepairSkillType
|
||||
Smithing,
|
||||
Tailoring,
|
||||
Tinkering,
|
||||
Carpentry,
|
||||
Fletching
|
||||
}
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private RepairSkillType _skill;
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializableField(2)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private string _crafter;
|
||||
|
||||
[Constructible]
|
||||
public RepairDeed(RepairSkillType skill, double level, bool normalizeLevel) : this(
|
||||
skill,
|
||||
level,
|
||||
null,
|
||||
normalizeLevel
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RepairDeed(
|
||||
RepairSkillType skill = RepairSkillType.Smithing, double level = 100.0,
|
||||
Mobile crafter = null, bool normalizeLevel = true
|
||||
) : base(0x14F0)
|
||||
{
|
||||
if (normalizeLevel)
|
||||
{
|
||||
Smithing,
|
||||
Tailoring,
|
||||
Tinkering,
|
||||
Carpentry,
|
||||
Fletching
|
||||
SkillLevel = (int)(level / 10) * 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkillLevel = level;
|
||||
}
|
||||
|
||||
private Mobile m_Crafter;
|
||||
_skill = skill;
|
||||
_crafter = crafter?.RawName;
|
||||
Hue = 0x1BC;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
private RepairSkillType m_Skill;
|
||||
private double m_SkillLevel;
|
||||
public override bool DisplayLootType => false;
|
||||
|
||||
[Constructible]
|
||||
public RepairDeed(RepairSkillType skill, double level, bool normalizeLevel) : this(
|
||||
skill,
|
||||
level,
|
||||
null,
|
||||
normalizeLevel
|
||||
)
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableProperty(1)]
|
||||
public double SkillLevel
|
||||
{
|
||||
get => _skillLevel;
|
||||
set
|
||||
{
|
||||
_skillLevel = Math.Clamp(value, 0, 120.0);
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
// A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
|
||||
list.Add(1061133, $"{GetSkillTitle(_skillLevel)}\t{RepairSkillInfo.GetInfo(_skill).Name}");
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_crafter != null)
|
||||
{
|
||||
list.Add(1050043, _crafter); // crafted by ~1_NAME~
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (Deleted || !from.CanSee(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RepairDeed(
|
||||
RepairSkillType skill = RepairSkillType.Smithing, double level = 100.0,
|
||||
Mobile crafter = null, bool normalizeLevel = true
|
||||
) : base(0x14F0)
|
||||
// A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
|
||||
LabelTo(from, 1061133, $"{GetSkillTitle(_skillLevel)}\t{RepairSkillInfo.GetInfo(_skill).Name}");
|
||||
|
||||
if (_crafter != null)
|
||||
{
|
||||
if (normalizeLevel)
|
||||
LabelTo(from, 1050043, _crafter); // crafted by ~1_NAME~
|
||||
}
|
||||
}
|
||||
|
||||
private static TextDefinition GetSkillTitle(double skillLevel)
|
||||
{
|
||||
var skill = (int)(skillLevel / 10);
|
||||
|
||||
if (skill >= 11)
|
||||
{
|
||||
return 1062008 + skill - 11;
|
||||
}
|
||||
|
||||
if (skill >= 5)
|
||||
{
|
||||
return 1061123 + skill - 5;
|
||||
}
|
||||
|
||||
return skill switch
|
||||
{
|
||||
4 => "a Novice",
|
||||
3 => "a Neophyte",
|
||||
_ => "a Newbie"
|
||||
};
|
||||
}
|
||||
|
||||
public static RepairSkillType GetTypeFor(CraftSystem s)
|
||||
{
|
||||
for (var i = 0; i < RepairSkillInfo.Table.Length; i++)
|
||||
{
|
||||
if (RepairSkillInfo.Table[i].System == s)
|
||||
{
|
||||
SkillLevel = (int)(level / 10) * 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkillLevel = level;
|
||||
}
|
||||
|
||||
m_Skill = skill;
|
||||
m_Crafter = crafter;
|
||||
Hue = 0x1BC;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public RepairDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DisplayLootType => false;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public RepairSkillType RepairSkill
|
||||
{
|
||||
get => m_Skill;
|
||||
set
|
||||
{
|
||||
m_Skill = value;
|
||||
InvalidateProperties();
|
||||
return (RepairSkillType)i;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public double SkillLevel
|
||||
return RepairSkillType.Smithing;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (Check(from))
|
||||
{
|
||||
get => m_SkillLevel;
|
||||
set
|
||||
{
|
||||
m_SkillLevel = Math.Clamp(value, 0, 120.0);
|
||||
InvalidateProperties();
|
||||
}
|
||||
Repair.Do(from, RepairSkillInfo.GetInfo(_skill).System, this);
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Crafter
|
||||
public bool Check(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
get => m_Crafter;
|
||||
set
|
||||
{
|
||||
m_Crafter = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
list.Add(
|
||||
1061133,
|
||||
$"{GetSkillTitle(m_SkillLevel)}\t{RepairSkillInfo.GetInfo(m_Skill).Name}"
|
||||
); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_Crafter != null)
|
||||
{
|
||||
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
|
||||
}
|
||||
|
||||
// On OSI it says it's exceptional. Intentional difference.
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (Deleted || !from.CanSee(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LabelTo(
|
||||
from,
|
||||
1061133,
|
||||
$"{GetSkillTitle(m_SkillLevel)}\t{RepairSkillInfo.GetInfo(m_Skill).Name}"
|
||||
); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
|
||||
|
||||
if (m_Crafter != null)
|
||||
{
|
||||
LabelTo(from, 1050043, m_Crafter.Name); // crafted by ~1_NAME~
|
||||
}
|
||||
}
|
||||
|
||||
private static TextDefinition GetSkillTitle(double skillLevel)
|
||||
{
|
||||
var skill = (int)(skillLevel / 10);
|
||||
|
||||
if (skill >= 11)
|
||||
{
|
||||
return 1062008 + skill - 11;
|
||||
}
|
||||
|
||||
if (skill >= 5)
|
||||
{
|
||||
return 1061123 + skill - 5;
|
||||
}
|
||||
|
||||
return skill switch
|
||||
{
|
||||
4 => "a Novice",
|
||||
3 => "a Neophyte",
|
||||
_ => "a Newbie"
|
||||
};
|
||||
}
|
||||
|
||||
public static RepairSkillType GetTypeFor(CraftSystem s)
|
||||
{
|
||||
for (var i = 0; i < RepairSkillInfo.Table.Length; i++)
|
||||
{
|
||||
if (RepairSkillInfo.Table[i].System == s)
|
||||
{
|
||||
return (RepairSkillType)i;
|
||||
}
|
||||
}
|
||||
|
||||
return RepairSkillType.Smithing;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (Check(from))
|
||||
{
|
||||
Repair.Do(from, RepairSkillInfo.GetInfo(m_Skill).System, this);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Check(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage(1047012); // The contract must be in your backpack to use it.
|
||||
}
|
||||
else if (!VerifyRegion(from))
|
||||
{
|
||||
RepairSkillInfo.GetInfo(m_Skill).NotNearbyMessage.SendMessageTo(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1047012); // The contract must be in your backpack to use it.
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool VerifyRegion(Mobile m) => m.Region.IsPartOf<TownRegion>() &&
|
||||
Faction.IsNearType(m, RepairSkillInfo.GetInfo(m_Skill).NearbyTypes, 6);
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
if (!VerifyRegion(from))
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write((int)m_Skill);
|
||||
writer.Write(m_SkillLevel);
|
||||
writer.Write(m_Crafter);
|
||||
RepairSkillInfo.GetInfo(_skill).NotNearbyMessage.SendMessageTo(from);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool VerifyRegion(Mobile m) => m.Region.IsPartOf<TownRegion>() &&
|
||||
Faction.IsNearType(m, RepairSkillInfo.GetInfo(_skill).NearbyTypes, 6);
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
{
|
||||
_skill = (RepairSkillType)reader.ReadInt();
|
||||
_skillLevel = reader.ReadDouble();
|
||||
Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity<Mobile>());
|
||||
}
|
||||
|
||||
private class RepairSkillInfo
|
||||
{
|
||||
public RepairSkillInfo(
|
||||
CraftSystem system, Type[] nearbyTypes, TextDefinition notNearbyMessage,
|
||||
TextDefinition name
|
||||
)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Skill = (RepairSkillType)reader.ReadInt();
|
||||
m_SkillLevel = reader.ReadDouble();
|
||||
m_Crafter = reader.ReadEntity<Mobile>();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
System = system;
|
||||
NearbyTypes = nearbyTypes;
|
||||
NotNearbyMessage = notNearbyMessage;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
private class RepairSkillInfo
|
||||
public RepairSkillInfo(CraftSystem system, Type nearbyType, TextDefinition notNearbyMessage, TextDefinition name)
|
||||
: this(system, new[] { nearbyType }, notNearbyMessage, name)
|
||||
{
|
||||
public RepairSkillInfo(
|
||||
CraftSystem system, Type[] nearbyTypes, TextDefinition notNearbyMessage,
|
||||
TextDefinition name
|
||||
)
|
||||
}
|
||||
|
||||
public TextDefinition NotNearbyMessage { get; }
|
||||
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public CraftSystem System { get; }
|
||||
|
||||
public Type[] NearbyTypes { get; }
|
||||
|
||||
public static RepairSkillInfo[] Table { get; } =
|
||||
{
|
||||
new(DefBlacksmithy.CraftSystem, typeof(Blacksmith), 1047013, 1023015),
|
||||
new(DefTailoring.CraftSystem, typeof(Tailor), 1061132, 1022981),
|
||||
new(DefTinkering.CraftSystem, typeof(Tinker), 1061166, 1022983),
|
||||
new(DefCarpentry.CraftSystem, typeof(Carpenter), 1061135, 1060774),
|
||||
new(DefBowFletching.CraftSystem, typeof(Bowyer), 1061134, 1023005)
|
||||
};
|
||||
|
||||
public static RepairSkillInfo GetInfo(RepairSkillType type)
|
||||
{
|
||||
var v = (int)type;
|
||||
|
||||
if (v < 0 || v >= Table.Length)
|
||||
{
|
||||
System = system;
|
||||
NearbyTypes = nearbyTypes;
|
||||
NotNearbyMessage = notNearbyMessage;
|
||||
Name = name;
|
||||
v = 0;
|
||||
}
|
||||
|
||||
public RepairSkillInfo(CraftSystem system, Type nearbyType, TextDefinition notNearbyMessage, TextDefinition name)
|
||||
: this(system, new[] { nearbyType }, notNearbyMessage, name)
|
||||
{
|
||||
}
|
||||
|
||||
public TextDefinition NotNearbyMessage { get; }
|
||||
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public CraftSystem System { get; }
|
||||
|
||||
public Type[] NearbyTypes { get; }
|
||||
|
||||
public static RepairSkillInfo[] Table { get; } =
|
||||
{
|
||||
new(DefBlacksmithy.CraftSystem, typeof(Blacksmith), 1047013, 1023015),
|
||||
new(DefTailoring.CraftSystem, typeof(Tailor), 1061132, 1022981),
|
||||
new(DefTinkering.CraftSystem, typeof(Tinker), 1061166, 1022983),
|
||||
new(DefCarpentry.CraftSystem, typeof(Carpenter), 1061135, 1060774),
|
||||
new(DefBowFletching.CraftSystem, typeof(Bowyer), 1061134, 1023005)
|
||||
};
|
||||
|
||||
public static RepairSkillInfo GetInfo(RepairSkillType type)
|
||||
{
|
||||
var v = (int)type;
|
||||
|
||||
if (v < 0 || v >= Table.Length)
|
||||
{
|
||||
v = 0;
|
||||
}
|
||||
|
||||
return Table[v];
|
||||
}
|
||||
return Table[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
|
|||
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