This commit is contained in:
parent
c63a5f13fa
commit
2204d5fb86
86 changed files with 1077 additions and 257 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
@ -11,7 +12,7 @@ namespace Server.Items
|
|||
Modern
|
||||
}
|
||||
|
||||
public class HolidayTree : Item
|
||||
public class HolidayTree : Item, IAddon
|
||||
{
|
||||
private ArrayList m_Components;
|
||||
private Mobile m_Placer;
|
||||
|
|
@ -208,6 +209,16 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
public bool CouldFit( IPoint3D p, Map map )
|
||||
{
|
||||
return map.CanFit( (Point3D)p, 20 );
|
||||
}
|
||||
|
||||
Item IAddon.Deed
|
||||
{
|
||||
get{ return new HolidayTreeDeed(); }
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
|
@ -253,8 +264,22 @@ namespace Server.Items
|
|||
break;
|
||||
}
|
||||
}
|
||||
ValidatePlacement();
|
||||
}
|
||||
|
||||
public void ValidatePlacement()
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house == null )
|
||||
{
|
||||
HolidayTreeDeed deed = new HolidayTreeDeed();
|
||||
deed.MoveToWorld( Location, Map );
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
|
|
@ -265,6 +290,13 @@ namespace Server.Items
|
|||
|
||||
this.Delete();
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house != null && house.Addons.Contains( this ) )
|
||||
{
|
||||
house.Addons.Remove( this );
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 503393 ); // A deed for the tree has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ using Server.Targeting;
|
|||
using Server.ContextMenus;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Ninjitsu;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
|
@ -144,20 +146,27 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( this.RootParent == from ) // TODO: Previous implementation allowed use on ground, without house protection checks. What is the correct behavior?
|
||||
if ( this.RootParent != from ) // TODO: Previous implementation allowed use on ground, without house protection checks. What is the correct behavior?
|
||||
{
|
||||
if ( Pet == null )
|
||||
{
|
||||
LinkPet( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
SummonPet( from );
|
||||
}
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
AnimalFormContext animalContext = AnimalForm.GetContext( from );
|
||||
|
||||
if( Core.ML && animalContext != null )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1080073 ); // You cannot use a Crystal Ball of Pet Summoning while in animal form.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Pet == null )
|
||||
{
|
||||
LinkPet( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1042001 ); // That must be in your pack for you to use it.
|
||||
CastSummonPet( from );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +229,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public void SummonPet( Mobile from )
|
||||
public void CastSummonPet( Mobile from )
|
||||
{
|
||||
BaseCreature pet = this.Pet;
|
||||
|
||||
|
|
@ -251,27 +260,48 @@ namespace Server.Items
|
|||
{
|
||||
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, 0x22, 3, "", "You cannot summon your pet to this location." ) );
|
||||
}
|
||||
else if ( Core.ML && from is PlayerMobile && DateTime.Now < ((PlayerMobile)from).LastPetBallTime.AddSeconds( 15.0 ) )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1080072, 0x22 ); // You must wait a few seconds before you can summon your pet.
|
||||
}
|
||||
else
|
||||
{
|
||||
Charges--;
|
||||
if( Core.ML )
|
||||
new PetSummoningSpell( this, from ).Cast();
|
||||
else
|
||||
SummonPet( from );
|
||||
}
|
||||
|
||||
if ( pet.IsStabled )
|
||||
{
|
||||
pet.SetControlMaster( from );
|
||||
}
|
||||
|
||||
if ( pet.Summoned )
|
||||
pet.SummonMaster = from;
|
||||
|
||||
public void SummonPet( Mobile from )
|
||||
{
|
||||
BaseCreature pet = this.Pet;
|
||||
|
||||
pet.ControlTarget = from;
|
||||
pet.ControlOrder = OrderType.Follow;
|
||||
Charges--;
|
||||
|
||||
pet.IsStabled = false;
|
||||
from.Stabled.Remove( pet );
|
||||
}
|
||||
if ( pet.IsStabled )
|
||||
{
|
||||
pet.SetControlMaster( from );
|
||||
|
||||
pet.MoveToWorld( from.Location, from.Map );
|
||||
if ( pet.Summoned )
|
||||
pet.SummonMaster = from;
|
||||
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1054128, 0x43 ); // The Crystal Ball fills with a green mist. Your pet has been summoned.
|
||||
pet.ControlTarget = from;
|
||||
pet.ControlOrder = OrderType.Follow;
|
||||
|
||||
pet.IsStabled = false;
|
||||
from.Stabled.Remove( pet );
|
||||
}
|
||||
|
||||
pet.MoveToWorld( from.Location, from.Map );
|
||||
|
||||
MessageHelper.SendLocalizedMessageTo( this, from, 1054128, 0x43 ); // The Crystal Ball fills with a green mist. Your pet has been summoned.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
{
|
||||
((PlayerMobile)from).LastPetBallTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -341,5 +371,94 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PetSummoningSpell : Spell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo( "Ball Of Summoning", "", 230 );
|
||||
|
||||
private BallOfSummoning m_Ball;
|
||||
private Mobile m_Caster;
|
||||
|
||||
public PetSummoningSpell( BallOfSummoning ball, Mobile caster )
|
||||
: base( caster, null, m_Info )
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Ball = ball;
|
||||
}
|
||||
|
||||
public override bool ClearHandsOnCast { get { return false; } }
|
||||
public override bool RevealOnCast { get { return true; } }
|
||||
|
||||
public override TimeSpan GetCastRecovery()
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public override double CastDelayFastScalar { get { return 0; } }
|
||||
|
||||
public override TimeSpan CastDelayBase
|
||||
{
|
||||
get
|
||||
{
|
||||
return TimeSpan.FromSeconds( 2.0 );
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetMana()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override bool ConsumeReagents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckFizzle()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool m_Stop;
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
m_Stop = true;
|
||||
Disturb( DisturbType.Hurt, false, false );
|
||||
}
|
||||
|
||||
public override bool CheckDisturb( DisturbType type, bool checkFirst, bool resistable )
|
||||
{
|
||||
if( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DoHurtFizzle()
|
||||
{
|
||||
if( !m_Stop )
|
||||
base.DoHurtFizzle();
|
||||
}
|
||||
|
||||
public override void DoFizzle()
|
||||
{
|
||||
if( !m_Stop )
|
||||
base.DoFizzle();
|
||||
}
|
||||
|
||||
public override void OnDisturb( DisturbType type, bool message )
|
||||
{
|
||||
if( message && !m_Stop )
|
||||
Caster.SendLocalizedMessage( 1080074 ); // You have been disrupted while attempting to summon your pet!
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
m_Ball.SummonPet( m_Caster );
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue