View Full Version: Erreur sur un spell

RunUO.FR Support > Probleme de script > Erreur sur un spell


Title: Erreur sur un spell
Description: comprend pas...


Nezumi - June 26, 2004 02:52 PM (GMT)
voila le code :

CODE
using System;
using Server.Targeting;
using Server.Network;
using Server;

namespace Server.Spells.Blanche
{
public class LumiereSpell : Spell
{
 private static SpellInfo m_Info = new SpellInfo(
   "Lumière", "",
   SpellCircle.Blanche,
   236,
   9031,
   Reagent.SulfurousAsh,
   Reagent.SpidersSilk
  );

 public LumiereSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
 {
 }

 public override void OnCast()
 {
  Caster.Target = new LumiereTarget( this );
 }

 private class LumiereTarget : Target
 {
  private Spell m_Spell;

  public LumiereTarget( Spell spell ) : base( 10, false, TargetFlags.None )
  {
   m_Spell = spell;
  }

  protected override void OnTarget( Mobile from, object targeted )
  {
   if ( targeted is Mobile && m_Spell.CheckSequence() )
   {
    Mobile targ = (Mobile)targeted;

    SpellHelper.Turn( m_Spell.Caster, targ );

    if ( targ.BeginAction( typeof( LightCycle ) ) )
    {
     new LightCycle.LumiereTimer( targ ).Start();
     /*int level = (int)Math.Abs( LightCycle.DungeonLevel * ( m_Spell.Caster.Skills[SkillName.Magery].Base / 100 ) );

     if ( level > 25 || level < 0 )*/
     level = 25;

     targ.LightLevel = level;

     targ.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist );
     targ.PlaySound( 0x4B1 );
    }
    else
    {
     from.SendMessage( "{0} déjà la lumière en eux.", from == targ ? "Vous avez" : "Ils ont" );
    }
   }

   m_Spell.FinishSequence();
  }

  protected override void OnTargetFinish( Mobile from )
  {
   m_Spell.FinishSequence();
  }
 }


 private class LumiereTimer : Timer
 {
  private Mobile m;

  public LumiereTimer(Mobile from ) : base
  ( TimeSpan.FromSeconds (20.0), TimeSpan.FromSeconds (20.0) )
   {
    m = from;
    m.SendMessage("Début du timer Lumiere");
   }

  protected override void OnTick() //Ici c'est la fin du timer, autrement dit ici apres 20 secondes
  {
   m.SendMessage("Fin du timer Lumiere"); //on précise a celui qui a activer le Timer que celui-ci se termine
   m.LightLevel = 0;
   Stop(); // On précise que le timer ne recommance pas. Sans le stop, vous verrez "Fin du timer" a tous les 20 secondes.

  }
 }
}
}}




et voici l'erreur

CODE
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\#Nexam\Magie Blanche\LumiereSpell.cs: CS1022: (line 95, 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.


quelqu'un comprend ?

Nezumi - June 26, 2004 05:18 PM (GMT)
j'ai trouvé... c'était tout bête

en fait il faut déclarer:

public class LumiereSpell : BlancheSpell

pour avoir la bonne ref dans mon cas :)




Hosted for free by InvisionFree