Author Topic: Magery Trainer  (Read 10431 times)

0 Members and 1 Guest are viewing this topic.

Offline Papang-Topic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • Papang- has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Magery Trainer
« on: December 21, 2017, 11:33:52 AM »
+1
Hello again   8)

After a few hours of work (looking for tutorials), I finally managed to make a little mage trainer for EA Shards.
after a few tests on "Test Center", it works!

Only a little problem...
If i run the program from Visual Studio 2017 I have no crash.
But If i open the build release with Admin right, it will insta crash the Client.exe but continue working on stealth.

Code: [Select]
using System;
using StealthAPI;
using ScriptSDK.Mobiles;
using ScriptSDK.Targets;


namespace PapangTrainer
{
    class Program
    {
        public static PlayerMobile Me = PlayerMobile.GetPlayer();
        public static bool IsBusy = false;

        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Press [1] for Magery");
            string Select = Console.ReadLine();
           
            switch (Select)
            {
                case "1":
                    IsBusy = true;
                    while (IsBusy)
                    {
                        var _MageMax = Stealth.Client.GetSkillCap(Skill.Magery);
                        var _CurMage = Stealth.Client.GetSkillValue(Skill.Magery);
                        var Target = new EntityTarget(1000);

                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.Write("\r " + "[magery @ " + _CurMage + "/" + _MageMax + "]");

                        if (Me.Mana < 25)
                            Medit();

                        if (_CurMage >= 0 && _CurMage < 34)
                        {
                            Me.Cast("Bless");
                            Stealth.Client.Wait(850);
                            Target.Action(Target.Entity);
                        }
                        else if (_CurMage >= 34 && _CurMage < 45)
                        {
                            Me.Cast("Greater Heal");
                            Me.Targeting.WaitForTarget(1000);
                            Target.Action(Target.Entity);
                        }
                        else if (_CurMage >= 45 && _CurMage < 67)
                        {
                            Me.Cast("Dispel Field");
                            Me.Targeting.WaitForTarget(1000);
                            Target.Action(Target.Entity);
                        }
                        else if (_CurMage >= 67 && _CurMage < 82)
                        {
                            Me.Cast("Invisibility");
                            Me.Targeting.WaitForTarget(1500);
                            Target.Action(Target.Entity);
                        }
                        else if (_CurMage >= 82 && _CurMage < 95)
                        {
                            Me.Cast("Mass Dispel");
                            Me.Targeting.WaitForTarget(2000);
                            Target.Action(Target.Entity);
                        }
                        else if (_CurMage >= 95 && _CurMage < 120)
                        {
                            Me.Cast("Earthquake");
                            Stealth.Client.Wait(1500);
                        }
                        else
                        {
                            Console.WriteLine("Magery Cap Raised ! Congratulation.");
                            IsBusy = false;
                        }
                    }
                    break;
            }
        }
        public static void Medit()
        {
            do
            {
                Console.ForegroundColor = ConsoleColor.DarkCyan;
                Console.Write("\r" + "Meditating ... MWaah !");
                Stealth.Client.CancelTarget();
                Stealth.Client.UseSkill(Skill.Meditation);
                Stealth.Client.Wait(500);
            } while (Me.Mana < Me.MaxMana);
        }
    }
}

Post Merge: December 21, 2017, 11:46:32 AM
If you are shocked by the code structure, all tips will be welcome, I have never done anything like this before.

My goal is to learn and share, each advice received will allow me to evolve and share my achievements on the forum.
« Last Edit: December 21, 2017, 11:46:32 AM by Papang- »

Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +367
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: Magery Trainer
« Reply #1 on: December 21, 2017, 01:45:36 PM »
+1
Can you open up the client and see it working after it crashes?
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline Papang-Topic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • Papang- has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Magery Trainer
« Reply #2 on: December 21, 2017, 02:11:21 PM »
+1
yes, i can reoppen it just after without bug and see the work doing.

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: +559
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Magery Trainer
« Reply #3 on: December 21, 2017, 11:31:08 PM »
+1
Hello again   8)

After a few hours of work (looking for tutorials), I finally managed to make a little mage trainer for EA Shards.
after a few tests on "Test Center", it works!

Only a little problem...
If i run the program from Visual Studio 2017 I have no crash.
But If i open the build release with Admin right, it will insta crash the Client.exe but continue working on stealth.

If you are shocked by the code structure, all tips will be welcome, I have never done anything like this before.

My goal is to learn and share, each advice received will allow me to evolve and share my achievements on the forum.
Should be reported to Vizit0r as best. He can prolly fix the issue. First i thought you mean an assembly issue, but that would crash the application not client.exe. I will check if i can reproduce it. Do you use the latest SDK-Build from my repo?

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: +559
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Magery Trainer
« Reply #4 on: December 21, 2017, 11:32:23 PM »
+1
yes, i can reoppen it just after without bug and see the work doing.
Well your char doesnt disconnect, means it will still perform the script and all regardless if client.exe is running or not.

Edit : Finally found the Edit button...

Your code looks good, but did   PlayerMobile.Skills.Magery.Value and PlayerMobile.Skills.Magery.Cap not working? SDK is designed that you can ignore all exposed Stealth.XXX functions at upmost.

Reminds me to work further on scriptsdk.com next year.. Job change will give 20 hours a week more freetime...
« Last Edit: December 21, 2017, 11:37:50 PM by Crome969 »

Offline Papang-Topic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • Papang- has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Magery Trainer
« Reply #5 on: December 22, 2017, 04:12:49 AM »
+1
Crome969,
I'm using the latest ScriptSDK from the git and compiledit.
About PlayerMobile.Skills.Magery.Value  and PlayerMobile.Skills.Magery.Cap,  i switched to Me.Skills.Magery.Cap & Value and it's worked as intented :)

Maybe the crash is due of some corruptions with "UO files", maybe i must take a look or build an environment only dedicated for Ultima Online coding. I will work on this next week-end, have to prepair Xmas with family :)

By the way, Mery X-mas to the team hehe.

Post Merge: December 22, 2017, 04:51:01 AM
Another question, for medit i have to use Me.UseSkill(ScriptSDK.Data.SkillName.Meditation) instead Me.UseSkill("Meditation").
There is an missing info on SDK or i did something wrong?
« Last Edit: December 22, 2017, 04:51:01 AM by Papang- »

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: +559
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Magery Trainer
« Reply #6 on: December 26, 2017, 12:05:10 PM »
+1
if i remember properly me.skills.Meditation.use() should work. If there are any bugs in that way i need reports at github about and i can check if i can fix it.

Offline Papang-Topic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • Papang- has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Magery Trainer
« Reply #7 on: December 27, 2017, 12:03:07 PM »
+1
me.skills.Meditation.use() should work.

 :D

Tags: