Пример #1
0
        public ItemData(int Id, int Sprite, string Name, string PublicName, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat,
                        bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, InteractionType InteractionType, int Modes,
                        string VendingIds, List <double> AdjustableHeights, int EffectId, int WiredId, bool IsRare, int ClothingId, bool ExtraRot)
        {
            this.Id                   = Id;
            this.SpriteId             = Sprite;
            this.ItemName             = Name;
            this.PublicName           = PublicName;
            this.Type                 = char.Parse(Type);
            this.Width                = Width;
            this.Length               = Length;
            this.Height               = Height;
            this.Stackable            = Stackable;
            this.Walkable             = Walkable;
            this.IsSeat               = IsSeat;
            this.AllowEcotronRecycle  = AllowRecycle;
            this.AllowTrade           = AllowTrade;
            this.AllowMarketplaceSell = AllowMarketplaceSell;
            this.AllowGift            = AllowGift;
            this.AllowInventoryStack  = AllowInventoryStack;
            this.InteractionType      = InteractionType;
            this.Modes                = Modes;
            this.VendingIds           = new List <int>();
            if (VendingIds.Contains(","))
            {
                foreach (string VendingId in VendingIds.Split(','))
                {
                    try
                    {
                        this.VendingIds.Add(int.Parse(VendingId));
                    }
                    catch
                    {
                        Console.WriteLine("Erro com item " + ItemName + ".");
                        continue;
                    }
                }
            }
            else if (!String.IsNullOrEmpty(VendingIds) && (int.Parse(VendingIds)) > 0)
            {
                this.VendingIds.Add(int.Parse(VendingIds));
            }

            this.AdjustableHeights = new Dictionary <string, double>();

            int count = 0;

            foreach (double eHeight in AdjustableHeights)
            {
                this.AdjustableHeights.Add(count.ToString(), eHeight);
                count++;
            }

            this.EffectId   = EffectId;
            this.WiredType  = WiredBoxTypeUtility.FromWiredId(WiredId);
            this.IsRare     = IsRare;
            this.ClothingId = ClothingId;
            this.ExtraRot   = ExtraRot;
        }
Пример #2
0
        public override void Compose(ServerPacket packet)
        {
            packet.WriteBoolean(false);
            packet.WriteInteger(5);

            packet.WriteInteger(Box.SetItems.Count);
            foreach (Item Item in Box.SetItems.Values.ToList())
            {
                packet.WriteInteger(Item.Id);
            }

            packet.WriteInteger(Box.Item.GetBaseItem().SpriteId);
            packet.WriteInteger(Box.Item.Id);
            packet.WriteString(Box.StringData);

            if (Box.Type == WiredBoxType.ConditionMatchStateAndPosition || Box.Type == WiredBoxType.ConditionDontMatchStateAndPosition)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0;0";
                }

                packet.WriteInteger(3);//Loop
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0);
            }
            else if (Box.Type == WiredBoxType.ConditionUserCountInRoom || Box.Type == WiredBoxType.ConditionUserCountDoesntInRoom)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                packet.WriteInteger(2);//Loop
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 1);
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 50);
            }

            if (Box.Type == WiredBoxType.ConditionFurniHasNoFurni)
            {
                packet.WriteInteger(1);
            }

            if (Box.Type != WiredBoxType.ConditionUserCountInRoom && Box.Type != WiredBoxType.ConditionUserCountDoesntInRoom && Box.Type != WiredBoxType.ConditionFurniHasNoFurni)
            {
                packet.WriteInteger(0);
            }
            else if (Box.Type == WiredBoxType.ConditionFurniHasNoFurni)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0";
                }
                packet.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 50);
            }
            packet.WriteInteger(0);
            packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
        }
Пример #3
0
        public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
        {
            bool flag = Session == null || Item == null;

            if (!flag)
            {
                bool flag2 = !HasRights;
                if (!flag2)
                {
                    IWiredItem wiredItem = null;
                    bool       flag3     = !Item.GetRoom().GetWired().TryGet(Item.Id, out wiredItem);
                    if (!flag3)
                    {
                        Item.ExtraData = "1";
                        Item.UpdateState(false, true);
                        Item.RequestUpdate(2, true);
                        bool flag4 = Item.GetBaseItem().WiredType == WiredBoxType.AddonRandomEffect;
                        if (!flag4)
                        {
                            bool flag5 = Item.GetRoom().GetWired().IsTrigger(Item);
                            if (flag5)
                            {
                                List <int> blockedItems = WiredBoxTypeUtility.ContainsBlockedEffect(wiredItem, Item.GetRoom().GetWired().GetEffects(wiredItem));
                                Session.SendMessage(new WiredTriggerConfigComposer(wiredItem, blockedItems));
                            }
                            else
                            {
                                bool flag6 = Item.GetRoom().GetWired().IsEffect(Item);
                                if (flag6)
                                {
                                    List <int> blockedItems2 = WiredBoxTypeUtility.ContainsBlockedTrigger(wiredItem, Item.GetRoom().GetWired().GetTriggers(wiredItem));
                                    Session.SendMessage(new WiredEffectConfigComposer(wiredItem, blockedItems2));
                                }
                                else
                                {
                                    bool flag7 = Item.GetRoom().GetWired().IsCondition(Item);
                                    if (flag7)
                                    {
                                        Session.SendMessage(new WiredConditionConfigComposer(wiredItem));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        public void OnTrigger(Player Session, Item Item, int Request, bool HasRights)
        {
            if (Session == null || Item == null)
            {
                return;
            }

            if (!HasRights)
            {
                return;
            }

            IWiredItem Box = null;

            if (!Item.GetRoom().GetWired().TryGet(Item.Id, out Box))
            {
                return;
            }

            Item.ExtraData = "1";
            Item.UpdateState(false, true);
            Item.RequestUpdate(2, true);

            if (Item.GetBaseItem().WiredType == WiredBoxType.AddonRandomEffect)
            {
                return;
            }

            if (Item.GetRoom().GetWired().IsTrigger(Item))
            {
                var BlockedItems = WiredBoxTypeUtility.ContainsBlockedEffect(Box, Item.GetRoom().GetWired().GetEffects(Box));
                Session.SendPacket(new WiredTriggeRconfigComposer(Box, BlockedItems));
            }
            else if (Item.GetRoom().GetWired().IsEffect(Item))
            {
                var BlockedItems = WiredBoxTypeUtility.ContainsBlockedTrigger(Box, Item.GetRoom().GetWired().GetTriggers(Box));
                Session.SendPacket(new WiredEffectConfigComposer(Box, BlockedItems));
            }
            else if (Item.GetRoom().GetWired().IsCondition(Item))
            {
                Session.SendPacket(new WiredConditionConfigComposer(Box));
            }
        }
Пример #5
0
        public void OnTrigger(GameClient session, Item item, int request, bool hasRights)
        {
            if (session == null || item == null)
            {
                return;
            }
            if (!hasRights)
            {
                return;
            }

            IWiredItem box = null;

            if (!item.GetRoom().GetWired().TryGet(item.Id, out box))
            {
                return;
            }

            item.ExtraData = "1";
            item.UpdateState(false, true);
            item.RequestUpdate(2, true);
            if (item.GetBaseItem().WiredType == WiredBoxType.AddonRandomEffect)
            {
                return;
            }

            if (item.GetRoom().GetWired().IsTrigger(item))
            {
                var blockedItems = WiredBoxTypeUtility.ContainsBlockedEffect(box, item.GetRoom().GetWired().GetEffects(box));
                session.SendPacket(new WiredTriggerConfigComposer(box, blockedItems));
            }
            else if (item.GetRoom().GetWired().IsEffect(item))
            {
                var blockedItems = WiredBoxTypeUtility.ContainsBlockedTrigger(box, item.GetRoom().GetWired().GetTriggers(box));
                session.SendPacket(new WiredEffectConfigComposer(box, blockedItems));
            }
            else if (item.GetRoom().GetWired().IsCondition(item))
            {
                session.SendPacket(new WiredConditionConfigComposer(box));
            }
        }
Пример #6
0
        public WiredTriggerConfigComposer(IWiredItem Box, List <int> BlockedItems)
            : base(ServerPacketHeader.WiredTriggerConfigMessageComposer)
        {
            base.WriteBoolean(false);
            base.WriteInteger(5);

            base.WriteInteger(Box.SetItems.Count);
            foreach (Item Item in Box.SetItems.Values.ToList())
            {
                base.WriteInteger(Item.Id);
            }

            base.WriteInteger(Box.Item.GetBaseItem().SpriteId);
            base.WriteInteger(Box.Item.Id);
            base.WriteString(Box.StringData);

            base.WriteInteger(Box is IWiredCycle ? 1 : 0);
            if (Box is IWiredCycle && Box.Type != WiredBoxType.TriggerLongRepeat)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger(Cycle.Delay);
            }
            else if (Box.Type == WiredBoxType.TriggerLongRepeat)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger((Cycle.Delay * 500) / 5000);
            }


            base.WriteInteger(0);
            base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
            base.WriteInteger(BlockedItems.Count());
            if (BlockedItems.Count() > 0)
            {
                foreach (int Id in BlockedItems.ToList())
                {
                    base.WriteInteger(Id);
                }
            }
        }
Пример #7
0
        public override void Compose(ServerPacket packet)
        {
            packet.WriteBoolean(false);
            packet.WriteInteger(15);

            packet.WriteInteger(WiredItem.SetItems.Count);
            foreach (Item Item in WiredItem.SetItems.Values.ToList())
            {
                packet.WriteInteger(Item.Id);
            }

            packet.WriteInteger(WiredItem.Item.GetBaseItem().SpriteId);
            packet.WriteInteger(WiredItem.Item.Id);

            if (WiredItem.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                if (String.IsNullOrEmpty(WiredItem.StringData))
                {
                    WiredItem.StringData = "Bot name;0";
                }

                packet.WriteString(WiredItem.StringData != null ? (WiredItem.StringData.Split(';')[0]) : "");
            }
            else if (WiredItem.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                if (String.IsNullOrEmpty(WiredItem.StringData))
                {
                    WiredItem.StringData = "0;Bot name";
                }

                packet.WriteString(WiredItem.StringData != null ? (WiredItem.StringData.Split(';')[1]) : "");
            }
            else
            {
                packet.WriteString(WiredItem.StringData);
            }

            if (WiredItem.Type != WiredBoxType.EffectMatchPosition && WiredItem.Type != WiredBoxType.EffectMoveAndRotate && WiredItem.Type != WiredBoxType.EffectMuteTriggerer && WiredItem.Type != WiredBoxType.EffectBotFollowsUserBox)
            {
                packet.WriteInteger(0); // Loop
            }
            else if (WiredItem.Type == WiredBoxType.EffectMatchPosition)
            {
                if (String.IsNullOrEmpty(WiredItem.StringData))
                {
                    WiredItem.StringData = "0;0;0";
                }

                packet.WriteInteger(3);
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0);
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0);
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[2]) : 0);
            }
            else if (WiredItem.Type == WiredBoxType.EffectMoveAndRotate)
            {
                if (String.IsNullOrEmpty(WiredItem.StringData))
                {
                    WiredItem.StringData = "0;0";
                }

                packet.WriteInteger(2);
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0);
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0);
            }
            else if (WiredItem.Type == WiredBoxType.EffectMuteTriggerer)
            {
                if (String.IsNullOrEmpty(WiredItem.StringData))
                {
                    WiredItem.StringData = "0;Message";
                }

                packet.WriteInteger(1);//Count, for the time.
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0);
            }
            else if (WiredItem.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                packet.WriteInteger(1);//Count, for the time.
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0);
            }
            else if (WiredItem.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0);
            }

            if (WiredItem is IWiredCycle && WiredItem.Type != WiredBoxType.EffectKickUser && WiredItem.Type != WiredBoxType.EffectMatchPosition && WiredItem.Type != WiredBoxType.EffectMoveAndRotate && WiredItem.Type != WiredBoxType.EffectSetRollerSpeed)
            {
                IWiredCycle Cycle = (IWiredCycle)WiredItem;
                packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type));
                packet.WriteInteger(0);
                packet.WriteInteger(Cycle.Delay);
            }
            else if (WiredItem.Type == WiredBoxType.EffectMatchPosition || WiredItem.Type == WiredBoxType.EffectMoveAndRotate)
            {
                IWiredCycle Cycle = (IWiredCycle)WiredItem;
                packet.WriteInteger(0);
                packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type));
                packet.WriteInteger(Cycle.Delay);
            }
            else
            {
                packet.WriteInteger(0);
                packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type));
                packet.WriteInteger(0);
            }

            packet.WriteInteger(BlockedItems.Count()); // Incompatable items loop
            if (BlockedItems.Count() > 0)
            {
                foreach (int ItemId in BlockedItems.ToList())
                {
                    packet.WriteInteger(ItemId);
                }
            }
        }
Пример #8
0
        public WiredEffectConfigComposer(IWiredItem Box, List <int> BlockedItems)
            : base(ServerPacketHeader.WiredEffectConfigMessageComposer)
        {
            base.WriteBoolean(false);
            base.WriteInteger(15);

            base.WriteInteger(Box.SetItems.Count);
            foreach (Item Item in Box.SetItems.Values.ToList())
            {
                base.WriteInteger(Item.Id);
            }

            base.WriteInteger(Box.Item.GetBaseItem().SpriteId);
            base.WriteInteger(Box.Item.Id);

            if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "Bot name;0";
                }

                base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[0]) : "");
            }
            else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;Bot name";
                }

                base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[1]) : "");
            }
            else
            {
                base.WriteString(Box.StringData);
            }

            if (Box.Type != WiredBoxType.EffectMatchPosition &&
                Box.Type != WiredBoxType.EffectMoveAndRotate &&
                Box.Type != WiredBoxType.EffectMuteTriggerer &&
                Box.Type != WiredBoxType.EffectBotFollowsUserBox &&
                Box.Type != WiredBoxType.EffectAddScore)
            {
                base.WriteInteger(0); // Loop
            }
            else if (Box.Type == WiredBoxType.EffectMatchPosition)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0;0";
                }

                base.WriteInteger(3);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectAddScore)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "1;1";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMoveAndRotate)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMuteTriggerer)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;Message";
                }

                base.WriteInteger(1);//Count, for the time.
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                base.WriteInteger(1);//Count, for the time.
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }

            if (Box is IWiredCycle && Box.Type != WiredBoxType.EffectKickUser && Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectSetRollerSpeed && Box.Type != WiredBoxType.EffectAddScore)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(0);
                base.WriteInteger(Cycle.Delay);
            }
            else if (Box.Type == WiredBoxType.EffectMatchPosition || Box.Type == WiredBoxType.EffectMoveAndRotate || Box.Type == WiredBoxType.EffectAddScore)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger(0);
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(Cycle.Delay);
            }
            else
            {
                base.WriteInteger(0);
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(0);
            }

            base.WriteInteger(BlockedItems.Count()); // Incompatable items loop
            if (BlockedItems.Count() > 0)
            {
                foreach (int ItemId in BlockedItems.ToList())
                {
                    base.WriteInteger(ItemId);
                }
            }
        }
Пример #9
0
        public ItemData(int Id, int Sprite, string Name, string PublicName, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat,
                        bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, InteractionType InteractionType, int behaviourData, int Modes,
                        string VendingIds, string AdjustableHeights, int EffectId, int WiredId, bool IsRare, int ClothingId, bool ExtraRot)
        {
            this.Id                   = Id;
            SpriteId                  = Sprite;
            ItemName                  = Name;
            this.PublicName           = PublicName;
            this.Type                 = char.Parse(Type);
            this.Width                = Width;
            this.Length               = Length;
            this.Height               = Height;
            this.Stackable            = Stackable;
            this.Walkable             = Walkable;
            this.IsSeat               = IsSeat;
            AllowEcotronRecycle       = AllowRecycle;
            this.AllowTrade           = AllowTrade;
            this.AllowMarketplaceSell = AllowMarketplaceSell;
            this.AllowGift            = AllowGift;
            this.AllowInventoryStack  = AllowInventoryStack;
            this.InteractionType      = InteractionType;
            BehaviourData             = behaviourData;
            this.Modes                = Modes;
            this.VendingIds           = new List <int>();
            if (VendingIds.Contains(","))
            {
                foreach (string VendingId in VendingIds.Split(','))
                {
                    try
                    {
                        this.VendingIds.Add(int.Parse(VendingId));
                    }
                    catch
                    {
                        Console.WriteLine("Error with Item " + ItemName + " - Vending Ids");
                        continue;
                    }
                }
            }
            else if (!String.IsNullOrEmpty(VendingIds) && (int.Parse(VendingIds)) > 0)
            {
                this.VendingIds.Add(int.Parse(VendingIds));
            }

            this.AdjustableHeights = new List <double>();
            if (AdjustableHeights.Contains(","))
            {
                foreach (string H in AdjustableHeights.Split(','))
                {
                    this.AdjustableHeights.Add(double.Parse(H));
                }
            }
            else if (!String.IsNullOrEmpty(AdjustableHeights) && (double.Parse(AdjustableHeights)) > 0)
            {
                this.AdjustableHeights.Add(double.Parse(AdjustableHeights));
            }

            int wiredId = 0;

            if (this.InteractionType == InteractionType.WIRED_CONDITION || this.InteractionType == InteractionType.WIRED_TRIGGER || this.InteractionType == InteractionType.WIRED_EFFECT)
            {
                wiredId = WiredId;
            }

            this.EffectId   = EffectId;
            WiredType       = WiredBoxTypeUtility.FromWiredId(wiredId);
            this.IsRare     = IsRare;
            this.ClothingId = ClothingId;
            this.ExtraRot   = ExtraRot;
        }
Пример #10
0
        public WiredConditionConfigComposer(IWiredItem Box)
            : base(ServerPacketHeader.WiredConditionConfigMessageComposer)
        {
            base.WriteBoolean(false);
            if (Box.Type == WiredBoxType.TotalUsersCoincidence)
            {
                base.WriteInteger(25);
            }
            else
            {
                base.WriteInteger(5);
            }

            base.WriteInteger(Box.SetItems.Count);
            foreach (Item Item in Box.SetItems.Values.ToList())
            {
                base.WriteInteger(Item.Id);
            }

            base.WriteInteger(Box.Item.GetBaseItem().SpriteId);
            base.WriteInteger(Box.Item.Id);
            base.WriteString(Box.StringData);

            if (Box.Type == WiredBoxType.ConditionDateRangeActive)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);//Loop
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }

            if (Box.Type == WiredBoxType.ConditionMatchStateAndPosition || Box.Type == WiredBoxType.ConditionDontMatchStateAndPosition)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0;0";
                }

                base.WriteInteger(3);//Loop
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0);
            }
            else if (Box.Type == WiredBoxType.ConditionUserCountInRoom || Box.Type == WiredBoxType.ConditionUserCountDoesntInRoom)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);//Loop
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 1);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 50);
            }

            if (Box.Type == WiredBoxType.ConditionFurniHasNoFurni || Box.Type == WiredBoxType.ConditionFurniHasFurni)
            {
                base.WriteInteger(1);
            }

            if (Box.Type != WiredBoxType.ConditionUserCountInRoom && Box.Type != WiredBoxType.ConditionUserCountDoesntInRoom && Box.Type != WiredBoxType.ConditionFurniHasNoFurni && Box.Type != WiredBoxType.ConditionFurniHasFurni && Box.Type != WiredBoxType.ConditionDateRangeActive)
            {
                base.WriteInteger(0);
            }
            else if (Box.Type == WiredBoxType.ConditionFurniHasNoFurni || Box.Type == WiredBoxType.ConditionFurniHasFurni)
            {
                base.WriteInteger(Box.BoolData ? 1 : 0);
            }
            base.WriteInteger(0);
            base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
        }
        public WiredEffectConfigComposer(IWiredItem Box, List <int> BlockedItems)
            : base(ServerPacketHeader.WiredEffectConfigMessageComposer)
        {
            base.WriteBoolean(false);
            if (Box.Type == WiredBoxType.EffectMoveUser || Box.Type == WiredBoxType.EffectProgressUserAchievement || Box.Type == WiredBoxType.EffectTimerReset)
            {
                base.WriteInteger(0);
            }
            else
            {
                base.WriteInteger(20);
            }

            base.WriteInteger(Box.SetItems.Count);
            foreach (Item Item in Box.SetItems.Values.ToList())
            {
                base.WriteInteger(Item.Id);
            }

            base.WriteInteger(Box.Item.GetBaseItem().SpriteId);
            base.WriteInteger(Box.Item.Id);

            if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "Bot name;0";
                }

                base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[0]) : "");
            }
            else if (Box.Type == WiredBoxType.EffectAddActorToTeam)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "1";
                }

                base.WriteString(Box.StringData != null ? Box.StringData : "");
            }

            else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;Bot name";
                }

                base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[1]) : "");
            }
            else if (Box.Type == WiredBoxType.EffectGiveReward)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "1,,;1,,;1,,;1,,;1,,-0-0-0";
                }

                base.WriteString(Box.StringData != null ? (Box.StringData.Split('-')[0]) : "");
            }


            else if (Box.Type == WiredBoxType.EffectMoveToDir)
            {
                base.WriteString(string.Empty);
            }
            else if (Box.Type == WiredBoxType.EffectTimerReset)
            {
                base.WriteString("");
            }
            else
            {
                base.WriteString(Box.StringData);
            }


            if (Box.Type != WiredBoxType.EffectMatchPosition &&
                Box.Type != WiredBoxType.EffectMoveAndRotate &&
                Box.Type != WiredBoxType.EffectMuteTriggerer &&
                Box.Type != WiredBoxType.EffectBotFollowsUserBox &&
                Box.Type != WiredBoxType.EffectAddScore &&
                Box.Type != WiredBoxType.EffectMoveToDir &&
                Box.Type != WiredBoxType.EffectGiveReward &&
                Box.Type != WiredBoxType.EffectAddRewardPoints &&
                Box.Type != WiredBoxType.EffectAddActorToTeam &&
                Box.Type != WiredBoxType.EffectMoveUser)

            {
                base.WriteInteger(0); // Loop
            }
            else if (Box.Type == WiredBoxType.EffectMatchPosition)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0;0";
                }

                base.WriteInteger(3);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMoveUser)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMoveToDir)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 50);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 5);
            }
            else if (Box.Type == WiredBoxType.EffectGiveReward)
            {
                base.WriteInteger(4);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[1]) : 0);
                base.WriteInteger(Box.BoolData ? 1 : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[2]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[3]) : 1);
            }
            else if (Box.Type == WiredBoxType.EffectAddActorToTeam)
            {
                base.WriteInteger(1);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData) : 1);
            }
            else if (Box.Type == WiredBoxType.EffectAddScore || Box.Type == WiredBoxType.EffectAddRewardPoints)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "1;1";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMoveAndRotate)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;0";
                }

                base.WriteInteger(2);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectMuteTriggerer)
            {
                if (String.IsNullOrEmpty(Box.StringData))
                {
                    Box.StringData = "0;Message";
                }

                base.WriteInteger(1);//Count, for the time.
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                base.WriteInteger(1);//Count, for the time.
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0);
            }
            else if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0);
            }

            if (Box is IWiredCycle && Box.Type != WiredBoxType.EffectKickUser && Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectSetRollerSpeed && Box.Type != WiredBoxType.EffectAddScore && Box.Type != WiredBoxType.EffectAddRewardPoints &&
                Box.Type != WiredBoxType.EffectMoveToDir && Box.Type != WiredBoxType.EffectMoveUser && Box.Type != WiredBoxType.EffectShowMessage && Box.Type != WiredBoxType.EffectGiveUserHanditem && Box.Type != WiredBoxType.EffectGiveUserEnable && Box.Type != WiredBoxType.EffectTimerReset &&
                Box.Type != WiredBoxType.EffectGiveUserFreeze && Box.Type != WiredBoxType.EffectExecuteWiredStacks)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(0);
                base.WriteInteger(Cycle.Delay);
            }
            else if (Box.Type == WiredBoxType.EffectMatchPosition || Box.Type == WiredBoxType.EffectMoveAndRotate || Box.Type == WiredBoxType.EffectAddScore || Box.Type == WiredBoxType.EffectAddRewardPoints || Box.Type == WiredBoxType.EffectMoveToDir || Box.Type == WiredBoxType.EffectMoveUser || Box.Type == WiredBoxType.EffectShowMessage || Box.Type == WiredBoxType.EffectGiveUserHanditem || Box.Type == WiredBoxType.EffectGiveUserEnable || Box.Type == WiredBoxType.EffectTimerReset || Box.Type == WiredBoxType.EffectGiveUserFreeze || Box.Type == WiredBoxType.EffectExecuteWiredStacks)
            {
                IWiredCycle Cycle = (IWiredCycle)Box;
                base.WriteInteger(0);
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(Cycle.Delay);
            }

            else
            {
                base.WriteInteger(0);
                base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type));
                base.WriteInteger(0);
            }

            base.WriteInteger(BlockedItems.Count());
            if (BlockedItems.Count() > 0)
            {
                foreach (int ItemId in BlockedItems.ToList())
                {
                    base.WriteInteger(ItemId);
                }
            }
        }
Пример #12
0
        public ItemData(int id,
                        int sprite,
                        string name,
                        string publicName,
                        string type,
                        int width,
                        int length,
                        double height,
                        bool stackable,
                        bool walkable,
                        bool isSeat,
                        bool allowRecycle,
                        bool allowTrade,
                        bool allowMarketplaceSell,
                        bool allowGift,
                        bool allowInventoryStack,
                        InteractionType interactionType,
                        int behaviourData,
                        int modes,
                        string vendingIds,
                        string adjustableHeights,
                        int effectId,
                        bool isRare,
                        bool extraRot)
        {
            Id                   = id;
            SpriteId             = sprite;
            ItemName             = name;
            PublicName           = publicName;
            Type                 = char.Parse(type);
            Width                = width;
            Length               = length;
            Height               = height;
            Stackable            = stackable;
            Walkable             = walkable;
            IsSeat               = isSeat;
            AllowEcotronRecycle  = allowRecycle;
            AllowTrade           = allowTrade;
            AllowMarketplaceSell = allowMarketplaceSell;
            AllowGift            = allowGift;
            AllowInventoryStack  = allowInventoryStack;
            InteractionType      = interactionType;
            BehaviourData        = behaviourData;
            Modes                = modes;
            VendingIds           = new List <int>();
            if (vendingIds.Contains(","))
            {
                foreach (var vendingId in vendingIds.Split(','))
                {
                    try
                    {
                        VendingIds.Add(int.Parse(vendingId));
                    }
                    catch
                    {
                        Console.WriteLine("Error with Item " + ItemName + " - Vending Ids");
                    }
                }
            }
            else if (!string.IsNullOrEmpty(vendingIds) && int.Parse(vendingIds) > 0)
            {
                VendingIds.Add(int.Parse(vendingIds));
            }

            AdjustableHeights = new List <double>();
            if (adjustableHeights.Contains(","))
            {
                foreach (var h in adjustableHeights.Split(','))
                {
                    AdjustableHeights.Add(double.Parse(h));
                }
            }
            else if (!string.IsNullOrEmpty(adjustableHeights) && double.Parse(adjustableHeights) > 0)
            {
                AdjustableHeights.Add(double.Parse(adjustableHeights));
            }

            EffectId = effectId;
            var wiredId = 0;

            if (InteractionType == InteractionType.WiredCondition ||
                InteractionType == InteractionType.WiredTrigger ||
                InteractionType == InteractionType.WiredEffect)
            {
                wiredId = BehaviourData;
            }
            WiredType = WiredBoxTypeUtility.FromWiredId(wiredId);
            IsRare    = isRare;
            ExtraRot  = extraRot;
        }
Пример #13
0
        public WiredEffectConfigComposer(IWiredItem box, List <int> blockedItems)
            : base(ServerPacketHeader.WiredEffectConfigMessageComposer)
        {
            WriteBoolean(false);
            WriteInteger(15);

            WriteInteger(box.SetItems.Count);
            foreach (var item in box.SetItems.Values.ToList())
            {
                WriteInteger(item.Id);
            }

            WriteInteger(box.Item.GetBaseItem().SpriteId);
            WriteInteger(box.Item.Id);

            if (box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                if (string.IsNullOrEmpty(box.StringData))
                {
                    box.StringData = "Bot name;0";
                }

                WriteString(box.StringData != null ? box.StringData.Split(';')[0] : "");
            }
            else if (box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                if (string.IsNullOrEmpty(box.StringData))
                {
                    box.StringData = "0;Bot name";
                }

                WriteString(box.StringData != null ? box.StringData.Split(';')[1] : "");
            }
            else
            {
                WriteString(box.StringData);
            }

            if (box.Type != WiredBoxType.EffectMatchPosition && box.Type != WiredBoxType.EffectMoveAndRotate && box.Type != WiredBoxType.EffectMuteTriggerer &&
                box.Type != WiredBoxType.EffectBotFollowsUserBox)
            {
                WriteInteger(0); // Loop
            }
            else if (box.Type == WiredBoxType.EffectMatchPosition)
            {
                if (string.IsNullOrEmpty(box.StringData))
                {
                    box.StringData = "0;0;0";
                }

                WriteInteger(3);
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 0);
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[1]) : 0);
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[2]) : 0);
            }
            else if (box.Type == WiredBoxType.EffectMoveAndRotate)
            {
                if (string.IsNullOrEmpty(box.StringData))
                {
                    box.StringData = "0;0";
                }

                WriteInteger(2);
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 0);
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[1]) : 0);
            }
            else if (box.Type == WiredBoxType.EffectMuteTriggerer)
            {
                if (string.IsNullOrEmpty(box.StringData))
                {
                    box.StringData = "0;Message";
                }

                WriteInteger(1); //Count, for the time.
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 0);
            }
            else if (box.Type == WiredBoxType.EffectBotFollowsUserBox)
            {
                WriteInteger(1); //Count, for the time.
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 0);
            }
            else if (box.Type == WiredBoxType.EffectBotGivesHanditemBox)
            {
                WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[1]) : 0);
            }

            if (box is IWiredCycle && box.Type != WiredBoxType.EffectKickUser && box.Type != WiredBoxType.EffectMatchPosition && box.Type != WiredBoxType.EffectMoveAndRotate &&
                box.Type != WiredBoxType.EffectSetRollerSpeed)
            {
                var cycle = (IWiredCycle)box;
                WriteInteger(WiredBoxTypeUtility.GetWiredId(box.Type));
                WriteInteger(0);
                WriteInteger(cycle.Delay);
            }
            else if (box.Type == WiredBoxType.EffectMatchPosition || box.Type == WiredBoxType.EffectMoveAndRotate)
            {
                var cycle = (IWiredCycle)box;
                WriteInteger(0);
                WriteInteger(WiredBoxTypeUtility.GetWiredId(box.Type));
                WriteInteger(cycle.Delay);
            }
            else
            {
                WriteInteger(0);
                WriteInteger(WiredBoxTypeUtility.GetWiredId(box.Type));
                WriteInteger(0);
            }

            WriteInteger(blockedItems.Count()); // Incompatable items loop
            if (blockedItems.Any())
            {
                foreach (var itemId in blockedItems.ToList())
                {
                    WriteInteger(itemId);
                }
            }
        }