mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
set player attributes according to race and gender
This commit is contained in:
parent
53df82e293
commit
243c9712a6
1 changed files with 25 additions and 8 deletions
|
@ -21,17 +21,34 @@ namespace MWMechanics
|
|||
const ESM::NPC *player = ptr.get<ESM::NPC>()->base;
|
||||
|
||||
// reset
|
||||
creatureStats.mAttributes[0].setBase (player->npdt52.strength);
|
||||
creatureStats.mAttributes[1].setBase (player->npdt52.intelligence);
|
||||
creatureStats.mAttributes[2].setBase (player->npdt52.willpower);
|
||||
creatureStats.mAttributes[3].setBase (player->npdt52.agility);
|
||||
creatureStats.mAttributes[4].setBase (player->npdt52.speed);
|
||||
creatureStats.mAttributes[5].setBase (player->npdt52.endurance);
|
||||
creatureStats.mAttributes[6].setBase (player->npdt52.personality);
|
||||
creatureStats.mAttributes[7].setBase (player->npdt52.luck);
|
||||
|
||||
|
||||
// race
|
||||
const ESM::Race *race =
|
||||
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayerPos().getRace());
|
||||
|
||||
bool male = mEnvironment.mWorld->getPlayerPos().isMale();
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
const ESM::Race::MaleFemale *attribute = 0;
|
||||
switch (i)
|
||||
{
|
||||
case 0: attribute = &race->data.strength; break;
|
||||
case 1: attribute = &race->data.intelligence; break;
|
||||
case 2: attribute = &race->data.willpower; break;
|
||||
case 3: attribute = &race->data.agility; break;
|
||||
case 4: attribute = &race->data.speed; break;
|
||||
case 5: attribute = &race->data.endurance; break;
|
||||
case 6: attribute = &race->data.personality; break;
|
||||
case 7: attribute = &race->data.luck; break;
|
||||
}
|
||||
|
||||
creatureStats.mAttributes[i].setBase (
|
||||
static_cast<int> (male ? attribute->male : attribute->female));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// birthsign
|
||||
|
||||
|
|
Loading…
Reference in a new issue