Stripped ProjectAlchemy Source Code

02/07/2011 17:46 caio bola#901
Anyone knows a fast and stable config of speed/hitstokill values ?
02/08/2011 02:27 caio bola#902
case "/hunt":
{
if (!C.RunBot)
C.RunBot = true ;
UpdateStats(C);
C.Hunting = !C.Hunting;
Chat(C, "Hunting = " + C.Hunting, 2011);
break;
}

Why it isnt stopping hunting? anybody can helpme fix this?
02/08/2011 02:51 denominator#903
It`s not a problem with the case.

Code:
public static bool NewBot(Client C)
        {
 if (C.RunBot)
            {
                
                if (!C.Hunting)
                    return true;
If you have a hunting system in place already then you need to return true after the if Hunting statement
02/08/2011 03:05 caio bola#904
public static void NewBot(Client C)
{
if (C.RunBot)

{
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))
;
if (C.InFatalStrike && DateTime.Now > C.FatalStrikeActivated.AddSeconds(58))
{
C.InFatalStrike = false;

}
}
}
}


It doesnt stop hunting...if i enter this i got error at return
if (!C.Hunting)
return true; ,
02/08/2011 03:12 denominator#905
Code:
public static void NewBot(Client C)
Should be
Code:
public static bool NewBot(Client C)
Besides that seems to be a different code to what I have or at least slightly different. A suggestion if like me you are unsure of C# would be

HTML Code:
http://cw-network.info/ebooks/6057-10-days-to-learn-visual-c-2010.html
02/08/2011 03:17 caio bola#906
Can you share your code? i appreciate
02/08/2011 03:19 denominator#907
Not my code to share besides I said it`s only slightly different to what you have otherwise it`s virtually identical.
02/08/2011 03:38 caio bola#908
so the difference is one is bool other is void

how to make the hunting stop in my code ( void ) ? anyone?
02/08/2011 03:40 argon69#909
Hmm. I will try to share something here.

if (C.RunBot && C.NewBot()) // Don't change this. This is Ok. If you have problem here, that means, you have problem in NewBot routine. Unless, if you can use interface for bot class, stick with it.

boolean NewBot(){

// break the task into groups.

// 1. If bot has to wait because of previous action, return true/false (it doesn't really matter, 2ms or 5ms sleep. I believe it is about 10ms for normal pc sleep routine.

// 2. Check for mobs near you.
// 3. If no mob found, move to next location (jump) then return;
// 4. If mob found, check distance
// 5. If inFS and distance < 18, attack then return
If !inFS and distance < 18, jump, then return
}

This is basic idea. As you see, you don't want to do complicate task all once. You can only do 1 task at a time. I hope it helps. P4N already mentioned this earlier post. He pretty much told you all. If you can't understand it, I think you can't really program...
02/08/2011 03:47 denominator#910
argon any idea what is needed so that the loot will check for other items instead of just picking one item up and jumping to next mob? I`m guessing I need a for loop or a while loop?
02/08/2011 03:52 argon69#911
Quote:
Originally Posted by denominator View Post
argon any idea what is needed so that the loot will check for other items instead of just picking one item up and jumping to next mob?
Again, if you want to add item picking logic. It has to be broken into task. You duplicate mob hunting logic. Just replace mob with item :) You can't pick up item and jump to next mob. That is bad logic. SIMPLICITY is the key. Remember 1 task at a time. Pickup item then return :)
02/08/2011 05:10 argon69#912
I have been trying to make correctcoord packet working. I kind of lost here. If you can show me how i will appreciate it :) Here is my problem. I am sending jump pack (137) followed by correctcoord. First jump has timestamp + 2000 and next has correct one. However, I am not getting 108 from server but only 137. After 7 jumps, I get dced. Actually, the server said 4 jumps. It means my correctcoord is not working.

Thanks :)
02/08/2011 06:30 pro4never#913
That's because I never said you need to SEND correct coords, I said you need to send a certain type of invalid packet that causes the SERVER to send the 108 packet. That's the one you want to find.
02/08/2011 09:52 caio bola#914
Everytime i try to run /speed jumps lower than 800 I get and 10010 error packet ( invalid jump )

anyone can helpme?

public static Mob GetClosestMonster(Client C)
{
Mob ToReturn = null;
int Dist = 18;
if (C.InFatalStrike)
{
Dist = 18;
}
else
{
Dist = 18;
}
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 void NewBot(Client C)
{
if (C.RunBot)
{
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))
;
if (C.InFatalStrike && DateTime.Now > C.FatalStrikeActivated.AddSeconds(58))
{
C.InFatalStrike = false;
if (!C.Hunting)
return;
}
}
}
}
}
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;
}
}
}
}

Its fully working but I need some help to clear the code and to solve the invalid jump ( 10010) when I try to run at faster speeds.
Also I cant make the hunt to stop , what code I need to insert in order to make it stop if hunt=false?
02/08/2011 13:46 demon17#915
Quote:
Originally Posted by caio bola View Post
Everytime i try to run /speed jumps lower than 800 I get and 10010 error packet ( invalid jump )

anyone can helpme?

public static Mob GetClosestMonster(Client C)
{
Mob ToReturn = null;
int Dist = 18;
if (C.InFatalStrike)
{
Dist = 18;
}
else
{
Dist = 18;
}
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 void NewBot(Client C)
{
if (C.RunBot)
{
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))
;
if (C.InFatalStrike && DateTime.Now > C.FatalStrikeActivated.AddSeconds(58))
{
C.InFatalStrike = false;
if (!C.Hunting)
return;
}
}
}
}
}
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;
}
}
}
}

Its fully working but I need some help to clear the code and to solve the invalid jump ( 10010) when I try to run at faster speeds.
Also I cant make the hunt to stop , what code I need to insert in order to make it stop if hunt=false?
Lol you use ninja ?

I suggest you to try to set those speeds when FS is on ..

[FS came]
/update 11 2072012001
/speed attack 60
/speed jump 80
/speed update 80
/hitstokill 1

works nice when FS is ON.. so when fatalstrike is activated i can run faster speeds ..