Beispiel #1
0
        public bool ExecuteWired(WiredItemType Type, params object[] Stuff)
        {
            bool flag = false;
            bool result;

            try
            {
                if (!this.IsTrigger(Type))
                {
                    result = false;
                }
                else
                {
                    foreach (WiredItem current in this.wiredItems)
                    {
                        if (current.Type == Type && current.Execute(Stuff))
                        {
                            flag = true;
                        }
                    }
                    result = flag;
                }
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Beispiel #2
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            return(true);
        }
Beispiel #3
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }
            if (roomUser == null || this.mItems.Count == 0 || this.mRoom.GetWiredHandler().IsCycleQueued(this))
            {
                return(false);
            }
            if (this.mDelay < 500)
            {
                this.mDelay = 500;
            }
            if (this.mNext == 0L || this.mNext < CyberEnvironment.Now())
            {
                this.mNext = checked (CyberEnvironment.Now() + unchecked ((long)this.mDelay));
            }
            lock (this.mUsers.SyncRoot)
            {
                if (!this.mUsers.Contains(roomUser))
                {
                    this.mUsers.Enqueue(roomUser);
                }
            }
            this.mRoom.GetWiredHandler().EnqueueCycle(this);
            return(true);
        }
Beispiel #4
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }

            if (roomUser != null && !string.IsNullOrWhiteSpace(this.mText))
            {
                if (roomUser.GetClient().GetHabbo().HasFuse("fuse_mod") || this.mRoom.Owner == roomUser.GetUsername())
                {
                    return(false);
                }
                roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(4, false);
                roomUser.GetClient().SendWhisper(this.mText);
                mUsers.Add(roomUser);
            }

            if (mTimer == null)
            {
                mTimer = new Timer(2000);
            }

            this.mTimer.Elapsed += ExecuteKick;
            this.mTimer.Enabled  = true;

            return(true);
        }
Beispiel #5
0
        public bool ExecuteWired(WiredItemType Type, params object[] Stuff)
        {
            bool Completed = false;
            try
            {
                if(!IsTrigger(Type))
                {
                    return false;
                }

                foreach (WiredItem Item in wiredItems)
                {
                    if (Item.Type == Type)
                    {
                        if (Item.Execute(Stuff))
                        {
                            Completed = true;
                        }
                    }
                }
                return Completed;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return false;
            }
        }
Beispiel #6
0
        private bool IsCondition(WiredItemType Type)
        {
            switch (Type)
            {
            case WiredItemType.ConditionFurniHasUsers:
            case WiredItemType.ConditionFurniHasFurni:
            case WiredItemType.ConditionTriggererOnFurni:
            case WiredItemType.ConditionFurniCoincides:
            case WiredItemType.ConditionIsGroupMember:
            case WiredItemType.ConditionFurniTypeMatches:
            case WiredItemType.ConditionHowManyUsers:
            case WiredItemType.ConditionTriggererNotOnFurni:
            case WiredItemType.ConditionFurniHasNotFurni:
            case WiredItemType.ConditionFurniHaveNotUsers:
            case WiredItemType.ConditionItemsDontMatch:
            case WiredItemType.ConditionFurniTypeDontMatch:
            case WiredItemType.ConditionIsNotGroupMember:
            case WiredItemType.ConditionNotHowManyUsers:
            case WiredItemType.ConditionIsWearingEffect:
            case WiredItemType.ConditionIsNotWearingEffect:
            case WiredItemType.ConditionIsWearingBadge:
            case WiredItemType.ConditionIsNotWearingBadge:
            case WiredItemType.ConditionDateRangeActive:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #7
0
 public void ResetExtraString(WiredItemType Type)
 {
     lock (wiredItems)
     {
         foreach (WiredItem current in wiredItems)
         {
             if (current.Type == Type)
             {
                 current.OtherExtraString = "0";
             }
         }
     }
 }
Beispiel #8
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }
            if (roomUser != null && !string.IsNullOrEmpty(this.mText))
            {
                roomUser.GetClient().SendWhisper(this.mText);
            }
            return(true);
        }
Beispiel #9
0
 private bool IsEffect(WiredItemType Type)
 {
     switch (Type)
     {
     case WiredItemType.EffectShowMessage:
     case WiredItemType.EffectTeleportToFurni:
     case WiredItemType.EffectToggleFurniState:
     case WiredItemType.EffectMoveRotateFurni:
     case WiredItemType.EffectKickUser:
     case WiredItemType.EffectGiveReward:
     case WiredItemType.EffectResetPosition:
     case WiredItemType.EffectGiveScore:
     case WiredItemType.EffectResetTimers:
     case WiredItemType.EffectMuteUser:
         return(true);
     }
     return(false);
 }
Beispiel #10
0
        private bool IsTrigger(WiredItemType Type)
        {
            switch (Type)
            {
            case WiredItemType.TriggerUserEntersRoom:
            case WiredItemType.TriggerUserSaysKeyword:
            case WiredItemType.TriggerRepeatEffect:
            case WiredItemType.TriggerGameStarts:
            case WiredItemType.TriggerGameEnds:
            case WiredItemType.TriggerToggleFurni:
            case WiredItemType.TriggerWalksOnFurni:
            case WiredItemType.TriggerWalksOffFurni:
            case WiredItemType.TriggerScoreAchieved:
            case WiredItemType.TriggerLongRepeater:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #11
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            foreach (RoomItem Aitem in this.Items)
            {
                switch (Aitem.GetBaseItem().InteractionType)
                {
                case InteractionType.triggerrepeater:
                case InteractionType.triggertimer:
                    WiredItem Trigger = Room.GetWiredHandler().GetWired(Aitem);

                    Trigger.Delay = 5000;
                    Room.GetWiredHandler().ReloadWired(Trigger);
                    break;
                }
            }

            return(true);
        }
Beispiel #12
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (roomUser == null)
            {
                return(false);
            }
            else if (roomUser.team == Games.Team.none)
            {
                return(false);
            }

            int TimesDone = 0;

            int.TryParse(mExtra, out TimesDone);

            int ScoreToAchieve = 10;
            int MaxTimes       = 1;

            if (!String.IsNullOrWhiteSpace(mText))
            {
                string[] Integers = mText.Split(',');
                ScoreToAchieve = int.Parse(Integers[0]);
                MaxTimes       = int.Parse(Integers[1]);
            }

            if (TimesDone >= MaxTimes)
            {
                return(false);
            }

            Room.GetGameManager().AddPointToTeam(roomUser.team, ScoreToAchieve, roomUser);
            TimesDone++;

            mExtra = TimesDone.ToString();
            return(true);
        }
Beispiel #13
0
        private bool IsCondition(WiredItemType Type)
        {
            switch (Type)
            {
                case WiredItemType.ConditionFurniHasUsers:
                case WiredItemType.ConditionFurniHasFurni:
                case WiredItemType.ConditionTriggererOnFurni:
                    return true;
            }

            return false;
        }
Beispiel #14
0
        private bool IsEffect(WiredItemType Type)
        {
            switch (Type)
            {
                case WiredItemType.EffectShowMessage:
                case WiredItemType.EffectTeleportToFurni:
                case WiredItemType.EffectToggleFurniState:
                case WiredItemType.EffectMoveRotateFurni:
                case WiredItemType.EffectKickUser:
                case WiredItemType.actionposreset:
                    return true;
            }

            return false;
        }
Beispiel #15
0
        private bool IsTrigger(WiredItemType Type)
        {
            switch (Type)
            {
                case WiredItemType.TriggerUserEntersRoom:
                case WiredItemType.TriggerUserSaysKeyword:
                case WiredItemType.TriggerRepeatEffect:
                case WiredItemType.TriggerGameStarts:
                case WiredItemType.TriggerGameEnds:
                case WiredItemType.TriggerToggleFurni:
                case WiredItemType.TriggerWalksOnFurni:
                case WiredItemType.TriggerWalksOffFurni:
                    return true;
            }

            return false;
        }
Beispiel #16
0
 private bool IsCondition(WiredItemType Type)
 {
     switch (Type)
     {
         case WiredItemType.ConditionFurniHasUsers:
         case WiredItemType.ConditionFurniHasFurni:
         case WiredItemType.ConditionTriggererOnFurni:
         case WiredItemType.ConditionFurniCoincides:
         case WiredItemType.ConditionIsGroupMember:
         case WiredItemType.ConditionFurniTypeMatches:
         case WiredItemType.ConditionHowManyUsers:
         case WiredItemType.ConditionTriggererNotOnFurni:
         case WiredItemType.ConditionFurniHasNotFurni:
         case WiredItemType.ConditionFurniHaveNotUsers:
         case WiredItemType.ConditionItemsDontMatch:
         case WiredItemType.ConditionFurniTypeDontMatch:
         case WiredItemType.ConditionIsNotGroupMember:
         case WiredItemType.ConditionNotHowManyUsers:
         case WiredItemType.ConditionIsWearingEffect:
         case WiredItemType.ConditionIsNotWearingEffect:
         case WiredItemType.ConditionIsWearingBadge:
         case WiredItemType.ConditionIsNotWearingBadge:
         case WiredItemType.ConditionDateRangeActive:
             return true;
         default:
             return false;
     }
 }
Beispiel #17
0
		private bool IsEffect(WiredItemType Type)
		{
			switch (Type)
			{
			case WiredItemType.EffectShowMessage:
			case WiredItemType.EffectTeleportToFurni:
			case WiredItemType.EffectToggleFurniState:
			case WiredItemType.EffectMoveRotateFurni:
			case WiredItemType.EffectKickUser:
			case WiredItemType.EffectGiveReward:
                case WiredItemType.EffectResetPosition:
                case WiredItemType.EffectGiveScore:
                case WiredItemType.EffectResetTimers:
                case WiredItemType.EffectMuteUser:
				return true;
			}
			return false;
		}
Beispiel #18
0
		public bool ExecuteWired(WiredItemType Type, params object[] Stuff)
		{
			bool flag = false;
			bool result;
			try
			{
				if (!this.IsTrigger(Type))
				{
					result = false;
				}
				else
				{
					foreach (WiredItem current in this.wiredItems)
					{
						if (current.Type == Type && current.Execute(Stuff))
						{
							flag = true;
						}
					}
					result = flag;
				}
			}
			catch
			{
				result = false;
			}
			return result;
		}
Beispiel #19
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }
            if (roomUser == null)
            {
                return(false);
            }
            string[] array = this.OtherString.Split(new char[]
            {
                ';'
            });
            bool   flag   = true;
            Random random = new Random();

            if (!this.OtherBool)
            {
                string[] array2 = array;
                int      i      = 0;
                while (i < array2.Length)
                {
                    string   text   = array2[i];
                    string[] array3 = text.Split(new char[]
                    {
                        ','
                    });
                    bool   flag2   = false;
                    string Product = "";
                    int    num     = 0;
                    try
                    {
                        flag2   = int.Parse(array3[0]) == 0;
                        Product = array3[1];
                        num     = int.Parse(array3[2]);
                    }
                    catch
                    {
                    }
                    if (random.Next(0, 101) <= num)
                    {
                        if (flag2)
                        {
                            roomUser.GetClient().GetHabbo().GetBadgeComponent().GiveBadge(Product, true, roomUser.GetClient(), true);
                            break;
                        }
                        if (Product.StartsWith("avatar_effect"))
                        {
                            string s        = Product.Trim().Replace("avatar_effect", "");
                            int    effectId = int.Parse(s);
                            roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(effectId, 68400);
                            ServerMessage serverMessage = new ServerMessage(Outgoing.WiredRewardAlertMessageComposer);
                            serverMessage.AppendInt32(6);
                            roomUser.GetClient().SendMessage(serverMessage);
                            break;
                        }
                        Item item2 = null;
                        try
                        {
                            item2 = (
                                from x in CyberEnvironment.GetGame().GetItemManager().Items.Values
                                where x.Name == Product
                                select x).FirstOrDefault <Item>();
                        }
                        catch (Exception)
                        {
                            flag = false;
                        }
                        if (item2 == null)
                        {
                            flag = false;
                            break;
                        }
                        roomUser.GetClient().GetHabbo().GetInventoryComponent().AddNewItem(0u, item2.ItemId, "0", 0u, true, false, 0, 0, "");
                        ServerMessage serverMessage2 = new ServerMessage(Outgoing.WiredRewardAlertMessageComposer);
                        serverMessage2.AppendInt32(6);
                        roomUser.GetClient().SendMessage(serverMessage2);
                        roomUser.GetClient().SendMessage(new ServerMessage(Outgoing.UpdateInventoryMessageComposer));
                        break;
                    }
                    else
                    {
                        flag = false;
                        i++;
                    }
                }
            }
            else
            {
                string[] array4 = array;
                for (int j = 0; j < array4.Length; j++)
                {
                    string   text2  = array4[j];
                    string[] array5 = text2.Split(new char[]
                    {
                        ','
                    });
                    bool   flag3   = int.Parse(array5[0]) == 0;
                    string Product = array5[1];
                    int.Parse(array5[2]);
                    if (flag3)
                    {
                        roomUser.GetClient().GetHabbo().GetBadgeComponent().GiveBadge(Product, true, roomUser.GetClient(), true);
                    }
                    else
                    {
                        if (Product.StartsWith("avatar_effect"))
                        {
                            string s2        = Product.Trim().Replace("avatar_effect", "");
                            int    effectId2 = int.Parse(s2);
                            roomUser.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(effectId2, 68400);
                            ServerMessage serverMessage3 = new ServerMessage(Outgoing.WiredRewardAlertMessageComposer);
                            serverMessage3.AppendInt32(6);
                            roomUser.GetClient().SendMessage(serverMessage3);
                        }
                        else
                        {
                            Item item3 = null;
                            try
                            {
                                item3 = (
                                    from x in CyberEnvironment.GetGame().GetItemManager().Items.Values
                                    where x.Name == Product
                                    select x).FirstOrDefault <Item>();
                            }
                            catch (Exception)
                            {
                                flag = false;
                            }
                            if (item3 == null)
                            {
                                flag = false;
                            }
                            else
                            {
                                roomUser.GetClient().GetHabbo().GetInventoryComponent().AddNewItem(0u, item3.ItemId, "0", 0u, true, false, 0, 0, "");
                                ServerMessage serverMessage4 = new ServerMessage(Outgoing.WiredRewardAlertMessageComposer);
                                serverMessage4.AppendInt32(6);
                                roomUser.GetClient().SendMessage(serverMessage4);
                                roomUser.GetClient().SendMessage(new ServerMessage(Outgoing.UpdateInventoryMessageComposer));
                            }
                        }
                    }
                }
            }
            if (!flag)
            {
                ServerMessage serverMessage5 = new ServerMessage(Outgoing.WiredRewardAlertMessageComposer);
                serverMessage5.AppendInt32(4);
                roomUser.GetClient().SendMessage(serverMessage5);
            }
            return(true);
        }
Beispiel #20
0
        public bool Execute(params object[] Stuff)
        {
            RoomUser      roomUser = (RoomUser)Stuff[0];
            WiredItemType item     = (WiredItemType)Stuff[1];

            if (this.mBanned.Contains(item))
            {
                return(false);
            }
            if (roomUser == null || roomUser.GetClient() == null || roomUser.GetClient().GetHabbo() == null)
            {
                return(false);
            }

            Room Room = roomUser.GetClient().GetHabbo().CurrentRoom;

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

            if (String.IsNullOrWhiteSpace(mText) || String.IsNullOrWhiteSpace(mExtra))
            {
                return(false);
            }

            string[] Booleans = mText.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 mExtra.Split('/'))
            {
                if (String.IsNullOrWhiteSpace(ItemData))
                {
                    continue;
                }

                string[] InnerData = ItemData.Split('|');
                uint     ItemId    = uint.Parse(InnerData[0]);


                RoomItem Item = Room.GetRoomItemHandler().GetItem(ItemId);

                if (Item == null)
                {
                    continue;
                }

                string ExtraDataToSet = (ExtraData) ? InnerData[1] : Item.ExtraData;
                int    RotationToSet  = (Rot) ? int.Parse(InnerData[2]) : Item.Rot;

                string[] Positions = InnerData[3].Split(',');
                int      XToSet    = (Position) ? int.Parse(Positions[0]) : Item.GetX;
                int      YToSet    = (Position) ? int.Parse(Positions[1]) : Item.GetY;
                double   ZToSet    = (Position) ? double.Parse(Positions[2]) : Item.GetZ;


                ServerMessage serverMessage = new ServerMessage(Outgoing.ItemAnimationMessageComposer);
                serverMessage.AppendInt32(Item.GetX);
                serverMessage.AppendInt32(Item.GetY);
                serverMessage.AppendInt32(XToSet);
                serverMessage.AppendInt32(YToSet);
                serverMessage.AppendInt32(1);
                serverMessage.AppendUInt(Item.Id);
                serverMessage.AppendString(Item.GetZ.ToString(CyberEnvironment.cultureInfo));
                serverMessage.AppendString(ZToSet.ToString(CyberEnvironment.cultureInfo));
                serverMessage.AppendInt32(0);
                Room.SendMessage(serverMessage);

                Room.GetRoomItemHandler().SetFloorItem(roomUser.GetClient(), Item, XToSet, YToSet, RotationToSet, false, false, false, false);
                Item.ExtraData = ExtraDataToSet;
                Item.UpdateState();
            }
            return(true);
        }
Beispiel #21
0
 public void ResetExtraString(WiredItemType Type)
 {
     lock (wiredItems)
     {
         foreach (WiredItem current in wiredItems)
         {
             if (current.Type == Type)
             {
                 current.OtherExtraString = "0";
             }
         }
     }
 }