public bool Execute(params object[] Params) { ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions) { if (!Condition.Execute(Condition.Item)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Count() > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects) { foreach (RoomUser User in Instance.GetRoomUserManager().GetRoomUsers().ToList()) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) { continue; } Effect.Execute(User.GetClient().GetHabbo()); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); }
public bool Execute(params object[] Params) { Habbo Player = (Habbo)Params[0]; if (Player == null || Player.CurrentRoom == null || !Player.InRoom) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } if ((BoolData && Instance.OwnerId != Player.Id) || string.IsNullOrWhiteSpace(this.StringData)) { return(false); } IChatCommand ChatCommand = null; if (!PlusEnvironment.GetGame().GetChatManager().GetCommands().TryGetCommand(this.StringData.Replace(":", "").ToLower(), out ChatCommand)) { return(false); } if (Player.IChatCommand == ChatCommand) { Player.WiredInteraction = true; ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Count() > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); } return(false); }
public bool Execute(params object[] Params) { Instance.GetWired().OnEvent(Item); Habbo Player = (Habbo)Params[0]; if (!string.IsNullOrWhiteSpace(StringData) && Player.Username != StringData) { return(false); } ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Count(x => x.Type == WiredBoxType.AddonRandomEffect) > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); }
public bool Execute(params object[] Params) { Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } int.TryParse(StringData, out int scoreToGet); RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (Instance.GetGameManager().Points[(int)User.Team] < scoreToGet) { return(false); } Player.WiredInteraction = true; System.Collections.Generic.ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); System.Collections.Generic.ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Any(); if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. Instance?.GetWired().OnEvent(RandomBox.Item); Instance?.GetWired().OnEvent(SelectedBox.Item); } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); }
public bool OnCycle() { bool Success = false; ICollection <RoomUser> Avatars = Instance.GetRoomUserManager().GetRoomUsers().ToList(); ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { foreach (RoomUser Avatar in Avatars.ToList()) { if (Avatar == null || Avatar.GetClient() == null || Avatar.GetClient().Habbo == null) { continue; } if (!Condition.Execute(Avatar.GetClient().Habbo)) { continue; } Success = true; } if (!Success) { return(false); } Success = false; Instance.GetWired().OnEvent(Condition.Item); } Success = false; //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Count(x => x.Type == WiredBoxType.AddonRandomEffect) > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute()) { continue; } Success = true; if (!Success) { return(false); } if (Instance != null) { Instance.GetWired().OnEvent(Effect.Item); } } } TickCount = Delay; return(true); }
public bool Execute(params object[] Params) { Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } Item Item = (Item)Params[1]; if (Item == null) { return(false); } //if (User.Z != Item.TotalHeight + Item.GetZ && !Item.Data.IsSeat && Item.Data.InteractionType != InteractionType.BED) // return false; if (User.Z != Item.TotalHeight) { return(false); } if (!this.SetItems.ContainsKey(Item.Id)) { return(false); } ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { if (!Condition.Execute(Player)) { return(false); } if (Instance != null) { Instance.GetWired().OnEvent(Condition.Item); } } //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Count() > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute(Player)) { return(false); } if (Instance != null) { Instance.GetWired().OnEvent(Effect.Item); } } } return(true); }