CODE |
Core: Optimizing for 2 processors Scripts: Compiling C# scripts...failed (2 errors, 0 warnings) Errors: + Items/Containers/BaseTreasureChest.cs: CS0122: Line 57: 'Server.Items.LockableContainer.m_Locked' is inaccessible d ue to its protection level CS0122: Line 59: 'Server.Items.LockableContainer.m_Locked' is inaccessible d ue to its protection level CS0122: Line 60: 'Server.Items.LockableContainer.m_Locked' is inaccessible d ue to its protection level CS0122: Line 62: 'Server.Items.LockableContainer.m_Locked' is inaccessible d ue to its protection level CS0122: Line 65: 'Server.Items.LockableContainer.m_Picker' is inaccessible d ue to its protection level + Spells/Third/Unlock.cs: CS1525: Line 76: Invalid expression term 'else' CS1002: Line 76:; expected Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. |
CODE |
using Server; using Server.Items; using Server.Network; using System; using System.Collections; namespace Server.Items { public class BaseTreasureChest : LockableContainer { private TreasureLevel m_TreasureLevel; private short m_MaxSpawnTime = 60; private short m_MinSpawnTime = 10; private TreasureResetTimer m_ResetTimer; [CommandProperty( AccessLevel.GameMaster )] public TreasureLevel Level { get { return m_TreasureLevel; } set { m_TreasureLevel = value; } } [CommandProperty( AccessLevel.GameMaster )] public short MaxSpawnTime { get { return m_MaxSpawnTime; } set { m_MaxSpawnTime = value; } } [CommandProperty( AccessLevel.GameMaster )] public short MinSpawnTime { get { return m_MinSpawnTime; } set { m_MinSpawnTime = value; } } public override bool IsDecoContainer { get{ return false; } } public BaseTreasureChest( int itemID ) : this( itemID, TreasureLevel.Level2 ) { } public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID ) { m_TreasureLevel = level; Locked = true; Movable = false; SetLockLevel(); GenerateTreasure(); } public BaseTreasureChest( Serial serial ) : base( serial ) { } public override string DefaultName { get { if ( this.Locked ) return "a locked treasure chest"; return "a treasure chest"; } } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); writer.Write( (byte) m_TreasureLevel ); writer.Write( m_MinSpawnTime ); writer.Write( m_MaxSpawnTime ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_TreasureLevel = (TreasureLevel)reader.ReadByte(); m_MinSpawnTime = reader.ReadShort(); m_MaxSpawnTime = reader.ReadShort(); if( !Locked ) StartResetTimer(); } protected virtual void SetLockLevel() { switch( m_TreasureLevel ) { case TreasureLevel.Level1: this.RequiredSkill = this.LockLevel = 5; break; case TreasureLevel.Level2: this.RequiredSkill = this.LockLevel = 20; break; case TreasureLevel.Level3: this.RequiredSkill = this.LockLevel = 50; break; case TreasureLevel.Level4: this.RequiredSkill = this.LockLevel = 70; break; case TreasureLevel.Level5: this.RequiredSkill = this.LockLevel = 90; break; case TreasureLevel.Level6: this.RequiredSkill = this.LockLevel = 100; break; } } private void StartResetTimer() { if( m_ResetTimer == null ) m_ResetTimer = new TreasureResetTimer( this ); else m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime )); m_ResetTimer.Start(); } protected virtual void GenerateTreasure() { int MinGold = 1; int MaxGold = 2; switch( m_TreasureLevel ) { case TreasureLevel.Level1: MinGold = 100; MaxGold = 300; break; case TreasureLevel.Level2: MinGold = 300; MaxGold = 600; break; case TreasureLevel.Level3: MinGold = 600; MaxGold = 900; break; case TreasureLevel.Level4: MinGold = 900; MaxGold = 1200; break; case TreasureLevel.Level5: MinGold = 1200; MaxGold = 5000; break; case TreasureLevel.Level6: MinGold = 5000; MaxGold = 9000; break; } DropItem( new Gold( MinGold, MaxGold ) ); } public override void LockPick( Mobile from ) { base.LockPick( from ); StartResetTimer(); } public void ClearContents() { for ( int i = Items.Count - 1; i >= 0; --i ) { if ( i < Items.Count ) Items[i].Delete(); } } public void Reset() { if( m_ResetTimer != null ) { if( m_ResetTimer.Running ) m_ResetTimer.Stop(); } Locked = true; ClearContents(); GenerateTreasure(); } public enum TreasureLevel { Level1, Level2, Level3, Level4, Level5, Level6, }; private class TreasureResetTimer : Timer { private BaseTreasureChest m_Chest; public TreasureResetTimer( BaseTreasureChest chest ) : base ( TimeSpan.FromMinutes( Utility.Random( chest.MinSpawnTime, chest.MaxSpawnTime ) ) ) { m_Chest = chest; Priority = TimerPriority.OneMinute; } protected override void OnTick() { m_Chest.Reset(); } } } } |
CODE |
using System; using Server.Targeting; using Server.Network; using Server.Items; namespace Server.Spells.Third { public class UnlockSpell : Spell { private static SpellInfo m_Info = new SpellInfo( "Unlock Spell", "Ex Por", SpellCircle.Third, 215, 9001, Reagent.Bloodmoss, Reagent.SulfurousAsh ); public UnlockSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info ) { } public override void OnCast() { Caster.Target = new InternalTarget( this ); } public void Target( LockableContainer targ ) { if ( Multis.BaseHouse.CheckSecured( targ ) ) { // You cannot cast this on a secure item. Caster.SendLocalizedMessage( 503098 ); } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, targ ); Point3D loc = targ.GetWorldLocation(); Effects.SendLocationParticles( EffectItem.Create( loc, targ.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5024 ); Effects.PlaySound( loc, targ.Map, 0x1FF ); if ( targ.Locked && targ.LockLevel != 0 ) { double magery = Caster.Skills[SkillName.Magery].Value; int level = (int)(magery * 0.8) - 4; if ( level >= targ.RequiredSkill && !(targ is TreasureMapChest && ((TreasureMapChest)targ).Level > 2) ) { targ.Locked = false; if ( targ.LockLevel == -255 ) targ.LockLevel = targ.RequiredSkill - 10; if ( targ.LockLevel == 0 ) targ.LockLevel = -1; } else { // My spell does not seem to have an effect on that lock. Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503099 ); } } else { // That did not need to be unlocked. Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 503101 ); } } FinishSequence(); } private class InternalTarget : Target { private UnlockSpell m_Owner; public InternalTarget( UnlockSpell owner ) : base( 12, false, TargetFlags.None ) { m_Owner = owner; } protected override void OnTarget( Mobile from, object o ) { if ( o is LockableContainer ) m_Owner.Target( (LockableContainer)o ); else from.SendLocalizedMessage( 501666 ); // You can't unlock that! // TODO: Really we can cast on anything, even mobiles, but it will effect and say 'That did not need to be unlocked' } protected override void OnTargetFinish( Mobile from ) { m_Owner.FinishSequence(); } } } } |
CODE |
[CommandProperty( AccessLevel.GameMaster )] public override bool Locked { get { return m_Locked; } set { if ( m_Locked != value ) { m_Locked = value; if ( !m_Locked ) StartResetTimer(); else m_Picker = null; InvalidateProperties(); } } } |
CODE |
Server Crash Report =================== RunUO Version 2.0, Build 2564.7233 Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2 .NET Framework: 2.0.50727.42 Time: 1/13/2007 10:41:28 AM Mobiles: 5095 Items: 293710 Exception: System.InvalidCastException: Specified cast is not valid. at Server.Spells.Third.UnlockSpell.InternalTarget.OnTarget(Mobile from, Object o) in c:\Program Files\RunUO 2.0 SVN 138\Scripts\Spells\Third\Unlock.cs:line 47 at Server.Targeting.Target.Invoke(Mobile from, Object targeted) at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc) at Server.Network.MessagePump.HandleReceive(NetState ns) at Server.Network.MessagePump.Slice() at Server.Core.Main(String[] args) |
CODE |
protected override void OnTarget( Mobile from, object o ) { IPoint3D loc = o as IPoint3D; if ( loc == null ) return; if ( m_Owner.CheckSequence() ) { SpellHelper.Turn( from, o ); Effects.SendLocationParticles( EffectItem.Create( (Point3D)loc, from.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5024 ); |