# HG changeset patch # User Matti Hamalainen # Date 1566397564 -10800 # Node ID 06f3892d53e9468f2e0f44bd27d11d74dd7b0fd7 # Parent 2ef1ae4e185f13ecda6c0b49546e28c9e2f15099 Chester stuff is in separate repository now. diff -r 2ef1ae4e185f -r 06f3892d53e9 chester/index.php --- a/chester/index.php Wed Jun 27 15:22:54 2018 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,996 +0,0 @@ -".htmlentities($label).": ". - "\n"; -} - - -function printCheckBox($id, $label, $value = FALSE) -{ - global $jsData; - $jsData .= "document.getElementById(\"".$id."\").checked = ".($value ? "true" : "false").";\n"; - - echo "". - ""; -} - - -function printOptionSelect($id, $size, $multi = FALSE) -{ - echo ""; -} - - -function performItemFixups($input, $table, &$changed) -{ - $changed = 0; - - foreach ($table as $pat => $rep) { - // Static patterns start with asterisk "*" - if ($pat[0] == "*") { - if (substr($pat, 1) == $input) { - $changed = 1; - return $rep; - } - } else { - // Perform regexp replacment - $res = preg_replace("/".$pat."/", $rep, $input, -1, $changed); - if ($changed > 0) - return $res; - } - - } - - return $input; -} - - -if (isset($_POST["mode"])) { - $formMode = intval($_POST["mode"]); -} else - $formMode = 0; - - -cmPrintPageHeader($pageTitle, " - -"); -echo "

".$pageTitle."

\n"; - - -/* - * Initial mode, request item listing - */ -if ($formMode == 0) { -?> - -
-

- - -First, you should provide a list of equipments you wish to manage. -Just plain copy & paste of an inventory listing is enough. -You can also test with pre-defined equipments, - by clicking the button. -

-
-

-Stacks of items are not supported, and few other things may cause problems too. -

-
-

- - -

-
- -
-
-|\(\d+\/\d+\)|\[\d+\/\d+\])/", $str, $m)) - $str = $m[1]; - - // Discard multi-item lines - if (preg_match("/^(many|".$fixNumbersMatch.")\s+(.+?)( labeled as .+|)$/", $str, $m)) { - if (!isset($fixNumbers[$m[1]])) { - $ignored[$str] = "Unparsed stack of many"; - } else { - $n = $fixNumbers[$m[1]]; - $res = performItemFixups($m[2], $fixStackTable, $changed); - if ($changed > 0) - addItems($n, $res.$m[3]); - else - $ignored[$str] = "Unsupported item stack"; - } - } else { - // Other item name fixups - addItems(1, performItemFixups($str, $fixItemTable, $changed)); - } - } - - if (count($ignored) > 0) { -?> -

Item data processed. Following lines were not accepted:

- - - $reason) { - echo " \n"; - } - $filename = "ignored.txt"; - $outFile = @fopen($filename, "a"); - if ($outFile !== FALSE) { - @chmod($filename, 0600); - foreach ($ignored as $name => $reason) { - fwrite($outFile, $name."§".$reason."\n"); - } - fclose($outFile); - } - - $encData = base64_encode(serialize($data)); -?> -
ItemReason
".htmlentities($name)."".htmlentities($reason)."
- -
- - -".$encData."\n"; -?> -
- -
- -
-

- - - - - -

- - - - - - - - - - - - - - - - -
-

Items pool

- - - - - - - - - -
items
-
-

Editing container ""

- - - - - - -
items
-
-

Create / edit a container

- - - -
-

Defined containers

- - - - - - - -
items total
-
-
- -
- -
- -
- -
-
-
- ($1 = item, $2 = container)
-
-
-
- - -
- -
- - -
- -
- -
 
- - -An error occured\n\n"; -} - -cmPrintPageFooter(); -?> diff -r 2ef1ae4e185f -r 06f3892d53e9 chester/itemfixes.inc.php --- a/chester/itemfixes.inc.php Wed Jun 27 15:22:54 2018 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ - "a book of eternal youth", - "^small crystal box \([a-z ]+\)" => "small crystal box" -); - - -// Multi-stack item fixups -$fixStackTable = array( - "^(purple|green) gloves" => 'a ${1} glove', - "^Blue gloves of master Conjurer" => 'Blue glove of master Conjurer', - "^bracelet mades of green crystal" => "bracelet made of green crystal", - "^alchemist moulded rings" => "alchemist moulded ring", - "^Rings of wisdom" => "Ring of wisdom", - "^Nova Arcanum, Melkior's books of necromancy" => "Nova Arcanum, Melkior's book of necromancy", - - // Generic rings - "^(heavy black metal|steel) rings" => 'a ${1} ring', - - // Damiens - "^arm protectors called Damien \(\S+\)" => 'an arm protector called Damien (${1})', - - // Containers - "^white cloth packs for holding salves" => "white cloth pack for holding salves", - "^(small|HUGE) shiny boxes for storing minerals" => 'a ${1} shiny box for storing minerals', - "^(small|HUGE) sturdy packs for storing potions" => 'a ${1} sturdy pack for storing potions', -); - - -$fixNumbers = array( - "two" => 2, - "three" => 3, - "four" => 4, - "five" => 5, - "six" => 6, - "seven" => 7, - "eight" => 8, - "nine" => 9, - "ten" => 10 -); - -?> \ No newline at end of file