示例#1
0
        public RoomUser method_4(RoomBot Bot, Pet PetData, uint x = 0)
        {
            int num;
            if (x == 0)
                num = this.method_5();
            else
                num = (int)x;
            RoomUser user = new RoomUser(Convert.ToUInt32(num + 1000), this.Id, this.int_7++, true, x);

            user.int_20 = num;

            this.RoomUsers[num] = user;
            if (Bot.x > 0 && Bot.y > 0 && Bot.x < this.RoomModel.int_4 && Bot.y < this.RoomModel.int_5)
            {
                user.method_7(Bot.x, Bot.y, Bot.z);
                user.method_9(Bot.Rotation);
            }
            else
            {
                Bot.x = this.RoomModel.DoorX;
                Bot.y = this.RoomModel.DoorY;
                user.method_7(this.RoomModel.DoorX, this.RoomModel.DoorY, this.RoomModel.double_0);
                user.method_9(this.RoomModel.int_2);
            }

            user.RoomBot = Bot;
            user.BotAI = Bot.GetBotAI(user.VirtualId);

            if (user.IsPet)
            {
                user.BotAI.Init((int)Bot.Id, user.VirtualId, this.Id);
                user.PetData = PetData;
                user.PetData.VirtualId = user.VirtualId;
            }
            else
            {
                user.BotAI.Init(-1, user.VirtualId, this.Id);
            }
            this.method_87(user, true, true);
            user.UpdateNeeded = true;
            ServerMessage Message = new ServerMessage(Outgoing.SetRoomUser); // P
            Message.AppendInt32(1);
            user.method_14(Message);
            this.SendMessage(Message, null);
            user.BotAI.OnSelfEnterRoom();
            return user;
        }
示例#2
0
        public RoomUser AddBotToRoom(RoomBot Bot, UserBot UBot)
        {
            int num = (int)UBot.BotId;
            if(num > 500)
            {
                int i = 500;
                while(i > 0)
                {
                    i--;
                    RoomUser ru = RoomUsers[i];
                    if (ru == null)
                    { num = i; break; }
                }
            }
            RoomUser user = new RoomUser(Convert.ToUInt32(UBot.BotId + 1000), this.Id, this.int_7++, true);
            user.int_20 = num;
            this.RoomUsers[num] = user;
            if (Bot.x > 0 && Bot.y > 0 && Bot.x < this.RoomModel.int_4 && Bot.y < this.RoomModel.int_5)
            {
                user.method_7(Bot.x, Bot.y, Bot.z);
                user.method_9(Bot.Rotation);
            }
            else
            {
                Bot.x = this.RoomModel.DoorX;
                Bot.y = this.RoomModel.DoorY;
                user.method_7(this.RoomModel.DoorX, this.RoomModel.DoorY, this.RoomModel.double_0);
                user.method_9(this.RoomModel.int_2);
            }

            user.RoomBot = Bot;
            user.BotAI = Bot.GetBotAI(user.VirtualId);

            user.BotAI.Init((int)Bot.Id, user.VirtualId, this.Id);

            this.method_87(user, true, true);
            user.UpdateNeeded = true;
            ServerMessage Message = new ServerMessage(Outgoing.PlaceBot); // P
            Message.AppendInt32(1);
            user.method_14(Message);
            this.SendMessage(Message, null);
            user.BotAI.OnSelfEnterRoom();
            return user;
        }