Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Multis;
namespace Server.Items
@ -12,7 +13,7 @@ namespace Server.Items
public class HolidayTree : Item, IAddon
{
private ArrayList m_Components;
private List<Item> m_Components;
public HolidayTree(Mobile from, HolidayTreeType type, Point3D loc) : base(1)
{
@ -20,7 +21,7 @@ namespace Server.Items
MoveToWorld(loc, from.Map);
Placer = from;
m_Components = new ArrayList();
m_Components = new List<Item>();
switch (type)
{
@ -112,7 +113,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
for (int i = 0; i < m_Components.Count; ++i)
((Item)m_Components[i]).Delete();
m_Components[i].Delete();
}
private void AddOrnament(int x, int y, int z, int itemID)
@ -138,7 +139,7 @@ namespace Server.Items
writer.Write(m_Components.Count);
for (int i = 0; i < m_Components.Count; ++i)
writer.Write((Item)m_Components[i]);
writer.Write(m_Components[i]);
}
public override void Deserialize(GenericReader reader)
@ -159,7 +160,7 @@ namespace Server.Items
{
int count = reader.ReadInt();
m_Components = new ArrayList(count);
m_Components = new List<Item>(count);
for (int i = 0; i < count; ++i)
{
@ -178,9 +179,7 @@ namespace Server.Items
public void ValidatePlacement()
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house == null)
if (BaseHouse.FindHouseAt(this) == null)
{
HolidayTreeDeed deed = new HolidayTreeDeed();
deed.MoveToWorld(Location, Map);
@ -201,7 +200,8 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.Addons.Contains(this)) house.Addons.Remove(this);
if (house?.Addons.Contains(this) == true)
house.Addons.Remove(this);
from.SendLocalizedMessage(503393); // A deed for the tree has been placed in your backpack.
}

View file

@ -60,7 +60,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -93,7 +93,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -48,60 +48,51 @@ namespace Server.Items
public virtual void RunSequence(Mobile m, int message, bool freeze)
{
object[] arg = null;
if (freeze)
{
m.Frozen = true;
Timer.DelayCall(TimeSpan.FromSeconds(message == 1095162 ? 2.0 : 1.25),
new TimerStateCallback(EndFall_Callback), m);
Timer.DelayCall(TimeSpan.FromSeconds(message == 1095162 ? 2.0 : 1.25), EndFall_Callback, m);
}
m.SendLocalizedMessage(message);
int action = 0;
int sound = 0;
if (message == 1095162)
{
if (m.Mounted) m.Mount.Rider = null;
if (m.Mounted)
m.Mount.Rider = null;
Point3D p = new Point3D(Location);
if (SpellHelper.FindValidSpawnLocation(Map, ref p, true))
Timer.DelayCall(TimeSpan.FromSeconds(0), new TimerStateCallback(Relocate_Callback),
new object[] { m, p });
Timer.DelayCall(TimeSpan.FromSeconds(0), () => m.MoveToWorld(p, m.Map));
arg = new object[] { m, 21 + Utility.Random(2), !m.Female ? 0x426 : 0x317 };
action = 21 + Utility.Random(2);
sound = m.Female ? 0x317 : 0x426;
}
else if (message == 1095161)
{
arg = new object[] { m, 17, !m.Female ? 0x429 : 0x319 };
action = 17;
sound = m.Female ? 0x319 : 0x429;
}
if (arg != null) Timer.DelayCall(TimeSpan.FromSeconds(.4), new TimerStateCallback(BeginFall_Callback), arg);
if (action > 0)
Timer.DelayCall(TimeSpan.FromSeconds(0.4), from => BeginFall_Callback(from, action, sound), m);
}
private static void Relocate_Callback(object state)
private static void BeginFall_Callback(Mobile m, int action, int sound)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
Point3D to = (Point3D)states[1];
m.MoveToWorld(to, m.Map);
}
private static void BeginFall_Callback(object state)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
int action = (int)states[1];
int sound = (int)states[2];
if (!m.Mounted) m.Animate(action, 1, 1, false, true, 0);
if (!m.Mounted)
m.Animate(action, 1, 1, false, true, 0);
m.PlaySound(sound);
}
private static void EndFall_Callback(object state)
private static void EndFall_Callback(Mobile m)
{
((Mobile)state).Frozen = false;
m.Frozen = false;
}
public override void Serialize(GenericWriter writer)

View file

@ -148,7 +148,7 @@ namespace Server.Items
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(InternalGump));
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -181,7 +181,7 @@ namespace Server.Items
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
AddPage(0);

View file

@ -105,7 +105,7 @@ namespace Server.Items
{
if (from.InRange(GetWorldLocation(), 3))
{
from.CloseGump(typeof(WreathAddonGump));
from.CloseGump<WreathAddonGump>();
from.SendGump(new WreathAddonGump(from, this));
}
else
@ -202,7 +202,7 @@ namespace Server.Items
if (house != null && house.IsCoOwner(from))
{
from.SendLocalizedMessage(1062838); // Where would you like to place this decoration?
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget, null);
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget);
}
else
{
@ -215,7 +215,7 @@ namespace Server.Items
}
}
public void Placement_OnTarget(Mobile from, object targeted, object state)
public void Placement_OnTarget(Mobile from, object targeted)
{
if (!(targeted is IPoint3D p))
return;