internal Rod(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Rod; Name = "black *rod* with a rusty star on one end"; PluralName = "black *rods* with rusty stars on the ends"; IsActive = true; Contents = new List <IAdventureItem>(); IsPortable = true; // Using the rod when at the fissure, creates a crystal bridge var use = new ItemInteraction(Game, "use", "wave"); use.RegisteredInteractions.Add(new DisplayForLocation("You wave the rod with a flourish. The air shimmers and a beautiful crystal bridge appears, spanning the fissure to the west!", Location.FissureEast)); use.RegisteredInteractions.Add(new DisplayForLocation("You wave the rod with a flourish.. The air shimmers and a beautiful crystal bridge appears, spanning the fissure to the east!!", Location.FissureWest)); use.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.CrystalBridge))); use.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You cautiously cross the crystal bridge...", Location.FissureWest, "west", "w", "bridge"), }, Game, Location.FissureEast)); use.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You step out onto the crystal bridge...", Location.FissureEast, "east", "e", "bridge"), }, Game, Location.FissureWest)); Interactions.Add(use); }
private Grate(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Grate; Name = "strong steel grate"; PluralName = "strong steel grates"; IsPortable = false; IsOpen = false; IsLocked = true; ItemIdToUnlock = Item.Key; var open = new ItemInteraction(Game, "open"); open.RegisteredInteractions.Add(new Open()); Interactions.Add(open); var unlock = new ItemInteraction(Game, "unlock"); unlock.RegisteredInteractions.Add(new Unlock()); unlock.RegisteredInteractions.Add(new DisplayForLocation("You open the grate and see a dark space below it. A rusty iron ladder leads down into pitch blackness!", Location.Depression)); unlock.RegisteredInteractions.Add(new DisplayForLocation("You open the grate and see the way out of the caves above you. A rusty iron ladder leads up to the daylight!", Location.Cave1)); unlock.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("With growing trepidation, you descend the ladder...", Location.Cave1, "down", "d", "ladder", "underground"), }, Game, Location.Depression)); unlock.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove("You climb the rusty ladder and emerge into the light!", Location.Depression, "up", "ladder", "surface", "climb"), }, Game, Location.Cave1)); Interactions.Add(unlock); }
public Hireling(World world, int snoId, TagMap tags) : base(world, snoId, tags) { //this.Attributes[GameAttribute.TeamID] = 2; Interactions.Add(new HireInteraction()); Interactions.Add(new InventoryInteraction()); }
internal Lamp(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Lamp; Name = "battered *lamp*";; PluralName = "battered *lamps*"; IsPortable = true; IsEndlessSupply = false; Slots = 0; // Takes up no space in inventory var light = new ItemInteraction(Game, "light"); light.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); light.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); light.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); Interactions.Add(light); var extinguish = new ItemInteraction(Game, "extinguish", "ext"); extinguish.RegisteredInteractions.Add(new DeactivateItem("The lamp turns off.")); extinguish.RegisteredInteractions.Add(new UpdateItemName("battered *lamp*")); extinguish.RegisteredInteractions.Add(new RemovePlayerStatus(PlayerStatus.HasLight)); Interactions.Add(extinguish); }
internal Bird(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Bird; Name = "little *bird* singing cheerfully"; PluralName = "little *birds* singing cheerfully"; IsPortable = true; IsActive = true; MustBeContainedIn = Item.Cage; Slots = 0; PreventTakeItemId = Item.Rod; PreventTakeText = "The *bird* was unafraid when you entered, but as you approach " + "it becomes disturbed and you cannot catch it."; var free = new ItemInteraction(Game, "use", "free", "release"); free.RegisteredInteractions.Add(new Display("You open the cage and the bird flies out.")); free.RegisteredInteractions.Add(new RemoveFromInventory()); free.RegisteredInteractions.Add(new AddToLocation(this)); Interactions.Add(free); var catchInteraction = new ItemInteraction(Game, "catch", "capture", "trap"); catchInteraction.RegisteredInteractions.Add(new AliasCommand(new Take(game, "take"))); Interactions.Add(catchInteraction); }
public Artisan(World world, int snoId, TagMap tags) : base(world, snoId, tags) { this.Attributes[GameAttribute.MinimapActive] = true; Interactions.Add(new CraftInteraction()); }
internal Bottle(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Bottle; Name = "small glass *bottle*"; PluralName = "small glass *bottles*"; IsContainer = true; IsPortable = true; IsTransparent = true; var smash = new ItemInteraction(Game, "smash", "break"); smash.RegisteredInteractions.Add(new Display("You smash the bottle and glass flies everywhere!")); smash.RegisteredInteractions.Add(new RemoveFromInventory()); smash.RegisteredInteractions.Add(new AddToLocation(new BrokenGlass(Game))); Interactions.Add(smash); var fill = new ItemInteraction(Game, "fill"); fill.RegisteredInteractions.Add(new Display("You reach down and fill the bottle with water.")); fill.RegisteredInteractions.Add(new AddToItemContents(ItemFactory.GetInstance(Game, Item.PintOfWater))); Interactions.Add(fill); //var empty = new ItemInteraction(Game, "empty", "pour");); //Interactions.Add(empty); }
public Cain(World world, int snoId, TagMap tags) : base(world, snoId, tags) { this.Attributes[GameAttribute.MinimapActive] = true; Conversations.Add(new ConversationInteraction(72416)); Conversations.Add(new ConversationInteraction(198588)); Conversations.Add(new ConversationInteraction(73171)); Interactions.Add(new IdentifyAllInteraction()); }
public Interaction WillRespondWith(ProviderServiceResponse response) { var result = InteractionUnderConstruction.WillRespondWith(response); Interactions.Add(InteractionUnderConstruction); InteractionUnderConstruction = new Interaction(BaseUrl, new RequestComparer(new HeaderComparer()), Output); return(result); }
// generate the n-wise interactions for the parameters private void GenerateInteractionsForParameters(Model model, int order) { IList <int[]> parameterCombinations = GenerateCombinations(model.Parameters.Count, order); foreach (var parameterCombination in parameterCombinations) { Interactions.Add(new ParameterInteraction(parameterCombination)); } GenerateValueCombinations(model); }
protected AdventureCreature(IReadonlyAdventureGame game, string[] nouns) : base(game, nouns) { IsCreature = true; // Player says no to attacking with bare hands... var no = new ItemInteraction(Game, "no"); no.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); no.RegisteredInteractions.Add(new Display("I don't blame you!")); Interactions.Add(no); }
internal Troll(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Troll; Name = "large troll barring your way"; PluralName = "large trolls barring your way"; IsCreature = true; var kill = new ItemInteraction(Game, "kill", "slay", "murder", "attack"); Interactions.Add(kill); }
internal ShadowyFigure(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.ShadowyFigure; Name = "shadowy *figure* peering at you through the window"; PluralName = "shadowy *figures* peering at you through the window"; IsPortable = false; var wave = new ItemInteraction(Game, "wave"); wave.RegisteredInteractions.Add(new Display("The shadowy figure waves back at you. Is it trying to get your attention?")); Interactions.Add(wave); }
internal Water(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.PintOfWater; Name = "source of *water*"; PluralName = "source of *water*"; IsPortable = false; MustBeContainedIn = Item.None; var drink = new ItemInteraction(Game, "drink"); drink.RegisteredInteractions.Add(new Display("Mmmmm, refreshing!")); Interactions.Add(drink); }
internal PintOfWater(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.PintOfWater; Name = "pint of *water*"; PluralName = "pints of *water*"; IsPortable = false; IsEndlessSupply = true; MustBeContainedIn = Item.Bottle; var drink = new ItemInteraction(Game, "drink"); Interactions.Add(drink); }
internal Troll(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Troll; Name = "large troll barring your way"; PluralName = "large trolls barring your way"; // Player says yes to attacking with bare hands... var yes = new ItemInteraction(Game, "yes"); yes.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); yes.RegisteredInteractions.Add(new Display("As you approach the hideous troll, it points at its sign and yells 'Pay troll!'")); yes.RegisteredInteractions.Add(new Display("The creature's foul breath drives you back, gasping for air.")); Interactions.Add(yes); }
public void QueueInteraction(SwitchInteraction interaction) { interaction.State = SwitchInteractionState.Queued; Interactions.Add(interaction); var message = new InteractionMessage { Interaction = interaction, Action = InteractionMessageAction.Queued }; Parallel.ForEach(GlobalSubscribers, d => _messagingHandler.SendMessage(d, message)); AssignQueuedInteraction(interaction); }
public SeatingArrangement(IEnumerable <string> people, IEnumerable <Interaction> interactions) : this() { var list = new List <string>(people); for (int i = 0; i < list.Count - 1; i++) { Interactions.Add(interactions.FirstOrDefault(x => x.Person1 == list[i] && x.Person2 == list[i + 1])); Interactions.Add(interactions.FirstOrDefault(x => x.Person1 == list[i + 1] && x.Person2 == list[i])); } Interactions.Add(interactions.FirstOrDefault(x => x.Person1 == list.Last() && x.Person2 == list.First())); Interactions.Add(interactions.FirstOrDefault(x => x.Person2 == list.Last() && x.Person1 == list.First())); }
internal Snake(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Snake; Name = "large vicious-looking snake barring your way"; PluralName = "large vicious-looking snakes barring your way"; // Player says yes to attacking with bare hands... var yes = new ItemInteraction(Game, "yes"); yes.RegisteredInteractions.Add(new RemovePlayerItemState("attack")); yes.RegisteredInteractions.Add(new Display("You lunge at the snake, trying to grapple with it...")); yes.RegisteredInteractions.Add(new Display("The snake sinks its envenomed fangs into your softly yielding flesh")); yes.RegisteredInteractions.Add(new PlayerDies(game)); Interactions.Add(yes); }
internal Vase(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Vase; Name = "delicate precious Ming *vase*"; PluralName = "delicate precious Ming *vases*"; IsPortable = true; IsTreasure = true; var smash = new ItemInteraction(Game, "smash", "break"); smash.RegisteredInteractions.Add(new Display("You smash the vase and pieces fly everywhere!")); smash.RegisteredInteractions.Add(new RemoveFromInventory()); smash.RegisteredInteractions.Add(new AddToLocation(new BrokenVase(Game))); Interactions.Add(smash); }
private void Queue_OnInteractionAdded(object sender, InteractionEventArgs e) { try { Context.Send(s => { try { // Make sure it's not already disconnected var state = e.Interaction.GetAttribute(InteractionAttributes.State); if (state.Equals(InteractionAttributeValues.State.ExternalDisconnect, StringComparison.InvariantCultureIgnoreCase) || state.Equals(InteractionAttributeValues.State.InternalDisconnect, StringComparison.InvariantCultureIgnoreCase)) { return; } // Verify that this interaction has hootsuite data if (string.IsNullOrEmpty(e.Interaction.GetAttribute("Hootsuite_RawData"))) { return; } // Add it to the list Interactions.Add(new InteractionViewModel(e.Interaction)); // Select it if we don't have anything else if (SelectedInteraction == null) { SelectedInteraction = Interactions[Interactions.Count - 1]; } } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }, null); } catch (Exception ex) { Console.WriteLine(ex); #if DEBUG MessageBox.Show(ex.Message); #endif } }
internal Lamp(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Lamp; Name = "battered *lamp*";; PluralName = "battered *lamps*"; IsPortable = true; IsEndlessSupply = true; var light = new ItemInteraction(Game, "light"); light.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); light.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); light.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); Interactions.Add(light); }
internal Coins(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Coins; Name = "pile of *coins*"; PluralName = "piles of *coins*"; IsPortable = true; IsTreasure = true; var pay = new ItemInteraction(Game, "use", "spend", "insert"); pay.RegisteredInteractions.Add(new RemoveFromInventory()); pay.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.Batteries))); pay.RegisteredInteractions.Add(new Display("You insert your coins into the machine, and a pack of batteries is dispensed!")); Interactions.Add(pay); }
internal LittleAxe(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.LittleAxe; Name = "small *axe*"; PluralName = "small *axes*"; IsPortable = true; IsWeapon = true; var use = new ItemInteraction(Game, "use", "swing", "throw", "wield"); use.RegisteredInteractions.Add(new Display("You attack the dwarf, throwing the little axe at it!!")); use.RegisteredInteractions.Add(new RemoveFromInventory()); use.RegisteredInteractions.Add(new Chance(80)); Interactions.Add(use); }
// adds an interaction generated from a constraint to the table private void MergeConstraintInteraction(int order, ParameterInteraction constraintInteraction) { // is the constraint already in the table if (!Interactions.Contains(constraintInteraction)) { // if the interaction has more parameters than the order we can't mark any of the existing combinations excluded // if the interaction is shorter we need to mark the existing combinations excluded if (constraintInteraction.Parameters.Count > order) { Interactions.Add(constraintInteraction); } else { var excludedValues = constraintInteraction.Combinations.Where((c) => c.State == ValueCombinationState.Excluded); var candidateInteractions = from interaction in Interactions where constraintInteraction.Parameters.All((i) => interaction.Parameters.Contains(i)) select interaction; var excludedCombinations = from interaction in candidateInteractions from combination in interaction.Combinations where excludedValues.Any((c) => MatchCombination(c, combination)) select combination; foreach (var combination in excludedCombinations) { combination.State = ValueCombinationState.Excluded; } } } else { // mark combinations excluded by the constraint excluded in the table var interaction = Interactions.First((i) => i.Equals(constraintInteraction)); var excludedValues = constraintInteraction.Combinations.Where((c) => c.State == ValueCombinationState.Excluded); var combinations = interaction.Combinations.Where((c) => excludedValues.Any((excluded) => MatchCombination(excluded, c))); foreach (var combination in combinations) { combination.State = ValueCombinationState.Excluded; } } }
internal Leaflet(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Leaflet; Name = "*leaflet*"; PluralName = "*leaflets*"; IsPortable = true; var whenRead = new StringBuilder("You read the leaflet and this is what it says:"); whenRead.AppendLine(); whenRead.AppendLine("Somewhere nearby lies the fabled Colossal Cave, a place of danger, mystery and, some say, magic."); whenRead.AppendLine("Rumours are that some have found gold in the caves. Other rumours say that no one who goes in ever comes out again..."); var read = new ItemInteraction(Game, "read"); read.RegisteredInteractions.Add(new Display(whenRead.ToString())); Interactions.Add(read); }
internal VendingMachine(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.VendingMachine; Name = "vending machine selling batteries"; PluralName = "vending machines selling batteries"; IsOpen = false; IsContainer = false; var push = new ItemInteraction(Game, "push", "shove", "move", "slide"); push.RegisteredInteractions.Add(new AddMoves(new List <IPlayerMove> { new PlayerMove(string.Empty, Location.RoughHewn, "south", "s"), }, Game)); push.RegisteredInteractions.Add(new Display("You give a mighty heave on the machine, and it slides aside, revealing a passageway heading South...")); Interactions.Add(push); }
private InteractionViewModel GetInteractionViewModel(Interaction interaction) { // Does this interaction have a video conversation attached? if (string.IsNullOrEmpty(interaction.GetStringAttribute(VideoIntegrationAttributeNames.VideoConversationId))) { Trace.Main.status("{} does not have a video conversation", interaction.InteractionId.Id); return(null); } // Try to find an existing VM first var interactionVm = Interactions.FirstOrDefault(i => i.InteractionId.Equals(interaction.InteractionId.Id)); if (interactionVm != null) { return(interactionVm); } Context.Send(s => { try { // Create view model interactionVm = InteractionViewModel.FromInteraction(interaction); // Add to list Interactions.Add(interactionVm); // Set it as the selected interaction (forces the interaction's tab to show within the vidyo tab addin) SelectedInteraction = interactionVm; } catch (Exception ex) { Trace.Main.exception(ex); } }, null); // Auto answer because of reconstitution? if (interactionVm.VidyoAutoAnswerOnReconstitution) { interaction.Pickup(); } return(interactionVm); }
private void handleInteractionState(InteractionMessage message) { var interaction = Interactions.FirstOrDefault(i => i.Id == message.Interaction.Id); Application.Current.Dispatcher.Invoke(new Action(() => { if (interaction != null) { interaction.State = message.Interaction.State; switch (message.Action) { case InteractionMessageAction.Queued: break; case InteractionMessageAction.Created: break; case InteractionMessageAction.Assigned: interaction.Agent = message.Interaction.Agent; break; case InteractionMessageAction.StateChanged: if (message.Interaction.State == SwitchInteractionState.Completed) { Interactions.Remove(interaction); } break; default: break; } } else { Interactions.Add(message.Interaction); if (OnInteractionQueued != null) { OnInteractionQueued(message); } } })); }
internal Batteries(IReadonlyAdventureGame game, params string[] nouns) : base(game, nouns) { ItemId = Item.Batteries; Name = "packet of fresh *batteries*"; PluralName = "packets of fresh *batteries"; IsPortable = true; IsEndlessSupply = false; var installBatteries = new ItemInteraction(Game, "use", "install", "fit", "renew", "refresh"); installBatteries.RegisteredInteractions.Add(new RemoveFromInventory()); installBatteries.RegisteredInteractions.Add(new Display("You fit the fresh batteries into your lamp!")); installBatteries.RegisteredInteractions.Add(new ActivateItem("The lamp shines brightly.")); installBatteries.RegisteredInteractions.Add(new UpdateItemName("battered *lamp* which is lit")); installBatteries.RegisteredInteractions.Add(new AddPlayerStatus(PlayerStatus.HasLight)); installBatteries.RegisteredInteractions.Add(new AddToLocation(ItemFactory.GetInstance(Game, Item.SpentBatteries))); installBatteries.RegisteredInteractions.Add(new UpdateEventRecord(EventIds.HasLamp, 2000)); Interactions.Add(installBatteries); }