mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 22:49:55 +00:00
b57807407a
Spell, potion, enchantment, creature, NPC, armor, book, clothing, miscellaneous and weapon record data can now be sent in a RecordDynamic packet. Additionally, the packets include data related to associated magical effects (for spells, potions and enchantments), data related to default inventory contents (for creatures and NPCs) and data related to body parts affected (for armor and clothing). The server now has associated script functions for setting most of the details of the above, with the main exception being individual creature and NPC stats. Records can either be created entirely from scratch or can use an existing record (set via the baseId variable) as a starting point for their values. In the latter case, only the values that are specifically set override the starting values. Creature and NPC records also have an inventoryBaseId that can be used on top of the baseId to base their inventories on another existing record. The client's RecordHelper class has been heavily expanded to allow for the above mentioned functionality. When players create spells, potions and enchantments as part of regular gameplay, they send RecordDynamic packets that provide the server with the complete details of the records that should be created. When they create enchantments, they also provide the server with armor, book, clothing and weapon records corresponding to the items they've enchanted. This functionality added by this packet was originally supposed to be exclusive to the rewrite, but I've gone ahead and tried to provide it for the pre-rewrite in a way that can mostly be reused for the rewrite.
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
#ifndef OPENMW_WORLDSTATE_HPP
|
|
#define OPENMW_WORLDSTATE_HPP
|
|
|
|
#include <components/openmw-mp/Base/BaseWorldstate.hpp>
|
|
|
|
namespace mwmp
|
|
{
|
|
class Networking;
|
|
class Worldstate : public BaseWorldstate
|
|
{
|
|
public:
|
|
|
|
Worldstate();
|
|
virtual ~Worldstate();
|
|
|
|
void addRecords();
|
|
|
|
bool containsExploredMapTile(int cellX, int cellY);
|
|
void markExploredMapTile(int cellX, int cellY);
|
|
|
|
void setMapExplored();
|
|
void setWeather();
|
|
|
|
void sendMapExplored(int cellX, int cellY, const std::vector<char>& imageData);
|
|
void sendWeather(std::string region, int currentWeather, int nextWeather, int queuedWeather, float transitionFactor);
|
|
|
|
void sendEnchantmentRecord(const ESM::Enchantment* enchantment);
|
|
void sendPotionRecord(const ESM::Potion* potion);
|
|
void sendSpellRecord(const ESM::Spell* spell);
|
|
|
|
void sendArmorRecord(const ESM::Armor* armor, std::string baseRefId = "");
|
|
void sendBookRecord(const ESM::Book* book, std::string baseRefId = "");
|
|
void sendClothingRecord(const ESM::Clothing* clothing, std::string baseRefId = "");
|
|
void sendWeaponRecord(const ESM::Weapon* weapon, std::string baseRefId = "");
|
|
|
|
private:
|
|
|
|
std::vector<MapTile> exploredMapTiles;
|
|
|
|
Networking *getNetworking();
|
|
|
|
};
|
|
}
|
|
|
|
#endif //OPENMW_WORLDSTATE_HPP
|