switchmods fixed session vars, saved to db in d2config class. Need to test d2s editor with modifyBit() function. need to fix app.js uniqueitems editor required fields on misc/weapons/armor

This commit is contained in:
Hash Borgir
2022-05-24 00:16:01 -06:00
parent 16174f5efd
commit 6b4b0c564e
22 changed files with 405 additions and 10360 deletions

View File

@@ -56,7 +56,7 @@ if (!empty($_POST)) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$path = rtrim($_POST['path'], "\\");
$path = str_replace("\\", "\\\\", $path);
$modpath = $path;
$savePath = $path . '\\\\save\\\\';
$tbl = $path.'\\\\data\\\\local\\\\lng\\\\eng\\\\';
@@ -69,6 +69,8 @@ if (!empty($_POST)) {
PDO_Connect("sqlite:../D2Modder.db");
$sql = "CREATE TABLE IF NOT EXISTS D2Modder (
modname VARCHAR(255),
modpath VARCHAR(255),
savepath VARCHAR(255),
path VARCHAR(255),
tbl VARCHAR(255),
lastused INT,
@@ -85,15 +87,15 @@ ERROR: INVALID PATH</h1></center>';
// set this mod to active mod in session
$_SESSION['path'] = $path;
$_SESSION['tbl'] = $tbl;
$_SESSION['savePath'] = $savePath;
$_SESSION['savepath'] = $savePath;
// Don't yell at me, security is the least of my considerations atm
// check modname in db
$sql = "SELECT * FROM D2Modder WHERE modname=?";
$res = PDO_FetchAll($sql, [$modname]);
if (empty($res)) {
$sql = "INSERT INTO D2Modder(`modname`,`path`,`tbl`,`lastused`) VALUES(?, ?, ?, ?)";
PDO_Execute($sql, [$modname, $path, $tbl, $time]);
$sql = "INSERT INTO D2Modder(`modname`,`modpath`,`savepath`,`path`,`tbl`,`lastused`) VALUES(?, ?, ?, ?, ?, ?)";
PDO_Execute($sql, [$modname, $modpath, $savePath, $path, $tbl, $time]);
}
header("Location: /processFiles.php");
}

View File

@@ -65,7 +65,7 @@ class D2Files {
}
public function getSaveFiles() {
$glob = glob($_SESSION['savePath'] . '*.d2s');
$glob = glob($_SESSION['savepath'] . '*.d2s');
foreach ($glob as $g) {

View File

@@ -77,4 +77,9 @@ function strtobits(string $str): string {
function swapEndianness($hex) {
return implode('', array_reverse(str_split($hex, 2)));
}
function modifyBit(int $n, int $p, bool $b){
return ($b ? ($n | (1 << $p)) : ($n & ~(1 << $p)) );
}

View File

@@ -434,10 +434,12 @@ class D2ItemDesc {
}
if ($params['descfunc'] == 16) {
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
$aura = PDO_FetchOne($sql);
if (!$max) {
$this->str = "Level $min $par Aura When Equipped ";
$this->str = "Level $min $aura Aura When Equipped ";
} else {
$this->str = "Level $min to $max $par Aura When Equipped ";
$this->str = "Level $min to $max $aura Aura When Equipped ";
}
}
@@ -570,7 +572,13 @@ class D2ItemDesc {
}
if ($params['descfunc'] == 16) {
$this->str = "Level [sLvl] [skill] Aura When Equipped ";
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
$aura = PDO_FetchOne($sql);
if (!$max) {
$this->str = "Level $min $aura Aura When Equipped ";
} else {
$this->str = "Level $min to $max $aura Aura When Equipped ";
}
}
if ($params['descfunc'] == 17) {

View File

@@ -12,7 +12,7 @@ class D2SaveFile {
$this->sData = new D2SaveFileStructureData();
$filePath = $_SESSION['savePath'] . $file;
$filePath = $_SESSION['savepath'] . $file;
$fp = fopen($filePath, "rb+");
@@ -101,7 +101,7 @@ class D2SaveFile {
$quests = null;
$filePath = $_SESSION['savePath'] . $file;
$filePath = $_SESSION['savepath'] . $file;
$fp = fopen($filePath, "rb+");
foreach ($this->sData->qNorm as $k => $v) {
@@ -143,7 +143,7 @@ class D2SaveFile {
public function getWaypointsData($file) {
$filePath = $_SESSION['savePath'] . $file;
$filePath = $_SESSION['savepath'] . $file;
$fp = fopen($filePath, "rb+");
$wp = null;

View File

@@ -107,7 +107,7 @@
</select>
</div>
</div>
<form action="/index.php" method="post">
<form action="/saveD2ModderEditorData.php" method="post">
<div class="form-group row">
<div class="col-2" style="background: #fec;">
@@ -209,7 +209,7 @@
<div class="col-2" style="background: #bbb;">
<p>Armor</p>
<select class="a-select custom-select code" name="code[]" required="required">
<select class="a-select custom-select code" name="code" required="required">
<option value=""></option>
<?php
foreach ($armor as $a)