[Client] Add setAttributes() and setSkills() methods to DedicatedPlayer

0.6.3
David Cernat 7 years ago
parent 716809f2db
commit a01fc577f1

@ -274,6 +274,33 @@ void DedicatedPlayer::setAnimFlags()
ptrCreatureStats->setMovementFlag(CreatureStats::Flag_ForceMoveJump, (movementFlags & CreatureStats::Flag_ForceMoveJump) != 0); 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() void DedicatedPlayer::setEquipment()
{ {
// Go no further if the player is disguised as a creature // Go no further if the player is disguised as a creature

@ -40,6 +40,8 @@ namespace mwmp
void setBaseInfo(); void setBaseInfo();
void setShapeshift(); void setShapeshift();
void setAnimFlags(); void setAnimFlags();
void setAttributes();
void setSkills();
void setEquipment(); void setEquipment();
void setCell(); void setCell();

@ -31,15 +31,7 @@ namespace mwmp
} }
else if (player != 0) else if (player != 0)
{ {
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr(); static_cast<DedicatedPlayer *>(player)->setAttributes();
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);
}
} }
} }
}; };

@ -29,19 +29,7 @@ namespace mwmp
} }
else if (player != 0) else if (player != 0)
{ {
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr(); static_cast<DedicatedPlayer *>(player)->setSkills();
// 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);
}
} }
} }
}; };

Loading…
Cancel
Save