protected virtual bool DoRest(string rawParameters, params CommandParameter[] parameters) { if (Position == Positions.Fighting) { Send("Maybe you should finish fighting first?"); return(true); } if (Position == Positions.Resting) { Send("You are already resting."); return(true); } // Search valid furniture if any IItemFurniture furniture = null; if (parameters.Length > 0) { furniture = FindHelpers.FindByName(Room.Content.OfType <IItemFurniture>().Where(CanSee), parameters[0]); // TODO: search for IItem than cast it to ItemFurniture? if (furniture == null) { Send(StringHelpers.ItemNotFound); return(true); } if (!furniture.CanRest) { Send("You can't rest on that."); return(true); } if (1 + furniture.People.Count() > furniture.MaxPeople) { Act(ActOptions.ToCharacter, "There is no more room on {0}.", furniture); return(true); } // ChangeFurniture(furniture); } else { ChangeFurniture(null); } // Change position if (Position == Positions.Sleeping) { if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.At) { Act(ActOptions.ToAll, "{0:N} wake{0:v} and rest{0:v} at {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.On) { Act(ActOptions.ToAll, "{0:N} wake{0:v} and rest{0:v} on {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.In) { Act(ActOptions.ToAll, "{0:N} wake{0:v} and rest{0:v} in {1}.", this, furniture); } else { Act(ActOptions.ToAll, "{0:N} wake{0:v} and start{0:v} resting.", this); } } else if (Position == Positions.Sitting) { if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.At) { Act(ActOptions.ToAll, "{0:N} rest{0:v} at {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.On) { Act(ActOptions.ToAll, "{0:N} rest{0:v} on {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.In) { Act(ActOptions.ToAll, "{0:N} rest{0:v} in {1}.", this, furniture); } else { Act(ActOptions.ToRoom, "{0;N} rest{0:v}.", this); } } else if (Position == Positions.Standing) { if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.At) { Act(ActOptions.ToAll, "{0:N} sit{0:v} down at {1} and rest{0:v}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.On) { Act(ActOptions.ToAll, "{0:N} sit{0:v} on {1} and rest{0:v}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.In) { Act(ActOptions.ToAll, "{0:N} rest{0:v} in {1}.", this, furniture); } else { Act(ActOptions.ToAll, "{0:N} sit{0:v} down and rest{0:v}.", this); } } ChangePosition(Positions.Resting); return(true); }
protected virtual bool DoStand(string rawParameters, params CommandParameter[] parameters) { if (Position == Positions.Fighting) { Send("Maybe you should finish fighting first?"); return(true); } if (Position == Positions.Standing) { Send("You are already standing."); return(true); } // Search valid furniture if any IItemFurniture furniture = null; if (parameters.Length > 0) { furniture = FindHelpers.FindByName(Room.Content.OfType <IItemFurniture>().Where(CanSee), parameters[0]); // TODO: search for IItem than cast it to ItemFurniture? if (furniture == null) { Send(StringHelpers.ItemNotFound); return(true); } if (!furniture.CanStand) { Send("You can't seem to find a place to stand."); return(true); } if (1 + furniture.People.Count() > furniture.MaxPeople) { Act(ActOptions.ToCharacter, "There is no more room to stand on {0}.", furniture); return(true); } // ChangeFurniture(furniture); } else { ChangeFurniture(null); } // Change position if (Position == Positions.Sleeping) { if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.At) { Act(ActOptions.ToAll, "{0:N} wake{0:v} up and stand{0:v} at {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.On) { Act(ActOptions.ToAll, "{0:N} wake{0:v} up and stand{0:v} on {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.In) { Act(ActOptions.ToAll, "{0:N} wake{0:v} up and stand{0:v} in {1}.", this, furniture); } else { Act(ActOptions.ToAll, "{0:N} wake{0:v} up and stand{0:v} up.", this); } // Autolook if impersonated/incarnated if (ImpersonatedBy != null || IncarnatedBy != null) { DisplayRoom(); } } else if (Position == Positions.Resting || Position == Positions.Sitting) { if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.At) { Act(ActOptions.ToAll, "{0:N} stand{0:v} at {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.On) { Act(ActOptions.ToAll, "{0:N} stand{0:v} on {1}.", this, furniture); } else if (furniture?.FurniturePlacePreposition == FurniturePlacePrepositions.In) { Act(ActOptions.ToAll, "{0:N} stand{0:v} in {1}.", this, furniture); } else { Act(ActOptions.ToAll, "{0:N} stand{0:v} up.", this); } } ChangePosition(Positions.Standing); return(true); }