[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);
}
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…
Cancel
Save