Heres abit of code for impulses source 5165
well I used a hashtable and added this into GameState.cs
Code:
public void DuelistTest()
{
Game.Entity duelist = new Game.Entity(Game.EntityFlag.Bot);
duelist.MapObjType = Game.MapObjectType.Bot;
this.BotOwner = Entity;
BotOwner = Entity;
duelist.Name = Entity.Name + "[BOT]";
duelist.X = Entity.X += 1;
duelist.Y = Entity.Y += 1;
duelist.Dodge = Entity.Dodge *= 2;
duelist.Defence = Entity.Defence *= 2;
duelist.MapID = Entity.MapID;
duelist.Body = Entity.Body;
duelist.Hitpoints = Entity.MaxHitpoints;
duelist.Level = Entity.Level;
duelist.Stamina = 250;
duelist.Face = Entity.Face;
duelist.Facing = Entity.Facing;
duelist.HairColor = Entity.HairColor;
duelist.HairStyle = Entity.HairStyle;
duelist.Strength = 750;
duelist.Agility = 750;
duelist.Spirit = 750;
duelist.Vitality = 750;
duelist.Spouse = "TheServer";
duelist.MinAttack = 500;
duelist.MaxAttack = 3000;
duelist.BaseMinAttack = 500;
duelist.BaseMaxAttack = 3000;
duelist.BaseMagicDefence = 300;
duelist.BaseMagicAttack = 5000;
duelist.Class = Entity.Class;
duelist.ItemBless = Entity.ItemBless;
duelist.ItemHP = Entity.ItemHP;
duelist.ItemMP = Entity.ItemMP;
duelist.PKMode = Game.Enums.PKMode.PK;
// entity.UID = 400001;
duelist.UID = (uint)ServerBase.Kernel.Random.Next(400000, 500000);
ServerBase.Kernel.Bots.Add(duelist.UID, this);
duelist.SendSpawn(this);
}
public void DuelistTestMove()
{
if (DateTime.Now > LastBotMove.AddMilliseconds(250))
{
LastBotMove = DateTime.Now;
if (Game.Attacking.Calculate.PointDistance(BotOwner.X, BotOwner.Y, Entity.X, Entity.Y) >= 4)
{
DuelistJumpAround();
}
}
}
void DuelistJumpAround()
{
BotOwner.X = (ushort)(Entity.X + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
BotOwner.Y = (ushort)(Entity.Y + ServerBase.Kernel.Random.Next(7) - ServerBase.Kernel.Random.Next(7));
BotOwner.Action = Game.Enums.ConquerAction.Jump;
}
and these
Code:
public static DateTime LastBotMove = DateTime.Now;
public static DateTime LastBotAttack = DateTime.Now;
public static bool BotInUse = false;
public Game.Entity BotOwner;
in kernel.cs I made the top look like
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
and then added
Code:
public static Hashtable Bots = new Hashtable();
In program.cs I adde
Code:
static void BotThread_Execute()
{
}
and I added
Code:
ServerBase.Thread BotThread = new ServerBase.Thread(10);
BotThread.Execute += new Action(BotThread_Execute);
and the
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange);
I made look like
Code:
GC.KeepAlive(CharacterThread); GC.KeepAlive(FloorItems); GC.KeepAlive(StatusFlagChange); GC.KeepAlive(BotThread);
then added the command in packerhandler.cs
Code:
case "bot":
{
client.DuelistTest();
break;
}
About 25% done. OH I also find
Code:
public enum EntityFlag : byte
{
and make it look like
Code:
Player = 1,
Monster = 2,
Bot = 3
then find
Code:
public enum MapObjectType
{
and make it look like
Code:
public enum MapObjectType
{
Npc, Item, Monster, Player, Nothing, InvalidCast, Bot
}
again as I said 25% done.