RedBeard
Member
This seems to do what it is suppose to do. The problem is when an NPC steps on the teleporter it crashes the server:
any suggestions?Unable to cast object of type 'Server.Mobiles.TavernKeeper' to type 'Server.Mobiles.PlayerMobile'.
at Server.Items.ThievesGuildTeleporter.OnMoveOver(Mobile m)
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
using Server.Network;
using Server.SkillHandlers;
using Server.Mobiles;
using Server.Guilds;
namespace Server.Items
{
public class ThievesGuildTeleporter : Teleporter
{
[Constructable]
public ThievesGuildTeleporter()
{
}
public ThievesGuildTeleporter(Serial serial)
: base(serial)
{
}
public override bool OnMoveOver(Mobile m)
{
PlayerMobile player = (PlayerMobile)m;
if (!m.Player)
{
return false;
}
if (m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild)
return base.OnMoveOver(m);
if (Stealing.SuspendOnMurder && m.Kills > 0)
{
// You are currently suspended from the thieves guild. They would frown upon your actions.
m.SendLocalizedMessage(501703);
return false;
}
else
{
m.SendMessage("Only active members of the Thieves Guild may enter.");
return false;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}