示例#1
0
    void Faction::save(ESMWriter &esm, bool isDeleted) const
    {
        esm.writeHNCString("NAME", mId);

        if (isDeleted)
        {
            esm.writeHNCString("DELE", "");
            return;
        }

        esm.writeHNOCString("FNAM", mName);

        for (int i = 0; i < 10; i++)
        {
            if (mRanks[i].empty())
                break;

            esm.writeHNString("RNAM", mRanks[i], 32);
        }

        esm.writeHNT("FADT", mData, 240);

        for (std::map<std::string, int>::const_iterator it = mReactions.begin(); it != mReactions.end(); ++it)
        {
            esm.writeHNString("ANAM", it->first);
            esm.writeHNT("INTV", it->second);
        }
    }
示例#2
0
 void AiEscort::save(ESMWriter &esm) const
 {
     esm.writeHNT ("DATA", mData);
     esm.writeHNString ("TARG", mTargetId);
     esm.writeHNT ("DURA", mRemainingDuration);
     if (!mCellId.empty())
         esm.writeHNString ("CELL", mCellId);
 }
示例#3
0
    void MagicBoltState::save(ESMWriter &esm) const
    {
        BaseProjectileState::save(esm);

        esm.writeHNString ("SPEL", mSpellId);
        esm.writeHNString ("SRCN", mSourceName);
        mEffects.save(esm);
        esm.writeHNT ("SPED", mSpeed);
        esm.writeHNT ("STCK", mStack);
        esm.writeHNString ("SOUN", mSound);
    }
示例#4
0
 void AiFollow::save(ESMWriter &esm) const
 {
     esm.writeHNT ("DATA", mData);
     esm.writeHNString("TARG", mTargetId);
     esm.writeHNT ("DURA", mRemainingDuration);
     if (!mCellId.empty())
         esm.writeHNString ("CELL", mCellId);
     esm.writeHNT ("ALWY", mAlwaysFollow);
     esm.writeHNT ("CMND", mCommanded);
     if (mActive)
         esm.writeHNT("ACTV", mActive);
 }
示例#5
0
    void ProjectileState::save(ESMWriter &esm) const
    {
        BaseProjectileState::save(esm);

        esm.writeHNString ("BOW_", mBowId);
        esm.writeHNT ("VEL_", mVelocity);
    }
示例#6
0
 void BaseProjectileState::save(ESMWriter &esm) const
 {
     esm.writeHNString ("ID__", mId);
     esm.writeHNT ("VEC3", mPosition);
     esm.writeHNT ("QUAT", mOrientation);
     esm.writeHNT ("ACTO", mActorId);
 }
示例#7
0
void ESM::CellId::save (ESMWriter &esm) const
{
    esm.writeHNString ("SPAC", mWorldspace);

    if (mPaged)
        esm.writeHNT ("CIDX", mIndex, 8);
}
示例#8
0
void ESM::JournalEntry::save (ESMWriter &esm) const
{
    esm.writeHNT ("JETY", mType);
    esm.writeHNString ("YETO", mTopic);
    esm.writeHNString ("YEIN", mInfo);
    esm.writeHNString ("TEXT", mText);

    if (mType==Type_Journal)
    {
        esm.writeHNT ("JEDA", mDay);
        esm.writeHNT ("JEMO", mMonth);
        esm.writeHNT ("JEDM", mDayOfMonth);
    }
    else if (mType==Type_Topic)
        esm.writeHNString ("ACT_", mActorName);
}
示例#9
0
void ESM::VariantIntegerData::write (ESMWriter& esm, Variant::Format format, VarType type) const
{
    if (type!=VT_Short && type!=VT_Long && type!=VT_Int)
        throw std::logic_error ("not an integer type");

    if (format==Variant::Format_Global)
    {
        if (type==VT_Short || type==VT_Long)
        {
            float value = mValue;
            esm.writeHNString ("FNAM", type==VT_Short ? "s" : "l");
            esm.writeHNT ("FLTV", value);
        }
        else
            throw std::runtime_error ("unsupported global variable integer type");
    }
    else if (format==Variant::Format_Gmst || format==Variant::Format_Info)
    {
        if (type==VT_Int)
        {
            std::ostringstream stream;
            stream
                << "unsupported " <<(format==Variant::Format_Gmst ? "gmst" : "info")
                << " variable integer type";
            throw std::runtime_error (stream.str());
        }

        esm.writeHNT ("INTV", mValue);
    }
}
示例#10
0
void GameSetting::save(ESMWriter &esm)
{
    switch(mType)
    {
    case VT_String: esm.writeHNString("STRV", mStr); break;
    case VT_Int: esm.writeHNT("INTV", mI); break;
    case VT_Float: esm.writeHNT("FLTV", mF); break;
    default: break;
    }
}
示例#11
0
void ESM::GlobalScript::save (ESMWriter &esm) const
{
    esm.writeHNString ("NAME", mId);

    mLocals.save (esm);

    if (mRunning)
        esm.writeHNT ("RUN_", mRunning);

    esm.writeHNOString ("TARG", mTargetId);
}
示例#12
0
void Faction::save(ESMWriter &esm)
{
    esm.writeHNCString("FNAM", mName);
    
    for (int i = 0; i < 10; i++)
    {
        if (mRanks[i].empty())
            break;

        esm.writeHNString("RNAM", mRanks[i], 32);
    }

    esm.writeHNT("FADT", mData, 240);
    
    for (std::vector<Reaction>::iterator it = mReactions.begin(); it != mReactions.end(); ++it)
    {
        esm.writeHNString("ANAM", it->mFaction);
        esm.writeHNT("INTV", it->mReaction);
    }
}
示例#13
0
void ESM::DialogueState::save (ESMWriter &esm) const
{
    for (std::vector<std::string>::const_iterator iter (mKnownTopics.begin());
        iter!=mKnownTopics.end(); ++iter)
    {
        esm.writeHNString ("TOPI", *iter);
    }

    for (std::map<std::string, std::map<std::string, int> >::const_iterator iter = mModFactionReaction.begin();
         iter != mModFactionReaction.end(); ++iter)
    {
        esm.writeHNString ("FACT", iter->first);

        for (std::map<std::string, int>::const_iterator reactIter = iter->second.begin();
             reactIter != iter->second.end(); ++reactIter)
        {
            esm.writeHNString ("REAC", reactIter->first);
            esm.writeHNT ("INTV", reactIter->second);
        }
    }
}
示例#14
0
 void StartScript::save(ESMWriter &esm, bool isDeleted) const
 {
     esm.writeHNCString("NAME", mId);
     if (isDeleted)
     {
         esm.writeHNCString("DELE", "");
     }
     else
     {
         esm.writeHNString("DATA", mData);
     }
 }
示例#15
0
void ESM::VariantStringData::write (ESMWriter& esm, Variant::Format format, VarType type) const
{
    if (type!=VT_String)
        throw std::logic_error ("not a string type");

    if (format==Variant::Format_Global)
        throw std::runtime_error ("global variables of type string not supported");

    if (format==Variant::Format_Info)
        throw std::runtime_error ("info variables of type string not supported");

    // GMST
    esm.writeHNString ("STRV", mValue);
}
示例#16
0
    void SpellState::save(ESMWriter &esm) const
    {
        for (TContainer::const_iterator it = mSpells.begin(); it != mSpells.end(); ++it)
        {
            esm.writeHNString("SPEL", it->first);

            const std::map<const int, float>& random = it->second;
            for (std::map<const int, float>::const_iterator rIt = random.begin(); rIt != random.end(); ++rIt)
            {
                esm.writeHNT("INDX", rIt->first);
                esm.writeHNT("RAND", rIt->second);
            }
        }

        for (std::map<std::string, TimeStamp>::const_iterator it = mUsedPowers.begin(); it != mUsedPowers.end(); ++it)
        {
            esm.writeHNString("USED", it->first);
            esm.writeHNT("TIME", it->second);
        }

        if (!mSelectedSpell.empty())
            esm.writeHNString("SLCT", mSelectedSpell);
    }
示例#17
0
void ESM::VariantFloatData::write (ESMWriter& esm, Variant::Format format, VarType type) const
{
    if (type!=VT_Float)
        throw std::logic_error ("not a float type");

    if (format==Variant::Format_Global)
    {
        esm.writeHNString ("FNAM", "f");
        esm.writeHNT ("FLTV", mValue);
    }
    else if (format==Variant::Format_Gmst || format==Variant::Format_Info)
    {
        esm.writeHNT ("FLTV", mValue);
    }
}
示例#18
0
void ESM::Player::save (ESMWriter &esm) const
{
    mObject.save (esm);

    mCellId.save (esm);

    esm.writeHNT ("LKEP", mLastKnownExteriorPosition, 12);

    if (mHasMark)
    {
        esm.writeHNT ("MARK", mMarkedPosition, 24);
        mMarkedCell.save (esm);
    }

    if (mAutoMove)
        esm.writeHNT ("AMOV", mAutoMove);

    esm.writeHNString ("SIGN", mBirthsign);

    esm.writeHNT ("CURD", mCurrentCrimeId);
    esm.writeHNT ("PAYD", mPayedCrimeId);
}
示例#19
0
void DialInfo::save(ESMWriter &esm)
{
    esm.writeHNCString("INAM", mId);
    esm.writeHNCString("PNAM", mPrev);
    esm.writeHNCString("NNAM", mNext);
    esm.writeHNT("DATA", mData, 12);
    esm.writeHNOCString("ONAM", mActor);
    esm.writeHNOCString("RNAM", mRace);
    esm.writeHNOCString("CNAM", mClass);
    esm.writeHNOCString("FNAM", mNpcFaction);
    esm.writeHNOCString("ANAM", mCell);
    esm.writeHNOCString("DNAM", mPcFaction);
    esm.writeHNOCString("SNAM", mSound);
    esm.writeHNOString("NAME", mResponse);

    for (std::vector<SelectStruct>::iterator it = mSelects.begin(); it != mSelects.end(); ++it)
    {
        esm.writeHNString("SCVR", it->mSelectRule);
        switch(it->mType)
        {
        case VT_Int: esm.writeHNT("INTV", it->mI); break;
        case VT_Float: esm.writeHNT("FLTV", it->mF); break;
        default: break;
        }
    }

    esm.writeHNOString("BNAM", mResultScript);
    
    switch(mQuestStatus)
    {
    case QS_Name: esm.writeHNT("QSTN",'\1'); break;
    case QS_Finished: esm.writeHNT("QSTF", '\1'); break;
    case QS_Restart: esm.writeHNT("QSTR", '\1'); break;
    case QS_Deleted: esm.writeHNT("DELE", '\1'); break;
    default: break;
    }
}
示例#20
0
void ESM::NpcStats::save (ESMWriter &esm) const
{
    for (std::map<std::string, Faction>::const_iterator iter (mFactions.begin());
        iter!=mFactions.end(); ++iter)
    {
        esm.writeHNString ("FACT", iter->first);

        if (iter->second.mExpelled)
        {
            int expelled = 1;
            esm.writeHNT ("FAEX", expelled);
        }

        if (iter->second.mRank >= 0)
            esm.writeHNT ("FARA", iter->second.mRank);

        if (iter->second.mReputation)
            esm.writeHNT ("FARE", iter->second.mReputation);
    }

    if (mDisposition)
        esm.writeHNT ("DISP", mDisposition);

    for (int i=0; i<27; ++i)
    {
        mSkills[i].mRegular.save (esm);
        mSkills[i].mWerewolf.save (esm);
    }

    esm.writeHNT ("HWAT", true);
    for (int i=0; i<8; ++i)
        mWerewolfAttributes[i].save (esm);

    if (mIsWerewolf)
        esm.writeHNT ("WOLF", mIsWerewolf);

    if (mBounty)
        esm.writeHNT ("BOUN", mBounty);

    if (mReputation)
        esm.writeHNT ("REPU", mReputation);

    if (mWerewolfKills)
        esm.writeHNT ("WKIL", mWerewolfKills);

    if (mProfit)
        esm.writeHNT ("PROF", mProfit);

    if (mLevelProgress)
        esm.writeHNT ("LPRO", mLevelProgress);

    esm.writeHNT ("INCR", mSkillIncrease);

    for (std::vector<std::string>::const_iterator iter (mUsedIds.begin()); iter!=mUsedIds.end();
        ++iter)
        esm.writeHNString ("USED", *iter);

    if (mTimeToStartDrowning)
        esm.writeHNT ("DRTI", mTimeToStartDrowning);

    if (mLastDrowningHit)
        esm.writeHNT ("DRLH", mLastDrowningHit);

    if (mLevelHealthBonus)
        esm.writeHNT ("LVLH", mLevelHealthBonus);

    if (mCrimeId != -1)
        esm.writeHNT ("CRID", mCrimeId);
}
示例#21
0
 void AiActivate::save(ESMWriter &esm) const
 {
     esm.writeHNString("TARG", mTargetId);
 }
示例#22
0
void ESM::CreatureStats::save (ESMWriter &esm) const
{

    for (int i=0; i<8; ++i)
        mAttributes[i].save (esm);

    for (int i=0; i<3; ++i)
        mDynamic[i].save (esm);

    if (mGoldPool)
        esm.writeHNT ("GOLD", mGoldPool);

    esm.writeHNT ("TIME", mTradeTime);

    if (mDead)
        esm.writeHNT ("DEAD", mDead);

    if (mDied)
        esm.writeHNT ("DIED", mDied);

    if (mMurdered)
        esm.writeHNT ("MURD", mMurdered);

    if (mFriendlyHits)
        esm.writeHNT ("FRHT", mFriendlyHits);

    if (mTalkedTo)
        esm.writeHNT ("TALK", mTalkedTo);

    if (mAlarmed)
        esm.writeHNT ("ALRM", mAlarmed);

    if (mAttacked)
        esm.writeHNT ("ATKD", mAttacked);

    if (mAttackingOrSpell)
        esm.writeHNT ("ATCK", mAttackingOrSpell);

    if (mKnockdown)
        esm.writeHNT ("KNCK", mKnockdown);

    if (mKnockdownOneFrame)
        esm.writeHNT ("KNC1", mKnockdownOneFrame);

    if (mKnockdownOverOneFrame)
        esm.writeHNT ("KNCO", mKnockdownOverOneFrame);

    if (mHitRecovery)
        esm.writeHNT ("HITR", mHitRecovery);

    if (mBlock)
        esm.writeHNT ("BLCK", mBlock);

    if (mMovementFlags)
        esm.writeHNT ("MOVE", mMovementFlags);

    if (mAttackStrength)
        esm.writeHNT ("ASTR", mAttackStrength);

    if (mFallHeight)
        esm.writeHNT ("FALL", mFallHeight);

    if (!mLastHitObject.empty())
        esm.writeHNString ("LHIT", mLastHitObject);

    if (!mLastHitAttemptObject.empty())
        esm.writeHNString ("LHAT", mLastHitAttemptObject);

    if (mRecalcDynamicStats)
        esm.writeHNT ("CALC", mRecalcDynamicStats);

    if (mDrawState)
        esm.writeHNT ("DRAW", mDrawState);

    if (mLevel != 1)
        esm.writeHNT ("LEVL", mLevel);

    if (mActorId != -1)
        esm.writeHNT ("ACID", mActorId);

    if (mDeathAnimation)
        esm.writeHNT ("DANM", mDeathAnimation);

    mSpells.save(esm);
    mActiveSpells.save(esm);
    mAiSequence.save(esm);
    mMagicEffects.save(esm);

    for (std::map<std::pair<int, std::string>, int>::const_iterator it = mSummonedCreatureMap.begin(); it != mSummonedCreatureMap.end(); ++it)
    {
        esm.writeHNT ("SUMM", it->first.first);
        esm.writeHNString ("SOUR", it->first.second);
        esm.writeHNT ("ACID", it->second);
    }

    for (std::vector<int>::const_iterator it = mSummonGraveyard.begin(); it != mSummonGraveyard.end(); ++it)
    {
        esm.writeHNT ("GRAV", *it);
    }

    esm.writeHNT("AISE", mHasAiSettings);
    if (mHasAiSettings)
    {
        for (int i=0; i<4; ++i)
            mAiSettings[i].save(esm);
    }
}
示例#23
0
void SpellList::save(ESMWriter &esm) const
{
    for (std::vector<std::string>::const_iterator it = mList.begin(); it != mList.end(); ++it) {
        esm.writeHNString("NPCS", *it, 32);
    }
}