|
|
@ -38,15 +38,16 @@ namespace MWMechanics
|
|
|
|
creatureStats.getAttribute(6).setBase (player->mNpdt52.mPersonality);
|
|
|
|
creatureStats.getAttribute(6).setBase (player->mNpdt52.mPersonality);
|
|
|
|
creatureStats.getAttribute(7).setBase (player->mNpdt52.mLuck);
|
|
|
|
creatureStats.getAttribute(7).setBase (player->mNpdt52.mLuck);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MWWorld::ESMStore &esmStore =
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
|
|
|
|
|
|
|
|
// race
|
|
|
|
// race
|
|
|
|
if (mRaceSelected)
|
|
|
|
if (mRaceSelected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const ESM::Race *race =
|
|
|
|
const ESM::Race *race =
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find (
|
|
|
|
esmStore.get<ESM::Race>().find(player->mRace);
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().getRace()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool male = MWBase::Environment::get().getWorld()->getPlayer().isMale();
|
|
|
|
bool male = (player->mFlags & ESM::NPC::Female) == 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<8; ++i)
|
|
|
|
for (int i=0; i<8; ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -89,11 +90,13 @@ namespace MWMechanics
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// birthsign
|
|
|
|
// birthsign
|
|
|
|
if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty())
|
|
|
|
const std::string &signId =
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!signId.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const ESM::BirthSign *sign =
|
|
|
|
const ESM::BirthSign *sign =
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find (
|
|
|
|
esmStore.get<ESM::BirthSign>().find(signId);
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
|
|
|
|
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
|
|
|
|
iter!=sign->mPowers.mList.end(); ++iter)
|
|
|
|
iter!=sign->mPowers.mList.end(); ++iter)
|
|
|
@ -105,11 +108,12 @@ namespace MWMechanics
|
|
|
|
// class
|
|
|
|
// class
|
|
|
|
if (mClassSelected)
|
|
|
|
if (mClassSelected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const ESM::Class& class_ = MWBase::Environment::get().getWorld()->getPlayer().getClass();
|
|
|
|
const ESM::Class *class_ =
|
|
|
|
|
|
|
|
esmStore.get<ESM::Class>().find(player->mClass);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<2; ++i)
|
|
|
|
for (int i=0; i<2; ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int attribute = class_.mData.mAttribute[i];
|
|
|
|
int attribute = class_->mData.mAttribute[i];
|
|
|
|
if (attribute>=0 && attribute<8)
|
|
|
|
if (attribute>=0 && attribute<8)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
creatureStats.getAttribute(attribute).setBase (
|
|
|
|
creatureStats.getAttribute(attribute).setBase (
|
|
|
@ -123,7 +127,7 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
for (int i2=0; i2<5; ++i2)
|
|
|
|
for (int i2=0; i2<5; ++i2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = class_.mData.mSkills[i2][i];
|
|
|
|
int index = class_->mData.mSkills[i2][i];
|
|
|
|
|
|
|
|
|
|
|
|
if (index>=0 && index<27)
|
|
|
|
if (index>=0 && index<27)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -134,12 +138,12 @@ namespace MWMechanics
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const MWWorld::Store<ESM::Skill> &skills =
|
|
|
|
const MWWorld::Store<ESM::Skill> &skills =
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
|
|
|
|
esmStore.get<ESM::Skill>();
|
|
|
|
|
|
|
|
|
|
|
|
MWWorld::Store<ESM::Skill>::iterator iter = skills.begin();
|
|
|
|
MWWorld::Store<ESM::Skill>::iterator iter = skills.begin();
|
|
|
|
for (; iter != skills.end(); ++iter)
|
|
|
|
for (; iter != skills.end(); ++iter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (iter->mData.mSpecialization==class_.mData.mSpecialization)
|
|
|
|
if (iter->mData.mSpecialization==class_->mData.mSpecialization)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = iter->mIndex;
|
|
|
|
int index = iter->mIndex;
|
|
|
|
|
|
|
|
|
|
|
@ -267,11 +271,17 @@ namespace MWMechanics
|
|
|
|
MWBase::Environment::get().getWindowManager();
|
|
|
|
MWBase::Environment::get().getWindowManager();
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
MWWorld::Player &player = world->getPlayer();
|
|
|
|
const ESM::NPC *player =
|
|
|
|
|
|
|
|
world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Race *race =
|
|
|
|
|
|
|
|
world->getStore().get<ESM::Race>().find(player->mRace);
|
|
|
|
|
|
|
|
const ESM::Class *cls =
|
|
|
|
|
|
|
|
world->getStore().get<ESM::Class>().find(player->mClass);
|
|
|
|
|
|
|
|
|
|
|
|
winMgr->setValue ("name", player.getName());
|
|
|
|
winMgr->setValue ("name", player->mName);
|
|
|
|
winMgr->setValue ("race", world->getStore().get<ESM::Race>().find (player.getRace())->mName);
|
|
|
|
winMgr->setValue ("race", race->mName);
|
|
|
|
winMgr->setValue ("class", player.getClass().mName);
|
|
|
|
winMgr->setValue ("class", cls->mName);
|
|
|
|
|
|
|
|
|
|
|
|
mUpdatePlayer = false;
|
|
|
|
mUpdatePlayer = false;
|
|
|
|
|
|
|
|
|
|
|
@ -280,8 +290,8 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<5; ++i)
|
|
|
|
for (int i=0; i<5; ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
minorSkills[i] = player.getClass().mData.mSkills[i][0];
|
|
|
|
minorSkills[i] = cls->mData.mSkills[i][0];
|
|
|
|
majorSkills[i] = player.getClass().mData.mSkills[i][1];
|
|
|
|
majorSkills[i] = cls->mData.mSkills[i][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
winMgr->configureSkills (majorSkills, minorSkills);
|
|
|
|
winMgr->configureSkills (majorSkills, minorSkills);
|
|
|
@ -297,14 +307,33 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::setPlayerName (const std::string& name)
|
|
|
|
void MechanicsManager::setPlayerName (const std::string& name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setName (name);
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ESM::NPC player =
|
|
|
|
|
|
|
|
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
|
|
|
|
|
|
|
player.mName = name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
world->createRecord(player);
|
|
|
|
|
|
|
|
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
|
|
|
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setGender (male);
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setRace (race);
|
|
|
|
|
|
|
|
|
|
|
|
ESM::NPC player =
|
|
|
|
|
|
|
|
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player.mRace = race;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
player.mFlags |= ESM::NPC::Female;
|
|
|
|
|
|
|
|
if (male) {
|
|
|
|
|
|
|
|
player.mFlags ^= ESM::NPC::Female;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
world->createRecord(player);
|
|
|
|
|
|
|
|
|
|
|
|
mRaceSelected = true;
|
|
|
|
mRaceSelected = true;
|
|
|
|
buildPlayer();
|
|
|
|
buildPlayer();
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
mUpdatePlayer = true;
|
|
|
@ -312,24 +341,38 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
|
|
|
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setBirthsign (id);
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setBirthSign(id);
|
|
|
|
buildPlayer();
|
|
|
|
buildPlayer();
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::setPlayerClass (const std::string& id)
|
|
|
|
void MechanicsManager::setPlayerClass (const std::string& id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setClass (
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (id)
|
|
|
|
|
|
|
|
);
|
|
|
|
ESM::NPC player =
|
|
|
|
|
|
|
|
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
|
|
|
|
|
|
|
player.mClass = id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
world->createRecord(player);
|
|
|
|
|
|
|
|
|
|
|
|
mClassSelected = true;
|
|
|
|
mClassSelected = true;
|
|
|
|
buildPlayer();
|
|
|
|
buildPlayer();
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
|
|
|
void MechanicsManager::setPlayerClass (const ESM::Class &cls)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MWBase::Environment::get().getWorld()->getPlayer().setClass (class_);
|
|
|
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Class *ptr = world->createRecord(cls);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ESM::NPC player =
|
|
|
|
|
|
|
|
*world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
|
|
|
|
|
|
|
player.mClass = ptr->mId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
world->createRecord(player);
|
|
|
|
|
|
|
|
|
|
|
|
mClassSelected = true;
|
|
|
|
mClassSelected = true;
|
|
|
|
buildPlayer();
|
|
|
|
buildPlayer();
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
mUpdatePlayer = true;
|
|
|
|