2017-04-09 09:24:33 +00:00
|
|
|
#include <regex>
|
|
|
|
|
|
|
|
#include <apps/openmw-mp/Player.hpp>
|
|
|
|
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
|
|
|
#include <apps/openmw-mp/Networking.hpp>
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include <components/openmw-mp/Base/BaseActor.hpp>
|
|
|
|
#include "Actors.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
BaseActorList scriptActorList;
|
2017-04-09 09:24:33 +00:00
|
|
|
BaseActor tempActor;
|
|
|
|
|
|
|
|
void ActorFunctions::InitActorList(unsigned short pid) noexcept
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
scriptActorList.cell.blank();
|
|
|
|
scriptActorList.baseActors.clear();
|
|
|
|
scriptActorList.guid = player->guid;
|
2017-04-09 09:24:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int ActorFunctions::GetActorListSize() noexcept
|
|
|
|
{
|
|
|
|
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.count;
|
|
|
|
}
|
2017-04-09 13:32:44 +00:00
|
|
|
|
|
|
|
void ActorFunctions::SendActorList() noexcept
|
|
|
|
{
|
|
|
|
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->setActorList(&scriptActorList);
|
|
|
|
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->Send(scriptActorList.guid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActorFunctions::SendActorAuthority() noexcept
|
|
|
|
{
|
|
|
|
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->setActorList(&scriptActorList);
|
|
|
|
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptActorList.guid);
|
|
|
|
}
|
|
|
|
|