|
||
|
|||||||
| Server Support on Windows Get (and give) support on general questions related to the RunUO server itself. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Ever since i implemented factions into my scripts, i've been getting this error with RunUO:
World: Loading....An Error was encountered while loading a saved object -type: server: mobiles: playermobile - serial: 0x00000003 delete? y/n then i put yes because if i put no it completely shuts down RunUO and i cant open it. So then it restarts runuo but all the player accounts are wiped. ANY idea what i could do to fix this? also i didnt know whether to put this in scripts or runuo server support so sorry if i put it in the wrong one |
|
|
|
|
|
|
#2 (permalink) |
|
Oh and heres the crash report and i will also post the player mobiles script
Server Crash Report =================== Time: 6/1/2003 2:41:17 AM Mobiles: 171 Items: 4889 Clients: - Count: 4 + 24.238.54.38: (account = nacho) (mobile = 0x1 'Admin Nacho Supreme') + 67.38.30.76: (account = pimpc420) (mobile = 0x4 'graffix-') + 63.159.218.43: (account = whatup ) (mobile = 0x3 'Gangsta') + 67.34.176.240: (account = big4boss) (mobile = 0x6 'SiC') Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Server.Factions.Monolith.PutSigil(Sigil m_Sig) at Server.Factions.SigilTarget.OnTarget(Mobile from, Object target) at Server.Targeting.Target.Invoke(Mobile from, Object targeted) at Server.Network.PacketHandlers.TargetResponse(NetSt ate state, PacketReader pvSrc) at Server.Network.MessagePump.HandleReceive(NetState ns) at Server.Network.MessagePump.Slice() at Server.Core.Main(String[] args) playermobiles script: [code:1] Server Crash Report =================== Time: 6/1/2003 2:41:17 AM Mobiles: 171 Items: 4889 Clients: - Count: 4 + 24.238.54.38: (account = nacho) (mobile = 0x1 'Admin Nacho Supreme') + 67.38.30.76: (account = pimpc420) (mobile = 0x4 'graffix-') + 63.159.218.43: (account = whatup ) (mobile = 0x3 'Gangsta') + 67.34.176.240: (account = big4boss) (mobile = 0x6 'SiC') Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Server.Factions.Monolith.PutSigil(Sigil m_Sig) at Server.Factions.SigilTarget.OnTarget(Mobile from, Object target) at Server.Targeting.Target.Invoke(Mobile from, Object targeted) at Server.Network.PacketHandlers.TargetResponse(NetSt ate state, PacketReader pvSrc) at Server.Network.MessagePump.HandleReceive(NetState ns) at Server.Network.MessagePump.Slice() at Server.Core.Main(String[] args) [/code:1] |
|
|
|
|
|
|
#3 (permalink) |
|
oops HERES the player mobiles script:
[code:1] using System; using System.Collections; using Server; using Server.Misc; using Server.Items; using Server.Multis; using Server.Network; using Server.Factions; using Server.Gumps; using Server.Accounting; 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 } public class PlayerMobile : Mobile { 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_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 Hashtable m_AntiMacroTable; private ArrayList m_VisList; private TimeSpan m_GameTime; private TimeSpan m_ShortTermElapse; private TimeSpan m_LongTermElapse; private DateTime m_SessionStart; private PlayerFlag m_Flags; private MainControlStone MC; private DateTime m_LastEscortTime; public ArrayList m_PetList = new ArrayList(); public ArrayList m_PetNames = new ArrayList(); public ArrayList m_Macro = new ArrayList(); // Start of factions private ArrayList killers = new ArrayList(); private bool m_FactionKill; public int m_MaxSlots; private int minPoints = -6; public bool m_Leaving; public DateTime BC = DateTime.Now; private bool m_PurpleTized ; private DateTime m_NextStatRaise = DateTime.Now; private Faction m_Faction; private int m_Points; private int m_Rank; private int m_Votes; private Sigil m_Sigil; private bool m_Candidate; private bool m_Voted; private bool m_ColorWars; private int m_ResKill; private DateTime m_StartDate; private DateTime m_Join; private DateTime m_Left; private DateTime m_GivePoints; private ArrayList m_PurpleTizedItems; public DateTime LastEscortTime { get{ return m_LastEscortTime; } set{ m_LastEscortTime = value; } } 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; } } } private DesignContext m_DesignContext; public DesignContext DesignContext { get{ return m_DesignContext; } set{ m_DesignContext = value; } } public static void Initialize() { EventSink.Login += new LoginEventHandler( OnLogin ); EventSink.Logout += new LogoutEventHandler( OnLogout ); EventSink.Disconnected += new DisconnectedEventHandler(EventSink_Disconnected); } [CommandProperty( AccessLevel.GameMaster )] public bool KarmaLocked { get{ return GetFlag( PlayerFlag.KarmaLocked ); } set{ SetFlag( PlayerFlag.KarmaLocked, value ); } } private static void OnLogin( LoginEventArgs e ) { Mobile from = e.Mobile; PlayerMobile pm = from as PlayerMobile; if ( pm != null ) pm.m_SessionStart = DateTime.Now; SacrificeVirtue.CheckAtrophy( from ); JusticeVirtue.CheckAtrophy( from ); } private static void OnLogout( LogoutEventArgs e ) { if ( e.Mobile is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)e.Mobile; pm.m_GameTime += DateTime.Now - pm.m_SessionStart; } } 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.Map = context.Foundation.Map; from.Location = context.Foundation.BanLocation; } } public override bool OnBeforeDeath() { if (m_Sigil != null) { m_Sigil.WithSigil = null; m_Sigil.MoveToWorld(Location, Map); m_Sigil.OnGround = true; m_Sigil = null; UnPurpleTize(); } UnPurpleTize(); return base.OnBeforeDeath(); } 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; 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; if (target is PlayerMobile && m_Faction == Faction.None && ((PlayerMobile)target).Faction != Faction.None) { if (target.Combatant != null) { SendMessage("You can not help him right now"); return false; } } return base.CanBeBeneficial( target, message, allowDead ); } 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; } } } } return base.Move( d ); } 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 static bool m_NoRecursion; protected override void OnLocationChange( Point3D oldLocation ) { 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 > 0 ) { BandageContext c = BandageContext.GetContext( this ); if ( c != null ) c.Slip(); } base.OnDamage( amount, from, willKill ); } public ArrayList PetList { get { return m_PetList; } set { m_PetList = value; } } public ArrayList PetNames { get { return m_PetNames; } set { m_PetNames = value; } } public ArrayList VisibilityList { get { return m_VisList; } } public PlayerMobile() { m_FactionKill = true; m_VisList = new ArrayList(); m_AntiMacroTable = new Hashtable(); m_StartDate = DateTime.Now; m_GameTime = TimeSpan.Zero; m_ShortTermElapse = TimeSpan.FromHours( 8.0 ); m_LongTermElapse = TimeSpan.FromHours( 40.0 ); m_JusticeProtectors = new ArrayList(); } public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison ) { if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) ) return base.ApplyPoison( from, PoisonImpl.IncreaseLevel( poison ) ); return base.ApplyPoison( from, poison ); } 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 bool CanBeBeneficial( Mobile target ) { if (target is PlayerMobile && m_Faction == Faction.None && ((PlayerMobile)target).Faction != Faction.None) { if (target.Combatant != null) { SendMessage("You can not help him right now"); return false; } } return base.CanBeBeneficial( target ); } public PlayerMobile( Serial serial ) : base( serial ) { m_VisList = new ArrayList(); m_AntiMacroTable = new Hashtable(); } 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; } } public int GetMaxSlots() { double skilltotal = 0; int slots = 2; if ( Skills[SkillName.AnimalTaming].Base == 120 ) { skilltotal += 100; slots += 3; } else if ( Skills[SkillName.AnimalTaming].Base >= 110 ) { skilltotal += 100; slots += 2; } else if ( Skills[SkillName.AnimalTaming].Base >= 100 ) { skilltotal += 100; slots += 1; } else { skilltotal += Skills[SkillName.AnimalTaming].Base; } if ( Skills[SkillName.AnimalLore].Base == 120 ) { skilltotal += 100; slots += 3; } else if ( Skills[SkillName.AnimalLore].Base >= 110 ) { skilltotal += 100; slots += 2; } else if ( Skills[SkillName.AnimalLore].Base >= 100 ) { skilltotal += 100; slots += 1; } else { skilltotal += Skills[SkillName.AnimalLore].Base; } if ( Skills[SkillName.Veterinary].Base == 120 ) { skilltotal += 100; slots += 3; } else if ( Skills[SkillName.Veterinary].Base >= 110 ) { skilltotal += 100; slots += 2; } else if ( Skills[SkillName.Veterinary].Base >= 100 ) { skilltotal += 100; slots += 1; } else { skilltotal += Skills[SkillName.Veterinary].Base; } skilltotal -= 150; slots += (int)(skilltotal / 50 ); m_MaxSlots = slots; return slots; } public override void Serialize( GenericWriter writer ) { if (m_Faction != Faction.None && MC == null) FindMainControl(); // Resync Factions if (m_Faction != Faction.None && MC != null) { if (m_Faction == Faction.Britannians && MC.Brit != null) MC.Brit.AddMember(this); if (m_Faction == Faction.Minax && MC.Minx != null) MC.Minx.AddMember(this); if (m_Faction == Faction.ShadowLords && MC.Shad != null) MC.Shad.AddMember(this); if (m_Faction == Faction.Mages && MC.Mage != null) MC.Mage.AddMember(this); } if (m_Faction == Faction.None && MC != null) { MC.RemoveAll(this); } //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 = this.GameTime + TimeSpan.FromHours( 8 ); if ( ShortTermMurders > 0 ) --ShortTermMurders; } if ( m_LongTermElapse < this.GameTime ) { m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 ); if ( Kills > 0 ) --Kills; } if (NetState == null) { if (this.m_Sigil != null) { if (this.m_Sigil.Monolith != null) { Monolith mono = m_Sigil.Monolith; this.m_Sigil.WithSigil = null; mono.PutSigil(m_Sigil); UnPurpleTize(); m_Sigil = null; } } } if (m_PurpleTizedItems == null) m_PurpleTizedItems = new ArrayList(); base.Serialize( writer ); writer.Write( (int) 5 ); writer.Write( m_LastJusticeLoss - DateTime.Now ); writer.WriteMobileList( m_JusticeProtectors, true ); writer.Write( m_LastSacrificeGain - DateTime.Now ); writer.Write( m_LastSacrificeLoss - DateTime.Now ); writer.Write( m_AvailableResurrects ); writer.Write( (bool) m_PurpleTized); writer.Write ( (int) m_PurpleTizedItems.Count); foreach (PurpleTizedItem item in m_PurpleTizedItems) { writer.Write( (Item) item.item); writer.Write( (int) item.Hue); } writer.Write( (int) m_Flags ); writer.Write( m_LongTermElapse ); writer.Write( m_ShortTermElapse ); writer.Write( this.GameTime ); writer.Write( m_MaxSlots ); writer.Write( m_PetList.Count ); for ( int i = 0; i < m_PetList.Count; ++i ) { writer.Write( (Mobile)m_PetList[i] ); writer.Write( (string)m_PetNames[i] ); } writer.Write( m_NextStatRaise ); writer.Write( BC ); writer.Write( m_Leaving ); writer.Write( (int) m_Faction ); writer.Write( m_Points ); writer.Write( m_Rank ); writer.Write( m_Votes ); if (m_Sigil != null) writer.Write( (int) m_Sigil.Serial); else writer.Write( (int) 0); writer.Write( (bool) m_Candidate); writer.Write( (bool) m_Voted); writer.Write( (int) m_ResKill); writer.Write( m_StartDate ); writer.Write( m_Join ); writer.Write( m_Left ); writer.Write( m_GivePoints ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); if (m_Faction != Faction.None) FindMainControl(); m_FactionKill = true; if ( version < 2 ) { m_PetList = new ArrayList(); m_PetNames = new ArrayList(); } switch( version ) { case 6: { m_LastJusticeLoss = DateTime.Now + reader.ReadTimeSpan(); m_JusticeProtectors = reader.ReadMobileList(); goto case 5; } case 5: { m_LastSacrificeGain = DateTime.Now + reader.ReadTimeSpan(); m_LastSacrificeLoss = DateTime.Now + reader.ReadTimeSpan(); m_AvailableResurrects = reader.ReadInt(); goto case 4; } case 4: m_PurpleTized = reader.ReadBool(); int num = reader.ReadInt(); m_PurpleTizedItems = new ArrayList( num ); for ( int i = 0; i < num; ++i ) { Item item = reader.ReadItem(); int hue = reader.ReadInt(); PurpleTizedItem g = new PurpleTizedItem(item, hue); m_PurpleTizedItems.Add(g); } goto case 3; case 3: m_Flags = (PlayerFlag)reader.ReadInt(); goto case 2; case 2: m_LongTermElapse = reader.ReadTimeSpan(); m_ShortTermElapse = reader.ReadTimeSpan(); m_GameTime = reader.ReadTimeSpan(); goto case 1; case 1: { m_MaxSlots = reader.ReadInt(); int size = reader.ReadInt(); m_PetList = new ArrayList( size ); m_PetNames = new ArrayList( size ); for ( int i = 0; i < size; ++i ) { m_PetList.Add( reader.ReadMobile() ); m_PetNames.Add( reader.ReadString() ); } m_NextStatRaise = reader.ReadDateTime(); BC = reader.ReadDateTime(); m_Leaving = reader.ReadBool(); m_Faction = (Faction) reader.ReadInt(); m_Points = reader.ReadInt(); m_Rank = reader.ReadInt(); m_Votes = reader.ReadInt(); int serial = reader.ReadInt(); if (Serial != 0) m_Sigil = (Sigil)World.FindItem(serial); m_Candidate = reader.ReadBool(); m_Voted = reader.ReadBool(); m_ResKill = reader.ReadInt(); m_StartDate = reader.ReadDateTime(); m_Join = reader.ReadDateTime(); m_Left = reader.ReadDateTime(); m_GivePoints = reader.ReadDateTime(); goto case 0; } case 0: { if ( m_JusticeProtectors == null ) m_JusticeProtectors = new ArrayList(); break; } } } public void FindMainControl() { if (MC != null) return; foreach ( Item item in World.Items.Values ) { if ( item is MainControlStone) { MC = (MainControlStone) item; if (m_Faction == Faction.Britannians && MC.Brit != null) MC.Brit.AddMember(this); if (m_Faction == Faction.Minax && MC.Minx != null) MC.Minx.AddMember(this); if (m_Faction == Faction.ShadowLords && MC.Shad != null) MC.Shad.AddMember(this); if (m_Faction == Faction.Mages && MC.Mage != null) MC.Mage.AddMember(this); return; } } } public void ClaimPet( int PetInList ) { BaseCreature m_Pet = (BaseCreature)m_PetList[PetInList]; if ( m_Pet.ControlSlots + Followers > FollowersMax ) { this.SendLocalizedMessage( 1049612, m_Pet.Name ); m_Pet.Delete(); return; } m_Pet.Map = this.Map; m_Pet.Location = this.Location; Followers += m_Pet.ControlSlots; m_PetList.RemoveAt( PetInList ); m_PetNames.RemoveAt( PetInList ); this.SendLocalizedMessage( 1008070 ); } public void StablePet( BaseCreature Pet ) { if ( Pet.Controled == false ) { this.SendLocalizedMessage( 1048053 ); return; } if ( Pet.ControlMaster != this ) { this.SendLocalizedMessage( 1042562 ); return; } if ( Pet.Combatant != null ) { this.SendLocalizedMessage( 1042564 ); return; } if ( Pet.Summoned ) { this.SendLocalizedMessage( 502673 ); return; } m_PetList.Add( (Mobile)Pet ); m_PetNames.Add( Pet.Name ); Followers -= Pet.ControlSlots; Pet.Location = new Point3D( 5434, 1089, -2); Pet.Map = Map.Trammel; this.SendLocalizedMessage( 1049677 ); } public override bool CanSee( Mobile m ) { if ( m is PlayerMobile && ((PlayerMobile)m).m_VisList.Contains( this ) ) return true; else return base.CanSee( m ); } 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; } } [CommandProperty( AccessLevel.GameMaster )] public DateTime GivePoints { get{ return m_GivePoints; } set{ m_GivePoints = value; } } [CommandProperty( AccessLevel.GameMaster )] public bool Voted { get {return m_Voted;} set {m_Voted = value; } } [CommandProperty( AccessLevel.GameMaster )] public bool Candidate { get {return m_Candidate;} set {m_Candidate = value; } } public bool CanRaise ( Mobile m ) { int num = 0; foreach (Point3D m_loc in m_Macro) { if (m.Location == m_loc) { num++; } } if (num < 130) return true; return false; } public void AddKiller( PlayerMobile killer) { if (!(killers.Contains(killer))) killers.Add(killer); } public void RemoveKiller( PlayerMobile killer) { if (killers.Contains(killer)) killers.Remove(killer); } public bool KillerIsTimed( PlayerMobile killer) { if(killers.Count != 0) { if ( killers.Contains (killer) ) { return true; } } return false; } [CommandProperty( AccessLevel.GameMaster )] public Sigil Sigil { get { return m_Sigil; } set { m_Sigil = value; } } [CommandProperty(AccessLevel.GameMaster)] public int Votes { get{return m_Votes;} set{m_Votes = value;} } [CommandProperty(AccessLevel.Counselor)] public int Rank { get{return m_Rank;} set{m_Rank = value;InvalidateProperties();} } [CommandProperty(AccessLevel.Counselor)] public int Points { get{return m_Points;} set{m_Points = value;} } [CommandProperty(AccessLevel.Counselor)] public Faction Faction { get{return m_Faction;} set { if (MainControl != null && MainControl.Brit != null && m_Faction == Faction.Britannians) { MainControl.Brit.RemoveMember(this); } if (MainControl != null && MainControl.Shad != null && m_Faction == Faction.ShadowLords) { MainControl.Shad.RemoveMember(this); } if (MainControl != null && MainControl.Minx != null && m_Faction == Faction.Minax) { MainControl.Minx.RemoveMember(this); } if (MainControl != null && MainControl.Mage != null && m_Faction == Faction.Mages) { MainControl.Mage.RemoveMember(this); } m_Faction = value; if (MainControl != null && MainControl.Brit != null && m_Faction == Faction.Britannians) { MainControl.Brit.AddMember(this); } if (MainControl != null && MainControl.Shad != null && m_Faction == Faction.ShadowLords) { MainControl.Shad.AddMember(this); } if (MainControl != null && MainControl.Minx != null && m_Faction == Faction.Minax) { MainControl.Minx.AddMember(this); } if (MainControl != null && MainControl.Mage != null && m_Faction == Faction.Mages) { MainControl.Mage.AddMember(this); } } } [CommandProperty(AccessLevel.Counselor)] public bool FactionKill { get{return m_FactionKill;} set{m_FactionKill = value;} } [CommandProperty( AccessLevel.GameMaster )] public bool ResetSigil { get {return false;} set { m_Sigil = null; } } [CommandProperty( AccessLevel.GameMaster )] public bool Leaving { get { return m_Leaving; } set { m_Leaving = value; } } [CommandProperty( AccessLevel.GameMaster )] public int ResKill { get { return m_ResKill; } set { m_ResKill = value; } } [CommandProperty( AccessLevel.GameMaster )] public MainControlStone MainControl { get { return MC; } set { MC = value; } } public DateTime Left { get { return m_Left; } set { m_Left = value; } } public DateTime StartDate { get { return m_StartDate; } set { m_StartDate = value; } } public int GetPoints(){ return m_Points; } public void SubPoints(int chunk) { if((m_Points - chunk) > minPoints) { m_Points -= chunk; } else { m_Points = minPoints; } } public void AddPoints(int chunk) { m_Points += chunk; } public bool HasEnoughPoints(int chunk) { if((m_Points - chunk) < 0) { return false; } else { return true; } } public PlayerFlag Flags { get{ return m_Flags; } set{ m_Flags = value; } } public bool HasMoreThanMin(int chunk) { if((m_Points - chunk) < minPoints) { return false; } else { return true; } } [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 ); } } 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 bool CanFactionKill() { if (m_FactionKill) return true; else return false; } private class PurpleTizedItem { private Item m_Item; private int m_Hue; public PurpleTizedItem(Item item, int Hue) { m_Item = item; m_Hue = Hue; } public PurpleTizedItem(Item item) { m_Item = item; m_Hue = item.Hue; } public Item item { get { return m_Item; } set { m_Item = value; } } public int Hue { get { return m_Hue; } set { m_Hue = value; } } } public void PurpleTize() { if (m_PurpleTizedItems == null) m_PurpleTizedItems = new ArrayList(); else m_PurpleTizedItems.Clear(); foreach (Item item in Items) { if (!(item is EtherealMount)) { PurpleTizedItem pur = new PurpleTizedItem(item); m_PurpleTizedItems.Add(pur); item.Hue = 11; item.Movable = false; } } m_PurpleTized = true; } public void UnPurpleTize() { if (m_PurpleTizedItems != null) { foreach (PurpleTizedItem item in m_PurpleTizedItems) { if (item !=null && item.item != null ) { item.item.Hue = item.Hue; item.item.Movable = true; } } } m_PurpleTized = true; } public override void GetProperties( ObjectPropertyList list ) { base.GetProperties(list); if (m_Faction == Faction.Britannians && m_Rank >= 0 && m_Rank <= 3) { list.Add(1060790); list.Add(1060771); } if (m_Faction == Faction.Britannians && m_Rank > 3 && m_Rank <= 5) { list.Add(1060791); list.Add(1060771); } if (m_Faction == Faction.Britannians && m_Rank >5 && m_Rank <= 7) { list.Add(1060792); list.Add(1060771); } if (m_Faction == Faction.Britannians && m_Rank >7 && m_Rank <= 9) { list.Add(1060793); list.Add(1060771); } if (m_Faction == Faction.Britannians && m_Rank >9) { list.Add(1060794); list.Add(1060771); } if (m_Faction == Faction.ShadowLords && m_Rank > 0 && m_Rank <= 3) { list.Add(1060795); list.Add(1060772); } if (m_Faction == Faction.ShadowLords && m_Rank > 3 && m_Rank <= 5) { list.Add(1060796); list.Add(1060772); } if (m_Faction == Faction.ShadowLords && m_Rank > 5 && m_Rank <= 7) { list.Add(1060797); list.Add(1060772); } if (m_Faction == Faction.ShadowLords && m_Rank > 7 && m_Rank <= 9) { list.Add(1060798); list.Add(1060772); } if (m_Faction == Faction.ShadowLords && m_Rank > 9 ) { list.Add(1060799); list.Add(1060772); } if (m_Faction == Faction.Mages && m_Rank > 0 && m_Rank <= 3) { list.Add(1060785); list.Add(1060770); } if (m_Faction == Faction.Mages && m_Rank > 3 && m_Rank <= 5) { list.Add(1060786); list.Add(1060770); } if (m_Faction == Faction.Mages && m_Rank > 5&& m_Rank <= 7) { list.Add(1060787); list.Add(1060770); } if (m_Faction == Faction.Mages && m_Rank > 7 && m_Rank <= 9) { list.Add(1060788); list.Add(1060770); } if (m_Faction == Faction.Mages && m_Rank > 9 ) { list.Add(1060789); list.Add(1060770); } if (m_Faction == Faction.Minax && m_Rank > 0 && m_Rank <= 3) { list.Add(1060779); list.Add(1060769); } if (m_Faction == Faction.Minax && m_Rank > 3 && m_Rank <= 5) { list.Add(1060780); list.Add(1060769); } if (m_Faction == Faction.Minax && m_Rank > 5 && m_Rank <= 7) { list.Add(1060781); list.Add(1060769); } if (m_Faction == Faction.Minax && m_Rank > 7 && m_Rank <= 9) { list.Add(1060782); list.Add(1060769); } if (m_Faction == Faction.Minax && m_Rank > 9) { list.Add(1060783); list.Add(1060769); } } public override void OnSingleClick(Mobile from) { string FactionText = ""; if (Faction != Faction.None) { if (m_Faction == Faction.Britannians && m_Rank >= 0 && m_Rank <= 3) { FactionText = "[Defender]"; } if (m_Faction == Faction.Britannians && m_Rank > 3 && m_Rank <= 5) { FactionText = "[Sentinel]"; } if (m_Faction == Faction.Britannians && m_Rank >5 && m_Rank <= 7) { FactionText = "[Crusader]"; } if (m_Faction == Faction.Britannians && m_Rank >7 && m_Rank <= 9) { FactionText = "[Knight of Virtue]"; } if (m_Faction == Faction.Britannians && m_Rank >9) { FactionText = "[Knight of the Codex]"; } if (m_Faction == Faction.ShadowLords && m_Rank > 0 && m_Rank <= 3) { FactionText = "[Servant]"; } if (m_Faction == Faction.ShadowLords && m_Rank > 3 && m_Rank <= 5) { FactionText = "[Keeper of Lies]"; } if (m_Faction == Faction.ShadowLords && m_Rank > 5 && m_Rank <= 7) { FactionText = "[Bringer of Sorrow]"; } if (m_Faction == Faction.ShadowLords && m_Rank > 7 && m_Rank <= 9) { FactionText = "[Agent of Evil]"; } if (m_Faction == Faction.ShadowLords && m_Rank > 9 ) { FactionText = "[Purveyor of Darkness]"; } if (m_Faction == Faction.Mages && m_Rank > 0 && m_Rank <= 3) { FactionText = "[Mystic]"; } if (m_Faction == Faction.Mages && m_Rank > 3 && m_Rank <= 5) { FactionText = "[Diviner]"; } if (m_Faction == Faction.Mages && m_Rank > 5&& m_Rank <= 7) { FactionText = "[Luminary]"; } if (m_Faction == Faction.Mages && m_Rank > 7 && m_Rank <= 9) { FactionText = "[Archon of Principle]"; } if (m_Faction == Faction.Mages && m_Rank > 9 ) { FactionText = "[Inquisitor of the Council]"; } if (m_Faction == Faction.Minax && m_Rank > 0 && m_Rank <= 3) { FactionText = "[Defiler]"; } if (m_Faction == Faction.Minax && m_Rank > 3 && m_Rank <= 5) { FactionText = "[Executioner]"; } if (m_Faction == Faction.Minax && m_Rank > 5 && m_Rank <= 7) { FactionText = "[Warlord]"; } if (m_Faction == Faction.Minax && m_Rank > 7 && m_Rank <= 9) { FactionText = "[Dread Knight]"; } if (m_Faction == Faction.Minax && m_Rank > 9) { FactionText = "[Avenger of Mondain]"; } if ( Notoriety.Compute(from, this) == Notoriety.Innocent || Notoriety.Compute(from, this) == Notoriety.Ally) PrivateOverheadMessage(Server.Network.MessageType. Label, 303, true, FactionText, from.NetState); else PrivateOverheadMessage(Server.Network.MessageType. Label, 333, true, FactionText, from.NetState); base.OnSingleClick(from); } } public override void OnSpeech( SpeechEventArgs e ) { base.OnSpeech( e ); if (e.Mobile == this && e.Speech.ToLower() == "showscore" ) { string message = "" + GetPoints(); PublicOverheadMessage( MessageType.Regular, 0x5A7, false, message); } if (e.Mobile == this && e.Speech.ToLower() == "what is my faction term status" ) { string message = ""; if (m_Faction != Faction.None && Leaving == false) message = "You are not leaving your faction currently"; else { message = "You can leave your faction "; if ( Left.AddDays(5) > DateTime.Now) { TimeSpan t = Left.AddDays(5) - DateTime.Now; message = message +"in " + t.Days.ToString()+ " days and " + t.Hours.ToString() + ":" + t.Minutes.ToString()+ " hours"; } else { message = message + "Now!"; } } PublicOverheadMessage( MessageType.Regular, 0x5A7, false, message); } } } } [/code:1] ops: |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|