forked from mirror/openmw-tes3mp
Add preliminary structure for journal changes
This commit is contained in:
parent
e9b22814b9
commit
e2c595fc5d
7 changed files with 47 additions and 1 deletions
|
@ -247,6 +247,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
DEBUG_PRINTF("ID_GAME_JOURNAL\n");
|
DEBUG_PRINTF("ID_GAME_JOURNAL\n");
|
||||||
myPacket->Read(player);
|
myPacket->Read(player);
|
||||||
|
|
||||||
|
Script::Call<Script::CallbackIdentity("OnPlayerChangeJournal")>(player->getId(), player->packetSpells.action);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ public:
|
||||||
{"OnPlayerChangeEquipment", Function<void, unsigned short>()},
|
{"OnPlayerChangeEquipment", Function<void, unsigned short>()},
|
||||||
{"OnPlayerChangeInventory", Function<void, unsigned short>()},
|
{"OnPlayerChangeInventory", Function<void, unsigned short>()},
|
||||||
{"OnPlayerChangeSpellbook", Function<void, unsigned short, int>()},
|
{"OnPlayerChangeSpellbook", Function<void, unsigned short, int>()},
|
||||||
|
{"OnPlayerChangeJournal", Function<void, unsigned short>()},
|
||||||
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
|
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
|
||||||
{"OnPlayerEndCharGen", Function<void, unsigned short>()},
|
{"OnPlayerEndCharGen", Function<void, unsigned short>()},
|
||||||
{"OnGUIAction", Function<void, unsigned short, int, const char*>()}
|
{"OnGUIAction", Function<void, unsigned short, int, const char*>()}
|
||||||
|
|
|
@ -998,6 +998,16 @@ void LocalPlayer::sendSpellRemoval(const ESM::Spell &spell)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Not implemented.");
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalPlayer::sendJournalEntry(const std::string& id, int index, const MWWorld::Ptr& actor)
|
||||||
|
{
|
||||||
|
Main::get().getNetworking()->getPlayerPacket(ID_GAME_JOURNAL)->Send(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalPlayer::sendJournalIndex(const std::string& id, int index)
|
||||||
|
{
|
||||||
|
Main::get().getNetworking()->getPlayerPacket(ID_GAME_JOURNAL)->Send(this);
|
||||||
|
}
|
||||||
|
|
||||||
void LocalPlayer::sendAttack(Attack::TYPE type)
|
void LocalPlayer::sendAttack(Attack::TYPE type)
|
||||||
{
|
{
|
||||||
MWMechanics::DrawState_ state = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
|
MWMechanics::DrawState_ state = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
|
||||||
|
|
|
@ -60,6 +60,8 @@ namespace mwmp
|
||||||
void sendSpellAddition(const ESM::Spell &spell);
|
void sendSpellAddition(const ESM::Spell &spell);
|
||||||
void sendSpellRemoval(std::string id);
|
void sendSpellRemoval(std::string id);
|
||||||
void sendSpellRemoval(const ESM::Spell &spell);
|
void sendSpellRemoval(const ESM::Spell &spell);
|
||||||
|
void sendJournalEntry(const std::string& id, int index, const MWWorld::Ptr& actor);
|
||||||
|
void sendJournalIndex(const std::string& id, int index);
|
||||||
void sendAttack(Attack::TYPE type);
|
void sendAttack(Attack::TYPE type);
|
||||||
|
|
||||||
void prepareAttack(Attack::TYPE type, bool state);
|
void prepareAttack(Attack::TYPE type, bool state);
|
||||||
|
|
|
@ -323,7 +323,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
{
|
{
|
||||||
if (packet->length == myPacket->headerSize())
|
if (packet->length == myPacket->headerSize())
|
||||||
{
|
{
|
||||||
|
getLocalPlayer()->sendSpellbook();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "dialogueextensions.hpp"
|
#include "dialogueextensions.hpp"
|
||||||
|
|
||||||
|
#include "../mwmp/Main.hpp"
|
||||||
|
#include "../mwmp/LocalPlayer.hpp"
|
||||||
|
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
#include <components/compiler/opcodes.hpp>
|
#include <components/compiler/opcodes.hpp>
|
||||||
|
|
||||||
|
@ -43,6 +46,11 @@ namespace MWScript
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getJournal()->addEntry (quest, index, ptr);
|
MWBase::Environment::get().getJournal()->addEntry (quest, index, ptr);
|
||||||
|
|
||||||
|
// Added by tes3mp
|
||||||
|
//
|
||||||
|
// LocalPlayer has gained a journal entry, so send a packet with it
|
||||||
|
mwmp::Main::get().getLocalPlayer()->sendJournalEntry(quest, index, ptr);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +73,11 @@ namespace MWScript
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
MWBase::Environment::get().getJournal()->setJournalIndex (quest, index);
|
MWBase::Environment::get().getJournal()->setJournalIndex (quest, index);
|
||||||
|
|
||||||
|
// Added by tes3mp
|
||||||
|
//
|
||||||
|
// LocalPlayer has gained a journal index, so send a packet with it
|
||||||
|
mwmp::Main::get().getLocalPlayer()->sendJournalIndex(quest, index);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,24 @@ namespace mwmp
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct JournalItem
|
||||||
|
{
|
||||||
|
std::string quest;
|
||||||
|
int index;
|
||||||
|
enum JOURNAL_ITEM_TYPE
|
||||||
|
{
|
||||||
|
ENTRY = 0,
|
||||||
|
INDEX = 1
|
||||||
|
};
|
||||||
|
int type; // 0 - An entire entry, 1 - An index
|
||||||
|
};
|
||||||
|
|
||||||
|
struct JournalChanges
|
||||||
|
{
|
||||||
|
std::vector<JournalItem> journalItems;
|
||||||
|
unsigned int count;
|
||||||
|
};
|
||||||
|
|
||||||
struct PacketItems
|
struct PacketItems
|
||||||
{
|
{
|
||||||
std::vector<Item> items;
|
std::vector<Item> items;
|
||||||
|
|
Loading…
Reference in a new issue