void PlayerCreationManager::loadDefaultCharacterItems() { IffStream* iffStream = TemplateManager::instance()->openIffFile( "creation/default_pc_equipment.iff"); if (iffStream == NULL) { error("Couldn't load creation default items."); return; } iffStream->openForm('LOEQ'); uint32 version = iffStream->getNextFormType(); Chunk* versionChunk = iffStream->openForm(version); for (int i = 0; i < versionChunk->getChunksSize(); ++i) { Chunk* ptmpChunk = iffStream->openForm('PTMP'); String templateName; Chunk* nameChunk = iffStream->openChunk('NAME'); nameChunk->readString(templateName); iffStream->closeChunk('NAME'); SortedVector < String > items; for (int j = 1; j < ptmpChunk->getChunksSize(); ++j) { Chunk* itemChunk = iffStream->openChunk('ITEM'); String itemTemplate; int unk1 = itemChunk->readInt(); itemChunk->readString(itemTemplate); itemTemplate = itemTemplate.replaceFirst("shared_", ""); items.put(itemTemplate); iffStream->closeChunk('ITEM'); } defaultCharacterEquipment.put(templateName, items); iffStream->closeForm('PTMP'); } iffStream->closeForm(version); iffStream->closeForm('LOEQ'); delete iffStream; }
void PlayerCreationManager::loadHairStyleInfo() { IffStream* iffStream = TemplateManager::instance()->openIffFile( "creation/default_pc_hairstyles.iff"); if (iffStream == NULL) { error("Couldn't load creation hair styles."); return; } iffStream->openForm('HAIR'); uint32 version = iffStream->getNextFormType(); Chunk* versionChunk = iffStream->openForm(version); int totalHairStyles = 0; for (int i = 0; i < versionChunk->getChunksSize(); ++i) { Reference<HairStyleInfo*> hsi = new HairStyleInfo(); hsi->readObject(iffStream); hairStyleInfo.put(hsi->getPlayerTemplate(), hsi); totalHairStyles += hsi->getTotalStyles(); //info("Loaded " + String::valueOf(hsi->getTotalStyles()) + " hair styles for template " + hsi->getPlayerTemplate()); } iffStream->closeForm(version); iffStream->closeForm('HAIR'); delete iffStream; info( "Loaded " + String::valueOf(totalHairStyles) + " total creation hair styles."); }