private bool PutItem(IItem item, IContainer container) { // TODO: check weight + item count Act(ActOptions.ToAll, "{0:N} put{0:v} {1} in {2}.", this, item, container); item.ChangeContainer(container); return(true); }
private bool DropItem(IItem item) { //Act(ActOptions.ToCharacter, "You drop {0}.", item); //Act(ActOptions.ToRoom, "{0} drops {1}.", this, item); Act(ActOptions.ToAll, "{0:N} drop{0:v} {1}.", this, item); item.ChangeContainer(Room); return(true); }
private bool GetItem(IItem item, IContainer container) { // TODO: check weight + item count //Act(ActOptions.ToCharacter, "You get {0} from {1}.", item, container); //Act(ActOptions.ToRoom, "{0} gets {1} from {2}.", this, item, container); Act(ActOptions.ToAll, "{0:N} get{0:v} {1} from {2}.", this, item, container); item.ChangeContainer(this); return(true); }
private bool GetItem(IItem item) // equivalent to get_obj in act_obj.C:211 { // TODO: check if someone is using it as Furniture // TODO: check weight + item count //Act(ActOptions.ToCharacter, "You get {0}.", item); //Act(ActOptions.ToRoom, "{0} gets {1}.", this, item); Act(ActOptions.ToAll, "{0:N} get{0:v} {1}.", this, item); item.ChangeContainer(this); return(true); }
// Give item victim protected virtual bool DoGive(string rawParameters, params CommandParameter[] parameters) { if (parameters.Length < 2) { Send("Give what to whom?"); return(true); } IItem what = FindHelpers.FindByName(Content.Where(CanSee), parameters[0]); if (what == null) { Send(StringHelpers.ItemInventoryNotFound); return(true); } ICharacter whom = FindHelpers.FindByName(Room.People.Where(CanSee), parameters[1]); if (whom == null) { Send(StringHelpers.CharacterNotFound); return(true); } if (!whom.CanSee(what)) { Act(ActOptions.ToCharacter, "{0:n} can't see it.", whom); return(true); } if (what is ItemQuest) { Act(ActOptions.ToCharacter, "You cannot give quest items."); return(true); } // Give item to victim what.ChangeContainer(whom); ActToNotVictim(whom, "{0} gives {1} to {2}.", this, what, whom); whom.Act(ActOptions.ToCharacter, "{0} gives you {1}.", this, what); Act(ActOptions.ToCharacter, "You give {0} to {1}.", what, whom); return(true); }
public void RemoveItem(IItem item) { //item.ContainedInto?.GetFromContainer(item); item.ChangeContainer(null); IEquipable equipable = item as IEquipable; equipable?.ChangeEquipedBy(null); // If container, remove content IContainer container = item as IContainer; if (container != null) { List <IItem> content = new List <IItem>(container.Content); // clone to be sure foreach (IItem itemInContainer in content) { RemoveItem(itemInContainer); } } item.OnRemoved(); //_items.Remove(item); will removed in cleanup step }