public RoomUser DeployBot(RoomBot Bot, Pet PetData) { RoomUser BotUser = new RoomUser(0, RoomId, UserCounter++); if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY) { BotUser.SetPos(Bot.X, Bot.Y, Bot.Z); BotUser.SetRot(Bot.Rot); } else { Bot.X = Model.DoorX; Bot.Y = Model.DoorY; BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ); BotUser.SetRot(Model.DoorOrientation); } UserMatrix[Bot.X, Bot.Y] = true; BotUser.BotData = Bot; BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId); if (BotUser.IsPet) { BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, RoomId); BotUser.PetData = PetData; BotUser.PetData.VirtualId = BotUser.VirtualId; } else { BotUser.BotAI.Init(-1, BotUser.VirtualId, RoomId); } UserList.Add(BotUser); UpdateUserStatus(BotUser); BotUser.UpdateNeeded = true; ServerPacket EnterMessage = new ServerPacket(28); EnterMessage.AppendInt32(1); BotUser.Serialize(EnterMessage); SendMessage(EnterMessage); BotUser.BotAI.OnSelfEnterRoom(); return BotUser; }
public RoomUser DeployBot(RoomBot Bot) { return DeployBot(Bot, null); }