2022-06-21 01:27:08 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'D2BitReader.php';
|
|
|
|
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2022-06-21 02:21:28 +00:00
|
|
|
class D2CharItem {
|
2022-06-21 01:27:08 +00:00
|
|
|
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 02:21:28 +00:00
|
|
|
private string $bits;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $basename = ''; //name of the base item
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $item_name = ''; //name string
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $item_rank = ''; //normal/exceptional/elite
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $item_type = ''; //basic type: armor/weapon/misc
|
|
|
|
//flags
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $identified = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $sockets = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $ear = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $starter = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $compact = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $ethereal;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $personalized;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $runeword;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $version;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $runeword_name = '';
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $runes_title = '';
|
|
|
|
//placement
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $location = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $body = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $col = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $row = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $container = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $parent;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $storage;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $bodypart;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $invH = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $invW = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $beltrows = 1;
|
|
|
|
//features
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $item_code = ''; //3 letter code from txt
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $SocketsFilled = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $SocketsNum = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $socketable = false; //gem, rune, jewel
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $fingerprint = '';
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $itemlvl = 0; //item level
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $quality = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $isCharm = false;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $isJewel = false;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $magic_rank = 'Normal'; //normal/magic/rare/crafted/set/unique
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $set_id = 0; //set item id from txt
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $set_item = '';
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $set_name = 0; //set name, if it is set item,
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $personname = '';
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $questdif = -1;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $gold;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $GUID = '';
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $defense = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $mindam = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $maxdam = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $mindam2 = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $maxdam2 = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $mindammi = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $maxdammi = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $MaxDur = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $CurDur = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $reqlvl = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $reqstr = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $reqdex = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $speed = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $throwing = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $stackable = 0;
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $charName = ''; //ear's name
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $gfx; //graphic file name
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $baseTrans = -1; //transform indexes for colour remap base item
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $magicTrans = -1; //transform indexes for colour remap magic item
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $type; //type column from txt
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $spelldesc = ''; //desc for potions
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $ditem; //link to item properties from txt
|
|
|
|
//mods
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $dammult = 100; //damage multiply
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $damminadd = 0; //damage add
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $dammaxadd = 0; //damage add
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $defmult = 100; //defense multiply
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $defadd = 0; //defense multiply
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int[]
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $resist = array(0, 0, 0, 0, 0, 0); //phy, mag, fire, light, cold, poison
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var int[]
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $attributes = array(0, 0, 0, 0); //str, dex, vit, ene
|
|
|
|
|
|
|
|
//arrays
|
|
|
|
|
|
|
|
//socketed items, collected in above function,
|
|
|
|
//because item has only data for itselt, and
|
|
|
|
//gems/runes/jewels are standalone
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $SocketItems = array();
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $properties = array(); //item variable properties
|
2022-07-06 23:41:24 +00:00
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public $propids = array(); //properties ids list
|
|
|
|
|
2022-07-06 23:41:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $bits
|
|
|
|
*/
|
2022-06-21 01:27:08 +00:00
|
|
|
public function __construct(string $bits){
|
2022-06-21 02:21:28 +00:00
|
|
|
if ($bits == '') return false;
|
2022-06-21 01:27:08 +00:00
|
|
|
$this->bits = $bits;
|
|
|
|
|
2022-06-21 02:21:28 +00:00
|
|
|
return $this->parseItem();
|
2022-06-21 01:27:08 +00:00
|
|
|
}
|
2022-07-06 23:41:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-06-21 02:21:28 +00:00
|
|
|
public function parseItem(){
|
|
|
|
|
|
|
|
}
|
2022-06-21 01:27:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|