/// <summary> /// Executes this command /// </summary> internal override bool ExecutionBody() { INonPlayerCharacter merchant = (INonPlayerCharacter)Subject; if (merchant == null || !merchant.DoISellThings()) { RenderError("There is no merchant that sells items in that direction."); return(false); } IInanimate thing = (IInanimate)Target; if (Target == null) { RenderError("The merchant does not sell that item."); return(false); } int price = merchant.PriceCheck(thing, true); if (price <= 0) { RenderError("The merchant will not sell that item."); return(false); } string errorMessage = merchant.MakeSale((IMobile)Actor, thing, price); if (!string.IsNullOrWhiteSpace(errorMessage)) { RenderError(errorMessage); } ILexicalParagraph toActor = new LexicalParagraph(string.Format("You purchase a $T$ from $S$ for {0}blz.", price)); ILexicalParagraph toArea = new LexicalParagraph("$A$ makes a purchase from $S$."); //TODO: language outputs Message messagingObject = new Message(toActor) { ToOrigin = new List <ILexicalParagraph> { toArea } }; messagingObject.ExecuteMessaging(Actor, merchant, thing, OriginLocation.CurrentZone, null); return(true); }