Author Topic: [C#] Buff Event Question  (Read 3931 times)

0 Members and 1 Guest are viewing this topic.

Offline rwo001Topic starter

  • Jr. Member
  • **
  • Posts: 45
  • Activity:
    0%
  • Reputation Power: 1
  • rwo001 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
[C#] Buff Event Question
« on: December 30, 2015, 05:57:10 PM »
0
Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScriptSDK.API;

namespace StealthUO
{
    class Program
    {       
        static void Main(string[] args)
        {
            Stealth.Client.Buff_DebuffSystem += _onBuff;           
            Stealth.Client.CastSpell("Lightning Strike");  // Toggle On
            Stealth.Client.CastSpell("Lightning Strike");  // Toggle Off
           
            Console.ReadKey();
        }

        public static void _onBuff(object sender, Buff_DebuffSystemEventArgs e)
        {
            Console.WriteLine(e.AttributeId);
            Console.WriteLine(e.IsEnabled);           
        }
    }
}

I expected the about code shoud return
Code: [Select]
1096
True
1096
False
But the result is
Code: [Select]
1096
False
1096
False

Anyone knows what the problem is?

Offline rwo001Topic starter

  • Jr. Member
  • **
  • Posts: 45
  • Activity:
    0%
  • Reputation Power: 1
  • rwo001 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: [C#] Buff Event Question
« Reply #1 on: December 30, 2015, 06:25:08 PM »
0
Code: [Select]
namespace ScriptSDK.API
{
  public class Buff_DebuffSystemEventArgs : ObjectEventArgs
  {
    public ushort AttributeId { get; private set; }

    public bool IsEnabled { get; private set; }

    public Buff_DebuffSystemEventArgs(uint objectId, ushort attributeId, bool isEnabled)
      : base(objectId)
    {
      this.AttributeId = attributeId;
      this.IsEnabled = this.IsEnabled;
      // Is it the reason why the return value incorrect?
      // this.IsEnabled = isEnabled?
    }
  }
}

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: [C#] Buff Event Question
« Reply #2 on: December 31, 2015, 01:28:32 AM »
0
The ScriptSDK.API is Maxwells handler for using Stealth in C# if we look at the event properly we will see :

Code: [Select]
this.IsEnabled = this.IsEnabled;Boolean Values are false by Default. So if you assign x = x then x is ... x.
Correct should be :
Code: [Select]
this.IsEnabled = this.isEnabled;
And then it has 2 different variables and get the correct assignment.

I go now check if he fixed it on his source if not i will fix it on his side as well

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: [C#] Buff Event Question
« Reply #3 on: December 31, 2015, 01:57:40 AM »
0
* Fixed on SDK
* Fixed on Maxwells Repo
* Rebuild and upload on Sourceforge

Tags: