[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /obj/handlers/haggle_handler.c</h2>
This handler controls the npcs haggling the price of something with 
a player.  Currently it only handles sell barganing.
<p>
Factors of relevance:
   <ol>
 <li> merchants' guild rating
 <li> race of customer vs. shopkeeper
</ol>
<h2>Includes</h2>
This class includes the following files /include/money.h and /include/shops/bank.h<h2>Method index</h2>
<ul>
<li><a href="#bargain_factor">bargain_factor</a>(object, object)<br/>
This method determines the barganing factor between the customer and
the shop keeper.
<li><a href="#insult_factor">insult_factor</a>(object, object)<br/>
This method determines the insult factor between the customer and the
shop keeper.
<li><a href="#sell_haggle">sell_haggle</a>(int, int, int, int, string, object, object)<br/>
This method does the actual haggle on a sell.
</ul>
<h2>Public Functions</h2>
These are functions that everyone can access.<p>
<dl>
<dt class="autodocfuncname"><a name="bargain_factor">
bargain_factor</a><pre class="autodocfuncdef">
int bargain_factor(object keeper,
                   object customer)
</pre><dd><br />
This method determines the barganing factor between the customer and
the shop keeper.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
keeper - the shop keeper<br />
customer - the customer of the shop
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="insult_factor">
insult_factor</a><pre class="autodocfuncdef">
int insult_factor(object keeper,
                  object customer)
</pre><dd><br />
This method determines the insult factor between the customer and the
shop keeper.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
keeper - the shop keeper<br />
customer - the customer in the shop
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="sell_haggle">
sell_haggle</a><pre class="autodocfuncdef">
int * sell_haggle(int value,
                  int offer,
                  int asking,
                  int insults,
                  string place,
                  object keeper,
                  object customer)
</pre><dd><br />
This method does the actual haggle on a sell.
The logic is as follows:
<pre>
if offer > asking then
   give back a boggle response
else if offer == asking then
   sell the thing and give an accepted saying
else if offer * insult_factor > asking * 100 then
   adjustment = ( ( asking - offer ) * bargain_factor ) / 100
   asking -= adjustment
   return an adjustment message
else
   return an insulted message
endif
</pre>
The return from this function is an array of three elements, the
first is the a flag saying if the item was accepted or not, the
second is the current asking price and the last is the current
insult level.
<pre>
({
   flag (0/1), // This is 0 if unable to sell, 1 if sold
   asking,     // the current asking price
   insults,    // the current insult level
})
</pre><br />
<br /><dl>
<dd><b>Parameters:</b><br />
value - the real value of the item<br />
offer - the offered value for the item<br />
asking - the current asking price<br />
insults - the current insult level<br />
place - the place for the money strings<br />
keeper - the shop keeper<br />
customer - the customer<br />
<br />
<dd><b>Returns:</b>
<br />the array as described above<br /><br />
<dd><b>See also:</b>
<br /><a href="#insult_factor">insult_factor()</a> and <a href="#bargain_factor">bargain_factor()
</a><br /><br /><br /></dl>

</dl>
[an error occurred while processing this directive]

