v0.0.1-Alpha (#42)
This commit is contained in:
parent
d30f93c454
commit
a36796c2c1
3552 changed files with 2476 additions and 15223 deletions
|
|
@ -0,0 +1,671 @@
|
|||
using System;
|
||||
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 int m_Animation;
|
||||
private int m_Frames;
|
||||
private StatueMaterial m_Material;
|
||||
private StatuePose m_Pose;
|
||||
|
||||
private Mobile m_SculptedBy;
|
||||
private StatueType m_Type;
|
||||
|
||||
public CharacterStatue(Mobile from, StatueType type)
|
||||
{
|
||||
m_Type = type;
|
||||
m_Pose = StatuePose.Ready;
|
||||
m_Material = StatueMaterial.Antique;
|
||||
|
||||
Direction = Direction.South;
|
||||
AccessLevel = AccessLevel.Counselor;
|
||||
Hits = HitsMax;
|
||||
Blessed = true;
|
||||
Frozen = true;
|
||||
|
||||
CloneBody(from);
|
||||
CloneClothes(from);
|
||||
InvalidateHues();
|
||||
}
|
||||
|
||||
public CharacterStatue(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StatueType StatueType
|
||||
{
|
||||
get => m_Type;
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
InvalidateHues();
|
||||
InvalidatePose();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StatuePose Pose
|
||||
{
|
||||
get => m_Pose;
|
||||
set
|
||||
{
|
||||
m_Pose = value;
|
||||
InvalidatePose();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StatueMaterial Material
|
||||
{
|
||||
get => m_Material;
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateHues();
|
||||
InvalidatePose();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile SculptedBy
|
||||
{
|
||||
get => m_SculptedBy;
|
||||
set
|
||||
{
|
||||
m_SculptedBy = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime SculptedOn{ get; set; }
|
||||
|
||||
public CharacterStatuePlinth Plinth{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem{ get; set; }
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
DisplayPaperdollTo(from);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_SculptedBy != null)
|
||||
{
|
||||
if (m_SculptedBy.ShowFameTitle && (m_SculptedBy.Player || m_SculptedBy.Body.IsHuman) &&
|
||||
m_SculptedBy.Fame >= 10000)
|
||||
list.Add(1076202,
|
||||
$"{(m_SculptedBy.Female ? "Lady" : "Lord")} {m_SculptedBy.Name}"); // Sculpted by ~1_Name~
|
||||
else
|
||||
list.Add(1076202, m_SculptedBy.Name); // Sculpted by ~1_Name~
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if (from.Alive && m_SculptedBy != null)
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (house?.IsCoOwner(from) == true || from.AccessLevel > AccessLevel.Counselor)
|
||||
list.Add(new DemolishEntry(this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (Plinth?.Deleted == false)
|
||||
Plinth.Delete();
|
||||
}
|
||||
|
||||
protected override void OnMapChange(Map oldMap)
|
||||
{
|
||||
InvalidatePose();
|
||||
|
||||
if (Plinth != null)
|
||||
Plinth.Map = Map;
|
||||
}
|
||||
|
||||
protected override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
InvalidatePose();
|
||||
|
||||
if (Plinth != null)
|
||||
Plinth.Location = new Point3D(X, Y, Z - 5);
|
||||
}
|
||||
|
||||
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, m_Animation, m_Frames));
|
||||
}
|
||||
|
||||
public override void OnAosSingleClick(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write((int)m_Type);
|
||||
writer.Write((int)m_Pose);
|
||||
writer.Write((int)m_Material);
|
||||
|
||||
writer.Write(m_SculptedBy);
|
||||
writer.Write(SculptedOn);
|
||||
|
||||
writer.Write(Plinth);
|
||||
writer.Write(IsRewardItem);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Type = (StatueType)reader.ReadInt();
|
||||
m_Pose = (StatuePose)reader.ReadInt();
|
||||
m_Material = (StatueMaterial)reader.ReadInt();
|
||||
|
||||
m_SculptedBy = reader.ReadMobile();
|
||||
SculptedOn = reader.ReadDateTime();
|
||||
|
||||
Plinth = reader.ReadItem() as CharacterStatuePlinth;
|
||||
IsRewardItem = reader.ReadBool();
|
||||
|
||||
InvalidatePose();
|
||||
|
||||
Frozen = true;
|
||||
|
||||
if (m_SculptedBy == null || Map == Map.Internal) // Remove preview statues
|
||||
Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
}
|
||||
|
||||
public void Sculpt(Mobile by)
|
||||
{
|
||||
m_SculptedBy = by;
|
||||
SculptedOn = DateTime.UtcNow;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public bool Demolish(Mobile by)
|
||||
{
|
||||
CharacterStatueDeed deed = new CharacterStatueDeed(null);
|
||||
|
||||
if (by.PlaceInBackpack(deed))
|
||||
{
|
||||
Delete();
|
||||
|
||||
deed.Statue = this;
|
||||
deed.StatueType = m_Type;
|
||||
deed.IsRewardItem = IsRewardItem;
|
||||
|
||||
Plinth?.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
by.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
|
||||
deed.Delete();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Restore(CharacterStatue from)
|
||||
{
|
||||
m_Material = from.Material;
|
||||
m_Pose = from.Pose;
|
||||
|
||||
Direction = from.Direction;
|
||||
|
||||
CloneBody(from);
|
||||
CloneClothes(from);
|
||||
|
||||
InvalidateHues();
|
||||
InvalidatePose();
|
||||
}
|
||||
|
||||
public void CloneBody(Mobile from)
|
||||
{
|
||||
Name = from.Name;
|
||||
BodyValue = from.BodyValue;
|
||||
Female = from.Female;
|
||||
HairItemID = from.HairItemID;
|
||||
FacialHairItemID = from.FacialHairItemID;
|
||||
}
|
||||
|
||||
public void CloneClothes(Mobile from)
|
||||
{
|
||||
for (int i = Items.Count - 1; i >= 0; i--)
|
||||
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)
|
||||
AddItem(CloneItem(item));
|
||||
}
|
||||
}
|
||||
|
||||
public Item CloneItem(Item item)
|
||||
{
|
||||
Item cloned = new Item(item.ItemID)
|
||||
{
|
||||
Layer = item.Layer,
|
||||
Name = item.Name,
|
||||
Hue = item.Hue,
|
||||
Weight = item.Weight,
|
||||
Movable = false
|
||||
};
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
public void InvalidateHues()
|
||||
{
|
||||
Hue = 0xB8F + (int)m_Type * 4 + (int)m_Material;
|
||||
|
||||
HairHue = Hue;
|
||||
|
||||
if (FacialHairItemID > 0)
|
||||
FacialHairHue = Hue;
|
||||
|
||||
for (int i = Items.Count - 1; i >= 0; i--)
|
||||
Items[i].Hue = Hue;
|
||||
|
||||
Plinth?.InvalidateHue();
|
||||
}
|
||||
|
||||
public void InvalidatePose()
|
||||
{
|
||||
switch (m_Pose)
|
||||
{
|
||||
case StatuePose.Ready:
|
||||
m_Animation = 4;
|
||||
m_Frames = 0;
|
||||
break;
|
||||
case StatuePose.Casting:
|
||||
m_Animation = 16;
|
||||
m_Frames = 2;
|
||||
break;
|
||||
case StatuePose.Salute:
|
||||
m_Animation = 33;
|
||||
m_Frames = 1;
|
||||
break;
|
||||
case StatuePose.AllPraiseMe:
|
||||
m_Animation = 17;
|
||||
m_Frames = 4;
|
||||
break;
|
||||
case StatuePose.Fighting:
|
||||
m_Animation = 31;
|
||||
m_Frames = 5;
|
||||
break;
|
||||
case StatuePose.HandsOnHips:
|
||||
m_Animation = 6;
|
||||
m_Frames = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Map != null)
|
||||
{
|
||||
ProcessDelta();
|
||||
|
||||
Packet p = null;
|
||||
|
||||
IPooledEnumerable<NetState> eable = Map.GetClientsInRange(Location);
|
||||
|
||||
foreach (NetState state in eable)
|
||||
{
|
||||
state.Mobile.ProcessDelta();
|
||||
|
||||
if (p == null)
|
||||
p = Packet.Acquire(new UpdateStatueAnimation(this, 1, m_Animation, m_Frames));
|
||||
|
||||
state.Send(p);
|
||||
}
|
||||
|
||||
Packet.Release(p);
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
}
|
||||
|
||||
private class DemolishEntry : ContextMenuEntry
|
||||
{
|
||||
private CharacterStatue m_Statue;
|
||||
|
||||
public DemolishEntry(CharacterStatue statue) : base(6275, 2)
|
||||
{
|
||||
m_Statue = statue;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (m_Statue.Deleted)
|
||||
return;
|
||||
|
||||
m_Statue.Demolish(Owner.From);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CharacterStatueDeed : Item, IRewardItem
|
||||
{
|
||||
private bool m_IsRewardItem;
|
||||
|
||||
private StatueType m_Type;
|
||||
|
||||
public CharacterStatueDeed(CharacterStatue statue) : base(0x14F0)
|
||||
{
|
||||
Statue = statue;
|
||||
|
||||
if (statue != null)
|
||||
{
|
||||
m_Type = statue.StatueType;
|
||||
m_IsRewardItem = statue.IsRewardItem;
|
||||
}
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public CharacterStatueDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
StatueType t = m_Type;
|
||||
|
||||
if (Statue != null) t = 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; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StatueType StatueType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Statue != null)
|
||||
return Statue.StatueType;
|
||||
|
||||
return m_Type;
|
||||
}
|
||||
set => m_Type = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set
|
||||
{
|
||||
m_IsRewardItem = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_IsRewardItem)
|
||||
list.Add(1076222); // 6th Year Veteran Reward
|
||||
|
||||
if (Statue != null)
|
||||
list.Add(1076231, Statue.Name); // Statue of ~1_Name~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Account is Account acct && from.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
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 (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, 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();
|
||||
|
||||
Statue?.Delete();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(1); // version
|
||||
|
||||
writer.Write((int)m_Type);
|
||||
|
||||
writer.Write(Statue);
|
||||
writer.Write(m_IsRewardItem);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version >= 1) m_Type = (StatueType)reader.ReadInt();
|
||||
|
||||
Statue = reader.ReadMobile() as CharacterStatue;
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
|
||||
public class CharacterStatueTarget : Target
|
||||
{
|
||||
private Item m_Maker;
|
||||
private StatueType m_Type;
|
||||
|
||||
public CharacterStatueTarget(Item maker, StatueType type) : base(-1, true, TargetFlags.None)
|
||||
{
|
||||
m_Maker = maker;
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
IPoint3D p = targeted as IPoint3D;
|
||||
Map map = from.Map;
|
||||
|
||||
if (p == null || map == null || m_Maker?.Deleted != false)
|
||||
return;
|
||||
|
||||
if (m_Maker.IsChildOf(from.Backpack))
|
||||
{
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
BaseHouse house = null;
|
||||
Point3D loc = new Point3D(p);
|
||||
|
||||
if (targeted is Item item && !item.IsLockedDown && !item.IsSecure && !(item is AddonComponent))
|
||||
{
|
||||
from.SendLocalizedMessage(1076191); // Statues can only be placed in houses.
|
||||
return;
|
||||
}
|
||||
|
||||
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, m_Type);
|
||||
CharacterStatuePlinth plinth = new CharacterStatuePlinth(statue);
|
||||
|
||||
house.Addons.Add(plinth);
|
||||
|
||||
if (m_Maker is IRewardItem rewardItem)
|
||||
statue.IsRewardItem = rewardItem.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.
|
||||
*/
|
||||
m_Maker.Delete();
|
||||
statue.Sculpt(from);
|
||||
|
||||
from.CloseGump<CharacterStatueGump>();
|
||||
from.SendGump(new CharacterStatueGump(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.
|
||||
}
|
||||
}
|
||||
|
||||
public static AddonFitResult CouldFit(Point3D p, Map map, Mobile from, ref BaseHouse house)
|
||||
{
|
||||
if (!map.CanFit(p.X, p.Y, p.Z, 20, true))
|
||||
return AddonFitResult.Blocked;
|
||||
if (!BaseAddon.CheckHouse(from, p, map, 20, ref house))
|
||||
return AddonFitResult.NotInHouse;
|
||||
|
||||
return CheckDoors(p, 20, house);
|
||||
}
|
||||
|
||||
public static AddonFitResult CheckDoors(Point3D p, int height, BaseHouse house)
|
||||
{
|
||||
List<BaseDoor> doors = house.Doors;
|
||||
|
||||
for (int i = 0; i < doors.Count; i++)
|
||||
{
|
||||
BaseDoor door = doors[i];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
using Server.Engines.VeteranRewards;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CharacterStatueMaker : Item, IRewardItem
|
||||
{
|
||||
private bool m_IsRewardItem;
|
||||
private StatueType m_Type;
|
||||
|
||||
public CharacterStatueMaker(StatueType type) : base(0x32F0)
|
||||
{
|
||||
m_Type = type;
|
||||
|
||||
InvalidateHue();
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
Weight = 5.0;
|
||||
}
|
||||
|
||||
public CharacterStatueMaker(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1076173; // Character Statue Maker
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StatueType StatueType
|
||||
{
|
||||
get => m_Type;
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
InvalidateHue();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set
|
||||
{
|
||||
m_IsRewardItem = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, new object[] { m_Type }))
|
||||
return;
|
||||
|
||||
if (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, 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 (m_IsRewardItem)
|
||||
list.Add(1076222); // 6th Year Veteran Reward
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(m_IsRewardItem);
|
||||
writer.Write((int)m_Type);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
m_Type = (StatueType)reader.ReadInt();
|
||||
}
|
||||
|
||||
public void InvalidateHue()
|
||||
{
|
||||
Hue = 0xB8F + (int)m_Type * 4;
|
||||
}
|
||||
}
|
||||
|
||||
public class MarbleStatueMaker : CharacterStatueMaker
|
||||
{
|
||||
[Constructible]
|
||||
public MarbleStatueMaker() : base(StatueType.Marble)
|
||||
{
|
||||
}
|
||||
|
||||
public MarbleStatueMaker(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class JadeStatueMaker : CharacterStatueMaker
|
||||
{
|
||||
[Constructible]
|
||||
public JadeStatueMaker() : base(StatueType.Jade)
|
||||
{
|
||||
}
|
||||
|
||||
public JadeStatueMaker(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class BronzeStatueMaker : CharacterStatueMaker
|
||||
{
|
||||
[Constructible]
|
||||
public BronzeStatueMaker() : base(StatueType.Bronze)
|
||||
{
|
||||
}
|
||||
|
||||
public BronzeStatueMaker(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
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)
|
||||
{
|
||||
m_Statue = statue;
|
||||
|
||||
InvalidateHue();
|
||||
}
|
||||
|
||||
public CharacterStatuePlinth(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1076201; // Character Statue
|
||||
public Item Deed => new CharacterStatueDeed(m_Statue);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Statue?.Deleted == false)
|
||||
m_Statue.Delete();
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
if (m_Statue != null)
|
||||
m_Statue.Map = Map;
|
||||
}
|
||||
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
if (m_Statue != null)
|
||||
m_Statue.Location = new Point3D(X, Y, Z + 5);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_Statue != null)
|
||||
from.SendGump(new CharacterPlinthGump(m_Statue));
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(m_Statue);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Statue = reader.ReadMobile() as CharacterStatue;
|
||||
|
||||
if (m_Statue?.SculptedBy == null || Map == Map.Internal) Timer.DelayCall(TimeSpan.Zero, Delete);
|
||||
}
|
||||
|
||||
public void InvalidateHue()
|
||||
{
|
||||
if (m_Statue != null)
|
||||
Hue = 0xB8F + (int)m_Statue.StatueType * 4 + (int)m_Statue.Material;
|
||||
}
|
||||
|
||||
private class CharacterPlinthGump : Gump
|
||||
{
|
||||
public CharacterPlinthGump(CharacterStatue statue) : base(60, 30)
|
||||
{
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Draggable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
AddImage(0, 0, 0x24F4);
|
||||
AddHtml(55, 50, 150, 20, statue.Name);
|
||||
AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString());
|
||||
AddHtmlLocalized(55, 100, 150, 20, GetTypeNumber(statue.StatueType), 0);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class CharacterStatueGump : Gump
|
||||
{
|
||||
private Item m_Maker;
|
||||
private Mobile m_Owner;
|
||||
private CharacterStatue m_Statue;
|
||||
|
||||
public CharacterStatueGump(Item maker, CharacterStatue statue, Mobile owner) : base(60, 36)
|
||||
{
|
||||
m_Maker = maker;
|
||||
m_Statue = statue;
|
||||
m_Owner = owner;
|
||||
|
||||
if (m_Statue == null)
|
||||
return;
|
||||
|
||||
Closable = true;
|
||||
Disposable = true;
|
||||
Draggable = true;
|
||||
Resizable = false;
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 327, 324, 0x13BE);
|
||||
AddImageTiled(10, 10, 307, 20, 0xA40);
|
||||
AddImageTiled(10, 40, 307, 244, 0xA40);
|
||||
AddImageTiled(10, 294, 307, 20, 0xA40);
|
||||
AddAlphaRegion(10, 10, 307, 304);
|
||||
AddHtmlLocalized(14, 12, 327, 20, 1076156, 0x7FFF); // Character Statue Maker
|
||||
|
||||
// pose
|
||||
AddHtmlLocalized(133, 41, 120, 20, 1076168, 0x7FFF); // Choose Pose
|
||||
AddHtmlLocalized(133, 61, 120, 20, 1076208 + (int)m_Statue.Pose, 0x77E);
|
||||
AddButton(163, 81, 0xFA5, 0xFA7, (int)Buttons.PoseNext);
|
||||
AddButton(133, 81, 0xFAE, 0xFB0, (int)Buttons.PosePrev);
|
||||
|
||||
// direction
|
||||
AddHtmlLocalized(133, 126, 120, 20, 1076170, 0x7FFF); // Choose Direction
|
||||
AddHtmlLocalized(133, 146, 120, 20, GetDirectionNumber(m_Statue.Direction), 0x77E);
|
||||
AddButton(163, 167, 0xFA5, 0xFA7, (int)Buttons.DirNext);
|
||||
AddButton(133, 167, 0xFAE, 0xFB0, (int)Buttons.DirPrev);
|
||||
|
||||
// material
|
||||
AddHtmlLocalized(133, 211, 120, 20, 1076171, 0x7FFF); // Choose Material
|
||||
AddHtmlLocalized(133, 231, 120, 20, GetMaterialNumber(m_Statue.StatueType, m_Statue.Material), 0x77E);
|
||||
AddButton(163, 253, 0xFA5, 0xFA7, (int)Buttons.MatNext);
|
||||
AddButton(133, 253, 0xFAE, 0xFB0, (int)Buttons.MatPrev);
|
||||
|
||||
// cancel
|
||||
AddButton(10, 294, 0xFB1, 0xFB2, (int)Buttons.Close);
|
||||
AddHtmlLocalized(45, 294, 80, 20, 1006045, 0x7FFF); // Cancel
|
||||
|
||||
// sculpt
|
||||
AddButton(234, 294, 0xFB7, 0xFB9, (int)Buttons.Sculpt);
|
||||
AddHtmlLocalized(269, 294, 80, 20, 1076174, 0x7FFF); // Sculpt
|
||||
|
||||
// restore
|
||||
if (m_Maker is CharacterStatueDeed)
|
||||
{
|
||||
AddButton(107, 294, 0xFAB, 0xFAD, (int)Buttons.Restore);
|
||||
AddHtmlLocalized(142, 294, 80, 20, 1076193, 0x7FFF); // Restore
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_Statue?.Deleted != false)
|
||||
return;
|
||||
|
||||
bool sendGump = false;
|
||||
|
||||
if (info.ButtonID == (int)Buttons.Sculpt)
|
||||
{
|
||||
if (m_Maker is CharacterStatueDeed deed)
|
||||
{
|
||||
CharacterStatue backup = deed.Statue;
|
||||
|
||||
backup?.Delete();
|
||||
}
|
||||
|
||||
m_Maker?.Delete();
|
||||
|
||||
m_Statue.Sculpt(state.Mobile);
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.PosePrev)
|
||||
{
|
||||
m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 5) % 6);
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.PoseNext)
|
||||
{
|
||||
m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 1) % 6);
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.DirPrev)
|
||||
{
|
||||
m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 7) % 8);
|
||||
m_Statue.InvalidatePose();
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.DirNext)
|
||||
{
|
||||
m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 1) % 8);
|
||||
m_Statue.InvalidatePose();
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.MatPrev)
|
||||
{
|
||||
m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 3) % 4);
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.MatNext)
|
||||
{
|
||||
m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 1) % 4);
|
||||
sendGump = true;
|
||||
}
|
||||
else if (info.ButtonID == (int)Buttons.Restore)
|
||||
{
|
||||
if (m_Maker is CharacterStatueDeed deed)
|
||||
{
|
||||
CharacterStatue backup = deed.Statue;
|
||||
|
||||
if (backup != null)
|
||||
m_Statue.Restore(backup);
|
||||
}
|
||||
|
||||
sendGump = true;
|
||||
}
|
||||
else // Close
|
||||
{
|
||||
sendGump = !m_Statue.Demolish(state.Mobile);
|
||||
}
|
||||
|
||||
if (sendGump)
|
||||
state.Mobile.SendGump(new CharacterStatueGump(m_Maker, m_Statue, m_Owner));
|
||||
}
|
||||
|
||||
private enum Buttons
|
||||
{
|
||||
Close,
|
||||
Sculpt,
|
||||
PosePrev,
|
||||
PoseNext,
|
||||
DirPrev,
|
||||
DirNext,
|
||||
MatPrev,
|
||||
MatNext,
|
||||
Restore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
namespace Server.Network
|
||||
{
|
||||
public class UpdateStatueAnimation : Packet
|
||||
{
|
||||
public UpdateStatueAnimation(Mobile m, int status, int animation, int frame) : base(0xBF, 17)
|
||||
{
|
||||
m_Stream.Write((short)0x11);
|
||||
m_Stream.Write((short)0x19);
|
||||
m_Stream.Write((byte)0x5);
|
||||
m_Stream.Write(m.Serial);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)0xFF);
|
||||
m_Stream.Write((byte)status);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)animation);
|
||||
m_Stream.Write((byte)0);
|
||||
m_Stream.Write((byte)frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue