Stripped ProjectAlchemy Source Code

02/09/2011 07:48 hippie#931
feel better after that one p4n :D


edit ok i finally mange to catch the proxy crashing im sure it something wrong wif my sql not sure whut any info would be helpfully thxns


[Only registered and activated users can see links. Click Here To Register...]
02/10/2011 01:45 caio bola#932
I want to make a code like:

if there is a "ITEMX" on GroundItem , return chat message "ITEMX" Dropped

anyone can helpme coding it?
02/10/2011 01:48 argon69#933
Quote:
Originally Posted by pro4never View Post
the ONLY jump type is 137. No other general data subtypes should be being sent to the server. Unless of course you're trying to create a bot that does some other interesting things but not related to normal botting gameplay.



That all depends on how you code the bot lol! Depending on how you control your delays and how you link up delays (are you putting a delay after jumping before you attack again? or just a certain time after last attack? etc) then you can modify the speeds greatly. It also changes based on server latency.

Seeing as the bot I released contains NO botting functionality how on earth would I be able to tell you what settings you should be using for bot code you should be writing yourself? ^^
Thanks P4N. I finally got it working. I won't try to bother you on IM with bot related. I will only chat with you with other stuff :)
02/10/2011 02:30 denominator#934
Might seem a little off topic but at the same time it isn`t lol. In C# in the error list is the most important error the first error shown? I`m rewatching video tutorials of C# again and will continue until I can get my head around it but can`t exactly ask the author of the videos. There seems so far to be far to many uses of the word method >.<

Console.Writeline with writeline being the method. But then he says Static void Main(string[] args) is also a method >.< To much method lmfao.
02/10/2011 03:35 argon69#935
Quote:
Originally Posted by denominator View Post
Might seem a little off topic but at the same time it isn`t lol. In C# in the error list is the most important error the first error shown? I`m rewatching video tutorials of C# again and will continue until I can get my head around it but can`t exactly ask the author of the videos. There seems so far to be far to many uses of the word method >.<

Console.Writeline with writeline being the method. But then he says Static void Main(string[] args) is also a method >.< To much method lmfao.
Well. Any program is a big function starts from main. It doesn't matter C, C#, or Java. Function has begin and end. Function calls different function but it comes back to caller function :) Hehe, function = method. What about thread !!?! deserted function?
02/10/2011 03:55 pro4never#936
Quote:
Originally Posted by denominator View Post
Might seem a little off topic but at the same time it isn`t lol. In C# in the error list is the most important error the first error shown? I`m rewatching video tutorials of C# again and will continue until I can get my head around it but can`t exactly ask the author of the videos. There seems so far to be far to many uses of the word method >.<

Console.Writeline with writeline being the method. But then he says Static void Main(string[] args) is also a method >.< To much method lmfao.
In that case Main is a method/function.


As argon said... basically everything in programming is going to be a method.

NOTE: this is not really true as you have classes, structs, etcetcetc. These objects are very important.

So what's a method? A method is something that... 'does something'. A method is a section of code which you call when you want a specific thing to happen. This could be anything from, writing something to the console (WriteLine("text");) to your own more complex functions.... say a NextPointInPath(CurrentLocation, TargetLocation);.


As for the questions on threads... That is something that's both simple to explain yet not exactly a simple topic.

By default a program has it's one main thread... This is the thread that runs the Main() argument. A thread can be thought of a little bit like a processor. It can do one thing at a time and one thing only... If you tell a thread to wait... it can't perform any other action until it's done waiting (thread.sleep(X);).

When you create a new thread you allow certain actions to be calculated by the server at the same time.

For example in this proxy I create 2 threads per client as they connect.

Thread 1: Packet thread runs through the packet queue and sends the packets to the server or client. This thread loops incredibly fast to ensure that all packets are being sent in a timely manner

Thread 2: Botting thread runs through your botting code to control any AI/Actions you want the bot to do for your character. The thread loops fairly quickly so that even fast actions can continue to occur (IE: Fast fatal strike)

By spawning these new threads you can avoid worrying about stopping a thread which will then say... stop packets from being sent to the correct place.

There's way, way, way more to threads but that's essentially it... a thread is a single line of processing. More threads = more single lines of processing. Keep in mind your computer can technically only run 1 thread per cpu core at a time... not that you'll really notice that as cpu's cycle incredibly quickly.
02/10/2011 04:29 denominator#937
Yup just decided to watch the method part of the video, the guy is using a car as an example as to how things work. I`m still hazy on it all so as I said I will watch and watch and watch. Can`t believe it took me around an hour to get the majority concept of PHP and directing to different folders etc where as this is stumping the crap out of me still.

Some of it I get but some of it I am still scratching my head lol. Practise makes perfect though so I`m sure one day I will grasp it :)
02/11/2011 04:40 hippie#938
yay me i finally got it 2 log in :D now 2 work on reading C# tuts :D

btw has anyone seen OELABOELA i hope he hasnt gone insane wif all the newbs screaming about his bot
02/11/2011 07:23 caio bola#939
[quote]
Quote:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlchemyProxy
{
public partial class Handler
{
public static void COut(string Out)
{
Console.WriteLine(Program.ProxyTitle + " " + Out);
}
public static bool IsOre(uint ID)
{
if (ID >= 1072010 && ID <= 1072052)
return true;
else return false;
}
public static Mob GetClosestMonster(Client C)
{
Mob ToReturn = null;
int Dist = 18;
if (C.InFatalStrike)
{
Dist = 18;
}
else
{
Dist = 7;
}
foreach (Mob M in C.LocalMobs.Values)
{
if (Calculations.Distance(C.X, C.Y, M.X, M.Y) < Dist)
{
ToReturn = M;
Dist = Calculations.Distance(C.X, C.Y, M.X, M.Y);
if (Dist < 2)
break;
}
}
return ToReturn;
}
public static bool NewBot(Client C)
{
if (!C.Hunting)
return true;
{
Mob Attack = GetClosestMonster(C);
if (Attack != null)
{
if (C.LastJump.AddMilliseconds(C.JumpSpeed) < DateTime.Now)
{
Packets.CliJump(Attack.X, Attack.Y, 156, C);
Handler.Chat(C, " ", 2008);
C.X = Attack.X;
C.Y = Attack.Y;
C.UpdatedX = C.X;
C.UpdatedY = C.Y;
Calculations.UpdateLocal(C);
C.LastJump = DateTime.Now;
}
else if (C.LastAttack.AddMilliseconds(C.AttackSpeed) < DateTime.Now)
{
Calculations.ShiftTarget(Attack);
Packets.AtkServer(C, Attack, 2);
C.X = Attack.X;
C.Y = Attack.Y;
C.UpdatedX = C.X;
C.UpdatedY = C.Y;
Calculations.UpdateLocal(C);
Handler.Chat(C, " " + Attack.Name, 2008);
C.LastAttack = DateTime.Now;
}
}
Mob M = GetClosestMonster(C);
if (M == null)
{
RandomJump(C);
}
int Dist = Calculations.Distance(C.X, C.Y, M.X, M.Y);
if (Dist < 2)
{
if (DateTime.Now > C.LastAttack.AddMilliseconds(C.AttackSpeed))
{
Packets.AtkServer(C, M, 2);
}
else
{
if (DateTime.Now > C.LastJump.AddMilliseconds(C.JumpSpeed))

return true;
if (C.InFatalStrike && DateTime.Now > C.FatalStrikeActivated.AddSeconds(58))
{
C.InFatalStrike = false;
}

}

}
return true;
}
}






private static void RandomJump(Client C)
{
Random random = new Random();
Coord XY = new Coord();
XY.X = (ushort)(C.X + random.Next(-18, 18));
XY.Y = (ushort)(C.Y + random.Next(-18, 18));
if (Calculations.ValidDmap(C.StaticMap, XY.X, XY.Y))
{
Packets.CliJump(XY.X, XY.Y, 156, C);
Packets.Jump(C, XY.X, XY.Y, 137);
Packets.CliJump(XY.X, XY.Y, 156, C);
C.X = XY.X;
C.Y = XY.Y;
C.UpdatedX = XY.X;
C.UpdatedY = XY.Y;
System.Threading.Thread.Sleep(C.JumpSpeed);
C.LastJump = DateTime.Now;
}
}
}
}
Im getting some buggy

Sometimes , during hunting , the character moves to the local , but it doesnt update
so I cant see any mobs or items , but the mobs can see and hit me.

Anyone can give a help here?
02/11/2011 16:18 denominator#940
Ok I`m a little confused I have managed to get it to do /mining without the need to write /hunt first but now when I attempt /hunt the char just stands there? I have tried a few things so far including while (C.RunBot)

Code:
public static bool NewBot(Client C)
        {
            if (C.RunBot)
            {
                if (!C.Mining)
                    return true;

                if (C.LastDropped.AddSeconds(15) < DateTime.Now)
                {
                    foreach (Items.ItemInfo I in C.Inventory.Values)
                    {
                        if (Handler.IsOre(I.ID))
                        {
                            C.LastDropped = DateTime.Now;
                            Packets.DropItem(C, I.UID);
                            break;
                        }
                    }
                }
                else
                {
                    if (C.RunBot)
                    {
                        if (!C.Hunting)
                            return true;


                        Mob attack = GetClosestMonster(C);
Code:
public static bool NewBot(Client C)
        {
            while (C.RunBot)
            {
                if (!C.Mining)
                    return true;

                if (C.LastDropped.AddSeconds(15) < DateTime.Now)
                {
                    foreach (Items.ItemInfo I in C.Inventory.Values)
                    {
                        if (Handler.IsOre(I.ID))
                        {
                            C.LastDropped = DateTime.Now;
                            Packets.DropItem(C, I.UID);
                            break;
                        }
                    }
                }
                else
                {
                  //  while (C.RunBot)
                  //  {
                        if (!C.Hunting)
                            return true;
02/11/2011 16:58 pro4never#941
Warning you now... don't do two near infinite loops inside the same code... it's very poor practice

While(X)
{
While (X)
{
}
}
02/11/2011 17:08 denominator#942
Yup the one is not actually coded in its been // Wouldn`t make much sense to me to have two whiles anyway lol
02/11/2011 17:53 DeathByMoogles#943
Dropped by here to check in.

If any active developers want some free accounts, I'm happy to give them.
I think I have a ninja and a warrior on Dark that are both around level 100-110

Just send me a PM sometime.
(No noobs.)
02/13/2011 02:11 caio bola#944
p4n , you said we dont need to use 156 jump at all

i want to know whats the difference between CliJump and Jump , packets

And what jump( clijump or jump) and typ ( 156 or 137 ) i should use in my hunt code , including randomjump code.
02/13/2011 05:45 argon69#945
Quote:
Originally Posted by caio bola View Post
p4n , you said we dont need to use 156 jump at all

i want to know whats the difference between CliJump and Jump , packets

And what jump( clijump or jump) and typ ( 156 or 137 ) i should use in my hunt code , including randomjump code.
clijump is for Client refresh. Let's say, your bot is sitting in between Client and TQ server. When you use jump, the proxy is commnuicating with TQ server. When you use clijump, you are telling your co client to refresh that location. As P4N said, if you refresh your client at fast rate, it will crash :)