Exemplo n.º 1
0
        private void LoadBots()
        {
            List <RoomBot> bots = FirewindEnvironment.GetGame().GetBotManager().GetBotsForRoom(this.RoomId);

            foreach (RoomBot bot in bots)
            {
                RoomUser NewUser = DeployBot(bot);
                NewUser.SetPos(bot.X, bot.Y, bot.Z);
            }
        }
Exemplo n.º 2
0
        private void UnitList_onAdd(object sender, EventArgs args)
        {
            try
            {
                KeyValuePair <int, RoomUnit> userPair = (KeyValuePair <int, RoomUnit>)sender;
                RoomUser user = userPair.Value as RoomUser;

                if (user == null || user.GetClient() == null || user.GetClient().GetHabbo() == null)
                {
                    return;
                }

                GameClient session = user.GetClient();

                if (session == null || session.GetHabbo() == null)
                {
                    return;
                }

                DynamicRoomModel Model = room.GetGameMap().Model;
                user.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ);
                user.SetRot(Model.DoorOrientation, false);

                user.CurrentItemEffect = ItemEffectType.None;

                if (user.GetClient().GetHabbo().IsTeleporting)
                {
                    RoomItem Item = room.GetRoomItemHandler().GetItem(user.GetClient().GetHabbo().TeleporterId);

                    if (Item != null)
                    {
                        user.SetPos(Item.GetX, Item.GetY, Item.GetZ);
                        user.SetRot(Item.Rot, false);

                        Item.InteractingUser2        = session.GetHabbo().Id;
                        ((StringData)Item.data).Data = "2";
                        Item.UpdateState(false, true);
                    }
                }

                user.GetClient().GetHabbo().IsTeleporting = false;
                user.GetClient().GetHabbo().TeleporterId  = 0;

                ServerMessage EnterMessage = new ServerMessage(Outgoing.SetRoomUser);
                EnterMessage.AppendInt32(1);
                user.Serialize(EnterMessage);
                room.SendMessage(EnterMessage);


                if (room.Owner != session.GetHabbo().Username)
                {
                    FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(user.GetClient(), HabboHotel.Quests.QuestType.SOCIAL_VISIT);
                }

                if (session.GetHabbo().GetMessenger() != null)
                {
                    session.GetHabbo().GetMessenger().OnStatusChanged(true);
                }

                foreach (RoomUnit unit in UnitList.Values)
                {
                    RoomAI ai = unit as RoomAI;
                    if (ai == null)
                    {
                        continue;
                    }

                    ai.BaseAI.OnUserEnterRoom(user);
                }

                user.GetClient().GetMessageHandler().OnRoomUserAdd();

                if (OnUserEnter != null)
                {
                    OnUserEnter(user, null);
                }

                if (room.GotMusicController())
                {
                    room.GetRoomMusicController().OnNewUserEnter(user);
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException(e.ToString());
            }
        }