Verbal commandsiZJokersWild said:I got everything going good, but I was wondering. I was looking through the scripts and did not see how to activate the feeding and turning and all. Anybody give me a quick reply as to how I go about that? Thanks.
hudel said:I've make props on my AdminChar and set the VampFeed and Vampirism to true and set the VampType to Master and then I die always short after I'm resurected. What can I do here? What do I have to eat as a vamp? Just blood from other players or can I eat Daemonblood, too?
The stuff I posted doesn't handle the actual Turning thats in the PlayerMobile (or subclassed pm)Greystar said:Would it be that you are burning to death by any chance??? That was the problem I had untill I disabled it on my Admin character... That was what was killing me... I might look at Tru's Version of this (which seems to be the original anyway) to see what He did since anything I've gotten from Tru has always worked for me. Although GD13's stuff works fine as well I just like to test my options.
orpheus said:arg. .. I'm getting an error it seems a few others have/had
I got everything but the playermobile working. I'm going to look through the posts again for help, but heres what I get:
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
- Error: Scripts\Custom\Sickness\PlayerMobile.cs: CS0116: (line 37, column 17)
A namespace does not directly contain members such as fields or methods
- Error: Scripts\Custom\Sickness\PlayerMobile.cs: CS1022: (line 2809, column 1)
Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
using System;
using System.Collections;
using Server;
using Server.Misc;
using Server.Items;
using Server.Gumps;
using Server.Multis;
using Server.Engines.Help;
using Server.ContextMenus;
using Server.Network;
using Server.Spells;
using Server.Spells.Fifth;
using Server.Spells.Seventh;
using Server.Targeting;
using Server.Engines.Quests;
namespace Server.Mobiles
{
[Flags]
public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
{
None = 0x00000000,
Glassblowing = 0x00000001,
Masonry = 0x00000002,
SandMining = 0x00000004,
StoneMining = 0x00000008,
ToggleMiningStone = 0x00000010,
KarmaLocked = 0x00000020,
AutoRenewInsurance = 0x00000040,
UseOwnFilter = 0x00000080,
PublicMyRunUO = 0x00000100,
PagingSquelched = 0x00000200,
////////////////////////////////////////////////////////////////////////////////////
//Start Sickness Edit///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
Sick = 0x00010000,
Sickness = 0x00020000,
SickContagious = 0x00040000
}
public enum SickFlag
{
None,
TempImmunity,
PermImmunity,
Cold,
Flu,
Headache,
Virus,
VampTurn
}
public enum VampType
{
None,
Vampire,
Master,
Ancient
}
///////////////////////////////////////////////////////////////////////////////
//End Sickness Edit////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public enum NpcGuild
{
None,
MagesGuild,
WarriorsGuild,
ThievesGuild,
RangersGuild,
HealersGuild,
MinersGuild,
MerchantsGuild,
TinkersGuild,
TailorsGuild,
FishermensGuild,
BardsGuild,
BlacksmithsGuild
}
public class PlayerMobile : Mobile
{
private class CountAndTimeStamp
{
private int m_Count;
private DateTime m_Stamp;
public CountAndTimeStamp()
{
}
public DateTime TimeStamp { get{ return m_Stamp; } }
public int Count
{
get { return m_Count; }
set { m_Count = value; m_Stamp = DateTime.Now; }
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
//Start Sickness Edit///////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Vampires
public VampType m_VampType = VampType.None;
private bool m_Vampirism = false;
private bool m_VampBurn = false;
private bool m_VampHunger = false;
public int m_Blood = 100;
private PlayerFlag m_Flags;
public bool GetDFlag( PlayerFlag flag )
{
return ( (m_Flags & flag) != 0 );
}
public void SetDFlag( PlayerFlag flag, bool value )
{
if ( value )
m_Flags |= flag;
else
m_Flags &= ~flag;
}
[CommandProperty( AccessLevel.GameMaster )]
public VampType VampireType
{
get { return m_VampType; }
set { m_VampType = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int Blood
{
get { return m_Blood; }
set { m_Blood = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Vampirism
{
get{ return m_Vampirism; }
set{ m_Vampirism = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool VampHunger
{
get{ return m_VampHunger; }
set{ m_VampHunger = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool VampBurn
{
get{ return m_VampBurn; }
set{ m_VampBurn = value; }
}
public class VampBurnTimer : Timer
{
public const double SecondsPerUOMinute = 5.0;
public const double MinutesPerUODay = SecondsPerUOMinute * 24;
private static DateTime WorldStart = new DateTime( 1997, 9, 1 );
public static void Initialize()
{
// m_ServerStart = DateTime.Now;
new VampBurnTimer().Start();
}
public VampBurnTimer() : base( TimeSpan.FromMinutes( .10 ), TimeSpan.FromMinutes( .10 ) )
{
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
CheckBurn(); //Every tick run function burn
}
private bool GetBurning( int XPos )
{
TimeSpan timeSpan = DateTime.Now - WorldStart;
int totalMinutes = (int)( timeSpan.TotalSeconds / SecondsPerUOMinute );
totalMinutes += Map.Felucca.MapIndex * 320;
totalMinutes += XPos / 16;
int currentHour = ( totalMinutes / 60 ) % 24;
int currentMinute = totalMinutes % 60;
if ( currentHour <= 18 && currentHour >= 6)
//if (( currentHour >= 18 && currentMinute >= 01 ) ||(currentHour <= 5 && currentMinute <= 59))
return true;
//if ( currentHour <= 7 && ( currentHour >= 18 /*&& currentMinute <= 59 */))
// return false;
return false;
}
private void CheckBurn( )
{
ArrayList mobs = new ArrayList( World.Mobiles.Values );
for( int i = 0; i<mobs.Count; i++)
{
Mobile m = mobs[i] as Mobile;
if (m is PlayerMobile && m.Alive && m.Map != Map.Internal)
{
PlayerMobile mplayer = m as PlayerMobile;
if (mplayer.Vampirism == true && mplayer.VampBurn == true )
{
BaseHouse house = BaseHouse.FindHouseAt( m );
//StaticHouseSign staticHouse = StaticHouseSign.StaticFindHouseAt( m );
if (house == null /*&& staticHouse == null*/ && Validate(m) == true)
{
if ( GetBurning( m.X ) )
{
m.Stam -= 10; //tick away some stamina
m.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );
Effects.SendLocationEffect(m.Location, m.Map,0x371C, 20); //0x36BD,0x398C
m.PrivateOverheadMessage(0, 0, false, "You feel as if your skin is melting", m.NetState );
m.PlaySound( m.Female ? 814 : 1088 );
m.Say( "*ahhhh!*" );
m.Damage( Utility.Random( 40, 75 ) );
}
else
m.PrivateOverheadMessage(0, 0, false, "Be glad your not a vampire", m.NetState );
return;
}
}
}
}
}
public bool Validate(Mobile from)
{
if(from.Region.Name != "Wind" && //towns
from.Region.Name != "Covetous" && from.Region.Name != "Deceit" &&//dungeons
from.Region.Name != "Despise" && from.Region.Name != "Destard" &&//dungeons
from.Region.Name != "Hythloth" && from.Region.Name != "Shame" &&//dungeons
from.Region.Name != "Wrong" && from.Region.Name != "Terathan Keep" &&//dungeons
from.Region.Name != "Fire" && from.Region.Name != "Ice" &&//dungeons
from.Region.Name != "Rock Dungeon" && from.Region.Name != "Spider Cave" &&//dungeons
from.Region.Name != "Spectre Dungeon" && from.Region.Name != "Blood Dungeon" &&//dungeons
from.Region.Name != "Wisp Dungeon" && from.Region.Name != "Ankh Dungeon" &&//dungeons
from.Region.Name != "Exodus Dungeon" && from.Region.Name != "Sorcerer's Dungeon" &&//dungeons
from.Region.Name != "Ancient Lair" && from.Region.Name != "Doom" &&//dungeons
from.Region.Name != "Jail")
{
return true;
}
else
{
return false;
}
}
}
#endregion
#region Sicknesses
private SickFlag flag;
public SickTimer m_SickTimer;
public ImmunTimer m_ImmunTimer;
[CommandProperty( AccessLevel.GameMaster )]
public bool Sick
{
get{ return GetDFlag( PlayerFlag.Sick ); }
set
{
if ( this.Sickness != SickFlag.TempImmunity && this.Sickness != SickFlag.PermImmunity && this.Sickness != SickFlag.None && this.Sickness != SickFlag.VampTurn && !value )
this.SendMessage( "You feel better!" );
if ( this.Sickness != SickFlag.None ) //&& this.Sickness != SickFlag.VampTurn
SetDFlag( PlayerFlag.Sick, value );
else
{
SetDFlag( PlayerFlag.Sick, false );
this.SickContagious = false;
}
if ( !value )
{
this.Sickness = SickFlag.None;
}
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool SickContagious
{
get{ return GetDFlag( PlayerFlag.SickContagious ); }
set
{
if ( !this.Sick || this.Sickness == SickFlag.TempImmunity || this.Sickness == SickFlag.PermImmunity || this.Sickness == SickFlag.VampTurn)
SetDFlag( PlayerFlag.SickContagious, false );
else
SetDFlag( PlayerFlag.SickContagious, value );
}
}
[CommandProperty( AccessLevel.GameMaster )]
public SickFlag Sickness
{
get{ return flag; }
set
{
flag = value;
ChangeSickness( this, flag );
}
}
public class ImmunTimer : Timer
{
private Mobile m_defender;
private PlayerMobile m_pmdefender;
private int cnt = 0;
public ImmunTimer( Mobile defender ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 0.6 ), 480 )
{
m_defender = defender;
m_pmdefender = (PlayerMobile) defender;
}
protected override void OnTick()
{
cnt += 1;
if ( !m_pmdefender.Sick && m_pmdefender.Sickness == SickFlag.VampTurn)
Stop();
if ( m_pmdefender.Sickness == SickFlag.TempImmunity && m_pmdefender.Sickness != SickFlag.VampTurn && cnt == 480)//&& m_pmdefender.Vampirism == false
m_pmdefender.Sick = false;
}
}
public class SickTimer : Timer
{
private Mobile m_defender;
private int cnt = 0;
private int m_count = 0;
private int m_countmax;
private PlayerMobile m_pmdefender;
private SickFlag m_flag;
public SickTimer( Mobile defender, int count, SickFlag flag ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 20 ), count )
{
m_defender = defender;
m_countmax = count;
m_pmdefender = (PlayerMobile) defender;
m_flag = flag;
}
protected override void OnTick()
{
if ( !m_defender.Alive && m_pmdefender.Sickness != SickFlag.VampTurn)
{
m_pmdefender.Sick = false;
m_pmdefender.SickContagious = false;
Stop();
}
if ( ((!m_pmdefender.Sick) || (m_pmdefender.Sickness == SickFlag.None) || (m_pmdefender.Sickness == SickFlag.TempImmunity) || (m_pmdefender.Sickness == SickFlag.PermImmunity)) && (m_pmdefender.Sickness != SickFlag.VampTurn ))
Stop();
if ( m_flag == SickFlag.Cold )
{
cnt += 1;
m_count += 1;
m_defender.Damage( Utility.Random( 5, 10 ) );
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 3 );
if ( cnt > 2 )
{
m_defender.SendMessage( "You have a cold!" );
m_defender.Emote("cough*cough");
if ( !m_defender.Female )
m_defender.PlaySound( 0x420 );
else
m_defender.PlaySound( 0x311 );
cnt = 0;
}
}
if( m_flag == SickFlag.Flu )
{
cnt += 1;
m_count += 1;
m_defender.Damage( Utility.Random( 10, 15 ) );
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 5 );
if ( cnt > 2 )
{
m_defender.SendMessage( "You have influenza!" );
m_defender.Emote("*feels feverish*");
if ( !m_defender.Female )
m_defender.PlaySound( 0x42B );
else
m_defender.PlaySound( 0x31B );
cnt = 0;
}
}
if ( m_flag == SickFlag.Headache )
{
cnt += 1;
m_count += 1;
m_defender.Damage( Utility.Random( 1, 5 ) );
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 2 );
if ( cnt > 2 )
{
m_defender.SendMessage( "You have a bad headache!" );
m_defender.Emote("*head throbbing*");
if ( !m_defender.Female )
m_defender.PlaySound( 0x42B );
else
m_defender.PlaySound( 0x31B );
cnt = 0;
}
}
if ( m_flag == SickFlag.Virus )
{
cnt += 1;
m_count += 1;
m_defender.Damage( Utility.Random( 15, 20 ) );
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 4 );
if ( cnt > 2 )
{
m_defender.SendMessage( "You have a virus!" );
m_defender.Emote("*stomach wretching*");
if ( !m_defender.Female )
m_defender.PlaySound( 0x43F );
else
m_defender.PlaySound( 0x32D );
cnt = 0;
}
}
if ( m_flag == SickFlag.VampTurn )
{
cnt += 1;
m_count += 12;
if ( cnt == 2 )
{
m_defender.SendMessage( "You feel the blood in your body changing!" );
m_defender.Emote("*stomach wretching*");
m_defender.Damage( Utility.Random( 1, 1 ) );
m_defender.PlaySound( m_defender.Female ? 813 : 1087 );
m_defender.Say( "*pukes*" );
if ( !m_defender.Mounted )
{
m_defender.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( m_defender.Location );
switch( m_defender.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = m_defender.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = m_defender.Map;
puke.Location = p;
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 1 );
}
if ( cnt == 4 )
{
m_defender.SendMessage( "You feel your body drying up!" );
m_defender.Emote("*stomach wretching*");
m_defender.Damage( Utility.Random( 1, 2 ) );
m_defender.PlaySound( m_defender.Female ? 813 : 1087 );
m_defender.Say( "*pukes*" );
if ( !m_defender.Mounted )
{
m_defender.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( m_defender.Location );
switch( m_defender.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = m_defender.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = m_defender.Map;
puke.Location = p;
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 2 );
}
if ( cnt == 6 )
{
m_defender.SendMessage( "You feel as if you are dying!" );
m_defender.Emote("*stomach wretching*");
m_defender.Damage( Utility.Random( 1, 3 ) );
m_defender.PlaySound( m_defender.Female ? 813 : 1087 );
m_defender.Say( "*pukes*" );
if ( !m_defender.Mounted )
{
m_defender.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( m_defender.Location );
switch( m_defender.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = m_defender.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = m_defender.Map;
puke.Location = p;
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 3 );
}
if ( cnt == 8 )
{
m_defender.SendMessage( "You feel extremely dizzy and light headed!" );
m_defender.Emote("*stomach wretching*");
m_defender.Damage( Utility.Random( 1, 4 ) );
m_defender.PlaySound( m_defender.Female ? 813 : 1087 );
m_defender.Say( "*pukes*" );
if ( !m_defender.Mounted )
{
m_defender.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( m_defender.Location );
switch( m_defender.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = m_defender.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = m_defender.Map;
puke.Location = p;
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 4 );
}
if ( cnt == 10 )
{
m_defender.SendMessage( "You can hardly control yourself!" );
m_defender.Emote("*stomach tightens*");
m_defender.Damage( Utility.Random( 1, 5 ) );
m_defender.PlaySound( m_defender.Female ? 813 : 1087 );
m_defender.Say( "*pukes*" );
if ( !m_defender.Mounted )
{
m_defender.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( m_defender.Location );
switch( m_defender.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = m_defender.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = m_defender.Map;
puke.Location = p;
//break;
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 5 );
}
if ( cnt == 12 )
{
m_defender.SendMessage( "You begin to fall over and feel death upon you!" );
m_defender.PlaySound( m_defender.Female ? 814 : 1088 );
m_defender.Say( "*ahhhh!*" );
m_defender.PublicOverheadMessage( MessageType.Spell, m_defender.SpeechHue, true, "*you shuffle off your mortal coil*", false );
m_defender.Damage( Utility.Random( 150, 150 ) );
//m_defender.Hits = m_defender.Hits - Utility.Random( 1, 150 );
m_pmdefender.Vampirism = true;
m_pmdefender.VampHunger = true;
m_pmdefender.VampBurn = true;
m_pmdefender.Title = "The Vampire";
m_pmdefender.Hue = 1154;
m_pmdefender.VampireType = VampType.Vampire;
m_pmdefender.Sickness = SickFlag.PermImmunity;
m_pmdefender.Resurrect();
m_defender.AddToBackpack( new VampireOrb() );
m_defender.Hunger = 3;
m_defender.Kills = 5;
m_defender.SendMessage( "You have been reborn into a Vampire, you'll need Blood to survive now!" );
/////////////////////////////////////////////////////////////////////////////////////////
///////THIS IS FOR RESETTING SKILLS AND CAP ON TURN//////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
//Server.Skills skills = m_defender.Skills;
//
//for ( int i = 0; i < skills.Length; ++i )
//{
//skills[i].Base = 0.0;
//skills[i].Cap = 100.0;
//}
///////////////////////////////////////////////////////////////////////////////////////
}
}
if ( m_count == m_countmax )//&& m_pmdefender.Vampirism != true
{
m_pmdefender.Sickness = SickFlag.TempImmunity;
return;
}
int randominfect = Utility.Random( 1, 99 );
ArrayList li = new ArrayList();
foreach ( Mobile o in m_defender.Map.GetMobilesInRange( m_defender.Location, 5 ) )
{
li.Add(o);
}
for (int i = 0; i < li.Count; i++)
{
Mobile o = li[i] as Mobile;
if ( o is PlayerMobile && m_defender != o )
{
PlayerMobile mob = (PlayerMobile) o;
if (( mob.Sickness == SickFlag.TempImmunity || mob.Sickness == SickFlag.PermImmunity || !mob.SickContagious )|| (mob.Vampirism == true))
{
}
else if ( mob.Sickness == SickFlag.None )
{
if ( randominfect > 43 && randominfect < 50 )
mob.Sickness = m_flag;
}
}
}
}
}
public virtual void ChangeSickness( PlayerMobile m, SickFlag newsick )
{
int count = Utility.Random( 5, 20 );
Mobile pm = (Mobile) m;
switch ( newsick )
{
case SickFlag.None:
{
if ( m.Sick )
{
m.Sick = false;
m.SickContagious = false;
}
break;
}
case SickFlag.TempImmunity:
{
m.SendMessage( "You feel better!" );
m.Sick = true;
m.SickContagious= false;
m_ImmunTimer = new ImmunTimer ( pm );
m_ImmunTimer.Start();
break;
}
case SickFlag.PermImmunity:
{
m.SendMessage( "You feel permanently immune to sicknesses!" );
m.Sick = true;
m.SickContagious= false;
break;
}
case SickFlag.Cold:
{
m.SendMessage( "You have caught a cold!" );
m.Sick = true;
m.SickContagious= true;
m_SickTimer = new SickTimer ( pm, count, SickFlag.Cold );
m_SickTimer.Start();
break;
}
case SickFlag.Flu:
{
m.SendMessage( "You came down with influenza!" );
m.Sick = true;
m.SickContagious= true;
m_SickTimer = new SickTimer ( pm, count, SickFlag.Flu );
m_SickTimer.Start();
break;
}
case SickFlag.Headache:
{
m.SendMessage( "You feel a bad headache coming on!" );
m.Sick = true;
m.SickContagious= false;
m_SickTimer = new SickTimer ( pm, count, SickFlag.Headache );
m_SickTimer.Start();
break;
}
case SickFlag.Virus:
{
m.SendMessage( "You caught a bad virus!" );
m.Sick = true;
m.SickContagious= true;
m_SickTimer = new SickTimer ( pm, count, SickFlag.Virus );
m_SickTimer.Start();
break;
}
case SickFlag.VampTurn:
{
m.SendMessage( "You have been infected by a Vampire!" );
m.Sick = true;
m.SickContagious= false;
m_SickTimer = new SickTimer ( pm, count, SickFlag.VampTurn );
m_SickTimer.Start();
break;
}
}
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//End Sickness Edit///////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private DesignContext m_DesignContext;
private NpcGuild m_NpcGuild;
private DateTime m_NpcGuildJoinTime;
private TimeSpan m_NpcGuildGameTime;
//private PlayerFlag m_Flags; <<<<Edit this out for Sickness system
private int m_StepsTaken;
private int m_Profession;
//private int m_StepsTaken;
//private int m_Profession;
[CommandProperty( AccessLevel.GameMaster )]
public int Profession
{
get{ return m_Profession; }
set{ m_Profession = value; }
}
public int StepsTaken
{
get{ return m_StepsTaken; }
set{ m_StepsTaken = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public NpcGuild NpcGuild
{
get{ return m_NpcGuild; }
set{ m_NpcGuild = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime NpcGuildJoinTime
{
get{ return m_NpcGuildJoinTime; }
set{ m_NpcGuildJoinTime = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NpcGuildGameTime
{
get{ return m_NpcGuildGameTime; }
set{ m_NpcGuildGameTime = value; }
}
public PlayerFlag Flags
{
get{ return m_Flags; }
set{ m_Flags = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool PagingSquelched
{
get{ return GetFlag( PlayerFlag.PagingSquelched ); }
set{ SetFlag( PlayerFlag.PagingSquelched, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Glassblowing
{
get{ return GetFlag( PlayerFlag.Glassblowing ); }
set{ SetFlag( PlayerFlag.Glassblowing, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Masonry
{
get{ return GetFlag( PlayerFlag.Masonry ); }
set{ SetFlag( PlayerFlag.Masonry, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool SandMining
{
get{ return GetFlag( PlayerFlag.SandMining ); }
set{ SetFlag( PlayerFlag.SandMining, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool StoneMining
{
get{ return GetFlag( PlayerFlag.StoneMining ); }
set{ SetFlag( PlayerFlag.StoneMining, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool ToggleMiningStone
{
get{ return GetFlag( PlayerFlag.ToggleMiningStone ); }
set{ SetFlag( PlayerFlag.ToggleMiningStone, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool KarmaLocked
{
get{ return GetFlag( PlayerFlag.KarmaLocked ); }
set{ SetFlag( PlayerFlag.KarmaLocked, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool AutoRenewInsurance
{
get{ return GetFlag( PlayerFlag.AutoRenewInsurance ); }
set{ SetFlag( PlayerFlag.AutoRenewInsurance, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool UseOwnFilter
{
get{ return GetFlag( PlayerFlag.UseOwnFilter ); }
set{ SetFlag( PlayerFlag.UseOwnFilter, value ); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool PublicMyRunUO
{
get{ return GetFlag( PlayerFlag.PublicMyRunUO ); }
set{ SetFlag( PlayerFlag.PublicMyRunUO, value ); InvalidateMyRunUO(); }
}
public static Direction GetDirection4( Point3D from, Point3D to )
{
int dx = from.X - to.X;
int dy = from.Y - to.Y;
int rx = dx - dy;
int ry = dx + dy;
Direction ret;
if ( rx >= 0 && ry >= 0 )
ret = Direction.West;
else if ( rx >= 0 && ry < 0 )
ret = Direction.South;
else if ( rx < 0 && ry < 0 )
ret = Direction.East;
else
ret = Direction.North;
return ret;
}
public override bool OnDroppedItemToWorld( Item item, Point3D location )
{
if ( !base.OnDroppedItemToWorld( item, location ) )
return false;
BounceInfo bi = item.GetBounce();
if ( bi != null )
{
Type type = item.GetType();
if ( type.IsDefined( typeof( FurnitureAttribute ), true ) || type.IsDefined( typeof( DynamicFlipingAttribute ), true ) )
{
object[] objs = type.GetCustomAttributes( typeof( FlipableAttribute ), true );
if ( objs != null && objs.Length > 0 )
{
FlipableAttribute fp = objs[0] as FlipableAttribute;
if ( fp != null )
{
int[] itemIDs = fp.ItemIDs;
Point3D oldWorldLoc = bi.m_WorldLoc;
Point3D newWorldLoc = location;
if ( oldWorldLoc.X != newWorldLoc.X || oldWorldLoc.Y != newWorldLoc.Y )
{
Direction dir = GetDirection4( oldWorldLoc, newWorldLoc );
if ( itemIDs.Length == 2 )
{
switch ( dir )
{
case Direction.North:
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East:
case Direction.West: item.ItemID = itemIDs[1]; break;
}
}
else if ( itemIDs.Length == 4 )
{
switch ( dir )
{
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East: item.ItemID = itemIDs[1]; break;
case Direction.North: item.ItemID = itemIDs[2]; break;
case Direction.West: item.ItemID = itemIDs[3]; break;
}
}
}
}
}
}
}
return true;
}
public bool GetFlag( PlayerFlag flag )
{
return ( (m_Flags & flag) != 0 );
}
public void SetFlag( PlayerFlag flag, bool value )
{
if ( value )
m_Flags |= flag;
else
m_Flags &= ~flag;
}
public DesignContext DesignContext
{
get{ return m_DesignContext; }
set{ m_DesignContext = value; }
}
public static void Initialize()
{
if ( FastwalkPrevention )
{
PacketHandler ph = PacketHandlers.GetHandler( 0x02 );
ph.ThrottleCallback = new ThrottlePacketCallback( MovementThrottle_Callback );
}
EventSink.Login += new LoginEventHandler( OnLogin );
EventSink.Logout += new LogoutEventHandler( OnLogout );
EventSink.Connected += new ConnectedEventHandler( EventSink_Connected );
EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected );
}
public override void OnSkillInvalidated( Skill skill )
{
if ( Core.AOS && skill.SkillName == SkillName.MagicResist )
UpdateResistances();
}
public override int GetMaxResistance( ResistanceType type )
{
int max = base.GetMaxResistance( type );
if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
max = 60;
return max;
}
private int m_LastGlobalLight = -1, m_LastPersonalLight = -1;
public override void OnNetStateChanged()
{
m_LastGlobalLight = -1;
m_LastPersonalLight = -1;
}
public override void ComputeBaseLightLevels( out int global, out int personal )
{
global = LightCycle.ComputeLevelFor( this );
personal = this.LightLevel;
}
public override void CheckLightLevels( bool forceResend )
{
NetState ns = this.NetState;
if ( ns == null )
return;
int global, personal;
ComputeLightLevels( out global, out personal );
if ( !forceResend )
forceResend = ( global != m_LastGlobalLight || personal != m_LastPersonalLight );
if ( !forceResend )
return;
m_LastGlobalLight = global;
m_LastPersonalLight = personal;
ns.Send( GlobalLightLevel.Instantiate( global ) );
ns.Send( new PersonalLightLevel( this, personal ) );
}
public override int GetMinResistance( ResistanceType type )
{
int magicResist = (int)(Skills[SkillName.MagicResist].Value * 10);
int min = int.MinValue;
if ( magicResist >= 1000 )
min = 40 + ((magicResist - 1000) / 50);
else if ( magicResist >= 400 )
min = (magicResist - 400) / 15;
if ( min > MaxPlayerResistance )
min = MaxPlayerResistance;
int baseMin = base.GetMinResistance( type );
if ( min < baseMin )
min = baseMin;
return min;
}
private static void OnLogin( LoginEventArgs e )
{
Mobile from = e.Mobile;
SacrificeVirtue.CheckAtrophy( from );
JusticeVirtue.CheckAtrophy( from );
CompassionVirtue.CheckAtrophy( from );
if ( AccountHandler.LockdownLevel > AccessLevel.Player )
{
string notice;
Accounting.Account acct = from.Account as Accounting.Account;
if ( acct == null || !acct.HasAccess( from.NetState ) )
{
if ( from.AccessLevel == AccessLevel.Player )
notice = "The server is currently under lockdown. No players are allowed to log in at this time.";
else
notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from );
}
else if ( from.AccessLevel == AccessLevel.Administrator )
{
notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump.";
}
else
{
notice = "The server is currently under lockdown. You have sufficient access level to connect.";
}
from.SendGump( new NoticeGump( 1060637, 30720, notice, 0xFFC000, 300, 140, null, null ) );
}
}
private bool m_NoDeltaRecursion;
public void ValidateEquipment()
{
if ( m_NoDeltaRecursion || Map == null || Map == Map.Internal )
return;
if ( this.Items == null )
return;
m_NoDeltaRecursion = true;
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ValidateEquipment_Sandbox ) );
}
private void ValidateEquipment_Sandbox()
{
try
{
if ( Map == null || Map == Map.Internal )
return;
ArrayList items = this.Items;
if ( items == null )
return;
bool moved = false;
int str = this.Str;
int dex = this.Dex;
int intel = this.Int;
Mobile from = this;
for ( int i = items.Count - 1; i >= 0; --i )
{
if ( i >= items.Count )
continue;
Item item = (Item)items[i];
if ( item is BaseWeapon )
{
BaseWeapon weapon = (BaseWeapon)item;
bool drop = false;
if ( dex < weapon.DexRequirement )
drop = true;
else if ( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) )
drop = true;
else if ( intel < weapon.IntRequirement )
drop = true;
if ( drop )
{
string name = weapon.Name;
if ( name == null )
name = String.Format( "#{0}", weapon.LabelNumber );
from.SendLocalizedMessage( 1062001, name ); // You can no longer wield your ~1_WEAPON~
from.AddToBackpack( weapon );
moved = true;
}
}
else if ( item is BaseArmor )
{
BaseArmor armor = (BaseArmor)item;
bool drop = false;
if ( !armor.AllowMaleWearer && from.Body.IsMale && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else if ( !armor.AllowFemaleWearer && from.Body.IsFemale && from.AccessLevel < AccessLevel.GameMaster )
{
drop = true;
}
else
{
int strBonus = armor.ComputeStatBonus( StatType.Str ), strReq = armor.ComputeStatReq( StatType.Str );
int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex );
int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int );
if ( dex < dexReq || (dex + dexBonus) < 1 )
drop = true;
else if ( str < strReq || (str + strBonus) < 1 )
drop = true;
else if ( intel < intReq || (intel + intBonus) < 1 )
drop = true;
}
if ( drop )
{
string name = armor.Name;
if ( name == null )
name = String.Format( "#{0}", armor.LabelNumber );
if ( armor is BaseShield )
from.SendLocalizedMessage( 1062003, name ); // You can no longer equip your ~1_SHIELD~
else
from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~
from.AddToBackpack( armor );
moved = true;
}
}
}
if ( moved )
from.SendLocalizedMessage( 500647 ); // Some equipment has been moved to your backpack.
}
catch ( Exception e )
{
Console.WriteLine( e );
}
finally
{
m_NoDeltaRecursion = false;
}
}
public override void Delta( MobileDelta flag )
{
base.Delta( flag );
if ( (flag & MobileDelta.Stat) != 0 )
ValidateEquipment();
if ( (flag & (MobileDelta.Name | MobileDelta.Hue)) != 0 )
InvalidateMyRunUO();
}
private static void Disconnect( object state )
{
NetState ns = ((Mobile)state).NetState;
if ( ns != null )
ns.Dispose();
}
private static void OnLogout( LogoutEventArgs e )
{
}
private static void EventSink_Connected( ConnectedEventArgs e )
{
PlayerMobile pm = e.Mobile as PlayerMobile;
if ( pm != null )
{
pm.m_SessionStart = DateTime.Now;
if ( pm.m_Quest != null )
pm.m_Quest.StartTimer();
}
}
private static void EventSink_Disconnected( DisconnectedEventArgs e )
{
Mobile from = e.Mobile;
DesignContext context = DesignContext.Find( from );
if ( context != null )
{
/* Client disconnected
* - Remove design context
* - Eject client from house
*/
// Remove design context
DesignContext.Remove( from );
// Eject client from house
from.RevealingAction();
from.MoveToWorld( context.Foundation.BanLocation, context.Foundation.Map );
}
PlayerMobile pm = e.Mobile as PlayerMobile;
if ( pm != null )
{
pm.m_GameTime += (DateTime.Now - pm.m_SessionStart);
if ( pm.m_Quest != null )
pm.m_Quest.StopTimer();
}
}
public override void RevealingAction()
{
if ( m_DesignContext != null )
return;
Spells.Sixth.InvisibilitySpell.RemoveTimer( this );
base.RevealingAction();
}
public override void OnSubItemAdded( Item item )
{
if ( AccessLevel < AccessLevel.GameMaster && item.IsChildOf( this.Backpack ) )
{
int maxWeight = WeightOverloading.GetMaxWeight( this );
int curWeight = Mobile.BodyWeight + this.TotalWeight;
if ( curWeight > maxWeight )
this.SendLocalizedMessage( 1019035, true, String.Format( " : {0} / {1}", curWeight, maxWeight ) );
}
}
public override bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness )
{
if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
return false;
if ( (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier )
{
if ( message )
{
if ( target.Title == null )
SendMessage( "{0} the vendor cannot be harmed.", target.Name );
else
SendMessage( "{0} {1} cannot be harmed.", target.Name, target.Title );
}
return false;
}
return base.CanBeHarmful( target, message, ignoreOurBlessedness );
}
public override bool CanBeBeneficial( Mobile target, bool message, bool allowDead )
{
if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) )
return false;
return base.CanBeBeneficial( target, message, allowDead );
}
public override bool CheckContextMenuDisplay( IEntity target )
{
return ( m_DesignContext == null );
}
public override void OnItemAdded( Item item )
{
base.OnItemAdded( item );
if ( item is BaseArmor || item is BaseWeapon )
{
Hits=Hits; Stam=Stam; Mana=Mana;
}
InvalidateMyRunUO();
}
public override void OnItemRemoved( Item item )
{
base.OnItemRemoved( item );
if ( item is BaseArmor || item is BaseWeapon )
{
Hits=Hits; Stam=Stam; Mana=Mana;
}
InvalidateMyRunUO();
}
public override int HitsMax
{
get
{
int strBase;
int strOffs = GetStatOffset( StatType.Str );
if ( Core.AOS )
{
strBase = this.Str;
strOffs += AosAttributes.GetValue( this, AosAttribute.BonusHits );
}
else
{
strBase = this.RawStr;
}
return (strBase / 2) + 50 + strOffs;
}
}
public override int StamMax
{
get{ return base.StamMax + AosAttributes.GetValue( this, AosAttribute.BonusStam ); }
}
public override int ManaMax
{
get{ return base.ManaMax + AosAttributes.GetValue( this, AosAttribute.BonusMana ); }
}
public override bool Move( Direction d )
{
NetState ns = this.NetState;
if ( ns != null )
{
Gump[] gumps = ns.Gumps;
for ( int i = 0; i < gumps.Length; ++i )
{
if ( gumps[i] is ResurrectGump )
{
if ( Alive )
{
CloseGump( typeof( ResurrectGump ) );
}
else
{
SendLocalizedMessage( 500111 ); // You are frozen and cannot move.
return false;
}
}
}
}
TimeSpan speed = ComputeMovementSpeed( d );
if ( !base.Move( d ) )
return false;
m_NextMovementTime += speed;
return true;
}
public override bool CheckMovement( Direction d, out int newZ )
{
DesignContext context = m_DesignContext;
if ( context == null )
return base.CheckMovement( d, out newZ );
HouseFoundation foundation = context.Foundation;
newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level );
int newX = this.X, newY = this.Y;
Movement.Movement.Offset( d, ref newX, ref newY );
int startX = foundation.X + foundation.Components.Min.X + 1;
int startY = foundation.Y + foundation.Components.Min.Y + 1;
int endX = startX + foundation.Components.Width - 1;
int endY = startY + foundation.Components.Height - 2;
return ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map );
}
public override bool AllowItemUse( Item item )
{
return DesignContext.Check( this );
}
public override bool AllowSkillUse( SkillName skill )
{
return DesignContext.Check( this );
}
private bool m_LastProtectedMessage;
private int m_NextProtectionCheck = 10;
public virtual void RecheckTownProtection()
{
m_NextProtectionCheck = 10;
Regions.GuardedRegion reg = this.Region as Regions.GuardedRegion;
bool isProtected = ( reg != null && !reg.IsDisabled() );
if ( isProtected != m_LastProtectedMessage )
{
if ( isProtected )
SendLocalizedMessage( 500112 ); // You are now under the protection of the town guards.
else
SendLocalizedMessage( 500113 ); // You have left the protection of the town guards.
m_LastProtectedMessage = isProtected;
}
}
public override void MoveToWorld( Point3D loc, Map map )
{
base.MoveToWorld( loc, map );
RecheckTownProtection();
}
public override void SetLocation( Point3D loc, bool isTeleport )
{
base.SetLocation( loc, isTeleport );
if ( isTeleport || --m_NextProtectionCheck == 0 )
RecheckTownProtection();
}
public override void GetContextMenuEntries( Mobile from, ArrayList list )
{
base.GetContextMenuEntries( from, list );
if ( from == this )
{
if ( m_Quest != null )
m_Quest.GetContextMenuEntries( list );
if ( Alive && InsuranceEnabled )
{
list.Add( new CallbackEntry( 6201, new ContextCallback( ToggleItemInsurance ) ) );
if ( AutoRenewInsurance )
list.Add( new CallbackEntry( 6202, new ContextCallback( CancelRenewInventoryInsurance ) ) );
else
list.Add( new CallbackEntry( 6200, new ContextCallback( AutoRenewInventoryInsurance ) ) );
}
// TODO: Toggle champ titles
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null && house.IsAosRules )
list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) );
if ( m_JusticeProtectors.Count > 0 )
list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) );
}
}
private void CancelProtection()
{
for ( int i = 0; i < m_JusticeProtectors.Count; ++i )
{
Mobile prot = (Mobile)m_JusticeProtectors[i];
string args = String.Format( "{0}\t{1}", this.Name, prot.Name );
prot.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
this.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended.
}
m_JusticeProtectors.Clear();
}
private void ToggleItemInsurance()
{
if ( !CheckAlive() )
return;
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
private bool CanInsure( Item item )
{
if ( item is Container )
return false;
if ( item is Spellbook || item is Runebook || item is PotionKeg )
return false;
if ( item.Stackable )
return false;
if ( item.LootType == LootType.Cursed )
return false;
if ( item.ItemID == 0x204E ) // death shroud
return false;
return true;
}
private void ToggleItemInsurance_Callback( Mobile from, object obj )
{
if ( !CheckAlive() )
return;
Item item = obj as Item;
if ( item == null || !item.IsChildOf( this ) )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060871, "", 0x23 ); // You can only insure items that you have equipped or that are in your backpack
}
else if ( item.Insured )
{
item.Insured = false;
SendLocalizedMessage( 1060874, "", 0x35 ); // You cancel the insurance on the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
else if ( !CanInsure( item ) )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
}
else if ( item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == from )
{
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060870, "", 0x23 ); // That item is blessed and does not need to be insured
SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that
}
else
{
if ( !item.PayedInsurance )
{
if ( Banker.Withdraw( from, 600 ) )
{
SendLocalizedMessage( 1060398, "600" ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
item.PayedInsurance = true;
}
else
{
SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
return;
}
}
item.Insured = true;
SendLocalizedMessage( 1060873, "", 0x23 ); // You have insured the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) );
SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel
}
}
private void AutoRenewInventoryInsurance()
{
if ( !CheckAlive() )
return;
SendLocalizedMessage( 1060881, "", 0x23 ); // You have selected to automatically reinsure all insured items upon death
AutoRenewInsurance = true;
}
private void CancelRenewInventoryInsurance()
{
if ( !CheckAlive() )
return;
SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death
AutoRenewInsurance = false;
}
// TODO: Champ titles, toggle
private void LeaveHouse()
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null )
this.Location = house.BanLocation;
}
private delegate void ContextCallback();
private class CallbackEntry : ContextMenuEntry
{
private ContextCallback m_Callback;
public CallbackEntry( int number, ContextCallback callback ) : this( number, -1, callback )
{
}
public CallbackEntry( int number, int range, ContextCallback callback ) : base( number, range )
{
m_Callback = callback;
}
public override void OnClick()
{
if ( m_Callback != null )
m_Callback();
}
}
public override void OnDoubleClick( Mobile from )
{
if ( this == from && !Warmode )
{
IMount mount = Mount;
if ( mount != null && !DesignContext.Check( this ) )
return;
}
base.OnDoubleClick( from );
}
public override void DisplayPaperdollTo( Mobile to )
{
if ( DesignContext.Check( this ) )
base.DisplayPaperdollTo( to );
}
private static bool m_NoRecursion;
protected override void OnLocationChange( Point3D oldLocation )
{
CheckLightLevels( false );
DesignContext context = m_DesignContext;
if ( context == null || m_NoRecursion )
return;
m_NoRecursion = true;
HouseFoundation foundation = context.Foundation;
int newX = this.X, newY = this.Y;
int newZ = foundation.Z + HouseFoundation.GetLevelZ( context.Level );
int startX = foundation.X + foundation.Components.Min.X + 1;
int startY = foundation.Y + foundation.Components.Min.Y + 1;
int endX = startX + foundation.Components.Width - 1;
int endY = startY + foundation.Components.Height - 2;
if ( newX >= startX && newY >= startY && newX < endX && newY < endY && Map == foundation.Map )
{
if ( Z != newZ )
Location = new Point3D( X, Y, newZ );
m_NoRecursion = false;
return;
}
Location = new Point3D( foundation.X, foundation.Y, newZ );
Map = foundation.Map;
m_NoRecursion = false;
}
protected override void OnMapChange( Map oldMap )
{
DesignContext context = m_DesignContext;
if ( context == null || m_NoRecursion )
return;
m_NoRecursion = true;
HouseFoundation foundation = context.Foundation;
if ( Map != foundation.Map )
Map = foundation.Map;
m_NoRecursion = false;
}
public override void OnDamage( int amount, Mobile from, bool willKill )
{
if ( amount > (Core.AOS ? 25 : 0) )
{
BandageContext c = BandageContext.GetContext( this );
if ( c != null )
c.Slip();
}
WeightOverloading.FatigueOnDamage( this, amount );
base.OnDamage( amount, from, willKill );
}
public static int ComputeSkillTotal( Mobile m )
{
int total = 0;
for ( int i = 0; i < m.Skills.Length; ++i )
total += m.Skills[i].BaseFixedPoint;
return ( total / 10 );
}
public override void Resurrect()
{
bool wasAlive = this.Alive;
base.Resurrect();
if ( this.Alive && !wasAlive )
{
Item deathRobe = new DeathRobe();
if ( !EquipItem( deathRobe ) )
deathRobe.Delete();
}
}
private Mobile m_InsuranceAward;
private int m_InsuranceCost;
private int m_InsuranceBonus;
public override bool OnBeforeDeath()
{
m_InsuranceCost = 0;
m_InsuranceAward = base.FindMostRecentDamager( false );
if ( m_InsuranceAward != null && !m_InsuranceAward.Player )
m_InsuranceAward = null;
if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;
return base.OnBeforeDeath();
}
private bool CheckInsuranceOnDeath( Item item )
{
if ( InsuranceEnabled && item.Insured )
{
if ( AutoRenewInsurance )
{
int cost = ( m_InsuranceAward == null ? 600 : 300 );
if ( Banker.Withdraw( this, cost ) )
{
m_InsuranceCost += cost;
item.PayedInsurance = true;
}
else
{
SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance
item.PayedInsurance = false;
item.Insured = false;
}
}
else
{
item.PayedInsurance = false;
item.Insured = false;
}
if ( m_InsuranceAward != null )
{
if ( Banker.Deposit( m_InsuranceAward, 300 ) )
{
if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus += 300;
}
}
return true;
}
return false;
}
public override DeathMoveResult GetParentMoveResultFor( Item item )
{
if ( CheckInsuranceOnDeath( item ) )
return DeathMoveResult.MoveToBackpack;
return base.GetParentMoveResultFor( item );
}
public override DeathMoveResult GetInventoryMoveResultFor( Item item )
{
if ( CheckInsuranceOnDeath( item ) )
return DeathMoveResult.MoveToBackpack;
return base.GetInventoryMoveResultFor( item );
}
public override void OnDeath( Container c )
{
base.OnDeath( c );
HueMod = -1;
NameMod = null;
SavagePaintExpiration = TimeSpan.Zero;
SetHairMods( -1, -1 );
PolymorphSpell.StopTimer( this );
IncognitoSpell.StopTimer( this );
DisguiseGump.StopTimer( this );
EndAction( typeof( PolymorphSpell ) );
EndAction( typeof( IncognitoSpell ) );
MeerMage.StopEffect( this, false );
if ( m_PermaFlags.Count > 0 )
{
m_PermaFlags.Clear();
if ( c is Corpse )
((Corpse)c).Criminal = true;
if ( SkillHandlers.Stealing.ClassicMode )
Criminal = true;
}
if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward )
{
Mobile m = FindMostRecentDamager( false );
if ( m != null && m.Player )
{
bool gainedPath = false;
int theirTotal = ComputeSkillTotal( m );
int ourTotal = ComputeSkillTotal( this );
int pointsToGain = 1 + ((theirTotal - ourTotal) / 50);
if ( pointsToGain < 1 )
pointsToGain = 1;
else if ( pointsToGain > 4 )
pointsToGain = 4;
if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
{
if ( gainedPath )
m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
else
m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.
m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
m.PlaySound( 0x1F7 );
m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain * 2 );
}
}
}
if ( m_InsuranceCost > 0 )
SendLocalizedMessage( 1060398, m_InsuranceCost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
if ( m_InsuranceAward is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m_InsuranceAward;
if ( pm.m_InsuranceBonus > 0 )
pm.SendLocalizedMessage( 1060397, pm.m_InsuranceBonus.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
}
}
private ArrayList m_PermaFlags;
private ArrayList m_VisList;
private Hashtable m_AntiMacroTable;
private TimeSpan m_GameTime;
private TimeSpan m_ShortTermElapse;
private TimeSpan m_LongTermElapse;
private DateTime m_SessionStart;
private DateTime m_LastEscortTime;
private DateTime m_NextSmithBulkOrder;
private DateTime m_NextTailorBulkOrder;
private DateTime m_SavagePaintExpiration;
private SkillName m_Learning = (SkillName)(-1);
public SkillName Learning
{
get{ return m_Learning; }
set{ m_Learning = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan SavagePaintExpiration
{
get
{
TimeSpan ts = m_SavagePaintExpiration - DateTime.Now;
if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;
return ts;
}
set
{
m_SavagePaintExpiration = DateTime.Now + value;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextSmithBulkOrder
{
get
{
TimeSpan ts = m_NextSmithBulkOrder - DateTime.Now;
if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;
return ts;
}
set
{
try{ m_NextSmithBulkOrder = DateTime.Now + value; }
catch{}
}
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextTailorBulkOrder
{
get
{
TimeSpan ts = m_NextTailorBulkOrder - DateTime.Now;
if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;
return ts;
}
set
{
try{ m_NextTailorBulkOrder = DateTime.Now + value; }
catch{}
}
}
public DateTime LastEscortTime
{
get{ return m_LastEscortTime; }
set{ m_LastEscortTime = value; }
}
public PlayerMobile()
{
m_VisList = new ArrayList();
m_PermaFlags = new ArrayList();
m_AntiMacroTable = new Hashtable();
m_BOBFilter = new Engines.BulkOrders.BOBFilter();
m_GameTime = TimeSpan.Zero;
m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
m_LongTermElapse = TimeSpan.FromHours( 40.0 );
m_JusticeProtectors = new ArrayList();
InvalidateMyRunUO();
}
public override bool MutateSpeech( ArrayList hears, ref string text, ref object context )
{
if ( Alive )
return false;
if ( Core.AOS )
{
for ( int i = 0; i < hears.Count; ++i )
{
object o = hears[i];
if ( o != this && o is Mobile && ((Mobile)o).Skills[SkillName.SpiritSpeak].Value >= 100.0 )
return false;
}
}
return base.MutateSpeech( hears, ref text, ref context );
}
public override void Damage( int amount, Mobile from )
{
if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
amount = (int)(amount * 1.25);
Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );
if ( oath == this )
{
amount = (int)(amount * 1.1);
from.Damage( amount, from );
}
base.Damage( amount, from );
}
public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
{
if ( !Alive )
return ApplyPoisonResult.Immune;
if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
return base.ApplyPoison( from, PoisonImpl.IncreaseLevel( poison ) );
return base.ApplyPoison( from, poison );
}
public PlayerMobile( Serial s ) : base( s )
{
m_VisList = new ArrayList();
m_AntiMacroTable = new Hashtable();
InvalidateMyRunUO();
}
public ArrayList VisibilityList
{
get{ return m_VisList; }
}
public ArrayList PermaFlags
{
get{ return m_PermaFlags; }
}
public override int Luck{ get{ return AosAttributes.GetValue( this, AosAttribute.Luck ); } }
public override bool IsHarmfulCriminal( Mobile target )
{
if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).m_PermaFlags.Count > 0 )
{
int noto = Notoriety.Compute( this, target );
if ( noto == Notoriety.Innocent )
target.Delta( MobileDelta.Noto );
return false;
}
if ( target is BaseCreature && ((BaseCreature)target).InitialInnocent )
return false;
return base.IsHarmfulCriminal( target );
}
public bool AntiMacroCheck( Skill skill, object obj )
{
if ( obj == null || m_AntiMacroTable == null || this.AccessLevel != AccessLevel.Player )
return true;
Hashtable tbl = (Hashtable)m_AntiMacroTable[skill];
if ( tbl == null )
m_AntiMacroTable[skill] = tbl = new Hashtable();
CountAndTimeStamp count = (CountAndTimeStamp)tbl[obj];
if ( count != null )
{
if ( count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
{
count.Count = 1;
return true;
}
else
{
++count.Count;
if ( count.Count <= SkillCheck.Allowance )
return true;
else
return false;
}
}
else
{
tbl[obj] = count = new CountAndTimeStamp();
count.Count = 1;
return true;
}
}
private void RevertHair()
{
SetHairMods( -1, -1 );
}
private Engines.BulkOrders.BOBFilter m_BOBFilter;
public Engines.BulkOrders.BOBFilter BOBFilter
{
get{ return m_BOBFilter; }
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Start Sickness Edit///////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case 18:
{
m_VampType = (VampType)reader.ReadInt();
m_Vampirism = (bool)reader.ReadBool();
m_VampHunger = (bool)reader.ReadBool();
m_VampBurn = (bool)reader.ReadBool();
m_Blood = reader.ReadInt();
goto case 17;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//End Sickness Edit/////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case 17: // changed how DoneQuests is serialized
case 16:
{
m_Quest = QuestSerializer.DeserializeQuest( reader );
if ( m_Quest != null )
m_Quest.From = this;
int count = reader.ReadEncodedInt();
if ( count > 0 )
{
m_DoneQuests = new ArrayList();
for ( int i = 0; i < count; ++i )
{
Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader );
DateTime restartTime;
if ( version < 17 )
restartTime = DateTime.MaxValue;
else
restartTime = reader.ReadDateTime();
m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) );
}
}
m_Profession = reader.ReadEncodedInt();
goto case 15;
}
case 15:
{
m_LastCompassionLoss = reader.ReadDeltaTime();
goto case 14;
}
case 14:
{
m_CompassionGains = reader.ReadEncodedInt();
if ( m_CompassionGains > 0 )
m_NextCompassionDay = reader.ReadDeltaTime();
goto case 13;
}
case 13: // just removed m_PayedInsurance list
case 12:
{
m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
goto case 11;
}
case 11:
{
if ( version < 13 )
{
ArrayList payed = reader.ReadItemList();
for ( int i = 0; i < payed.Count; ++i )
((Item)payed[i]).PayedInsurance = true;
}
goto case 10;
}
case 10:
{
if ( reader.ReadBool() )
{
m_HairModID = reader.ReadInt();
m_HairModHue = reader.ReadInt();
m_BeardModID = reader.ReadInt();
m_BeardModHue = reader.ReadInt();
// We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
}
goto case 9;
}
case 9:
{
SavagePaintExpiration = reader.ReadTimeSpan();
if ( SavagePaintExpiration > TimeSpan.Zero )
{
BodyMod = ( Female ? 184 : 183 );
HueMod = 0;
}
goto case 8;
}
case 8:
{
m_NpcGuild = (NpcGuild)reader.ReadInt();
m_NpcGuildJoinTime = reader.ReadDateTime();
m_NpcGuildGameTime = reader.ReadTimeSpan();
goto case 7;
}
case 7:
{
m_PermaFlags = reader.ReadMobileList();
goto case 6;
}
case 6:
{
NextTailorBulkOrder = reader.ReadTimeSpan();
goto case 5;
}
case 5:
{
NextSmithBulkOrder = reader.ReadTimeSpan();
goto case 4;
}
case 4:
{
m_LastJusticeLoss = reader.ReadDeltaTime();
m_JusticeProtectors = reader.ReadMobileList();
goto case 3;
}
case 3:
{
m_LastSacrificeGain = reader.ReadDeltaTime();
m_LastSacrificeLoss = reader.ReadDeltaTime();
m_AvailableResurrects = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Flags = (PlayerFlag)reader.ReadInt();
goto case 1;
}
case 1:
{
m_LongTermElapse = reader.ReadTimeSpan();
m_ShortTermElapse = reader.ReadTimeSpan();
m_GameTime = reader.ReadTimeSpan();
goto case 0;
}
case 0:
{
break;
}
}
if ( m_PermaFlags == null )
m_PermaFlags = new ArrayList();
if ( m_JusticeProtectors == null )
m_JusticeProtectors = new ArrayList();
if ( m_BOBFilter == null )
m_BOBFilter = new Engines.BulkOrders.BOBFilter();
ArrayList list = this.Stabled;
for ( int i = 0; i < list.Count; ++i )
{
BaseCreature bc = list[i] as BaseCreature;
if ( bc != null )
bc.IsStabled = true;
}
}
public override void Serialize( GenericWriter writer )
{
//cleanup our anti-macro table
foreach ( Hashtable t in m_AntiMacroTable.Values )
{
ArrayList remove = new ArrayList();
foreach ( CountAndTimeStamp time in t.Values )
{
if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
remove.Add( time );
}
for (int i=0;i<remove.Count;++i)
t.Remove( remove[i] );
}
//decay our kills
if ( m_ShortTermElapse < this.GameTime )
{
m_ShortTermElapse += TimeSpan.FromHours( 8 );
if ( ShortTermMurders > 0 )
--ShortTermMurders;
}
if ( m_LongTermElapse < this.GameTime )
{
m_LongTermElapse += TimeSpan.FromHours( 40 );
if ( Kills > 0 )
--Kills;
}
base.Serialize( writer );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Start Sickness Edit////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
writer.Write( (int) 18 ); // version
writer.Write( (int)m_VampType );
writer.Write( (bool)m_Vampirism );
writer.Write( (bool)m_VampHunger );
writer.Write( (bool)m_VampBurn );
writer.Write( (int)m_Blood );
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//End Sickness Edit//////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QuestSerializer.Serialize( m_Quest, writer );
if ( m_DoneQuests == null )
{
writer.WriteEncodedInt( (int) 0 );
}
else
{
writer.WriteEncodedInt( (int) m_DoneQuests.Count );
for ( int i = 0; i < m_DoneQuests.Count; ++i )
{
QuestRestartInfo restartInfo = (QuestRestartInfo)m_DoneQuests[i];
QuestSerializer.Write( (Type) restartInfo.QuestType, QuestSystem.QuestTypes, writer );
writer.Write( (DateTime) restartInfo.RestartTime );
}
}
writer.WriteEncodedInt( (int) m_Profession );
writer.WriteDeltaTime( m_LastCompassionLoss );
writer.WriteEncodedInt( m_CompassionGains );
if ( m_CompassionGains > 0 )
writer.WriteDeltaTime( m_NextCompassionDay );
m_BOBFilter.Serialize( writer );
bool useMods = ( m_HairModID != -1 || m_BeardModID != -1 );
writer.Write( useMods );
if ( useMods )
{
writer.Write( (int) m_HairModID );
writer.Write( (int) m_HairModHue );
writer.Write( (int) m_BeardModID );
writer.Write( (int) m_BeardModHue );
}
writer.Write( SavagePaintExpiration );
writer.Write( (int) m_NpcGuild );
writer.Write( (DateTime) m_NpcGuildJoinTime );
writer.Write( (TimeSpan) m_NpcGuildGameTime );
writer.WriteMobileList( m_PermaFlags, true );
writer.Write( NextTailorBulkOrder );
writer.Write( NextSmithBulkOrder );
writer.WriteDeltaTime( m_LastJusticeLoss );
writer.WriteMobileList( m_JusticeProtectors, true );
writer.WriteDeltaTime( m_LastSacrificeGain );
writer.WriteDeltaTime( m_LastSacrificeLoss );
writer.Write( m_AvailableResurrects );
writer.Write( (int) m_Flags );
writer.Write( m_LongTermElapse );
writer.Write( m_ShortTermElapse );
writer.Write( this.GameTime );
}
public void ResetKillTime()
{
m_ShortTermElapse = this.GameTime + TimeSpan.FromHours( 8 );
m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 );
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan GameTime
{
get
{
if ( NetState != null )
return m_GameTime + (DateTime.Now - m_SessionStart);
else
return m_GameTime;
}
}
public override bool CanSee( Mobile m )
{
if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) )
return true;
return base.CanSee( m );
}
public override bool CanSee( Item item )
{
if ( m_DesignContext != null && m_DesignContext.Foundation.IsHiddenToCustomizer( item ) )
return false;
return base.CanSee( item );
}
#region Quest stuff
private QuestSystem m_Quest;
private ArrayList m_DoneQuests;
public QuestSystem Quest
{
get{ return m_Quest; }
set{ m_Quest = value; }
}
public ArrayList DoneQuests
{
get{ return m_DoneQuests; }
set{ m_DoneQuests = value; }
}
#endregion
#region MyRunUO Invalidation
private bool m_ChangedMyRunUO;
public bool ChangedMyRunUO
{
get{ return m_ChangedMyRunUO; }
set{ m_ChangedMyRunUO = value; }
}
public void InvalidateMyRunUO()
{
if ( !Deleted && !m_ChangedMyRunUO )
{
m_ChangedMyRunUO = true;
Engines.MyRunUO.MyRunUO.QueueMobileUpdate( this );
}
}
public override void OnKillsChange( int oldValue )
{
InvalidateMyRunUO();
}
public override void OnGenderChanged( bool oldFemale )
{
InvalidateMyRunUO();
}
public override void OnGuildChange( Server.Guilds.BaseGuild oldGuild )
{
InvalidateMyRunUO();
}
public override void OnGuildTitleChange( string oldTitle )
{
InvalidateMyRunUO();
}
public override void OnKarmaChange( int oldValue )
{
InvalidateMyRunUO();
}
public override void OnFameChange( int oldValue )
{
InvalidateMyRunUO();
}
public override void OnSkillChange( SkillName skill, double oldBase )
{
InvalidateMyRunUO();
}
public override void OnAccessLevelChanged( AccessLevel oldLevel )
{
InvalidateMyRunUO();
}
public override void OnRawStatChange( StatType stat, int oldValue )
{
InvalidateMyRunUO();
}
public override void OnDelete()
{
InvalidateMyRunUO();
}
#endregion
#region Fastwalk Prevention
private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.4 ); // Fastwalk prevention will become active after 0.4 seconds
private DateTime m_NextMovementTime;
public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.GameMaster ); } }
public virtual TimeSpan ComputeMovementSpeed( Direction dir )
{
if ( (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
return TimeSpan.Zero;
bool running = ( (dir & Direction.Running) != 0 );
bool onHorse = ( this.Mount != null );
if ( onHorse )
return ( running ? TimeSpan.FromSeconds( 0.1 ) : TimeSpan.FromSeconds( 0.2 ) );
return ( running ? TimeSpan.FromSeconds( 0.2 ) : TimeSpan.FromSeconds( 0.4 ) );
}
public static bool MovementThrottle_Callback( NetState ns )
{
PlayerMobile pm = ns.Mobile as PlayerMobile;
if ( pm == null || !pm.UsesFastwalkPrevention )
return true;
if ( pm.m_NextMovementTime == DateTime.MinValue )
{
// has not yet moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}
TimeSpan ts = pm.m_NextMovementTime - DateTime.Now;
if ( ts < TimeSpan.Zero )
{
// been a while since we've last moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}
return ( ts < FastwalkThreshold );
}
#endregion
#region Enemy of One
private Type m_EnemyOfOneType;
private bool m_WaitingForEnemy;
public Type EnemyOfOneType
{
get{ return m_EnemyOfOneType; }
set
{
Type oldType = m_EnemyOfOneType;
Type newType = value;
if ( oldType == newType )
return;
m_EnemyOfOneType = value;
DeltaEnemies( oldType, newType );
}
}
public bool WaitingForEnemy
{
get{ return m_WaitingForEnemy; }
set{ m_WaitingForEnemy = value; }
}
private void DeltaEnemies( Type oldType, Type newType )
{
foreach ( Mobile m in this.GetMobilesInRange( 18 ) )
{
Type t = m.GetType();
if ( t == oldType || t == newType )
Send( new MobileMoving( m, Notoriety.Compute( this, m ) ) );
}
}
#endregion
#region Hair and beard mods
private int m_HairModID = -1, m_HairModHue;
private int m_BeardModID = -1, m_BeardModHue;
public void SetHairMods( int hairID, int beardID )
{
if ( hairID == -1 )
InternalRestoreHair( true, ref m_HairModID, ref m_HairModHue );
else if ( hairID != -2 )
InternalChangeHair( true, hairID, ref m_HairModID, ref m_HairModHue );
if ( beardID == -1 )
InternalRestoreHair( false, ref m_BeardModID, ref m_BeardModHue );
else if ( beardID != -2 )
InternalChangeHair( false, beardID, ref m_BeardModID, ref m_BeardModHue );
}
private Item CreateHair( bool hair, int id, int hue )
{
if ( hair )
return Server.Items.Hair.CreateByID( id, hue );
else
return Server.Items.Beard.CreateByID( id, hue );
}
private void InternalRestoreHair( bool hair, ref int id, ref int hue )
{
if ( id == -1 )
return;
Item item = FindItemOnLayer( hair ? Layer.Hair : Layer.FacialHair );
if ( item != null )
item.Delete();
if ( id != 0 )
AddItem( CreateHair( hair, id, hue ) );
id = -1;
hue = 0;
}
private void InternalChangeHair( bool hair, int id, ref int storeID, ref int storeHue )
{
Item item = FindItemOnLayer( hair ? Layer.Hair : Layer.FacialHair );
if ( item != null )
{
if ( storeID == -1 )
{
storeID = item.ItemID;
storeHue = item.Hue;
}
item.Delete();
}
else if ( storeID == -1 )
{
storeID = 0;
storeHue = 0;
}
if ( id == 0 )
return;
AddItem( CreateHair( hair, id, 0 ) );
}
#endregion
#region Virtue stuff
private DateTime m_LastSacrificeGain;
private DateTime m_LastSacrificeLoss;
private int m_AvailableResurrects;
public DateTime LastSacrificeGain{ get{ return m_LastSacrificeGain; } set{ m_LastSacrificeGain = value; } }
public DateTime LastSacrificeLoss{ get{ return m_LastSacrificeLoss; } set{ m_LastSacrificeLoss = value; } }
public int AvailableResurrects{ get{ return m_AvailableResurrects; } set{ m_AvailableResurrects = value; } }
private DateTime m_NextJustAward;
private DateTime m_LastJusticeLoss;
private ArrayList m_JusticeProtectors;
public DateTime LastJusticeLoss{ get{ return m_LastJusticeLoss; } set{ m_LastJusticeLoss = value; } }
public ArrayList JusticeProtectors{ get{ return m_JusticeProtectors; } set{ m_JusticeProtectors = value; } }
private DateTime m_LastCompassionLoss;
private DateTime m_NextCompassionDay;
private int m_CompassionGains;
public DateTime LastCompassionLoss{ get{ return m_LastCompassionLoss; } set{ m_LastCompassionLoss = value; } }
public DateTime NextCompassionDay{ get{ return m_NextCompassionDay; } set{ m_NextCompassionDay = value; } }
public int CompassionGains{ get{ return m_CompassionGains; } set{ m_CompassionGains = value; } }
#endregion
}
}
//Emote v2 by CMonkey123
/*
v2 changes:
-Shortened script
-Added emotes (thanks to zire):
bow, faint, punch, slap, stickouttongue, tapfoot
-Added emote gump (thanks to zire)
*/
using System;
using System.Collections;
using System.IO;
using System.Text;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
namespace Server.Scripts.Commands
{
public class Emote
{
public static void Initialize()
{
Server.Commands.Register( "e", AccessLevel.Player, new CommandEventHandler( Emote_OnCommand ) );
}
[Usage( "<sound>" )]
[Description( "Emote with sounds, words, and possibly an animation with one command!")]
public static void Emote_OnCommand( CommandEventArgs e )
{
Mobile pm = e.Mobile;
string em = e.ArgString.Trim();
switch( em )
{
case "ah":
pm.PlaySound( pm.Female ? 778 : 1049 );
pm.Say( "*ah!*" );
break;
case "ahha":
pm.PlaySound( pm.Female ? 779 : 1050 );
pm.Say( "*ah ha!*" );
break;
case "applaud":
pm.PlaySound( pm.Female ? 780 : 1051 );
pm.Say( "*applauds*" );
break;
case "blownose":
pm.PlaySound( pm.Female ? 781 : 1052 );
pm.Say( "*blows nose*" );
if ( !pm.Mounted )
{
pm.Animate( 34, 5, 1, true, false, 0 );
}
break;
case "bow":
pm.Say( "*bows*" );
if ( !pm.Mounted )
{
pm.Animate( 32, 5, 1, true, false, 0 );
}
break;
case "burp":
pm.PlaySound( pm.Female ? 782 : 1053 );
pm.Say( "*burp!*" );
if ( !pm.Mounted )
{
pm.Animate( 33, 5, 1, true, false, 0 );
}
break;
case "woohoo":
pm.PlaySound( pm.Female ? 783 : 1054 );
pm.Say( "*woohoo!*" );
break;
case "clearthroat":
pm.PlaySound( pm.Female ? 780 : 1051 );
pm.Say( "*applauds*" );
break;
case "cough":
pm.PlaySound( pm.Female ? 785 : 1056 );
pm.Say( "*cough!*" );
if ( !pm.Mounted )
{
pm.Animate( 33, 5, 1, true, false, 0 );
}
break;
case "bscough":
pm.PlaySound( pm.Female ? 786 : 1057 );
pm.Say( "*bs cough*" );
break;
case "cry":
pm.PlaySound( pm.Female ? 787 : 1058 );
pm.Say( "*cries*" );
break;
case "faint":
pm.PlaySound( pm.Female ? 791 : 1063 );
pm.Say( "*faints*" );
if ( !pm.Mounted )
{
pm.Animate( 22, 5, 1, true, false, 0 );
}
break;
case "fart":
pm.PlaySound( pm.Female ? 792 : 1064 );
pm.Say( "*farts*" );
break;
case "gasp":
pm.PlaySound( pm.Female ? 793 : 1065 );
pm.Say( "*gasp!*" );
break;
case "giggle":
pm.PlaySound( pm.Female ? 794 : 1066 );
pm.Say( "*giggles*" );
break;
case "groan":
pm.PlaySound( pm.Female ? 795 : 1067 );
pm.Say( "*groans*" );
break;
case "growl":
pm.PlaySound( pm.Female ? 796 : 1068 );
pm.Say( "*growls*" );
break;
case "hey":
pm.PlaySound( pm.Female ? 797 : 1069 );
pm.Say( "*hey!*" );
break;
case "hiccup":
pm.PlaySound( pm.Female ? 798 : 1070 );
pm.Say( "*hiccup!*" );
break;
case "huh":
pm.PlaySound( pm.Female ? 799 : 1071 );
pm.Say( "*huh?*" );
break;
case "kiss":
pm.PlaySound( pm.Female ? 800 : 1072 );
pm.Say( "*kisses*" );
break;
case "laugh":
pm.PlaySound( pm.Female ? 801 : 1073 );
pm.Say( "*laughs*" );
break;
case "no":
pm.PlaySound( pm.Female ? 802 : 1074 );
pm.Say( "*no!*" );
break;
case "oh":
pm.PlaySound( pm.Female ? 803 : 1075 );
pm.Say( "*oh!*" );
break;
case "oooh":
pm.PlaySound( pm.Female ? 811 : 1085 );
pm.Say( "*oooh*" );
break;
case "oops":
pm.PlaySound( pm.Female ? 812 : 1086 );
pm.Say( "*oops*" );
break;
case "puke":
pm.PlaySound( pm.Female ? 813 : 1087 );
pm.Say( "*pukes*" );
if ( !pm.Mounted )
{
pm.Animate( 32, 5, 1, true, false, 0 );
}
Point3D p = new Point3D( pm.Location );
switch( pm.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = pm.Map.GetAverageZ( p.X, p.Y );
Puke puke = new Puke();
puke.Map = pm.Map;
puke.Location = p;
break;
case "punch":
pm.PlaySound( 315 );
pm.Say( "*punches*" );
if ( !pm.Mounted )
{
pm.Animate( 31, 5, 1, true, false, 0 );
}
break;
case "scream":
pm.PlaySound( pm.Female ? 814 : 1088 );
pm.Say( "*ahhhh!*" );
break;
case "shush":
pm.PlaySound( pm.Female ? 815 : 1089 );
pm.Say( "*shhh!*" );
break;
case "sigh":
pm.PlaySound( pm.Female ? 816 : 1090 );
pm.Say( "*sigh*" );
break;
case "slap":
{
pm.PlaySound( 948 );
pm.Say( "*slaps*" );
if ( !pm.Mounted )
{
pm.Animate( 11, 5, 1, true, false, 0 );
}
break;
}
case "sneeze":
pm.PlaySound( pm.Female ? 817 : 1091 );
pm.Say( "*ahh-choo!*" );
break;
case "sniff":
pm.PlaySound( pm.Female ? 818 : 1092 );
pm.Say( "*sniff*" );
break;
case "snore":
pm.PlaySound( pm.Female ? 819 : 1093 );
pm.Say( "*snore*" );
break;
case "spit":
pm.PlaySound( pm.Female ? 820 : 1094 );
pm.Say( "*spits*" );
break;
case "stickouttongue":
{
pm.PlaySound( 792 );
pm.Say( "*sticks out tongue*" );
break;
}
case "tapfoot":
pm.PlaySound( 874 );
pm.Say( "*taps foot*" );
if ( !pm.Mounted )
{
pm.Animate( 38, 5, 1, true, false, 0 );
}
break;
case "wistle":
pm.PlaySound( pm.Female ? 821 : 1095 );
pm.Say( "*wistles*" );
break;
case "yawn":
pm.PlaySound( pm.Female ? 822 : 1096 );
pm.Say( "*yawns*" );
break;
case "yea":
pm.PlaySound( pm.Female ? 823 : 1097 );
pm.Say( "*yea!*" );
break;
case "yell":
pm.PlaySound( pm.Female ? 823 : 1098 );
pm.Say( "*yells*" );
break;
}
}
}
}
//puke item
namespace Server.Items
{
public class ItemRemovalTimer : Timer
{
private Item i_item;
public ItemRemovalTimer( Item item ) : base( TimeSpan.FromSeconds( 2.0 ) )
{
Priority = TimerPriority.OneSecond;
i_item = item;
}
protected override void OnTick()
{
if (( i_item != null ) && ( !i_item.Deleted ))
i_item.Delete();
}
}
public class Puke : Item
{
[Constructable]
public Puke() : base( Utility.RandomList( 0xf3b, 0xf3c ) )
{
Name = "A Pile of Bloody Puke";
Hue = 2118;
Movable = false;
ItemRemovalTimer thisTimer = new ItemRemovalTimer( this );
thisTimer.Start();
}
public override void OnSingleClick( Mobile from )
{
this.LabelTo( from, this.Name );
}
public Puke( Serial serial ) : base( serial )
{
}
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();
this.Delete(); // none when the world starts
}
}
}
//emote gump thanks to zire
namespace Server.Gumps
{
public enum EmotePage
{
P1,
P2,
P3,
P4,
}
public class EmoteGump : Gump
{
public static void Initialize()
{
Commands.Register( "emenu", AccessLevel.Player, new CommandEventHandler( Msg_OnCommand ) );
}
[Usage( "emenu" )]
[Description( "Emote Menu" )]
private static void Msg_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new EmoteGump( e.Mobile, EmotePage.P1) );
}
private Mobile m_From;
private EmotePage m_Page;
private const int Blanco = 0xFFFFFF;
private const int Azul = 0x8080FF;
public void AddPageButton( int x, int y, int buttonID, string text, EmotePage page, params EmotePage[] subpage )
{
bool seleccionado = ( m_Page == page );
for ( int i = 0; !seleccionado && i < subpage.Length; ++i )
seleccionado = ( m_Page == subpage[i] );
AddButton( x, y - 1, seleccionado ? 4006 : 4005, 4007, buttonID, GumpButtonType.Reply, 0 );
AddHtml( x + 35, y, 200, 20, Color( text, seleccionado ? Azul : Blanco ), false, false );
}
public void AddButtonLabeled( int x, int y, int buttonID, string text )
{
AddButton( x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0 );
AddHtml( x + 35, y, 240, 20, Color( text, Blanco ), false, false );
}
public int GetButtonID( int type, int index )
{
return 1 + (index * 15) + type;
}
public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
public EmoteGump ( Mobile from, EmotePage page) : base ( 600, 50 )
{
from.CloseGump( typeof( EmoteGump ) );
m_From = from;
m_Page = page;
Closable = true;
Dragable = true;
AddPage( 0 );
AddBackground( 0, 65, 130, 360, 5054);
AddAlphaRegion( 10, 70, 110, 350 );
AddImageTiled( 10, 70, 110, 20, 9354);
AddLabel( 13, 70, 200, "Emote List");
AddImage( 100, 0, 10410);
AddImage( 100, 305, 10412);
AddImage( 100, 150, 10411);
switch ( page )
{
case EmotePage.P1:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 1 ), "Ah");
AddButtonLabeled( 10, 115, GetButtonID( 1, 2 ), "Ah-ha");
AddButtonLabeled( 10, 140, GetButtonID( 1, 3 ), "Applaud");
AddButtonLabeled( 10, 165, GetButtonID( 1, 4 ), "Blows Nose");
AddButtonLabeled( 10, 190, GetButtonID( 1, 5 ), "Bows");
AddButtonLabeled( 10, 215, GetButtonID( 1, 6 ), "BS Cough");
AddButtonLabeled( 10, 240, GetButtonID( 1, 7 ), "Burp");
AddButtonLabeled( 10, 265, GetButtonID( 1, 8 ), "Clear Throat");
AddButtonLabeled( 10, 290, GetButtonID( 1, 9 ), "Cough");
AddButtonLabeled( 10, 315, GetButtonID( 1, 10 ), "Cry");
AddButtonLabeled( 10, 340, GetButtonID( 1, 11 ), "Faints");
AddButtonLabeled( 10, 365, GetButtonID( 1, 12 ), "Fart");
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
}
break;
case EmotePage.P2:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 13 ), "Gasp");
AddButtonLabeled( 10, 115, GetButtonID( 1, 14 ), "Giggle");
AddButtonLabeled( 10, 140, GetButtonID( 1, 15 ), "Groan");
AddButtonLabeled( 10, 165, GetButtonID( 1, 16 ), "Growl");
AddButtonLabeled( 10, 190, GetButtonID( 1, 17 ), "Hey");
AddButtonLabeled( 10, 215, GetButtonID( 1, 18 ), "Hiccup");
AddButtonLabeled( 10, 240, GetButtonID( 1, 19 ), "Huh");
AddButtonLabeled( 10, 265, GetButtonID( 1, 20 ), "Kiss");
AddButtonLabeled( 10, 290, GetButtonID( 1, 21 ), "Laughs");
AddButtonLabeled( 10, 315, GetButtonID( 1, 22 ), "No");
AddButtonLabeled( 10, 340, GetButtonID( 1, 23 ), "Oh");
AddButtonLabeled( 10, 365, GetButtonID( 1, 24 ), "Oooh");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,1 ), GumpButtonType.Reply, 0 );
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,3 ), GumpButtonType.Reply, 0 );
break;
}
case EmotePage.P3:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 25 ), "Oops");
AddButtonLabeled( 10, 115, GetButtonID( 1, 26 ), "Puke");
AddButtonLabeled( 10, 140, GetButtonID( 1, 27 ), "Punch");
AddButtonLabeled( 10, 165, GetButtonID( 1, 28 ), "Scream");
AddButtonLabeled( 10, 190, GetButtonID( 1, 29 ), "Shush");
AddButtonLabeled( 10, 215, GetButtonID( 1, 30 ), "Sigh");
AddButtonLabeled( 10, 240, GetButtonID( 1, 31 ), "Slap");
AddButtonLabeled( 10, 265, GetButtonID( 1, 32 ), "Sneeze");
AddButtonLabeled( 10, 290, GetButtonID( 1, 33 ), "Sniff");
AddButtonLabeled( 10, 315, GetButtonID( 1, 34 ), "Snore");
AddButtonLabeled( 10, 340, GetButtonID( 1, 35 ), "Spit");
AddButtonLabeled( 10, 365, GetButtonID( 1, 36 ), "Sticks Tongue");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,4 ), GumpButtonType.Reply, 0 );
break;
}
case EmotePage.P4:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 37 ), "Taps Foot");
AddButtonLabeled( 10, 115, GetButtonID( 1, 38 ), "Whistle");
AddButtonLabeled( 10, 140, GetButtonID( 1, 39 ), "Woohoo");
AddButtonLabeled( 10, 165, GetButtonID( 1, 40 ), "Yawn");
AddButtonLabeled( 10, 190, GetButtonID( 1, 41 ), "Yea");
AddButtonLabeled( 10, 215, GetButtonID( 1, 42 ), "Yell");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,3 ), GumpButtonType.Reply, 0 );
break;
}
}
}
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
{
int val = info.ButtonID - 1;
if ( val < 0 )
return;
Mobile from = m_From;
int type = val % 15;
int index = val / 15;
switch ( type )
{
case 0:
{
EmotePage page;
switch ( index )
{
case 1: page = EmotePage.P1; break;
case 2: page = EmotePage.P2; break;
case 3: page = EmotePage.P3; break;
case 4: page = EmotePage.P4; break;
default: return;
}
from.SendGump( new EmoteGump( from, page) );
break;
}
case 1:
{
switch ( index )
{
case 1:
{
if ( from.Female )
{
from.PlaySound( 778 );
from.Say( "*ah!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1049 );
from.Say( "*ah!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 2:
{
if ( from.Female )
{
from.PlaySound( 779 );
from.Say( "*ah-ha!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1050 );
from.Say( "*ah-ha!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 3:
{
if ( from.Female )
{
from.PlaySound( 780 );
from.Say( "*applauds*" );
}
else if ( !from.Female )
{
from.PlaySound( 1051 );
from.Say( "*applauds*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 4:
{
if ( from.Female )
{
from.PlaySound( 781 );
from.Say( "*blows nose*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1052 );
from.Say( "*blows nose*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 5:
{
from.Say( "*bows*" );
if ( !from.Mounted )
{
from.Animate( 32, 5, 1, true, false, 0 );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 6:
{
if ( from.Female )
{
from.PlaySound( 786 );
from.Say( "*bs cough*" );
}
else if ( !from.Female )
{
from.PlaySound( 1057 );
from.Say( "*bs cough*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 7:
{
if ( from.Female )
{
from.PlaySound( 782 );
from.Say( "*burp!*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1053 );
from.Say( "*burp!*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 8:
{
if ( from.Female )
{
from.PlaySound( 784 );
from.Say( "*clears throat*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1055 );
from.Say( "*clears throat*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 9:
{
if ( from.Female )
{
from.PlaySound( 785 );
from.Say( "*cough!*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1056 );
from.Say( "*cough!*" );
if ( !from.Mounted )
{
from.Animate( 33, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 10:
{
if ( from.Female )
{
from.PlaySound( 787 );
from.Say( "*cries*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1058 );
from.Say( "*cries*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 11:
{
if ( from.Female )
{
from.PlaySound( 791 );
from.Say( "*faints*" );
if ( !from.Mounted )
{
from.Animate( 22, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1063 );
from.Say( "*faints*" );
if ( !from.Mounted )
{
from.Animate( 22, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 12:
{
if ( from.Female )
{
from.PlaySound( 792 );
from.Say( "*farts*" );
}
else if ( !from.Female )
{
from.PlaySound( 1064 );
from.Say( "*farts*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P1) );
break;
}
case 13:
{
if ( from.Female )
{
from.PlaySound( 793 );
from.Say( "*gasp!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1065 );
from.Say( "*gasp!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 14:
{
if ( from.Female )
{
from.PlaySound( 794 );
from.Say( "*giggles*" );
}
else if ( !from.Female )
{
from.PlaySound( 1066 );
from.Say( "*giggles*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 15:
{
if ( from.Female )
{
from.PlaySound( 795 );
from.Say( "*groans*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1067 );
from.Say( "*groans*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 16:
{
if ( from.Female )
{
from.PlaySound( 796 );
from.Say( "*growls*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1068 );
from.Say( "*growls*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 17:
{
if ( from.Female )
{
from.PlaySound( 797 );
from.Say( "*hey!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1069 );
from.Say( "*hey!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 18:
{
if ( from.Female )
{
from.PlaySound( 798 );
from.Say( "*hiccup!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1070 );
from.Say( "*hiccup!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 19:
{
if ( from.Female )
{
from.PlaySound( 799 );
from.Say( "*huh?*" );
}
else if ( !from.Female )
{
from.PlaySound( 1071 );
from.Say( "*huh?*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 20:
{
if ( from.Female )
{
from.PlaySound( 800 );
from.Say( "*kisses*" );
}
else if ( !from.Female )
{
from.PlaySound( 1072 );
from.Say( "*kisses*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 21:
{
if ( from.Female )
{
from.PlaySound( 801 );
from.Say( "*laughs!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1073 );
from.Say( "*laughs!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 22:
{
if ( from.Female )
{
from.PlaySound( 802 );
from.Say( "*no!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1074 );
from.Say( "*no!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 23:
{
if ( from.Female )
{
from.PlaySound( 803 );
from.Say( "*oh!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1075 );
from.Say( "*oh!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 24:
{
if ( from.Female )
{
from.PlaySound( 811 );
from.Say( "*oooh!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1085 );
from.Say( "*oooh!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P2) );
break;
}
case 25:
{
if ( from.Female )
{
from.PlaySound( 812 );
from.Say( "*oops!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1086 );
from.Say( "*oops!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 26:
{
if ( from.Female )
{
from.PlaySound( 813 );
from.Say( "*pukes*" );
if ( !from.Mounted )
{
from.Animate( 32, 5, 1, true, false, 0 );
}
}
if ( !from.Female )
{
from.PlaySound( 1087 );
from.Say( "*pukes*" );
if ( !from.Mounted )
{
from.Animate( 32, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 27:
{
from.PlaySound( 315 );
from.Say( "*punches*" );
if ( !from.Mounted )
{
from.Animate( 31, 5, 1, true, false, 0 );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 28:
{
if ( from.Female )
{
from.PlaySound( 814 );
from.Say( "*aaahh!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1088 );
from.Say( "*aaahh!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 29:
{
if ( from.Female )
{
from.PlaySound( 815 );
from.Say( "*shh!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1089 );
from.Say( "*shh!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 30:
{
if ( from.Female )
{
from.PlaySound( 816 );
from.Say( "*sigh*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1090 );
from.Say( "*sigh*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 31:
{
from.PlaySound( 948 );
from.Say( "*slaps*" );
if ( !from.Mounted )
{
from.Animate( 11, 5, 1, true, false, 0 );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 32:
{
if ( from.Female )
{
from.PlaySound( 817 );
from.Say( "*ahh-choo!*" );
if ( !from.Mounted )
{
from.Animate( 32, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1091 );
from.Say( "*ahh-choo!*" );
if ( !from.Mounted )
{
from.Animate( 32, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 33:
{
if ( from.Female )
{
from.PlaySound( 818 );
from.Say( "*sniff*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1092 );
from.Say( "*sniff*" );
if ( !from.Mounted )
{
from.Animate( 34, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 34:
{
if ( from.Female )
{
from.PlaySound( 819 );
from.Say( "*snore*" );
}
else if ( !from.Female )
{
from.PlaySound( 1093 );
from.Say( "*snore*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 35:
{
if ( from.Female )
{
from.PlaySound( 820 );
from.Say( "*spits*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1094 );
from.Say( "*spits*" );
if ( !from.Mounted )
{
from.Animate( 6, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 36:
{
from.PlaySound( 792 );
from.Say( "*sticks out tongue*" );
from.SendGump( new EmoteGump( from, EmotePage.P3) );
break;
}
case 37:
{
from.PlaySound( 874 );
from.Say( "*taps foot*" );
if ( !from.Mounted )
{
from.Animate( 38, 5, 1, true, false, 0 );
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
case 38:
{
if ( from.Female )
{
from.PlaySound( 821 );
from.Say( "*whistles*" );
if ( !from.Mounted )
{
from.Animate( 5, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1095 );
from.Say( "*whistles*" );
if ( !from.Mounted )
{
from.Animate( 5, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
case 39:
{
if ( from.Female )
{
from.PlaySound( 783 );
from.Say( "*woohoo!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1054 );
from.Say( "*woohoo!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
case 40:
{
if ( from.Female )
{
from.PlaySound( 822 );
from.Say( "*yawn*" );
if ( !from.Mounted )
{
from.Animate( 17, 5, 1, true, false, 0 );
}
}
else if ( !from.Female )
{
from.PlaySound( 1096 );
from.Say( "*yawn*" );
if ( !from.Mounted )
{
from.Animate( 17, 5, 1, true, false, 0 );
}
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
case 41:
{
if ( from.Female )
{
from.PlaySound( 823 );
from.Say( "*yea!*" );
}
else if ( !from.Female )
{
from.PlaySound( 1097 );
from.Say( "*yea!*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
case 42:
{
if ( from.Female )
{
from.PlaySound( 824 );
from.Say( "*yells*" );
}
else if ( !from.Female )
{
from.PlaySound( 1098 );
from.Say( "*yells*" );
}
from.SendGump( new EmoteGump( from, EmotePage.P4) );
break;
}
}
break;
}
}
}
}
}
// By Tru
using System;
using Server.Network;
using Server.Mobiles;
namespace Server.Items
{
public class AkashasHeart : Food
{
[Constructable]
public AkashasHeart() : this( 1 )
{
}
[Constructable]
public AkashasHeart( int amount ) : base( 0x171f )
{
this.Name = "Akashas Heart";
this.Stackable = false;
this.Weight = 1.0;
this.FillFactor = 100;
this.Amount = amount;
this.ItemID = 7405;
}
public override void OnDoubleClick( Mobile from )
{
PlayerMobile pm = from as PlayerMobile;
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else if ( ((PlayerMobile)from).Vampirism == false )
{
from.SendMessage( "This is the heart of a Vampire." );
//from.SendLocalizedMessage( 1042594 ); // You do not understand how to use this.
}
else if ( pm.m_VampType == VampType.Master || pm.m_VampType == VampType.Ancient )
{
from.SendMessage( "Eating this heart would gain you nothing." );
}
else
{
pm.m_VampType = VampType.Master;
pm.SendMessage( "You feel more powerful." );
Delete();
}
}
public AkashasHeart( Serial serial ) : base( serial )
{
}
public override Item Dupe( int amount )
{
return base.Dupe( new AkashasHeart(), amount );
}
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();
}
}
}
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Engines.CannedEvil;
namespace Server.Mobiles
{
public abstract class SicknessChampion : BaseCreature
{
public SicknessChampion( AIType aiType ) : this( aiType, FightMode.Closest )
{
}
public SicknessChampion( AIType aiType, FightMode mode ) : base( aiType, mode, 18, 1, 0.1, 0.2 )
{
}
public SicknessChampion( 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();
}
public void GivePowerScrolls()
{
if ( Map != Map.Felucca )
return;
ArrayList toGive = new ArrayList();
ArrayList list = Aggressors;
for ( int i = 0; i < list.Count; ++i )
{
AggressorInfo info = (AggressorInfo)list[i];
if ( info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Attacker ) )
toGive.Add( info.Attacker );
}
list = Aggressed;
for ( int i = 0; i < list.Count; ++i )
{
AggressorInfo info = (AggressorInfo)list[i];
if ( info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Defender ) )
toGive.Add( info.Defender );
}
if ( toGive.Count == 0 )
return;
// Randomize
for ( int i = 0; i < toGive.Count; ++i )
{
int rand = Utility.Random( toGive.Count );
object hold = toGive[i];
toGive[i] = toGive[rand];
toGive[rand] = hold;
}
for ( int i = 0; i < 6; ++i )
{
int level;
double random = Utility.RandomDouble();
if ( 0.1 >= random )
level = 15;
else if ( 0.4 >= random )
level = 10;
else
level = 05;
Mobile m = (Mobile)toGive[i % toGive.Count];
PowerScroll ps = PowerScroll.CreateRandomNoCraft( level, level );
m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
m.AddToBackpack( ps );
if ( m is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m;
for ( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = (Mobile)pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal )
continue;
int chance = 0;
switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) )
{
case VirtueLevel.Seeker: chance = 10; break;
case VirtueLevel.Follower: chance = 15; break;
case VirtueLevel.Knight: chance = 20; break;
}
if ( chance > Utility.Random( 100 ) )
{
prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice!
prot.AddToBackpack( new PowerScroll( ps.Skill, ps.Value ) );
}
}
}
}
}
public override bool OnBeforeDeath()
{
if ( !NoKillAwards )
{
GivePowerScrolls();
Map map = this.Map;
if ( map != null )
{
for ( int x = -12; x <= 12; ++x )
{
for ( int y = -12; y <= 12; ++y )
{
double dist = Math.Sqrt(x*x+y*y);
if ( dist <= 12 )
new GoodiesTimer( map, X + x, Y + y ).Start();
}
}
}
}
return base.OnBeforeDeath();
}
private class GoodiesTimer : Timer
{
private Map m_Map;
private int m_X, m_Y;
public GoodiesTimer( Map map, int x, int y ) : base( TimeSpan.FromSeconds( Utility.RandomDouble() * 3.0 ) )
{
m_Map = map;
m_X = x;
m_Y = y;
}
protected override void OnTick()
{
int z = m_Map.GetAverageZ( m_X, m_Y );
bool canFit = m_Map.CanFit( m_X, m_Y, z, 6, false, false );
for ( int i = -3; !canFit && i <= 3; ++i )
{
canFit = m_Map.CanFit( m_X, m_Y, z + i, 6, false, false );
if ( canFit )
z += i;
}
if ( !canFit )
return;
Gold g = new Gold( 6, 100 );
g.MoveToWorld( new Point3D( m_X, m_Y, z ), m_Map );
if ( 0.5 >= Utility.RandomDouble() )
{
switch ( Utility.Random( 3 ) )
{
case 0: // Fire column
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 5052 );
Effects.PlaySound( g, g.Map, 0x208 );
break;
}
case 1: // Explosion
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x36BD, 20, 10, 5044 );
Effects.PlaySound( g, g.Map, 0x307 );
break;
}
case 2: // Ball of fire
{
Effects.SendLocationParticles( EffectItem.Create( g.Location, g.Map, EffectItem.DefaultDuration ), 0x36FE, 10, 10, 5052 );
break;
}
}
}
}
}
}
}
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Mobiles;
using Server.Targets;
namespace Server.Scripts.Commands
{
public class Feed
{
public static void Initialize()
{
Server.Commands.Register( "Feed", AccessLevel.Player, new CommandEventHandler( Feed_OnCommand ) );
}
public static void Feed_OnCommand( CommandEventArgs e )
{
PlayerMobile m = e.Mobile as PlayerMobile;
if ( m.Vampirism != true )
m.SendMessage( "You do not have this ability!" );
else if( m.VampHunger != true )
m.SendMessage( "You are too full to drink any more blood at this time." );
else if( m.Alive == false )
m.SendMessage( "You cannot use this ability while a ghost!" );
else
m.Target = new FeedTarget();
}
}
}
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Mobiles;
using Server.Targets;
namespace Server.Scripts.Commands
{
public class Turn
{
public static void Initialize()
{
Server.Commands.Register( "Turn", AccessLevel.Player, new CommandEventHandler( Turn_OnCommand ) );
}
public static void Turn_OnCommand( CommandEventArgs e )
{
PlayerMobile m = e.Mobile as PlayerMobile;
if ( m.Vampirism != true )
m.SendMessage( "You do not have this ability!" );
else if( m.VampireType == VampType.Vampire )
m.SendMessage( "You are not powerful enough to spread the bloodline." );
else if( m.Alive == false )
m.SendMessage( "You cannot use this ability while a ghost!" );
else
m.Target = new TurnTarget();
}
}
}