Full Version : Skill Ball Problem
xmlspawner >>Scripting Support >>Skill Ball Problem


<< Prev | Next >>

Erica- 01-26-2007
Hi ok im having a little issue here ok my shard is set with a skill stone for them when players start they are in a skill room they pick 12 skills and got 100 each on skills meaning i got it set where skill cap is 12000 that will give them 12 skills to pick from the skillstone now ive had a few players buy a skill ball and when they double click it the page gump is empty now i know that if lets say they didnt use a skillstone and got 80 on one of there skills they can raise it up from the skillball 10 points only does it if they got a skill at 80 what im trying to do once they pick there 12 skills which would be 12 skills at 100 i want the skillball to work where if they put arrow on 2 skills down so they can have 100 on 10 skills that the skillball would give them 10 plus on a skill meaning if they only picked 10 skills from skillstone then they can use a powerscroll to make certain skills go up 120 or 105 or 115 , 110 doing that i wiould like the skillball to let them be able to add 10 plus on any skills if they ate a powerscroll .
Heres the script for the skillball not sure what i would change for this to happen.

CODE
//   RunUO script: Skill Ball
//   Copyright (c) 2003 by Wulf C. Krueger <wk@mailstation.de>
//
//   This script is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; version 2 of the License applies.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   Please do NOT remove or change this header.



using System;
using Server.Network;
using Server.Items;
using Server.Gumps;

namespace Server.Items
{
  public class SkillBall : Item
     {
     private int m_SkillBonus = 10;
     private string m_BaseName = "a skill ball +";
     public bool GumpOpen = false;

     [CommandProperty( AccessLevel.GameMaster )]
     public int SkillBonus
     {
  get { return m_SkillBonus; }
  set {
    m_SkillBonus = value;
    this.Name = m_BaseName + Convert.ToString(m_SkillBonus);
  }
     }

     [Constructable]
     public SkillBall( int SkillBonus ) : base( 6249 )
     {
     Movable = false;
  Hue = 1153;
  m_SkillBonus = SkillBonus;
  Name = m_BaseName + Convert.ToString(SkillBonus);
     }

     [Constructable]
     public SkillBall() : base( 6249 )
     {
  Name = m_BaseName + Convert.ToString(SkillBonus);
     }

     public SkillBall( Serial serial ) : base( serial )
     {
     }

     public override void OnDoubleClick( Mobile from )
     {
  if ( (this.SkillBonus == 80) && (from.AccessLevel < AccessLevel.GameMaster) ) {
    from.SendMessage("This Skill Ball isn't charged. Please page for a GM.");
    return;
  }
  else if ( (from.AccessLevel >= AccessLevel.GameMaster) && (this.SkillBonus == 0) ) {
    from.SendGump( new PropertiesGump( from, this ) );
    return;
  }

  if ( !IsChildOf( from.Backpack ) )
    from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
  else if (!GumpOpen) {
    GumpOpen = true;
    from.SendGump( new SkillBallGump( from, this ) );
  }
  else if (GumpOpen)
    from.SendMessage("You're already using the ball.");
     }

     public override void Serialize( GenericWriter writer )
     {
  base.Serialize( writer );

  writer.Write( (int) 0 ); // version
  writer.Write( m_SkillBonus );
     }

     public override void Deserialize( GenericReader reader )
     {
  base.Deserialize( reader );

  int version = reader.ReadInt();

  switch (version) {

    case 0 : {
      m_SkillBonus = reader.ReadInt();
      break;
    }
  }
     }
  }
}

namespace Server.Gumps
{
  public class SkillBallGump : Gump
  {
     private const int FieldsPerPage = 14;

     private Skill m_Skill;
     private SkillBall m_skb;

     public SkillBallGump ( Mobile from, SkillBall skb ) : base ( 20, 30 )
     {
  m_skb = skb;
   
  AddPage ( 0 );
  AddBackground( 0, 0, 260, 351, 5054 );
   
  AddImageTiled( 10, 10, 240, 23, 0x52 );
  AddImageTiled( 11, 11, 238, 21, 0xBBC );
   
  AddLabel( 65, 11, 0, "Skills you can raise" );
   
  AddPage( 1 );
   
  int page = 1;
  int index = 0;
   
  Skills skills = from.Skills;
   
  int number;
  if ( Core.AOS )
    number = 0;
  else
    number = 3;
   
  for ( int i = 0; i < ( skills.Length - number ); ++i ) {
    if ( index >= FieldsPerPage ) {
      AddButton( 231, 13, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1 );
     
      ++page;
      index = 0;
     
      AddPage( page );
     
      AddButton( 213, 13, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1 );
    }
   
    Skill skill = skills[i];
   
    if ( (skill.Base + m_skb.SkillBonus) <= 100 ) {
     
      AddImageTiled( 10, 32 + (index * 22), 240, 23, 0x52 );
      AddImageTiled( 11, 33 + (index * 22), 238, 21, 0xBBC );
     
      AddLabelCropped( 13, 33 + (index * 22), 150, 21, 0, skill.Name );
      AddImageTiled( 180, 34 + (index * 22), 50, 19, 0x52 );
      AddImageTiled( 181, 35 + (index * 22), 48, 17, 0xBBC );
      AddLabelCropped( 182, 35 + (index * 22), 234, 21, 0, skill.Base.ToString( "F1" ) );
     
      if ( from.AccessLevel >= AccessLevel.Player )
        AddButton( 231, 35 + (index * 22), 0x15E1, 0x15E5, i + 1, GumpButtonType.Reply, 0 );
      else
        AddImage( 231, 35 + (index * 22), 0x2622 );
     
      ++index;
    }
  }
     }
     
     public override void OnResponse( NetState state, RelayInfo info )
     {
  Mobile from = state.Mobile;
   
  if ( (from == null) || (m_skb.Deleted) )
    return;

  m_skb.GumpOpen = false;

  if ( info.ButtonID > 0 ) {
    m_Skill = from.Skills[(info.ButtonID-1)];
   
    if ( m_Skill == null )
           return;
   
         double count = 0;
    for ( int i = 0; i < from.Skills.Length; ++i )
      count += from.Skills[i].Base;
   
         if ( (count + m_skb.SkillBonus) > (from.SkillsCap / 10) ) {
      from.SendMessage( "You cannot exceed the skill cap." );
      return;
    }
     
    if (m_Skill.Base + m_skb.SkillBonus <= 100) {
      m_Skill.Base += m_skb.SkillBonus;
      m_skb.Delete();
    }
    else
      from.SendMessage("You have to choose another skill.");
  }
     }
  }
}