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

VDF parsing failure #21

Closed
howardchung opened this issue May 11, 2018 · 4 comments
Closed

VDF parsing failure #21

howardchung opened this issue May 11, 2018 · 4 comments

Comments

@howardchung
Copy link

howardchung commented May 11, 2018

Attempting to parse this file:
https://raw.githubusercontent.com/SteamDatabase/GameTracking-Dota2/master/game/dota/pak01_dir/scripts/items/items_game.txt

Results in:
TypeError: Cannot read property 'default' of undefined
at Object.parse (/usr/src/node_modules/simple-vdf/index.js:67:41)

@rossengeorgiev
Copy link
Owner

This is probably fixed by #19

@howardchung
Copy link
Author

howardchung commented May 11, 2018

investigated and it doesn't look like that's the issue.

It's failing on this block:

		"12187"
		{
			"name"		"Cavernite Dire Creeps"
			"prefab"		"direcreeps"
			"creation_date"		"2018-03-28"
			"event_id"		"EVENT_ID_INTERNATIONAL_2018"
			"image_inventory"		"econ/tools/ti8_dire_creeps"
			"item_description"		"#DOTA_Item_Desc_Cavernite_Dire_Creeps"
			"item_name"		"#DOTA_Item_Cavernite_Dire_Creeps"
			"item_rarity"		"legendary"
			"player_loadout"		"1"
			"static_attributes"
			{
				"cannot trade"
				{
					"attribute_class"		"cannot_trade"
					"value"		"1"
				}
				"not marketable"
				{
					"attribute_class"		"not marketable"
					"value"		"1"
				}
				"cannot delete"
				{
					"attribute_class"		"cannot_delete"
					"value"		"1"
				}
			}
			"visuals"
			{
				"asset_modifier"
				{
					"type"		"entity_clientside_model"
					"asset"		"npc_dota_creep_badguys_melee"
					"modifier"		"models/creeps/lane_creeps/creep_bad_melee/creep_bad_melee_cavern.vmdl"
				}
				"asset_modifier"
				{
					"type"		"portrait_game"
					"asset"		"npc_dota_creep_badguys_melee"
					"modifier"
					{
						"PortraitLightPosition"		"29.379999 12.250000 162.360001"
						"PortraitLightAngles"		"73.760002 10.190000 0.000000"
						"PortraitLightFOV"		"75"
						"PortraitLightDistance"		"115"
						"PortraitLightColor"		"191 240 254"
						"PortraitShadowColor"		"48 48 48"
						"PortraitShadowScale"		"5"
						"PortraitAmbientColor"		"155 104 104"
						"PortraitAmbientScale"		"5"
						"PortraitSpecularColor"		"251 74 84"
						"PortraitBackgroundTexture"		"materials/vgui/hud/heroportraits/portraitbackground_darkclouds.vmat"
						"PortraitBackgroundColor1"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor2"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor3"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor4"		"0.700000 0.340000 0.200000"
						"PortraitLightScale"		"7.759000"
						"PortraitGroundShadowScale"		"1.500000"
						"PortraitAmbientDirection"		"-10.070 5.110 -31.920"
						"PortraitAnimationActivity"		"ACT_DOTA_IDLE"
						"cameras"
						{
							"default"
							{
								"PortraitPosition"		"322.152832 141.399353 16.114092"
								"PortraitAngles"		"350.009979 204.790024 0.000000"
								"PortraitFOV"		"17"
								"PortraitFar"		"1000"
							}
						}
						"PortraitSpecularDirection"		"0.000000 0.000000 -1.000000"
						"PortraitSpecularPower"		"16"
						"PortraitAnimationCycle"		"0"
						"PortraitAnimationRate"		"1"
						"PortraitHideHero"		"0"
						"PortraitHideParticles"		"0"
						"PortraitHideDropShadow"		"0"
						"PortraitDesaturateParticles"		"0"
						"PortraitDesaturateHero"		"1"
					}
				}
				"asset_modifier"
				{
					"type"		"entity_clientside_model"
					"asset"		"npc_dota_creep_badguys_ranged"
					"modifier"		"models/creeps/lane_creeps/creep_bad_ranged/creep_bad_ranged_cavern.vmdl"
				}
				"asset_modifier"
				{
					"type"		"portrait_game"
					"asset"		"npc_dota_creep_badguys_ranged"
					"modifier"
					{
						"PortraitLightPosition"		"57.590000 -15.800000 176.649994"
						"PortraitLightAngles"		"68.419998 172.600006 0.000000"
						"PortraitLightFOV"		"90"
						"PortraitLightDistance"		"99"
						"PortraitLightColor"		"254 248 242"
						"PortraitShadowColor"		"74 74 74"
						"PortraitShadowScale"		"5"
						"PortraitAmbientColor"		"79 108 108"
						"PortraitAmbientScale"		"5"
						"PortraitSpecularColor"		"251 74 84"
						"PortraitBackgroundTexture"		"materials/vgui/hud/heroportraits/portraitbackground_darkclouds.vmat"
						"PortraitBackgroundColor1"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor2"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor3"		"0.700000 0.340000 0.200000"
						"PortraitBackgroundColor4"		"0.700000 0.340000 0.200000"
						"PortraitLightScale"		"4.500000"
						"PortraitGroundShadowScale"		"1.500000"
						"PortraitAmbientDirection"		"-79.070 -84.150 -25.320"
						"PortraitAnimationActivity"		"ACT_DOTA_IDLE"
						"cameras"
						{
							"default"
							{
								"PortraitPosition"		"259.155487 112.627571 16.826363"
								"PortraitAngles"		"346.670013 203.990051 0.000000"
								"PortraitFOV"		"23"
								"PortraitFar"		"1000"
							}
						}
						"PortraitSpecularDirection"		"0.000000 0.000000 -1.000000"
						"PortraitSpecularPower"		"16"
						"PortraitAnimationCycle"		"0"
						"PortraitAnimationRate"		"1"
						"PortraitHideHero"		"0"
						"PortraitHideParticles"		"0"
						"PortraitHideDropShadow"		"0"
						"PortraitDesaturateParticles"		"0"
						"PortraitDesaturateHero"		"1"
					}
				}
			}
		}

I think it has to do with attempting to merge the duplicate keys "asset_modifier". It looks like the "modifier" property within each one can be a string or an object, so I'm not sure how they're merged.

@howardchung
Copy link
Author

I've worked around the issue for now by removing the failing blocks from the file.

@rossengeorgiev
Copy link
Owner

This should fix the exception and duplicates will now overwrite previous value.

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

2 participants