mirror of
https://github.com/ServUO/ServUO
synced 2026-08-11 20:23:04 -04:00
-Fixed issue where client helpers could bypass the container gump and add items directly to the seed box -SearedFireAntGoo is no longer stackable -Blue NPC's (mainly vendors, not initial innocent) can no longer be attacked on trammel maps -Aggressors/Aggressed from pet masters now works properly. This was suspected to crated large numbers to redundant aggressor/aggressed added to a mobiles aggressor/aggressed lists -Aggressive action for healing a mobile while fighting another mobile has been re-enabled -AuraDamage is now a harmful act, ie those affected will aggro on your pet! -MLDryads should no longer attack other wild creatures during Blackthorn Invasion Instance -More code cleanup
93 lines
2.1 KiB
C#
93 lines
2.1 KiB
C#
using Server.Network;
|
|
using System;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public abstract class FarmableCrop : Item
|
|
{
|
|
private bool m_Picked;
|
|
public FarmableCrop(int itemID)
|
|
: base(itemID)
|
|
{
|
|
Movable = false;
|
|
}
|
|
|
|
public FarmableCrop(Serial serial)
|
|
: base(serial)
|
|
{
|
|
}
|
|
|
|
public abstract Item GetCropObject();
|
|
|
|
public abstract int GetPickedID();
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
Map map = Map;
|
|
Point3D loc = Location;
|
|
|
|
if (Parent != null || Movable || IsLockedDown || IsSecure || map == null || map == Map.Internal)
|
|
return;
|
|
|
|
if (!from.InRange(loc, 2) || !from.InLOS(this))
|
|
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
|
else if (!m_Picked)
|
|
OnPicked(from, loc, map);
|
|
}
|
|
|
|
public virtual void OnPicked(Mobile from, Point3D loc, Map map)
|
|
{
|
|
ItemID = GetPickedID();
|
|
|
|
Item spawn = GetCropObject();
|
|
|
|
if (spawn != null)
|
|
spawn.MoveToWorld(loc, map);
|
|
|
|
m_Picked = true;
|
|
|
|
Unlink();
|
|
|
|
Timer.DelayCall(TimeSpan.FromMinutes(5.0), Delete);
|
|
}
|
|
|
|
public void Unlink()
|
|
{
|
|
ISpawner se = Spawner;
|
|
|
|
if (se != null)
|
|
{
|
|
Spawner.Remove(this);
|
|
Spawner = null;
|
|
}
|
|
}
|
|
|
|
public override void Serialize(GenericWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
writer.WriteEncodedInt(0); // version
|
|
|
|
writer.Write(m_Picked);
|
|
}
|
|
|
|
public override void Deserialize(GenericReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
|
|
int version = reader.ReadEncodedInt();
|
|
|
|
switch (version)
|
|
{
|
|
case 0:
|
|
m_Picked = reader.ReadBool();
|
|
break;
|
|
}
|
|
if (m_Picked)
|
|
{
|
|
Unlink();
|
|
Delete();
|
|
}
|
|
}
|
|
}
|
|
}
|