Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
395
Scripts/Items/Functional/SeedBox/SeedBox.cs
Normal file
395
Scripts/Items/Functional/SeedBox/SeedBox.cs
Normal file
@@ -0,0 +1,395 @@
|
||||
using System;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.VeteranRewards;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using System.Linq;
|
||||
using Server.ContextMenus;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
{
|
||||
[FlipableAttribute(19288, 19290)]
|
||||
public class SeedBox : Container, IRewardItem, ISecurable
|
||||
{
|
||||
public static readonly int MaxSeeds = 5000;
|
||||
public static readonly int MaxUnique = 300;
|
||||
|
||||
public override int DefaultMaxItems { get { return MaxUnique; } }
|
||||
public override bool DisplaysContent { get { return false; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsRewardItem { get; set; }
|
||||
|
||||
public List<SeedEntry> Entries { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int TotalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if(Entries != null)
|
||||
Entries.ForEach(e => count += e == null || e.Seed == null ? 0 : e.Seed.Amount);
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UniqueCount
|
||||
{
|
||||
get { return Entries == null ? 0 : Entries.Where(e => e != null && e.Seed != null && e.Seed.Amount > 0).Count(); }
|
||||
}
|
||||
|
||||
public override double DefaultWeight { get { return 10.0; } }
|
||||
|
||||
[Constructable]
|
||||
public SeedBox() : base(19288)
|
||||
{
|
||||
Entries = new List<SeedEntry>();
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
Level = SecureLevel.Owner;
|
||||
}
|
||||
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (IsChildOf(m.Backpack) || (CheckAccessible(m) && m.InRange(this.GetWorldLocation(), 3)))
|
||||
{
|
||||
if (m is PlayerMobile)
|
||||
BaseGump.SendGump(new SeedBoxGump((PlayerMobile)m, this));
|
||||
}
|
||||
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
base.OnDoubleClick(m);
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries(from, list);
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
public bool CheckAccessible(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel >= AccessLevel.GameMaster)
|
||||
return true;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (house == null)
|
||||
return true;
|
||||
|
||||
switch (Level)
|
||||
{
|
||||
case SecureLevel.Owner: return house.IsOwner(from);
|
||||
case SecureLevel.CoOwners: return house.IsCoOwner(from);
|
||||
case SecureLevel.Friends: return house.IsFriend(from);
|
||||
case SecureLevel.Anyone: return true;
|
||||
case SecureLevel.Guild: return house.IsGuildMember(from);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (dropped is Seed)
|
||||
{
|
||||
return TryAddSeed(from, (Seed)dropped);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1151838); // This item cannot be stored in the seed box.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryAddSeed(Mobile from, Seed seed, int index = -1)
|
||||
{
|
||||
if (!from.Backpack.CheckHold(from, seed, true, true) || seed.Amount <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!from.InRange(this.GetWorldLocation(), 3) || from.Map != this.Map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (TotalCount + seed.Amount <= MaxSeeds)
|
||||
{
|
||||
SeedEntry entry = GetExisting(seed);
|
||||
int oldcount = UniqueCount;
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
entry.Seed.Amount += seed.Amount;
|
||||
seed.Delete();
|
||||
|
||||
entry.Seed.InvalidateProperties();
|
||||
}
|
||||
else if (UniqueCount < MaxUnique)
|
||||
{
|
||||
entry = new SeedEntry(seed);
|
||||
DropItem(seed);
|
||||
|
||||
seed.Movable = false;
|
||||
seed.InvalidateProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1151839); // There is not enough room in the box.
|
||||
}
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
if (Entries.Contains(entry))
|
||||
{
|
||||
if (index > -1 && index < Entries.Count - 1)
|
||||
{
|
||||
Entries.Remove(entry);
|
||||
AddEntry(entry, index);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index > -1 && index < Entries.Count)
|
||||
{
|
||||
AddEntry(entry, index);
|
||||
}
|
||||
else
|
||||
AddEntry(entry);
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1151846); // You put the seed in the seedbox.
|
||||
|
||||
if (from is PlayerMobile)
|
||||
{
|
||||
var gump = new SeedBoxGump((PlayerMobile)from, this);
|
||||
gump.CheckPage(entry);
|
||||
|
||||
BaseGump.SendGump(gump);
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1151839); // There is not enough room in the box.
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void AddEntry(SeedEntry entry, int index = -1)
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
TrimEntries();
|
||||
Entries.Add(entry);
|
||||
}
|
||||
else if (index >= 0 && index < Entries.Count)
|
||||
{
|
||||
Entries.Insert(index, entry);
|
||||
}
|
||||
|
||||
if (Entries.Count > 0)
|
||||
{
|
||||
if (ItemID == 19288)
|
||||
{
|
||||
ItemID = 19289;
|
||||
}
|
||||
else if (ItemID == 19290)
|
||||
{
|
||||
ItemID = 19291;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveEntry(SeedEntry entry)
|
||||
{
|
||||
Entries.Remove(entry);
|
||||
TrimEntries();
|
||||
|
||||
if (Entries.Count == 0)
|
||||
{
|
||||
if (ItemID == 19289)
|
||||
{
|
||||
ItemID = 19288;
|
||||
}
|
||||
else if (ItemID == 19291)
|
||||
{
|
||||
ItemID = 19290;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DropSeed(Mobile from, SeedEntry entry, int amount)
|
||||
{
|
||||
if (amount > entry.Seed.Amount)
|
||||
amount = entry.Seed.Amount;
|
||||
|
||||
Seed seed;
|
||||
|
||||
if (amount == entry.Seed.Amount)
|
||||
{
|
||||
seed = entry.Seed;
|
||||
entry.Seed = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
seed = new Seed(entry.Seed.PlantType, entry.Seed.PlantHue, true);
|
||||
seed.Amount = amount;
|
||||
|
||||
entry.Seed.Amount -= amount;
|
||||
}
|
||||
|
||||
seed.Movable = true;
|
||||
|
||||
if (from.Backpack == null || !from.Backpack.TryDropItem(from, seed, false))
|
||||
{
|
||||
seed.MoveToWorld(from.Location, from.Map);
|
||||
from.SendLocalizedMessage(1151844); // There is not enough room in your backpack!
|
||||
}
|
||||
|
||||
if (entry.Seed != null && entry.Seed.Amount <= 0)
|
||||
{
|
||||
entry.Seed.Delete();
|
||||
entry.Seed = null;
|
||||
}
|
||||
|
||||
if (entry.Seed == null || entry.Seed.Amount <= 0)
|
||||
{
|
||||
RemoveEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public SeedEntry GetExisting(Seed seed)
|
||||
{
|
||||
return Entries.FirstOrDefault(e => e != null && e.Seed != null && e.Seed.PlantType == seed.PlantType && e.Seed.PlantHue == seed.PlantHue);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (IsRewardItem)
|
||||
{
|
||||
list.Add(1076220); // 4th Year Veteran Reward
|
||||
}
|
||||
|
||||
list.Add(1151847, String.Format("{0}\t{1}", TotalCount.ToString(), MaxSeeds.ToString())); // Seeds in Box: ~1_val~ / ~2_val~
|
||||
list.Add(1151848, String.Format("{0}\t{1}", UniqueCount.ToString(), MaxUnique.ToString())); // Unique Seeds In Box: ~1_val~ / ~2_val~
|
||||
}
|
||||
|
||||
private void CheckEntries()
|
||||
{
|
||||
List<Item> toDelete = new List<Item>(this.Items);
|
||||
|
||||
foreach (var item in toDelete.Where(i => i != null && i.Amount == 0))
|
||||
item.Delete();
|
||||
|
||||
List<SeedEntry> entries = new List<SeedEntry>(Entries);
|
||||
|
||||
foreach(var entry in entries.Where(e => e != null && (e.Seed == null || e.Seed.Amount == 0 || e.Seed.Deleted)))
|
||||
Entries.Remove(entry);
|
||||
|
||||
ColUtility.Free(entries);
|
||||
ColUtility.Free(toDelete);
|
||||
}
|
||||
|
||||
public void TrimEntries()
|
||||
{
|
||||
int lastIndex = Entries.FindLastIndex(e => e != null);
|
||||
|
||||
if (lastIndex + 1 < Entries.Count - 1)
|
||||
{
|
||||
Entries.RemoveRange(lastIndex + 1, (Entries.Count - 1) - lastIndex);
|
||||
}
|
||||
|
||||
Entries.TrimExcess();
|
||||
}
|
||||
|
||||
public SeedBox(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(IsRewardItem);
|
||||
writer.Write((int)Level);
|
||||
|
||||
writer.Write(Entries.Count);
|
||||
for (int i = 0; i < Entries.Count; i++)
|
||||
{
|
||||
SeedEntry entry = Entries[i];
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
writer.Write(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(1);
|
||||
entry.Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
Entries = new List<SeedEntry>();
|
||||
|
||||
IsRewardItem = reader.ReadBool();
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
switch (reader.ReadInt())
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
Entries.Add(null);
|
||||
break;
|
||||
case 1:
|
||||
SeedEntry entry = new SeedEntry(reader);
|
||||
|
||||
if (entry.Seed != null)
|
||||
Entries.Add(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall(
|
||||
() =>
|
||||
{
|
||||
foreach (var item in Items.Where(i => i.Movable))
|
||||
item.Movable = false;
|
||||
});
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(10), CheckEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
299
Scripts/Items/Functional/SeedBox/SeedBoxGump.cs
Normal file
299
Scripts/Items/Functional/SeedBox/SeedBoxGump.cs
Normal file
@@ -0,0 +1,299 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
{
|
||||
public class SeedBoxGump : BaseGump
|
||||
{
|
||||
public SeedBox Box { get; set; }
|
||||
public int Page { get; set; }
|
||||
|
||||
public int Pages { get { return (int)Math.Ceiling((double)Box.Entries.Count / 20.0); } }
|
||||
|
||||
public SeedBoxGump(PlayerMobile user, SeedBox box, int page = 1) : base(user, 100, 100)
|
||||
{
|
||||
Box = box;
|
||||
Page = page;
|
||||
|
||||
user.CloseGump(this.GetType());
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
AddImage(0, 0, 2172);
|
||||
|
||||
int start = (Page - 1) * 20;
|
||||
int index = 0;
|
||||
|
||||
AddHtmlLocalized(100, 345, 300, 20, 1151850, String.Format("{0}\t{1}", Page.ToString(), Pages.ToString()), 0xFFFF, false, false);
|
||||
|
||||
if (Page > 1)
|
||||
{
|
||||
AddButton(45, 345, 5603, 5603, 1, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
if (Page < Pages)
|
||||
{
|
||||
AddButton(235, 345, 5601, 5601, 2, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
for (int i = start; i < Box.Entries.Count && i < start + 20; i++)
|
||||
{
|
||||
SeedEntry entry = Box.Entries[i];
|
||||
|
||||
if (entry == null || entry.Seed == null)
|
||||
{
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int x; int y;
|
||||
|
||||
if (index < 4)
|
||||
{
|
||||
x = 15 + (index * 70);
|
||||
y = 15;
|
||||
}
|
||||
else if (index < 8)
|
||||
{
|
||||
x = 15 + ((index - 4) * 70);
|
||||
y = 82;
|
||||
}
|
||||
else if (index < 12)
|
||||
{
|
||||
x = 15 + ((index - 8) * 70);
|
||||
y = 149;
|
||||
}
|
||||
else if (index < 16)
|
||||
{
|
||||
x = 15 + ((index - 12) * 70);
|
||||
y = 216;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 15 + ((index - 16) * 70);
|
||||
y = 283;
|
||||
}
|
||||
|
||||
AddButton(x, y, entry.Image, entry.Image, i + 100, GumpButtonType.Reply, 0);
|
||||
AddItem(x, y + 30, 0xDCF, entry.Seed.Hue);
|
||||
|
||||
AddItemProperty(entry.Seed.Serial);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckPage(SeedEntry entry)
|
||||
{
|
||||
int index = Box.Entries.IndexOf(entry);
|
||||
|
||||
Page = (int)Math.Ceiling((double)(index + 1) / 20);
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
if (Box.Deleted)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: // page back
|
||||
Page--;
|
||||
|
||||
if (Page < 1)
|
||||
Page = 1;
|
||||
|
||||
Refresh();
|
||||
break;
|
||||
case 2: // page forward
|
||||
Page++;
|
||||
|
||||
if (Page > Pages)
|
||||
Page = Pages;
|
||||
|
||||
Refresh();
|
||||
break;
|
||||
default:
|
||||
int id = info.ButtonID - 100;
|
||||
|
||||
if (id >= 0 && id < Box.Entries.Count)
|
||||
{
|
||||
SeedEntry entry = Box.Entries[id];
|
||||
|
||||
if (entry == null)
|
||||
return;
|
||||
|
||||
Refresh();
|
||||
BaseGump.SendGump(new SeedInfoGump(User, Box, entry, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SeedInfoGump : BaseGump
|
||||
{
|
||||
public SeedBox Box { get; set; }
|
||||
public SeedEntry Entry { get; set; }
|
||||
|
||||
public static int TextHue = 0x696969;
|
||||
|
||||
public SeedInfoGump(PlayerMobile user, SeedBox box, SeedEntry entry, SeedBoxGump par) : base(user, parent: par)
|
||||
{
|
||||
Box = box;
|
||||
Entry = entry;
|
||||
|
||||
user.CloseGump(this.GetType());
|
||||
}
|
||||
|
||||
public override void AddGumpLayout()
|
||||
{
|
||||
if (Entry == null || Entry.Seed == null)
|
||||
{
|
||||
User.CloseGump(this.GetType());
|
||||
return;
|
||||
}
|
||||
|
||||
AddBackground(0, 0, 300, 280, 5170);
|
||||
|
||||
string args;
|
||||
int seedloc = Entry.Seed.GetLabel(out args);
|
||||
int index = Box.Entries.IndexOf(Entry);
|
||||
|
||||
AddHtmlLocalized(30, 25, 270, 20, seedloc, args, C32216(TextHue), false, false);
|
||||
|
||||
AddHtmlLocalized(50, 60, 150, 20, 1151840, C32216(TextHue), false, false); // Remove: 1
|
||||
AddButton(30, 60, 10740, 10740, 1, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized(50, 90, 150, 20, 1151841, Entry.Seed.Amount.ToString(), C32216(TextHue), false, false); // Remove: ~1_val~
|
||||
AddButton(30, 90, 10740, 10740, 2, GumpButtonType.Reply, 0);
|
||||
|
||||
if (index > 0)
|
||||
{
|
||||
AddHtmlLocalized(50, 120, 150, 20, 1151851, C32216(TextHue), false, false); // Insert Seed Before
|
||||
AddButton(30, 120, 10740, 10740, 3, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddImage(30, 120, 10740);
|
||||
|
||||
if (Box.Entries.Count < SeedBox.MaxUnique)
|
||||
{
|
||||
AddHtmlLocalized(50, 150, 150, 20, 1151852, C32216(TextHue), false, false); // Insert Seed After
|
||||
AddButton(30, 150, 10740, 10740, 4, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddImage(30, 150, 10740);
|
||||
|
||||
if (index < Box.Entries.Count && Box.Entries.Count < SeedBox.MaxUnique)
|
||||
{
|
||||
AddHtmlLocalized(50, 180, 150, 20, 1151842, C32216(TextHue), false, false); // Shift Right
|
||||
AddButton(30, 180, 10740, 10740, 5, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddImage(30, 180, 10740);
|
||||
|
||||
if (index > 0 && Box.Entries[index - 1] == null)
|
||||
{
|
||||
AddHtmlLocalized(50, 210, 150, 20, 1151843, C32216(TextHue), false, false); // Shift Left
|
||||
AddButton(30, 210, 10740, 10740, 6, GumpButtonType.Reply, 0);
|
||||
}
|
||||
else
|
||||
AddImage(30, 210, 10740);
|
||||
}
|
||||
|
||||
public override void OnResponse(RelayInfo info)
|
||||
{
|
||||
if (Box.Deleted)
|
||||
return;
|
||||
|
||||
int index = Box.Entries.IndexOf(Entry);
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: break;
|
||||
case 1:
|
||||
Box.DropSeed(User, Entry, 1);
|
||||
|
||||
RefreshParent();
|
||||
break;
|
||||
case 2:
|
||||
Box.DropSeed(User, Entry, Entry.Seed.Amount);
|
||||
|
||||
RefreshParent();
|
||||
break;
|
||||
case 3:
|
||||
User.SendLocalizedMessage(1151849); // Click this button and target a seed to add it here.
|
||||
User.BeginTarget(-1, false, TargetFlags.None, (from, targeted) =>
|
||||
{
|
||||
Seed seed = targeted as Seed;
|
||||
|
||||
if (seed != null)
|
||||
{
|
||||
if (Box != null && !Box.Deleted && index > 0)
|
||||
{
|
||||
Box.TryAddSeed(User, seed, index);
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1151838); // This item cannot be stored in the seed box.
|
||||
|
||||
RefreshParent();
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
if (Box.Entries.Count < SeedBox.MaxUnique)
|
||||
{
|
||||
User.SendLocalizedMessage(1151849); // Click this button and target a seed to add it here.
|
||||
User.BeginTarget(-1, false, TargetFlags.None, (from, targeted) =>
|
||||
{
|
||||
Seed seed = targeted as Seed;
|
||||
|
||||
if (seed != null)
|
||||
{
|
||||
if (Box != null && !Box.Deleted && index > 0)
|
||||
{
|
||||
Box.TryAddSeed(User, seed, index + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1151838); // This item cannot be stored in the seed box.
|
||||
|
||||
RefreshParent();
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 5: // shift right
|
||||
if (index >= 0 && index < Box.Entries.Count && Box.Entries.Count < SeedBox.MaxUnique)
|
||||
{
|
||||
Box.Entries.Insert(index, null);
|
||||
|
||||
if (index + 2 < Box.Entries.Count && Box.Entries[index + 2] == null)
|
||||
Box.Entries.RemoveAt(index + 2);
|
||||
|
||||
if (Parent is SeedBoxGump)
|
||||
((SeedBoxGump)Parent).CheckPage(Entry);
|
||||
|
||||
RefreshParent(true);
|
||||
}
|
||||
break;
|
||||
case 6: // shift left
|
||||
if (index >= 0 && index < Box.Entries.Count && Box.Entries[index - 1] == null)
|
||||
{
|
||||
Box.Entries.Remove(Entry);
|
||||
Box.Entries.Insert(index - 1, Entry);
|
||||
Box.TrimEntries();
|
||||
if(Parent is SeedBoxGump)
|
||||
((SeedBoxGump)Parent).CheckPage(Entry);
|
||||
RefreshParent(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Scripts/Items/Functional/SeedBox/SeedEntry.cs
Normal file
37
Scripts/Items/Functional/SeedBox/SeedEntry.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Engines.Plants;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
{
|
||||
public class SeedEntry
|
||||
{
|
||||
public Seed Seed { get; set; }
|
||||
public int Image { get; set; }
|
||||
|
||||
public SeedEntry(Seed seed)
|
||||
{
|
||||
Seed = seed;
|
||||
|
||||
seed.ShowType = true;
|
||||
|
||||
Image = Utility.Random(2183, 3);
|
||||
}
|
||||
|
||||
public SeedEntry(GenericReader reader)
|
||||
{
|
||||
int v = reader.ReadInt();
|
||||
|
||||
Seed = reader.ReadItem() as Seed;
|
||||
Image = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(Seed);
|
||||
writer.Write(Image);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user