/** * Load sheet_id.bin from leveldesign.bnp * Initialize SheetId and SheetsManager */ private function loadSheets() { $bnpLeveldesign = new BnpFile($this->ryzomDataPath . '/leveldesign.bnp'); $buffer = $bnpLeveldesign->readFile('sheet_id.bin'); $this->sheetIds = new SheetId(); $this->sheetIds->load($buffer); $psLoader = new PackedSheetsLoader($this->ryzomDataPath); $this->sheets = new SheetsManager($this->sheetIds, $psLoader); }
/** * @param string $ryzomDataPath * * @return \Ryzom\Translation\StringsManager */ public function load($ryzomDataPath) { $bnp = new BnpFile($ryzomDataPath . '/gamedev.bnp'); $sm = new StringsManager(); $sm->register(new WordsLoader()); $sm->load('place', $bnp->readFile('place_words_en.txt'), 'en'); $sm->load('place', $bnp->readFile('place_words_fr.txt'), 'fr'); $sm->load('place', $bnp->readFile('place_words_de.txt'), 'de'); $sm->load('place', $bnp->readFile('place_words_es.txt'), 'es'); $sm->load('place', $bnp->readFile('place_words_ru.txt'), 'ru'); return $sm; }
<?php use Nel\Misc\BnpFile; use Ryzom\Sheets\PackedSheetsLoader; use Ryzom\Translation\Loader\UxtLoader; use Ryzom\Translation\Loader\WordsLoader; use Ryzom\Translation\StringsManager; require __DIR__ . '/../vendor/autoload.php'; $sm = new StringsManager(); $sm->register(new UxtLoader()); $sm->register(new WordsLoader()); $leveldesign = new BnpFile('/srv/home2/ryzom/data/gamedev.bnp'); // loading en.uxt file $buffer = $leveldesign->readFile('en.uxt'); $sm->load('uxt', $buffer, 'en'); $strings = $sm->getStrings('uxt', 'en'); // all keys are in lowercase $key = 'languagename'; $value = $strings[$key]; printf("%s = [%s]\n", $key, $value['name']); // loading outpost_words_en.txt $buffer = $leveldesign->readFile('outpost_words_en.txt'); $sm->load('outpost', $buffer, 'en'); $strings = $sm->getStrings('outpost', 'en'); $key = 'fyros_outpost_04'; $value = $strings[$key]; printf("%s\n name = %s\n description = %s\n", $key, $value['name'], $value['description']); /*****************************************************************************/ echo "\n"; $psLoader = new PackedSheetsLoader('/srv/home2/ryzom/data'); printf("+ loading sitem.packed_sheets file...\n");