Full Version : Duel System
xmlspawner >>Scripting Support >>Duel System
<< Prev | Next >>
Asmir02- 02-20-2006
Im wroking on duel system i plan to release this system as soon as i finish and see if there is any bugs. Before i release to everyone i got to fix the errors i went from 50 errors to 20 errors so now i need your guys help with these errors
Errors

CODE
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518: (line 439, column 19) Expected class, delegate, enum, interface, or struct - Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518: (line 450, column 16) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 458, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 505, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 772, column 16) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 780, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 788, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 794, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 876, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 907, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 912, column 16) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 997, column 10) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1001, column 19) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1031, column 19) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1097, column 20) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1128, column 17) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1001:
(line 1130, column 9) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1130, column 11) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1518:
(line 1134, column 29) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\ChallengeStone2.cs: CS1022:
(line 1136, column 4) 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.

Here is the script

CODE
using System; using Server; using System.Collections; using Server.Scripts.Commands; using Server.Targeting;
using Server.Mobiles;
using Server.Gumps;
using Server.Items;
using Server.Challenge;
using Server.Spells;
using Server.Spells.Second;
using Server.Spells.Third;
using Server.Spells.Necromancy;
namespace Server.Duel
{
public enum DuelType
{
Any,
Mage,
Dexxer,
Tank
}
public enum DuelSet
{
Allow,
Sevenx,
Fivex
}
public class Challenge
{
private static ArrayList worldStones = new ArrayList();
public static void Initialize()
{
Server.Commands.Register( "Duel", AccessLevel.Player, new CommandEventHandler( Duel_OnCommand ) );
Configure();
}
public static void Configure()
{
EventSink.WorldLoad+= new WorldLoadEventHandler(onLoad);
EventSink.Disconnected += new DisconnectedEventHandler(OnDisconnect);
EventSink.Login += new LoginEventHandler(OnLogin);
if( curStone != null )
{
curStone.UpdateRegion();
}
}
public static ArrayList WorldStones
{
get { return worldStones; }
set { worldStones = value; }
}
public static void onLoad()
{
foreach ( Mobile mob in World.Mobiles.Values )
{
if ( mob is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)mob;
if( pm.IsInChallenge )
{
pm.IsInChallenge = false;
int kills = 0;
if( kills >= 5 )
pm.LogoutLocation = new Point3D( 2623, 2120, 10 );
else
pm.LogoutLocation = new Point3D( 1522, 1757, 28 );
if( pm.TempMount != null )
{
pm.TempMount.Rider = pm;
pm.TempMount = null;
}
}
}
}
foreach ( Item item in World.Items.Values )
{
if (item is DuelStone)
{
WorldStones.Add(item);
}
}
}
[Usage( "Duel" )]
[Description( "Initiates Challenge Game!" )]
public static void Duel_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
from.CloseGump( typeof( BeginGump ) );
from.SendGump( new BeginGump( (PlayerMobile)from, WorldStones ) );
return;
}
}
}
namespace Server.Items
{
[Serializable()]
public class DuelStone : Item
{
public bool m_Active;
private DuelType m_DuelType;
private DuelSet m_DuelSet;
private bool m_CanHeal;
private bool m_CanUsePotions;
private bool m_MagicWeapons;
private Mobile m_D1;
private Mobile m_D2;
private static DuelStone curStone;
private int m_ArenaZ;
private int m_MinPlayers;
public Point3D m_ChallengerPointDest;
public Point3D m_OpponentPointDest;
public Point3D m_ChallengerExitPointDest;
public Point3D m_OpponentExitPointDest;
private Map m_MapDest;
private Mobile m_OpponentMobile;
private Mobile m_ChallengerMobile;
private ChallengeGameType m_Game = ChallengeGameType.OnePlayerTeam;
private ArrayList m_ChallengePlayers = new ArrayList();
private ArrayList m_OpponentPlayers = new ArrayList();
private ArrayList m_ChallengerDead = new ArrayList();
private ArrayList m_OpponentDead = new ArrayList();
private int dualLength = 10;
private DuelRegion m_DuelingRegion;
private Rectangle2D m_DuelCoords;
private BitArray m_RestrictedSpells;
private BitArray m_RestrictedSkills;
public ArrayList ChallengeTeam{ get{ return m_ChallengePlayers; } }
public ArrayList OpponentTeam{ get{ return m_OpponentPlayers; } }
public ArrayList ChallengerDead{ get{ return m_ChallengerDead; } }
public ArrayList OpponentDead{ get{ return m_OpponentDead; }}
public Mobile Advance
{
get { return m_Advance; }
set { m_Advance = value; }
}
public Mobile D1
{
get { return m_D1; }
set { m_D1 = value; }
}
public Mobile D2
{
get { return m_D2; }
set { m_D2 = value; }
}
[CommandProperty(AccessLevel.GameMaster)]
public int ArenaZ
{
get { return m_ArenaZ; }
set { m_ArenaZ = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int DualLength
{
get { return dualLength; }
set { dualLength = value; }
}
public BitArray RestrictedSpells
{
get { return m_RestrictedSpells; }
}
public BitArray RestrictedSkills
{
get { return m_RestrictedSkills; }
}
public DuelRegion DuelingRegion
{
get { return m_DuelingRegion; }
}
public Rectangle2D DuelCoords
{
get { return m_DuelCoords; }
set { m_DuelCoords = value; }
}
public bool CanHeal
{
get
{
return m_CanHeal;
}
set
{
m_CanHeal = value;
}
}
public bool CanUsePotions
{
get
{
return m_CanUsePotions;
}
set
{
m_CanUsePotions = value;
}
}
public bool MagicWeapons
{
get
{
return m_MagicWeapons;
}
set
{
m_MagicWeapons = value;
}
}
public DuelType DuelType
{
get
{
return m_DuelType;
}
set
{
m_DuelType = value;
}
}
public DuelSet DuelSet
{
get
{
return m_DuelSet;
}
set
{
m_DuelSet = value;
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Active
{
get { return m_Active; }
set
{
m_Active = value; InvalidateProperties();
if ( m_Active == true )
Name = "Duel Stone[Not in use]";
if ( m_Active == false )
Name = "Duel Stone[In use]";
}
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D ChallengerPointDest
{
get { return m_ChallengerPointDest; }
set { m_ChallengerPointDest = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D OpponentPointDest
{
get { return m_OpponentPointDest; }
set { m_OpponentPointDest = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Map MapDest
{
get { return m_MapDest; }
set { m_MapDest = value; }
}
[Constructable]
public DuelStone() : this( new Point3D( 0, 0, 0 ), new Point3D( 0, 0, 0 ), new Point3D( 0, 0, 0 ), new Point3D( 0, 0, 0 ), null, false )
{
Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );
r.m_DuelCoords = rect;
r.UpdateRegion();
}
[Constructable]
public DuelStone( Point3D challengerpointDest, Point3D opponentpointDest, Point3D challengerexit, Point3D opponentexit, bool creatures ) : base( 0xED4 )
{
Movable = false;
Hue = 0;
Name = "a Ladder Dueling stone";
Active = true;
m_ChallengerPointDest = challengerpointDest;
m_OpponentPointDest = opponentpointDest;
m_ChallengerExitPointDest = challengerexit;
m_OpponentExitPointDest = opponentexit;
MapDest = Map.Felucca;
m_ChallengePlayers = new ArrayList();
m_OpponentPlayers = new ArrayList();
m_ChallengerDead = new ArrayList();
m_OpponentDead = new ArrayList();
Duel.Duel.WorldStones.Add( this );
curStone = this;
m_DuelCoords = new Rectangle2D();
UpdateRegion();
m_RestrictedSpells = new BitArray( SpellRegistry.Types.Length );
m_RestrictedSkills = new BitArray( SkillInfo.Table.Length );
}
public override void OnSingleClick( Mobile from )
{
if ( Active == true )
{
LabelTo( from, Name );
LabelTo( from, "Not in use" );
}
if ( Active == false )
{
LabelTo( from, Name );
LabelTo( from, "In Use" );
}
}
public void AddChallengePlayer( PlayerMobile player)
{
ChallengeTeam.Add(player);
}
public void AddOpponentPlayer( PlayerMobile player)
{
OpponentTeam.Add(player);
}
public void RemoveChallengePlayer( PlayerMobile player)
{
ChallengeTeam.Remove(player);
}
public void RemoveOpponentPlayer( PlayerMobile player)
{
OpponentTeam.Remove(player);
}
public void AddChallengerDead( PlayerMobile player )
{
ChallengerDead.Add(player);
}
public void AddOpponentDead( PlayerMobile player )
{
OpponentDead.Add(player);
}
public void ClearAll()
{
Active = true;
foreach ( PlayerMobile opponent in OpponentTeam )
{
opponent.IsInChallenge = false;
}
foreach( PlayerMobile challenger in ChallengeTeam )
{
challenger.IsInChallenge = false;
}
ChallengeTeam.Clear();
ChallengerDead.Clear();
OpponentTeam.Clear();
OpponentDead.Clear();
}
public override void OnDelete()
{
base.OnDelete ();
if( Dule.Dule.WorldStones.Contains( this ))
{
Dule.Dule.WorldStones.Remove( this );
}
}
public static void OnLogin(LoginEventArgs e)
{
try
{
if (curStone.m_Players.Contains(e.Mobile))
{
e.Mobile.SendMessage(1161, "Something must have went wrong during one of the duels, and you have been removed.");
curStone.m_Players.Remove(e.Mobile);
}
}
catch { }
}
public static void OnDisconnect( DisconnectedEventArgs e )
{
if( curStone.m_Players != null )
{
if( e.Mobile == curStone.m_D1 )
{
curStone.m_D2.SendMessage( 1161, "Your opponent has logged out, thus you win." );
curStone.EndRound( curStone.m_D2, curStone.m_D1 );
}
else if( e.Mobile == curStone.m_D2 )
{
curStone.m_D1.SendMessage( 1161, "Your opponent has logged out, thus you win." );
curStone.EndRound( curStone.m_D1, curStone.m_D2 );
}
}
}
}
}
public override void OnDoubleClick( Mobile from )
{
if( Active )
{
PlayerMobile pm = from as PlayerMobile;
Active = false;
pm.IsInChallenge = true;
}
}
public void DuelReady()
{
DuelReady( m_D1 );
DuelReady( m_D2 );
WallandMove();
}
public void DuelReady(Mobile who)
{
PlayerMobile c = (PlayerMobile) who;
if( !who.Alive )
who.Resurrect();
if(oncurs != null)
bp.DropItem(oncurs);
c.SendMessage( "You have 10 seconds until the duel begins" );
c.SendMessage( 63, "After one of you dies, both of you will be teleported out" );
c.Criminal = true;
c.CurePoison(c);
c.Blessed = true;
c.Frozen = true;
c.Hits = c.HitsMax;
c.Mana = c.ManaMax;
c.Stam = c.StamMax;
c.StatMods.Clear();
if(bp != null)
{
Item toDisarm = c.FindItemOnLayer( Layer.OneHanded );
if ( toDisarm == null || !toDisarm.Movable )
toDisarm = c.FindItemOnLayer( Layer.TwoHanded );
if (toDisarm != null)
bp.DropItem(toDisarm);
if ( c.Mount != null )
{
IMount mount = c.Mount;
mount.Rider = null;
if( mount is BaseMount )
{
BaseMount oldMount = (BaseMount)mount;
oldMount.Map = Map.Internal;
c.TempMount = oldMount;
}
}
}
}
public void TimerStart()
{
new InternalTimer( this ).Start();
}
public class InternalTimer : Timer
{
private int m_Count = 10;
private DuelStone m_Item;
private ArrayList m_Players = new ArrayList();
private DateTime dualstart;
public InternalTimer( DuelStone item ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
{
m_Item = item;
m_Players.AddRange( item.ChallengeTeam );
m_Players.AddRange( item.OpponentTeam );
}
public void nocheat(Mobile who)
{
Targeting.Target.Cancel( who );
who.MagicDamageAbsorb = 0;
who.MeleeDamageAbsorb = 0;
ProtectionSpell.Registry.Remove( who );
DefensiveSpell.Nullify( who );
}
protected override void OnTick()
{
m_Count--;
if ( (m_Count % 5) == 0 && m_Count > 10)
{
foreach ( PlayerMobile pm in m_Players )
pm.SendMessage( "{0} seconds until the duel begins.", m_Count );
}
else if(m_Count <= 10 && m_Count > 0)
{
foreach ( PlayerMobile pm in m_Players )
pm.SendMessage( "{0}", m_Count );
}
else if ( m_Count == 0 )
{
foreach ( PlayerMobile pm in m_Players )
{
DuelReady( m_D1 );
DuelReady( m_D2 );
nocheat((Mobile)pm);
pm.Frozen = false;
pm.Blessed = false;
ChallengeRing ring = new ChallengeRing( m_Item, m_Players );
pm.EquipItem( ring );
pm.SendMessage( 43, "GO GO GO GO GO GO GO GO GO GO!" );
}
new FightTimer( m_Item, m_Players ).Start();
Stop();
}
}
}
public class FightTimer : Timer
{
private double m_Count;
private int m_Seconds;
private DuelStone m_Item;
private ArrayList m_Players;
public FightTimer( DuelStone item, ArrayList players ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ))
{
m_Item = item;
m_Players = players;
m_Count = item.DualLength;
m_Seconds = item.DualLength * 60;
}
public void attrib(Mobile who)
{
PlayerMobile m = who as PlayerMobile;
RemoveRing(m);
m.Aggressed.Clear();
m.Aggressors.Clear();
if(!who.Alive)
who.Resurrect();
if(m.TempMount != null)
{
m.TempMount.Rider = m;
m.TempMount = null;
}
m.Criminal = false;
m.PlaySound( 0x214 );
m.FixedEffect( 0x376A, 10, 16 );
m.Hits = 125;
m.Mana = 125;
m.Stam = 125;
}
public Point2D Middle()
{
Rectangle2D r = m_DuelCoords;
int wMid = r.X + (r.Width / 2);
int hMid = r.Y + (r.Height / 2);
Point2D mid = new Point2D( wMid, hMid );
return mid;
}
public Point2D D1Dest()
{
Point2D dest = Middle();
dest.Y -= 2;
return dest;
}
public Point2D D2Dest()
{
Point2D dest = Middle();
dest.Y += 2;
return dest;
}
public void WallandMove()
{
Item x = new WallOfStoneEast(this);
x.MoveToWorld( new Point3D( Middle().X, Middle().Y, m_ArenaZ ), m_MapDest );
m_D1.MoveToWorld( new Point3D( D1Dest().X, D1Dest().Y, m_ArenaZ ), m_MapDest );
m_D2.MoveToWorld( new Point3D( D2Dest().X, D2Dest().Y, m_ArenaZ ), m_MapDest );
}
public void RemoveRing( PlayerMobile m )
{
ChallengeRing ring = new ChallengeRing();
foreach( Item item in m.Items )
{
if( item is ChallengeRing )
ring = item as ChallengeRing;
}
if( ring != null )
ring.Delete();
}
public void winner(PlayerMobile winner)
{
winner.BankBox.Open();
winner.SendMessage( 43, "Congratulations on winning the duel!!");
winner.SendMessage( 43, "Don't forget to retreive your items from the bank!!");
winner.Wins += 1;
}
public void loser(PlayerMobile loser)
{
loser.BankBox.Open();
loser.SendMessage( 43, "Somebody get owned?");
loser.SendMessage( 43, "Don't forget to retreive your items from the bank!!");
loser.Loses += 1;
}
protected override void OnTick()
{
m_Seconds--;
m_Count = (m_Seconds / 60);
if ( (m_Count % 5) == 0 && m_Count <= 30 && (double)m_Count == (double)m_Seconds/60)
{
foreach ( PlayerMobile pm in m_Players )
pm.SendMessage( "The Duel will end in {0} minutes ", m_Count );
}
else if ( m_Count == 1 && (double)m_Count == (double)m_Seconds/60 )
{
foreach ( PlayerMobile pm in m_Players )
pm.SendMessage( "1 minute left" );
}
else if ( m_Seconds <= 10 )
{
foreach ( PlayerMobile pm in m_Players )
pm.SendMessage( "{0}", m_Seconds );
}
else if ( m_Count == 0 )
{
foreach ( PlayerMobile pm in m_Players )
{
pm.SendMessage( 43, "You failed to kill your opponent. The game is ending..." );
pm.SendMessage( 43, "Don't forget to retreive your items from the bank!!");
attrib( pm as Mobile );
}
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
challenger.Location = m_Item.m_ChallengerExitPointDest;
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
opponent.Location = m_Item.m_OpponentExitPointDest;
m_Item.ClearAll();
Stop();
}
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
{
if ( !challenger.Alive )
{
if ( !m_Item.ChallengerDead.Contains( challenger ))
m_Item.AddChallengerDead( challenger );
}
}
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
{
if ( !opponent.Alive )
{
if ( !m_Item.OpponentDead.Contains( opponent ))
m_Item.AddOpponentDead( opponent );
}
}
if ( m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count || m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count )
{
foreach ( PlayerMobile pm in m_Players )
{
attrib( pm as Mobile );
}
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
{
if( challenger.NetState != null )
challenger.Location = m_Item.m_ChallengerExitPointDest;
else
challenger.LogoutLocation = m_Item.m_ChallengerExitPointDest;
}
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
{
if( opponent.NetState != null )
opponent.Location = m_Item.m_OpponentExitPointDest;
else
opponent.LogoutLocation = m_Item.m_OpponentExitPointDest;
}
if(m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count && m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
{
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
challenger.SendMessage( 63, "Neither side lost, due to all fighters being dead.." );
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
opponent.SendMessage( 63, "Neither side lost, due to all fighters being dead.." );
}
if(m_Item.ChallengerDead.Count == m_Item.ChallengeTeam.Count)
{
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
winner(opponent);
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
loser(challenger);
}
if(m_Item.OpponentDead.Count == m_Item.OpponentTeam.Count)
{
foreach( PlayerMobile challenger in m_Item.ChallengeTeam )
winner(challenger);
foreach (PlayerMobile opponent in m_Item.OpponentTeam )
loser(opponent);
}
m_Item.ClearAll();
Stop();
}
}
}
public bool Is7x( Mobile from ) //7x Check
{
if(from.SkillsTotal == 7000)
return true;
return false;
}
public bool Is5x( Mobile from ) //5x Check
{
if(from.SkillsTotal <= 5000) //Change to == for exactly 5x. This just makes sure they don't have over.
return true;
return false;
}
public void AcceptPlayer( Mobile from )
{
from.SendMessage( 1161, "You have met the pre-requisites, and have been accepted into the duel. Please have patients." );
m_Players.Add( from );
}
public void WeaponCheck( Mobile from )
{
if( DuelType == DuelType.Mage )
{
Item toBank = from.FindItemOnLayer( Layer.OneHanded );
Container bp = from.BankBox;
Container pack = from.Backpack;
Item holding = from.Holding;
if( holding != null )
{
bp.DropItem(holding);
from.SendMessage( 1161, "The item that you were holding has been moved to you bankbox due to restrictions on the duel." );
}
if ( toBank == null || !toBank.Movable )
toBank = from.FindItemOnLayer( Layer.TwoHanded );
if (toBank != null && bp != null && toBank is BaseWeapon)
{
bp.DropItem(toBank);
from.SendMessage( 1161, "Some equipment has been moved to your bankbox due to restrictions on the duel." );
}
foreach( Item i in new ArrayList( pack.Items ) )
{
if(i.Map != Map.Internal)
{
if(i is BaseWeapon)
{
bp.DropItem(i);
from.SendMessage( 1161, "Some equipment was moved to your bankbox due to restrictions on this tourney." );
}
}
}
}
if( !m_MagicWeapons )
{
Item toBank = from.FindItemOnLayer( Layer.OneHanded );
Container bp = from.BankBox;
Container pack = from.Backpack;
Item holding = from.Holding;
if( holding != null )
{
if(IsMagicWeapon(holding))
{
bp.DropItem(holding);
from.SendMessage( 1161, "The item that you were holding has been moved to you bankbox due to restrictions on the duel." );
}
}
if ( toBank == null || !toBank.Movable )
toBank = from.FindItemOnLayer( Layer.TwoHanded );
if (toBank != null && bp != null && toBank is BaseWeapon)
{
if(IsMagicWeapon(toBank))
{
bp.DropItem(toBank);
from.SendMessage( 1161, "Some equipment has been moved to your bankbox due to restrictions on the duel." );
}
}
foreach( Item i in new ArrayList( pack.Items ) )
{
if(i.Map != Map.Internal)
{
if(i is BaseWeapon || i is BaseArmor || i is BaseJewel)
{
if(IsMagicWeapon(i))
{
bp.DropItem(i);
from.SendMessage( 1161, "Some equipment was moved to your bankbox due to restrictions on this duel." );
}
}
}
}
}
}
public bool IsMagicWeapon( Item from )
{
bool strike = false;
if( from is BaseWeapon )
{
BaseWeapon b = (BaseWeapon)from;
if( b.AccuracyLevel > 0 || b.DamageLevel > 0 || b.DurabilityLevel > 0 || b.Slayer > 0 || b.ArtifactRarity > 0 )
strike = true;
}
if( from is BaseArmor )
{
BaseArmor b = (BaseArmor)from;
if(b.ArtifactRarity > 0)
strike = true;
}
if( from is BaseJewel )
{
BaseJewel b = (BaseJewel)from;
if(b.ArtifactRarity > 0)
strike = true;
}
return strike;
}
public void DenyPlayer( Mobile from )
{
from.SendMessage( 1161, "We are sorry, but you do not meet the pre-requisites.");
}
public void VerifyJoin( Mobile from )
{
switch( DuelType )
{
case DuelType.Any:
{
break;
}
case DuelType.Mage:
{
if(IsMage(from))
break;
else
{
canJoin = false;
break;
}
}
case DuelType.Dexxer:
{
if(IsDexxer(from))
break;
else
{
canJoin = false;
break;
}
}
case DuelType.Tank:
{
if(IsTank(from))
break;
else
{
canJoin = false;
break;
}
}
}
switch( DuelSet )
{
case DuelSet.Allow:
{
break;
}
case DuelSet.Sevenx:
{
if(Is7x(from))
break;
else
{
canJoin = false;
break;
}
}
case DuelSet.Fivex:
{
if(Is5x(from))
break;
else
{
canJoin = false;
break;
}
}
}
if(canJoin)
AcceptPlayer(from);
else
DenyPlayer(from);
}
public DuelStone( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 3 );// version
writer.Write( m_MagicWeapons );
writer.Write( (int) m_DuelType );
writer.Write( (int) m_DuelSet );
writer.Write( (int) m_ArenaZ );
writer.Write( m_CanHeal );
writer.Write( m_CanUsePotions );
writer.Write( (int)dualLength);
writer.Write( (int)m_Game );
writer.Write( m_ChallengerExitPointDest );
writer.Write( m_OpponentExitPointDest );
writer.Write( true );
writer.Write( m_ChallengerPointDest );
writer.Write( m_OpponentPointDest );
writer.Write( m_MapDest );
WriteBitArray( writer, m_RestrictedSpells );
WriteBitArray( writer, m_RestrictedSkills );
writer.Write( (Rectangle2D) m_DuelCoords );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
curStone = this;
int version = reader.ReadInt();
switch ( version )
{
case 7:
{
m_MagicWeapons = reader.ReadBool();
m_DuelType = (DuelType)reader.ReadInt();
m_DuelSet = (DuelSet)reader.ReadInt();
goto case 6;
}
case 6:
{
m_ArenaZ = reader.ReadInt();
goto case 5;
}
case 5:
{
m_CanHeal = reader.ReadBool();
m_CanUsePotions = reader.ReadBool();
goto case 4;
}
case 4:
{
m_RestrictedSpells = ReadBitArray( reader );
m_RestrictedSkills = ReadBitArray( reader );
goto case 3;
}
case 3:
{
dualLength = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Game = (ChallengeGameType)reader.ReadInt();
goto case 1;
}
case 1:
{
m_ChallengerExitPointDest = reader.ReadPoint3D();
m_OpponentExitPointDest = reader.ReadPoint3D();
goto case 0;
}
case 0:
{
m_Active = reader.ReadBool();
m_ChallengerPointDest = reader.ReadPoint3D();
m_OpponentPointDest = reader.ReadPoint3D();
m_MapDest = reader.ReadMap();
break;
}
}
}
public void UpdateRegion()
{
if( m_DuelingRegion == null )
{
m_DuelingRegion = new DuelRegion( this, this.Map );
}
try
{
Region.RemoveRegion( m_DuelingRegion );
m_DuelingRegion.Coords.Clear();
m_DuelingRegion.Coords.Add( m_DuelCoords );
m_DuelingRegion.Disabled = true;
m_DuelingRegion.Map = this.Map;
Region.AddRegion( m_DuelingRegion );
return;
}
catch
{
m_DuelCoords = new Rectangle2D();
}
}
public static int GetRegistryNumber( ISpell s )
{
Type[] t = SpellRegistry.Types;
for( int i = 0; i < t.Length; i++ )
{
if( s.GetType() == t[i] )
return i;
}
return -1;
}
public bool IsRestrictedSpell( ISpell s )
{
int regNum = GetRegistryNumber( s );
if( regNum < 0 ) //Happens with unregistered Spells
return false;
return m_RestrictedSpells[regNum];
}
public bool IsRestrictedSkill( int skill )
{
if( skill < 0 )
return false;
return m_RestrictedSkills[skill];
}
public override void OnDelete()
{
if( m_DuelingRegion != null )
Region.RemoveRegion( m_DuelingRegion );
try{m_D1 = null;}catch{}
try{m_D2 = null;}catch{}
base.OnDelete();
}
public override void OnMapChange()
{
UpdateRegion();
base.OnMapChange();
}
public void ShowBounds( Rectangle2D r, Map m )
{
if( m == Map.Internal || m == null )
return;
Point3D p1 = new Point3D( r.X, r.Y - 1, 0 );
Point3D p2 = new Point3D( r.X, r.Y + r.Height - 1, 0 );
Effects.SendLocationEffect( new Point3D( r.X -1, r.Y - 1, m.GetAverageZ( r.X, r.Y -1 ) ) , m, 251, 75, 1, 1151, 3 ); //Top Corner //Testing color
for( int x = r.X; x <= ( r.X + r.Width -1 ); x++ )
{
p1.X = x;
p2.X = x;
p1.Z = m_ArenaZ;
p2.Z = m_ArenaZ;
Effects.SendLocationEffect( p1, m, 249, 75, 1, 1151, 3 ); //North bound
Effects.SendLocationEffect( p2, m, 249, 75, 1, 1151, 3 ); //South bound
}
p1 = new Point3D( r.X -1 , r.Y -1 , 0 );
p2 = new Point3D( r.X + r.Width - 1, r.Y, 0 );
for( int y = r.Y; y <= ( r.Y + r.Height -1 ); y++ )
{
p1.Y = y;
p2.Y = y;
p1.Z = m_ArenaZ;
p2.Z = m_ArenaZ;
Effects.SendLocationEffect( p1, m, 250, 75, 1, 1151, 3 ); //West Bound
Effects.SendLocationEffect( p2, m, 250, 75, 1, 1151, 3 ); //East Bound
}
}
}
}

Ty for that are trying to help me with this
Dian- 02-20-2006
Well.. the reason behind those perticular errors were from combining 2 scripts into one file.. there were a couple extra brackets before your override OnDoubleClick() method.
I cleaned up the indentions to the script, and seperated that into 2 files, see how that helps for now.. I have not tried to compile it into RunUO.. but that alone has removed the errors in the script you had recieved.