using System;
using Server;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Items
{
public class Headpost : Item
{
[Constructable]
public Headpost()
: base(0x1296)
{
Name = "Headpost";
//You had Movable with a small m
Movable = false;
}
public Headpost(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
public override void OnDoubleClick(Mobile from)
{
//You are not supposed to send the mobile as a target parament, but the headpost. We do this with the "this" keyword
//from.Target = new HeadpostTarget(from);
from.Target = new HeadpostTarget(this);
}
private class HeadpostTarget : Target
{
public Headpost m_Post;
public HeadpostTarget(Headpost post)
: base(3, false, TargetFlags.None)
{
//m.SendMessage("Target a head.");
m_Post = post;
}
//You had the wrong paraments for OnTarget, will be fixed with intellisence
//protected override void OnTarget(Item m)
protected override void OnTarget(Mobile from, object targeted)
{
Point3D headLocation = m_Post.Location;
headLocation.Z += 18;
//The head instaces doesnt exist yet, how will you get it?
//head.MoveToWorld(headLocation);
}
}
}
}