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