void SharedTangibleObjectTemplate::parseVariableData(const String& varName, Chunk* data) {
	TemplateManager* templateManager = TemplateManager::instance();

	if (varName == "paletteColorCustomizationVariables") {
//		paletteColorCustomizationVariables.parse(data);
		PaletteColorCustomizationVariables pccv;
		pccv.parse(data); //need to parse cant skip
	} else if (varName == "rangedIntCustomizationVariables") {
//		rangedIntCustomizationVariables.parse(data);

		RangedIntCustomizationVariables ricv;
		ricv.parse(data);
	} else if (varName == "constStringCustomizationVariables") {
/*		uint8 unk = data->getUnsignedByte();
		uint32 num = data->getUnsignedInt();

		if (num != 0) {
			QString fileName = data->getIffStream()->getFileName().c_str();
			SWGForensics::instance->printToConsole("EUREKA found constStringCustomizationVariables" + fileName);
			SWGForensics::instance->runTraverse = false;
		}*/
	} else if (varName == "socketDestinations") {
//		socketDestinations.parse(data);
	} else if (varName == "structureFootprintFileName") {		
		StringParam structureFootprintFileName;

		if (structureFootprintFileName.parse(data))
			structureFootprint = templateManager->loadStructureFootprint(structureFootprintFileName.get());
	} else if (varName == "useStructureFootprintOutline") {
/*		useStructureFootprintOutline.parse(data);
		variables[varName] = &useStructureFootprintOutline;*/
	} else if (varName == "targetable") {
		targetable.parse(data);
//		variables[varName] = &targetable;
	} else if (varName == "certificationsRequired") {
/*		certificationsRequired.parse(data);
		variables[varName] = &certificationsRequired;*/
	} else if (varName == "customizationVariableMapping") {
/*		customizationVariableMapping.parse(data);
		variables[varName] = &customizationVariableMapping;*/
	}
}
void SharedTangibleObjectTemplate::parseVariableData(const String& varName, LuaObject* data) {
	lua_State* state = data->getLuaState();
	TemplateManager* templateManager = TemplateManager::instance();

	if (varName == "certificationsRequired") {
		LuaObject certifications(state);
		certificationsRequired.removeAll();
		for (int i = 1; i <= certifications.getTableSize(); ++i) {
			certificationsRequired.add(certifications.getStringAt(i));
		}

		certifications.pop();
	} else if (varName == "structureFootprintFileName") {
		structureFootprint = templateManager->loadStructureFootprint(Lua::getStringParameter(state));
	} else if (varName == "targetable") {
		targetable = Lua::getByteParameter(state);
	} else if (varName == "playerUseMask") {
		playerUseMask = Lua::getShortParameter(state);
	} else if (varName == "useCount") {
		useCount = Lua::getIntParameter(state);
	} else if (varName == "factoryCrateSize") {
		factoryCrateSize = Lua::getIntParameter(state);
	} else if (varName == "maxCondition") {
		maxCondition = Lua::getIntParameter(state);
	} else if (varName == "level") {
		level = Lua::getIntParameter(state);
	} else if (varName == "optionsBitmask") {
		optionsBitmask = Lua::getIntParameter(state);
	} else if (varName == "pvpStatusBitmask") {
		pvpStatusBitmask = Lua::getIntParameter(state);
	} else if (varName == "sliceable") {
		sliceable = Lua::getIntParameter(state);
	} else if (varName == "faction") {
		String factionString = Lua::getStringParameter(state);
		faction = factionString.toLowerCase().hashCode();
	} else if (varName == "playerRaces") {
		LuaObject races(state);

		// Inherited lists need to be tossed if a new list is about to be created
		if (playerRaces->size() != 0) {
			playerRaces->removeAll();
		}

		for (int i = 1; i <= races.getTableSize(); ++i) {
			String race = races.getStringAt(i);

			if (!playerRaces->contains(race.hashCode())) {
				playerRaces->add(race.hashCode());
			}


		}

		races.pop();
	} else if (varName == "skillMods") {
		skillMods.removeAll();

		LuaObject smods(state);
		for (int i = 1; i <= smods.getTableSize(); ++i) {
			lua_rawgeti(state, -1, i);
			LuaObject mod(state);

			String modName = mod.getStringAt(1);
			int modValue = mod.getIntAt(2);

			skillMods.put(modName, modValue);

			mod.pop();
		}
		smods.pop();
	} else if (varName == "numberExperimentalProperties") {
		LuaObject numberExperimentalPropertiesList(state);
		numberExperimentalProperties->removeAll();
		for (int i = 1; i <= numberExperimentalPropertiesList.getTableSize(); ++i) {
			numberExperimentalProperties->add(numberExperimentalPropertiesList.getIntAt(i));
		}

		numberExperimentalPropertiesList.pop();
	} else if (varName == "experimentalProperties") {
		LuaObject experimentalPropertiesList(state);
		experimentalProperties->removeAll();
		for (int i = 1; i <= experimentalPropertiesList.getTableSize(); ++i) {
			experimentalProperties->add(experimentalPropertiesList.getStringAt(i));
		}

		experimentalPropertiesList.pop();
	} else if (varName == "experimentalWeights") {
		LuaObject experimentalWeightsList(state);
		experimentalWeights->removeAll();
		for (int i = 1; i <= experimentalWeightsList.getTableSize(); ++i) {
			experimentalWeights->add(experimentalWeightsList.getIntAt(i));
		}

		experimentalWeightsList.pop();
	} else if (varName == "experimentalGroupTitles") {
		LuaObject experimentalGroupTitlesList(state);
		experimentalGroupTitles->removeAll();
		for (int i = 1; i <= experimentalGroupTitlesList.getTableSize(); ++i) {
			experimentalGroupTitles->add(experimentalGroupTitlesList.getStringAt(i));
		}

		experimentalGroupTitlesList.pop();
	} else if (varName == "experimentalSubGroupTitles") {
		LuaObject experimentalSubGroupTitlesList(state);
		experimentalSubGroupTitles->removeAll();
		for (int i = 1; i <= experimentalSubGroupTitlesList.getTableSize(); ++i) {
			experimentalSubGroupTitles->add(experimentalSubGroupTitlesList.getStringAt(i));
		}

		experimentalSubGroupTitlesList.pop();
	} else if (varName == "experimentalMin") {
		LuaObject experimentalMinList(state);
		experimentalMin->removeAll();
		for (int i = 1; i <= experimentalMinList.getTableSize(); ++i) {
			experimentalMin->add(experimentalMinList.getFloatAt(i));
		}

		experimentalMinList.pop();
	} else if (varName == "experimentalMax") {
		LuaObject experimentalMaxList(state);
		experimentalMax->removeAll();
		for (int i = 1; i <= experimentalMaxList.getTableSize(); ++i) {
			experimentalMax->add(experimentalMaxList.getFloatAt(i));
		}

		experimentalMaxList.pop();
	} else if (varName == "experimentalPrecision") {
		LuaObject experimentalPrecisionList(state);
		experimentalPrecision->removeAll();
		for (int i = 1; i <= experimentalPrecisionList.getTableSize(); ++i) {
			experimentalPrecision->add(experimentalPrecisionList.getIntAt(i));
		}
		experimentalPrecisionList.pop();
	} else if (varName == "experimentalCombineType") {
		LuaObject experimentalCombineList(state);
		experimentalCombineType->removeAll();
		for (int i = 1; i <= experimentalCombineList.getTableSize(); ++i) {
			experimentalCombineType->add(experimentalCombineList.getIntAt(i));
		}
		experimentalCombineList.pop();
	} else {
		data->pop();
	}

}