#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
462
Scripts/Mobiles/Animals/Pets/BaseMount.cs
Normal file
462
Scripts/Mobiles/Animals/Pets/BaseMount.cs
Normal file
|
|
@ -0,0 +1,462 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public abstract class BaseMount : BaseCreature, IMount
|
||||
{
|
||||
private Mobile m_Rider;
|
||||
private Item m_InternalItem;
|
||||
private DateTime m_NextMountAbility;
|
||||
|
||||
public virtual TimeSpan MountAbilityDelay { get { return TimeSpan.Zero; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime NextMountAbility
|
||||
{
|
||||
get { return m_NextMountAbility; }
|
||||
set { m_NextMountAbility = value; }
|
||||
}
|
||||
|
||||
protected Item InternalItem { get { return m_InternalItem; } }
|
||||
|
||||
public virtual bool AllowMaleRider{ get{ return true; } }
|
||||
public virtual bool AllowFemaleRider{ get{ return true; } }
|
||||
|
||||
public BaseMount( string name, int bodyID, int itemID, AIType aiType, FightMode fightMode, int rangePerception, int rangeFight, double activeSpeed, double passiveSpeed ) : base ( aiType, fightMode, rangePerception, rangeFight, activeSpeed, passiveSpeed )
|
||||
{
|
||||
Name = name;
|
||||
Body = bodyID;
|
||||
|
||||
m_InternalItem = new MountItem( this, itemID );
|
||||
}
|
||||
|
||||
public BaseMount( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_NextMountAbility );
|
||||
|
||||
writer.Write( m_Rider );
|
||||
writer.Write( m_InternalItem );
|
||||
}
|
||||
|
||||
[Hue, CommandProperty( AccessLevel.GameMaster )]
|
||||
public override int Hue
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Hue;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Hue = value;
|
||||
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.Hue = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
Rider = null;
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.Delete();
|
||||
|
||||
m_InternalItem = null;
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
Rider = null;
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_NextMountAbility = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Rider = reader.ReadMobile();
|
||||
m_InternalItem = reader.ReadItem();
|
||||
|
||||
if ( m_InternalItem == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnDisallowedRider( Mobile m )
|
||||
{
|
||||
m.SendMessage( "You may not ride this creature." );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsDeadPet )
|
||||
return;
|
||||
|
||||
Region reg = from.Region;
|
||||
|
||||
if ( reg.NoMounts( from, from.Location ) )
|
||||
{
|
||||
from.SendMessage( "You cannot mount that in here!" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.IsBodyMod && !from.Body.IsHuman )
|
||||
{
|
||||
from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !CheckMountAllowed( from, true ) )
|
||||
return;
|
||||
|
||||
if ( from.Mounted )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005583 ); // Please dismount first.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.Female ? !AllowFemaleRider : !AllowMaleRider )
|
||||
{
|
||||
OnDisallowedRider( from );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !Multis.DesignContext.Check( from ) )
|
||||
return;
|
||||
|
||||
if ( from.HasTrade )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042317, "", 0x41 ); // You may not ride at this time
|
||||
return;
|
||||
}
|
||||
|
||||
if ( from.InRange( this, 1 ) )
|
||||
{
|
||||
bool canAccess = ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
|| ( Controlled && ControlMaster == from )
|
||||
|| ( Summoned && SummonMaster == from );
|
||||
|
||||
if ( canAccess )
|
||||
{
|
||||
if ( this.Poisoned )
|
||||
PrivateOverheadMessage( Network.MessageType.Regular, 0x3B2, 1049692, from.NetState ); // This mount is too ill to ride.
|
||||
else
|
||||
Rider = from;
|
||||
}
|
||||
else if ( !Controlled && !Summoned )
|
||||
{
|
||||
// That mount does not look broken! You would have to tame it to ride it.
|
||||
PrivateOverheadMessage( Network.MessageType.Regular, 0x3B2, 501263, from.NetState );
|
||||
}
|
||||
else
|
||||
{
|
||||
// This isn't your mount; it refuses to let you ride.
|
||||
PrivateOverheadMessage( Network.MessageType.Regular, 0x3B2, 501264, from.NetState );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500206 ); // That is too far away to ride.
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ItemID
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_InternalItem != null )
|
||||
return m_InternalItem.ItemID;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.ItemID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Dismount( Mobile m )
|
||||
{
|
||||
IMount mount = m.Mount;
|
||||
|
||||
if ( mount != null )
|
||||
mount.Rider = null;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Rider
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Rider;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( m_Rider != value )
|
||||
{
|
||||
if ( value == null )
|
||||
{
|
||||
Point3D loc = m_Rider.Location;
|
||||
Map map = m_Rider.Map;
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
{
|
||||
loc = m_Rider.LogoutLocation;
|
||||
map = m_Rider.LogoutMap;
|
||||
}
|
||||
|
||||
Direction = m_Rider.Direction;
|
||||
Location = loc;
|
||||
Map = map;
|
||||
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.Internalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Rider != null )
|
||||
Dismount( m_Rider );
|
||||
|
||||
Dismount( value );
|
||||
|
||||
if ( m_InternalItem != null )
|
||||
value.AddItem( m_InternalItem );
|
||||
|
||||
value.Direction = this.Direction;
|
||||
|
||||
Internalize();
|
||||
}
|
||||
|
||||
m_Rider = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class BlockEntry
|
||||
{
|
||||
public BlockMountType m_Type;
|
||||
public DateTime m_Expiration;
|
||||
|
||||
public bool IsExpired{ get{ return ( DateTime.Now >= m_Expiration ); } }
|
||||
|
||||
public BlockEntry( BlockMountType type, DateTime expiration )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Expiration = expiration;
|
||||
}
|
||||
}
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public static void SetMountPrevention( Mobile mob, BlockMountType type, TimeSpan duration )
|
||||
{
|
||||
if ( mob == null )
|
||||
return;
|
||||
|
||||
DateTime expiration = DateTime.Now + duration;
|
||||
|
||||
BlockEntry entry = m_Table[mob] as BlockEntry;
|
||||
|
||||
if ( entry != null )
|
||||
{
|
||||
entry.m_Type = type;
|
||||
entry.m_Expiration = expiration;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Table[mob] = entry = new BlockEntry( type, expiration );
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearMountPrevention( Mobile mob )
|
||||
{
|
||||
if ( mob != null )
|
||||
m_Table.Remove( mob );
|
||||
}
|
||||
|
||||
public static BlockMountType GetMountPrevention( Mobile mob )
|
||||
{
|
||||
if ( mob == null )
|
||||
return BlockMountType.None;
|
||||
|
||||
BlockEntry entry = m_Table[mob] as BlockEntry;
|
||||
|
||||
if ( entry == null )
|
||||
return BlockMountType.None;
|
||||
|
||||
if ( entry.IsExpired )
|
||||
{
|
||||
m_Table.Remove( mob );
|
||||
return BlockMountType.None;
|
||||
}
|
||||
|
||||
return entry.m_Type;
|
||||
}
|
||||
|
||||
public static bool CheckMountAllowed( Mobile mob, bool message )
|
||||
{
|
||||
BlockMountType type = GetMountPrevention( mob );
|
||||
|
||||
if ( type == BlockMountType.None )
|
||||
return true;
|
||||
|
||||
if ( message )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case BlockMountType.Dazed:
|
||||
{
|
||||
mob.SendLocalizedMessage( 1040024 ); // You are still too dazed from being knocked off your mount to ride!
|
||||
break;
|
||||
}
|
||||
case BlockMountType.DismountRecovery:
|
||||
{
|
||||
mob.SendLocalizedMessage( 1070859 ); // You cannot mount while recovering from a dismount special maneuver.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void OnRiderDamaged( int amount, Mobile from, bool willKill )
|
||||
{
|
||||
if( m_Rider == null )
|
||||
return;
|
||||
|
||||
Mobile attacker = from;
|
||||
if( attacker == null )
|
||||
attacker = m_Rider.FindMostRecentDamager( true );
|
||||
|
||||
if( !(attacker == this || attacker == m_Rider || willKill || DateTime.Now < m_NextMountAbility) )
|
||||
{
|
||||
if( DoMountAbility( amount, from ) )
|
||||
m_NextMountAbility = DateTime.Now + MountAbilityDelay;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool DoMountAbility( int damage, Mobile attacker )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class MountItem : Item, IMountItem
|
||||
{
|
||||
private BaseMount m_Mount;
|
||||
|
||||
public override double DefaultWeight { get { return 0; } }
|
||||
|
||||
public MountItem( BaseMount mount, int itemID ) : base( itemID )
|
||||
{
|
||||
Layer = Layer.Mount;
|
||||
Movable = false;
|
||||
|
||||
m_Mount = mount;
|
||||
}
|
||||
|
||||
public MountItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Mount != null )
|
||||
m_Mount.Delete();
|
||||
|
||||
m_Mount = null;
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override DeathMoveResult OnParentDeath(Mobile parent)
|
||||
{
|
||||
if ( m_Mount != null )
|
||||
m_Mount.Rider = null;
|
||||
|
||||
return DeathMoveResult.RemainEquiped;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Mount );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mount = reader.ReadMobile() as BaseMount;
|
||||
|
||||
if ( m_Mount == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IMount Mount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Mount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BlockMountType
|
||||
{
|
||||
None = -1,
|
||||
Dazed,
|
||||
DismountRecovery
|
||||
}
|
||||
}
|
||||
72
Scripts/Mobiles/Animals/Pets/Horse.cs
Normal file
72
Scripts/Mobiles/Animals/Pets/Horse.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
[CorpseName( "a horse corpse" )]
|
||||
[TypeAlias( "Server.Mobiles.BrownHorse", "Server.Mobiles.DirtyHorse", "Server.Mobiles.GrayHorse", "Server.Mobiles.TanHorse" )]
|
||||
public class Horse : BaseMount
|
||||
{
|
||||
private static int[] m_IDs = new int[]
|
||||
{
|
||||
0xC8, 0x3E9F,
|
||||
0xE2, 0x3EA0,
|
||||
0xE4, 0x3EA1,
|
||||
0xCC, 0x3EA2
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public Horse() : this( "a horse" )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Horse( string name ) : base( name, 0xE2, 0x3EA0, AIType.AI_Timid, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
int random = Utility.Random( 4 );
|
||||
|
||||
Body = m_IDs[random * 2];
|
||||
ItemID = m_IDs[random * 2 + 1];
|
||||
BaseSoundID = 0xA8;
|
||||
Invulnerable = true;
|
||||
|
||||
SetStr( 22, 98 );
|
||||
SetDex( 56, 75 );
|
||||
SetInt( 6, 10 );
|
||||
|
||||
SetHits( 28, 45 );
|
||||
SetMana( 0 );
|
||||
|
||||
SetDamage( 3, 4 );
|
||||
|
||||
SetSkill( SkillName.MagicResist, 25.1, 30.0 );
|
||||
SetSkill( SkillName.Tactics, 29.3, 44.0 );
|
||||
SetSkill( SkillName.HandToHand, 29.3, 44.0 );
|
||||
|
||||
Fame = 0;
|
||||
Karma = 400;
|
||||
ControlSlots = 2;
|
||||
}
|
||||
|
||||
public override int Meat{ get{ return 3; } }
|
||||
public override int Hides{ get{ return 10; } }
|
||||
|
||||
public Horse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Scripts/Mobiles/Animals/Pets/Llama.cs
Normal file
60
Scripts/Mobiles/Animals/Pets/Llama.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
[CorpseName( "a llama corpse" )]
|
||||
public class Llama : BaseMount
|
||||
{
|
||||
[Constructable]
|
||||
public Llama() : this( "a llama" )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Llama( string name ) : base( name, 0xDC, 0x3EA6, AIType.AI_Timid, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
Invulnerable = true;
|
||||
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
SetStr( 21, 49 );
|
||||
SetDex( 56, 75 );
|
||||
SetInt( 16, 30 );
|
||||
|
||||
SetHits( 15, 27 );
|
||||
SetMana( 0 );
|
||||
|
||||
SetDamage( 3, 5 );
|
||||
|
||||
SetSkill( SkillName.MagicResist, 15.1, 20.0 );
|
||||
SetSkill( SkillName.Tactics, 19.2, 29.0 );
|
||||
SetSkill( SkillName.HandToHand, 19.2, 29.0 );
|
||||
|
||||
Fame = 0;
|
||||
Karma = 200;
|
||||
ControlSlots = 2;
|
||||
}
|
||||
|
||||
public override int Meat{ get{ return 1; } }
|
||||
public override int Hides{ get{ return 12; } }
|
||||
|
||||
public Llama( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
202
Scripts/Mobiles/Animals/Pets/PackHorse.cs
Normal file
202
Scripts/Mobiles/Animals/Pets/PackHorse.cs
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
[CorpseName( "a horse corpse" )]
|
||||
public class PackHorse : BaseCreature
|
||||
{
|
||||
[Constructable]
|
||||
public PackHorse() : base( AIType.AI_Timid, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
Name = "a pack horse";
|
||||
Body = 291;
|
||||
BaseSoundID = 0xA8;
|
||||
Invulnerable = true;
|
||||
|
||||
SetStr( 44, 120 );
|
||||
SetDex( 36, 55 );
|
||||
SetInt( 6, 10 );
|
||||
|
||||
SetHits( 61, 80 );
|
||||
SetStam( 81, 100 );
|
||||
SetMana( 0 );
|
||||
|
||||
SetDamage( 5, 11 );
|
||||
|
||||
SetSkill( SkillName.MagicResist, 25.1, 30.0 );
|
||||
SetSkill( SkillName.Tactics, 29.3, 44.0 );
|
||||
SetSkill( SkillName.HandToHand, 29.3, 44.0 );
|
||||
|
||||
Fame = 0;
|
||||
Karma = 400;
|
||||
|
||||
VirtualArmor = 16;
|
||||
ControlSlots = 2;
|
||||
|
||||
Container pack = Backpack;
|
||||
|
||||
if ( pack != null )
|
||||
pack.Delete();
|
||||
|
||||
pack = new StrongBackpack();
|
||||
pack.Movable = false;
|
||||
|
||||
AddItem( pack );
|
||||
}
|
||||
|
||||
public override int Meat{ get{ return 3; } }
|
||||
public override int Hides{ get{ return 10; } }
|
||||
|
||||
public PackHorse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
#region Pack Animal Methods
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
if ( !base.OnBeforeDeath() )
|
||||
return false;
|
||||
|
||||
PackAnimal.CombineBackpacks( this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override DeathMoveResult GetInventoryMoveResultFor( Item item )
|
||||
{
|
||||
return DeathMoveResult.MoveToCorpse;
|
||||
}
|
||||
|
||||
public override bool IsSnoop( Mobile from )
|
||||
{
|
||||
if ( PackAnimal.CheckAccess( this, from ) )
|
||||
return false;
|
||||
|
||||
return base.IsSnoop( from );
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item item )
|
||||
{
|
||||
if ( PackAnimal.CheckAccess( this, from ) )
|
||||
{
|
||||
AddToBackpack( item );
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDragDrop( from, item );
|
||||
}
|
||||
|
||||
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
|
||||
{
|
||||
return PackAnimal.CheckAccess( this, from );
|
||||
}
|
||||
|
||||
public override bool CheckNonlocalLift( Mobile from, Item item )
|
||||
{
|
||||
return PackAnimal.CheckAccess( this, from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
PackAnimal.TryPackOpen( this, from );
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
PackAnimal.GetContextMenuEntries( this, from, list );
|
||||
}
|
||||
#endregion
|
||||
|
||||
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 class PackAnimalBackpackEntry : ContextMenuEntry
|
||||
{
|
||||
private BaseCreature m_Animal;
|
||||
private Mobile m_From;
|
||||
|
||||
public PackAnimalBackpackEntry( BaseCreature animal, Mobile from ) : base( 6145, 3 )
|
||||
{
|
||||
m_Animal = animal;
|
||||
m_From = from;
|
||||
|
||||
if ( animal.IsDeadPet )
|
||||
Enabled = false;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
PackAnimal.TryPackOpen( m_Animal, m_From );
|
||||
}
|
||||
}
|
||||
|
||||
public class PackAnimal
|
||||
{
|
||||
public static void GetContextMenuEntries( BaseCreature animal, Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
if ( CheckAccess( animal, from ) )
|
||||
list.Add( new PackAnimalBackpackEntry( animal, from ) );
|
||||
}
|
||||
|
||||
public static bool CheckAccess( BaseCreature animal, Mobile from )
|
||||
{
|
||||
if ( from == animal || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
if ( from.Alive && animal.Controlled && !animal.IsDeadPet && (from == animal.ControlMaster || from == animal.SummonMaster) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void CombineBackpacks( BaseCreature animal )
|
||||
{
|
||||
Container pack = animal.Backpack;
|
||||
|
||||
if ( pack != null )
|
||||
{
|
||||
Container newPack = new Backpack();
|
||||
|
||||
for ( int i = pack.Items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( i >= pack.Items.Count )
|
||||
continue;
|
||||
|
||||
newPack.DropItem( pack.Items[i] );
|
||||
}
|
||||
|
||||
pack.DropItem( newPack );
|
||||
}
|
||||
}
|
||||
|
||||
public static void TryPackOpen( BaseCreature animal, Mobile from )
|
||||
{
|
||||
if ( animal.IsDeadPet )
|
||||
return;
|
||||
|
||||
Container item = animal.Backpack;
|
||||
|
||||
if ( item != null )
|
||||
from.Use( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
129
Scripts/Mobiles/Animals/Pets/PackLlama.cs
Normal file
129
Scripts/Mobiles/Animals/Pets/PackLlama.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
[CorpseName("a llama corpse")]
|
||||
public class PackLlama : BaseCreature
|
||||
{
|
||||
[Constructable]
|
||||
public PackLlama() : base( AIType.AI_Timid, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
Name = "a pack llama";
|
||||
Body = 292;
|
||||
BaseSoundID = 0x3F3;
|
||||
Invulnerable = true;
|
||||
|
||||
SetStr( 52, 80 );
|
||||
SetDex( 36, 55 );
|
||||
SetInt( 16, 30 );
|
||||
|
||||
SetHits( 50 );
|
||||
SetStam( 86, 105 );
|
||||
SetMana( 0 );
|
||||
|
||||
SetDamage( 2, 6 );
|
||||
|
||||
SetSkill( SkillName.MagicResist, 15.1, 20.0 );
|
||||
SetSkill( SkillName.Tactics, 19.2, 29.0 );
|
||||
SetSkill( SkillName.HandToHand, 19.2, 29.0 );
|
||||
|
||||
Fame = 0;
|
||||
Karma = 200;
|
||||
ControlSlots = 2;
|
||||
|
||||
VirtualArmor = 16;
|
||||
|
||||
Container pack = Backpack;
|
||||
|
||||
if ( pack != null )
|
||||
pack.Delete();
|
||||
|
||||
pack = new StrongBackpack();
|
||||
pack.Movable = false;
|
||||
|
||||
AddItem( pack );
|
||||
}
|
||||
|
||||
public override int Meat{ get{ return 1; } }
|
||||
|
||||
public PackLlama( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
#region Pack Animal Methods
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
if ( !base.OnBeforeDeath() )
|
||||
return false;
|
||||
|
||||
PackAnimal.CombineBackpacks( this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override DeathMoveResult GetInventoryMoveResultFor( Item item )
|
||||
{
|
||||
return DeathMoveResult.MoveToCorpse;
|
||||
}
|
||||
|
||||
public override bool IsSnoop( Mobile from )
|
||||
{
|
||||
if ( PackAnimal.CheckAccess( this, from ) )
|
||||
return false;
|
||||
|
||||
return base.IsSnoop( from );
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item item )
|
||||
{
|
||||
if ( PackAnimal.CheckAccess( this, from ) )
|
||||
{
|
||||
AddToBackpack( item );
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDragDrop( from, item );
|
||||
}
|
||||
|
||||
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
|
||||
{
|
||||
return PackAnimal.CheckAccess( this, from );
|
||||
}
|
||||
|
||||
public override bool CheckNonlocalLift( Mobile from, Item item )
|
||||
{
|
||||
return PackAnimal.CheckAccess( this, from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
PackAnimal.TryPackOpen( this, from );
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
PackAnimal.GetContextMenuEntries( this, from, list );
|
||||
}
|
||||
#endregion
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue