[General] Implement container and door records for RecordDynamic packets

pull/541/head
David Cernat 6 years ago
parent 4183373f53
commit e9336e53fc

@ -22,6 +22,8 @@ BookRecord tempBook;
ClothingRecord tempClothing; ClothingRecord tempClothing;
MiscellaneousRecord tempMiscellaneous; MiscellaneousRecord tempMiscellaneous;
WeaponRecord tempWeapon; WeaponRecord tempWeapon;
ContainerRecord tempContainer;
DoorRecord tempDoor;
BaseOverrides tempOverrides; BaseOverrides tempOverrides;
@ -337,7 +339,10 @@ void RecordsDynamicFunctions::SetRecordId(const char* id) noexcept
tempMiscellaneous.data.mId = id; tempMiscellaneous.data.mId = id;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mId = id; tempWeapon.data.mId = id;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.data.mId = id;
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mId = id;
else else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set id for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set id for record type %i which lacks that property", writeRecordsType);
} }
@ -366,6 +371,10 @@ void RecordsDynamicFunctions::SetRecordBaseId(const char* baseId) noexcept
tempMiscellaneous.baseId = baseId; tempMiscellaneous.baseId = baseId;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.baseId = baseId; tempWeapon.baseId = baseId;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.baseId = baseId;
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.baseId = baseId;
else else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set baseId for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set baseId for record type %i which lacks that property", writeRecordsType);
} }
@ -429,6 +438,10 @@ void RecordsDynamicFunctions::SetRecordName(const char* name) noexcept
tempMiscellaneous.data.mName = name; tempMiscellaneous.data.mName = name;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mName = name; tempWeapon.data.mName = name;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.data.mName = name;
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mName = name;
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set name for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set name for record type %i which lacks that property", writeRecordsType);
@ -458,6 +471,10 @@ void RecordsDynamicFunctions::SetRecordModel(const char* model) noexcept
tempMiscellaneous.data.mModel = model; tempMiscellaneous.data.mModel = model;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mModel = model; tempWeapon.data.mModel = model;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.data.mModel = model;
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mModel = model;
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set model for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set model for record type %i which lacks that property", writeRecordsType);
@ -512,6 +529,10 @@ void RecordsDynamicFunctions::SetRecordScript(const char* script) noexcept
tempMiscellaneous.data.mScript = script; tempMiscellaneous.data.mScript = script;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mScript = script; tempWeapon.data.mScript = script;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.data.mScript = script;
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mScript = script;
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set script for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set script for record type %i which lacks that property", writeRecordsType);
@ -687,6 +708,8 @@ void RecordsDynamicFunctions::SetRecordWeight(double weight) noexcept
tempMiscellaneous.data.mData.mWeight = weight; tempMiscellaneous.data.mData.mWeight = weight;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON) else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mData.mWeight = weight; tempWeapon.data.mData.mWeight = weight;
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.data.mWeight = weight;
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set weight for record type %i which lacks that property", writeRecordsType); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set weight for record type %i which lacks that property", writeRecordsType);
@ -1026,6 +1049,36 @@ void RecordsDynamicFunctions::SetRecordAIFight(int aiFight) noexcept
tempOverrides.hasAiFight = true; tempOverrides.hasAiFight = true;
} }
void RecordsDynamicFunctions::SetRecordOpenSound(const char* sound) noexcept
{
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mOpenSound = sound;
else
{
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set open sound for record type %i which lacks that property", writeRecordsType);
return;
}
tempOverrides.hasOpenSound = true;
}
void RecordsDynamicFunctions::SetRecordCloseSound(const char* sound) noexcept
{
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
tempDoor.data.mCloseSound = sound;
else
{
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Tried to set close sound for record type %i which lacks that property", writeRecordsType);
return;
}
tempOverrides.hasCloseSound = true;
}
void RecordsDynamicFunctions::SetRecordIdByIndex(unsigned int index, const char* id) noexcept void RecordsDynamicFunctions::SetRecordIdByIndex(unsigned int index, const char* id) noexcept
{ {
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType; unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
@ -1193,6 +1246,18 @@ void RecordsDynamicFunctions::AddRecord() noexcept
WorldstateFunctions::writeWorldstate.weaponRecords.push_back(tempWeapon); WorldstateFunctions::writeWorldstate.weaponRecords.push_back(tempWeapon);
tempWeapon = {}; tempWeapon = {};
} }
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
{
tempContainer.baseOverrides = tempOverrides;
WorldstateFunctions::writeWorldstate.containerRecords.push_back(tempContainer);
tempContainer = {};
}
else if (writeRecordsType == mwmp::RECORD_TYPE::DOOR)
{
tempDoor.baseOverrides = tempOverrides;
WorldstateFunctions::writeWorldstate.doorRecords.push_back(tempDoor);
tempDoor = {};
}
tempOverrides = {}; tempOverrides = {};
} }
@ -1233,6 +1298,8 @@ void RecordsDynamicFunctions::AddRecordInventoryItem() noexcept
tempCreature.inventory.push_back(tempInventoryItem); tempCreature.inventory.push_back(tempInventoryItem);
else if (writeRecordsType == mwmp::RECORD_TYPE::NPC) else if (writeRecordsType == mwmp::RECORD_TYPE::NPC)
tempNpc.inventory.push_back(tempInventoryItem); tempNpc.inventory.push_back(tempInventoryItem);
else if (writeRecordsType == mwmp::RECORD_TYPE::CONTAINER)
tempContainer.inventory.push_back(tempInventoryItem);
tempOverrides.hasInventory = true; tempOverrides.hasInventory = true;
tempInventoryItem = {}; tempInventoryItem = {};

@ -84,6 +84,9 @@
{"SetRecordFatigue", RecordsDynamicFunctions::SetRecordFatigue},\ {"SetRecordFatigue", RecordsDynamicFunctions::SetRecordFatigue},\
{"SetRecordAIFight", RecordsDynamicFunctions::SetRecordAIFight},\ {"SetRecordAIFight", RecordsDynamicFunctions::SetRecordAIFight},\
\ \
{"SetRecordOpenSound", RecordsDynamicFunctions::SetRecordOpenSound},\
{"SetRecordCloseSound", RecordsDynamicFunctions::SetRecordCloseSound},\
\
{"SetRecordIdByIndex", RecordsDynamicFunctions::SetRecordIdByIndex},\ {"SetRecordIdByIndex", RecordsDynamicFunctions::SetRecordIdByIndex},\
{"SetRecordEnchantmentIdByIndex", RecordsDynamicFunctions::SetRecordEnchantmentIdByIndex},\ {"SetRecordEnchantmentIdByIndex", RecordsDynamicFunctions::SetRecordEnchantmentIdByIndex},\
\ \
@ -712,6 +715,24 @@ public:
*/ */
static void SetRecordAIFight(int aiFight) noexcept; static void SetRecordAIFight(int aiFight) noexcept;
/**
* \brief Set the opening sound of the temporary record stored on the server for the
* currently specified record type.
*
* \param sound The opening sound of the record.
* \return void
*/
static void SetRecordOpenSound(const char* sound) noexcept;
/**
* \brief Set the closing sound of the temporary record stored on the server for the
* currently specified record type.
*
* \param sound The closing sound of the record.
* \return void
*/
static void SetRecordCloseSound(const char* sound) noexcept;
/** /**
* \brief Set the id of the record at a certain index in the records stored on the server. * \brief Set the id of the record at a certain index in the records stored on the server.
* *

@ -90,6 +90,20 @@ bool RecordHelper::doesWeaponRecordExist(const std::string& id)
return world->getStore().get<ESM::Weapon>().search(id); return world->getStore().get<ESM::Weapon>().search(id);
} }
bool RecordHelper::doesContainerRecordExist(const std::string& id)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
return world->getStore().get<ESM::Container>().search(id);
}
bool RecordHelper::doesDoorRecordExist(const std::string& id)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
return world->getStore().get<ESM::Door>().search(id);
}
std::string RecordHelper::createCreatureRecord(const ESM::Creature& record) std::string RecordHelper::createCreatureRecord(const ESM::Creature& record)
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
@ -843,6 +857,109 @@ void RecordHelper::overrideWeaponRecord(const mwmp::WeaponRecord& record)
world->updatePtrsWithRefId(recordData.mId); world->updatePtrsWithRefId(recordData.mId);
} }
void RecordHelper::overrideContainerRecord(const mwmp::ContainerRecord& record)
{
const ESM::Container &recordData = record.data;
if (recordData.mId.empty())
{
LOG_APPEND(Log::LOG_INFO, "-- Ignoring record override with no id provided");
return;
}
bool isExistingId = doesContainerRecordExist(recordData.mId);
MWBase::World *world = MWBase::Environment::get().getWorld();
if (record.baseId.empty())
{
world->getModifiableStore().overrideRecord(recordData);
}
else if (doesContainerRecordExist(record.baseId))
{
const ESM::Container *baseData = world->getStore().get<ESM::Container>().search(record.baseId);
ESM::Container finalData = *baseData;
finalData.mId = recordData.mId;
if (record.baseOverrides.hasName)
finalData.mName = recordData.mName;
if (record.baseOverrides.hasModel)
finalData.mModel = recordData.mModel;
if (record.baseOverrides.hasWeight)
finalData.mWeight = recordData.mWeight;
if (record.baseOverrides.hasFlags)
finalData.mFlags = recordData.mFlags;
if (record.baseOverrides.hasScript)
finalData.mScript = recordData.mScript;
if (record.baseOverrides.hasInventory)
finalData.mInventory.mList = recordData.mInventory.mList;
world->getModifiableStore().overrideRecord(finalData);
}
else
{
LOG_APPEND(Log::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str());
return;
}
if (isExistingId)
world->updatePtrsWithRefId(recordData.mId);
}
void RecordHelper::overrideDoorRecord(const mwmp::DoorRecord& record)
{
const ESM::Door &recordData = record.data;
if (recordData.mId.empty())
{
LOG_APPEND(Log::LOG_INFO, "-- Ignoring record override with no id provided");
return;
}
bool isExistingId = doesDoorRecordExist(recordData.mId);
MWBase::World *world = MWBase::Environment::get().getWorld();
if (record.baseId.empty())
{
world->getModifiableStore().overrideRecord(recordData);
}
else if (doesDoorRecordExist(record.baseId))
{
const ESM::Door *baseData = world->getStore().get<ESM::Door>().search(record.baseId);
ESM::Door finalData = *baseData;
finalData.mId = recordData.mId;
if (record.baseOverrides.hasName)
finalData.mName = recordData.mName;
if (record.baseOverrides.hasModel)
finalData.mModel = recordData.mModel;
if (record.baseOverrides.hasOpenSound)
finalData.mOpenSound = recordData.mOpenSound;
if (record.baseOverrides.hasCloseSound)
finalData.mCloseSound = recordData.mCloseSound;
if (record.baseOverrides.hasScript)
finalData.mScript = recordData.mScript;
world->getModifiableStore().overrideRecord(finalData);
}
else
{
LOG_APPEND(Log::LOG_INFO, "-- Ignoring record override with invalid baseId %s", record.baseId.c_str());
return;
}
if (isExistingId)
world->updatePtrsWithRefId(recordData.mId);
}
void RecordHelper::overrideCreatureRecord(const ESM::Creature& record) void RecordHelper::overrideCreatureRecord(const ESM::Creature& record)
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
@ -912,3 +1029,17 @@ void RecordHelper::overrideWeaponRecord(const ESM::Weapon& record)
world->getModifiableStore().overrideRecord(record); world->getModifiableStore().overrideRecord(record);
} }
void RecordHelper::overrideContainerRecord(const ESM::Container& record)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
world->getModifiableStore().overrideRecord(record);
}
void RecordHelper::overrideDoorRecord(const ESM::Door& record)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
world->getModifiableStore().overrideRecord(record);
}

@ -24,6 +24,9 @@ namespace RecordHelper
bool doesMiscellaneousRecordExist(const std::string& id); bool doesMiscellaneousRecordExist(const std::string& id);
bool doesWeaponRecordExist(const std::string& id); bool doesWeaponRecordExist(const std::string& id);
bool doesContainerRecordExist(const std::string& id);
bool doesDoorRecordExist(const std::string& id);
std::string createCreatureRecord(const ESM::Creature& record); std::string createCreatureRecord(const ESM::Creature& record);
std::string createNpcRecord(const ESM::NPC& record); std::string createNpcRecord(const ESM::NPC& record);
@ -40,6 +43,9 @@ namespace RecordHelper
void overrideMiscellaneousRecord(const mwmp::MiscellaneousRecord& record); void overrideMiscellaneousRecord(const mwmp::MiscellaneousRecord& record);
void overrideWeaponRecord(const mwmp::WeaponRecord& record); void overrideWeaponRecord(const mwmp::WeaponRecord& record);
void overrideContainerRecord(const mwmp::ContainerRecord& record);
void overrideDoorRecord(const mwmp::DoorRecord& record);
void overrideCreatureRecord(const ESM::Creature& record); void overrideCreatureRecord(const ESM::Creature& record);
void overrideNpcRecord(const ESM::NPC& record); void overrideNpcRecord(const ESM::NPC& record);
@ -52,6 +58,9 @@ namespace RecordHelper
void overrideClothingRecord(const ESM::Clothing& record); void overrideClothingRecord(const ESM::Clothing& record);
void overrideMiscellaneousRecord(const ESM::Miscellaneous& record); void overrideMiscellaneousRecord(const ESM::Miscellaneous& record);
void overrideWeaponRecord(const ESM::Weapon& record); void overrideWeaponRecord(const ESM::Weapon& record);
void overrideContainerRecord(const ESM::Container& record);
void overrideDoorRecord(const ESM::Door& record);
} }

@ -158,6 +158,30 @@ void Worldstate::addRecords()
RecordHelper::overrideWeaponRecord(record); RecordHelper::overrideWeaponRecord(record);
} }
} }
else if (recordsType == mwmp::RECORD_TYPE::CONTAINER)
{
for (auto &&record : containerRecords)
{
bool hasBaseId = !record.baseId.empty();
LOG_APPEND(Log::LOG_INFO, "- container record %s, %s\n-- baseId is %s", record.data.mId.c_str(), record.data.mName.c_str(),
hasBaseId ? record.baseId.c_str() : "empty");
RecordHelper::overrideContainerRecord(record);
}
}
else if (recordsType == mwmp::RECORD_TYPE::DOOR)
{
for (auto &&record : doorRecords)
{
bool hasBaseId = !record.baseId.empty();
LOG_APPEND(Log::LOG_INFO, "- door record %s, %s\n-- baseId is %s", record.data.mId.c_str(), record.data.mName.c_str(),
hasBaseId ? record.baseId.c_str() : "empty");
RecordHelper::overrideDoorRecord(record);
}
}
} }
bool Worldstate::containsExploredMapTile(int cellX, int cellY) bool Worldstate::containsExploredMapTile(int cellX, int cellY)

@ -7,7 +7,9 @@
#include <components/esm/loadarmo.hpp> #include <components/esm/loadarmo.hpp>
#include <components/esm/loadbook.hpp> #include <components/esm/loadbook.hpp>
#include <components/esm/loadclot.hpp> #include <components/esm/loadclot.hpp>
#include <components/esm/loadcont.hpp>
#include <components/esm/loadcrea.hpp> #include <components/esm/loadcrea.hpp>
#include <components/esm/loaddoor.hpp>
#include <components/esm/loadench.hpp> #include <components/esm/loadench.hpp>
#include <components/esm/loadmisc.hpp> #include <components/esm/loadmisc.hpp>
#include <components/esm/loadnpc.hpp> #include <components/esm/loadnpc.hpp>
@ -31,7 +33,9 @@ namespace mwmp
NPC, NPC,
POTION, POTION,
SPELL, SPELL,
WEAPON WEAPON,
CONTAINER,
DOOR
}; };
// When using an existing record as a base, this struct tracks which changes // When using an existing record as a base, this struct tracks which changes
@ -91,6 +95,9 @@ namespace mwmp
bool hasMagicka = false; bool hasMagicka = false;
bool hasFatigue = false; bool hasFatigue = false;
bool hasAiFight = false; bool hasAiFight = false;
bool hasOpenSound = false;
bool hasCloseSound = false;
}; };
struct ArmorRecord struct ArmorRecord
@ -114,6 +121,14 @@ namespace mwmp
BaseOverrides baseOverrides; BaseOverrides baseOverrides;
}; };
struct ContainerRecord
{
ESM::Container data;
std::string baseId;
std::vector<mwmp::Item> inventory;
BaseOverrides baseOverrides;
};
struct CreatureRecord struct CreatureRecord
{ {
ESM::Creature data; ESM::Creature data;
@ -123,6 +138,13 @@ namespace mwmp
BaseOverrides baseOverrides; BaseOverrides baseOverrides;
}; };
struct DoorRecord
{
ESM::Door data;
std::string baseId;
BaseOverrides baseOverrides;
};
struct EnchantmentRecord struct EnchantmentRecord
{ {
ESM::Enchantment data; ESM::Enchantment data;
@ -224,7 +246,9 @@ namespace mwmp
std::vector<ArmorRecord> armorRecords; std::vector<ArmorRecord> armorRecords;
std::vector<BookRecord> bookRecords; std::vector<BookRecord> bookRecords;
std::vector<ClothingRecord> clothingRecords; std::vector<ClothingRecord> clothingRecords;
std::vector<ContainerRecord> containerRecords;
std::vector<CreatureRecord> creatureRecords; std::vector<CreatureRecord> creatureRecords;
std::vector<DoorRecord> doorRecords;
std::vector<EnchantmentRecord> enchantmentRecords; std::vector<EnchantmentRecord> enchantmentRecords;
std::vector<MiscellaneousRecord> miscellaneousRecords; std::vector<MiscellaneousRecord> miscellaneousRecords;
std::vector<NpcRecord> npcRecords; std::vector<NpcRecord> npcRecords;

@ -40,6 +40,10 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *bs, bool send)
worldstate->recordsCount = Utils::getVectorSize(worldstate->miscellaneousRecords); worldstate->recordsCount = Utils::getVectorSize(worldstate->miscellaneousRecords);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::WEAPON) else if (worldstate->recordsType == mwmp::RECORD_TYPE::WEAPON)
worldstate->recordsCount = Utils::getVectorSize(worldstate->weaponRecords); worldstate->recordsCount = Utils::getVectorSize(worldstate->weaponRecords);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::CONTAINER)
worldstate->recordsCount = Utils::getVectorSize(worldstate->containerRecords);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::DOOR)
worldstate->recordsCount = Utils::getVectorSize(worldstate->doorRecords);
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Processed invalid ID_RECORD_DYNAMIC packet about unimplemented recordsType %i", LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Processed invalid ID_RECORD_DYNAMIC packet about unimplemented recordsType %i",
@ -80,6 +84,10 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *bs, bool send)
Utils::resetVector(worldstate->miscellaneousRecords, worldstate->recordsCount); Utils::resetVector(worldstate->miscellaneousRecords, worldstate->recordsCount);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::WEAPON) else if (worldstate->recordsType == mwmp::RECORD_TYPE::WEAPON)
Utils::resetVector(worldstate->weaponRecords, worldstate->recordsCount); Utils::resetVector(worldstate->weaponRecords, worldstate->recordsCount);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::CONTAINER)
Utils::resetVector(worldstate->containerRecords, worldstate->recordsCount);
else if (worldstate->recordsType == mwmp::RECORD_TYPE::DOOR)
Utils::resetVector(worldstate->doorRecords, worldstate->recordsCount);
} }
if (worldstate->recordsType == mwmp::RECORD_TYPE::SPELL) if (worldstate->recordsType == mwmp::RECORD_TYPE::SPELL)
@ -438,6 +446,58 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *bs, bool send)
} }
} }
} }
else if (worldstate->recordsType == mwmp::RECORD_TYPE::CONTAINER)
{
for (auto &&record : worldstate->containerRecords)
{
auto &recordData = record.data;
RW(record.baseId, send, true);
RW(recordData.mId, send, true);
RW(recordData.mName, send, true);
RW(recordData.mModel, send, true);
RW(recordData.mWeight, send);
RW(recordData.mFlags, send);
RW(recordData.mScript, send, true);
ProcessInventoryList(record.inventory, recordData.mInventory, send);
if (!record.baseId.empty())
{
auto &&overrides = record.baseOverrides;
RW(overrides.hasName, send);
RW(overrides.hasModel, send);
RW(overrides.hasWeight, send);
RW(overrides.hasFlags, send);
RW(overrides.hasScript, send);
RW(overrides.hasInventory, send);
}
}
}
else if (worldstate->recordsType == mwmp::RECORD_TYPE::DOOR)
{
for (auto &&record : worldstate->doorRecords)
{
auto &recordData = record.data;
RW(record.baseId, send, true);
RW(recordData.mId, send, true);
RW(recordData.mName, send, true);
RW(recordData.mModel, send, true);
RW(recordData.mOpenSound, send, true);
RW(recordData.mCloseSound, send, true);
RW(recordData.mScript, send, true);
if (!record.baseId.empty())
{
auto &&overrides = record.baseOverrides;
RW(overrides.hasName, send);
RW(overrides.hasModel, send);
RW(overrides.hasOpenSound, send);
RW(overrides.hasCloseSound, send);
RW(overrides.hasScript, send);
}
}
}
} }
void PacketRecordDynamic::ProcessEffects(ESM::EffectList &effectList, bool send) void PacketRecordDynamic::ProcessEffects(ESM::EffectList &effectList, bool send)

Loading…
Cancel
Save