forked from mirror/openmw-tes3mp
[General] Stop using virtual functions in BasePlayer
This commit is contained in:
parent
c62a575a9e
commit
63c8a98083
30 changed files with 365 additions and 444 deletions
|
@ -65,7 +65,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong handshake with player %d, name: %s",
|
||||
player->getId(),
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
kickPlayer(player->guid);
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Wrong server password for player %d, name: %s (pass: %s)",
|
||||
player->getId(),
|
||||
player->Npc()->mName.c_str(),
|
||||
player->npc.mName.c_str(),
|
||||
player->getPassw()->c_str());
|
||||
kickPlayer(player->guid);
|
||||
return;
|
||||
|
@ -109,7 +109,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
else if (packet->data[0] == ID_GAME_BASE_INFO)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO about %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
@ -129,7 +129,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_BASE_INFO:
|
||||
{
|
||||
/*LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO about %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);*/
|
||||
|
@ -140,7 +140,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
//DEBUG_PRINTF("ID_GAME_POS \n");
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true); //send to other clients
|
||||
|
@ -151,9 +151,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_PLAYER_CELL_CHANGE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_CHANGE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
|
||||
|
@ -166,7 +166,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
else
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Ignored because %s is dead",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -174,7 +174,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_PLAYER_CELL_LOAD:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_LOAD from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerCellLoad")>(player->getId());
|
||||
|
||||
|
@ -183,7 +183,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_ATTRIBUTE:
|
||||
{
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
@ -196,7 +196,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_SKILL:
|
||||
{
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
@ -209,7 +209,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_LEVEL:
|
||||
{
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
myPacket->Send(player, true);
|
||||
|
@ -265,30 +265,30 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
DEBUG_PRINTF("ID_GAME_ATTACK\n");
|
||||
|
||||
if (!player->CreatureStats()->mDead)
|
||||
if (!player->creatureStats.mDead)
|
||||
{
|
||||
myPacket->Read(player);
|
||||
|
||||
Player *target = Players::getPlayer(player->getAttack()->target);
|
||||
Player *target = Players::getPlayer(player->attack.target);
|
||||
|
||||
if (target == nullptr)
|
||||
target = player;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Player: %s attacked %s state: %d", player->Npc()->mName.c_str(),
|
||||
target->Npc()->mName.c_str(), player->getAttack()->pressed == 1);
|
||||
if (player->getAttack()->pressed == 0)
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Player: %s attacked %s state: %d", player->npc.mName.c_str(),
|
||||
target->Npc()->mName.c_str(), player->attack.pressed == 1);
|
||||
if (player->attack.pressed == 0)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "success: %d", player->getAttack()->success == 1);
|
||||
if (player->getAttack()->success == 1)
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "success: %d", player->attack.success == 1);
|
||||
if (player->attack.success == 1)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "damage: %d", player->getAttack()->damage == 1);
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "damage: %d", player->attack.damage == 1);
|
||||
target->setLastAttackerId(player->getId());
|
||||
target->setLastAttackerTime(std::chrono::steady_clock::now());
|
||||
}
|
||||
}
|
||||
|
||||
myPacket->Send(player, true);
|
||||
playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->getAttack()->target);
|
||||
playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->attack.target);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
case ID_GAME_DIE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
Player *killer = Players::getPlayer(player->getLastAttackerId());
|
||||
|
||||
|
@ -322,7 +322,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
player->resetLastAttacker();
|
||||
|
||||
player->CreatureStats()->mDead = true;
|
||||
player->creatureStats.mDead = true;
|
||||
myPacket->Send(player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player->getId(), reason, killer->getId());
|
||||
|
@ -334,7 +334,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
DEBUG_PRINTF("ID_GAME_RESURRECT\n");
|
||||
//packetResurrect.Read(player);
|
||||
player->CreatureStats()->mDead = false;
|
||||
player->creatureStats.mDead = false;
|
||||
myPacket->Send(player, true);
|
||||
playerController->GetPacket(ID_GAME_POS)->RequestData(player->guid);
|
||||
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(player->guid);
|
||||
|
@ -361,8 +361,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
if (result)
|
||||
{
|
||||
*player->ChatMessage() = player->Npc()->mName + " (" + std::to_string(player->getId()) + "): "
|
||||
+ *player->ChatMessage() + "\n";
|
||||
player->chatMessage = player->npc.mName + " (" + std::to_string(player->getId()) + "): "
|
||||
+ player->chatMessage + "\n";
|
||||
myPacket->Send(player, false);
|
||||
myPacket->Send(player, true);
|
||||
}
|
||||
|
@ -373,10 +373,10 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
DEBUG_PRINTF("ID_GAME_CHARGEN\n");
|
||||
myPacket->Read(player);
|
||||
|
||||
if (player->CharGenStage()->current == player->CharGenStage()->end && player->CharGenStage()->current != 0)
|
||||
if (player->charGenStage.current == player->charGenStage.end && player->charGenStage.current != 0)
|
||||
{
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player->getId());
|
||||
cout << "RACE: " << player->Npc()->mRace << endl;
|
||||
cout << "RACE: " << player->npc.mRace << endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_PLACE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
myPacket->Send(event, true);
|
||||
|
@ -439,7 +439,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_DELETE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -462,7 +462,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_LOCK:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -479,7 +479,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_UNLOCK:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -496,7 +496,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_SCALE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -513,7 +513,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_MOVE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -530,7 +530,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_ROTATE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -547,7 +547,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_OBJECT_ANIM_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -564,7 +564,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_CONTAINER_ADD:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER_ADD from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -581,7 +581,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_CONTAINER_REMOVE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER_REMOVE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -598,7 +598,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_DOOR_ACTIVATE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_ACTIVATE from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -615,7 +615,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_MUSIC_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -630,7 +630,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_VIDEO_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -646,7 +646,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_SCRIPT_LOCAL_SHORT:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -663,7 +663,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_SCRIPT_LOCAL_FLOAT:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -680,7 +680,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_SCRIPT_MEMBER_SHORT:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -695,7 +695,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
case ID_SCRIPT_GLOBAL_SHORT:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s",
|
||||
player->Npc()->mName.c_str());
|
||||
player->npc.mName.c_str());
|
||||
|
||||
myPacket->Read(event);
|
||||
|
||||
|
@ -890,7 +890,7 @@ int Networking::mainLoop()
|
|||
bs.Write((unsigned char) ID_MASTER_QUERY);
|
||||
bs.Write(Players::getPlayers()->size());
|
||||
for(auto player : *Players::getPlayers())
|
||||
bs.Write(RakNet::RakString(player.second->Npc()->mName.c_str()));
|
||||
bs.Write(RakNet::RakString(player.second->npc.mName.c_str()));
|
||||
bs.Write(0); // plugins
|
||||
peer->Send(&bs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, packet->systemAddress, false);
|
||||
break;
|
||||
|
|
|
@ -30,10 +30,10 @@ void Players::newPlayer(RakNet::RakNetGUID guid)
|
|||
guid.g);
|
||||
|
||||
players[guid] = new Player(guid);
|
||||
players[guid]->getCell()->blank();
|
||||
players[guid]->Npc()->blank();
|
||||
players[guid]->NpcStats()->blank();
|
||||
players[guid]->CreatureStats()->blank();
|
||||
players[guid]->cell.blank();
|
||||
players[guid]->npc.blank();
|
||||
players[guid]->npcStats.blank();
|
||||
players[guid]->creatureStats.blank();
|
||||
players[guid]->charClass.blank();
|
||||
|
||||
for (unsigned int i = 0; i < mwmp::Networking::get().maxConnections(); i++)
|
||||
|
|
|
@ -29,9 +29,9 @@ void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const cha
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->EquipedItem(slot)->refid = itemId;
|
||||
player->EquipedItem(slot)->count = count;
|
||||
player->EquipedItem(slot)->health = health;
|
||||
player->equipedItems[slot].refid = itemId;
|
||||
player->equipedItems[slot].count = count;
|
||||
player->equipedItems[slot].health = health;
|
||||
}
|
||||
|
||||
void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept
|
||||
|
@ -84,7 +84,7 @@ bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemId)
|
|||
GET_PLAYER(pid, player, false);
|
||||
|
||||
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++)
|
||||
if (Misc::StringUtils::ciEqual(player->EquipedItem(slot)->refid, itemId))
|
||||
if (Misc::StringUtils::ciEqual(player->equipedItems[slot].refid, itemId))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ const char *ItemFunctions::GetEquipmentItemId(unsigned short pid, unsigned short
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->EquipedItem(slot)->refid.c_str();
|
||||
return player->equipedItems[slot].refid.c_str();
|
||||
}
|
||||
|
||||
int ItemFunctions::GetEquipmentItemCount(unsigned short pid, unsigned short slot) noexcept
|
||||
|
@ -102,7 +102,7 @@ int ItemFunctions::GetEquipmentItemCount(unsigned short pid, unsigned short slot
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->EquipedItem(slot)->count;
|
||||
return player->equipedItems[slot].count;
|
||||
}
|
||||
|
||||
int ItemFunctions::GetEquipmentItemHealth(unsigned short pid, unsigned short slot) noexcept
|
||||
|
@ -110,7 +110,7 @@ int ItemFunctions::GetEquipmentItemHealth(unsigned short pid, unsigned short slo
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->EquipedItem(slot)->health;
|
||||
return player->equipedItems[slot].health;
|
||||
}
|
||||
|
||||
const char *ItemFunctions::GetInventoryItemId(unsigned short pid, unsigned int i) noexcept
|
||||
|
|
|
@ -20,10 +20,10 @@ void StatsFunctions::SetName(unsigned short pid, const char *name) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
if (player->Npc()->mName == name)
|
||||
if (player->npc.mName == name)
|
||||
return;
|
||||
|
||||
player->Npc()->mName = name;
|
||||
player->npc.mName = name;
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetName(unsigned short pid) noexcept
|
||||
|
@ -32,7 +32,7 @@ const char *StatsFunctions::GetName(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->Npc()->mName.c_str();
|
||||
return player->npc.mName.c_str();
|
||||
}
|
||||
|
||||
void StatsFunctions::SetBirthsign(unsigned short pid, const char *sign) noexcept
|
||||
|
@ -40,10 +40,10 @@ void StatsFunctions::SetBirthsign(unsigned short pid, const char *sign) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
if (*player->BirthSign() == sign)
|
||||
if (player->birthsign == sign)
|
||||
return;
|
||||
|
||||
*player->BirthSign() = sign;
|
||||
player->birthsign = sign;
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetBirthsign(unsigned short pid) noexcept
|
||||
|
@ -52,8 +52,7 @@ const char *StatsFunctions::GetBirthsign(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
|
||||
return player->BirthSign()->c_str();
|
||||
return player->birthsign.c_str();
|
||||
}
|
||||
|
||||
void StatsFunctions::SetRace(unsigned short pid, const char *race) noexcept
|
||||
|
@ -61,15 +60,15 @@ void StatsFunctions::SetRace(unsigned short pid, const char *race) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
if (player->Npc()->mRace == race)
|
||||
if (player->npc.mRace == race)
|
||||
return;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Setting race for %s: %s -> %s",
|
||||
player->Npc()->mName.c_str(),
|
||||
player->Npc()->mRace.c_str(),
|
||||
player->npc.mName.c_str(),
|
||||
player->npc.mRace.c_str(),
|
||||
race);
|
||||
|
||||
player->Npc()->mRace = race;
|
||||
player->npc.mRace = race;
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetRace(unsigned short pid) noexcept
|
||||
|
@ -77,7 +76,7 @@ const char *StatsFunctions::GetRace(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->Npc()->mRace.c_str();
|
||||
return player->npc.mRace.c_str();
|
||||
}
|
||||
|
||||
void StatsFunctions::SetHead(unsigned short pid, const char *head) noexcept
|
||||
|
@ -85,10 +84,10 @@ void StatsFunctions::SetHead(unsigned short pid, const char *head) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
if (player->Npc()->mHead == head)
|
||||
if (player->npc.mHead == head)
|
||||
return;
|
||||
|
||||
player->Npc()->mHead = head;
|
||||
player->npc.mHead = head;
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetHead(unsigned short pid) noexcept
|
||||
|
@ -96,7 +95,7 @@ const char *StatsFunctions::GetHead(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->Npc()->mHead.c_str();
|
||||
return player->npc.mHead.c_str();
|
||||
}
|
||||
|
||||
void StatsFunctions::SetHairstyle(unsigned short pid, const char *style) noexcept
|
||||
|
@ -104,10 +103,10 @@ void StatsFunctions::SetHairstyle(unsigned short pid, const char *style) noexcep
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
if (player->Npc()->mHair == style)
|
||||
if (player->npc.mHair == style)
|
||||
return;
|
||||
|
||||
player->Npc()->mHair = style;
|
||||
player->npc.mHair = style;
|
||||
}
|
||||
|
||||
const char *StatsFunctions::GetHairstyle(unsigned short pid) noexcept
|
||||
|
@ -115,7 +114,7 @@ const char *StatsFunctions::GetHairstyle(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->Npc()->mHair.c_str();
|
||||
return player->npc.mHair.c_str();
|
||||
}
|
||||
|
||||
int StatsFunctions::GetIsMale(unsigned short pid) noexcept
|
||||
|
@ -123,7 +122,7 @@ int StatsFunctions::GetIsMale(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,false);
|
||||
|
||||
return player->Npc()->isMale();
|
||||
return player->npc.isMale();
|
||||
}
|
||||
|
||||
void StatsFunctions::SetIsMale(unsigned short pid, int value) noexcept
|
||||
|
@ -131,7 +130,7 @@ void StatsFunctions::SetIsMale(unsigned short pid, int value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->Npc()->setIsMale(value == true);
|
||||
player->npc.setIsMale(value == true);
|
||||
}
|
||||
|
||||
int StatsFunctions::GetLevel(unsigned short pid) noexcept
|
||||
|
@ -139,7 +138,7 @@ int StatsFunctions::GetLevel(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mLevel;
|
||||
return player->creatureStats.mLevel;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetLevel(unsigned short pid, int value) noexcept
|
||||
|
@ -147,7 +146,7 @@ void StatsFunctions::SetLevel(unsigned short pid, int value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->CreatureStats()->mLevel = value;
|
||||
player->creatureStats.mLevel = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetLevelProgress(unsigned short pid) noexcept
|
||||
|
@ -155,7 +154,7 @@ int StatsFunctions::GetLevelProgress(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->NpcStats()->mLevelProgress;
|
||||
return player->npcStats.mLevelProgress;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetLevelProgress(unsigned short pid, int value) noexcept
|
||||
|
@ -163,7 +162,7 @@ void StatsFunctions::SetLevelProgress(unsigned short pid, int value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->NpcStats()->mLevelProgress = value;
|
||||
player->npcStats.mLevelProgress = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetHealthBase(unsigned short pid) noexcept
|
||||
|
@ -171,7 +170,7 @@ double StatsFunctions::GetHealthBase(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[0].mBase;
|
||||
return player->creatureStats.mDynamic[0].mBase;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetHealthBase(unsigned short pid, double value) noexcept
|
||||
|
@ -179,7 +178,7 @@ void StatsFunctions::SetHealthBase(unsigned short pid, double value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[0].mBase = value;
|
||||
player->creatureStats.mDynamic[0].mBase = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetHealthCurrent(unsigned short pid) noexcept
|
||||
|
@ -187,7 +186,7 @@ double StatsFunctions::GetHealthCurrent(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[0].mCurrent;
|
||||
return player->creatureStats.mDynamic[0].mCurrent;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetHealthCurrent(unsigned short pid, double value) noexcept
|
||||
|
@ -195,7 +194,7 @@ void StatsFunctions::SetHealthCurrent(unsigned short pid, double value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[0].mCurrent = value;
|
||||
player->creatureStats.mDynamic[0].mCurrent = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetMagickaBase(unsigned short pid) noexcept
|
||||
|
@ -203,7 +202,7 @@ double StatsFunctions::GetMagickaBase(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[1].mBase;
|
||||
return player->creatureStats.mDynamic[1].mBase;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetMagickaBase(unsigned short pid, double value) noexcept
|
||||
|
@ -211,7 +210,7 @@ void StatsFunctions::SetMagickaBase(unsigned short pid, double value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[1].mBase = value;
|
||||
player->creatureStats.mDynamic[1].mBase = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetMagickaCurrent(unsigned short pid) noexcept
|
||||
|
@ -219,7 +218,7 @@ double StatsFunctions::GetMagickaCurrent(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[1].mCurrent;
|
||||
return player->creatureStats.mDynamic[1].mCurrent;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetMagickaCurrent(unsigned short pid, double value) noexcept
|
||||
|
@ -227,7 +226,7 @@ void StatsFunctions::SetMagickaCurrent(unsigned short pid, double value) noexcep
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[1].mCurrent = value;
|
||||
player->creatureStats.mDynamic[1].mCurrent = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetFatigueBase(unsigned short pid) noexcept
|
||||
|
@ -235,7 +234,7 @@ double StatsFunctions::GetFatigueBase(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[2].mBase;
|
||||
return player->creatureStats.mDynamic[2].mBase;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetFatigueBase(unsigned short pid, double value) noexcept
|
||||
|
@ -243,7 +242,7 @@ void StatsFunctions::SetFatigueBase(unsigned short pid, double value) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[2].mBase = value;
|
||||
player->creatureStats.mDynamic[2].mBase = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetFatigueCurrent(unsigned short pid) noexcept
|
||||
|
@ -251,7 +250,7 @@ double StatsFunctions::GetFatigueCurrent(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->CreatureStats()->mDynamic[2].mCurrent;
|
||||
return player->creatureStats.mDynamic[2].mCurrent;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetFatigueCurrent(unsigned short pid, double value) noexcept
|
||||
|
@ -259,7 +258,7 @@ void StatsFunctions::SetFatigueCurrent(unsigned short pid, double value) noexcep
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CreatureStats()->mDynamic[2].mCurrent = value;
|
||||
player->creatureStats.mDynamic[2].mCurrent = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetAttributeCount() noexcept
|
||||
|
@ -322,7 +321,7 @@ int StatsFunctions::GetAttributeBase(unsigned short pid, unsigned short attribut
|
|||
if (attribute >= Attribute::Length)
|
||||
return 0;
|
||||
|
||||
return player->CreatureStats()->mAttributes[attribute].mBase;
|
||||
return player->creatureStats.mAttributes[attribute].mBase;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetAttributeBase(unsigned short pid, unsigned short attribute, int value) noexcept
|
||||
|
@ -333,7 +332,7 @@ void StatsFunctions::SetAttributeBase(unsigned short pid, unsigned short attribu
|
|||
if (attribute >= Attribute::Length)
|
||||
return;
|
||||
|
||||
player->CreatureStats()->mAttributes[attribute].mBase = value;
|
||||
player->creatureStats.mAttributes[attribute].mBase = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetAttributeCurrent(unsigned short pid, unsigned short attribute) noexcept
|
||||
|
@ -344,7 +343,7 @@ int StatsFunctions::GetAttributeCurrent(unsigned short pid, unsigned short attri
|
|||
if (attribute >= Attribute::Length)
|
||||
return 0;
|
||||
|
||||
return player->CreatureStats()->mAttributes[attribute].mCurrent;
|
||||
return player->creatureStats.mAttributes[attribute].mCurrent;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetAttributeCurrent(unsigned short pid, unsigned short attribute, int value) noexcept
|
||||
|
@ -355,7 +354,7 @@ void StatsFunctions::SetAttributeCurrent(unsigned short pid, unsigned short attr
|
|||
if (attribute >= Attribute::Length)
|
||||
return;
|
||||
|
||||
player->CreatureStats()->mAttributes[attribute].mCurrent = value;
|
||||
player->creatureStats.mAttributes[attribute].mCurrent = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetSkillBase(unsigned short pid, unsigned short skill) noexcept
|
||||
|
@ -366,7 +365,7 @@ int StatsFunctions::GetSkillBase(unsigned short pid, unsigned short skill) noexc
|
|||
if (skill >= Skill::Length)
|
||||
return 0;
|
||||
|
||||
return player->NpcStats()->mSkills[skill].mBase;
|
||||
return player->npcStats.mSkills[skill].mBase;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetSkillBase(unsigned short pid, unsigned short skill, int value) noexcept //TODO: need packet for one value
|
||||
|
@ -377,7 +376,7 @@ void StatsFunctions::SetSkillBase(unsigned short pid, unsigned short skill, int
|
|||
if (skill >= Skill::Length)
|
||||
return;
|
||||
|
||||
player->NpcStats()->mSkills[skill].mBase = value;
|
||||
player->npcStats.mSkills[skill].mBase = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetSkillCurrent(unsigned short pid, unsigned short skill) noexcept
|
||||
|
@ -388,7 +387,7 @@ int StatsFunctions::GetSkillCurrent(unsigned short pid, unsigned short skill) no
|
|||
if (skill >= Skill::Length)
|
||||
return 0;
|
||||
|
||||
return player->NpcStats()->mSkills[skill].mCurrent;
|
||||
return player->npcStats.mSkills[skill].mCurrent;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetSkillCurrent(unsigned short pid, unsigned short skill, int value) noexcept //TODO: need packet for one value
|
||||
|
@ -399,7 +398,7 @@ void StatsFunctions::SetSkillCurrent(unsigned short pid, unsigned short skill, i
|
|||
if (skill >= Skill::Length)
|
||||
return;
|
||||
|
||||
player->NpcStats()->mSkills[skill].mCurrent = value;
|
||||
player->npcStats.mSkills[skill].mCurrent = value;
|
||||
}
|
||||
|
||||
double StatsFunctions::GetSkillProgress(unsigned short pid, unsigned short skill) noexcept
|
||||
|
@ -410,7 +409,7 @@ double StatsFunctions::GetSkillProgress(unsigned short pid, unsigned short skill
|
|||
if (skill >= Skill::Length)
|
||||
return 0;
|
||||
|
||||
return player->NpcStats()->mSkills[skill].mProgress;
|
||||
return player->npcStats.mSkills[skill].mProgress;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetSkillProgress(unsigned short pid, unsigned short skill, double value) noexcept
|
||||
|
@ -421,7 +420,7 @@ void StatsFunctions::SetSkillProgress(unsigned short pid, unsigned short skill,
|
|||
if (skill >= Skill::Length)
|
||||
return;
|
||||
|
||||
player->NpcStats()->mSkills[skill].mProgress = value;
|
||||
player->npcStats.mSkills[skill].mProgress = value;
|
||||
}
|
||||
|
||||
int StatsFunctions::GetSkillIncrease(unsigned short pid, unsigned int attribute) noexcept
|
||||
|
@ -432,7 +431,7 @@ int StatsFunctions::GetSkillIncrease(unsigned short pid, unsigned int attribute)
|
|||
if (attribute > Attribute::Length)
|
||||
return 0;
|
||||
|
||||
return player->NpcStats()->mSkillIncrease[attribute];
|
||||
return player->npcStats.mSkillIncrease[attribute];
|
||||
}
|
||||
|
||||
void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned int attribute, int value) noexcept // TODO: need packet for transmit it
|
||||
|
@ -443,7 +442,7 @@ void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned int attribute
|
|||
if (attribute > Attribute::Length)
|
||||
return;
|
||||
|
||||
player->NpcStats()->mSkillIncrease[attribute] = value;
|
||||
player->npcStats.mSkillIncrease[attribute] = value;
|
||||
}
|
||||
|
||||
void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noexcept
|
||||
|
@ -451,8 +450,8 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->CharGenStage()->current = start;
|
||||
player->CharGenStage()->end = end;
|
||||
player->charGenStage.current = start;
|
||||
player->charGenStage.end = end;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CHARGEN)->Send(player, false);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ void TranslocationFunctions::GetPos(unsigned short pid, float *x, float *y, floa
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
*x = player->Position()->pos[0];
|
||||
*y = player->Position()->pos[1];
|
||||
*z = player->Position()->pos[2];
|
||||
*x = player->position.pos[0];
|
||||
*y = player->position.pos[1];
|
||||
*z = player->position.pos[2];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetPosX(unsigned short pid) noexcept
|
||||
|
@ -30,7 +30,7 @@ double TranslocationFunctions::GetPosX(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->pos[0];
|
||||
return player->position.pos[0];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetPosY(unsigned short pid) noexcept
|
||||
|
@ -38,7 +38,7 @@ double TranslocationFunctions::GetPosY(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->pos[1];
|
||||
return player->position.pos[1];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetPosZ(unsigned short pid) noexcept
|
||||
|
@ -46,7 +46,7 @@ double TranslocationFunctions::GetPosZ(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->pos[2];
|
||||
return player->position.pos[2];
|
||||
}
|
||||
|
||||
void TranslocationFunctions::GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept
|
||||
|
@ -58,9 +58,9 @@ void TranslocationFunctions::GetAngle(unsigned short pid, float *x, float *y, fl
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
*x = player->Position()->rot[0];
|
||||
*y = player->Position()->rot[1];
|
||||
*z = player->Position()->rot[2];
|
||||
*x = player->position.rot[0];
|
||||
*y = player->position.rot[1];
|
||||
*z = player->position.rot[2];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
|
||||
|
@ -68,7 +68,7 @@ double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->rot[0];
|
||||
return player->position.rot[0];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
|
||||
|
@ -76,7 +76,7 @@ double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->rot[1];
|
||||
return player->position.rot[1];
|
||||
}
|
||||
|
||||
double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
|
||||
|
@ -84,7 +84,7 @@ double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0.0f);
|
||||
|
||||
return player->Position()->rot[2];
|
||||
return player->position.rot[2];
|
||||
}
|
||||
|
||||
void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept
|
||||
|
@ -92,9 +92,9 @@ void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, doub
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->Position()->pos[0] = x;
|
||||
player->Position()->pos[1] = y;
|
||||
player->Position()->pos[2] = z;
|
||||
player->position.pos[0] = x;
|
||||
player->position.pos[1] = y;
|
||||
player->position.pos[2] = z;
|
||||
}
|
||||
|
||||
void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
|
||||
|
@ -102,9 +102,9 @@ void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, do
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->Position()->rot[0] = x;
|
||||
player->Position()->rot[1] = y;
|
||||
player->Position()->rot[2] = z;
|
||||
player->position.rot[0] = x;
|
||||
player->position.rot[1] = y;
|
||||
player->position.rot[2] = z;
|
||||
}
|
||||
|
||||
const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
|
||||
|
@ -112,7 +112,7 @@ const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->getCell()->mName.c_str();
|
||||
return player->cell.mName.c_str();
|
||||
}
|
||||
|
||||
void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexcept
|
||||
|
@ -121,18 +121,18 @@ void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexc
|
|||
GET_PLAYER(pid, player,);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %s",
|
||||
player->Npc()->mName.c_str(),
|
||||
player->getCell()->getDescription().c_str(),
|
||||
player->npc.mName.c_str(),
|
||||
player->cell.getDescription().c_str(),
|
||||
name);
|
||||
|
||||
// If the player is currently in an exterior, turn on the interior flag
|
||||
// from the cell so the player doesn't get teleported to their exterior
|
||||
// grid position (which we haven't changed)
|
||||
if (player->getCell()->isExterior()) {
|
||||
player->getCell()->mData.mFlags |= ESM::Cell::Interior;
|
||||
if (player->cell.isExterior()) {
|
||||
player->cell.mData.mFlags |= ESM::Cell::Interior;
|
||||
}
|
||||
|
||||
player->getCell()->mName = name;
|
||||
player->cell.mName = name;
|
||||
}
|
||||
|
||||
void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
|
||||
|
@ -141,33 +141,33 @@ void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexc
|
|||
GET_PLAYER(pid, player,);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %i,%i",
|
||||
player->Npc()->mName.c_str(),
|
||||
player->getCell()->getDescription().c_str(),
|
||||
player->npc.mName.c_str(),
|
||||
player->cell.getDescription().c_str(),
|
||||
x,
|
||||
y);
|
||||
|
||||
// If the player is currently in an interior, turn off the interior flag
|
||||
// from the cell
|
||||
if (!player->getCell()->isExterior()) {
|
||||
player->getCell()->mData.mFlags &= ~ESM::Cell::Interior;
|
||||
if (!player->cell.isExterior()) {
|
||||
player->cell.mData.mFlags &= ~ESM::Cell::Interior;
|
||||
}
|
||||
|
||||
player->getCell()->mData.mX = x;
|
||||
player->getCell()->mData.mY = y;
|
||||
player->cell.mData.mX = x;
|
||||
player->cell.mData.mY = y;
|
||||
}
|
||||
|
||||
int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,0);
|
||||
return player->getCell()->mData.mX;
|
||||
return player->cell.mData.mX;
|
||||
}
|
||||
|
||||
int TranslocationFunctions::GetExteriorY(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,0);
|
||||
return player->getCell()->mData.mY;
|
||||
return player->cell.mData.mY;
|
||||
}
|
||||
|
||||
bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
|
||||
|
@ -175,7 +175,7 @@ bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, false);
|
||||
|
||||
return player->getCell()->isExterior();
|
||||
return player->cell.isExterior();
|
||||
}
|
||||
|
||||
void TranslocationFunctions::SendPos(unsigned short pid) noexcept
|
||||
|
|
|
@ -598,17 +598,17 @@ namespace MWClass
|
|||
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->success = true;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.success = true;
|
||||
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(victim);
|
||||
if (dedicatedPlayer != nullptr)
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->target = dedicatedPlayer->guid;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.target = dedicatedPlayer->guid;
|
||||
}
|
||||
|
||||
if(Misc::Rng::roll0to99() >= hitchance)
|
||||
{
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->success = false;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.success = false;
|
||||
mwmp::Main::get().getLocalPlayer()->sendAttack(mwmp::Attack::MELEE);
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,7 @@ namespace MWClass
|
|||
bool isDedicated = dedicatedPlayer != nullptr;
|
||||
bool _knockdown = false;
|
||||
if(isDedicated)
|
||||
_knockdown = dedicatedPlayer->getAttack()->knockdown;
|
||||
_knockdown = dedicatedPlayer->attack.knockdown;
|
||||
|
||||
if ((!isDedicated && ishealth && agilityTerm <= damage && knockdownTerm <= Misc::Rng::roll0to99()) || _knockdown)
|
||||
{
|
||||
|
@ -850,11 +850,11 @@ namespace MWClass
|
|||
mwmp::DedicatedPlayer *victimPlayer = mwmp::Players::getPlayer(ptr);
|
||||
if (attacker == MWMechanics::getPlayer() && victimPlayer != nullptr)
|
||||
{
|
||||
mwmp::Attack *_atk = mwmp::Main::get().getLocalPlayer()->getAttack();
|
||||
_atk->damage = damage;
|
||||
_atk->attacker = mwmp::Main::get().getLocalPlayer()->guid;
|
||||
_atk->target = victimPlayer->guid;
|
||||
_atk->knockdown = getCreatureStats(ptr).getKnockedDown();
|
||||
mwmp::Attack attack = mwmp::Main::get().getLocalPlayer()->attack;
|
||||
attack.damage = damage;
|
||||
attack.attacker = mwmp::Main::get().getLocalPlayer()->guid;
|
||||
attack.target = victimPlayer->guid;
|
||||
attack.knockdown = getCreatureStats(ptr).getKnockedDown();
|
||||
mwmp::Main::get().getLocalPlayer()->sendAttack(mwmp::Attack::MELEE); // todo: make this sensitive to different weapon types
|
||||
}
|
||||
|
||||
|
|
|
@ -121,13 +121,13 @@ namespace MWMechanics
|
|||
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(blocker);
|
||||
bool isDedicated = dedicatedPlayer != NULL;
|
||||
if (attacker == MWMechanics::getPlayer())
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->block = false;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.block = false;
|
||||
|
||||
if ((!isDedicated && Misc::Rng::roll0to99() < x) ||
|
||||
(isDedicated && dedicatedPlayer->getAttack()->block == 1))
|
||||
(isDedicated && dedicatedPlayer->attack.block == 1))
|
||||
{
|
||||
if (attacker == MWMechanics::getPlayer())
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->block = true;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.block = true;
|
||||
|
||||
// Reduce shield durability by incoming damage
|
||||
int shieldhealth = shield->getClass().getItemHealth(*shield);
|
||||
|
@ -203,12 +203,12 @@ namespace MWMechanics
|
|||
int skillValue = attacker.getClass().getSkill(attacker, weapon.getClass().getEquipmentSkill(weapon));
|
||||
|
||||
if (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->success = true;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.success = true;
|
||||
|
||||
if (Misc::Rng::roll0to99() >= getHitChance(attacker, victim, skillValue))
|
||||
{
|
||||
if (attacker == getPlayer())
|
||||
mwmp::Main::get().getLocalPlayer()->getAttack()->success = false;
|
||||
mwmp::Main::get().getLocalPlayer()->attack.success = false;
|
||||
victim.getClass().onHit(victim, damage, false, projectile, attacker, osg::Vec3f(), false);
|
||||
MWMechanics::reduceWeaponCondition(damage, false, weapon, attacker);
|
||||
return;
|
||||
|
|
|
@ -826,10 +826,10 @@ namespace MWMechanics
|
|||
bool isDedicated = dedicatedPlayer != NULL;
|
||||
|
||||
if (isDedicated)
|
||||
dedicatedPlayer->getAttack()->pressed = false;
|
||||
dedicatedPlayer->attack.pressed = false;
|
||||
|
||||
if ((!isDedicated && !mwmp::Main::get().getLocalPlayer()->getAttack()->success) ||
|
||||
(isDedicated && dedicatedPlayer->getAttack()->success == 0))
|
||||
if ((!isDedicated && !mwmp::Main::get().getLocalPlayer()->attack.success) ||
|
||||
(isDedicated && dedicatedPlayer->attack.success == 0))
|
||||
{
|
||||
if (mCaster == getPlayer())
|
||||
{
|
||||
|
|
|
@ -30,8 +30,8 @@ std::map<RakNet::RakNetGUID, DedicatedPlayer *> Players::players;
|
|||
|
||||
DedicatedPlayer::DedicatedPlayer(RakNet::RakNetGUID guid) : BasePlayer(guid)
|
||||
{
|
||||
getAttack()->pressed = 0;
|
||||
CreatureStats()->mDead = false;
|
||||
attack.pressed = 0;
|
||||
creatureStats.mDead = false;
|
||||
movementFlags = 0;
|
||||
}
|
||||
DedicatedPlayer::~DedicatedPlayer()
|
||||
|
@ -54,12 +54,12 @@ void Players::createPlayer(RakNet::RakNetGUID guid)
|
|||
ESM::NPC npc = *player.get<ESM::NPC>()->mBase;
|
||||
DedicatedPlayer *dedicPlayer = players[guid];
|
||||
|
||||
npc.mRace = dedicPlayer->Npc()->mRace;
|
||||
npc.mHead = dedicPlayer->Npc()->mHead;
|
||||
npc.mHair = dedicPlayer->Npc()->mHair;
|
||||
npc.mClass = dedicPlayer->Npc()->mClass;
|
||||
npc.mName = dedicPlayer->Npc()->mName;
|
||||
npc.mFlags = dedicPlayer->Npc()->mFlags;
|
||||
npc.mRace = dedicPlayer->npc.mRace;
|
||||
npc.mHead = dedicPlayer->npc.mHead;
|
||||
npc.mHair = dedicPlayer->npc.mHair;
|
||||
npc.mClass = dedicPlayer->npc.mClass;
|
||||
npc.mName = dedicPlayer->npc.mName;
|
||||
npc.mFlags = dedicPlayer->npc.mFlags;
|
||||
|
||||
if (dedicPlayer->state == 0)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ void Players::createPlayer(RakNet::RakNetGUID guid)
|
|||
if (dedicPlayer->state == 0)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Creating new reference pointer for %s",
|
||||
dedicPlayer->Npc()->mName.c_str());
|
||||
dedicPlayer->npc.mName.c_str());
|
||||
|
||||
MWWorld::Ptr tmp = world->placeObject(dedicPlayer->reference->getPtr(), cellStore, newPos);
|
||||
|
||||
|
@ -86,12 +86,12 @@ void Players::createPlayer(RakNet::RakNetGUID guid)
|
|||
dedicPlayer->ptr.mRef = tmp.mRef;
|
||||
|
||||
dedicPlayer->cell = *dedicPlayer->ptr.getCell()->getCell();
|
||||
dedicPlayer->pos = dedicPlayer->ptr.getRefData().getPosition();
|
||||
dedicPlayer->position = dedicPlayer->ptr.getRefData().getPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Updating reference pointer for %s",
|
||||
dedicPlayer->Npc()->mName.c_str());
|
||||
dedicPlayer->npc.mName.c_str());
|
||||
|
||||
dedicPlayer->ptr.getBase()->canChangeCell = true;
|
||||
dedicPlayer->updatePtr(world->moveObject(dedicPlayer->ptr, cellStore, newPos.pos[0], newPos.pos[1], newPos.pos[2]));
|
||||
|
@ -205,7 +205,7 @@ void DedicatedPlayer::move(float dt)
|
|||
|
||||
|
||||
{
|
||||
osg::Vec3f lerp = Lerp(refPos.asVec3(), pos.asVec3(), dt * 15);
|
||||
osg::Vec3f lerp = Lerp(refPos.asVec3(), position.asVec3(), dt * 15);
|
||||
refPos.pos[0] = lerp.x();
|
||||
refPos.pos[1] = lerp.y();
|
||||
refPos.pos[2] = lerp.z();
|
||||
|
@ -213,11 +213,11 @@ void DedicatedPlayer::move(float dt)
|
|||
}
|
||||
|
||||
MWMechanics::Movement *move = &ptr.getClass().getMovementSettings(ptr);
|
||||
move->mPosition[0] = dir.pos[0];
|
||||
move->mPosition[1] = dir.pos[1];
|
||||
move->mPosition[2] = dir.pos[2];
|
||||
move->mPosition[0] = direction.pos[0];
|
||||
move->mPosition[1] = direction.pos[1];
|
||||
move->mPosition[2] = direction.pos[2];
|
||||
|
||||
world->rotateObject(ptr, pos.rot[0], pos.rot[1], pos.rot[2]);
|
||||
world->rotateObject(ptr, position.rot[0], position.rot[1], position.rot[2]);
|
||||
}
|
||||
|
||||
void Players::update(float dt)
|
||||
|
@ -231,18 +231,18 @@ void Players::update(float dt)
|
|||
|
||||
MWMechanics::DynamicStat<float> value;
|
||||
|
||||
if (pl->CreatureStats()->mDead)
|
||||
if (pl->creatureStats.mDead)
|
||||
{
|
||||
value.readState(pl->CreatureStats()->mDynamic[0]);
|
||||
value.readState(pl->creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
value.readState(pl->CreatureStats()->mDynamic[0]);
|
||||
value.readState(pl->creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
value.readState(pl->CreatureStats()->mDynamic[1]);
|
||||
value.readState(pl->creatureStats.mDynamic[1]);
|
||||
ptrNpcStats->setMagicka(value);
|
||||
value.readState(pl->CreatureStats()->mDynamic[2]);
|
||||
value.readState(pl->creatureStats.mDynamic[2]);
|
||||
ptrNpcStats->setFatigue(value);
|
||||
|
||||
if (ptrNpcStats->isDead())
|
||||
|
@ -294,7 +294,7 @@ void DedicatedPlayer::updateEquipment()
|
|||
{
|
||||
MWWorld::ContainerStoreIterator it = invStore.getSlot(slot);
|
||||
|
||||
const string &dedicItem = EquipedItem(slot)->refid;
|
||||
const string &dedicItem = equipedItems[slot].refid;
|
||||
std::string item = "";
|
||||
bool equal = false;
|
||||
if (it != invStore.end())
|
||||
|
@ -312,7 +312,7 @@ void DedicatedPlayer::updateEquipment()
|
|||
if (dedicItem.empty() || equal)
|
||||
continue;
|
||||
|
||||
const int count = EquipedItem(slot)->count;
|
||||
const int count = equipedItems[slot].count;
|
||||
ptr.getClass().getContainerStore(ptr).add(dedicItem, count, ptr);
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it2 = invStore.begin(); it2 != invStore.end(); ++it2)
|
||||
|
@ -440,7 +440,7 @@ void DedicatedPlayer::updateCell()
|
|||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Server says %s (%s) moved to %s",
|
||||
ptr.getBase()->mRef.getRefId().c_str(),
|
||||
this->Npc()->mName.c_str(),
|
||||
this->npc.mName.c_str(),
|
||||
cell.getDescription().c_str());
|
||||
|
||||
try
|
||||
|
@ -462,7 +462,7 @@ void DedicatedPlayer::updateCell()
|
|||
// Allow this player's reference to move across a cell now that a manual cell
|
||||
// update has been called
|
||||
ptr.getBase()->canChangeCell = true;
|
||||
updatePtr(world->moveObject(ptr, cellStore, pos.pos[0], pos.pos[1], pos.pos[2]));
|
||||
updatePtr(world->moveObject(ptr, cellStore, position.pos[0], position.pos[1], position.pos[2]));
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,5 +505,5 @@ void DedicatedPlayer::setMarkerState(bool state)
|
|||
|
||||
void DedicatedPlayer::updateActor(MWMechanics::Actor *actor)
|
||||
{
|
||||
actor->getCharacterController()->setAttackingOrSpell(getAttack()->pressed);
|
||||
actor->getCharacterController()->setAttackingOrSpell(attack.pressed);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace mwmp
|
|||
|
||||
Networking *networking = Main::get().getNetworking();
|
||||
|
||||
*localPlayer->ChatMessage() = str;
|
||||
localPlayer->chatMessage = str;
|
||||
|
||||
RakNet::BitStream bs;
|
||||
networking->getPlayerPacket(ID_CHAT_MESSAGE)->Packet(&bs, localPlayer, true);
|
||||
|
|
|
@ -270,25 +270,25 @@ ESM::CustomMarker mwmp::GUIController::CreateMarker(const RakNet::RakNetGUID &gu
|
|||
return mEditingMarker;
|
||||
}
|
||||
|
||||
mEditingMarker.mNote = player->Npc()->mName;
|
||||
mEditingMarker.mNote = player->npc.mName;
|
||||
|
||||
const ESM::Cell *ptrCell = player->getCell();
|
||||
const ESM::Cell *playerCell = &player->cell;
|
||||
|
||||
mEditingMarker.mCell = player->getCell()->mCellId;
|
||||
mEditingMarker.mCell = player->cell.mCellId;
|
||||
|
||||
mEditingMarker.mWorldX = player->Position()->pos[0];
|
||||
mEditingMarker.mWorldY = player->Position()->pos[1];
|
||||
mEditingMarker.mWorldX = player->position.pos[0];
|
||||
mEditingMarker.mWorldY = player->position.pos[1];
|
||||
|
||||
mEditingMarker.mCell.mPaged = ptrCell->isExterior();
|
||||
if (!ptrCell->isExterior())
|
||||
mEditingMarker.mCell.mWorldspace = ptrCell->mName;
|
||||
mEditingMarker.mCell.mPaged = playerCell->isExterior();
|
||||
if (!playerCell->isExterior())
|
||||
mEditingMarker.mCell.mWorldspace = playerCell->mName;
|
||||
else
|
||||
{
|
||||
mEditingMarker.mCell.mWorldspace = ESM::CellId::sDefaultWorldspace;
|
||||
|
||||
// Don't remove these, or the markers will stop showing up in exteriors
|
||||
mEditingMarker.mCell.mIndex.mX = ptrCell->getGridX();
|
||||
mEditingMarker.mCell.mIndex.mY = ptrCell->getGridY();
|
||||
mEditingMarker.mCell.mIndex.mX = playerCell->getGridX();
|
||||
mEditingMarker.mCell.mIndex.mY = playerCell->getGridY();
|
||||
}
|
||||
return mEditingMarker;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ using namespace std;
|
|||
|
||||
LocalPlayer::LocalPlayer()
|
||||
{
|
||||
CharGenStage()->current = 0;
|
||||
CharGenStage()->end = 1;
|
||||
charGenStage.current = 0;
|
||||
charGenStage.end = 1;
|
||||
consoleAllowed = true;
|
||||
ignorePosPacket = false;
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ void LocalPlayer::update()
|
|||
|
||||
void LocalPlayer::charGen(int stageFirst, int stageEnd)
|
||||
{
|
||||
CharGenStage()->current = stageFirst;
|
||||
CharGenStage()->end = stageEnd;
|
||||
charGenStage.current = stageFirst;
|
||||
charGenStage.end = stageEnd;
|
||||
}
|
||||
|
||||
bool LocalPlayer::charGenThread()
|
||||
|
@ -83,14 +83,14 @@ bool LocalPlayer::charGenThread()
|
|||
|
||||
// If we haven't finished CharGen and we're in a menu, it must be
|
||||
// one of the CharGen menus, so go no further until it's closed
|
||||
if (windowManager->isGuiMode() && CharGenStage()->end != 0)
|
||||
if (windowManager->isGuiMode() && charGenStage.end != 0)
|
||||
return false;
|
||||
|
||||
// If the current stage of CharGen is not the last one,
|
||||
// move to the next one
|
||||
else if (CharGenStage()->current < CharGenStage()->end)
|
||||
else if (charGenStage.current < charGenStage.end)
|
||||
{
|
||||
switch (CharGenStage()->current)
|
||||
switch (charGenStage.current)
|
||||
{
|
||||
case 0:
|
||||
windowManager->pushGuiMode(MWGui::GM_Name);
|
||||
|
@ -109,26 +109,26 @@ bool LocalPlayer::charGenThread()
|
|||
break;
|
||||
}
|
||||
getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this);
|
||||
CharGenStage()->current++;
|
||||
charGenStage.current++;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we've reached the last stage of CharGen, send the
|
||||
// corresponding packets and mark CharGen as finished
|
||||
else if (CharGenStage()->end != 0)
|
||||
else if (charGenStage.end != 0)
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
(*Npc()) = *player.get<ESM::NPC>()->mBase;
|
||||
(*BirthSign()) = world->getPlayer().getBirthSign();
|
||||
npc = *player.get<ESM::NPC>()->mBase;
|
||||
birthsign = world->getPlayer().getBirthSign();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server with my CharGen info");
|
||||
getNetworking()->getPlayerPacket(ID_GAME_BASE_INFO)->Send(this);
|
||||
|
||||
// Send stats packets if this is the 2nd round of CharGen that
|
||||
// only happens for new characters
|
||||
if (CharGenStage()->end != 1)
|
||||
if (charGenStage.end != 1)
|
||||
{
|
||||
updateDynamicStats(true);
|
||||
updateAttributes(true);
|
||||
|
@ -140,7 +140,7 @@ bool LocalPlayer::charGenThread()
|
|||
}
|
||||
|
||||
// Set the last stage variable to 0 to indicate that CharGen is finished
|
||||
CharGenStage()->end = 0;
|
||||
charGenStage.end = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -169,9 +169,9 @@ void LocalPlayer::updateDynamicStats(bool forceUpdate)
|
|||
oldMagicka = magicka;
|
||||
oldFatigue = fatigue;
|
||||
|
||||
health.writeState(CreatureStats()->mDynamic[0]);
|
||||
magicka.writeState(CreatureStats()->mDynamic[1]);
|
||||
fatigue.writeState(CreatureStats()->mDynamic[2]);
|
||||
health.writeState(creatureStats.mDynamic[0]);
|
||||
magicka.writeState(creatureStats.mDynamic[1]);
|
||||
fatigue.writeState(creatureStats.mDynamic[2]);
|
||||
|
||||
timer = 0;
|
||||
|
||||
|
@ -188,9 +188,9 @@ void LocalPlayer::updateAttributes(bool forceUpdate)
|
|||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (ptrNpcStats.getAttribute(i).getBase() != CreatureStats()->mAttributes[i].mBase)
|
||||
if (ptrNpcStats.getAttribute(i).getBase() != creatureStats.mAttributes[i].mBase)
|
||||
{
|
||||
ptrNpcStats.getAttribute(i).writeState(CreatureStats()->mAttributes[i]);
|
||||
ptrNpcStats.getAttribute(i).writeState(creatureStats.mAttributes[i]);
|
||||
attributesChanged = true;
|
||||
}
|
||||
}
|
||||
|
@ -213,29 +213,29 @@ void LocalPlayer::updateSkills(bool forceUpdate)
|
|||
|
||||
for (int i = 0; i < 27; ++i)
|
||||
{
|
||||
if (ptrNpcStats.getSkill(i).getBase() != NpcStats()->mSkills[i].mBase)
|
||||
if (ptrNpcStats.getSkill(i).getBase() != npcStats.mSkills[i].mBase)
|
||||
{
|
||||
ptrNpcStats.getSkill(i).writeState(NpcStats()->mSkills[i]);
|
||||
ptrNpcStats.getSkill(i).writeState(npcStats.mSkills[i]);
|
||||
skillsChanged = true;
|
||||
}
|
||||
// If we only have skill progress, remember it for future packets,
|
||||
// but don't send a packet just because of this
|
||||
else if (ptrNpcStats.getSkill(i).getProgress() != NpcStats()->mSkills[i].mProgress)
|
||||
else if (ptrNpcStats.getSkill(i).getProgress() != npcStats.mSkills[i].mProgress)
|
||||
{
|
||||
ptrNpcStats.getSkill(i).writeState(NpcStats()->mSkills[i]);
|
||||
ptrNpcStats.getSkill(i).writeState(npcStats.mSkills[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (ptrNpcStats.getSkillIncrease(i) != NpcStats()->mSkillIncrease[i]) {
|
||||
NpcStats()->mSkillIncrease[i] = ptrNpcStats.getSkillIncrease(i);
|
||||
if (ptrNpcStats.getSkillIncrease(i) != npcStats.mSkillIncrease[i]) {
|
||||
npcStats.mSkillIncrease[i] = ptrNpcStats.getSkillIncrease(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (skillsChanged || forceUpdate)
|
||||
{
|
||||
NpcStats()->mLevelProgress = ptrNpcStats.getLevelProgress();
|
||||
npcStats.mLevelProgress = ptrNpcStats.getLevelProgress();
|
||||
getNetworking()->getPlayerPacket(ID_GAME_SKILL)->Send(this);
|
||||
}
|
||||
}
|
||||
|
@ -245,9 +245,9 @@ void LocalPlayer::updateLevel(bool forceUpdate)
|
|||
MWWorld::Ptr player = getPlayerPtr();
|
||||
const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
|
||||
|
||||
if (ptrNpcStats.getLevel() != CreatureStats()->mLevel || forceUpdate)
|
||||
if (ptrNpcStats.getLevel() != creatureStats.mLevel || forceUpdate)
|
||||
{
|
||||
CreatureStats()->mLevel = ptrNpcStats.getLevel();
|
||||
creatureStats.mLevel = ptrNpcStats.getLevel();
|
||||
getNetworking()->getPlayerPacket(ID_GAME_LEVEL)->Send(this);
|
||||
|
||||
// Also update skills to refresh level progress and attribute bonuses
|
||||
|
@ -282,11 +282,11 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
isJumping = true;
|
||||
}
|
||||
|
||||
(*Position()) = ptrPos;
|
||||
position = ptrPos;
|
||||
|
||||
Dir()->pos[0] = move.mPosition[0];
|
||||
Dir()->pos[1] = move.mPosition[1];
|
||||
Dir()->pos[2] = move.mPosition[2];
|
||||
direction.pos[0] = move.mPosition[0];
|
||||
direction.pos[1] = move.mPosition[1];
|
||||
direction.pos[2] = move.mPosition[2];
|
||||
|
||||
getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
else if (!sentJumpEnd)
|
||||
{
|
||||
sentJumpEnd = true;
|
||||
(*Position()) = ptrPos;
|
||||
position = ptrPos;
|
||||
getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this);
|
||||
}
|
||||
}
|
||||
|
@ -318,17 +318,17 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
|||
{
|
||||
cellChanged = true;
|
||||
}
|
||||
else if (!Misc::StringUtils::ciEqual(ptrCell->mName, getCell()->mName))
|
||||
else if (!Misc::StringUtils::ciEqual(ptrCell->mName, cell.mName))
|
||||
{
|
||||
cellChanged = true;
|
||||
}
|
||||
else if (ptrCell->isExterior())
|
||||
{
|
||||
if (ptrCell->mData.mX != getCell()->mData.mX)
|
||||
if (ptrCell->mData.mX != cell.mData.mX)
|
||||
{
|
||||
cellChanged = true;
|
||||
}
|
||||
else if (ptrCell->mData.mY != getCell()->mData.mY)
|
||||
else if (ptrCell->mData.mY != cell.mData.mY)
|
||||
{
|
||||
cellChanged = true;
|
||||
}
|
||||
|
@ -339,10 +339,10 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
|||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_CELL_CHANGE to server");
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s",
|
||||
getCell()->getDescription().c_str(),
|
||||
ptrCell->getDescription().c_str());
|
||||
cell.getDescription().c_str(),
|
||||
cell.getDescription().c_str());
|
||||
|
||||
(*getCell()) = *ptrCell;
|
||||
cell = *ptrCell;
|
||||
|
||||
// Make sure the position is updated before a cell packet is sent, or else
|
||||
// cell change events in server scripts will have the wrong player position
|
||||
|
@ -363,13 +363,13 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
|||
void LocalPlayer::updateChar()
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(
|
||||
Npc()->mRace,
|
||||
Npc()->isMale(),
|
||||
Npc()->mHead,
|
||||
Npc()->mHair
|
||||
npc.mRace,
|
||||
npc.isMale(),
|
||||
npc.mHead,
|
||||
npc.mHair
|
||||
);
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(*BirthSign());
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(birthsign);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->rebuildAvatar();
|
||||
}
|
||||
|
@ -387,28 +387,28 @@ void LocalPlayer::updateEquipment(bool forceUpdate)
|
|||
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++)
|
||||
{
|
||||
MWWorld::ContainerStoreIterator it = invStore.getSlot(slot);
|
||||
if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), EquipedItem(slot)->refid))
|
||||
if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), equipedItems[slot].refid))
|
||||
{
|
||||
equipChanged = true;
|
||||
|
||||
EquipedItem(slot)->refid = it->getCellRef().getRefId();
|
||||
EquipedItem(slot)->health = it->getCellRef().getCharge();
|
||||
equipedItems[slot].refid = it->getCellRef().getRefId();
|
||||
equipedItems[slot].health = it->getCellRef().getCharge();
|
||||
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||
{
|
||||
MWMechanics::WeaponType weaptype;
|
||||
MWMechanics::getActiveWeapon(player.getClass().getCreatureStats(player), player.getClass().getInventoryStore(player), &weaptype);
|
||||
if (weaptype != MWMechanics::WeapType_Thrown)
|
||||
EquipedItem(slot)->count = 1;
|
||||
equipedItems[slot].count = 1;
|
||||
}
|
||||
else
|
||||
EquipedItem(slot)->count = invStore.count(it->getCellRef().getRefId());
|
||||
equipedItems[slot].count = invStore.count(it->getCellRef().getRefId());
|
||||
}
|
||||
else if (it == invStore.end() && !EquipedItem(slot)->refid.empty())
|
||||
else if (it == invStore.end() && !equipedItems[slot].refid.empty())
|
||||
{
|
||||
equipChanged = true;
|
||||
EquipedItem(slot)->refid = "";
|
||||
EquipedItem(slot)->count = 0;
|
||||
EquipedItem(slot)->health = 0;
|
||||
equipedItems[slot].refid = "";
|
||||
equipedItems[slot].count = 0;
|
||||
equipedItems[slot].health = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,10 +511,10 @@ void LocalPlayer::updateAttackState(bool forceUpdate)
|
|||
{
|
||||
const string &spell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
||||
|
||||
getAttack()->attacker = guid;
|
||||
getAttack()->type = Attack::MAGIC;
|
||||
getAttack()->pressed = true;
|
||||
getAttack()->refid = spell;
|
||||
attack.attacker = guid;
|
||||
attack.type = Attack::MAGIC;
|
||||
attack.pressed = true;
|
||||
attack.refid = spell;
|
||||
|
||||
/*RakNet::BitStream bs;
|
||||
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
|
||||
|
@ -546,7 +546,7 @@ void LocalPlayer::updateDeadState(bool forceUpdate)
|
|||
|
||||
if (ptrNpcStats->isDead() && !isDead)
|
||||
{
|
||||
CreatureStats()->mDead = true;
|
||||
creatureStats.mDead = true;
|
||||
RakNet::BitStream bs;
|
||||
getNetworking()->getPlayerPacket((RakNet::MessageID)ID_GAME_DIE)->Packet(&bs, this, true);
|
||||
getNetworking()->sendData(&bs);
|
||||
|
@ -605,11 +605,11 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
|
|||
#undef __SETFLAG
|
||||
|
||||
if (state == MWMechanics::DrawState_Nothing)
|
||||
(*DrawState()) = 0;
|
||||
drawState = 0;
|
||||
else if (state == MWMechanics::DrawState_Weapon)
|
||||
(*DrawState()) = 1;
|
||||
drawState = 1;
|
||||
else if (state == MWMechanics::DrawState_Spell)
|
||||
(*DrawState()) = 2;
|
||||
drawState = 2;
|
||||
|
||||
if (jump)
|
||||
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump;
|
||||
|
@ -711,8 +711,8 @@ void LocalPlayer::setDynamicStats()
|
|||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
dynamicStat = ptrCreatureStats->getDynamic(i);
|
||||
dynamicStat.setBase(CreatureStats()->mDynamic[i].mBase);
|
||||
dynamicStat.setCurrent(CreatureStats()->mDynamic[i].mCurrent);
|
||||
dynamicStat.setBase(creatureStats.mDynamic[i].mBase);
|
||||
dynamicStat.setCurrent(creatureStats.mDynamic[i].mCurrent);
|
||||
ptrCreatureStats->setDynamic(i, dynamicStat);
|
||||
}
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void LocalPlayer::setAttributes()
|
|||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
attributeValue.readState(CreatureStats()->mAttributes[i]);
|
||||
attributeValue.readState(creatureStats.mAttributes[i]);
|
||||
ptrCreatureStats->setAttribute(i, attributeValue);
|
||||
}
|
||||
}
|
||||
|
@ -742,16 +742,16 @@ void LocalPlayer::setSkills()
|
|||
|
||||
for (int i = 0; i < 27; ++i)
|
||||
{
|
||||
skillValue.readState(NpcStats()->mSkills[i]);
|
||||
skillValue.readState(npcStats.mSkills[i]);
|
||||
ptrNpcStats->setSkill(i, skillValue);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
ptrNpcStats->setSkillIncrease(i, NpcStats()->mSkillIncrease[i]);
|
||||
ptrNpcStats->setSkillIncrease(i, npcStats.mSkillIncrease[i]);
|
||||
}
|
||||
|
||||
ptrNpcStats->setLevelProgress(NpcStats()->mLevelProgress);
|
||||
ptrNpcStats->setLevelProgress(npcStats.mLevelProgress);
|
||||
}
|
||||
|
||||
void LocalPlayer::setLevel()
|
||||
|
@ -760,7 +760,7 @@ void LocalPlayer::setLevel()
|
|||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
MWMechanics::CreatureStats *ptrCreatureStats = &player.getClass().getCreatureStats(player);
|
||||
ptrCreatureStats->setLevel(CreatureStats()->mLevel);
|
||||
ptrCreatureStats->setLevel(creatureStats.mLevel);
|
||||
}
|
||||
|
||||
void LocalPlayer::setPosition()
|
||||
|
@ -777,8 +777,8 @@ void LocalPlayer::setPosition()
|
|||
else
|
||||
{
|
||||
world->getPlayer().setTeleported(true);
|
||||
world->moveObject(player, Position()->pos[0], Position()->pos[1], Position()->pos[2]);
|
||||
world->rotateObject(player, Position()->rot[0], Position()->rot[1], Position()->rot[2]);
|
||||
world->moveObject(player, position.pos[0], position.pos[1], position.pos[2]);
|
||||
world->rotateObject(player, position.rot[0], position.rot[1], position.rot[2]);
|
||||
}
|
||||
|
||||
updatePosition(true);
|
||||
|
@ -792,10 +792,10 @@ void LocalPlayer::setCell()
|
|||
|
||||
world->getPlayer().setTeleported(true);
|
||||
|
||||
int x = getCell()->mData.mX;
|
||||
int y = getCell()->mData.mY;
|
||||
int x = cell.mData.mX;
|
||||
int y = cell.mData.mY;
|
||||
|
||||
if (getCell()->isExterior())
|
||||
if (cell.isExterior())
|
||||
{
|
||||
world->indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
||||
pos.pos[2] = 0;
|
||||
|
@ -805,7 +805,7 @@ void LocalPlayer::setCell()
|
|||
world->changeToExteriorCell(pos, true);
|
||||
world->fixPosition(player);
|
||||
}
|
||||
else if (world->findExteriorPosition(getCell()->mName, pos))
|
||||
else if (world->findExteriorPosition(cell.mName, pos))
|
||||
{
|
||||
world->changeToExteriorCell(pos, true);
|
||||
world->fixPosition(player);
|
||||
|
@ -814,8 +814,8 @@ void LocalPlayer::setCell()
|
|||
{
|
||||
try
|
||||
{
|
||||
world->findInteriorPosition(getCell()->mName, pos);
|
||||
world->changeToInteriorCell(getCell()->mName, pos, true);
|
||||
world->findInteriorPosition(cell.mName, pos);
|
||||
world->changeToInteriorCell(cell.mName, pos, true);
|
||||
}
|
||||
// If we've been sent to an invalid interior, ignore the incoming
|
||||
// packet about our position in that cell
|
||||
|
@ -856,7 +856,7 @@ void LocalPlayer::setEquipment()
|
|||
|
||||
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++)
|
||||
{
|
||||
mwmp::Item *currentItem = EquipedItem(slot);
|
||||
mwmp::Item *currentItem = &equipedItems[slot];
|
||||
|
||||
if (!currentItem->refid.empty())
|
||||
{
|
||||
|
@ -870,8 +870,8 @@ void LocalPlayer::setEquipment()
|
|||
ptrInventory.equip(
|
||||
slot,
|
||||
ptrInventory.ContainerStore::add(
|
||||
EquipedItem(slot)->refid.c_str(),
|
||||
EquipedItem(slot)->count,
|
||||
equipedItems[slot].refid.c_str(),
|
||||
equipedItems[slot].count,
|
||||
ptrPlayer),
|
||||
ptrPlayer);
|
||||
else
|
||||
|
@ -1064,9 +1064,8 @@ void LocalPlayer::sendAttack(Attack::TYPE type)
|
|||
{
|
||||
MWMechanics::DrawState_ state = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
|
||||
|
||||
|
||||
getAttack()->type = type;
|
||||
getAttack()->pressed = false;
|
||||
attack.type = type;
|
||||
attack.pressed = false;
|
||||
RakNet::BitStream bs;
|
||||
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
|
||||
getNetworking()->sendData(&bs);
|
||||
|
@ -1074,7 +1073,7 @@ void LocalPlayer::sendAttack(Attack::TYPE type)
|
|||
|
||||
void LocalPlayer::prepareAttack(Attack::TYPE type, bool state)
|
||||
{
|
||||
if (getAttack()->pressed == state && type != Attack::MAGIC)
|
||||
if (attack.pressed == state && type != Attack::MAGIC)
|
||||
return;
|
||||
|
||||
MWMechanics::DrawState_ dstate = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
|
||||
|
@ -1082,21 +1081,21 @@ void LocalPlayer::prepareAttack(Attack::TYPE type, bool state)
|
|||
if (dstate == MWMechanics::DrawState_Spell)
|
||||
{
|
||||
const string &spell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
||||
getAttack()->success = Misc::Rng::roll0to99() < MWMechanics::getSpellSuccessChance(spell, getPlayerPtr());
|
||||
attack.success = Misc::Rng::roll0to99() < MWMechanics::getSpellSuccessChance(spell, getPlayerPtr());
|
||||
state = true;
|
||||
getAttack()->refid = spell;
|
||||
attack.refid = spell;
|
||||
}
|
||||
else
|
||||
{
|
||||
getAttack()->success = false;
|
||||
attack.success = false;
|
||||
}
|
||||
|
||||
getAttack()->pressed = state;
|
||||
getAttack()->type = type;
|
||||
getAttack()->knockdown = false;
|
||||
getAttack()->block = false;
|
||||
getAttack()->target = RakNet::RakNetGUID();
|
||||
getAttack()->attacker = guid;
|
||||
attack.pressed = state;
|
||||
attack.type = type;
|
||||
attack.knockdown = false;
|
||||
attack.block = false;
|
||||
attack.target = RakNet::RakNetGUID();
|
||||
attack.attacker = guid;
|
||||
|
||||
RakNet::BitStream bs;
|
||||
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
|
||||
|
|
|
@ -193,7 +193,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
case ID_HANDSHAKE:
|
||||
{
|
||||
(*getLocalPlayer()->getPassw()) = "SuperPassword";
|
||||
getLocalPlayer()->passw = "SuperPassword";
|
||||
myPacket->Send(getLocalPlayer(), serverAddr);
|
||||
break;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl == 0 ? "new player" : pl->Npc()->mName.c_str());
|
||||
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl == 0 ? "new player" : pl->npc.mName.c_str());
|
||||
|
||||
if (pl == 0)
|
||||
{
|
||||
|
@ -369,32 +369,32 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Packet(&bsIn, pl, false);
|
||||
|
||||
//cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->getAttack()->pressed == 1) << endl;
|
||||
if (pl->getAttack()->pressed == 0)
|
||||
if (pl->attack.pressed == 0)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s",
|
||||
pl->getAttack()->success ? "true" : "false");
|
||||
pl->attack.success ? "true" : "false");
|
||||
|
||||
if (pl->getAttack()->success == 1)
|
||||
if (pl->attack.success == 1)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f",
|
||||
pl->getAttack()->damage);
|
||||
pl->attack.damage);
|
||||
}
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats &stats = pl->getPtr().getClass().getNpcStats(pl->getPtr());
|
||||
stats.getSpells().setSelectedSpell(pl->getAttack()->refid);
|
||||
stats.getSpells().setSelectedSpell(pl->attack.refid);
|
||||
|
||||
MWWorld::Ptr victim;
|
||||
if (pl->getAttack()->target == getLocalPlayer()->guid)
|
||||
if (pl->attack.target == getLocalPlayer()->guid)
|
||||
victim = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
else if (Players::getPlayer(pl->getAttack()->target) != 0)
|
||||
victim = Players::getPlayer(pl->getAttack()->target)->getPtr();
|
||||
else if (Players::getPlayer(pl->attack.target) != 0)
|
||||
victim = Players::getPlayer(pl->attack.target)->getPtr();
|
||||
|
||||
MWWorld::Ptr attacker;
|
||||
attacker = pl->getPtr();
|
||||
|
||||
// Get the weapon used (if hand-to-hand, weapon = inv.end())
|
||||
if (*pl->DrawState() == 1)
|
||||
if (pl->drawState == 1)
|
||||
{
|
||||
MWWorld::InventoryStore &inv = attacker.getClass().getInventoryStore(attacker);
|
||||
MWWorld::ContainerStoreIterator weaponslot = inv.getSlot(
|
||||
|
@ -415,16 +415,16 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
}
|
||||
|
||||
if (!weapon.isEmpty())
|
||||
MWMechanics::blockMeleeAttack(attacker, victim, weapon, pl->getAttack()->damage, 1);
|
||||
pl->getPtr().getClass().onHit(victim, pl->getAttack()->damage, healthdmg, weapon, attacker, osg::Vec3f(),
|
||||
pl->getAttack()->success);
|
||||
MWMechanics::blockMeleeAttack(attacker, victim, weapon, pl->attack.damage, 1);
|
||||
pl->getPtr().getClass().onHit(victim, pl->attack.damage, healthdmg, weapon, attacker, osg::Vec3f(),
|
||||
pl->attack.success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s",
|
||||
pl->getAttack()->refid.c_str());
|
||||
LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", pl->getAttack()->success);
|
||||
pl->attack.refid.c_str());
|
||||
LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", pl->attack.success);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -453,7 +453,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
value.readState(pl->CreatureStats()->mDynamic[i]);
|
||||
value.readState(pl->creatureStats.mDynamic[i]);
|
||||
ptrCreatureStats->setDynamic(i, value);
|
||||
}
|
||||
}
|
||||
|
@ -472,12 +472,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
}
|
||||
else if (pl != 0)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->Npc()->mName.c_str());
|
||||
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->npc.mName.c_str());
|
||||
MWMechanics::DynamicStat<float> health;
|
||||
pl->CreatureStats()->mDead = true;
|
||||
health.readState(pl->CreatureStats()->mDynamic[0]);
|
||||
pl->creatureStats.mDead = true;
|
||||
health.readState(pl->creatureStats.mDynamic[0]);
|
||||
health.setCurrent(0);
|
||||
health.writeState(pl->CreatureStats()->mDynamic[0]);
|
||||
health.writeState(pl->creatureStats.mDynamic[0]);
|
||||
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).setHealth(health);
|
||||
}
|
||||
break;
|
||||
|
@ -488,11 +488,11 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
player.getClass().getCreatureStats(player).resurrect();
|
||||
ESM::Position pos;
|
||||
MWBase::Environment::get().getWorld()->findInteriorPosition("Pelagiad, Fort Pelagiad", pos);
|
||||
MWBase::Environment::get().getWorld()->changeToInteriorCell("Pelagiad, Fort Pelagiad", pos, true);
|
||||
(*getLocalPlayer()->Position()) = pos;
|
||||
(*getLocalPlayer()->getCell()) = *player.getCell()->getCell();
|
||||
ESM::Position resurrectPos;
|
||||
MWBase::Environment::get().getWorld()->findInteriorPosition("Pelagiad, Fort Pelagiad", resurrectPos);
|
||||
MWBase::Environment::get().getWorld()->changeToInteriorCell("Pelagiad, Fort Pelagiad", resurrectPos, true);
|
||||
getLocalPlayer()->position = resurrectPos;
|
||||
getLocalPlayer()->cell = *player.getCell()->getCell();
|
||||
myPacket->Send(getLocalPlayer(), serverAddr);
|
||||
|
||||
getLocalPlayer()->updateDynamicStats(true);
|
||||
|
@ -500,15 +500,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
}
|
||||
else if (pl != 0)
|
||||
{
|
||||
pl->CreatureStats()->mDead = false;
|
||||
if (pl->CreatureStats()->mDynamic[0].mMod < 1)
|
||||
pl->CreatureStats()->mDynamic[0].mMod = 1;
|
||||
pl->CreatureStats()->mDynamic[0].mCurrent = pl->CreatureStats()->mDynamic[0].mMod;
|
||||
pl->creatureStats.mDead = false;
|
||||
if (pl->creatureStats.mDynamic[0].mMod < 1)
|
||||
pl->creatureStats.mDynamic[0].mMod = 1;
|
||||
pl->creatureStats.mDynamic[0].mCurrent = pl->creatureStats.mDynamic[0].mMod;
|
||||
|
||||
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).resurrect();
|
||||
|
||||
MWMechanics::DynamicStat<float> health;
|
||||
health.readState(pl->CreatureStats()->mDynamic[0]);
|
||||
health.readState(pl->creatureStats.mDynamic[0]);
|
||||
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).setHealth(health);
|
||||
}
|
||||
break;
|
||||
|
@ -553,12 +553,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
if (guid == myGuid)
|
||||
{
|
||||
myPacket->Packet(&bsIn, getLocalPlayer(), false);
|
||||
message = *getLocalPlayer()->ChatMessage();
|
||||
message = getLocalPlayer()->chatMessage;
|
||||
}
|
||||
else if (pl != 0)
|
||||
{
|
||||
myPacket->Packet(&bsIn, pl, false);
|
||||
message = *pl->ChatMessage();
|
||||
message = pl->chatMessage;
|
||||
}
|
||||
Main::get().getGUIController()->printChatMessage(message);
|
||||
|
||||
|
@ -596,7 +596,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
attributeValue.readState(pl->CreatureStats()->mAttributes[i]);
|
||||
attributeValue.readState(pl->creatureStats.mAttributes[i]);
|
||||
ptrCreatureStats->setAttribute(i, attributeValue);
|
||||
}
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
for (int i = 0; i < 27; ++i)
|
||||
{
|
||||
skillValue.readState(pl->NpcStats()->mSkills[i]);
|
||||
skillValue.readState(pl->npcStats.mSkills[i]);
|
||||
ptrNpcStats->setSkill(i, skillValue);
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
MWWorld::Ptr ptrPlayer = pl->getPtr();
|
||||
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
|
||||
|
||||
ptrCreatureStats->setLevel(pl->CreatureStats()->mLevel);
|
||||
ptrCreatureStats->setLevel(pl->creatureStats.mLevel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1142,7 +1142,7 @@ bool Networking::attack(const MWWorld::Ptr &ptr)
|
|||
if (pl == 0)
|
||||
return false;
|
||||
|
||||
return pl->getAttack()->pressed;
|
||||
return pl->attack.pressed;
|
||||
}
|
||||
|
||||
bool Networking::isConnected()
|
||||
|
|
|
@ -134,77 +134,6 @@ namespace mwmp
|
|||
|
||||
}
|
||||
|
||||
virtual ESM::Position *Position()
|
||||
{
|
||||
return &pos;
|
||||
}
|
||||
virtual ESM::NPC *Npc()
|
||||
{
|
||||
return &npc;
|
||||
}
|
||||
virtual ESM::NpcStats *NpcStats()
|
||||
{
|
||||
return &npcStats;
|
||||
}
|
||||
virtual ESM::CreatureStats *CreatureStats()
|
||||
{
|
||||
return &creatureStats;
|
||||
}
|
||||
|
||||
virtual unsigned int *MovementFlags()
|
||||
{
|
||||
return &movementFlags;
|
||||
}
|
||||
virtual ESM::Cell *getCell()
|
||||
{
|
||||
return &cell;
|
||||
}
|
||||
|
||||
virtual Item *EquipedItem(int id)
|
||||
{
|
||||
if (id >= 18) return &equipedItems[18];
|
||||
return &equipedItems[id];
|
||||
}
|
||||
|
||||
virtual char *MovementAnim()
|
||||
{
|
||||
return &movementAnim;
|
||||
}
|
||||
|
||||
virtual char *DrawState()
|
||||
{
|
||||
return &drawState;
|
||||
}
|
||||
|
||||
virtual ESM::Position *Dir()
|
||||
{
|
||||
return &dir;
|
||||
}
|
||||
|
||||
virtual Attack *getAttack()
|
||||
{
|
||||
return &attack;
|
||||
}
|
||||
|
||||
virtual std::string *BirthSign()
|
||||
{
|
||||
return &birthSign;
|
||||
}
|
||||
|
||||
virtual std::string *ChatMessage()
|
||||
{
|
||||
return &chatMessage;
|
||||
}
|
||||
|
||||
virtual CGStage *CharGenStage()
|
||||
{
|
||||
return &stage;
|
||||
}
|
||||
|
||||
virtual std::string *getPassw()
|
||||
{
|
||||
return &passw;
|
||||
}
|
||||
RakNet::RakNetGUID guid;
|
||||
GUIMessageBox guiMessageBox;
|
||||
ESM::Class charClass;
|
||||
|
@ -218,9 +147,8 @@ namespace mwmp
|
|||
bool ignorePosPacket;
|
||||
ESM::ActiveSpells activeSpells;
|
||||
|
||||
protected:
|
||||
ESM::Position pos;
|
||||
ESM::Position dir;
|
||||
ESM::Position position;
|
||||
ESM::Position direction;
|
||||
ESM::Cell cell;
|
||||
ESM::NPC npc;
|
||||
ESM::NpcStats npcStats;
|
||||
|
@ -230,9 +158,9 @@ namespace mwmp
|
|||
char movementAnim;
|
||||
char drawState;
|
||||
Attack attack;
|
||||
std::string birthSign;
|
||||
std::string birthsign;
|
||||
std::string chatMessage;
|
||||
CGStage stage;
|
||||
CGStage charGenStage;
|
||||
std::string passw;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@ void PacketAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->getAttack()->attacker, send);
|
||||
RW(player->getAttack()->target, send);
|
||||
RW(player->getAttack()->refid, send);
|
||||
RW(player->getAttack()->type, send);
|
||||
RW(player->getAttack()->success, send);
|
||||
RW(player->getAttack()->damage, send);
|
||||
RW(player->attack.attacker, send);
|
||||
RW(player->attack.target, send);
|
||||
RW(player->attack.refid, send);
|
||||
RW(player->attack.type, send);
|
||||
RW(player->attack.success, send);
|
||||
RW(player->attack.damage, send);
|
||||
//
|
||||
RW(player->getAttack()->pressed, send);
|
||||
RW(player->getAttack()->knockdown, send);
|
||||
RW(player->getAttack()->block, send);
|
||||
RW(player->attack.pressed, send);
|
||||
RW(player->attack.knockdown, send);
|
||||
RW(player->attack.block, send);
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ void PacketAttribute::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen
|
|||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
for (int i = 0; i < AttributeCount; ++i)
|
||||
RW(player->CreatureStats()->mAttributes[i], send);
|
||||
RW(player->creatureStats.mAttributes[i], send);
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ void PacketBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->Npc()->mName, send);
|
||||
RW(player->Npc()->mModel, send);
|
||||
RW(player->Npc()->mRace, send);
|
||||
RW(player->Npc()->mHair, send);
|
||||
RW(player->Npc()->mHead, send);
|
||||
RW(player->npc.mName, send);
|
||||
RW(player->npc.mModel, send);
|
||||
RW(player->npc.mRace, send);
|
||||
RW(player->npc.mHair, send);
|
||||
RW(player->npc.mHead, send);
|
||||
|
||||
RW(player->Npc()->mFlags, send);
|
||||
RW(player->npc.mFlags, send);
|
||||
|
||||
RW(*player->BirthSign(), send);
|
||||
RW(player->birthsign, send);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ void mwmp::PacketCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(*player->CharGenStage(), send);
|
||||
RW(player->charGenStage, send);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ void mwmp::PacketChatMessage::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *pl
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(*player->ChatMessage(), send);
|
||||
RW(player->chatMessage, send);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace mwmp
|
|||
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
RW(player->CreatureStats()->mDead, send);
|
||||
RW(player->creatureStats.mDead, send);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ void mwmp::PacketDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *play
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(*player->MovementFlags(), send);
|
||||
RW(player->movementFlags, send);
|
||||
|
||||
RW(*player->DrawState(), send);
|
||||
RW(player->drawState, send);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : PlayerP
|
|||
void PacketDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
RW(player->CreatureStats()->mDynamic[0], send); // health
|
||||
RW(player->CreatureStats()->mDynamic[1], send); // magic
|
||||
RW(player->CreatureStats()->mDynamic[2], send); // fatigue
|
||||
RW(player->creatureStats.mDynamic[0], send); // health
|
||||
RW(player->creatureStats.mDynamic[1], send); // magic
|
||||
RW(player->creatureStats.mDynamic[2], send); // fatigue
|
||||
}
|
|
@ -18,8 +18,8 @@ void PacketEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen
|
|||
|
||||
for (int i = 0; i < 19; i++)
|
||||
{
|
||||
RW(player->EquipedItem(i)->refid, send);
|
||||
RW(player->EquipedItem(i)->count, send);
|
||||
RW(player->EquipedItem(i)->health, send);
|
||||
RW(player->equipedItems[i].refid, send);
|
||||
RW(player->equipedItems[i].count, send);
|
||||
RW(player->equipedItems[i].health, send);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : PlayerPacket(
|
|||
void PacketHandshake::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
RW(player->Npc()->mName, send);
|
||||
RW(*player->getPassw(), send);
|
||||
RW(player->npc.mName, send);
|
||||
RW(player->passw, send);
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ void PacketLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->CreatureStats()->mLevel, send);
|
||||
RW(player->creatureStats.mLevel, send);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ void mwmp::PacketPlayerCellChange::Packet(RakNet::BitStream *bs, mwmp::BasePlaye
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->getCell()->mData.mFlags, send);
|
||||
RW(player->getCell()->mData.mX, send);
|
||||
RW(player->getCell()->mData.mY, send);
|
||||
RW(player->getCell()->mName, send);
|
||||
RW(player->cell.mData.mFlags, send);
|
||||
RW(player->cell.mData.mX, send);
|
||||
RW(player->cell.mData.mY, send);
|
||||
RW(player->cell.mName, send);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,4 @@ mwmp::PacketPlayerCellLoad::PacketPlayerCellLoad(RakNet::RakPeerInterface *peer)
|
|||
void mwmp::PacketPlayerCellLoad::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->getCell()->mData.mFlags, send);
|
||||
RW(player->getCell()->mData.mX, send);
|
||||
RW(player->getCell()->mData.mY, send);
|
||||
RW(player->getCell()->mName, send);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ void PacketPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send
|
|||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
RW(*player->Position(), send);
|
||||
RW(*player->Dir(), send);
|
||||
RW(player->position, send);
|
||||
RW(player->direction, send);
|
||||
}
|
|
@ -21,7 +21,7 @@ namespace mwmp
|
|||
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, player, send);
|
||||
RW(player->CreatureStats()->mDead, send);
|
||||
RW(player->creatureStats.mDead, send);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ void PacketSkill::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
|||
PlayerPacket::Packet(bs, player, send);
|
||||
|
||||
for (int i = 0; i < SkillCount; ++i)
|
||||
RW(player->NpcStats()->mSkills[i], send);
|
||||
RW(player->npcStats.mSkills[i], send);
|
||||
|
||||
for (int i = 0; i < AttributeCount; ++i)
|
||||
RW(player->NpcStats()->mSkillIncrease[i], send);
|
||||
RW(player->npcStats.mSkillIncrease[i], send);
|
||||
|
||||
RW(player->NpcStats()->mLevelProgress, send);
|
||||
RW(player->npcStats.mLevelProgress, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue