Filter and refactor

This commit is contained in:
color.diff=auto 2021-03-23 12:35:28 -06:00
parent c74918ab45
commit 50252def84
8 changed files with 385 additions and 202 deletions

129
filterProperties.txt Normal file
View File

@ -0,0 +1,129 @@
color
bloody
Expansion
gembonus
fire-fx
light-fx
gems%/lvl
dmg-slash
dmg-slash%
dmg-crush
dmg-crush%
dmg-thrust
dmg-thrust%
abs-slash
abs-crush
abs-thrust
abs-slash%
abs-crush%
abs-thrust%
ac/time
ac%/time
hp/time
mana/time
dmg/time
dmg%/time
str/time
dex/time
enr/time
vit/time
att/time
att%/time
dmg-cold/time
dmg-fire/time
dmg-ltng/time
dmg-pois/time
res-cold/time
res-fire/time
res-ltng/time
res-pois/time
abs-cold/time
abs-fire/time
abs-ltng/time
abs-pois/time
gold%/time
mag%/time
regen-stam/time
stam/time
dmg-dem/time
dmg-und/time
att-dem/time
att-und/time
crush/time
wounds/time
kick/time
deadly/time
gems%/time
fade
state
pruby
fruby
nruby
flruby
cruby
pamethyst
famethyst
namethyst
flamethyst
camethyst
pdiamond
fdiamond
ndiamond
fldiamond
cdiamond
pemerald
femerald
nemerald
flemerald
cemerald
psapphire
fsapphire
nsapphire
flsapphire
csapphire
ptopaz
ftopaz
ntopaz
fltopaz
ctopaz
pskull
fskull
nskull
flskull
cskull
rbgr01
rbgr02
rbgr03
rbgr04
rbgr05
rbgr06
rbgr07
rbgr08
rbgr09
rbgr10
rbgr11
rbgr12
rbgr13
rbgr14
rbgr15
rbgr16
rbgr17
rbgr18
rbgr19
rbgr20
rbgr21
rbgr22
rbgr23
rbgr24
rbgr25
rbgr26
rbgr27
rbgr28
rbgr29
rbgr30
rbgr31
rbgr32
rbgr33
magharv
showkills
iforge

View File

@ -23,6 +23,8 @@
ini_set('display_errors', 1);
ini_set('log_errors', 1);
define('FILTER_PROPERTIES_FILE', 'filterProperties.txt');
$filename = 'd2im.conf';
if (file_exists($filename)) {
@ -58,21 +60,46 @@ if (file_exists($filename)) {
$u = $files->getFile("UniqueItems");
$s = $files->getFile("SetItems");
// If there's data, process it and save
if (!empty($_POST)) {
require_once './src/D2SaveFile.php';
$saver = new D2SaveFile();
// process post
// combine armor/weapon codes
$post = $_POST;
if (!empty($post['code'])) {
array_filter($post['code']);
if (!empty($post['code'][0])) {
$post['code'] = $post['code'][0];
} else {
$post['code'] = $post['code'][1];
}
}
// if ladder or carry1 is 0, set empty field.
if (!$post['ladder']){
$post['ladder'] = '';
}
if (!$post['carry1']){
$post['carry1'] = '';
}
if ($_POST['formtype'] == "uniqueitems") {
$saver->save($u);
$saver->saveTblEnries("UniqueItems.tbl.txt");
}
if ($_POST['formtype'] == "setitems") {
$saver->save($s);
$saver->saveTblEnries("SetItems.tbl.txt");
}

View File

@ -6,3 +6,7 @@ function dd($var) {
echo "</pre>";
die();
}
function filterFunc($arg1, $arg2) {
return !($arg1 == $arg2);
}

View File

@ -4,29 +4,30 @@
<!-- First row -->
<div class="form-group row">
<div class="col-4">
<div class="input-group">
<input id="index" name="index" placeholder="Index (Item Name)" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control">
</div><span class="help">[show/hide Help]</span>
<div class="col-2" style="background: #efe;">
<div class="input-group">
<input id="index" name="index" placeholder="Index" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control">
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="indexHelpBlock" class="form-text text-muted">Index: string key to item's name in a .tbl file</span>
</div>
<div class="col-4">
<div class="input-group">
<div class="col-2" style="background: #cfc;">
<div class="input-group">
<input id="set" name="set" placeholder="Set" type="text" aria-describedby="setHelpBlock" required="required" class="form-control">
</div><span class="help">[show/hide Help]</span>
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="indexHelpBlock" class="form-text text-muted">
Set: string key to the index field in Sets.txt - the set the item is a part of.
</span>
</div>
<div class="col-2" style="background: #ccd;">
<label for="a-select">Armor</label>
<select class="a-select custom-select" name="code[]" id="" required="required">
<option value=""></option>
<option value="">Armor</option>
<?php
foreach ($armor as $a)
if ($a['spawnable']) {
@ -40,9 +41,8 @@
<div class="col-2" style="background: #ddc;">
<label for="w-select">Weapon</label>
<select class="w-select custom-select" name="code[]" id="w-select" required="required">
<option value=""></option>
<option value="">Weapon</option>
<?php
foreach ($weapon as $a) {
echo '<option value="' . $a['code'] . '">' . $a['name'] . '</option>';
@ -50,206 +50,212 @@
?>
</select>
</div>
</div>
<input id="item" type="hidden" name="item" value="">
<!-- Second row -->
<input id="item" type="hidden" name="item" value="">
<div class="form-group row">
<div class="col-2" style="background: #dec;">
<div class="col-4" style="background: #dec;">
<div class="input-group">
<input id="rarity" name="rarity" placeholder="Rarity" type="text" aria-describedby="rarityHelpBlock" required="required" class="form-control">
</div><span class="help">[show/hide Help]</span>
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="rarityHelpBlock" class="form-text text-muted">Rarity: Chance to pick this set item if more then one set item of the same base item exist, this uses the common rarity/total_rarity formula, so if you have two set rings, one with a rarity of 100 the other with a rarity of 1, then the first will drop 100/101 percent of the time (99%) and the other will drop 1/101 percent of the time (1%), rarity can be anything between 0 and 255.</span>
</div>
<div class="col-2" style="background: #edd;">
<input id="lvl" name="lvl" placeholder="Lvl" type="text" aria-describedby="lvlHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="lvl" name="lvl" placeholder="Lvl" type="text" aria-describedby="lvlHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="lvlHelpBlock" class="form-text text-muted">The quality level of this set item, monsters, cube recipes, vendors, objects and the like most be at least this level or higher to be able to drop this item, otherwise they would drop a magical item with twice normal durability.</span>
</div>
<div class="col-2" style="background: #edd;">
<input id="lvlreq" name="lvlreq" placeholder="Level Required" type="text" aria-describedby="lvlreqHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="lvlreq" name="lvlreq" placeholder="Level Required" type="text" aria-describedby="lvlreqHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="lvlreqHelpBlock" class="form-text text-muted">lvl req: The character level required to use this set item.</span>
</div>
<div class="col-2">
<input id="chrtransform" name="chrtransform" placeholder="ChrTransform" type="text" aria-describedby="chrtransformHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="chrtransform" name="chrtransform" placeholder="ChrTransform" type="text" aria-describedby="chrtransformHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="chrtransformHelpBlock" class="form-text text-muted">ChrTransform: palette shift to apply to the the DCC component-file and the DC6 flippy-file (whenever or not the color shift will apply is determined by Weapons.txt, Armor.txt or Misc.txt). This is an ID pointer from Colors.txt.</span>
</div>
<div class="col-2">
<input id="invtransform" name="invtransform" type="text" placeholder="InvTransform" aria-describedby="invtransformHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="invtransform" name="invtransform" type="text" placeholder="InvTransform" aria-describedby="invtransformHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="invtransformHelpBlock" class="form-text text-muted">InvTransform: palette shift to apply to the the DC6 inventory-file (whenever or not the color shift will apply is determined by Weapons.txt, Armor.txt or Misc.txt). This is an ID pointer from Colors.txt.</span>
</div>
<div class="col-2" style="background: #eef;">
<input id="invfile" name="invfile" placeholder="InvFile" type="text" aria-describedby="invfileHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="invfile" name="invfile" placeholder="InvFile" type="text" aria-describedby="invfileHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="invfileHelpBlock" class="form-text text-muted">InvFile: overrides the invfile and uniqueinvfile specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains the file name of the DC6 inventory graphic.</span>
</div>
<div class="col-2" style="background: #eef;">
<input id="flippyfile" name="flippyfile" placeholder="Flippy File" type="text" aria-describedby="flippyfileHelpBlock" class="form-control" required="required"><span class="help">[show/hide Help]</span>
<input id="flippyfile" name="flippyfile" placeholder="Flippy File" type="text" aria-describedby="flippyfileHelpBlock" class="form-control" required="required"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="flippyfileHelpBlock" class="form-text text-muted">FlippyFile: overrides the flippyfile specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains the file name of the DC6 flippy animation.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="dropsound" name="dropsound" placeholder="DropSound" type="text" aria-describedby="dropsoundHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="dropsound" name="dropsound" placeholder="DropSound" type="text" aria-describedby="dropsoundHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="dropsoundHelpBlock" class="form-text text-muted">DropSound: overrides the dropsound (the sound played when the item hits the ground) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="dropsfxframe" name="dropsfxframe" placeholder="DropSfxFrame" type="text" aria-describedby="dropsfxframeHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="dropsfxframe" name="dropsfxframe" placeholder="DropSfxFrame" type="text" aria-describedby="dropsfxframeHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="dropsfxframeHelpBlock" class="form-text text-muted">DropSfxFrame: how many frames after the flippy animation starts playing will the associated drop sound start to play. This overrides the values in Weapons.txt, Armor.txt or Misc.txt.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="usesound" name="usesound" placeholder="UseSound" type="text" aria-describedby="usesoundHelpBlock" class="form-control"><span class="help">[show/hide Help]</span><span id="usesoundHelpBlock" class="form-text text-muted">UseSound: overrides the usesound (the sound played when the item is consumed by the player) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
<input id="usesound" name="usesound" placeholder="UseSound" type="text" aria-describedby="usesoundHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span><span id="usesoundHelpBlock" class="form-text text-muted">UseSound: overrides the usesound (the sound played when the item is consumed by the player) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
</div>
<div class="col-2" style="background: #def;">
Cost Mult:
<input id="costmult" value="5" name="costmult" placeholder="Cost Mult" type="text" aria-describedby="costmultHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="costmult" value="" name="costmult" placeholder="Cost Mult" type="text" aria-describedby="costmultHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="costmultHelpBlock" class="form-text text-muted">Cost Mult: the base item's price is multiplied by this value when sold, repaired or bought from a vendor.</span>
</div>
<div class="col-2" style="background: #def;">
Cost Add:
<input id="costadd" value="5000" name="costadd" placeholder="Cost Add" type="text" aria-describedby="costaddHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="costadd" value="" name="costadd" placeholder="Cost Add" type="text" aria-describedby="costaddHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="costaddHelpBlock" class="form-text text-muted">Cost Add: after the price has been multiplied, this amount of gold is added to the price on top.</span>
</div>
</div>
<div class="col-3" style="background: #ffc">
<p>Add Func:</p>
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_0" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="0">
<label for="addfunc_0" class="custom-control-label">0</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_1" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="1">
<label for="addfunc_1" class="custom-control-label">1</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_2" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="2">
<label for="addfunc_2" class="custom-control-label">2</label>
</div><br> <span class="help">[show/hide Help]</span>
<span id="addfuncHelpBlock" class="form-text text-muted">add func: a property mode field that controls how the variable attributes will appear and be functional on a set item. See the appendix for further details about this field's effects.<ol>
<li>no green properties on item (apropxx will appear as a blue attribute on the list instead).</li>
<li>green properties (apropxx) depend on which other items from the set are equipped.</li>
<li>green properties (apropxx) depend on how many other items from the set are equipped.</li>
</ol></span>
</div>
<div class="form-group row">
<div class="col-12">
<h3 style="color: blue;">Blue Attributes</h3>
</div>
<?php
$html = '';
foreach (range(1, 9) as $p) {
?>
<div class="col-2" style="background: #D6DDFF;">
<select id="prop<?php echo $p ?>-select" name="prop<?php echo $p ?>" class="custom-select">
<option class="PropFirst" value="">Prop<?php echo $p ?></option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a['code'] . '">' . $a['code'] . '</option>';
}
?>
</select>
<input id="par<?php echo $p ?>" name="par<?php echo $p ?>" placeholder="Par<?php echo $p ?>" type="number" aria-describedby="par<?php echo $p ?>HelpBlock" class="form-control par<?php echo $p ?>">
<input id="min<?php echo $p ?>" name="min<?php echo $p ?>" placeholder="min<?php echo $p ?>" type="number" aria-describedby="min<?php echo $p ?>HelpBlock" class="form-control min<?php echo $p ?>">
<input id="max<?php echo $p ?>" name="max<?php echo $p ?>" placeholder="max<?php echo $p ?>" type="number" aria-describedby="max<?php echo $p ?>HelpBlock" class="form-control max<?php echo $p ?>">
<div class="col-2" style="background: #ffc">
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_0" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="0">
<label for="addfunc_0" class="custom-control-label">0</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_1" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="1">
<label for="addfunc_1" class="custom-control-label">1</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="addfunc" id="addfunc_2" type="radio" aria-describedby="addfuncHelpBlock" required="required" class="custom-control-input" value="2">
<label for="addfunc_2" class="custom-control-label">2</label>
</div><br> <span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i></span>
<span style="font-family: Exocet;">Add Func</span>
<span id="addfuncHelpBlock" class="form-text text-muted">add func: a property mode field that controls how the variable attributes will appear and be functional on a set item. See the appendix for further details about this field's effects.</span>
</div>
<div class="form-group row">
<div class="col-12">
<h3 style="color: blue;">Blue Attributes</h3>
</div>
<?php
}
?>
</div>
<div class="form-group row">
<div class="col-12">
<h3 style="color: green">Green Attributes</h3>
<p style="font-family: lato;">Note: Edit boxes in Vertical Order. <br>[aprop1a, aprop1b][aprop2a, aprop2b]</p>
</div>
<?php
$html = '';
foreach (range(1, 5) as $p) {
?>
<div class="col-2" style="background: #DDFFD6">
<select id="aprop<?php echo $p ?>a-select" name="aprop<?php echo $p ?>a" class="custom-select">
<option class="aPropFirst" value="">aProp<?php echo $p ?>a</option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a['code'] . '">' . $a['code'] . '</option>';
}
?>
</select>
<input id="apar<?php echo $p ?>a" name="apar<?php echo $p ?>a" placeholder="apar<?php echo $p ?>a" type="number" aria-describedby="apar<?php echo $p ?>aHelpBlock" class="form-control apar<?php echo $p ?>a">
<input id="amin<?php echo $p ?>a" name="amin<?php echo $p ?>a" placeholder="amin<?php echo $p ?>a" type="number" aria-describedby="amin<?php echo $p ?>aHelpBlock" class="form-control amin<?php echo $p ?>a">
<input id="amax<?php echo $p ?>a" name="amax<?php echo $p ?>a" placeholder="amax<?php echo $p ?>a" type="number" aria-describedby="amax<?php echo $p ?>aHelpBlock" class="form-control amax<?php echo $p ?>a">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
<!-- b -->
<div style="margin-top: 0px;">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
<select id="bprop<?php echo $p ?>b-select" name="aprop<?php echo $p ?>b" class="custom-select">
<option class="aPropFirst" value="">aProp<?php echo $p ?>b</option>
$html = '';
foreach (range(1, 9) as $p) {
?>
<div class="col-2" style="background: #D6DDFF;">
<select id="prop<?php echo $p ?>-select" name="prop<?php echo $p ?>" class="custom-select">
<option class="PropFirst" value="">Prop<?php echo $p ?></option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a['code'] . '">' . $a['code'] . '</option>';
echo '<option value="' . $a . '">' . $a. '</option>';
}
?>
</select>
<input id="par<?php echo $p ?>" name="par<?php echo $p ?>" placeholder="Par<?php echo $p ?>" type="number" aria-describedby="par<?php echo $p ?>HelpBlock" class="form-control par<?php echo $p ?>">
<input id="apar<?php echo $p ?>b" name="apar<?php echo $p ?>b" placeholder="apar<?php echo $p ?>b" type="number" aria-describedby="apar<?php echo $p ?>aHelpBlock" class="form-control apar<?php echo $p ?>b">
<input id="min<?php echo $p ?>" name="min<?php echo $p ?>" placeholder="min<?php echo $p ?>" type="number" aria-describedby="min<?php echo $p ?>HelpBlock" class="form-control min<?php echo $p ?>">
<input id="amin<?php echo $p ?>b" name="amin<?php echo $p ?>b" placeholder="amin<?php echo $p ?>b" type="number" aria-describedby="amin<?php echo $p ?>aHelpBlock" class="form-control amin<?php echo $p ?>b">
<input id="max<?php echo $p ?>" name="max<?php echo $p ?>" placeholder="max<?php echo $p ?>" type="number" aria-describedby="max<?php echo $p ?>HelpBlock" class="form-control max<?php echo $p ?>">
<input id="amax<?php echo $p ?>b" name="amax<?php echo $p ?>b" placeholder="amax<?php echo $p ?>b" type="number" aria-describedby="amax<?php echo $p ?>aHelpBlock" class="form-control amax<?php echo $p ?>b">
</div>
<?php
}
?>
</div>
</div>
<div class="form-group row">
<div class="col-12">
<h3 style="color: green">Green Attributes</h3>
<p style="font-family: lato;">Note: Edit boxes in Vertical Order. <br>[aprop1a, aprop1b][aprop2a, aprop2b]</p>
</div>
<?php
}
?>
$html = '';
foreach (range(1, 5) as $p) {
?>
<div class="col-2" style="background: #DDFFD6">
<select id="aprop<?php echo $p ?>a-select" name="aprop<?php echo $p ?>a" class="custom-select">
<option class="aPropFirst" value="">aProp<?php echo $p ?>a</option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a . '">' . $a . '</option>';
}
?>
</select>
<input id="apar<?php echo $p ?>a" name="apar<?php echo $p ?>a" placeholder="apar<?php echo $p ?>a" type="number" aria-describedby="apar<?php echo $p ?>aHelpBlock" class="form-control apar<?php echo $p ?>a">
</div>
<div class="form-group row">
<span class="help">[show/hide Help]</span>
<span id="apropHelpBlock" class="form-text text-muted">
<p><strong>aprop1a,aprop1b to aprop5a,aprop5b:</strong> An ID pointer of a property from Properties.txt, these columns control each of the five pairs of different variable (green) modifiers a set item can grant you at most.</p>
<p><strong>apar1a,apar1b to apar5a,apar5b:</strong> The parameter passed on to the associated property, this is used to pass skill IDs, state IDs, monster IDs, montype IDs and the like on to the properties that require them, these fields support calculations.</p>
<p><strong>amin1a,amin1b to amin5a,amin5b:</strong> Minimum value to assign to the associated property. Certain properties have special interpretations based on stat encoding (e.g. chance-to-cast and charged skills). See the File Guide for Properties.txt and ItemStatCost.txt for further details.</p>
<p><strong>amax1a,amax1b to amax5a,amax5b:</strong> Maximum value to assign to the associated property. Certain properties have special interpretations based on stat encoding (e.g. chance-to-cast and charged skills). See the File Guide for Properties.txt and ItemStatCost.txt for further details.</p>
<input id="amin<?php echo $p ?>a" name="amin<?php echo $p ?>a" placeholder="amin<?php echo $p ?>a" type="number" aria-describedby="amin<?php echo $p ?>aHelpBlock" class="form-control amin<?php echo $p ?>a">
<input id="amax<?php echo $p ?>a" name="amax<?php echo $p ?>a" placeholder="amax<?php echo $p ?>a" type="number" aria-describedby="amax<?php echo $p ?>aHelpBlock" class="form-control amax<?php echo $p ?>a">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
<!-- b -->
<div style="margin-top: 0px;">
<i class="fa fa-arrow-down" aria-hidden="true"></i>
<select id="bprop<?php echo $p ?>b-select" name="aprop<?php echo $p ?>b" class="custom-select">
<option class="aPropFirst" value="">aProp<?php echo $p ?>b</option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a. '">' . $a . '</option>';
}
?>
</select>
<input id="apar<?php echo $p ?>b" name="apar<?php echo $p ?>b" placeholder="apar<?php echo $p ?>b" type="number" aria-describedby="apar<?php echo $p ?>aHelpBlock" class="form-control apar<?php echo $p ?>b">
<input id="amin<?php echo $p ?>b" name="amin<?php echo $p ?>b" placeholder="amin<?php echo $p ?>b" type="number" aria-describedby="amin<?php echo $p ?>aHelpBlock" class="form-control amin<?php echo $p ?>b">
<input id="amax<?php echo $p ?>b" name="amax<?php echo $p ?>b" placeholder="amax<?php echo $p ?>b" type="number" aria-describedby="amax<?php echo $p ?>aHelpBlock" class="form-control amax<?php echo $p ?>b">
</div>
</div>
<?php
}
?>
</div>
<div class="form-group row">
<span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="apropHelpBlock" class="form-text text-muted">
<p><strong>aprop1a,aprop1b to aprop5a,aprop5b:</strong> An ID pointer of a property from Properties.txt, these columns control each of the five pairs of different variable (green) modifiers a set item can grant you at most.</p>
<p><strong>apar1a,apar1b to apar5a,apar5b:</strong> The parameter passed on to the associated property, this is used to pass skill IDs, state IDs, monster IDs, montype IDs and the like on to the properties that require them, these fields support calculations.</p>
<p><strong>amin1a,amin1b to amin5a,amin5b:</strong> Minimum value to assign to the associated property. Certain properties have special interpretations based on stat encoding (e.g. chance-to-cast and charged skills). See the File Guide for Properties.txt and ItemStatCost.txt for further details.</p>
<p><strong>amax1a,amax1b to amax5a,amax5b:</strong> Maximum value to assign to the associated property. Certain properties have special interpretations based on stat encoding (e.g. chance-to-cast and charged skills). See the File Guide for Properties.txt and ItemStatCost.txt for further details.</p>
</span>
</div>
</span>
</div>
<input type="hidden" name="*eol" value="0">
<?php include 'optionSubmit.php'; ?>
<input type="hidden" name="*eol" value="0">
<?php include 'optionSubmit.php'; ?>
<!-- distinguish between forms -->
<input type="hidden" name="formtype" value="setitems">
<!-- distinguish between forms -->
<input type="hidden" name="formtype" value="setitems">
</form>
<ul>

View File

@ -23,22 +23,13 @@ class D2SaveFile {
public $path;
public function save($file) {
$post = $_POST;
if (!empty($post['code'])) {
array_filter($post['code']);
public function save($file, $data) {
if (!empty($post['code'][0])) {
$post['code'] = $post['code'][0];
} else {
$post['code'] = $post['code'][1];
}
}
$fp = fopen($this->path.DIRECTORY_SEPARATOR.$file, 'a+');
$this->saveBackup($file);
fputcsv($fp, $post, "\t");
fputcsv($fp, $data, "\t");
}

View File

@ -25,17 +25,31 @@
class D2TxtParser {
public $path = TXT_PATH;
// Files specific to Unique Items
public function __construct() {
}
public function parseFile($file){
return $this->toPHP($file);
}
function toPHP($file) {
public function parseFile($file) {
if ($file == "Properties.txt") {
return $this->filterProps($file);
}
return $this->parseData($file);
}
function filterProps($file) {
$data = $this->parseData($file);
$propsToFilter = file(FILTER_PROPERTIES_FILE, FILE_IGNORE_NEW_LINES);
foreach ($data as $d) {
$allProps[] = $d['code'];
}
$filteredProps = array_diff($allProps, $propsToFilter);
return $filteredProps;
}
public function parseData($file) {
$file = $this->path . $file;
$rows = array_map(function ($v) {
return str_getcsv($v, "\t");
@ -47,6 +61,6 @@ class D2TxtParser {
}
return $data;
}
}
?>

View File

@ -3,21 +3,17 @@
<form action="/index.php" method="post">
<div class="form-group row">
<div class="col-3">
<div class="col-2" style="background: #fec;">
<p>Index</p>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-align-justify"></i>
</div>
</div>
<input id="index" name="index" placeholder="Index (Item Name)" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control">
</div><span class="help">[show/hide Help]</span>
<input id="index" name="index" placeholder="Item Name" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control">
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="indexHelpBlock" class="form-text text-muted">Index: the ID pointer that is referenced by the game in TreasureClassEx.txt and CubeMain.txt, this column also contains the string-key used in the TBL files.</span>
</div>
<div class="col-3" style="background: #ddc;">
<div class="col-2" style="background: #ddc;">
<p>Version:</p>
<div class="custom-control custom-radio custom-control-inline">
<input name="version" id="version_0" type="radio" aria-describedby="versionHelpBlock" required="required" class="custom-control-input" value="0">
@ -30,7 +26,8 @@
<div class="custom-control custom-radio custom-control-inline">
<input name="version" id="version_2" type="radio" aria-describedby="versionHelpBlock" required="required" class="custom-control-input" value="100" checked>
<label for="version_2" class="custom-control-label">100</label>
</div><br><span class="help">[show/hide Help]</span>
</div><br><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="versionHelpBlock" class="form-text text-muted">Version: Switch, what game version was this unique item added in, 0 referes to real classic Diablo II (1.00-1.06), 1 refers to new classic Diablo II (1.07-1.11) and 100 refers to the Expansion Set. Items with 100 will be unable to drop in Classic Diablo II.</span>
</div>
@ -44,7 +41,8 @@
<div class="custom-control custom-radio custom-control-inline">
<input name="enabled" id="enabled_1" type="radio" class="custom-control-input" value="1" aria-describedby="enabledHelpBlock" required="required" checked>
<label for="enabled_1" class="custom-control-label">1</label>
</div><br><span class="help">[show/hide Help]</span>
</div><br><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="enabledHelpBlock" class="form-text text-muted">Ladder: Boolean, 1 = item available only on the realms (enabled), 0 = item available both in single player/open games, TCP/IP and on the realms.</span>
</div>
@ -53,51 +51,57 @@
<p>Ladder:</p>
<div class="custom-control custom-radio custom-control-inline">
<input name="ladder" id="ladder_0" type="radio" class="custom-control-input" value="0" aria-describedby="ladderHelpBlock" required="required">
<input name="ladder" id="ladder_0" type="radio" class="custom-control-input" value="0" aria-describedby="ladderHelpBlock" required="required" checked>
<label for="ladder_0" class="custom-control-label">0</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input name="ladder" id="ladder_1" type="radio" class="custom-control-input" value="1" aria-describedby="ladderHelpBlock" required="required" checked>
<input name="ladder" id="ladder_1" type="radio" class="custom-control-input" value="1" aria-describedby="ladderHelpBlock" required="required">
<label for="ladder_1" class="custom-control-label">1</label>
</div><br><span class="help">[show/hide Help]</span>
</div><br><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="ladderHelpBlock" class="form-text text-muted">Ladder: Boolean, 1 = item available only on the realms (ladder), 0 = item available both in single player/open games, TCP/IP and on the realms.</span>
</div>
<div class="col-2" style="background: #dec;">
<div class="col-4" style="background: #dec;">
<p>Rarity</p>
<div class="input-group">
<input id="rarity" name="rarity" placeholder="Rarity" type="text" aria-describedby="rarityHelpBlock" required="required" class="form-control">
</div><span class="help">[show/hide Help]</span>
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="rarityHelpBlock" class="form-text text-muted">Rarity: chance to pick this unique item if more then one unique item of the same base item exist, this uses the common rarity/total_rarity formula, so if you have two unique rings, one with a rarity of 100 the other with a rarity of 1, then the first will drop 100/101 percent of the time (99%) and the other will drop 1/101 percent of the time (1%), rarity can be anything between 1 and 255 (rarity of less then 1 will be set to 1 by the code).</span>
</div>
</div>
<div class="form-group row">
<div class="col-3">
<p>NoLimit</p>
<div class="form-group row">
<div class="col-2" style="background: #fde;">
<select id="nolimit" name="nolimit" class="custom-select" aria-describedby="nolimitHelpBlock">
<option value="" selected>No Limit</option>
<option value="0">0</option>
<option value="1">1</option>
</select><span class="help">[show/hide Help]</span>
</select><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="nolimitHelpBlock" class="form-text text-muted">NoLimit: Boolean, 0 = can drop only once per game, 1 = can drop more then once per game.</span>
</div>
<div class="col-3" style="background: #edd;">
<input id="lvl" name="lvl" placeholder="Lvl" type="text" aria-describedby="lvlHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<div class="col-4" style="background: #edd;">
<input id="lvl" name="lvl" placeholder="Lvl" type="text" aria-describedby="lvlHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="lvlHelpBlock" class="form-text text-muted">Lvl: the quality level of this unique item. Monsters, cube recipes, vendors, objects and the like most be at least this level or higher to be able to drop this item, otherwise they would drop a rare item with enhanced durability.</span>
</div>
<div class="col-2" style="background: #edd;">
<input id="lvlreq" name="lvlreq" placeholder="Level Required" type="text" aria-describedby="lvlreqHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="lvlreq" name="lvlreq" placeholder="LvlReq" type="text" aria-describedby="lvlreqHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="lvlreqHelpBlock" class="form-text text-muted">Lvl Req: the character level required to use this unique item.</span>
</div>
<div class="col-2" style="background: #ccd;">
<label for="a-select">Armor</label>
<select class="a-select custom-select" name="code[]" id="" required="required">
<option value=""></option>
<option value="">Armor</option>
<?php
foreach ($armor as $a)
if ($a['spawnable']) {
@ -111,9 +115,8 @@
<div class="col-2" style="background: #ddc;">
<label for="w-select">Weapon</label>
<select class="w-select custom-select" name="code[]" id="" required="required">
<option value=""></option>
<option value="">Weapon</option>
<?php
foreach ($weapon as $a) {
echo '<option value="' . $a['code'] . '">' . $a['name'] . '</option>';
@ -124,68 +127,78 @@
</div>
<div class="form-group row">
<input type="hidden" name="type" value=""> <br>
<input type="hidden" name="uber" value=""><br>
<div class="col-3">
<p>Carry1</p>
<input type="hidden" name="uber" value=""><br>
<div class="col-3" style="background: #edf;">
<select id="carry1" name="carry1" class="custom-select" aria-describedby="carry1HelpBlock" required="required">
<option value="" selected>Carry 1</option>
<option value="0">0</option>
<option value="1" selected>1</option>
</select><span class="help">[show/hide Help]</span>
<option value="1">1</option>
</select><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="carry1HelpBlock" class="form-text text-muted">Carry1: Boolean, 0 = allow the player to hold as many of this item as he wants, 1 = allow the player to hold a single copy only. In reality this just prevents the player from picking up the item when it is dropped on the floor and it prevents the player from putting this item in the trading window.</span>
</div>
<div class="col-3" style="background: #def;">
<input id="costmult" value="5" name="costmult" placeholder="Cost Mult" type="text" aria-describedby="costmultHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<div class="col-2" style="background: #def;">
<input id="costmult" value="" name="costmult" placeholder="Cost Mult" type="text" aria-describedby="costmultHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="costmultHelpBlock" class="form-text text-muted">Cost Mult: the base item's price is multiplied by this value when sold, repaired or bought from a vendor.</span>
</div>
<div class="col-3" style="background: #def;">
<input id="costadd" value="5000" name="costadd" placeholder="Cost Add" type="text" aria-describedby="costaddHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="costadd" value="" name="costadd" placeholder="Cost Add" type="text" aria-describedby="costaddHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="costaddHelpBlock" class="form-text text-muted">Cost Add: after the price has been multiplied, this amount of gold is added to the price on top.</span>
</div>
<div class="col-3">
<input id="chrtransform" name="chrtransform" placeholder="ChrTransform" type="text" aria-describedby="chrtransformHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<div class="col-3" style="background: #fde;">
<input id="chrtransform" name="chrtransform" placeholder="ChrTransform" type="text" aria-describedby="chrtransformHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="chrtransformHelpBlock" class="form-text text-muted">ChrTransform: palette shift to apply to the the DCC component-file and the DC6 flippy-file (whenever or not the color shift will apply is determined by Weapons.txt, Armor.txt or Misc.txt). This is an ID pointer from Colors.txt.</span>
</div>
</div>
<div class="form-group row">
<div class="col-2">
<input id="invtransform" name="invtransform" type="text" placeholder="InvTransform" aria-describedby="invtransformHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="invtransform" name="invtransform" type="text" placeholder="InvTransform" aria-describedby="invtransformHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="invtransformHelpBlock" class="form-text text-muted">InvTransform: palette shift to apply to the the DC6 inventory-file (whenever or not the color shift will apply is determined by Weapons.txt, Armor.txt or Misc.txt). This is an ID pointer from Colors.txt.</span>
</div>
<div class="col-2" style="background: #eef;">
<input id="flippyfile" name="flippyfile" placeholder="Flippy File" type="text" aria-describedby="flippyfileHelpBlock" class="form-control" required="required"><span class="help">[show/hide Help]</span>
<input id="flippyfile" name="flippyfile" placeholder="Flippy File" type="text" aria-describedby="flippyfileHelpBlock" class="form-control" required="required"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="flippyfileHelpBlock" class="form-text text-muted">FlippyFile: overrides the flippyfile specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains the file name of the DC6 flippy animation.</span>
</div>
<div class="col-2" style="background: #eef;">
<input id="invfile" name="invfile" placeholder="InvFile" type="text" aria-describedby="invfileHelpBlock" required="required" class="form-control"><span class="help">[show/hide Help]</span>
<input id="invfile" name="invfile" placeholder="InvFile" type="text" aria-describedby="invfileHelpBlock" required="required" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="invfileHelpBlock" class="form-text text-muted">InvFile: overrides the invfile and uniqueinvfile specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains the file name of the DC6 inventory graphic.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="dropsound" name="dropsound" placeholder="DropSound" type="text" aria-describedby="dropsoundHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="dropsound" name="dropsound" placeholder="DropSound" type="text" aria-describedby="dropsoundHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="dropsoundHelpBlock" class="form-text text-muted">DropSound: overrides the dropsound (the sound played when the item hits the ground) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="dropsfxframe" name="dropsfxframe" placeholder="DropSfxFrame" type="text" aria-describedby="dropsfxframeHelpBlock" class="form-control"><span class="help">[show/hide Help]</span>
<input id="dropsfxframe" name="dropsfxframe" placeholder="DropSfxFrame" type="text" aria-describedby="dropsfxframeHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span id="dropsfxframeHelpBlock" class="form-text text-muted">DropSfxFrame: how many frames after the flippy animation starts playing will the associated drop sound start to play. This overrides the values in Weapons.txt, Armor.txt or Misc.txt.</span>
</div>
<div class="col-2" style="background: #fed;">
<input id="usesound" name="usesound" placeholder="UseSound" type="text" aria-describedby="usesoundHelpBlock" class="form-control"><span class="help">[show/hide Help]</span><span id="usesoundHelpBlock" class="form-text text-muted">UseSound: overrides the usesound (the sound played when the item is consumed by the player) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
<input id="usesound" name="usesound" placeholder="UseSound" type="text" aria-describedby="usesoundHelpBlock" class="form-control"><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span><span id="usesoundHelpBlock" class="form-text text-muted">UseSound: overrides the usesound (the sound played when the item is consumed by the player) specified in Weapons.txt, Armor.txt or Misc.txt for the base item. This field contains an ID pointer from Sounds.txt.</span>
</div>
</div>
<div class="form-group row">
@ -200,7 +213,7 @@
<option class="PropFirst" value="">Prop<?php echo $p ?></option>
<?php
foreach ($prop as $a) {
echo '<option value="' . $a['code'] . '">' . $a['code'] . '</option>';
echo '<option value="' . $a . '">' . $a . '</option>';
}
?>
</select>

View File

@ -1 +0,0 @@
,stoned,stoned-desktop,23.03.2021 02:12,file:///home/stoned/.config/libreoffice/4;