Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Me Display Socketed Jewel Mods Using UserAddon.js & D2BotBlank #3194

Open
thetopfew opened this issue Nov 8, 2023 · 0 comments
Open

Comments

@thetopfew
Copy link

thetopfew commented Nov 8, 2023

While I'm no guru, I've successfully created many of my own modifications in the past. This one has me stumped on some bugs in my changes.

While running D2BotBlank, you can hover over an item to show the runes socketed & jewel names only, but it does not show you the jewels' mods in popup. (see code how I am cheating it for now inside game console!)

In UserAddon.js, after Line#212, add this:

if (this.socketedItems[i].itemType === 58) { //if jewel
	// Get jewel data
	var modLine = Misc.getItemDesc(this.socketedItems[i]); //uses the getItemDesc(unit) function from Misc.js
					
	// Begin to clean it up & organize into array
	modLine = modLine.replace(/(\\xff|ÿ)c[0-9!"+<:;.*]|\/|\\/gi, "").trim(); //remove the nasty identifiers
	modLine = modLine.replace("Can be Inserted into Socketed Items\n", ""); //remove this stupid mod line
	modLine = modLine.split("\n"); //turn into an array by splitting text lines from item description text
										
	//#reference: modLine[0] is now name, modLine[1] is (see next line), modLine[2] is jewel's first mod, and then so on.
	//#this fixes when sometimes the modLine[1] is === 'Jewel' and not 'Required Level: ##'
	if (modLine[1].indexOf("Jewel") > -1) { modLine.splice(1, 1); }
	modLine.splice(1, 1); //optional - now we are certain this removes 'Required Level: ##' line

	// Display each mod line
	for (let j = 0; j < modLine.length; j += 1) {
		//#PRINT WORKS!!! EASY WAY OUT TO GET THE JOB DONE, FOR NOW...
		print(modLine[j]);
						
		//#FIXME: this is NOT so nice.. yet
		//this.hooks.push(new Text(modLine[j], this.x, this.y + (j + 4) * 15, 0, 13, 2));
		//frameYsize += 15;
						
		//#FIXME: attempt to make boxes as wide as the longest element in array,
		//#then needs to be added to new Box hook
		//if (modLine[j].length > frameXsize) {
		//frameXsize = modLine[j].length;
		//}
	}
}

PROGRESS --> You can use this to easily print jewel mods in game console!

CURRENTLY --> Popup display is unreadable where you hover. I noticed it will work better while hovering over a mercs' helm area sometimes. Also, the main item image disappears, but you can pause to see it again.

This works for me to see jewel mods, however it would be great to share a nice total completion (popup and all) to community. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant