Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Server.Engines.XmlSpawner2;
- using Server.ContextMenus;
- using System.Collections.Generic;
- using Server.Items;
- namespace Server.Mobiles
- {
- [CorpseName("a horse corpse")]
- [TypeAlias("Server.Mobiles.BrownHorse", "Server.Mobiles.DirtyHorse", "Server.Mobiles.GrayHorse", "Server.Mobiles.TanHorse")]
- public class ReqPrototypeHorse : BaseMount
- {
- private bool m_BardingExceptional;
- private Mobile m_BardingCrafter;
- private int m_BardingHP;
- private bool m_HasBarding;
- private CraftResource m_BardingResource;
- private static readonly int[] m_IDs = new int[]
- {
- 0xC8, 0x3E9F,
- 0xE2, 0x3EA0,
- 0xE4, 0x3EA1,
- 0xCC, 0x3EA2
- };
- [Constructable]
- public ReqPrototypeHorse()
- : this("a horse")
- {
- }
- [Constructable]
- public ReqPrototypeHorse(string name)
- : base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
- {
- int random = Utility.Random(4);
- this.Body = m_IDs[random * 2];
- this.ItemID = m_IDs[random * 2 + 1];
- this.BaseSoundID = 0xA8;
- this.SetStr(22, 98);
- this.SetDex(56, 75);
- this.SetInt(6, 10);
- this.SetHits(28, 45);
- this.SetMana(0);
- this.SetDamage(3, 4);
- this.SetDamageType(ResistanceType.Physical, 100);
- this.SetResistance(ResistanceType.Physical, 15, 20);
- this.SetSkill(SkillName.MagicResist, 25.1, 30.0);
- this.SetSkill(SkillName.Tactics, 29.3, 44.0);
- this.SetSkill(SkillName.Wrestling, 29.3, 44.0);
- this.Fame = 300;
- this.Karma = 300;
- this.Tamable = true;
- this.ControlSlots = 1;
- this.MinTameSkill = 29.1;
- Container pack = this.Backpack;
- if (pack != null)
- pack.Delete();
- pack = new StrongBackpack();
- pack.Movable = false;
- this.AddItem(pack);
- }
- public ReqPrototypeHorse(Serial serial)
- : base(serial)
- {
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public Mobile BardingCrafter
- {
- get
- {
- return this.m_BardingCrafter;
- }
- set
- {
- this.m_BardingCrafter = value;
- this.InvalidateProperties();
- }
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public bool BardingExceptional
- {
- get
- {
- return this.m_BardingExceptional;
- }
- set
- {
- this.m_BardingExceptional = value;
- this.InvalidateProperties();
- }
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public int BardingHP
- {
- get
- {
- return this.m_BardingHP;
- }
- set
- {
- this.m_BardingHP = value;
- this.InvalidateProperties();
- }
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public bool HasBarding
- {
- get
- {
- return this.m_HasBarding;
- }
- set
- {
- this.m_HasBarding = value;
- if (this.m_HasBarding)
- {
- this.Hue = CraftResources.GetHue(this.m_BardingResource);
- this.BodyValue = 284;
- this.ItemID = 16018;
- }
- else
- {
- this.BodyValue = 200;
- this.ItemID = 16031;
- this.Hue = 0;
- }
- this.InvalidateProperties();
- }
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public CraftResource BardingResource
- {
- get
- {
- return this.m_BardingResource;
- }
- set
- {
- this.m_BardingResource = value;
- if (this.m_HasBarding)
- this.Hue = CraftResources.GetHue(value);
- this.InvalidateProperties();
- }
- }
- [CommandProperty(AccessLevel.GameMaster)]
- public int BardingMaxHP
- {
- get
- {
- return this.m_BardingExceptional ? 2500 : 1000;
- }
- }
- public override int Meat
- {
- get
- {
- return 3;
- }
- }
- public override int Hides
- {
- get
- {
- return 10;
- }
- }
- public override FoodType FavoriteFood
- {
- get
- {
- return FoodType.FruitsAndVegies | FoodType.GrainsAndHay;
- }
- }
- public override void OnDoubleClick(Mobile from)
- {
- XMLReqHorse horseatt = XmlAttach.FindAttachment(this, typeof(XMLReqHorse)) as XMLReqHorse;
- if (horseatt != null)
- {
- if (horseatt.HasSaddle == true)
- {
- base.OnDoubleClick(from);
- return;
- }
- if (horseatt.HasBags == true)
- {
- PackAnimal.TryPackOpen(this, from);
- return;
- }
- else
- {
- from.SendMessage("You must place a saddle on this mount if you wish to ride it.");
- return;
- }
- }
- else
- {
- return;
- }
- }
- public class PackAnimalBackpackEntry : ContextMenuEntry
- {
- private readonly BaseCreature m_Animal;
- private readonly Mobile m_From;
- public PackAnimalBackpackEntry(BaseCreature animal, Mobile from)
- : base(6145, 3)
- {
- this.m_Animal = animal;
- this.m_From = from;
- if (animal.IsDeadPet)
- this.Enabled = false;
- }
- public override void OnClick()
- {
- PackAnimal.TryPackOpen(this.m_Animal, this.m_From);
- }
- }
- public class RemoveSaddleOrBag : ContextMenuEntry
- {
- private readonly BaseCreature m_Animal;
- private readonly Mobile m_From;
- public RemoveSaddleOrBag(BaseCreature animal, Mobile from)
- : base(6145, 3)
- {
- this.m_Animal = animal;
- this.m_From = from;
- XMLReqHorse horseatt = XmlAttach.FindAttachment(this, typeof(XMLReqHorse)) as XMLReqHorse;
- if (horseatt.HasBags || horseatt.HasSaddle)
- this.Enabled = true;
- else
- this.Enabled = false;
- }
- public override void OnClick()
- {
- XMLReqHorse horseatt = XmlAttach.FindAttachment(this, typeof(XMLReqHorse)) as XMLReqHorse;
- if (horseatt.HasSaddle == true)
- {
- horseatt.HasSaddle = false;
- }
- if (horseatt.HasBags == true)
- {
- horseatt.HasBags = false;
- }
- }
- }
- 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 (this.CheckFeed(from, item))
- return true;
- if (PackAnimal.CheckAccess(this, from))
- {
- this.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 GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
- {
- base.GetContextMenuEntries(from, list);
- list.Add(new RemoveSaddleOrBag(this, from));
- XMLReqHorse horseatt = XmlAttach.FindAttachment(this, typeof(XMLReqHorse)) as XMLReqHorse;
- if (horseatt.HasBags == true)
- {
- PackAnimal.GetContextMenuEntries(this, from, list);
- }
- }
- public override void GetProperties(ObjectPropertyList list)
- {
- base.GetProperties(list);
- if (this.m_HasBarding && this.m_BardingExceptional && this.m_BardingCrafter != null)
- list.Add(1060853, this.m_BardingCrafter.Name); // armor exceptionally crafted by ~1_val~
- }
- public override void Serialize(GenericWriter writer)
- {
- base.Serialize(writer);
- writer.Write((int)0); // version
- writer.Write((bool)this.m_BardingExceptional);
- writer.Write((Mobile)this.m_BardingCrafter);
- writer.Write((bool)this.m_HasBarding);
- writer.Write((int)this.m_BardingHP);
- writer.Write((int)this.m_BardingResource);
- }
- public override void Deserialize(GenericReader reader)
- {
- base.Deserialize(reader);
- int version = reader.ReadInt();
- this.m_BardingExceptional = reader.ReadBool();
- this.m_BardingCrafter = reader.ReadMobile();
- this.m_HasBarding = reader.ReadBool();
- this.m_BardingHP = reader.ReadInt();
- this.m_BardingResource = (CraftResource)reader.ReadInt();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement