mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
Cube documenter working half way
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
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
|
||||
@@ -18,12 +18,12 @@
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* This software must not be used for commercial purposes
|
||||
* 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!
|
||||
but WITHOUT ANY WARRANTY!
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
@@ -48,6 +48,7 @@ class D2Files {
|
||||
public function __construct() {
|
||||
$filesToIgnore = [
|
||||
"aiparms.txt",
|
||||
"shrines.txt",
|
||||
"cubemain.txt"
|
||||
];
|
||||
$glob = glob($_SESSION['path'].'*.txt');
|
||||
|
@@ -3,10 +3,23 @@
|
||||
class D2ItemData {
|
||||
|
||||
public function uniqueItems($index, $doc = FALSE) {
|
||||
// This is where we get props for each item
|
||||
$sql = "SELECT * FROM `uniqueitems` WHERE `enabled`='1' AND `index`=\"$index\"";
|
||||
|
||||
$res = array_filter(PDO_FetchRow($sql));
|
||||
|
||||
|
||||
$res = (PDO_FetchRow($sql));
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Grag invfile code all 3 item tables wherever it is
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (empty($res['invfile'])) {
|
||||
|
||||
@@ -44,7 +57,16 @@ class D2ItemData {
|
||||
}
|
||||
|
||||
// var_dump($return);
|
||||
// for all props for this unique item, get ISC strings
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* for all props for this unique item, get ISC strings
|
||||
|
||||
*/
|
||||
|
||||
$props = array_filter([
|
||||
"Prop1" => array_filter(
|
||||
@@ -80,6 +102,13 @@ class D2ItemData {
|
||||
]);
|
||||
|
||||
// need par, min, max value for each prop
|
||||
//
|
||||
//
|
||||
// ( Also need func1 and val1 for each prop )
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// for each prop, get stat
|
||||
$counter = 1;
|
||||
foreach ($props as $key => $val) {
|
||||
@@ -87,7 +116,7 @@ class D2ItemData {
|
||||
// for each propr, get all 7 stats in ISC
|
||||
$sql = "SELECT stat1,stat2,stat3,stat4,stat5,stat6,stat7 FROM `properties` WHERE `code` = '{$val['prop' . $counter]}'";
|
||||
$props[$key]['stat'] = PDO_FetchRow($sql);
|
||||
|
||||
|
||||
if (!empty($props[$key]['stat'])){
|
||||
$props[$key]['stat'] = array_filter($props[$key]['stat']);
|
||||
}
|
||||
@@ -107,6 +136,12 @@ class D2ItemData {
|
||||
|
||||
$counter = 1;
|
||||
foreach ($props as $k => $v) { // for each property Prop1 Prop2
|
||||
|
||||
|
||||
// $sql = "SELECT val$counter,func$counter FROM `properties` WHERE `code`=\"{$return['prop' . $counter]}\"";
|
||||
// $funcval = PDO_FetchRow($sql);
|
||||
//
|
||||
// var_dump($funcval);
|
||||
$params = [
|
||||
'string1' => $v['desc']['string1'],
|
||||
'string2' => $v['desc']['string2'],
|
||||
@@ -116,12 +151,14 @@ class D2ItemData {
|
||||
"par" => $return['par' . $counter],
|
||||
"min" => $return['min' . $counter],
|
||||
"max" => $return['max' . $counter],
|
||||
// 'item' => $return
|
||||
// "val1" => $funcval['val1'],
|
||||
// "func1" => $funcval['func1']
|
||||
// 'item' => $return
|
||||
];
|
||||
|
||||
/*
|
||||
* getDesc should process string1, not file guide copy pasta
|
||||
*
|
||||
*
|
||||
*/
|
||||
if (!empty($v['desc'])) {
|
||||
require_once 'D2ItemDesc.php';
|
||||
@@ -148,7 +185,7 @@ class D2ItemData {
|
||||
}
|
||||
|
||||
$return['baseItemInfo'] = $baseItemInfo;
|
||||
|
||||
|
||||
if(!empty($baseItemInfo)){
|
||||
$return['baseItemInfo'] = array_filter($baseItemInfo);
|
||||
}
|
||||
@@ -159,20 +196,20 @@ class D2ItemData {
|
||||
} else {
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getIscStrings($iscStat) {
|
||||
$sql = "
|
||||
SELECT
|
||||
SELECT
|
||||
(
|
||||
SELECT String
|
||||
FROM itemstatcost as i
|
||||
LEFT JOIN strings AS `s` ON `i`.descstrpos = `s`.`Key`
|
||||
WHERE `Stat` = '$iscStat'
|
||||
)
|
||||
)
|
||||
AS string1,
|
||||
(
|
||||
SELECT String
|
||||
@@ -186,27 +223,27 @@ AS string2,
|
||||
FROM itemstatcost as i
|
||||
LEFT JOIN strings AS `s` ON `i`.descstrpos = `s`.`Key`
|
||||
WHERE `Stat` = '$iscStat'
|
||||
)
|
||||
)
|
||||
AS descfunc,
|
||||
(
|
||||
SELECT descval
|
||||
FROM itemstatcost as i
|
||||
LEFT JOIN strings AS `s` ON `i`.descstrpos = `s`.`Key`
|
||||
WHERE `Stat` = '$iscStat'
|
||||
)
|
||||
AS descval
|
||||
)
|
||||
AS descval
|
||||
";
|
||||
|
||||
return PDO_FetchRow($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function genDoc($itemData){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function genDoc($itemData){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* This software must not be used for commercial purposes
|
||||
* 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.
|
||||
|
||||
@@ -81,8 +81,8 @@ class D2ItemDesc {
|
||||
|
||||
DescVal: Controls whenever and if so in what way the stat value is shown,
|
||||
|
||||
* 0 = doesn't show the value of the stat,
|
||||
* 1 = shows the value of the stat infront of the description,
|
||||
* 0 = doesn't show the value of the stat,
|
||||
* 1 = shows the value of the stat infront of the description,
|
||||
* 2 = shows the value of the stat after the description.
|
||||
|
||||
DescStrPos: The string used for the description when the stat value is positive.
|
||||
@@ -90,13 +90,13 @@ class D2ItemDesc {
|
||||
DescStrNeg: The string used for the description when the stat value is negative.
|
||||
|
||||
DescStr2: An additional string used by some DescFuncs, usually used as a suffix or for aditional info (such as per character level etc).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* DATA SAMPLE
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
array (size=174)
|
||||
'item_absorbcold' =>
|
||||
array (size=6)
|
||||
@@ -130,15 +130,15 @@ class D2ItemDesc {
|
||||
'descval' => string '1' (length=1)
|
||||
'descstrpos' => string 'ModStr5h' (length=8)
|
||||
'String' => string 'Fire Absorb' (length=11)
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
public $str = '';
|
||||
// takes value, param.
|
||||
// value == Value to show on this stat
|
||||
//descfunc 14
|
||||
//descfunc 14
|
||||
|
||||
public $skilltabsDesc;
|
||||
public $skilltabsDescClean;
|
||||
@@ -181,12 +181,90 @@ class D2ItemDesc {
|
||||
"dru" => "Druid",
|
||||
"ass" => "Assassin"
|
||||
];
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Prepare values for descfunc
|
||||
These are prop funcs from properties.txt
|
||||
|
||||
val1 to val7: Parameter to the property function, if the function can
|
||||
use it (see class skills properties).
|
||||
|
||||
func1 to func7: Function used to assign a value to a property
|
||||
|
||||
* min: Description of the min value
|
||||
|
||||
* max: Description of the max value
|
||||
|
||||
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
*
|
||||
*
|
||||
APPENDIX: Functions of Properties.txt
|
||||
|
||||
Here are some functions used by the properties.txt to link
|
||||
param/min/max value to the actual bonus of the properties.
|
||||
*
|
||||
*
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
||||
|
||||
1 - Applies a value to a stat, can use SetX parameter.
|
||||
2 - defensive function only, similar to 1 ???
|
||||
3 - Apply the same min-max range as used in the previous function block
|
||||
(see res-all).
|
||||
|
||||
4 - not used ???
|
||||
5 - Dmg-min related ???
|
||||
6 - Dmg-max related ???
|
||||
7 - Dmg% related ???
|
||||
8 - ??? use for speed properties (ias, fcr, etc ...)
|
||||
9 - Apply the same param and value in min-max range, as used in the
|
||||
previous function block.
|
||||
|
||||
10 - skilltab skill group ???
|
||||
11 - event-based skills ???
|
||||
12 - random selection of parameters for parameter-based stat ???
|
||||
13 - durability-related ???
|
||||
14 - inventory positions on item ??? (related to socket)
|
||||
15 - use min field only
|
||||
16 - use max field only
|
||||
17 - use param field only
|
||||
18 - Related to /time properties.
|
||||
19 - Related to charged item.
|
||||
20 - Simple boolean stuff. Use by indestruct.
|
||||
21 - Add to group of skills, group determined by stat ID, uses ValX parameter.
|
||||
22 - Individual skill, using param for skill ID, random between min-max.
|
||||
23 - ethereal
|
||||
24 - property applied to character or target monster ???
|
||||
25--32 can be used in custom code. Check plugin documentation for syntax.
|
||||
|
||||
*
|
||||
* @prep
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public function prep($par, $min, $max) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @getDesc
|
||||
*
|
||||
@return string
|
||||
*
|
||||
*
|
||||
@return string
|
||||
*
|
||||
*
|
||||
* probably non real need to code this function.
|
||||
Just put this in getDesc()
|
||||
|
||||
if par
|
||||
* use par
|
||||
* else
|
||||
* use min
|
||||
|
||||
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
@@ -194,12 +272,18 @@ class D2ItemDesc {
|
||||
if (empty($params))
|
||||
return false;
|
||||
|
||||
//ddump($params);
|
||||
|
||||
$s1 = $params['string1'];
|
||||
$s2 = $params['string2'];
|
||||
$prop = $params['prop'];
|
||||
$par = $params['par'];
|
||||
$min = (int) $params['min'];
|
||||
$v = $min;
|
||||
$v = $par;
|
||||
|
||||
if (empty($par)) {
|
||||
$v = $min;
|
||||
}
|
||||
|
||||
$max = (int) $params['max'];
|
||||
|
||||
@@ -216,13 +300,13 @@ class D2ItemDesc {
|
||||
|
||||
/*
|
||||
* Descval 1
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* $format = 'The %s contains %d monkeys';
|
||||
echo sprintf($format, $num, $location);
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($params['descval'] == 1 || $params['descval'] == '') {
|
||||
|
||||
@@ -302,6 +386,8 @@ class D2ItemDesc {
|
||||
|
||||
if ($params['descfunc'] == 14) {
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT class
|
||||
FROM `charstats`
|
||||
WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR
|
||||
@@ -310,9 +396,17 @@ class D2ItemDesc {
|
||||
|
||||
$class = PDO_FetchOne($sql);
|
||||
|
||||
//ddump($class);
|
||||
|
||||
$s1 = $this->skilltabsDesc[$par]['String'];
|
||||
|
||||
//ddump($s1);
|
||||
|
||||
$this->str = sprintf($s1, $min);
|
||||
|
||||
if (!isset($par)) {
|
||||
$this->str = "Par is not set.";
|
||||
}
|
||||
}
|
||||
if ($params['descfunc'] == 15) {
|
||||
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
|
||||
@@ -390,13 +484,13 @@ class D2ItemDesc {
|
||||
}
|
||||
/*
|
||||
* Descval 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/ else if ($params['descval'] == 0) {
|
||||
if ($params['descfunc'] == 1) {
|
||||
$this->str = "$s1";
|
||||
@@ -511,12 +605,12 @@ class D2ItemDesc {
|
||||
}
|
||||
/*
|
||||
* Descval 2
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/ else if ($params['descval'] == 2) {
|
||||
if ($params['descfunc'] == 1) {
|
||||
$this->str = "$s1 +$v";
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<ul>
|
||||
<li class="itemindex statindex"></li>
|
||||
<li class="itemtype stattype"></li>
|
||||
<li class="itemlvl statlvlreq"></li
|
||||
<li class="itemlvl statlvlreq"></li>
|
||||
<li class="itemlvlreq statlvlreq"></li>
|
||||
<li class="itemcode code" style="color:#D49E43;"></li>
|
||||
<li class="itemstreq statlvlreq"></li>
|
||||
@@ -333,7 +333,7 @@
|
||||
</span><span class="form-text">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 props">
|
||||
<div class="form-group row props props-container">
|
||||
<?php
|
||||
$html = '';
|
||||
|
||||
|
Reference in New Issue
Block a user