Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - smitty

Pages: [1] 2
1
Stealth Client / [C#] send texts
« on: December 10, 2017, 08:03:12 PM »
Hello everyone!
I did some research and found some code to send text messages, after some reworking, I wrote this class.
figured i would share what i have learned.

Code: [Select]
using System;
using System.Net;
using System.Net.Mail;

namespace Hunter
{
    public class Communicator
    {
        private string _sender;
        private string _password;
        private long _telephoneNumber;
        private string _gateWay;
        private string _recipient;

        //list of gateways
        //https://en.wikipedia.org/wiki/SMS_gateway

        public Communicator(string sender, string password, long telephoneNumber, string gateWay)
        {
            _sender = sender;
            _password = password;
            _telephoneNumber = telephoneNumber;
            _gateWay = gateWay;
            _recipient = string.Concat(new object[] { _telephoneNumber, '@', _gateWay });
        }

        public void sendTxtMsg(string subject, string message)
        {
            using (MailMessage textMessage = new MailMessage(_sender, _recipient, subject, message))
            {
                using (SmtpClient textmessageClient = new SmtpClient("smtp.gmail.com", 587))
                {
                    textmessageClient.UseDefaultCredentials = false;
                    textmessageClient.EnableSsl = true;
                    textmessageClient.Credentials = new NetworkCredential(_sender, _password);
                    Console.WriteLine("attempting to send sms...");
                    textmessageClient.Send(textMessage);
                }
            }
        }
    }
}

I made a separate gmail account and configured the account to "Let less secure apps use your account"
So when you make the communicator object, do something like this
Code: [Select]
Communicator textSender = new Communicator("SeperateEmail@gmail.com", "passWrdToSeperateEmail", 1238675309, "gatewayToCellCarrier.com");
textSender.sendTxtMsg("[TEST]","Testing...");
The first parameter is the new email that was created that is SENDING the msg
The second parameter is the password to the newly created email
The third parameter is the phone number that you want to receive the texts
The fourth parameter is the gateway. a list of gateways can be found in the class above.

2
Stealth Client / Re: c# and multi-threading
« on: December 07, 2017, 09:29:10 PM »
Ooooo! look at me learnin things!!! I think i have solved the problem with a Mutex. One of the coolest words i have ever heard!

3
Stealth Client / Re: c# and multi-threading
« on: December 07, 2017, 08:09:33 PM »
okidoki
heres the main loop
Code: [Select]
            aHealer.Start();
            mTracker.Start();
            while(hunting)
            {
                //check weight
                if(player.Weight >= player.Maxweight - 10)
                {
                    var gold = Scanner.Find<Item>(typeof(items.gold), player.Backpack.Serial.Value, true);
                    if(gold.Count > 0)
                    {
                        Console.WriteLine("Sending gold...");
                        bos.useBag(gold[0]);
                    }
                }
                if(player.Hits < player.MaxHits)
                {
                    mTracker.Pause();
                    while(player.Hits < player.MaxHits)
                    {
                        //wait
                    }
                    mTracker.Resume();
                }
                if (myPet.Hits < (myPet.MaxHits - 5))
                {
                    mTracker.Pause();
                    while(myPet.Hits <  myPet.MaxHits)
                    {
                        //wait till pet is at fill health
                        player.Cast("heal");
                        player.Targeting.WaitForTarget(1500);
                        player.Targeting.TargetTo(myPet.Serial);

                    }
                    mTracker.Resume();
                }
                //check position
                //if(player.Location.X != startLocX && player.Location.Y != startLocY)
                //{
                //    player.Movement.MoveXY((ushort)startLocX, (ushort)startLocY, true, 1, true);
                //}
            } 

And heres the main part of my monster attacker thread
Code: [Select]
       private void attack(enemy item)
        {
            while(!_cancel && item.Hits > 0)
            {
                if (petKill && item.isAllKilled == false)
                {
                    if (Stealth.Client.ClientTargetResponsePresent() == true)
                        Stealth.Client.CancelTarget();
                    //uses pet
                    //Stealth.Client.SendTextToUO("All kill");
                    player.SendText("All kill", 0);
                    allKillRetical = true;
                    player.Targeting.WaitForTarget(1500);
                    player.Targeting.AutoTargetTo(item.Serial);
                    allKillRetical = false;
                    item.isAllKilled = true;
                }
                if (necroKill && item.isCorpsed == false)
                {
                    if (Stealth.Client.ClientTargetResponsePresent() == true)
                        Stealth.Client.CancelTarget();
                    player.Cast("corpse skin");
                    player.Targeting.WaitForTarget(1500);
                    player.Targeting.TargetTo(item.Serial);
                    item.isCorpsed = true;
                }
                if (mageryKill)
                {
                    if (Stealth.Client.ClientTargetResponsePresent() == true)
                        Stealth.Client.CancelTarget();
                    //uses eBolt
                    player.Cast("fireball");
                    player.Targeting.WaitForTarget(1500);
                    player.Targeting.TargetTo(item.Serial);
                }
            }
        }

and heres the main part of my heal thread

Code: [Select]
        public void HealOnce()
        {
           
            if (Stealth.Client.GetDeadStatus())
            {
                return;
            }
           
            //_ct = new CancellationTokenSource();
            if (player.Hits < player.MaxHits)
            {
                Console.WriteLine($"[Information] healonce");
                if (Stealth.Client.ClientTargetResponsePresent() == true)
                    Stealth.Client.CancelTarget();
            }
            else
            {
                //_sendConsoleMessage?.Invoke("No need in heals");
                return;
            }

            Stealth.Client.ClilocSpeech += Client_ClilocSpeech;

            //=================================================================================================================
            //if using magery
            if(useMageryHeal)
            {
                if(player.MaxMana > 5)
                {
                    player.Cast("heal");
                    player.Targeting.WaitForTarget(1500);
                    player.Targeting.TargetTo(targ.Serial);
                }
                else
                {
                    Console.WriteLine("[Error] Not enough mana!");
                    return;
                }

            }
            //==================================================================================================================
        }

hope this is enough!

4
Stealth Client / c# and multi-threading
« on: December 07, 2017, 07:32:43 PM »
im back with another question!
So i have been messing around with multi-threading with a hunter script for stealth. I have an autoHealer thread, and a monsterAttacker thread. Im having problems with the two not working together. If my character starts getting low on health, he will stop attacking the monster(I pause the monster attacker thread), but when i get healed back to full health and resume the monster attacker thread, i start attacking myself ( I have died many times haha). suggestions? Im thinkin multi-threading is not the way to go  :\'(

5
Stealth Client / Re: [c# and scriptSDK] looting
« on: December 06, 2017, 03:04:55 PM »
Well I am doing everything I can do to learn. Suggest some things for me and ill take a look at things i can try to share!

Also... I've been working on some stuff in my free time, and i think i am starting to really get the hang of this looting stuff! I am running into a slight error though
this is the body of my loot function:
Code: [Select]
            var itemsInCorpse = Scanner.Find<Item>(LootTypes, corpse.Serial.Value, true);
            if(!(itemsInCorpse.Count < 1))
            {
                for (int i = 0; i < itemsInCorpse.Count; i++)
                {
                    if (itemsInCorpse[i] == null)
                        continue;
                    _messanger.Invoke($"looting {itemsInCorpse[i].Serial.Value}");
                    if (itemsInCorpse[i].Amount > 0)
                    {
                        //moving stackable items
                        _messanger.Invoke($"looting {itemsInCorpse[i].Amount}");
                        itemsInCorpse[i].MoveItem(_player.Backpack, itemsInCorpse[i].Amount);
                        Stealth.Client.Wait(900);
                    }
                    else
                    {
                        //moving single item
                        itemsInCorpse[i].MoveItem(_player.Backpack);
                    }
                    Stealth.Client.Wait(1000);
                }
            }

Im running into a warning in the StealthClient.cs file while running in debug mode on line 243: packet = _replyes.Dequeue();
after each item looted i get this warning. When i view the details, its saying that the queue is empty

An unhandled exception of type 'System.InvalidOperationException' occurred in System.dll
details: {"Queue empty."}

forgot to mention i am using stealth v8.5.4

6
Stealth Client / Re: [c# and scriptSDK] looting
« on: December 01, 2017, 01:53:13 PM »
Currently working on something that fully automates all parts of trans powder / bags of sending / zoogi collecting. Future plans for doom gauntlet automation. I wrote the gauntlet script for easyuo ...  stealth can make it much much nicer, I just have to learn everything about stealth (dont know that ill release any of these) heheh.

7
Stealth Client / Re: [c# and scriptSDK] looting
« on: November 27, 2017, 03:54:19 PM »
OH MY GOD I JUST MOVED ITEMS FROM A CORPSE INTO MY BACKPACK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

8
Stealth Client / Re: [c# and scriptSDK] looting
« on: November 27, 2017, 03:34:39 PM »
The way i understood it from drabadans autokiller, Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, corpseId, true); is searching the corpse for all items, then using a foreach loop to check each item and see if it matches any items in the lootTypes list
thanks for working with me to understand this. I really appreciate the help!

9
Stealth Client / Re: [c# and scriptSDK] looting
« on: November 27, 2017, 03:20:44 PM »
Code: [Select]
        public bool MoveItem(uint itemId, int count, uint moveIntoId, int x, int y, int z)
        {
            if (DragItem(itemId, count))
                return DropItem(moveIntoId, x, y, z);
            return false;
        }

I have a list of uints representing items that i want to loot, we will use Zoogi as an example. The way that i thought you would look for the item is by using 0x26B7. So I added 0x26B7 into the list. Then down in the loot function i have
Code: [Select]
            Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, corpseId, true);
            var itemsFound = Stealth.Client.GetFindList();
            if (itemsFound.Count < 1)
            {
                _messanger.Invoke($"Nothing found in container");
                Stealth.Client.Ignore(corpseId);
                lootingQueue.Remove(corpseId);
                return;
            }
               
            _messanger.Invoke($"looting..." + itemsFound.Count);
            foreach (var item in itemsFound)
            {
                bool transfer = false;

                //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                if (LootTypes.Contains(Stealth.Client.GetType(item)))
                {
                    _messanger.Invoke($"loot type not in list");
                    transfer = true;
                }
                //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            .
            .
            .
            .
                if (transfer)
                {
                    ct = new CancellationTokenSource();
                    _currMovingItem = item;
                    _messanger.Invoke($"attempting loot item");

                    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                    //try to make item into an Item
                    Item thisItem = new Item(item);
                    thisItem.MoveItem(backpack);
                    //^^^^^^^^^^^^^^^^^^^^^

                    //Stealth.Client.MoveItem(item, 0, _backpackId, 0, 0, 0);
                }
Maybe im getting confused about what uint itemId is...

10
Stealth Client / [c# and scriptSDK] looting
« on: November 25, 2017, 11:00:05 PM »
Hello again!!!
I have a very interesting project that starting to really come together! I am having a real issue with looting certain items from containers (corpses or secures)
does anyone have a class or some examples for looting?
p.s. sorry for 2 posts in a row.


update:
ok after spending a lot of time on this, this is what i have found from my own script, and drabadans autokiller:
so it looks like drabadan uses this event handler to loot the container.
Code: [Select]
        private async void Client_DrawContainer(object sender, DrawContainerEventArgs e)
        {
            if(e.ModelGump == 9)
            {
                await Loot(e.ContainerId);
            }
        }

down in loot the loot function is where im running into issues...
Code: [Select]
        private async Task Loot(uint corpseId)
        {
            Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, corpseId, true);
            var itemsFound = Stealth.Client.GetFindList();

            foreach(var item in itemsFound)
            {
                bool transfer = false;
                if (LootTypes.Contains(Stealth.Client.GetType(item)))
                {
                    transfer = true;
                }

                if (!transfer)
                {
                    var tooltip = Stealth.Client.GetTooltip(item);
                    foreach(var tooltipValue in LootTooltipValues)
                    {
                        if (tooltip.ToLower().Contains(tooltipValue.ToLower()))
                        {
                            transfer = true;
                            break;
                        }
                    }
                }

                if(transfer)
                {
                    ct = new CancellationTokenSource();
                    _currMovingItem = item;
                    await Task.Delay(1000);
                   
                    //Does not really seem to move items...
                    Stealth.Client.MoveItem(item, 0, _backpackId, 0, 0, 0);
                    try
                    {
                        await Task.Delay(5000, ct.Token);
                    }
                    catch (TaskCanceledException) { }
                }
            }

            lootingQueue.Remove(corpseId);
        }


11
Stealth Client / sending a parameter to a form
« on: November 25, 2017, 06:07:59 PM »
Hey there!!!!
So I have been dissecting Drabadan's Auto killer script, and it looks amazing!!! ive been basing my own project off of this script! i do have two questions that i cant really figure out on my own. throughout the script Drabadan sends Action<string> messanger around to a lot of different places.

My questions:
1) What is the Action<string> messanger accomplishing.
2) It appears the shell constructor is taking a parameter... Where is that getting sent from?
 
Code: [Select]
public Shell(Action<string> messanger)
        {
            InitializeComponent();
            _messanger = messanger;
        }

12
Stealth Client / Re: mobile proximity
« on: June 30, 2016, 03:08:18 PM »
Oooo! all of that sounds fun =] I think after i get the script running like i want it to, Ill add multi threading (dont know how to do that just yet). I actually forgot to post my question about the auto wither thing above. My character will cast wither as soon as Somethings name is on the screen. I dont know how to lower the search radius. I thought i did with
Code: [Select]
Stealth.Client.SetFindDistance(2);
Stealth.Client.SetFindVertical(0);
but it doesnt seem to change search area.

Also, I have SDK.Initialize(); happening for every point in a rail that i made. Should i change that? Something tells me that SDK.Initialize(); should happen once, But hey im still learning =]

13
Stealth Client / mobile proximity
« on: June 29, 2016, 05:24:26 PM »
Hello! i feel like a crazy person with all these posts I be posting hehe. Anyways, I am working on something that will auto wither
heres my code:

Code: [Select]
for (int i = 0; i < Rail.Count(); i++)
            {
                if (Player.Hits != Player.MaxHits)
                {
                    healSelf(Player);
                }
                advancePosition(Player, Rail.ElementAt(i));
                SDK.Initialize();
                Stealth.Client.SetFindDistance(2);
                Stealth.Client.SetFindVertical(0);
                somethings = Scanner.Find<Something>(0x0, false).OrderBy(x => x.Distance).ToList();
                foreach (Something m in somethings)
                {
                   Player.Cast("Wither");
                   Thread.Sleep(1000);
                   if (Player.Hits != Player.MaxHits)
                   {
                      healSelf(Player);
                   }
                }
                if(somethings.Count == 0)
                {
                    continue;
                }
            }

dont judge if this is terribly wrong! im learning =]

14
Stealth Client / Re: [C#] rails
« on: June 26, 2016, 11:58:20 AM »
Thank you =]. I now have a functioning rail!!!!! you guys rock.

15
Stealth Client / Re: [C#] rails
« on: June 25, 2016, 08:57:48 PM »
So heres a good question. Does moveXYZ have some type of wait built into it to stop executing the script until character is at designated location?

Pages: [1] 2