Mercurial > hg > batmud > misc
changeset 166:63c932c1f037 misc
More documentation, cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 30 Dec 2010 02:16:05 +0000 |
parents | 5b1b275e8b6b |
children | dacd6e18fc55 |
files | prices.php |
diffstat | 1 files changed, 31 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/prices.php Thu Dec 30 02:05:06 2010 +0000 +++ b/prices.php Thu Dec 30 02:16:05 2010 +0000 @@ -3,15 +3,32 @@ * (C) Copyright 2009-2010 Matti 'Ggr' Hamalainen <ccr@tnsp.org> * * Requires PHP 4.3 or later, primarily tested on PHP 5.2.x. + * + * Notes: + * - Possibility for discount can be enabled per section, there is + * no "global" discount for everything, however. + * + * - Services in $services1_prices have a threshold for quantity + * discount, but services in $services2_prices do not. The total + * service discount % applies to both, too. + * + * - If "extra" field is set (as it is for services that have some + * additional material costs), the extra price DOES NOT get + * the section discount % applied!! + * + * - Ammunition, potions and salves sections have a "base" price, + * on top of which specials (more difficult to make, etc.) additional + * price can be set. + * */ // General settings $pageIndex = "prices.php"; $pageTitle = "Ggr's Merchant Pricelist"; $pageCharset = "ISO-8859-1"; -//$pageCSS = "foobar.css"; // uncomment and change this, if you want to use your own CSS stylesheet file +//$pageCSS = "foobar.css"; // Uncomment and change this, if you want to use your own CSS stylesheet file -// Enabled service and product sections +// Enable service and product sections $sections = array( "services1" => true, "services2" => true, @@ -110,7 +127,7 @@ // Mage reagents -$services = array( +$reagents = array( "name" => "reagents", "title" => "Power reagents", "discount" => true, // enable discounts for this section @@ -234,6 +251,10 @@ ); + +//============================================================================ +// The code starts here - utility functions +//============================================================================ function convPrice($val) { if ($val > 1000000) @@ -312,6 +333,7 @@ "</p>\n\n"; } +//============================================================================ echo "<?xml version=\"1.0\" encoding=\"".$pageCharset."\"?>"; ?> @@ -594,10 +616,10 @@ // Reagents //============================================================================ if ($sections["reagents"]) { -getDiscount("reagent_discount", $factor, $s); -$numReagents = 0; -$subTotal = 0; -foreach ($reagent_prices as $fkey => $flist) { + getDiscount("reagent_discount", $factor, $s); + $numReagents = 0; + $subTotal = 0; + foreach ($reagent_prices as $fkey => $flist) foreach ($flist as $key => $item) { if (getVal($key, $val) && $val > 0) { addVal($key, $val); @@ -605,9 +627,8 @@ $numReagents += $val; } } -} -if ($numReagents > 0) - printLine("Total reagents", $numReagents, $subTotal, TRUE); + if ($numReagents > 0) + printLine("Total reagents", $numReagents, $subTotal, TRUE); } //============================================================================