Ejemplo n.º 1
0
        internal void MoveTo(int pX, int pY, bool pOverride)
        {
            if (this.TeleportEnabled)
            {
                this.UnIdle();
                this.GetRoom().SendMessage(this.GetRoom().GetRoomItemHandler().UpdateUserOnRoller(this, new Point(pX, pY), 0u, this.GetRoom().GetGameMap().SqAbsoluteHeight(this.GoalX, this.GoalY)));
                if (this.Statusses.ContainsKey("sit"))
                {
                    this.Z -= 0.35;
                }
                this.UpdateNeeded = true;
                this.GetRoom().GetRoomUserManager().UpdateUserStatus(this, false);
                return;
            }
            if (this.GetRoom().GetGameMap().SquareHasUsers(pX, pY) && !pOverride)
            {
                return;
            }
            if (this.Frozen)
            {
                return;
            }
            if (!this.IsBot)
            {
                if (this.IsMoonwalking)
                {
                    this.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(136);
                }
                else
                {
                    if (!this.IsMoonwalking && this.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect == 136)
                    {
                        this.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(0);
                    }
                }
            }
            CoordItemSearch coordItemSearch      = new CoordItemSearch(this.GetRoom().GetGameMap().CoordinatedItems);
            List <RoomItem> allRoomItemForSquare = coordItemSearch.GetAllRoomItemForSquare(pX, pY);

            if (this.RidingHorse && !this.IsBot && allRoomItemForSquare.Count > 0)
            {
                foreach (RoomItem current in allRoomItemForSquare)
                {
                    if (checked (Math.Abs(this.X - pX) < 2 && Math.Abs(this.Y - pY) < 2) && (current.GetBaseItem().IsSeat || current.GetBaseItem().InteractionType == InteractionType.lowpool || current.GetBaseItem().InteractionType == InteractionType.pool || current.GetBaseItem().InteractionType == InteractionType.haloweenpool))
                    {
                        return;
                    }
                }
            }
            this.UnIdle();
            this.GoalX            = pX;
            this.GoalY            = pY;
            this.PathRecalcNeeded = true;
            this.throwBallAtGoal  = false;
        }
Ejemplo n.º 2
0
        internal void UpdateUserStatus(RoomUser User, bool cyclegameitems)
        {
            try
            {
                if (User != null)
                {
                    bool isBot = User.IsBot;
                    if (isBot)
                    {
                        cyclegameitems = false;
                    }
                    if (checked(User.SignTime - CyberEnvironment.GetUnixTimestamp()) < 0 && User.Statusses.ContainsKey("sign"))
                    {
                        User.Statusses.Remove("sign");
                        User.UpdateNeeded = true;
                    }
                    if ((User.Statusses.ContainsKey("lay") && !User.IsLyingDown) || (User.Statusses.ContainsKey("sit") && !User.IsSitting))
                    {
                        User.Statusses.Remove("lay");
                        User.Statusses.Remove("sit");
                        User.UpdateNeeded = true;
                    }
                    else
                    {
                        if (User.IsLyingDown || User.IsSitting)
                        {
                            return;
                        }
                    }
                    CoordItemSearch coordItemSearch = new CoordItemSearch(this.room.GetGameMap().CoordinatedItems);
                    List<RoomItem> allRoomItemForSquare = coordItemSearch.GetAllRoomItemForSquare(User.X, User.Y);
                    double num;
                    if (User.RidingHorse && !User.IsPet)
                    {
                        num = this.room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, allRoomItemForSquare) + 1.0;
                    }
                    else
                    {
                        num = this.room.GetGameMap().SqAbsoluteHeight(User.X, User.Y, allRoomItemForSquare);
                    }
                    if (num != User.Z)
                    {
                        User.Z = num;
                        User.UpdateNeeded = true;
                    }
                    DynamicRoomModel model = this.room.GetGameMap().Model;
                    if (model.SqState[User.X, User.Y] == SquareState.SEAT || User.IsSitting || User.IsLyingDown)
                    {
                        if (User.IsSitting)
                        {
                            if (!User.Statusses.ContainsKey("sit"))
                            {
                                User.Statusses.Add("sit", Convert.ToString((double)model.SqFloorHeight[User.X, User.Y] + 0.55));
                            }
                            User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                            User.UpdateNeeded = true;
                        }
                        else
                        {
                            if (User.IsLyingDown)
                            {
                                if (!User.Statusses.ContainsKey("lay"))
                                {
                                    User.Statusses.Add("lay", Convert.ToString((double)model.SqFloorHeight[User.X, User.Y] + 0.55));
                                }
                                User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                                User.UpdateNeeded = true;
                            }
                            else
                            {
                                if (!User.Statusses.ContainsKey("sit"))
                                {
                                    User.Statusses.Add("sit", "1.0");
                                }
                                User.Z = (double)model.SqFloorHeight[User.X, User.Y];
                                User.RotHead = (int)model.SqSeatRot[User.X, User.Y];
                                User.RotBody = (int)model.SqSeatRot[User.X, User.Y];
                                User.UpdateNeeded = true;
                            }
                        }
                    }
                    if (allRoomItemForSquare.Count == 0)
                    {
                        User.LastItem = 0;
                    }
                    using (List<RoomItem>.Enumerator enumerator = allRoomItemForSquare.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            RoomItem Item = enumerator.Current;
                            if (cyclegameitems)
                            {
                                Item.UserWalksOnFurni(User);
                                CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(User.GetClient(), QuestType.STAND_ON, Item.GetBaseItem().ItemId);
                            }
                            if (Item.GetBaseItem().IsSeat)
                            {
                                if (!User.Statusses.ContainsKey("sit"))
                                {
                                    if (Item.GetBaseItem().StackMultipler && !string.IsNullOrWhiteSpace(Item.ExtraData))
                                    {
                                        if (Item.ExtraData != "0")
                                        {
                                            int num2 = Convert.ToInt32(Item.ExtraData);
                                            User.Statusses.Add("sit", Item.GetBaseItem().ToggleHeight[num2].ToString());
                                        }
                                        else
                                        {
                                            User.Statusses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height));
                                        }
                                    }
                                    else
                                    {
                                        User.Statusses.Add("sit", TextHandling.GetString(Item.GetBaseItem().Height));
                                    }
                                }
                                User.Z = Item.GetZ;
                                User.RotHead = Item.Rot;
                                User.RotBody = Item.Rot;
                                User.UpdateNeeded = true;
                            }
                            InteractionType interactionType = Item.GetBaseItem().InteractionType;
                            checked
                            {
                                if (interactionType <= InteractionType.banzaigategreen)
                                {
                                    if (interactionType != InteractionType.bed)
                                    {
                                        if (interactionType != InteractionType.fbgate)
                                        {
                                            switch (interactionType)
                                            {
                                                case InteractionType.banzaigateblue:
                                                case InteractionType.banzaigatered:
                                                case InteractionType.banzaigateyellow:
                                                case InteractionType.banzaigategreen:
                                                    {
                                                        if (!cyclegameitems)
                                                        {
                                                            continue;
                                                        }
                                                        int num3 = (int)(Item.team + 32);
                                                        TeamManager teamManagerForBanzai = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForBanzai();
                                                        AvatarEffectsInventoryComponent avatarEffectsInventoryComponent = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();
                                                        if (User.team == Team.none)
                                                        {
                                                            if (!teamManagerForBanzai.CanEnterOnTeam(Item.team))
                                                            {
                                                                continue;
                                                            }
                                                            if (User.team != Team.none)
                                                            {
                                                                teamManagerForBanzai.OnUserLeave(User);
                                                            }
                                                            User.team = Item.team;
                                                            teamManagerForBanzai.AddUser(User);
                                                            if (avatarEffectsInventoryComponent.CurrentEffect != num3)
                                                            {
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(num3);
                                                                continue;
                                                            }
                                                            continue;
                                                        }
                                                        else
                                                        {
                                                            if (User.team != Team.none && User.team != Item.team)
                                                            {
                                                                teamManagerForBanzai.OnUserLeave(User);
                                                                User.team = Team.none;
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(0);
                                                                continue;
                                                            }
                                                            teamManagerForBanzai.OnUserLeave(User);
                                                            if (avatarEffectsInventoryComponent.CurrentEffect == num3)
                                                            {
                                                                avatarEffectsInventoryComponent.ActivateCustomEffect(0);
                                                            }
                                                            User.team = Team.none;
                                                            continue;
                                                        }
                                                    }
                                                default:
                                                    continue;
                                            }
                                        }
                                        else
                                        {
                                            if (User.IsBot)
                                            {
                                                continue;
                                            }

                                            string look = Item.ExtraData.Split(';')[0];
                                            if (User.GetClient().GetHabbo().Gender.ToUpper() == "F")
                                            {
                                                look = Item.ExtraData.Split(';')[1];
                                            }
                                            look = look.Replace("hd-99999-99999", User.GetClient().GetHabbo().HeadPart);
                                            User.GetClient().GetHabbo().Look = look;

                                            ServerMessage serverMessage = new ServerMessage();
                                            serverMessage.Init(Outgoing.UpdateUserDataMessageComposer);
                                            serverMessage.AppendInt32(-1);
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
                                            serverMessage.AppendString(User.GetClient().GetHabbo().Motto);
                                            serverMessage.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
                                            User.GetClient().SendMessage(serverMessage);
                                            ServerMessage serverMessage2 = new ServerMessage();
                                            serverMessage2.Init(Outgoing.UpdateUserDataMessageComposer);
                                            serverMessage2.AppendInt32(User.VirtualId);
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Gender.ToLower());
                                            serverMessage2.AppendString(User.GetClient().GetHabbo().Motto);
                                            serverMessage2.AppendInt32(User.GetClient().GetHabbo().AchievementPoints);
                                            this.room.SendMessage(serverMessage2);

                                            ServerMessage serverMessage3 = new ServerMessage();
                                            serverMessage3.Init(Outgoing.UpdateAvatarAspectMessageComposer);
                                            serverMessage3.AppendString(User.GetClient().GetHabbo().Look);
                                            serverMessage3.AppendString(User.GetClient().GetHabbo().Gender.ToUpper());
                                            User.GetClient().SendMessage(serverMessage3);

                                            continue;
                                        }
                                    }
                                }
                                else
                                {
                                    if (interactionType <= InteractionType.freezebluegate)
                                    {
                                        if (interactionType == InteractionType.banzaitele)
                                        {
                                            this.room.GetGameItemHandler().onTeleportRoomUserEnter(User, Item);
                                            continue;
                                        }
                                        switch (interactionType)
                                        {
                                            case InteractionType.freezeyellowgate:
                                            case InteractionType.freezeredgate:
                                            case InteractionType.freezegreengate:
                                            case InteractionType.freezebluegate:
                                                if (cyclegameitems)
                                                {
                                                    int num4 = (int)(Item.team + 39);
                                                    TeamManager teamManagerForFreeze = User.GetClient().GetHabbo().CurrentRoom.GetTeamManagerForFreeze();
                                                    AvatarEffectsInventoryComponent avatarEffectsInventoryComponent2 = User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent();
                                                    if (User.team != Item.team)
                                                    {
                                                        if (teamManagerForFreeze.CanEnterOnTeam(Item.team))
                                                        {
                                                            if (User.team != Team.none)
                                                            {
                                                                teamManagerForFreeze.OnUserLeave(User);
                                                            }
                                                            User.team = Item.team;
                                                            teamManagerForFreeze.AddUser(User);
                                                            if (avatarEffectsInventoryComponent2.CurrentEffect != num4)
                                                            {
                                                                avatarEffectsInventoryComponent2.ActivateCustomEffect(num4);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        teamManagerForFreeze.OnUserLeave(User);
                                                        if (avatarEffectsInventoryComponent2.CurrentEffect == num4)
                                                        {
                                                            avatarEffectsInventoryComponent2.ActivateCustomEffect(0);
                                                        }
                                                        User.team = Team.none;
                                                    }
                                                    ServerMessage serverMessage3 = new ServerMessage(Outgoing.UserIsPlayingFreezeMessageComposer);
                                                    serverMessage3.AppendBoolean(User.team != Team.none);
                                                    User.GetClient().SendMessage(serverMessage3);
                                                    continue;
                                                }
                                                continue;
                                            default:
                                                continue;
                                        }
                                    }
                                    else
                                    {
                                        if (interactionType != InteractionType.jump)
                                        {
                                            switch (interactionType)
                                            {
                                                case InteractionType.pinata:
                                                    {
                                                        if (!User.IsWalking || Item.ExtraData.Length <= 0)
                                                        {
                                                            continue;
                                                        }
                                                        int num5 = int.Parse(Item.ExtraData);
                                                        if (num5 >= 100 || User.CurrentEffect != 158)
                                                        {
                                                            continue;
                                                        }
                                                        int num6 = num5 + 1;
                                                        Item.ExtraData = num6.ToString();

                                                        Item.UpdateState();
                                                        CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(User.GetClient(), "ACH_PinataWhacker", 1, false);
                                                        if (num6 == 100)
                                                        {
                                                            CyberEnvironment.GetGame().GetPinataHandler().DeliverRandomPinataItem(User, this.room, Item);
                                                            CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(User.GetClient(), "ACH_PinataBreaker", 1, false);
                                                            continue;
                                                        }
                                                        continue;
                                                    }
                                                case InteractionType.tilestackmagic:
                                                case InteractionType.poster:
                                                    continue;

                                                case InteractionType.tent:
                                                case InteractionType.bedtent:
                                                    if (User.LastItem == Item.Id)
                                                        continue;

                                                    if (!User.IsBot && !User.OnCampingTent)
                                                    {
                                                        ServerMessage serverMessage = new ServerMessage();
                                                        serverMessage.Init(Outgoing.UpdateFloorItemExtraDataMessageComposer);
                                                        serverMessage.AppendString(Item.Id.ToString());
                                                        serverMessage.AppendInt32(0);
                                                        serverMessage.AppendString("1");
                                                        User.GetClient().SendMessage(serverMessage);
                                                        User.OnCampingTent = true;
                                                        User.LastItem = Item.Id;
                                                    }
                                                    continue;
                                                case InteractionType.runwaysage:
                                                    {
                                                        int num7 = new Random().Next(1, 4);
                                                        Item.ExtraData = num7.ToString();
                                                        Item.UpdateState();
                                                        continue;
                                                    }
                                                case InteractionType.shower:
                                                    Item.ExtraData = "1";
                                                    Item.UpdateState();
                                                    continue;
                                                default:
                                                    continue;
                                            }
                                        }
                                        else
                                        {
                                            if ((User.Y == Item.GetY || User.Y == Item.GetY - 1) && User.X == Item.GetX + 1)
                                            {
                                                continue;
                                            }
                                            continue;
                                        }
                                    }
                                }
                                if (Item.GetBaseItem().InteractionType == InteractionType.bedtent)
                                {
                                    User.OnCampingTent = true;
                                }
                                if (!User.Statusses.ContainsKey("lay"))
                                {
                                    User.Statusses.Add("lay", TextHandling.GetString(Item.GetBaseItem().Height) + " null");
                                }
                                User.Z = Item.GetZ;
                            }
                            User.RotHead = Item.Rot;
                            User.RotBody = Item.Rot;
                            User.UpdateNeeded = true;
                        }
                    }
                    if (User.IsSitting && User.TeleportEnabled)
                    {
                        User.Z -= 0.35;
                        User.UpdateNeeded = true;
                    }
                    if (cyclegameitems)
                    {
                        if (this.room.GotSoccer())
                        {
                            this.room.GetSoccer().OnUserWalk(User);
                        }
                        if (this.room.GotBanzai())
                        {
                            this.room.GetBanzai().OnUserWalk(User);
                        }
                        this.room.GetFreeze().OnUserWalk(User);
                    }
                }
            }
            catch
            {
            }
        }