Exemple #1
0
        public bool Execute(params object[] stuff)
        {
            int date1;
            var date2 = 0;

            var strArray = OtherString.Split(',');

            if (string.IsNullOrWhiteSpace(strArray[0]))
            {
                return(false);
            }

            int.TryParse(strArray[0], out date1);

            if (strArray.Length > 1)
            {
                int.TryParse(strArray[1], out date2);
            }

            if (date1 == 0)
            {
                return(false);
            }

            var currentTimestamp = Plus.GetUnixTimeStamp();

            return(date2 < 1 ? currentTimestamp >= date1 : currentTimestamp >= date1 && currentTimestamp <= date2);
        }
Exemple #2
0
        public bool Execute(params object[] stuff)
        {
            if (stuff == null || !(stuff[0] is RoomUser))
            {
                return(false);
            }
            var roomUser = (RoomUser)stuff[0];


            if (roomUser.IsBot || roomUser.GetClient() == null || roomUser.GetClient().GetHabbo() == null ||
                roomUser.GetClient()
                .GetHabbo()
                .GetInventoryComponent() == null || string.IsNullOrEmpty(OtherString))
            {
                return(false);
            }

            var itemsIdsArray = OtherString.Split(';');

            foreach (var itemIdStr in itemsIdsArray)
            {
                uint itemId;
                if (!uint.TryParse(itemIdStr, out itemId))
                {
                    continue;
                }
                if (roomUser.GetClient()
                    .GetHabbo().GetInventoryComponent().HasBaseItem(itemId))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #3
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = stuff?[0] as RoomUser;

            if ((roomUser?.IsBot ?? true) || roomUser.GetClient() == null || roomUser.GetClient().GetHabbo() == null ||
                roomUser.GetClient().GetHabbo().GetInventoryComponent() == null || string.IsNullOrEmpty(OtherString))
            {
                return(false);
            }

            string[] itemsIdsArray = OtherString.Split(';');

            foreach (string itemIdStr in itemsIdsArray)
            {
                uint itemId;

                if (!uint.TryParse(itemIdStr, out itemId))
                {
                    continue;
                }

                if (roomUser.GetClient().GetHabbo().GetInventoryComponent().HasBaseItem(itemId))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #4
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }

            if ((Interaction)stuff[1] == Interaction.TriggerScoreAchieved)
            {
                return(false);
            }


            RoomUser roomUser = (RoomUser)stuff[0];

            if (roomUser == null)
            {
                return(false);
            }

            if (roomUser.Team == Team.None)
            {
                return(false);
            }

            int timesDone;

            int.TryParse(OtherExtraString, out timesDone);

            int scoreToAchieve = 10;
            int maxTimes       = 1;

            if (!string.IsNullOrWhiteSpace(OtherString))
            {
                string[] integers = OtherString.Split(',');
                scoreToAchieve = int.Parse(integers[0]);
                maxTimes       = int.Parse(integers[1]);
            }

            if (timesDone >= maxTimes)
            {
                return(false);
            }

            Room.GetGameManager().AddPointToTeam(roomUser.Team, scoreToAchieve, roomUser);
            timesDone++;

            OtherExtraString = timesDone.ToString();
            return(true);
        }
        public bool Execute(params object[] stuff)
        {
            bool approved = false;

            int minimum = 1;
            int maximum = 50;

            if (!string.IsNullOrWhiteSpace(OtherString))
            {
                string[] integers = OtherString.Split(',');
                minimum = int.Parse(integers[0]);
                maximum = int.Parse(integers[1]);
            }

            if (Room.RoomData.UsersNow >= minimum && Room.RoomData.UsersNow <= maximum)
            {
                approved = true;
            }

            return(approved == false);
        }
Exemple #6
0
        public bool Execute(params object[] stuff)
        {
            if (Room == null)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(OtherString) || string.IsNullOrWhiteSpace(OtherExtraString))
            {
                return(false);
            }

            string[] booleans = OtherString.Split(',');

            if (booleans.Length < 3)
            {
                return(false);
            }

            bool extraData = booleans[0] == "true";
            bool rot       = booleans[1] == "true";
            bool position  = booleans[2] == "true";

            foreach (string itemData in OtherExtraString.Split('/'))
            {
                if (string.IsNullOrWhiteSpace(itemData))
                {
                    continue;
                }

                string[] innerData = itemData.Split('|');
                uint     itemId    = uint.Parse(innerData[0]);

                RoomItem fItem = Room.GetRoomItemHandler().GetItem(itemId);

                if (fItem == null)
                {
                    continue;
                }

                string extraDataToSet = extraData ? innerData[1] : fItem.ExtraData;
                int    rotationToSet  = rot ? int.Parse(innerData[2]) : fItem.Rot;

                string[] positions = innerData[3].Split(',');

                int    xToSet = position ? int.Parse(positions[0]) : fItem.X;
                int    yToSet = position ? int.Parse(positions[1]) : fItem.Y;
                double zToSet = position ? double.Parse(positions[2]) : fItem.Z;


                ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer"));
                serverMessage.AppendInteger(fItem.X);
                serverMessage.AppendInteger(fItem.Y);
                serverMessage.AppendInteger(xToSet);
                serverMessage.AppendInteger(yToSet);
                serverMessage.AppendInteger(1);
                serverMessage.AppendInteger(fItem.Id);
                serverMessage.AppendString(fItem.Z.ToString(Yupi.CultureInfo));
                serverMessage.AppendString(zToSet.ToString(Yupi.CultureInfo));
                serverMessage.AppendInteger(0);
                Room.SendMessage(serverMessage);

                Room.GetRoomItemHandler()
                .SetFloorItem(null, fItem, xToSet, yToSet, rotationToSet, false, false, false, false, false);
                fItem.ExtraData = extraDataToSet;
                fItem.UpdateState();

                Room.GetGameMap().GenerateMaps();
            }

            return(true);
        }
Exemple #7
0
        public bool Execute(params object[] stuff)
        {
            if (Room == null)
            {
                return(false);
            }

            if (String.IsNullOrWhiteSpace(OtherString) || String.IsNullOrWhiteSpace(OtherExtraString))
            {
                return(false);
            }

            var booleans = OtherString.Split(',');

            if (booleans.Length < 3)
            {
                return(false);
            }

            var extraData = booleans[0] == "true";
            var rot       = booleans[1] == "true";
            var position  = booleans[2] == "true";

            foreach (var itemData in OtherExtraString.Split('/'))
            {
                if (String.IsNullOrWhiteSpace(itemData))
                {
                    continue;
                }

                var innerData = itemData.Split('|');
                var itemId    = uint.Parse(innerData[0]);

                var fItem = Room.GetRoomItemHandler().GetItem(itemId);

                if (fItem == null)
                {
                    continue;
                }

                var extraDataToSet = (extraData) ? innerData[1] : fItem.ExtraData;
                var rotationToSet  = (rot) ? int.Parse(innerData[2]) : fItem.Rot;

                var positions = innerData[3].Split(',');
                var xToSet    = (position) ? int.Parse(positions[0]) : fItem.X;
                var yToSet    = (position) ? int.Parse(positions[1]) : fItem.Y;
                var zToSet    = (position) ? double.Parse(positions[2]) : fItem.Z;

                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer"));
                serverMessage.AppendInteger(fItem.X);
                serverMessage.AppendInteger(fItem.Y);
                serverMessage.AppendInteger(xToSet);
                serverMessage.AppendInteger(yToSet);
                serverMessage.AppendInteger(1);
                serverMessage.AppendInteger(fItem.Id);
                serverMessage.AppendString(fItem.Z.ToString(Plus.CultureInfo));
                serverMessage.AppendString(zToSet.ToString(Plus.CultureInfo));
                serverMessage.AppendInteger(0);
                Room.SendMessage(serverMessage);

                Room.GetRoomItemHandler()
                .SetFloorItem(null, fItem, xToSet, yToSet, rotationToSet, false, false, false, false, false);
                fItem.ExtraData = extraDataToSet;
                fItem.UpdateState();
            }
            return(true);
        }
Exemple #8
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }

            RoomUser user = (RoomUser)stuff[0];

            if (stuff[1] == null)
            {
                return(false);
            }

            Interaction item = (Interaction)stuff[1];

            if (_mBanned.Contains(item))
            {
                return(false);
            }

            if (user == null)
            {
                return(false);
            }

            if (OtherExtraString2 == null)
            {
                return(false);
            }

            int amountLeft = Convert.ToInt32(OtherExtraString2);

            bool unique = OtherBool;

            bool premied = false;

            if (amountLeft == 1)
            {
                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));

                message.AppendInteger(0);
                user.GetClient().SendMessage(message);

                return(true);
            }

            foreach (string dataStr in OtherString.Split(';'))
            {
                string[] dataArray = dataStr.Split(',');

                bool   isbadge    = dataArray[0] == "0";
                string code       = dataArray[1];
                int    percentage = int.Parse(dataArray[2]);

                int random = Yupi.GetRandomNumber(0, 100);

                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));

                if (!unique && percentage < random)
                {
                    continue;
                }

                premied = true;

                if (isbadge)
                {
                    if (user.GetClient().GetHabbo().GetBadgeComponent().HasBadge(code))
                    {
                        message.AppendInteger(1);
                        user.GetClient().SendMessage(message);
                    }
                    else
                    {
                        user.GetClient()
                        .GetHabbo()
                        .GetBadgeComponent()
                        .GiveBadge(code, true, user.GetClient(), true);

                        message.AppendInteger(7);
                        user.GetClient().SendMessage(message);
                    }
                }
                else //item or effect
                {
                    Item roomItem = Yupi.GetGame().GetItemManager().GetItem(uint.Parse(code));

                    if (roomItem == null)
                    {
                        continue;
                    }

                    if (roomItem.Type == 'e') // is effect
                    {
                        user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(roomItem.SpriteId, 3600, 1);
                    }
                    else
                    {
                        user.GetClient().GetHabbo().GetInventoryComponent().AddNewItem(0u, roomItem.Name, "0", 0u, true, false, 0, 0);
                        user.GetClient().SendMessage(new ServerMessage(LibraryParser.OutgoingRequest("UpdateInventoryMessageComposer")));
                    }

                    message.AppendInteger(6);
                    user.GetClient().SendMessage(message);
                }
            }

            if (!premied)
            {
                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));
                message.AppendInteger(4);
                user.GetClient().SendMessage(message);
            }
            else if (amountLeft > 1)
            {
                amountLeft--;
                OtherExtraString2 = amountLeft.ToString();
            }

            return(true);
        }
Exemple #9
0
        public bool Execute(params object[] stuff)
        {
            if (stuff[0] == null)
            {
                return(false);
            }
            var user = (RoomUser)stuff[0];
            var item = (Interaction)stuff[1];

            if (_mBanned.Contains(item))
            {
                return(false);
            }

            if (user == null)
            {
                return(false);
            }

            var amountLeft = int.Parse(OtherExtraString2);
            var often      = int.Parse(OtherExtraString);

            bool premied = false;

            if (amountLeft == 0)
            {
                var message = new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));
                message.AppendInteger(0);
                user.GetClient().SendMessage(message);

                return(true);
            }

            foreach (var dataStr in OtherString.Split(';'))
            {
                var dataArray = dataStr.Split(',');

                var isbadge    = dataArray[0] == "0";
                var code       = dataArray[1];
                var percentage = int.Parse(dataArray[2]);

                var random = Plus.GetRandomNumber(0, 100);

                var message =
                    new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));

                if (often == 0 && random <= percentage)
                {
                    continue;
                }
                premied = true;

                if (isbadge)
                {
                    if (user.GetClient().GetHabbo().GetBadgeComponent().HasBadge(code))
                    {
                        message.AppendInteger(1);
                        user.GetClient().SendMessage(message);
                    }
                    else
                    {
                        user.GetClient()
                        .GetHabbo()
                        .GetBadgeComponent()
                        .GiveBadge(code, true, user.GetClient(), true);

                        message.AppendInteger(7);
                        user.GetClient().SendMessage(message);
                    }
                }
                else //item or effect
                {
                    var roomItem = Plus.GetGame().GetItemManager().GetItem(uint.Parse(code));
                    if (roomItem == null)
                    {
                        continue;
                    }

                    if (roomItem.Type == 'e') // is effect
                    {
                        user.GetClient()
                        .GetHabbo()
                        .GetAvatarEffectsInventoryComponent().AddNewEffect(roomItem.SpriteId, 3600, 1);
                    }
                    else
                    {
                        user.GetClient()
                        .GetHabbo()
                        .GetInventoryComponent()
                        .AddNewItem(0u, roomItem.ItemId, "0", 0u, true, false, 0, 0, "");
                        user.GetClient()
                        .SendMessage(
                            new ServerMessage(LibraryParser.OutgoingRequest("UpdateInventoryMessageComposer")));
                    }

                    message.AppendInteger(6);
                    user.GetClient().SendMessage(message);
                }
            }

            if (!premied)
            {
                var message = new ServerMessage(LibraryParser.OutgoingRequest("WiredRewardAlertMessageComposer"));
                message.AppendInteger(4);
                user.GetClient().SendMessage(message);
            }
            return(true);
        }