Recent Posts

Pages: [1] 2 3 ... 10
1
Stealth Client / [C#] send texts
« Last post by smitty 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: [debug] Statistics
« Last post by Crome969 on December 09, 2017, 10:32:55 PM »
Hey my friend! If you have skype, hit me up later on.. i dont use icq lately. I can help you figure out a a way.

As startup to think about it is you need a start time and a current time.
Then you should figure out, if there are functions that gives you a timespan or not.
Idea 1 :

Pseudo function 1
Code: [Select]
TimeA : TDatetime;
begin
TimeA := Now;

while((Now - TimeA) < 1) do  <----------- Here we get a timespan in form of a date and need to parse
begin

end;
end;


Idea 2 :

Code: [Select]
Hour_1 : Cardinal;

TimeA : Cardinal;

Hour_1 := 3600 * 1000; //Reflects a hour

TimeA := GetTicks() + Hour_1;

if(TimeA > GetTicks()) then
begin
    // 1 hour has passed..
end;

I guess you get it. All pseudo.. had not runned stealth for a while..


3
Stealth Client / Re: [debug] Statistics
« Last post by camotbik on December 09, 2017, 04:11:29 AM »
I got my own mining script on EUO, that uses statistics - http://www.scriptuo.com/index.php?topic=8651.msg74785#msg74785
the part that would interest me is
Code: [Select]
  set %currenttime #scnt
  set %time %currenttime - %starttime
  set %hh %time / 3600
  set %rest1 %time % 3600
  set %minutes %rest1 / 60
  if %minutes < 10
    set %mm 0 , %minutes
  else
    set %mm %minutes
  set %seconds %rest1 % 60
  if %seconds < 10
    set %ss 0 , %seconds
  else
    set %ss %seconds
  set %runtime %hh , h , : , %mm , m , : , %ss , s
  menu set runtime %runtime
  set %oph ( %counter_ore * 3600 ) / %time

I was trying to achieve the same in pascal, but the lack of knowledge got me stuck.
4
Stealth Client / Re: [debug] Statistics
« Last post by The Ghost on December 09, 2017, 03:58:25 AM »
On top my head I know two script that use stat

First :  FaF from TM .  It tel you how lot of stat per Hr, Sea serpent, Net, pearls. 
Second is MWinc, have a lumber and Miner script.  Both give you a average /per and also tell you % ratio.   

Have a look at those two, maybe you can see where you went wrong.
5
Stealth Client / [debug] Statistics
« Last post by camotbik on December 09, 2017, 01:40:53 AM »
Hello to everyone.

I'm having a problem with creating statistics. I just cannot figure out and implement proper way to get PER HOUR stats. Check the stuf I got, maybe you can think of something.

Code: [Select]
Procedure Statistics_Global_innit;
begin
  Ore_Iron :=        0;
  Ore_OldCopper :=   0;
  Ore_Copper :=      0;
  Ore_Bronze :=      0;
  Ore_Rose :=        0;
  Ore_Shadow :=      0;
  Ore_Silver :=      0;
  Ore_Golden :=      0;
  Ore_Verite :=      0;
  Ore_Valorite :=    0;
  Ore_Marble :=      0;
  Ore_Ice :=         0;
  Ore_BloodRock :=   0;
  Ore_Mytheril :=    0;
  Ore_Amethyst :=    0;
  Ore_Dwarven :=     0;
  Ore_Steel :=       0;
  Ore_SunStone :=    0;
  Ore_BlackRock :=   0;
  Ore_Fire :=        0;
  Ore_Wizzard :=     0;
  Ore_DaemonSteel := 0;
  Ore_Crusader :=    0;
  Ore_Reactive :=    0;
  Ore_Sapphire :=    0;
  Ore_MoonRock :=    0;
end;


Procedure Statistics_Global_Update;
begin
  if GetColor(finditem) = $0000 then Ore_Iron := (Ore_Iron + GetQuantity(finditem));
  if GetColor(finditem) = $0487 then Ore_OldCopper := (Ore_OldCopper + GetQuantity(finditem));
  if GetColor(finditem) = $096D then Ore_Copper := (Ore_Copper + GetQuantity(finditem));
  if GetColor(finditem) = $0972 then Ore_Bronze := (Ore_Bronze + GetQuantity(finditem));
  if GetColor(finditem) = $0B84 then Ore_Rose := (Ore_Rose + GetQuantity(finditem));
  if GetColor(finditem) = $0496 then Ore_Shadow := (Ore_Shadow + GetQuantity(finditem));
  if GetColor(finditem) = $0497 then Ore_Silver := (Ore_Silver + GetQuantity(finditem));
  if GetColor(finditem) = $0494 then Ore_Golden := (Ore_Golden + GetQuantity(finditem));
  if GetColor(finditem) = $089F then Ore_Verite := (Ore_Verite + GetQuantity(finditem));
  if GetColor(finditem) = $08AB then Ore_Valorite := (Ore_Valorite + GetQuantity(finditem));
  if GetColor(finditem) = $0B91 then Ore_Marble := (Ore_Marble + GetQuantity(finditem));
  if GetColor(finditem) = $047F then Ore_Ice := (Ore_Ice + GetQuantity(finditem));
  if GetColor(finditem) = $04C2 then Ore_BloodRock := (Ore_BloodRock + GetQuantity(finditem));
  if GetColor(finditem) = $052D then Ore_Mytheril := (Ore_Mytheril + GetQuantity(finditem));
  if GetColor(finditem) = $0705 then Ore_Amethyst := (Ore_Amethyst + GetQuantity(finditem));
  if GetColor(finditem) = $0794 then Ore_Dwarven := (Ore_Dwarven + GetQuantity(finditem));
  if GetColor(finditem) = $07A1 then Ore_Steel := (Ore_Steel + GetQuantity(finditem));
  if GetColor(finditem) = $0A0A then Ore_SunStone := (Ore_SunStone + GetQuantity(finditem));
  if GetColor(finditem) = $047E then Ore_BlackRock := (Ore_BlackRock + GetQuantity(finditem));
  if GetColor(finditem) = $09EF then Ore_Fire := (Ore_Fire + GetQuantity(finditem));
  if GetColor(finditem) = $09AD then Ore_Wizzard := (Ore_Wizzard + GetQuantity(finditem));
  if GetColor(finditem) = $0493 then Ore_DaemonSteel := (Ore_DaemonSteel + GetQuantity(finditem));
  if GetColor(finditem) = $0A2E then Ore_Crusader := (Ore_Crusader + GetQuantity(finditem));
  if GetColor(finditem) = $07A5 then Ore_Reactive := (Ore_Reactive + GetQuantity(finditem));
  if GetColor(finditem) = $07AB then Ore_Sapphire := (Ore_Sapphire + GetQuantity(finditem));
  if GetColor(finditem) = $0B80 then Ore_MoonRock := (Ore_MoonRock + GetQuantity(finditem));
end;

Procedure Statistics_Global_Write;
begin
  If Ore_Iron <> 0 then AddToSystemJournal('Iron ' + IntToStr(Ore_Iron) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Iron * 360)));
  If Ore_OldCopper <> 0 then  AddToSystemJournal('Old Copper ' + IntToStr(Ore_OldCopper) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_OldCopper * 3600)));
  If Ore_Copper <> 0 then  AddToSystemJournal('Copper ' + IntToStr(Ore_Copper) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Copper * 360)));
  If Ore_Bronze <> 0 then  AddToSystemJournal('Bronze ' + IntToStr(Ore_Bronze) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Bronze * 360)));
  If Ore_Rose <> 0 then  AddToSystemJournal('Rose ' + IntToStr(Ore_Rose) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Rose * 360)));
  If Ore_Shadow <> 0 then  AddToSystemJournal('Shadow ' + IntToStr(Ore_Shadow) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Shadow * 360)));
  If Ore_Silver <> 0 then  AddToSystemJournal('Silver ' + IntToStr(Ore_Silver) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Silver * 360)));
  If Ore_Golden <> 0 then  AddToSystemJournal('Golden ' + IntToStr(Ore_Golden) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Golden * 360)));
  If Ore_Verite <> 0 then  AddToSystemJournal('Verite ' + IntToStr(Ore_Verite) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Verite * 360)));
  If Ore_Valorite <> 0 then  AddToSystemJournal('Valorite ' + IntToStr(Ore_Valorite) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Valorite * 360)));
  If Ore_Marble <> 0 then  AddToSystemJournal('Marble ' + IntToStr(Ore_Marble) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Marble * 360)));
  If Ore_Ice <> 0 then  AddToSystemJournal('Ice ' + IntToStr(Ore_Ice) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Ice * 360)));
  If Ore_BloodRock <> 0 then  AddToSystemJournal('Blood Rock ' + IntToStr(Ore_BloodRock) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_BloodRock * 360)));
  If Ore_Mytheril <> 0 then  AddToSystemJournal('Mytheril ' + IntToStr(Ore_Mytheril) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Mytheril * 360)));
  If Ore_Amethyst <> 0 then  AddToSystemJournal('Amethyst ' + IntToStr(Ore_Amethyst) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Amethyst * 360)));
  If Ore_Dwarven <> 0 then  AddToSystemJournal('Dwarven ' + IntToStr(Ore_Dwarven) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Dwarven * 360)));
  If Ore_Steel <> 0 then  AddToSystemJournal('Steel ' + IntToStr(Ore_Steel) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Steel * 360)));
  If Ore_SunStone <> 0 then  AddToSystemJournal('Sun Stone ' + IntToStr(Ore_SunStone) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_SunStone * 360)));
  If Ore_BlackRock <> 0 then  AddToSystemJournal('Black Rock ' + IntToStr(Ore_BlackRock) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_BlackRock * 360)));
  If Ore_Fire <> 0 then  AddToSystemJournal('Fire ' + IntToStr(Ore_Fire) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Fire * 360)));
  If Ore_Wizzard <> 0 then  AddToSystemJournal('Wizzard ' + IntToStr(Ore_Wizzard) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Wizzard * 360)));
  If Ore_DaemonSteel <> 0 then  AddToSystemJournal('Daemon Steel ' + IntToStr(Ore_DaemonSteel) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_DaemonSteel * 360)));
  If Ore_Crusader <> 0 then  AddToSystemJournal('Crusader ' + IntToStr(Ore_Crusader) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Crusader * 360)));
  If Ore_Reactive <> 0 then  AddToSystemJournal('Reactive ' + IntToStr(Ore_Reactive) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Reactive * 360)));
  If Ore_Sapphire <> 0 then  AddToSystemJournal('Sapphire ' + IntToStr(Ore_Sapphire) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_Sapphire * 360)));
  If Ore_MoonRock <> 0 then  AddToSystemJournal('MoonRock ' + IntToStr(Ore_MoonRock) + ' // Per Hour ' + IntToStr((((timer - t))) / (Ore_MoonRock * 360)));
  AddToSystemJournal('-----------------------------------------');
end;

The stats I get are totally wrong and insane.
Code: [Select]
12:39:25:074 [-]: Iron 118 // Per Hour 9502
12:39:25:078 [-]: Old Copper 8 // Per Hour 14015
12:39:25:083 [-]: Copper 7 // Per Hour 160179
12:39:25:087 [-]: Bronze 7 // Per Hour 160179
12:39:25:091 [-]: Rose 12 // Per Hour 93438
12:39:25:095 [-]: Shadow 14 // Per Hour 80089
12:39:25:099 [-]: Silver 56 // Per Hour 20022
12:39:25:102 [-]: Valorite 17 // Per Hour 65956
12:39:25:107 [-]: Marble 3 // Per Hour 373752
12:39:25:110 [-]: Ice 7 // Per Hour 160179
12:39:25:113 [-]: Blood Rock 10 // Per Hour 112125
12:39:25:117 [-]: Amethyst 6 // Per Hour 186876
12:39:25:120 [-]: Steel 4 // Per Hour 280314
12:39:25:123 [-]: Sun Stone 6 // Per Hour 186876
12:39:25:127 [-]: Black Rock 4 // Per Hour 280314
12:39:25:129 [-]: Daemon Steel 2 // Per Hour 560628
12:39:25:132 [-]: Crusader 4 // Per Hour 280314
12:39:25:136 [-]: Reactive 1 // Per Hour 1121257
12:39:25:141 [-]: MoonRock 2 // Per Hour 560628
12:39:25:144 [-]: -----------------------------------------
6
Stealth Client / Re: c# and multi-threading
« Last post by Crome969 on December 08, 2017, 01:00:13 AM »
Ive always used Backgroundworker and delegates to communicate between ui, threads, stealth.
Threads handle their own data and comunicate to a main thread. mainthread i evaluate actions and send messages to threads. No samples here since i have no code at hand as we speak.
7
Stealth Client / Re: c# and multi-threading
« Last post by smitty 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!
8
Stealth Client / Re: c# and multi-threading
« Last post by smitty 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!
9
Stealth Client / Re: c# and multi-threading
« Last post by BobOzarius on December 07, 2017, 07:35:32 PM »
haha Multi threading is always the way to go. What you need to do is show code. You're just doing something incorrectly upon returning to the attacking thread. Show your work. Or the teachers can't help.
10
Stealth Client / c# and multi-threading
« Last post by smitty 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  :\'(
Pages: [1] 2 3 ... 10