JSFiddle - React, Tailwind, and code Playground

by Yurii Predborskyi

JavaScript

const string = 'inventory_list1="160|100|6|26|1|0|5|3|0|16672|1|2|114564375.82|0|0|0|0|0|0|0|s0|0|0|"';
const stringWithDescriptions = 'inventory_list[index:1]="[item level:160]|[quality:100]|[rarity:6]|[item id:26]|[upgrade level:1]|[weapon type:0]|[slot ID:5]|[number of sockets:3]|[enchantments:0]|[some ID:16672]|[unknown value 1:1]|[unknown value 2:2]|[some other data: 114564375.82]|0|0|0|0|0|0|0|s[socket slots:0|0|0]|"';

// settings
const slotId = 8; // [0 - helmet, 1 - armor, 2 - boots, 3 - weapon, 4 - gloves, 5 - amulet, 6 - charm, 7 - shield, 8 - ring, 9 - belt, 10 - bottle]
const weaponType = 0; // [0 - not used, 1 - melee, 2 - magic, 3 - bow, 4 - claws, 5 - javelin, 6 - gun, 7 - chainsaw, 8 - flask, 9 - lance]
const enchantmentId = 0; // additional enchantment type? extra skill type?
const enchantmentLevel = 0;
const itemLevel = 160; // item level, doesn't seem to matter for satanics
const quality = 110; // item quality, maxes out at 100, probably
const rarity = 6; // satanics are 6, angelic keys are 7
const upgradeLevel = 10; // upgrade level for normal items is always 1, for satantics it's between 1 and 10
const numberOfSockets = 6; // number of sockets, max number depends on item type, max ranges from 1? to 6

// parameters
const maxItems = 100;
const startInventoryIndex = 3;
const startItemId = 0;

// this should produce (in the logs) one item for inventory list

function write(text) {
	document.write(text+'<br>');
}

write('original string');
write(string);
write('modified templates');
for (let i = 0; i < maxItems; i++) {
  const socketedItemIds = Array(numberOfSockets).fill(0); // create array of 0s to fill sockets with empty values
	const socketsString = numberOfSockets ? 's' + socketedItemIds.join('|') + '|' : '';
  const template = `inventory_list${startInventoryIndex + i}="${itemLevel}|${quality}|${rarity}|${startItemId +...