ServUO Version
Publish 57
Ultima Expansion
Endless Journey
using System;
using Server.Targeting;

namespace Server.Spells.First
{
public class NightSightSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Night Sight", "In Lor",
236,
9031,
Reagent.SulfurousAsh,
Reagent.SpidersSilk);
public NightSightSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}

public override SpellCircle Circle
{
get
{
return SpellCircle.First;
}
}
public override double RequiredSkill
{
get
{
return 0.0;
}
}
public override void OnCast()
{
Caster.Target = new NightSightTarget(this);
}

public void Target(Mobile targ)
{
SpellHelper.Turn(Caster, targ);

if (targ.BeginAction(typeof(LightCycle)))
{
new LightCycle.NightSightTimer(targ).Start();
int level = 22;

if (level < 0)
level = 0;

targ.LightLevel = level;

targ.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
targ.PlaySound(0x1E3);

BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.NightSight, 1075643)); //Night Sight/You ignore lighting effects
}
else
{
Caster.SendMessage("{0} already have nightsight.", Caster == targ ? "You" : "They");
}
}

private class NightSightTarget : Target
{
private readonly NightSightSpell m_Spell;

public NightSightTarget(NightSightSpell spell)
: base(12, false, TargetFlags.Beneficial)
{
m_Spell = spell;
}

protected override void OnTarget(Mobile from, object targeted)
{
if (targeted is Mobile && m_Spell.CheckBSequence((Mobile)targeted))
{
m_Spell.Target((Mobile)targeted);
}

m_Spell.FinishSequence();
}

protected override void OnTargetFinish(Mobile from)
{
m_Spell.FinishSequence();
}
}
}
}
After using NightSightSpell, the NightSight effect will continue to be maintained if the player dies and comes back to life. I want to get rid of the NightSight effect when the player dies after using NightSight. I need help with what command removes the effect.
 
You can add EndEffects to the PlayerMobile OnDeath method. Just find the EndAction methods and add new ones:
C#:
            EndAction(typeof(LightCycle));
            LightLevel = 0;
 
You can add EndEffects to the PlayerMobile OnDeath method. Just find the EndAction methods and add new ones:
C#:
            EndAction(typeof(LightCycle));
            LightLevel = 0;
Wow! It works well!Thank you so much for your help. I hope you have a happy day!
 
use classicuo, it bypass light, light its annoying, muh immersion.

Dont bother with all that stuff in my humble opinion, i would like a night & day cycle server side, is just not possible.
 
Back