PathOfBuilding icon indicating copy to clipboard operation
PathOfBuilding copied to clipboard

Brainstorm Trees No Longer Saving Properly

Open DrMarloLake opened this issue 3 years ago • 0 comments

Check version

  • [X] I'm running the latest version of Path of Building and I've verified this by checking the changelog

Check for duplicates

  • [X] I've checked for duplicate issues by using the search function of the issue tracker

What is the expected behaviour/value?

When starting a new build, I like to just do a crazy brainstorm. Search all thoughts/ideas and run a path to anything and everything. No wrong answer. I then save that tree as a 'Master' and duplicate. It usually contains 200-500 selections on the tree. My actual builds are then made by trimming away from those master duplicates.

What is the actual behaviour/value?

I've been away for awhile. Updated and then started one of these projects. Went to save and received an error :( After some digging, realized it was due to the quantity of selections. Looking back at previous versions of the file, I believe the issue was introduced Oct 27 2021 (screenshot below).

How to reproduce the issue

Select 256+ Nodes/Masteries on the tree and attempt to save.

Character build code

function PassiveSpecClass:EncodeURL(prefix)
	local a = { 0, 0, 0, 6, self.curClassId, self.curAscendClassId }
	
	local nodeCount = 0
	local clusterCount = 0
	local masteryCount = 0

	local clusterNodeIds = {}
	local masteryNodeIds = {}

	for id, node in pairs(self.allocNodes) do
		if node.type ~= "ClassStart" and node.type ~= "AscendClassStart" and id < 65536 then
			t_insert(a, m_floor(id / 256))
			t_insert(a, id % 256)
			nodeCount = nodeCount + 1
			if self.masterySelections[node.id] then
				local effect_id = self.masterySelections[node.id]
				t_insert(masteryNodeIds, m_floor(effect_id / 256))
				t_insert(masteryNodeIds, effect_id % 256)
				t_insert(masteryNodeIds, m_floor(node.id / 256))
				t_insert(masteryNodeIds, node.id % 256)
				masteryCount = masteryCount + 1
			end
		elseif id >= 65536 then
			local clusterId = id - 65536
			t_insert(clusterNodeIds, m_floor(clusterId / 256))
			t_insert(clusterNodeIds, clusterId % 256)
			clusterCount = clusterCount + 1
		end
	end
	t_insert(a, 7, nodeCount)

	t_insert(a, clusterCount)
	for _, id in pairs(clusterNodeIds) do
		t_insert(a, id)
	end
	
	t_insert(a, masteryCount)
	for _, id in pairs(masteryNodeIds) do
		t_insert(a, id)
	end
	
	return (prefix or "")..common.base64.encode(string.char(unpack(a))):gsub("+","-"):gsub("/","_")
end

Screenshots

Over 255 Worked

Above is the version (and all prior versions) of the file that allowed saving with over 255 selections.

Old Tree Working

Example of an old save.

256 now fails

This is the version that introduced changes causing an error (I think).

Current Fail

Example of current error message.

Comment out line 316 and save works

For now, I commented out line 316 in my file and was able to successfully save >255.

DrMarloLake avatar Aug 13 '22 09:08 DrMarloLake