mirror of
				https://gitlab.com/hashborgir/d2tools.git
				synced 2025-10-30 16:43:40 -05:00 
			
		
		
		
	item parsing not yet working fully
This commit is contained in:
		| @@ -43,7 +43,7 @@ foreach ($ISCData as $k => $v) { | |||||||
| //$filePath = "D:\Diablo II\MODS\MedianXL2012\save\Test.d2s"; | //$filePath = "D:\Diablo II\MODS\MedianXL2012\save\Test.d2s"; | ||||||
|  |  | ||||||
|  |  | ||||||
| $filePath = "Pest.d2s"; | $filePath = "Sorc.d2s"; | ||||||
| $char = new D2Char($filePath); | $char = new D2Char($filePath); | ||||||
|  |  | ||||||
| //$char->setChar("CharacterStatus", "Died", 0); | //$char->setChar("CharacterStatus", "Died", 0); | ||||||
| @@ -51,8 +51,8 @@ $char = new D2Char($filePath); | |||||||
| //$char->setChar("CharacterStatus", "Expansion", 1); | //$char->setChar("CharacterStatus", "Expansion", 1); | ||||||
| //$char->setChar("LeftmousebuttonskillID", 223); | //$char->setChar("LeftmousebuttonskillID", 223); | ||||||
|  |  | ||||||
| //$char->setAllSkills(1); | $char->setAllSkills(1); | ||||||
| $char->setSkill(4, 99); | //$char->setSkill(3, 20); | ||||||
| //$char->setChar("CharacterClass", "Necromancer"); // 127 | //$char->setChar("CharacterClass", "Necromancer"); // 127 | ||||||
| //$char->setChar("CharacterProgression", 1); // 0 in normal, 1 finished normal, 2 finished nm, 3 finished hell | //$char->setChar("CharacterProgression", 1); // 0 in normal, 1 finished normal, 2 finished nm, 3 finished hell | ||||||
|  |  | ||||||
| @@ -88,5 +88,5 @@ unset($char); // destroy $char so we can read it again after writing to it to ge | |||||||
|  |  | ||||||
| $char = new D2Char($filePath); | $char = new D2Char($filePath); | ||||||
|  |  | ||||||
| var_dump($char->cData); | var_dump($char->cData['items']); | ||||||
| //var_dump($char->cData['stats']); | //var_dump($char->cData['stats']); | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								img/items/1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								img/items/1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 228 B | 
| @@ -135,6 +135,8 @@ class D2Item { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|          |          | ||||||
|  |         //var_dump($b->getOffset()); | ||||||
|  |  | ||||||
|         //  |         //  | ||||||
|         { |         { | ||||||
|             // if 151 is 1, but 152 is 0, then we have read 152/153/154 already, so we should be at 155 |             // if 151 is 1, but 152 is 0, then we have read 152/153/154 already, so we should be at 155 | ||||||
| @@ -178,19 +180,29 @@ class D2Item { | |||||||
|                 case D2ItemQuality::MAGIC: |                 case D2ItemQuality::MAGIC: | ||||||
|                     // read 11 bits, prefix. |                     // read 11 bits, prefix. | ||||||
|                     // if no prefix, then next 11 bits will be suffix |                     // if no prefix, then next 11 bits will be suffix | ||||||
|                     $this->iData['$magic_prefix'] = bindec($b->readr(11)); |                     $this->iData['magic_prefix'] = bindec($b->readr(11)); | ||||||
|                     $this->iData['magic_suffix'] = bindec($b->readr(11)); |                     $this->iData['magic_suffix'] = bindec($b->readr(11)); | ||||||
|                     break; |                     break; | ||||||
|                 case D2ItemQuality::SET: |                 case D2ItemQuality::SET: | ||||||
|                     // Set items have a 12-bit field containing the ID of the set.  (Not the set member, but the whole set.)  The set member is identified by cross-referencing the item type with the set ID.  Also note that set items have an extra field following the item-specific data. |                     // Set items have a 12-bit field containing the ID of the set.  (Not the set member, but the whole set.)  The set member is identified by cross-referencing the item type with the set ID.  Also note that set items have an extra field following the item-specific data. | ||||||
|                     // Set identifier; i.e., all items which are part of the set will have the same value in this field. |                     // Set identifier; i.e., all items which are part of the set will have the same value in this field. | ||||||
|                     $set_item = bindec($b->readr(12)); |                     //var_dump($b->getOffset()); | ||||||
|  |                     $setid = bindec($b->readr(12)); | ||||||
|  |                     //var_dump($setid); | ||||||
|  |                     $sql = "SELECT ROWID,* from sets WHERE ROWID=$setid"; | ||||||
|  |                     $res = PDO_FetchRow($sql); | ||||||
|  |                      | ||||||
|  |                     //ddump($res); | ||||||
|  |                      | ||||||
|  |                     $this->iData["setname"] = $res; | ||||||
|  |                      | ||||||
|                     break; |                     break; | ||||||
|                 case D2ItemQuality::RARE: |                 case D2ItemQuality::RARE: | ||||||
|                     $this->iData['iquality'] = "Rare"; |                     $this->iData['iquality'] = "Rare"; | ||||||
|                     break; |                     break; | ||||||
|                 case D2ItemQuality::UNIQUE: |                 case D2ItemQuality::UNIQUE: | ||||||
|                     $this->iData['iquality'] = "Unique"; |                     //Unique items have an additional 12 bit field, which in most cases is the unique item ID.  The few exceptions are certain quest items (e.g., the Horadric Malus). | ||||||
|  |                     $uni_item = bindec($b->readr(12)); | ||||||
|                     break; |                     break; | ||||||
|                 case D2ItemQuality::CRAFTED: |                 case D2ItemQuality::CRAFTED: | ||||||
|                     $this->iData['iquality'] = "Crafted"; |                     $this->iData['iquality'] = "Crafted"; | ||||||
| @@ -304,7 +316,9 @@ class D2Item { | |||||||
|             $sql = "SELECT * from weapons WHERE code = '{$this->iData['code']}'"; |             $sql = "SELECT * from weapons WHERE code = '{$this->iData['code']}'"; | ||||||
|             $res = PDO_FetchRow($sql); |             $res = PDO_FetchRow($sql); | ||||||
|         } |         } | ||||||
|         //$this->iData['txt'] = ($res); |          | ||||||
|  |         // set txt data array | ||||||
|  |         $this->iData['txt'] = ($res); | ||||||
|  |  | ||||||
|         $sql = " |         $sql = " | ||||||
|             SELECT code, namestr |             SELECT code, namestr | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user