/** * @param string $race * @param string $gender * * @return array */ private function getDefaultHaircut($race, $gender) { $sheet = "{$race}_ho{$gender}_hair_basic01.sitem"; $index = ryzom_vs_index(EVisualSlot::HEAD_SLOT, $sheet); return [$index, $sheet]; }
/** * Find which slot does sheet belong to * * @param string $sheetName * * @return int|bool */ private function findSheetSlot($sheetName) { $slots = array(EVisualSlot::HIDDEN_SLOT, EVisualSlot::CHEST_SLOT, EVisualSlot::LEGS_SLOT, EVisualSlot::HEAD_SLOT, EVisualSlot::ARMS_SLOT, EVisualSlot::FACE_SLOT, EVisualSlot::HANDS_SLOT, EVisualSlot::FEET_SLOT, EVisualSlot::RIGHT_HAND_SLOT, EVisualSlot::LEFT_HAND_SLOT); foreach ($slots as $slot) { if (ryzom_vs_index($slot, $sheetName)) { return $slot; } } return false; }
<?php require_once __DIR__ . '/../ryzom_extra.php'; $result = ryzom_vs_sheet(1, 1); var_dump($result); $result = ryzom_vs_index(1, 'icfahv.sitem'); var_dump($result);
/** * Lookup sheet name visual slot index * * @param $slot * @param $sheetName * * @return bool|mixed */ protected function lookupItemSlotIndex($slot, $sheetName) { if (stristr($sheetName, '.sitem') === false) { $sheetName .= '.sitem'; } return ryzom_vs_index($slot, $sheetName); }