Hey guys, someone can help me with a little bot bug?
So... i will explain: I can buy and place bot, but when i try to make an action / change name, i got this error: (Couldn't get bot: {BOTID GOES HERE})
Some code's:
GETBOT
DEPLOYBOT
If you can help, please, PM me or add in skype, thanks!
My skype: Contato.Crazzy
So... i will explain: I can buy and place bot, but when i try to make an action / change name, i got this error: (Couldn't get bot: {BOTID GOES HERE})
Some code's:
Quote:
GETBOT
Code:
internal RoomUser GetBot(uint BotId)
{
if (this.bots.Contains(BotId))
{
return (RoomUser)this.bots[BotId];
}
Logging.WriteLine("Couldn't get BOT: " + BotId, ConsoleColor.Gray);
return null;
}
Quote:
DEPLOYBOT
Code:
internal RoomUser DeployBot(RoomBot Bot, Pet PetData)
{
int virtualId = this.primaryPrivateUserID++;
RoomUser roomUser = new RoomUser(0u, this.room.RoomId, virtualId, this.room, false);
int num = this.secondaryPrivateUserID++;
roomUser.InternalRoomID = num;
this.userlist.Add(num, roomUser);
DynamicRoomModel model = this.room.GetGameMap().Model;
Point coord = new Point(Bot.X, Bot.Y);
if (Bot.X > 0 && Bot.Y > 0 && Bot.X < model.MapSizeX && Bot.Y < model.MapSizeY)
{
this.room.GetGameMap().AddUserToMap(roomUser, coord);
roomUser.SetPos(Bot.X, Bot.Y, Bot.Z);
roomUser.SetRot(Bot.Rot, false);
}
else
{
Bot.X = model.DoorX;
Bot.Y = model.DoorY;
roomUser.SetPos(model.DoorX, model.DoorY, model.DoorZ);
roomUser.SetRot(model.DoorOrientation, false);
}
roomUser.BotData = Bot;
checked
{
roomUser.BotAI = Bot.GenerateBotAI(roomUser.VirtualId, (int)Bot.BotId);
if (roomUser.IsPet)
{
roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
roomUser.PetData = PetData;
roomUser.PetData.VirtualId = roomUser.VirtualId;
}
else
{
roomUser.BotAI.Init(Bot.BotId, roomUser.VirtualId, this.room.RoomId, roomUser, this.room);
}
this.UpdateUserStatus(roomUser, false);
roomUser.UpdateNeeded = true;
ServerMessage serverMessage = new ServerMessage(Outgoing.SetRoomUser);
serverMessage.AppendInt32(1);
roomUser.Serialize(serverMessage, this.room.GetGameMap().gotPublicPool);
this.room.SendMessage(serverMessage);
roomUser.BotAI.OnSelfEnterRoom();
if (roomUser.IsPet)
{
if (this.pets.Contains(roomUser.PetData.PetId))
{
this.pets[roomUser.PetData.PetId] = roomUser;
}
else
{
this.pets.Add(roomUser.PetData.PetId, roomUser);
}
this.petCount++;
}
if (roomUser.BotData.AiType == AIType.Generic)
{
if (this.bots.Contains(roomUser.BotData.BotId))
{
this.bots[roomUser.BotData.BotId] = roomUser;
}
else
{
this.bots.Add(roomUser.BotData.BotId, roomUser);
}
serverMessage.Init(Outgoing.Dance);
serverMessage.AppendInt32(roomUser.VirtualId);
serverMessage.AppendInt32(roomUser.BotData.DanceId);
this.room.SendMessage(serverMessage);
this.petCount++;
}
return roomUser;
}
}
My skype: Contato.Crazzy