lemperor
Initiate
Code:
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Menus;
using Server.Menus.Questions;
using Server.Items;
using Server.Regions;
using Server.Spells.Seventh;
using Server.Mobiles;
namespace Server.Mobiles
{
public class EggNogg : BaseCreature
{
Mobile mobile;
public override bool CanTeach{ get{ return false; } }
private static int GetRandomHue()
{
switch ( Utility.Random( 6 ) )
{
default:
case 0: return 0;
case 1: return Utility.RandomBlueHue();
case 2: return Utility.RandomGreenHue();
case 3: return Utility.RandomRedHue();
case 4: return Utility.RandomYellowHue();
case 5: return Utility.RandomNeutralHue();
}
}
[Constructable]
public EggNogg () : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
{
InitStats( 31, 41, 51 );
SpeechHue = Utility.RandomDyedHue();
Hue = Utility.RandomSkinHue();
if ( this.Female = Utility.RandomBool() )
{
this.Body = 0x191;
this.Name = NameList.RandomName( "female" );
Title = "EggNogg the Mage";
SetSkill( SkillName.EvalInt, 65, 88 );
SetSkill( SkillName.MagicResist, 65, 88 );
SetSkill( SkillName.Magery, 65, 88 );
SetSkill( SkillName.Wrestling, 60, 83 );
SetSkill( SkillName.Meditation, 65, 88 );
}
else
{
this.Body = 0x190;
this.Name = NameList.RandomName( "male" );
Title = "EggNogg the Mage";
SetSkill( SkillName.EvalInt, 65, 88 );
SetSkill( SkillName.Inscribe, 50, 65 );
SetSkill( SkillName.MagicResist, 65, 88 );
SetSkill( SkillName.Magery, 65, 88 );
SetSkill( SkillName.Wrestling, 60, 83 );
SetSkill( SkillName.Meditation, 65, 88 );
}
AddItem( new Server.Items.Robe( GetRandomHue() ) );
AddItem( new Server.Items.Boots( GetRandomHue () ) );
this.AddItem(new Server.Items.GnarledStaff());
this.AddItem(new Cloak(0x597));
Item hair = new Item( Utility.RandomList( 0x203B, 0x2049, 0x2048, 0x204A ) );
hair.Hue = Utility.RandomNondyedHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
AddItem( hair );
Container pack = new Backpack();
pack.DropItem( new Gold( 250, 300 ) );
pack.Movable = false;
AddItem( pack );
}
public override bool ClickTitle{ get{ return false; } }
public EggNogg( 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();
}
private Timer m_Timer;
public class EggNoggTimer : Timer
{
private Moongate m_Gate;
public EggNoggTimer( Moongate gate ) : base( TimeSpan.FromSeconds( 10.0 ) )
{
m_Gate = gate;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
m_Gate.Delete();
this.Stop();
}
}
public override void OnSpeech( SpeechEventArgs m )
{
mobile = m.Mobile;
PlayerMobile pm = (PlayerMobile)m.Mobile;
if (pm.Young && pm.IsPlayer() && pm.Profession == 4 && pm.Profession == 6 && pm.Profession == 7 );
{
if ( m.Speech.ToLower() == "gateme" ) //&& pm.Young )
{
this.Direction = GetDirectionTo( m.Mobile.Location );
this.Say( String.Format( "Ah, you must be new around here. Here's the gate, free of charge." ) );
Moongate gate = new Moongate( new Point3D( 5535, 1276, 47 ),Map.Trammel);
gate.MoveToWorld( mobile.Location, mobile.Map );
if ( m_Timer != null )
m_Timer.Stop();
else
m_Timer = new EggNoggTimer( gate );
m_Timer.Start();
}
else
{
if ( pm != null && !pm.Young ); // if the player is a playermobile (sanity check) AND the player is not young AND the player isn't a staff member
{
Container bank = m.Mobile.BankBox;
if ( m.Speech.ToLower() == "gateme" )
{
this.Direction = GetDirectionTo( m.Mobile.Location );
this.Say( String.Format( "I can get you there for 400 gold coins. Do you agree to pay?" ) );
if ( m.Speech.ToLower() == "yes" )
{
if ( bank != null && bank.ConsumeTotal( typeof( Gold ), 400 ) )
{
this.Say( String.Format( "Very well. Here is the gate." ) );
Moongate gate = new Moongate( new Point3D( 5335, 1276, 47 ),Map.Trammel);
gate.MoveToWorld( mobile.Location, mobile.Map );
if ( m_Timer != null )
m_Timer.Stop();
else
m_Timer = new EggNoggTimer( gate );
m_Timer.Start();
}
else
{
this.Say( String.Format( "You lack the funds for this gate." ) );
}
}
}
else if ( m.Speech.ToLower() == "no" )
{
this.Say( String.Format( "Very well." ) );
}
}
}}}}
}