mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-12-11 01:46:03 +00:00
345 lines
5.5 KiB
PHP
345 lines
5.5 KiB
PHP
<?php
|
|
|
|
require_once 'D2BitReader.php';
|
|
|
|
/**
|
|
*
|
|
*/
|
|
class D2CharItem {
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
private string $bits;
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $basename = ''; //name of the base item
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $item_name = ''; //name string
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $item_rank = ''; //normal/exceptional/elite
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $item_type = ''; //basic type: armor/weapon/misc
|
|
//flags
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $identified = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $sockets = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $ear = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $starter = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $compact = 0;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $ethereal;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $personalized;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $runeword;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $version;
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $runeword_name = '';
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $runes_title = '';
|
|
//placement
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $location = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $body = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $col = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $row = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $container = 0;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $parent;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $storage;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $bodypart;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $invH = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $invW = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $beltrows = 1;
|
|
//features
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $item_code = ''; //3 letter code from txt
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $SocketsFilled = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $SocketsNum = 0;
|
|
/**
|
|
* @var bool
|
|
*/
|
|
public $socketable = false; //gem, rune, jewel
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $fingerprint = '';
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $itemlvl = 0; //item level
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $quality = 0;
|
|
/**
|
|
* @var bool
|
|
*/
|
|
public $isCharm = false;
|
|
/**
|
|
* @var bool
|
|
*/
|
|
public $isJewel = false;
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $magic_rank = 'Normal'; //normal/magic/rare/crafted/set/unique
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $set_id = 0; //set item id from txt
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $set_item = '';
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $set_name = 0; //set name, if it is set item,
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $personname = '';
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $questdif = -1;
|
|
/**
|
|
* @var
|
|
*/
|
|
public $gold;
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $GUID = '';
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $defense = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $mindam = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $maxdam = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $mindam2 = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $maxdam2 = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $mindammi = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $maxdammi = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $MaxDur = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $CurDur = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $reqlvl = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $reqstr = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $reqdex = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $speed = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $throwing = 0;
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $stackable = 0;
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $charName = ''; //ear's name
|
|
/**
|
|
* @var
|
|
*/
|
|
public $gfx; //graphic file name
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $baseTrans = -1; //transform indexes for colour remap base item
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $magicTrans = -1; //transform indexes for colour remap magic item
|
|
/**
|
|
* @var
|
|
*/
|
|
public $type; //type column from txt
|
|
/**
|
|
* @var string
|
|
*/
|
|
public $spelldesc = ''; //desc for potions
|
|
/**
|
|
* @var
|
|
*/
|
|
public $ditem; //link to item properties from txt
|
|
//mods
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $dammult = 100; //damage multiply
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $damminadd = 0; //damage add
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $dammaxadd = 0; //damage add
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $defmult = 100; //defense multiply
|
|
/**
|
|
* @var int
|
|
*/
|
|
public $defadd = 0; //defense multiply
|
|
/**
|
|
* @var int[]
|
|
*/
|
|
public $resist = array(0, 0, 0, 0, 0, 0); //phy, mag, fire, light, cold, poison
|
|
/**
|
|
* @var int[]
|
|
*/
|
|
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
|
|
/**
|
|
* @var array
|
|
*/
|
|
public $SocketItems = array();
|
|
/**
|
|
* @var array
|
|
*/
|
|
public $properties = array(); //item variable properties
|
|
/**
|
|
* @var array
|
|
*/
|
|
public $propids = array(); //properties ids list
|
|
|
|
|
|
/**
|
|
* @param string $bits
|
|
*/
|
|
public function __construct(string $bits){
|
|
if ($bits == '') return false;
|
|
$this->bits = $bits;
|
|
|
|
return $this->parseItem();
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function parseItem(){
|
|
|
|
}
|
|
|
|
|
|
}
|