Processing custom strings for some properties, like skill-rand. https://d2mods.info/forum/kb/viewarticle?a=345

This commit is contained in:
Hash Borgir 2022-04-27 16:12:51 -06:00
parent 9ff7a97c9d
commit c40f67545f
4 changed files with 203 additions and 14 deletions

View File

@ -129,3 +129,5 @@ showkills
iforge
killcounter
soulcounter
skill-rand
aura-rand

94
ironman-dev.sqbpro Normal file
View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="D:/Documents/D2Modder/D2Modder/ironman-dev.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="3"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="58404"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><current_table name="4,10:main_bufficons"/><default_encoding codec=""/><browse_table_settings/></tab_browse><tab_sql><sql name="1.sql">WITH cte_item_codes(code,flippyfile) AS (
SELECT code,flippyfile from armor WHERE code != ''
UNION
SELECT code,flippyfile from misc WHERE code != ''
UNION
SELECT code,flippyfile from weapons WHERE code != ''
UNION
SELECT normcode,flippyfile from armor WHERE code != ''
UNION
SELECT normcode,flippyfile from weapons WHERE code != ''
UNION
SELECT ubercode,flippyfile from armor WHERE code != ''
UNION
SELECT ubercode,flippyfile from weapons WHERE code != ''
UNION
SELECT ultracode,flippyfile from armor WHERE code != ''
UNION
SELECT ultracode,flippyfile from weapons WHERE code != ''
)
--SELECT u.code,c.flippyfile
--FROM uniqueitems as u
--JOIN cte_item_codes as c
--ON u.code = c.code
SELECT s.item,c.flippyfile
FROM setitems as s
JOIN cte_item_codes as c
ON s.item = c.code
WHERE s.item != '' AND c.code != ''</sql><sql name="SQL 2">select count(*) from setitems</sql><sql name="SQL 3">WITH cte_item_codes(code,flippyfile) AS (
SELECT code,flippyfile from armor WHERE code != ''
UNION
SELECT code,flippyfile from misc WHERE code != ''
UNION
SELECT code,flippyfile from weapons WHERE code != ''
UNION
SELECT normcode,flippyfile from armor WHERE code != ''
UNION
SELECT normcode,flippyfile from weapons WHERE code != ''
UNION
SELECT ubercode,flippyfile from armor WHERE code != ''
UNION
SELECT ubercode,flippyfile from weapons WHERE code != ''
UNION
SELECT ultracode,flippyfile from armor WHERE code != ''
UNION
SELECT ultracode,flippyfile from weapons WHERE code != ''
)
SELECT u.code,c.flippyfile
FROM uniqueitems as u
JOIN cte_item_codes as c
ON u.code = c.code
--SELECT s.item,c.flippyfile
--FROM setitems as s
--JOIN cte_item_codes as c
--ON s.item = c.code
WHERE
u.code &lt;&gt; ''
AND c.code &lt;&gt; '';</sql><sql name="SQL 4">WITH cte_item_codes(code,flippyfile) AS (
SELECT code,flippyfile from armor
UNION
SELECT code,flippyfile from misc
UNION
SELECT code,flippyfile from weapons
UNION
SELECT normcode,flippyfile from armor
UNION
SELECT normcode,flippyfile from weapons
UNION
SELECT ubercode,flippyfile from armor
UNION
SELECT ubercode,flippyfile from weapons
UNION
SELECT ultracode,flippyfile from armor
UNION
SELECT ultracode,flippyfile from weapons
)
select * from cte_item_codes</sql><sql name="SQL 5">SELECT a.flippyfile, m.flippyfile, w.flippyfile
FROM armor AS a,
misc AS m,
weapons AS w
WHERE a.code = 'axe'
OR a.normcode = 'axe'
OR a.ubercode = 'axe'
OR a.ultracode = 'axe'
OR m.code = 'axe'
OR w.code = 'axe'
OR w.ultracode = 'axe'
OR w.normcode = 'axe'
OR w.ubercode = 'axe'</sql><sql name="SQL 6">select item from setitems</sql><current_tab id="5"/></tab_sql></sqlb_project>

View File

@ -96,9 +96,45 @@ class D2ItemData {
// for each propr, get all 7 stats in ISC
// for now only get stat1, and for else, use dgrp
$sql = "SELECT stat1 FROM properties WHERE code = ?";
// prop funcs
/*
* 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.
*
*/
$sql = "SELECT func1,stat1 FROM properties WHERE code = ?";
$props[$key]['stat'] = PDO_FetchRow($sql, [$val['prop' . $counter]]);
// if not empty, filter props key stat
if (!empty($props[$key]['stat'])) {
$props[$key]['stat'] = array_filter($props[$key]['stat']);
}
@ -109,7 +145,6 @@ class D2ItemData {
$counter = 1;
//each stat now goes into getIscStrings
foreach ($props as $k => $v) {
//ddump($v);
$props[$k]['desc'] = $this->getIscStrings($v['prop' . $counter]);
$counter++;
}
@ -137,10 +172,15 @@ class D2ItemData {
* getDesc should process string1, not file guide copy pasta
*
*/
if (!empty($v['desc'])) {
require_once 'D2ItemDesc.php';
if ( (!empty($v['desc'])) ) {
require_once 'D2ItemDesc.php';
$idesc = new D2ItemDesc();
$props[$k]['string'][] = ($idesc->getDesc($params));
if ($v['stat']['func1'] == '12'){
$props[$k]['string'] = "+{$params['par']} to a Random Skill";
}
ddump($props[$k]['string']);
}
$counter++;
}

View File

@ -18,12 +18,67 @@ define('DB_FILE', $_SESSION['modname'] . ".db");
PDO_Connect("sqlite:" . DB_FILE);
$sql = "SELECT code FROM uniqueitems";
//$sql = "SELECT code FROM uniqueitems";
//$res = PDO_FetchAll($sql);
//
//
//foreach ($res as $code){
// $c = $code['code'];
//
// $sql = "SELECT flippyfile FROM misc WHERE code = '$c'";
// $ret = PDO_FetchOne($sql);
//
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM armor WHERE code = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM armor WHERE normcode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM armor WHERE ubercode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM armor WHERE ultracode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
//
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM weapons WHERE code = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM weapons WHERE normcode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM weapons WHERE ubercode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
// if(empty($ret)){
// $sql = "SELECT flippyfile FROM weapons WHERE ultracode = '$c'";
// $ret = PDO_FetchOne($sql);
// }
//
// $return[] = $ret;
//
// echo $ret . "_uni<br>";
//}
//dump($return)
//
//
$sql = "SELECT item FROM setitems";
$res = PDO_FetchAll($sql);
foreach ($res as $code){
$c = $code['code'];
$c = $code['item'];
$sql = "SELECT flippyfile FROM misc WHERE code = '$c'";
$ret = PDO_FetchOne($sql);
@ -64,7 +119,5 @@ foreach ($res as $code){
$return[] = $ret;
echo $ret . "_uni<br>";
}
//dump($return);
echo $ret . "_set<br>";
};