using Server.Items;
using Server.Misc;
using System;
using System.Collections.Generic;
namespace Server.Mobiles
{
public class BountyGuard : BaseCreature
{
public override bool ClickTitle { get { return true; } }
[Constructable]
public BountyGuard() : base( AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.45, 0.8 )
{
InitStats( 1000, 1000, 1000 );
Title = "the bounty hunter";
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
if ( Female = Utility.RandomBool() )
{
Body = 0x191;
Name = NameList.RandomName( "female" );
switch( Utility.Random( 2 ) )
{
case 0: AddItem( new LeatherSkirt() ); break;
case 1: AddItem( new LeatherShorts() ); break;
}
switch( Utility.Random( 5 ) )
{
case 0: AddItem( new FemaleLeatherChest() ); break;
case 1: AddItem( new FemaleStuddedChest() ); break;
case 2: AddItem( new LeatherBustierArms() ); break;
case 3: AddItem( new StuddedBustierArms() ); break;
case 4: AddItem( new FemalePlateChest() ); break;
}
}
else
{
Body = 0x190;
Name = NameList.RandomName( "male" );
AddItem( new PlateChest() );
AddItem( new PlateArms() );
AddItem( new PlateLegs() );
switch( Utility.Random( 3 ) )
{
case 0: AddItem( new Doublet( Utility.RandomNondyedHue() ) ); break;
case 1: AddItem( new Tunic( Utility.RandomNondyedHue() ) ); break;
case 2: AddItem( new BodySash( Utility.RandomNondyedHue() ) ); break;
}
}
Utility.AssignRandomHair( this );
if( Utility.RandomBool() )
Utility.AssignRandomFacialHair( this, HairHue );
Halberd weapon = new Halberd();
weapon.Movable = false;
weapon.Crafter = this;
weapon.Quality = WeaponQuality.Exceptional;
AddItem( weapon );
Container pack = new Backpack();
pack.Movable = false;
pack.DropItem( new Gold( 10, 25 ) );
AddItem( pack );
Skills[SkillName.Anatomy].Base = 120.0;
Skills[SkillName.Tactics].Base = 250.0;
Skills[SkillName.Swords].Base = 120.0;
Skills[SkillName.MagicResist].Base = 120.0;
Skills[SkillName.DetectHidden].Base = 100.0;
//this.NextCombatTime = Core.TickCount + 500;
//this.Focus = target;
}
private static readonly List<int> RejectedHeadSayings = new List<int>()
{
500661, // I shall place this on my mantle!
500662, // This tasteth like chicken.
500663, // This tasteth just like the juicy peach I just ate.
500664, // Ahh! That was the one piece I was missing!
500665, // Somehow, it reminds me of mother.
500666, // It's a sign! I can see Elvis in this!
500667, // Thanks, I was missing mine.
500668, // I'll put this in the lost-and-found box.
500669 // My family will eat well tonight!
};
public override bool OnDragDrop(Mobile from, Item dropped)
{
var bh = dropped as BountiedHead;
if (bh != null && bh.Player != null && !bh.Player.Deleted &&
bh.Created + TimeSpan.FromDays(1.0) > DateTime.UtcNow)
{
SayTo(from, 500670); // Ah, a head! Let me check to see if there is a bounty on this.
Timer.DelayCall(TimeSpan.FromSeconds(3.0), CheckBountyOnHead, new object[] {bh, from});
return true;
}
else if (dropped is Head)
{
Say(RejectedHeadSayings[Utility.Random(RejectedHeadSayings.Count)]);
//dropped.Delete();
//return true;
}
SayTo(from, 500660); // If this were the head of a murderer, I would check for a bounty.
return false;
}
private void CheckBountyOnHead(object[] states)
{
var head = (BountiedHead) states[0];
var bountyHunter = (Mobile) states[1];
var bi = BountyInformation.GetBountyInformation(head.Player);
if (bi == null)
{
Say("The reward on this scoundrel's head has already been claimed!");
head.Delete();
return;
}
var totalBounty = bi.Bounty;
var headBounty = head.Bounty;
var difference = totalBounty - headBounty;
if (difference < 0)
{
Say("The reward on this scoundrel's head has already been claimed!");
head.Delete();
return;
}
bi.SubtractBounty(headBounty);
AwardBounty(bountyHunter, head.PlayerName, headBounty);
head.Delete();
}
private void AwardBounty(Mobile bountyHunter, string killer, int total)
{
var bountySize = 0;
if (total > 15000)
bountySize = 2;
else if (total > 100)
bountySize = 1;
switch (bountySize)
{
case 2:
bountyHunter.PlaySound(0x2E6);
Say("Thou hast brought the infamous " + killer + " to justice! Thy reward of " + total + "gp hath been deposited in thy bank account.");
break;
case 1:
bountyHunter.PlaySound(0x2E5);
Say("Tis a minor criminal, thank thee. Thy reward of " + total + "gp hath been deposited in thy bank account.");
break;
default:
bountyHunter.PlaySound(0x2E4);
Say("Thou hast wasted thy time for " + total + "gp.");
break;
}
Banker.Deposit(bountyHunter, total);
}
public BountyGuard(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
}
}