[General] Add creature soul values to RecordDynamic packets

pull/593/head
David Cernat 4 years ago
parent 8c7b07b9c8
commit 44d037c078

@ -1344,6 +1344,21 @@ void RecordsDynamicFunctions::SetRecordFatigue(int fatigue) noexcept
tempOverrides.hasFatigue = true;
}
void RecordsDynamicFunctions::SetRecordSoulValue(int soulValue) noexcept
{
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
if (writeRecordsType == mwmp::RECORD_TYPE::CREATURE)
tempCreature.data.mData.mSoul = soulValue;
else
{
LOG_MESSAGE_SIMPLE(TimedLog::LOG_ERROR, "Tried to set soul value for record type %i which lacks that property", writeRecordsType);
return;
}
tempOverrides.hasSoulValue = true;
}
void RecordsDynamicFunctions::SetRecordAIFight(int aiFight) noexcept
{
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;

@ -93,6 +93,8 @@
{"SetRecordMagicka", RecordsDynamicFunctions::SetRecordMagicka},\
{"SetRecordFatigue", RecordsDynamicFunctions::SetRecordFatigue},\
\
{"SetRecordSoulValue", RecordsDynamicFunctions::SetRecordSoulValue},\
\
{"SetRecordAIFight", RecordsDynamicFunctions::SetRecordAIFight},\
{"SetRecordAIFlee", RecordsDynamicFunctions::SetRecordAIFlee},\
{"SetRecordAIAlarm", RecordsDynamicFunctions::SetRecordAIAlarm},\
@ -807,6 +809,15 @@ public:
*/
static void SetRecordFatigue(int fatigue) noexcept;
/**
* \brief Set the soul value of the temporary record stored on the server for the
* currently specified record type.
*
* \param soulValue The soul value of the record.
* \return void
*/
static void SetRecordSoulValue(int soulValue) noexcept;
/**
* \brief Set the AI fight value of the temporary record stored on the server for the
* currently specified record type.

@ -564,6 +564,9 @@ void RecordHelper::overrideRecord(const mwmp::CreatureRecord& record)
if (record.baseOverrides.hasFatigue)
finalData.mData.mFatigue = recordData.mData.mFatigue;
if (record.baseOverrides.hasSoulValue)
finalData.mData.mSoul = recordData.mData.mSoul;
if (record.baseOverrides.hasAiFight)
finalData.mAiData.mFight = recordData.mAiData.mFight;

@ -132,6 +132,8 @@ namespace mwmp
bool hasMagicka = false;
bool hasFatigue = false;
bool hasSoulValue = false;
bool hasAiFight = false;
bool hasAiFlee = false;
bool hasAiAlarm = false;

@ -551,6 +551,7 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
RW(recordData.mData.mHealth, send);
RW(recordData.mData.mMana, send);
RW(recordData.mData.mFatigue, send);
RW(recordData.mData.mSoul, send);
RW(recordData.mAiData.mFight, send);
RW(recordData.mAiData.mFlee, send);
RW(recordData.mAiData.mAlarm, send);
@ -571,6 +572,7 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
RW(overrides.hasHealth, send);
RW(overrides.hasMagicka, send);
RW(overrides.hasFatigue, send);
RW(overrides.hasSoulValue, send);
RW(overrides.hasAiFight, send);
RW(overrides.hasAiFlee, send);
RW(overrides.hasAiAlarm, send);

Loading…
Cancel
Save