public override void Compose(ServerPacket packet) { packet.WriteBoolean(false); packet.WriteInteger(5); 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); packet.WriteString(WiredItem.StringData); packet.WriteInteger(WiredItem is IWiredCycle ? 1 : 0); if (WiredItem is IWiredCycle Cycle) { packet.WriteInteger(Cycle.Delay); } packet.WriteInteger(0); packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type)); packet.WriteInteger(BlockedItems.Count()); if (BlockedItems.Count() > 0) { foreach (int itemId in BlockedItems.ToList()) { packet.WriteInteger(itemId); } } }
public WiredConditionConfigComposer(IWiredItem box) : base(ServerPacketHeader.WiredConditionConfigMessageComposer) { WriteBoolean(false); WriteInteger(5); WriteInteger(box.SetItems.Count); foreach (var item in box.SetItems.Values.ToList()) { WriteInteger(item.Id); } WriteInteger(box.Item.GetBaseItem().SpriteId); WriteInteger(box.Item.Id); WriteString(box.StringData); if (box.Type == WiredBoxType.ConditionMatchStateAndPosition || box.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { if (string.IsNullOrEmpty(box.StringData)) { box.StringData = "0;0;0"; } WriteInteger(3); //Loop 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.ConditionUserCountInRoom || box.Type == WiredBoxType.ConditionUserCountDoesntInRoom) { if (string.IsNullOrEmpty(box.StringData)) { box.StringData = "0;0"; } WriteInteger(2); //Loop WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 1); WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[1]) : 50); } if (box.Type == WiredBoxType.ConditionFurniHasNoFurni) { WriteInteger(1); } if (box.Type != WiredBoxType.ConditionUserCountInRoom && box.Type != WiredBoxType.ConditionUserCountDoesntInRoom && box.Type != WiredBoxType.ConditionFurniHasNoFurni) { WriteInteger(0); } else if (box.Type == WiredBoxType.ConditionFurniHasNoFurni) { if (string.IsNullOrEmpty(box.StringData)) { box.StringData = "0"; } WriteInteger(box.StringData != null ? int.Parse(box.StringData.Split(';')[0]) : 50); } WriteInteger(0); WriteInteger(WiredBoxTypeUtility.GetWiredId(box.Type)); }
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) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(Cycle.Delay); } 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); } } }
public WiredTriggerConfigComposer(IWiredItem box, List <int> blockedItems) : base(ServerPacketHeader.WiredTriggerConfigMessageComposer) { WriteBoolean(false); WriteInteger(5); WriteInteger(box.SetItems.Count); foreach (var item in box.SetItems.Values.ToList()) { WriteInteger(item.Id); } WriteInteger(box.Item.GetBaseItem().SpriteId); WriteInteger(box.Item.Id); WriteString(box.StringData); WriteInteger(box is IWiredCycle ? 1 : 0); if (box is IWiredCycle) { var cycle = (IWiredCycle)box; WriteInteger(cycle.Delay); } WriteInteger(0); WriteInteger(WiredBoxTypeUtility.GetWiredId(box.Type)); WriteInteger(blockedItems.Count()); if (blockedItems.Any()) { foreach (var id in blockedItems.ToList()) { WriteInteger(id); } } }
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)); }
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); } } }
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); } } }
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); } } }
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); } } }