mitty2
Member
I kinda tore up a powerscroll for this one. It works fine, but after use, the player gets his 200 skill points, but when they log out it goes back to the original skillCap for the shard. Tried everything in CharacterCreation.cs and tried diff things in config file. Nothing seems to work. Guess I'm having a case of the stupids this week. TY for any pairs of eyes on this one.
C#:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using System.Collections;
using Server.Engines.Quests;
using System.Collections.Generic;
using Reward = Server.Engines.Quests.BaseReward;
namespace Server.Items
{
public class SkillCapScroll : Item
{
private int m_Value;
[Constructable]
public SkillCapScroll( int value ) : base( 0x14F0 )
{
Name = "Skill Cap Scroll 200 Skill Cap Points";
Hue = 33;
Weight = 1.0;
m_Value = 1800;
}
public SkillCapScroll( Serial serial ) : base( serial )
{
}
public void Use( Mobile from )
{
if ( Deleted )
return;
if ( IsChildOf( from.Backpack ) )
{
int NewValue = m_Value;
if ( from is PlayerMobile )
{
NewValue += 10200;
}
if ( from.SkillsCap >= NewValue )
{
from.SendMessage( "Your skill cap is too high to use this scroll" );
}
else
{
from.SendLocalizedMessage( 1049512 ); // You feel a surge of magic as the scroll enhances your powers!
from.SkillsCap += NewValue;
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 );
Delete();
}
}
else
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
}
public override void OnDoubleClick( Mobile from )
{
Use( from );
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) m_Value );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Value = reader.ReadInt();
break;
}
}
}
}
}