Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 • committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,58 @@
using System.Linq;
using Server.Items;
using Server.Spells.Sixth;
using Server.Targeting;
namespace Server.Regions
{
public class HouseRaffleRegion : BaseRegion
{
private HouseRaffleStone m_Stone;
public HouseRaffleRegion(HouseRaffleStone stone)
: base(null, stone.PlotFacet, DefaultPriority, stone.PlotBounds)
{
m_Stone = stone;
}
public override bool AllowHousing(Mobile from, Point3D p)
{
if (m_Stone == null)
return false;
if (m_Stone.IsExpired)
return true;
if (m_Stone.Deed == null)
return false;
Container pack = from.Backpack;
if (pack != null && ContainsDeed(pack))
return true;
BankBox bank = from.FindBankNoCreate();
if (bank != null && ContainsDeed(bank))
return true;
return false;
}
private bool ContainsDeed(Container cont)
{
return cont.FindItemsByType<HouseRaffleDeed>().Any(deed => deed == m_Stone.Deed);
}
public override bool OnTarget(Mobile m, Target t, object o)
{
if (m.Spell is MarkSpell && m.AccessLevel == AccessLevel.Player)
{
m.SendLocalizedMessage(501800); // You cannot mark an object at that location.
return false;
}
return base.OnTarget(m, t, o);
}
}
}