public override void DoWiredAction(RoomUnitUser triggerer, HashSet <uint> used)
 {
     foreach (RoomItem item in this.SelectedItems.ToList())
     {
         this.Room.RoomWiredManager.TriggerWiredStacks(triggerer, item, this, used);
     }
 }
Exemple #2
0
        public void EnteredRoom(uint id, RoomUnitUser roomUser)
        {
            this.CurrentRoomID       = id;
            this.CurrentRoomRoomUser = roomUser;

            Skylight.GetGame().GetRoomvisitManager().LogRoomvisit(this.Habbo.GetSession());
        }
        public override void DoWiredAction(RoomUnitUser triggerer, HashSet <uint> used)
        {
            if (this.PointsAmountUsed < this.PointsAmount)
            {
                this.PointsAmountUsed++;

                if (triggerer != null)
                {
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, triggerer.GameTeam, this.Points);

                    this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(triggerer.GameTeam);
                }
                else
                {
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, GameTeam.Blue, this.Points);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, GameTeam.Green, this.Points);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, GameTeam.Yellow, this.Points);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, GameTeam.Red, this.Points);

                    this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(GameTeam.Blue);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(GameTeam.Green);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(GameTeam.Yellow);
                    this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(GameTeam.Red);
                }
            }
        }
 public void Hit(RoomUnitUser user, bool left)
 {
     if (user.WSPlayer.LeftSide)
     {
         if (user.WSPlayer.Location + 1 == this.RightUser.WSPlayer.Location)
         {
             this.RightUser.WSPlayer.Lean += left ? -10 - RandomUtilies.GetRandom().Next(0, 10) : 10 + RandomUtilies.GetRandom().Next(0, 10);
             this.RightUser.WSPlayer.HitsTakenTotal++;
             this.RightUser.WSPlayer.BeenHit = true;
         }
         else
         {
             user.WSPlayer.Lean += left ? -10 - RandomUtilies.GetRandom().Next(0, 10) : 10 + RandomUtilies.GetRandom().Next(0, 10);
         }
     }
     else
     {
         if (user.WSPlayer.Location - 1 == this.LeftUser.WSPlayer.Location)
         {
             this.LeftUser.WSPlayer.Lean -= left ? -10 - RandomUtilies.GetRandom().Next(0, 10) : 10 + RandomUtilies.GetRandom().Next(0, 10);
             this.LeftUser.WSPlayer.HitsTakenTotal++;
             this.LeftUser.WSPlayer.BeenHit = true;
         }
         else
         {
             user.WSPlayer.Lean += left ? -10 - RandomUtilies.GetRandom().Next(0, 10) : 10 + RandomUtilies.GetRandom().Next(0, 10);
         }
     }
 }
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (triggerer != null)
            {
                int notTriggeredWireds = 0;
                foreach (RoomItem item_ in this.SelectedItems)
                {
                    if ((item_ as RoomItemWiredActionTrigger)?.TriggeredUsers.Contains(triggerer.UserID) == false)
                    {
                        if (!this.AllFurnis)
                        {
                            return(true);
                        }

                        notTriggeredWireds++;
                    }
                }


                if (this.AllFurnis && notTriggeredWireds == this.SelectedItems.Count)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #6
0
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            foreach (RoomItem item_ in this.SelectedItems)
            {
                bool next = false;
                foreach (RoomUnitUser user in this.Room.RoomGamemapManager.GetTile(item_.X, item_.Y).UsersOnTile.Values)
                {
                    if (user.IsRealUser && user.Z >= item_.Z)
                    {
                        next = true;
                        break;
                    }
                }

                if (next)
                {
                    continue;
                }

                foreach (AffectedTile tile in item_.AffectedTiles)
                {
                    foreach (RoomUnitUser user in this.Room.RoomGamemapManager.GetTile(tile.X, tile.Y).UsersOnTile.Values)
                    {
                        if (user.IsRealUser && user.Z >= item_.Z)
                        {
                            break;
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
Exemple #7
0
 public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights)
 {
     if (session != null)
     {
         RoomUnitUser user = session.GetHabbo().GetRoomSession().GetRoomUser();
         if (user != null)
         {
             if (ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), new ThreeDCoord(item.X, item.Y)) || ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), item.TDC))
             {
                 RoomItemTeleport teleport = (RoomItemTeleport)item;
                 if (teleport.Interactor == null && user.Interacting == null)
                 {
                     teleport.Interactor = user;
                     teleport.Way        = 1;
                     user.Interacting    = item;
                 }
             }
             else
             {
                 if (user.Interacting == null)
                 {
                     user.MoveTo(item.TDC.x, item.TDC.y);
                 }
             }
         }
     }
 }
Exemple #8
0
 public void UserCollide(RoomUnitUser user, RoomItem item, HashSet <uint> used)
 {
     foreach (RoomItemWiredTrigger item_ in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemWiredTriggerCollision)))
     {
         this.WiredTrigger(item_, user, used, item);
     }
 }
Exemple #9
0
 public RoomWiredDelay(RoomItemWiredAction wired, RoomUnitUser triggerer, int delay, HashSet <uint> used)
 {
     this.Wired     = wired;
     this.Triggerer = triggerer;
     this.Delay     = delay;
     this.Used      = used;
 }
 public override void DoWiredAction(RoomUnitUser user, HashSet <uint> used)
 {
     foreach (RoomItem item_ in this.SelectedItems)
     {
         item_.OnUse(null, item_, 0, true);
     }
 }
Exemple #11
0
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (triggerer != null)
            {
                foreach (RoomItem item_ in this.SelectedItems)
                {
                    if (triggerer.Z >= item_.Z) //we are above the item
                    {
                        if (item_.X == triggerer.X && item_.Y == triggerer.Y)
                        {
                            return(true);
                        }

                        foreach (AffectedTile tile in item_.AffectedTiles)
                        {
                            if (tile.X == triggerer.X && tile.Y == triggerer.Y)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Exemple #12
0
 public void ScoreChanged(RoomUnitUser triggerer, int newScore)
 {
     foreach (RoomItemWiredTrigger item_ in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemWiredAtScore)))
     {
         this.WiredTrigger(item_, triggerer, new HashSet <uint>(), newScore);
     }
 }
Exemple #13
0
        public override void DoWiredAction(RoomUnitUser triggerer, HashSet <uint> used)
        {
            if (this.SelectedItems.Count > 0)
            {
                RoomItemWiredMoveUser wired = (RoomItemWiredMoveUser)this;

                int      index = RandomUtilies.GetRandom(0, wired.SelectedItems.Count - 1);
                RoomItem item_ = wired.SelectedItems[index];
                if (item_ != null)
                {
                    if (triggerer != null)
                    {
                        triggerer.StopMoving();
                        triggerer.SetLocation(item_.X, item_.Y, item_.Z); //set new location
                        triggerer.UpdateState();

                        wired.Effect(triggerer);
                    }
                    else
                    {
                        foreach (RoomUnitUser user in this.Room.RoomUserManager.GetRealUsers())
                        {
                            user.StopMoving();
                            user.SetLocation(item_.X, item_.Y, item_.Z); //set new location
                            user.UpdateState();

                            wired.Effect(user);
                        }
                    }
                }
            }
        }
Exemple #14
0
 public void UserEnterRoom(RoomUnitUser user)
 {
     foreach (RoomItemWiredTrigger item in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemWiredEnterRoom)))
     {
         this.WiredTrigger(item, user, new HashSet <uint>());
     }
 }
Exemple #15
0
 public void UseItem(RoomUnitUser user, RoomItem item)
 {
     foreach (RoomItemWiredTrigger item_ in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemWiredFurniState)))
     {
         this.WiredTrigger(item_, user, new HashSet <uint>(), item.ID);
     }
 }
Exemple #16
0
        public TradeUser(RoomUnitUser user)
        {
            this.OfferedItems = new ConcurrentDictionary <uint, InventoryItem>();

            this.RoomUser      = user;
            this.ConfirmStatus = TradeConfirmStatus.None;
        }
Exemple #17
0
        public void LockedTile(RoomUnitUser user)
        {
            user.Session.GetHabbo().GetUserStats().BattleBanzaiTilesLocked++;
            //battle banzai quest

            this.Room.RoomGameManager.RoomBattleBanzaiManager.RoomBattleBallGameField.updateLocation(this.X, this.Y, user.GameTeam);
            List <PointField> coords        = this.Room.RoomGameManager.RoomBattleBanzaiManager.RoomBattleBallGameField.doUpdate();
            List <Point>      checkedPoints = new List <Point>(); //we dont want check same point multiple time or we use huge amount of cpu

            foreach (PointField pointField in coords)
            {
                foreach (Point p in pointField.GetPoints())
                {
                    if (!checkedPoints.Contains(p))
                    {
                        checkedPoints.Add(p);

                        bool tileFound = false;
                        foreach (RoomItem item in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemBattleBanzaiPatch)))
                        {
                            if (item.X == p.X && item.Y == p.Y)
                            {
                                if (item.ExtraData != "5" && item.ExtraData != "8" && item.ExtraData != "11" && item.ExtraData != "14") //already locked
                                {
                                    item.ExtraData = (((int)pointField.GameTeam * 3) + 2).ToString();
                                    item.UpdateState(true, true);
                                    this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(user, pointField.GameTeam, 1);
                                    tileFound = true;
                                }
                            }
                        }

                        if (tileFound)
                        {
                            user.Session.GetHabbo().GetUserStats().BattleBanzaiTilesLocked++;
                        }
                    }
                }
            }

            user.Session.GetHabbo().GetUserAchievements().CheckAchievement("BattleBanzaiTilesLocked");
            this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(user, user.GameTeam, 1);
            this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(user.GameTeam);

            int tilesLocked = 0;

            foreach (RoomItem item in this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemBattleBanzaiPatch)))
            {
                if (item.ExtraData == "5" || item.ExtraData == "8" || item.ExtraData == "11" || item.ExtraData == "14") //already locked
                {
                    tilesLocked++;
                }
            }

            if (tilesLocked >= this.Room.RoomItemManager.FloorItems.Get(typeof(RoomItemBattleBanzaiPatch)).Count)
            {
                this.Room.RoomGameManager.StopGame();
            }
        }
Exemple #18
0
        public void LeaveTeam(RoomUnitUser user)
        {
            this.UsersInGame.Remove(user.Session.GetHabbo().ID);

            user.GameTeam = GameTeam.None;
            user.GameType = GameType.None;
            this.GiveEffect(user);
        }
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (triggerer?.Session.GetHabbo().GetBadgeManager().GetActiveBadges().Any(b => b.BadgeID == this.BadgeID) == true)
            {
                return(true);
            }

            return(false);
        }
Exemple #20
0
        public override bool TryTrigger(RoomUnitUser triggerer, object extraData)
        {
            if (this.SelectedItems.Any(r => r.ID == (uint)extraData))
            {
                return(true);
            }

            return(false);
        }
Exemple #21
0
        public override bool TryTrigger(RoomUnitUser triggerer, object extraData)
        {
            if (this.Score == (extraData as int?))
            {
                return(true);
            }

            return(false);
        }
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (this.Room.RoomData.UsersNow < this.UsersMin || this.Room.RoomData.UsersNow > this.UsersMax)
            {
                return(false);
            }

            return(true);
        }
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (triggerer?.ActiveEffect.ToString() == this.EffectID)
            {
                return(false);
            }

            return(true);
        }
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            if (triggerer?.GameTeam == this.Team)
            {
                return(false);
            }

            return(true);
        }
        public override bool TryTrigger(RoomUnitUser triggerer, object extraData)
        {
            if (string.IsNullOrEmpty(this.SpecifyUser) || this.SpecifyUser == triggerer.Session.GetHabbo().Username)
            {
                return(true);
            }

            return(false);
        }
Exemple #26
0
        public Trade(Room room, RoomUnitUser user, RoomUnitUser target)
        {
            this.Room    = room;
            this.Traders = new TradeUser[] { new TradeUser(user), new TradeUser(target) };
            this.Started = false;
            this.Status  = TradeConfirmStatus.None;

            user.AddStatus("trd", "");
            target.AddStatus("trd", "");
        }
Exemple #27
0
        public override void OnCycle()
        {
            bool open = false;

            if (this.Interactor != null && this.Interactor.Interacting == this)
            {
                if (this.Tick == 1)
                {
                    if (ThreeDCoord.smethod_0(new ThreeDCoord(this.Interactor.X, this.Interactor.Y), this.TDC))
                    {
                        open = true;

                        this.Tick = 2;
                        this.Interactor.Override = true;
                        this.Interactor.MoveTo(this.TDCO.x, this.TDCO.y);
                    }
                    else
                    {
                        this.Interactor.Interacting = null;
                        this.Interactor             = null;
                    }
                }
                else if (this.Tick == 2)
                {
                    this.Interactor.Override    = false;
                    this.Interactor.Interacting = null;
                    this.Interactor             = null;
                }
            }
            else
            {
                if (this.Interactor != null)
                {
                    this.Interactor.Interacting = null;
                    this.Interactor             = null;
                }
            }

            if (open)
            {
                if (this.ExtraData != "1")
                {
                    this.ExtraData = "1";
                    this.UpdateState(false, true);
                }
            }
            else
            {
                if (this.ExtraData != "0")
                {
                    this.ExtraData = "0";
                    this.UpdateState(false, true);
                }
            }
        }
        public override void DoWiredAction(RoomUnitUser triggerer, HashSet <uint> used)
        {
            if (this.PointsAmountUsed < this.PointsAmount)
            {
                this.PointsAmountUsed++;

                this.Room.RoomGameManager.RoomBattleBanzaiManager.AddScore(triggerer, this.PointsTeam, this.Points);

                this.Room.RoomGameManager.RoomBattleBanzaiManager.UpdateScore(this.PointsTeam);
            }
        }
Exemple #29
0
        public void JoinTeam(RoomUnitUser user, GameTeam team, GameType type)
        {
            if (!this.UsersInGame.ContainsKey(user.Session.GetHabbo().ID))
            {
                this.UsersInGame.Add(user.Session.GetHabbo().ID, user);
            }

            user.GameTeam = team;
            user.GameType = type;
            this.GiveEffect(user);
        }
Exemple #30
0
        public override bool IsBlocking(RoomUnitUser triggerer)
        {
            int usersOnFurni = 0;

            foreach (RoomItem item_ in this.SelectedItems)
            {
                bool found = false;

                foreach (RoomUnitUser user in this.Room.RoomGamemapManager.GetTile(item_.X, item_.Y).UsersOnTile.Values)
                {
                    if (user.IsRealUser && user.Z >= item_.Z)
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    usersOnFurni++;
                    continue;
                }

                foreach (AffectedTile tile in item_.AffectedTiles)
                {
                    foreach (RoomUnitUser user in this.Room.RoomGamemapManager.GetTile(tile.X, tile.Y).UsersOnTile.Values)
                    {
                        if (user.IsRealUser && user.Z >= item_.Z)
                        {
                            found = true;
                            break;
                        }
                    }
                }

                if (found)
                {
                    usersOnFurni++;
                }
                else
                {
                    return(false);
                }
            }

            if (usersOnFurni >= this.SelectedItems.Count)
            {
                return(true);
            }

            return(false);
        }