d2tools/scratchSpaceFile.php
2022-05-05 23:34:52 -06:00

193 lines
4.2 KiB
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
set_time_limit(-1);
ini_set('max_input_time', '-1');
ini_set('max_execution_time', '0');
session_start();
ob_start();
require_once './config.php';
require_once './_pdo.php';
require_once "./src/D2Functions.php";
require_once './src/D2ItemData.php';
require_once './src/D2ItemDesc.php';
require_once './src/D2DocGenerator.php';
// define('DB_FILE', $_SESSION['modname'] . ".db");
// PDO_Connect("sqlite:" . DB_FILE);
$filePath = "D:\Diablo II\MODS\ironman-dev\save\Sorc.d2s";
$fp = fopen($filePath, "rb");
$offsets = [
0 => 4,
4 => 4,
8 => 4,
12 => 4,
16 => 4,
20 => 16,
36 => 1,
37 => 1,
38 => 2,
40 => 1,
41 => 2,
43 => 1,
44 => 4,
48 => 4,
52 => 4,
56 => 64,
120 => 4,
124 => 4,
128 => 4,
132 => 4,
136 => 32,
168 => 3,
171 => 4,
175 => 2,
177 => 2,
179 => 4,
183 => 2,
185 => 2,
187 => 4,
191 => 144,
335 => 298,
633 => 81,
714 => 51,
];
foreach ($offsets as $k => $v){
fseek($fp, $k);
$data[$k] = fread($fp, $v);
}
echo "<pre>";
print_r($data);
//$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['item'];
//
//
// $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 . "_set<br>";
//};