Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,720 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Accounting;
using Server.ContextMenus;
using Server.Engines.VeteranRewards;
using Server.Gumps;
using Server.Items;
using Server.Multis;
using Server.Network;
using Server.Spells;
using Server.Targeting;
namespace Server.Mobiles
{
public enum StatueType
{
Marble,
Jade,
Bronze
}
public enum StatuePose
{
Ready,
Casting,
Salute,
AllPraiseMe,
Fighting,
HandsOnHips
}
public enum StatueMaterial
{
Antique,
Dark,
Medium,
Light
}
public class CharacterStatue : Mobile, IRewardItem
{
private StatueType m_Type;
private StatuePose m_Pose;
private StatueMaterial m_Material;
private Mobile m_SculptedBy;
private DateTime m_SculptedOn;
private CharacterStatuePlinth m_Plinth;
private bool m_IsRewardItem;
private int m_Animation;
private int m_Frames;
public CharacterStatue(Mobile from, StatueType type)
: base()
{
this.m_Type = type;
this.m_Pose = StatuePose.Ready;
this.m_Material = StatueMaterial.Antique;
this.Direction = Direction.South;
this.AccessLevel = AccessLevel.Counselor;
this.Hits = this.HitsMax;
this.Blessed = true;
this.Frozen = true;
this.CloneBody(from);
this.CloneClothes(from);
this.InvalidateHues();
}
public CharacterStatue(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public StatueType StatueType
{
get
{
return this.m_Type;
}
set
{
this.m_Type = value;
this.InvalidateHues();
this.InvalidatePose();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public StatuePose Pose
{
get
{
return this.m_Pose;
}
set
{
this.m_Pose = value;
this.InvalidatePose();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public StatueMaterial Material
{
get
{
return this.m_Material;
}
set
{
this.m_Material = value;
this.InvalidateHues();
this.InvalidatePose();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile SculptedBy
{
get
{
return this.m_SculptedBy;
}
set
{
this.m_SculptedBy = value;
this.InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public DateTime SculptedOn
{
get
{
return this.m_SculptedOn;
}
set
{
this.m_SculptedOn = value;
}
}
public CharacterStatuePlinth Plinth
{
get
{
return this.m_Plinth;
}
set
{
this.m_Plinth = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get
{
return this.m_IsRewardItem;
}
set
{
this.m_IsRewardItem = value;
}
}
public override void OnDoubleClick(Mobile from)
{
this.DisplayPaperdollTo(from);
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.m_SculptedBy != null)
{
if (this.m_SculptedBy.ShowFameTitle && (this.m_SculptedBy.Player || this.m_SculptedBy.Body.IsHuman) && this.m_SculptedBy.Fame >= 10000)
list.Add(1076202, String.Format("{0} {1}", this.m_SculptedBy.Female ? "Lady" : "Lord", this.m_SculptedBy.Name)); // Sculpted by ~1_Name~
else
list.Add(1076202, this.m_SculptedBy.Name); // Sculpted by ~1_Name~
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
if (from.Alive && this.m_SculptedBy != null)
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if ((house != null && house.IsCoOwner(from)) || (int)from.AccessLevel > (int)AccessLevel.Counselor)
list.Add(new DemolishEntry(this));
}
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if (this.m_Plinth != null && !this.m_Plinth.Deleted)
this.m_Plinth.Delete();
}
public override bool CanBeRenamedBy(Mobile from)
{
return false;
}
public override bool CanBeDamaged()
{
return false;
}
public void OnRequestedAnimation(Mobile from)
{
from.Send(new UpdateStatueAnimation(this, 1, this.m_Animation, this.m_Frames));
}
public override void OnAosSingleClick(Mobile from)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
writer.Write((int)this.m_Type);
writer.Write((int)this.m_Pose);
writer.Write((int)this.m_Material);
writer.Write((Mobile)this.m_SculptedBy);
writer.Write((DateTime)this.m_SculptedOn);
writer.Write((Item)this.m_Plinth);
writer.Write((bool)this.m_IsRewardItem);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
this.m_Type = (StatueType)reader.ReadInt();
this.m_Pose = (StatuePose)reader.ReadInt();
this.m_Material = (StatueMaterial)reader.ReadInt();
this.m_SculptedBy = reader.ReadMobile();
this.m_SculptedOn = reader.ReadDateTime();
this.m_Plinth = reader.ReadItem() as CharacterStatuePlinth;
this.m_IsRewardItem = reader.ReadBool();
this.InvalidatePose();
this.Frozen = true;
if (this.m_SculptedBy == null || this.Map == Map.Internal) // Remove preview statues
{
Timer.DelayCall(TimeSpan.Zero, new TimerCallback(Delete));
}
}
public void Sculpt(Mobile by)
{
this.m_SculptedBy = by;
this.m_SculptedOn = DateTime.UtcNow;
this.InvalidateProperties();
}
public bool Demolish(Mobile by)
{
CharacterStatueDeed deed = new CharacterStatueDeed(null);
if (by.PlaceInBackpack(deed))
{
this.Delete();
deed.Statue = this;
deed.StatueType = this.m_Type;
deed.IsRewardItem = this.m_IsRewardItem;
if (this.m_Plinth != null)
this.m_Plinth.Delete();
return true;
}
else
{
by.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
deed.Delete();
return false;
}
}
public void Restore(CharacterStatue from)
{
this.m_Material = from.Material;
this.m_Pose = from.Pose;
this.Direction = from.Direction;
this.CloneBody(from);
this.CloneClothes(from);
this.InvalidateHues();
this.InvalidatePose();
}
public void CloneBody(Mobile from)
{
this.Name = from.Name;
this.BodyValue = from.BodyValue;
this.Female = from.Female;
this.HairItemID = from.HairItemID;
this.FacialHairItemID = from.FacialHairItemID;
}
public void CloneClothes(Mobile from)
{
for (int i = this.Items.Count - 1; i >= 0; i --)
this.Items[i].Delete();
for (int i = from.Items.Count - 1; i >= 0; i --)
{
Item item = from.Items[i];
if (item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank)
this.AddItem(this.CloneItem(item));
}
}
public Item CloneItem(Item item)
{
Item cloned = new Item(item.ItemID);
cloned.Layer = item.Layer;
cloned.Name = item.Name;
cloned.Hue = item.Hue;
cloned.Weight = item.Weight;
cloned.Movable = false;
return cloned;
}
public void InvalidateHues()
{
this.Hue = 0xB8F + (int)this.m_Type * 4 + (int)this.m_Material;
this.HairHue = this.Hue;
if (this.FacialHairItemID > 0)
this.FacialHairHue = this.Hue;
for (int i = this.Items.Count - 1; i >= 0; i --)
this.Items[i].Hue = this.Hue;
if (this.m_Plinth != null)
this.m_Plinth.InvalidateHue();
}
public void InvalidatePose()
{
switch ( this.m_Pose )
{
case StatuePose.Ready:
this.m_Animation = 4;
this.m_Frames = 0;
break;
case StatuePose.Casting:
this.m_Animation = 16;
this.m_Frames = 2;
break;
case StatuePose.Salute:
this.m_Animation = 33;
this.m_Frames = 1;
break;
case StatuePose.AllPraiseMe:
this.m_Animation = 17;
this.m_Frames = 4;
break;
case StatuePose.Fighting:
this.m_Animation = 31;
this.m_Frames = 5;
break;
case StatuePose.HandsOnHips:
this.m_Animation = 6;
this.m_Frames = 1;
break;
}
if (this.Map != null)
{
this.ProcessDelta();
Packet p = null;
IPooledEnumerable eable = this.Map.GetClientsInRange(this.Location);
foreach (NetState state in eable)
{
state.Mobile.ProcessDelta();
if (p == null)
p = Packet.Acquire(new UpdateStatueAnimation(this, 1, this.m_Animation, this.m_Frames));
state.Send(p);
}
Packet.Release(p);
eable.Free();
}
}
protected override void OnMapChange(Map oldMap)
{
this.InvalidatePose();
if (this.m_Plinth != null)
this.m_Plinth.Map = this.Map;
}
protected override void OnLocationChange(Point3D oldLocation)
{
this.InvalidatePose();
if (this.m_Plinth != null)
this.m_Plinth.Location = new Point3D(this.X, this.Y, this.Z - 5);
}
private class DemolishEntry : ContextMenuEntry
{
private readonly CharacterStatue m_Statue;
public DemolishEntry(CharacterStatue statue)
: base(6275, 2)
{
this.m_Statue = statue;
}
public override void OnClick()
{
if (this.m_Statue.Deleted)
return;
this.m_Statue.Demolish(this.Owner.From);
}
}
}
public class CharacterStatueDeed : Item, IRewardItem
{
private CharacterStatue m_Statue;
private StatueType m_Type;
private bool m_IsRewardItem;
public CharacterStatueDeed(CharacterStatue statue)
: base(0x14F0)
{
this.m_Statue = statue;
if (statue != null)
{
this.m_Type = statue.StatueType;
this.m_IsRewardItem = statue.IsRewardItem;
}
this.LootType = LootType.Blessed;
this.Weight = 1.0;
}
public CharacterStatueDeed(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
StatueType t = this.m_Type;
if (this.m_Statue != null)
{
t = this.m_Statue.StatueType;
}
switch ( t )
{
case StatueType.Marble:
return 1076189;
case StatueType.Jade:
return 1076188;
case StatueType.Bronze:
return 1076190;
default:
return 1076173;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public CharacterStatue Statue
{
get
{
return this.m_Statue;
}
set
{
this.m_Statue = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public StatueType StatueType
{
get
{
if (this.m_Statue != null)
return this.m_Statue.StatueType;
return this.m_Type;
}
set
{
this.m_Type = value;
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get
{
return this.m_IsRewardItem;
}
set
{
this.m_IsRewardItem = value;
this.InvalidateProperties();
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.m_IsRewardItem)
list.Add(1076222); // 6th Year Veteran Reward
if (this.m_Statue != null)
list.Add(1076231, this.m_Statue.Name); // Statue of ~1_Name~
}
public override void OnDoubleClick(Mobile from)
{
Account acct = from.Account as Account;
if (acct != null && from.IsPlayer())
{
TimeSpan time = TimeSpan.FromDays(RewardSystem.RewardInterval.TotalDays * 6) - (DateTime.UtcNow - acct.Created);
if (time > TimeSpan.Zero)
{
from.SendLocalizedMessage(1008126, true, Math.Ceiling(time.TotalDays / RewardSystem.RewardInterval.TotalDays).ToString()); // Your account is not old enough to use this item. Months until you can use this item :
return;
}
}
if (this.IsChildOf(from.Backpack))
{
if (!from.IsBodyMod)
{
from.SendLocalizedMessage(1076194); // Select a place where you would like to put your statue.
from.Target = new CharacterStatueTarget(this, this.StatueType);
}
else
from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
}
else
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override void OnDelete()
{
base.OnDelete();
if (this.m_Statue != null)
this.m_Statue.Delete();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)1); // version
writer.Write((int)this.m_Type);
writer.Write((Mobile)this.m_Statue);
writer.Write((bool)this.m_IsRewardItem);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
if (version >= 1)
{
this.m_Type = (StatueType)reader.ReadInt();
}
this.m_Statue = reader.ReadMobile() as CharacterStatue;
this.m_IsRewardItem = reader.ReadBool();
}
}
public class CharacterStatueTarget : Target
{
private readonly Item m_Maker;
private readonly StatueType m_Type;
public CharacterStatueTarget(Item maker, StatueType type)
: base(-1, true, TargetFlags.None)
{
this.m_Maker = maker;
this.m_Type = type;
}
public static AddonFitResult CouldFit(Point3D p, Map map, Mobile from, ref BaseHouse house)
{
if (!map.CanFit(p.X, p.Y, p.Z, 20, true, true, true))
return AddonFitResult.Blocked;
else if (!BaseAddon.CheckHouse(from, p, map, 20, ref house))
return AddonFitResult.NotInHouse;
else
return CheckDoors(p, 20, house);
}
public static AddonFitResult CheckDoors(Point3D p, int height, BaseHouse house)
{
List<Item> doors = house.Doors;
for (int i = 0; i < doors.Count; i ++)
{
BaseDoor door = doors[i] as BaseDoor;
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
if (Utility.InRange(doorLoc, p, 1) && (p.Z == doorLoc.Z || ((p.Z + height) > doorLoc.Z && (doorLoc.Z + doorHeight) > p.Z)))
return AddonFitResult.DoorTooClose;
}
return AddonFitResult.Valid;
}
protected override void OnTarget(Mobile from, object targeted)
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if (p == null || map == null || this.m_Maker == null || this.m_Maker.Deleted)
return;
if (this.m_Maker.IsChildOf(from.Backpack))
{
SpellHelper.GetSurfaceTop(ref p);
BaseHouse house = null;
Point3D loc = new Point3D(p);
if (targeted is Item && !((Item)targeted).IsLockedDown && !((Item)targeted).IsSecure && !(targeted is AddonComponent))
{
from.SendLocalizedMessage(1076191); // Statues can only be placed in houses.
return;
}
else if (from.IsBodyMod)
{
from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
return;
}
AddonFitResult result = CouldFit(loc, map, from, ref house);
if (result == AddonFitResult.Valid)
{
CharacterStatue statue = new CharacterStatue(from, this.m_Type);
CharacterStatuePlinth plinth = new CharacterStatuePlinth(statue);
house.Addons[plinth] = from;
if (this.m_Maker is IRewardItem)
statue.IsRewardItem = ((IRewardItem)this.m_Maker).IsRewardItem;
statue.Plinth = plinth;
plinth.MoveToWorld(loc, map);
statue.InvalidatePose();
/*
* TODO: Previously the maker wasn't deleted until after statue
* customization, leading to redeeding issues. Exact OSI behavior
* needs looking into.
*/
this.m_Maker.Delete();
statue.Sculpt(from);
from.CloseGump(typeof(CharacterStatueGump));
from.SendGump(new CharacterStatueGump(this.m_Maker, statue, from));
}
else if (result == AddonFitResult.Blocked)
from.SendLocalizedMessage(500269); // You cannot build that there.
else if (result == AddonFitResult.NotInHouse)
from.SendLocalizedMessage(1076192); // Statues can only be placed in houses where you are the owner or co-owner.
else if (result == AddonFitResult.DoorTooClose)
from.SendLocalizedMessage(500271); // You cannot build near the door.
}
else
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
}

View File

@@ -0,0 +1,198 @@
using System;
using Server.Engines.VeteranRewards;
using Server.Mobiles;
namespace Server.Items
{
public class CharacterStatueMaker : Item, IRewardItem
{
private bool m_IsRewardItem;
private StatueType m_Type;
[Constructable]
public CharacterStatueMaker(StatueType type)
: base(0x32F0)
{
this.m_Type = type;
this.InvalidateHue();
this.LootType = LootType.Blessed;
this.Weight = 5.0;
}
public CharacterStatueMaker(Serial serial)
: base(serial)
{
}
public override int LabelNumber
{
get
{
return 1076173;
}
}// Character Statue Maker
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem
{
get
{
return this.m_IsRewardItem;
}
set
{
this.m_IsRewardItem = value;
this.InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public StatueType StatueType
{
get
{
return this.m_Type;
}
set
{
this.m_Type = value;
this.InvalidateHue();
}
}
public override void OnDoubleClick(Mobile from)
{
if (this.m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, new object[] { this.m_Type }))
return;
if (this.IsChildOf(from.Backpack))
{
if (!from.IsBodyMod)
{
from.SendLocalizedMessage(1076194); // Select a place where you would like to put your statue.
from.Target = new CharacterStatueTarget(this, this.m_Type);
}
else
from.SendLocalizedMessage(1073648); // You may only proceed while in your original state...
}
else
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (this.m_IsRewardItem)
list.Add(1076222); // 6th Year Veteran Reward
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
writer.Write((bool)this.m_IsRewardItem);
writer.Write((int)this.m_Type);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
this.m_IsRewardItem = reader.ReadBool();
this.m_Type = (StatueType)reader.ReadInt();
}
public void InvalidateHue()
{
this.Hue = 0xB8F + (int)this.m_Type * 4;
}
}
public class MarbleStatueMaker : CharacterStatueMaker
{
[Constructable]
public MarbleStatueMaker()
: base(StatueType.Marble)
{
}
public MarbleStatueMaker(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class JadeStatueMaker : CharacterStatueMaker
{
[Constructable]
public JadeStatueMaker()
: base(StatueType.Jade)
{
}
public JadeStatueMaker(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
public class BronzeStatueMaker : CharacterStatueMaker
{
[Constructable]
public BronzeStatueMaker()
: base(StatueType.Bronze)
{
}
public BronzeStatueMaker(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}

View File

@@ -0,0 +1,151 @@
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Multis;
namespace Server.Items
{
public class CharacterStatuePlinth : Static, IAddon
{
private CharacterStatue m_Statue;
public CharacterStatuePlinth(CharacterStatue statue)
: base(0x32F2)
{
this.m_Statue = statue;
this.InvalidateHue();
}
public CharacterStatuePlinth(Serial serial)
: base(serial)
{
}
public Item Deed
{
get
{
return new CharacterStatueDeed(this.m_Statue);
}
}
public override int LabelNumber
{
get
{
return 1076201;
}
}// Character Statue
public override void OnAfterDelete()
{
base.OnAfterDelete();
if (this.m_Statue != null && !this.m_Statue.Deleted)
this.m_Statue.Delete();
}
public override void OnMapChange()
{
if (this.m_Statue != null)
this.m_Statue.Map = this.Map;
}
public override void OnLocationChange(Point3D oldLocation)
{
if (this.m_Statue != null)
this.m_Statue.Location = new Point3D(this.X, this.Y, this.Z + 5);
}
void IChopable.OnChop(Mobile user)
{
OnDoubleClick(user);
}
public override void OnDoubleClick(Mobile from)
{
if (this.m_Statue != null)
from.SendGump(new CharacterPlinthGump(this.m_Statue));
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt((int)0); // version
writer.Write((Mobile)this.m_Statue);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
this.m_Statue = reader.ReadMobile() as CharacterStatue;
if (this.m_Statue == null || this.m_Statue.SculptedBy == null || this.Map == Map.Internal)
{
Timer.DelayCall(TimeSpan.Zero, new TimerCallback(Delete));
}
}
public void InvalidateHue()
{
if (this.m_Statue != null)
this.Hue = 0xB8F + (int)this.m_Statue.StatueType * 4 + (int)this.m_Statue.Material;
}
public virtual bool CouldFit(IPoint3D p, Map map)
{
Point3D point = new Point3D(p.X, p.Y, p.Z);
if (map == null || !map.CanFit(point, 20))
return false;
BaseHouse house = BaseHouse.FindHouseAt(point, map, 20);
if (house == null)
return false;
AddonFitResult result = CharacterStatueTarget.CheckDoors(point, 20, house);
if (result == AddonFitResult.Valid)
return true;
return false;
}
private class CharacterPlinthGump : Gump
{
public CharacterPlinthGump(CharacterStatue statue)
: base(60, 30)
{
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
this.AddPage(0);
this.AddImage(0, 0, 0x24F4);
this.AddHtml(55, 50, 150, 20, statue.Name, false, false);
this.AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString(), false, false);
this.AddHtmlLocalized(55, 100, 150, 20, this.GetTypeNumber(statue.StatueType), 0, false, false);
}
public int GetTypeNumber(StatueType type)
{
switch ( type )
{
case StatueType.Marble:
return 1076181;
case StatueType.Jade:
return 1076180;
case StatueType.Bronze:
return 1076230;
default:
return 1076181;
}
}
}
}
}

View File

@@ -0,0 +1,214 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class CharacterStatueGump : Gump
{
private readonly Item m_Maker;
private readonly CharacterStatue m_Statue;
private readonly Mobile m_Owner;
public CharacterStatueGump(Item maker, CharacterStatue statue, Mobile owner)
: base(60, 36)
{
this.m_Maker = maker;
this.m_Statue = statue;
this.m_Owner = owner;
if (this.m_Statue == null)
return;
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
this.AddPage(0);
this.AddBackground(0, 0, 327, 324, 0x13BE);
this.AddImageTiled(10, 10, 307, 20, 0xA40);
this.AddImageTiled(10, 40, 307, 244, 0xA40);
this.AddImageTiled(10, 294, 307, 20, 0xA40);
this.AddAlphaRegion(10, 10, 307, 304);
this.AddHtmlLocalized(14, 12, 327, 20, 1076156, 0x7FFF, false, false); // Character Statue Maker
// pose
this.AddHtmlLocalized(133, 41, 120, 20, 1076168, 0x7FFF, false, false); // Choose Pose
this.AddHtmlLocalized(133, 61, 120, 20, 1076208 + (int)this.m_Statue.Pose, 0x77E, false, false);
this.AddButton(163, 81, 0xFA5, 0xFA7, (int)Buttons.PoseNext, GumpButtonType.Reply, 0);
this.AddButton(133, 81, 0xFAE, 0xFB0, (int)Buttons.PosePrev, GumpButtonType.Reply, 0);
// direction
this.AddHtmlLocalized(133, 126, 120, 20, 1076170, 0x7FFF, false, false); // Choose Direction
this.AddHtmlLocalized(133, 146, 120, 20, this.GetDirectionNumber(this.m_Statue.Direction), 0x77E, false, false);
this.AddButton(163, 167, 0xFA5, 0xFA7, (int)Buttons.DirNext, GumpButtonType.Reply, 0);
this.AddButton(133, 167, 0xFAE, 0xFB0, (int)Buttons.DirPrev, GumpButtonType.Reply, 0);
// material
this.AddHtmlLocalized(133, 211, 120, 20, 1076171, 0x7FFF, false, false); // Choose Material
this.AddHtmlLocalized(133, 231, 120, 20, this.GetMaterialNumber(this.m_Statue.StatueType, this.m_Statue.Material), 0x77E, false, false);
this.AddButton(163, 253, 0xFA5, 0xFA7, (int)Buttons.MatNext, GumpButtonType.Reply, 0);
this.AddButton(133, 253, 0xFAE, 0xFB0, (int)Buttons.MatPrev, GumpButtonType.Reply, 0);
// cancel
this.AddButton(10, 294, 0xFB1, 0xFB2, (int)Buttons.Close, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(45, 294, 80, 20, 1006045, 0x7FFF, false, false); // Cancel
// sculpt
this.AddButton(234, 294, 0xFB7, 0xFB9, (int)Buttons.Sculpt, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(269, 294, 80, 20, 1076174, 0x7FFF, false, false); // Sculpt
// restore
if (this.m_Maker is CharacterStatueDeed)
{
this.AddButton(107, 294, 0xFAB, 0xFAD, (int)Buttons.Restore, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(142, 294, 80, 20, 1076193, 0x7FFF, false, false); // Restore
}
}
private enum Buttons
{
Close,
Sculpt,
PosePrev,
PoseNext,
DirPrev,
DirNext,
MatPrev,
MatNext,
Restore
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (this.m_Statue == null || this.m_Statue.Deleted)
return;
bool sendGump = false;
if (info.ButtonID == (int)Buttons.Sculpt)
{
if (this.m_Maker is CharacterStatueDeed)
{
CharacterStatue backup = ((CharacterStatueDeed)this.m_Maker).Statue;
if (backup != null)
backup.Delete();
}
if (this.m_Maker != null)
this.m_Maker.Delete();
this.m_Statue.Sculpt(state.Mobile);
}
else if (info.ButtonID == (int)Buttons.PosePrev)
{
this.m_Statue.Pose = (StatuePose)(((int)this.m_Statue.Pose + 5) % 6);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.PoseNext)
{
this.m_Statue.Pose = (StatuePose)(((int)this.m_Statue.Pose + 1) % 6);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.DirPrev)
{
this.m_Statue.Direction = (Direction)(((int)this.m_Statue.Direction + 7) % 8);
this.m_Statue.InvalidatePose();
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.DirNext)
{
this.m_Statue.Direction = (Direction)(((int)this.m_Statue.Direction + 1) % 8);
this.m_Statue.InvalidatePose();
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.MatPrev)
{
this.m_Statue.Material = (StatueMaterial)(((int)this.m_Statue.Material + 3) % 4);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.MatNext)
{
this.m_Statue.Material = (StatueMaterial)(((int)this.m_Statue.Material + 1) % 4);
sendGump = true;
}
else if (info.ButtonID == (int)Buttons.Restore)
{
if (this.m_Maker is CharacterStatueDeed)
{
CharacterStatue backup = ((CharacterStatueDeed)this.m_Maker).Statue;
if (backup != null)
this.m_Statue.Restore(backup);
}
sendGump = true;
}
else // Close
{
sendGump = !this.m_Statue.Demolish(state.Mobile);
}
if (sendGump)
state.Mobile.SendGump(new CharacterStatueGump(this.m_Maker, this.m_Statue, this.m_Owner));
}
private int GetMaterialNumber(StatueType type, StatueMaterial material)
{
switch ( material )
{
case StatueMaterial.Antique:
switch ( type )
{
case StatueType.Bronze:
return 1076187;
case StatueType.Jade:
return 1076186;
case StatueType.Marble:
return 1076182;
}
return 1076187;
case StatueMaterial.Dark:
if (type == StatueType.Marble)
return 1076183;
return 1076182;
case StatueMaterial.Medium:
return 1076184;
case StatueMaterial.Light:
return 1076185;
default:
return 1076187;
}
}
private int GetDirectionNumber(Direction direction)
{
switch ( direction )
{
case Direction.North:
return 1075389;
case Direction.Right:
return 1075388;
case Direction.East:
return 1075387;
case Direction.Down:
return 1076204;
case Direction.South:
return 1075386;
case Direction.Left:
return 1075391;
case Direction.West:
return 1075390;
case Direction.Up:
return 1076205;
default:
return 1075386;
}
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
namespace Server.Network
{
public class UpdateStatueAnimation : Packet
{
public UpdateStatueAnimation(Mobile m, int status, int animation, int frame)
: base(0xBF, 17)
{
this.m_Stream.Write((short)0x11);
this.m_Stream.Write((short)0x19);
this.m_Stream.Write((byte)0x5);
this.m_Stream.Write((int)m.Serial);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)0xFF);
this.m_Stream.Write((byte)status);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)animation);
this.m_Stream.Write((byte)0);
this.m_Stream.Write((byte)frame);
}
}
}