mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-09-19 01:52:09 +00:00
Item Preview Done. Todo: Stat Rendering
This commit is contained in:
@@ -2,43 +2,43 @@
|
||||
|
||||
/*
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,7 @@ class D2Database {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($data)) {
|
||||
$sql .= "VALUES ";
|
||||
foreach ($data as $d) {
|
||||
@@ -100,9 +100,68 @@ class D2Database {
|
||||
}
|
||||
}
|
||||
$sql = rtrim($sql, ", ");
|
||||
$sql .= ";";
|
||||
|
||||
PDO_Execute($sql);
|
||||
$res = PDO_Execute($sql);
|
||||
}
|
||||
}
|
||||
|
||||
public function writeTbl($data) {
|
||||
$sql = 'CREATE TABLE IF NOT EXISTS `strings` (`Key` VARCHAR(255), `String` VARCHAR(255));';
|
||||
$res = PDO_Execute($sql);
|
||||
|
||||
$sql = "INSERT INTO `strings` (`Key`,`String`) VALUES ";
|
||||
foreach ($data as $k => $v) {
|
||||
$sql .= "(\"$k\",\"$v\"),";
|
||||
}
|
||||
$sql = rtrim($sql, ", ");
|
||||
$sql .= ";";
|
||||
|
||||
$res = PDO_Execute($sql);
|
||||
}
|
||||
|
||||
public function getString($key) {
|
||||
$sql = "SELECT String FROM `strings` WHERE `Key`='$key'";
|
||||
|
||||
$res = PDO_FetchRow($sql);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getIscStrings($iscStat) {
|
||||
$sql = "
|
||||
SELECT
|
||||
(
|
||||
SELECT String
|
||||
FROM itemstatcost as i
|
||||
LEFT JOIN strings AS `s` ON `i`.descstrpos = `s`.`Key`
|
||||
WHERE `Stat` = '$iscStat'
|
||||
)
|
||||
AS string1,
|
||||
(
|
||||
SELECT String
|
||||
FROM itemstatcost as i
|
||||
LEFT JOIN strings AS `s` ON `i`.DescStr2 = `s`.`Key`
|
||||
WHERE `Stat` = '$iscStat'
|
||||
)
|
||||
AS string2,
|
||||
(
|
||||
SELECT descfunc
|
||||
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
|
||||
";
|
||||
|
||||
return PDO_FetchRow($sql);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user