mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Client] Add setAttributes() and setSkills() methods to DedicatedPlayer
This commit is contained in:
parent
716809f2db
commit
a01fc577f1
4 changed files with 31 additions and 22 deletions
|
@ -274,6 +274,33 @@ void DedicatedPlayer::setAnimFlags()
|
|||
ptrCreatureStats->setMovementFlag(CreatureStats::Flag_ForceMoveJump, (movementFlags & CreatureStats::Flag_ForceMoveJump) != 0);
|
||||
}
|
||||
|
||||
void DedicatedPlayer::setAttributes()
|
||||
{
|
||||
MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr);
|
||||
MWMechanics::AttributeValue attributeValue;
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
attributeValue.readState(creatureStats.mAttributes[i]);
|
||||
ptrCreatureStats->setAttribute(i, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
void DedicatedPlayer::setSkills()
|
||||
{
|
||||
// Go no further if the player is disguised as a creature
|
||||
if (ptr.getTypeName() != typeid(ESM::NPC).name()) return;
|
||||
|
||||
MWMechanics::NpcStats *ptrNpcStats = &ptr.getClass().getNpcStats(ptr);
|
||||
MWMechanics::SkillValue skillValue;
|
||||
|
||||
for (int i = 0; i < 27; ++i)
|
||||
{
|
||||
skillValue.readState(npcStats.mSkills[i]);
|
||||
ptrNpcStats->setSkill(i, skillValue);
|
||||
}
|
||||
}
|
||||
|
||||
void DedicatedPlayer::setEquipment()
|
||||
{
|
||||
// Go no further if the player is disguised as a creature
|
||||
|
|
|
@ -40,6 +40,8 @@ namespace mwmp
|
|||
void setBaseInfo();
|
||||
void setShapeshift();
|
||||
void setAnimFlags();
|
||||
void setAttributes();
|
||||
void setSkills();
|
||||
void setEquipment();
|
||||
void setCell();
|
||||
|
||||
|
|
|
@ -31,15 +31,7 @@ namespace mwmp
|
|||
}
|
||||
else if (player != 0)
|
||||
{
|
||||
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
|
||||
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
|
||||
MWMechanics::AttributeValue attributeValue;
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
attributeValue.readState(player->creatureStats.mAttributes[i]);
|
||||
ptrCreatureStats->setAttribute(i, attributeValue);
|
||||
}
|
||||
static_cast<DedicatedPlayer *>(player)->setAttributes();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -29,19 +29,7 @@ namespace mwmp
|
|||
}
|
||||
else if (player != 0)
|
||||
{
|
||||
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
|
||||
|
||||
// Go no further if the player is disguised as a creature
|
||||
if (ptrPlayer.getTypeName() != typeid(ESM::NPC).name()) return;
|
||||
|
||||
MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer);
|
||||
MWMechanics::SkillValue skillValue;
|
||||
|
||||
for (int i = 0; i < 27; ++i)
|
||||
{
|
||||
skillValue.readState(player->npcStats.mSkills[i]);
|
||||
ptrNpcStats->setSkill(i, skillValue);
|
||||
}
|
||||
static_cast<DedicatedPlayer *>(player)->setSkills();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue