mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
Item preview upgrade. Debug info/button added. Debug link when click on item pic. Proper descfuncs with sprintf.
This commit is contained in:
@@ -172,28 +172,33 @@ class D2ItemDesc {
|
||||
'19' => 'StrSklTabItem20',
|
||||
'20' => 'StrSklTabItem21'
|
||||
];
|
||||
|
||||
public $charClass = [
|
||||
"ama" => "Amazon",
|
||||
"sor" => "Sorceress",
|
||||
"nec" => "Necromancer",
|
||||
"pal" => "Paladin",
|
||||
"bar" => "Barbarian",
|
||||
"dru" => "Druid",
|
||||
"ama" => "Amazon",
|
||||
"sor" => "Sorceress",
|
||||
"nec" => "Necromancer",
|
||||
"pal" => "Paladin",
|
||||
"bar" => "Barbarian",
|
||||
"dru" => "Druid",
|
||||
"ass" => "Assassin"
|
||||
];
|
||||
|
||||
public function getDesc($value, $params = []) {
|
||||
|
||||
public function getDesc($params = []) {
|
||||
if (empty($params))
|
||||
return false;
|
||||
|
||||
$v = '<span style="font-family: Lato; color: white; font-weight: 900">' . $value . "</span>";
|
||||
$s1 = $params['string1'];
|
||||
$s2 = $params['string2'];
|
||||
$prop = $params['prop'];
|
||||
$par = $params['par'];
|
||||
$min = '<span style="color: white; font-weight: 900">' . $params['min'] . "</span>";
|
||||
$max = '<span style="color: white; font-weight: 900">' . $params['max'] . "</span>";
|
||||
$min = (int) $params['min'];
|
||||
$v = $min;
|
||||
|
||||
$max = (int) $params['max'];
|
||||
|
||||
if ($min == $max) {
|
||||
$max = '';
|
||||
}
|
||||
|
||||
foreach ($this->skilltabs as $s) {
|
||||
$sql = "SELECT `String` FROM `strings` WHERE `Key`='$s'";
|
||||
$this->skilltabsDesc[] = PDO_FetchRow($sql);
|
||||
@@ -205,11 +210,23 @@ class D2ItemDesc {
|
||||
|
||||
//ddump($this->skilltabsDescClean);
|
||||
|
||||
|
||||
/*
|
||||
* Descval 1
|
||||
*
|
||||
*
|
||||
* $format = 'The %s contains %d monkeys';
|
||||
echo sprintf($format, $num, $location);
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($params['descval'] == 1 || $params['descval'] == '') {
|
||||
|
||||
if ($params['descfunc'] == 1) {
|
||||
$this->str = "+$v $s1";
|
||||
if (!empty($max)) {
|
||||
$max = "-" . $max;
|
||||
}
|
||||
$this->str = "+$min$max $s1";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 2) {
|
||||
@@ -229,7 +246,7 @@ class D2ItemDesc {
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 6) {
|
||||
$this->str = "+$v $s1 $s2";
|
||||
$this->str = "+$par $s1 $s2";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 7) {
|
||||
@@ -248,7 +265,7 @@ class D2ItemDesc {
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 11) {
|
||||
$this->str = "Repairs 1 Durability In " . (100 / $value) . " seconds";
|
||||
$this->str = "Repairs 1 Durability In " . (100 / $par) . " seconds";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 12) {
|
||||
@@ -262,17 +279,18 @@ class D2ItemDesc {
|
||||
if ($params['descfunc'] == 14) {
|
||||
|
||||
$sql = "SELECT class
|
||||
FROM `charstats`
|
||||
WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab2`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab3`='{$this->skilltabs[$par]}'";
|
||||
FROM `charstats`
|
||||
WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab2`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab3`='{$this->skilltabs[$par]}'";
|
||||
|
||||
$class = PDO_FetchOne($sql);
|
||||
|
||||
$this->str = "+$min-$max{$this->skilltabsDescClean[$par]['String']} Skill Levels ($class Only)";
|
||||
$this->str = sprintf($s1, $min, $this->skilltabsDescClean[$par]['String']);
|
||||
}
|
||||
if ($params['descfunc'] == 15) {
|
||||
$this->str = "[chance]% to case [slvl] [skill] on [event]";
|
||||
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
|
||||
$skill = PDO_FetchOne($sql);
|
||||
$this->str = sprintf($s1, $min, $max, $skill);
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 16) {
|
||||
@@ -292,7 +310,7 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 20) {
|
||||
$this->str = ($v * -1) . "% $s1";
|
||||
$this->str = ($v) . "% $s1";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 21) {
|
||||
@@ -307,7 +325,11 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 24) {
|
||||
$this->str = "+$v to Skill Charges Or Something";
|
||||
$string = str_replace("\\", "", $s1);
|
||||
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
|
||||
$skill = PDO_FetchOne($sql);
|
||||
$this->str = "+$min to Skill Charges Or Something";
|
||||
$this->str = sprintf("Level $max $skill ".$string,$min,$min);
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 25) {
|
||||
@@ -319,17 +341,28 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 27) {
|
||||
$this->str = "+$v to [skill] ([class] Only)";
|
||||
$sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'";
|
||||
$res = PDO_FetchRow($sql);
|
||||
$this->str = "+$par to a Random Skill";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 28) {
|
||||
$sql = "SELECT `skill` FROM `skills` WHERE `skilldesc`='$par'";
|
||||
$skill = PDO_FetchOne($sql);
|
||||
|
||||
|
||||
|
||||
$this->str = "+$min to $skill ";
|
||||
}
|
||||
} else if ($params['descval'] == 0) {
|
||||
}
|
||||
/*
|
||||
* Descval 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/ else if ($params['descval'] == 0) {
|
||||
if ($params['descfunc'] == 1) {
|
||||
$this->str = "$s1";
|
||||
}
|
||||
@@ -432,13 +465,24 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 27) {
|
||||
$this->str = "to [skill] ([class] Only)";
|
||||
$sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'";
|
||||
$res = PDO_FetchRow($sql);
|
||||
$this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 28) {
|
||||
$this->str = "to [skill] ";
|
||||
}
|
||||
} else if ($params['descval'] == 2) {
|
||||
}
|
||||
/*
|
||||
* Descval 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/ else if ($params['descval'] == 2) {
|
||||
if ($params['descfunc'] == 1) {
|
||||
$this->str = "$s1 +$v";
|
||||
}
|
||||
@@ -491,7 +535,16 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 14) {
|
||||
$this->str = "to [skilltab] Skill Levels ([class] Only) +$v ";
|
||||
|
||||
$sql = "SELECT class
|
||||
FROM `charstats`
|
||||
WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab2`='{$this->skilltabs[$par]}' OR
|
||||
`StrSkillTab3`='{$this->skilltabs[$par]}'";
|
||||
|
||||
$class = PDO_FetchOne($sql);
|
||||
|
||||
$this->str = "{$this->skilltabsDescClean[$par]['String']} ($class Only) +$max";
|
||||
}
|
||||
if ($params['descfunc'] == 15) {
|
||||
$this->str = "[chance]% to case [slvl] [skill] on [event]";
|
||||
@@ -541,7 +594,9 @@ WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 27) {
|
||||
$this->str = "+$v to [skill] ([class] Only)";
|
||||
$sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'";
|
||||
$res = PDO_FetchRow($sql);
|
||||
$this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)";
|
||||
}
|
||||
|
||||
if ($params['descfunc'] == 28) {
|
||||
|
@@ -1,43 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
|
||||
Copyright (C) 2021 Hash Borgir
|
||||
Copyright (C) 2021 Hash Borgir
|
||||
|
||||
This file is part of D2Modder
|
||||
This file is part of D2Modder
|
||||
|
||||
Redistribution and use in source and binary forms, with
|
||||
or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
Redistribution and use in source and binary forms, with
|
||||
or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* This software must not be used for commercial purposes
|
||||
* without my consent. Any sales or commercial use are prohibited
|
||||
* without my express knowledge and consent.
|
||||
* This software must not be used for commercial purposes
|
||||
* without my consent. Any sales or commercial use are prohibited
|
||||
* without my express knowledge and consent.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY!
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY!
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
?>
|
||||
@@ -56,7 +56,7 @@
|
||||
<img src="/img/Diablo2.png" style="float:right"><h1 syle="display:inline; font-weight: 900;"><?php echo $title . " " . $version; ?><span style="font-family: Lato !important; font-size: 14px;"> <?php echo " By" . $author ?></span></h1>
|
||||
<div style="font-family: Lato !important; text-align:right; color: tomato">
|
||||
Active Mod: <span style="color: purple"><?php echo $_SESSION['modname'] ?></span>
|
||||
<span style="color: #8888FF">[<?php echo $_SESSION['path'] ?>]</span>
|
||||
<span style="color: #8888FF">[<?php echo $_SESSION['path'] ?>]</span>
|
||||
</div>
|
||||
<ul class="nav nav-tabs" id="Tabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
@@ -67,7 +67,10 @@
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Gem-tab" data-toggle="tab" href="#Gem" role="tab" aria-controls="Set" aria-selected="false">Gems</a>
|
||||
</li>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Debug-tab" data-toggle="tab" href="#Debug" role="tab" aria-controls="Set" aria-selected="false">Debug</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,6 +83,9 @@
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Gem" role="tabpanel" aria-labelledby="Gem-tab">
|
||||
<?php require_once 'tabs/Gems.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Debug" role="tabpanel" aria-labelledby="Debug-tab">
|
||||
<?php require_once 'tabs/Debug.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
6
src/tabs/Debug.php
Normal file
6
src/tabs/Debug.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2>Debug Output</h2>
|
||||
<pre class="debug"></pre>
|
||||
</div>
|
||||
</div>
|
@@ -1,35 +1,7 @@
|
||||
<div style="height: 40px; margin: 40px 10px;"><h2>Unique Item Maker</h2></div>
|
||||
<div class="row">
|
||||
<div class="offset-4 col"><h3 style="font-family:fixed; font-size:80%;">Preview</h3>
|
||||
<div class="" style="height: 117px; background: url(/img/items/bg.png) no-repeat">
|
||||
<img style="" class="item" src="">
|
||||
<div class="item_desc">
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row" style="margin-bottom:40px;">
|
||||
<div class="col" style="">
|
||||
<p>Search for Item</p>
|
||||
<input style="border: 1px solid #999; padding: 10px;width: 440px;" id="search" type="text custom-control-inline" placeholder="Search item" name="search">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="">
|
||||
<div class="col-5">
|
||||
<select style="height: 260px;padding:10px;margin-bottom: 20px;" name="uniqueitems" class="custom-select uniqueitems-select" multiple>
|
||||
<!--<option value=""></option>-->
|
||||
<?php foreach ($uniqueitems as $u) { ?>
|
||||
<option value="<?php echo $u['index'] ?>"><?php echo $u['index'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-7 sortby">
|
||||
<p style="font-family:Exocet;">Sort By: </p>
|
||||
<div class="col sortby">
|
||||
<p style="">Sort By: </p>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input name="sort" id="sort_0" type="radio" class="custom-control-input" value="lvl">
|
||||
<label for="sort_0" class="custom-control-label">Level</label>
|
||||
@@ -47,7 +19,7 @@
|
||||
<label for="sort_3" class="custom-control-label">Item Code</label>
|
||||
</div>
|
||||
<hr>
|
||||
<p style="font-family:Exocet;">Filter By: </p>
|
||||
<p style="">Filter By: </p>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input name="view" id="view_0" type="radio" class="custom-control-input" value="rin">
|
||||
<label for="view_0" class="custom-control-label">Rings</label>
|
||||
@@ -72,6 +44,45 @@
|
||||
<input name="view" id="view_5" type="radio" class="custom-control-input" value="char">
|
||||
<label for="view_5" class="custom-control-label">Charms</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div>
|
||||
<div class="center item_desc" style="">
|
||||
|
||||
<div style="height: 116px;background: url(/img/items/bg.png) center top no-repeat;">
|
||||
<a href="" target="_blank" class="item_debug_link">
|
||||
<img style="" class="item img-fluid" src="">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="item_stats" style="background: #222; margin: 20px; padding: 20px;">
|
||||
<div class=""><p>ITEM PREVIEW</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<button style="margin: 20px;" class="btn btn-outline-warning btnDebug">Debug Info</button>
|
||||
<pre class="debug_preview" style="display:none; background: #eee; height: 420px;width: 1123px;"></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom:40px;">
|
||||
<div class="col" style="">
|
||||
<p>Search for Item</p>
|
||||
<input style="border: 1px solid #999; padding: 10px;width: 440px;" id="search" type="text custom-control-inline" placeholder="Search item" name="search">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="">
|
||||
<div class="col-5">
|
||||
<select style="height: 160px;padding:10px;margin-bottom: 20px;" name="uniqueitems" class="custom-select uniqueitems-select" multiple>
|
||||
<!--<option value=""></option>-->
|
||||
<?php foreach ($uniqueitems as $u) { ?>
|
||||
<option value="<?php echo $u['index'] ?>"><?php echo $u['index'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<form action="/index.php" method="post">
|
||||
|
Reference in New Issue
Block a user