mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-24 07:34:20 +00:00
Compare commits
4 Commits
chore--mou
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d523a1e7b | ||
|
|
5745742c91 | ||
|
|
62f58f5307 | ||
|
|
83707e2210 |
@@ -369,8 +369,21 @@ public:
|
|||||||
|
|
||||||
template<typename AmfType = AMFArrayValue>
|
template<typename AmfType = AMFArrayValue>
|
||||||
AmfType& PushDebug(const std::string_view name) {
|
AmfType& PushDebug(const std::string_view name) {
|
||||||
|
size_t i = 0;
|
||||||
|
for (; i < m_Dense.size(); i++) {
|
||||||
|
const auto& cast = dynamic_cast<AMFArrayValue*>(m_Dense[i].get());
|
||||||
|
if (!cast) continue;
|
||||||
|
|
||||||
|
const auto& nameValue = cast->Get<std::string>("name");
|
||||||
|
if (!nameValue || nameValue->GetValue() != name) continue;
|
||||||
|
|
||||||
|
// found a duplicate, return this instead
|
||||||
|
auto valueCast = dynamic_cast<AmfType*>(cast->Get("value"));
|
||||||
|
if (valueCast) return *valueCast;
|
||||||
|
}
|
||||||
|
|
||||||
auto* value = PushArray();
|
auto* value = PushArray();
|
||||||
value->Insert("name", name.data());
|
value->Insert<std::string>("name", name.data());
|
||||||
return value->Insert<AmfType>("value", std::make_unique<AmfType>());
|
return value->Insert<AmfType>("value", std::make_unique<AmfType>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -521,6 +521,10 @@ void BaseCombatAIComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsI
|
|||||||
|
|
||||||
void BaseCombatAIComponent::SetAiState(AiState newState) {
|
void BaseCombatAIComponent::SetAiState(AiState newState) {
|
||||||
if (newState == this->m_State) return;
|
if (newState == this->m_State) return;
|
||||||
|
GameMessages::NotifyCombatAIStateChange stateMsg;
|
||||||
|
stateMsg.prevState = this->m_State;
|
||||||
|
stateMsg.newState = newState;
|
||||||
|
m_Parent->HandleMsg(stateMsg);
|
||||||
this->m_State = newState;
|
this->m_State = newState;
|
||||||
m_DirtyStateOrTarget = true;
|
m_DirtyStateOrTarget = true;
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
|
|||||||
@@ -723,10 +723,6 @@ void InventoryComponent::Serialize(RakNet::BitStream& outBitStream, const bool b
|
|||||||
for (const auto& pair : m_Equipped) {
|
for (const auto& pair : m_Equipped) {
|
||||||
const auto item = pair.second;
|
const auto item = pair.second;
|
||||||
|
|
||||||
if (bIsInitialUpdate) {
|
|
||||||
AddItemSkills(item.lot);
|
|
||||||
}
|
|
||||||
|
|
||||||
outBitStream.Write(item.id);
|
outBitStream.Write(item.id);
|
||||||
outBitStream.Write(item.lot);
|
outBitStream.Write(item.lot);
|
||||||
|
|
||||||
@@ -984,9 +980,6 @@ void InventoryComponent::UnequipScripts(Item* unequippedItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InventoryComponent::HandlePossession(Item* item) {
|
void InventoryComponent::HandlePossession(Item* item) {
|
||||||
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
|
||||||
if (!characterComponent) return;
|
|
||||||
|
|
||||||
auto* possessorComponent = m_Parent->GetComponent<PossessorComponent>();
|
auto* possessorComponent = m_Parent->GetComponent<PossessorComponent>();
|
||||||
if (!possessorComponent) return;
|
if (!possessorComponent) return;
|
||||||
|
|
||||||
@@ -1002,52 +995,31 @@ void InventoryComponent::HandlePossession(Item* item) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
// Set the mount item ID so that we know what we're handling
|
||||||
|
|
||||||
// Set the mount Item ID so that we know what were handling
|
|
||||||
possessorComponent->SetMountItemID(item->GetId());
|
possessorComponent->SetMountItemID(item->GetId());
|
||||||
GameMessages::SendSetMountInventoryID(m_Parent, item->GetId(), UNASSIGNED_SYSTEM_ADDRESS);
|
GameMessages::SendSetMountInventoryID(m_Parent, item->GetId(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
|
|
||||||
// Create entity to mount
|
// Create the mount entity
|
||||||
auto startRotation = m_Parent->GetRotation();
|
|
||||||
|
|
||||||
EntityInfo info{};
|
EntityInfo info{};
|
||||||
info.lot = item->GetLot();
|
info.lot = item->GetLot();
|
||||||
info.pos = m_Parent->GetPosition();
|
info.pos = m_Parent->GetPosition();
|
||||||
info.rot = startRotation;
|
info.rot = m_Parent->GetRotation();
|
||||||
info.spawnerID = m_Parent->GetObjectID();
|
info.spawnerID = m_Parent->GetObjectID();
|
||||||
|
|
||||||
auto* mount = Game::entityManager->CreateEntity(info, nullptr, m_Parent);
|
auto* mount = Game::entityManager->CreateEntity(info, nullptr, m_Parent);
|
||||||
|
|
||||||
// Check to see if the mount is a vehicle, if so, flip it
|
|
||||||
auto* vehicleComponent = mount->GetComponent<HavokVehiclePhysicsComponent>();
|
|
||||||
if (vehicleComponent) characterComponent->SetIsRacing(true);
|
|
||||||
|
|
||||||
// Setup the destroyable stats
|
|
||||||
auto* destroyableComponent = mount->GetComponent<DestroyableComponent>();
|
|
||||||
if (destroyableComponent) {
|
|
||||||
destroyableComponent->SetIsImmune(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mount it
|
|
||||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||||
if (possessableComponent) {
|
if (possessableComponent) {
|
||||||
possessableComponent->SetIsItemSpawned(true);
|
possessableComponent->SetIsItemSpawned(true);
|
||||||
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
||||||
// Possess it
|
|
||||||
possessorComponent->SetPossessable(mount->GetObjectID());
|
|
||||||
possessorComponent->SetPossessableType(possessableComponent->GetPossessionType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMessages::SendSetJetPackMode(m_Parent, false);
|
auto* destroyableComponent = mount->GetComponent<DestroyableComponent>();
|
||||||
|
if (destroyableComponent) destroyableComponent->SetIsImmune(true);
|
||||||
|
|
||||||
// Make it go to the client
|
|
||||||
Game::entityManager->ConstructEntity(mount);
|
Game::entityManager->ConstructEntity(mount);
|
||||||
// Update the possessor
|
possessorComponent->Mount(mount);
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
|
||||||
|
|
||||||
// have to unlock the input so it vehicle can be driven
|
|
||||||
if (vehicleComponent) GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
|
|
||||||
GameMessages::SendMarkInventoryItemAsActive(m_Parent->GetObjectID(), true, eUnequippableActiveType::MOUNT, item->GetId(), m_Parent->GetSystemAddress());
|
GameMessages::SendMarkInventoryItemAsActive(m_Parent->GetObjectID(), true, eUnequippableActiveType::MOUNT, item->GetId(), m_Parent->GetSystemAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,14 +1147,12 @@ LOT InventoryComponent::GetConsumable() const {
|
|||||||
void InventoryComponent::AddItemSkills(const LOT lot) {
|
void InventoryComponent::AddItemSkills(const LOT lot) {
|
||||||
const auto info = Inventory::FindItemComponent(lot);
|
const auto info = Inventory::FindItemComponent(lot);
|
||||||
|
|
||||||
const auto slot = FindBehaviorSlot(static_cast<eItemType>(info.itemType));
|
const auto slot = FindBehaviorSlot(info.equipLocation);
|
||||||
|
|
||||||
if (slot == BehaviorSlot::Invalid) {
|
if (slot == BehaviorSlot::Invalid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto index = m_Skills.find(slot);
|
|
||||||
|
|
||||||
const auto skill = FindSkill(lot);
|
const auto skill = FindSkill(lot);
|
||||||
|
|
||||||
SetSkill(slot, skill);
|
SetSkill(slot, skill);
|
||||||
@@ -1210,7 +1180,7 @@ void InventoryComponent::FixInvisibleItems() {
|
|||||||
void InventoryComponent::RemoveItemSkills(const LOT lot) {
|
void InventoryComponent::RemoveItemSkills(const LOT lot) {
|
||||||
const auto info = Inventory::FindItemComponent(lot);
|
const auto info = Inventory::FindItemComponent(lot);
|
||||||
|
|
||||||
const auto slot = FindBehaviorSlot(static_cast<eItemType>(info.itemType));
|
const auto slot = FindBehaviorSlot(info.equipLocation);
|
||||||
|
|
||||||
if (slot == BehaviorSlot::Invalid) {
|
if (slot == BehaviorSlot::Invalid) {
|
||||||
return;
|
return;
|
||||||
@@ -1222,15 +1192,31 @@ void InventoryComponent::RemoveItemSkills(const LOT lot) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto old = index->second;
|
const auto skillId = FindSkill(lot);
|
||||||
|
|
||||||
GameMessages::SendRemoveSkill(m_Parent, old);
|
// Only act on this slot if it still holds the skill from this item.
|
||||||
|
// Another item may have overwritten the slot since this one was equipped.
|
||||||
|
if (index->second != skillId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_Skills.erase(slot);
|
m_Skills.erase(slot);
|
||||||
|
|
||||||
|
// Find another slot that still holds this skillID (if any).
|
||||||
|
const auto surviving = std::ranges::find_if(m_Skills, [skillId](const auto& pair) {
|
||||||
|
return pair.second == skillId;
|
||||||
|
});
|
||||||
|
|
||||||
|
// The client stores one acquiredSkillsInfo entry per skillID, tagged with the slotID
|
||||||
|
// it was originally added with. Always send RemoveSkill to clear that entry, then
|
||||||
|
// re-add with the surviving slot so the client shows it in the correct place.
|
||||||
|
GameMessages::SendRemoveSkill(m_Parent, skillId);
|
||||||
|
if (surviving != m_Skills.end()) {
|
||||||
|
GameMessages::SendAddSkill(m_Parent, skillId, surviving->first);
|
||||||
|
}
|
||||||
|
|
||||||
if (slot == BehaviorSlot::Primary) {
|
if (slot == BehaviorSlot::Primary) {
|
||||||
m_Skills.insert_or_assign(BehaviorSlot::Primary, 1);
|
m_Skills.insert_or_assign(BehaviorSlot::Primary, 1);
|
||||||
|
|
||||||
GameMessages::SendAddSkill(m_Parent, 1, BehaviorSlot::Primary);
|
GameMessages::SendAddSkill(m_Parent, 1, BehaviorSlot::Primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1322,22 +1308,16 @@ void InventoryComponent::RemoveDatabasePet(LWOOBJID id) {
|
|||||||
m_Pets.erase(id);
|
m_Pets.erase(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BehaviorSlot InventoryComponent::FindBehaviorSlot(const eItemType type) {
|
BehaviorSlot InventoryComponent::FindBehaviorSlot(const std::string& equipLocation) {
|
||||||
switch (type) {
|
// Skill slot is determined by equipLocation, not itemType.
|
||||||
case eItemType::HAT:
|
// Mapping confirmed against live captures and client data (issue #1339).
|
||||||
return BehaviorSlot::Head;
|
if (equipLocation == "special_r") return BehaviorSlot::Primary;
|
||||||
case eItemType::NECK:
|
if (equipLocation == "hair") return BehaviorSlot::Head;
|
||||||
return BehaviorSlot::Neck;
|
if (equipLocation == "special_l") return BehaviorSlot::Offhand;
|
||||||
case eItemType::LEFT_HAND:
|
if (equipLocation == "clavicle") return BehaviorSlot::Neck;
|
||||||
return BehaviorSlot::Offhand;
|
|
||||||
case eItemType::RIGHT_HAND:
|
|
||||||
return BehaviorSlot::Primary;
|
|
||||||
case eItemType::CONSUMABLE:
|
|
||||||
return BehaviorSlot::Consumable;
|
|
||||||
default:
|
|
||||||
return BehaviorSlot::Invalid;
|
return BehaviorSlot::Invalid;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool InventoryComponent::IsTransferInventory(eInventoryType type, bool includeVault) {
|
bool InventoryComponent::IsTransferInventory(eInventoryType type, bool includeVault) {
|
||||||
return type == VENDOR_BUYBACK || (includeVault && (type == VAULT_ITEMS || type == VAULT_MODELS)) || type == TEMP_ITEMS || type == TEMP_MODELS || type == MODELS_IN_BBB;
|
return type == VENDOR_BUYBACK || (includeVault && (type == VAULT_ITEMS || type == VAULT_MODELS)) || type == TEMP_ITEMS || type == TEMP_MODELS || type == MODELS_IN_BBB;
|
||||||
@@ -1679,10 +1659,28 @@ bool InventoryComponent::SetSkill(BehaviorSlot slot, uint32_t skillId) {
|
|||||||
const auto index = m_Skills.find(slot);
|
const auto index = m_Skills.find(slot);
|
||||||
if (index != m_Skills.end()) {
|
if (index != m_Skills.end()) {
|
||||||
const auto old = index->second;
|
const auto old = index->second;
|
||||||
|
// Only remove the old skill from the client if no other slot still holds it.
|
||||||
|
// The client's acquiredSkillsInfo is keyed by skillID (one entry per skill),
|
||||||
|
// so RemoveSkill clears it globally — sending it while another slot still uses
|
||||||
|
// the same skillID would break that slot on the client.
|
||||||
|
const auto usedElsewhere = std::ranges::any_of(m_Skills, [&](const auto& pair) {
|
||||||
|
return pair.first != slot && pair.second == old;
|
||||||
|
});
|
||||||
|
if (!usedElsewhere) {
|
||||||
GameMessages::SendRemoveSkill(m_Parent, old);
|
GameMessages::SendRemoveSkill(m_Parent, old);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only send AddSkill if the client doesn't already know about this skillID.
|
||||||
|
// The client early-exits on duplicate AddSkill (same skillID already in
|
||||||
|
// acquiredSkillsInfo) without updating the slot — so only send when it's new.
|
||||||
|
const auto alreadyKnown = std::ranges::any_of(m_Skills, [&](const auto& pair) {
|
||||||
|
return pair.first != slot && pair.second == skillId;
|
||||||
|
});
|
||||||
|
if (!alreadyKnown) {
|
||||||
GameMessages::SendAddSkill(m_Parent, skillId, slot);
|
GameMessages::SendAddSkill(m_Parent, skillId, slot);
|
||||||
|
}
|
||||||
|
|
||||||
m_Skills.insert_or_assign(slot, skillId);
|
m_Skills.insert_or_assign(slot, skillId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,11 +367,10 @@ public:
|
|||||||
void RemoveDatabasePet(LWOOBJID id);
|
void RemoveDatabasePet(LWOOBJID id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current behavior slot active for the passed item type
|
* Returns the behavior slot for the given equipLocation string.
|
||||||
* @param type the item type to find the behavior slot for
|
* This is the authoritative mapping used for skill slot assignment.
|
||||||
* @return the current behavior slot active for the passed item type
|
|
||||||
*/
|
*/
|
||||||
static BehaviorSlot FindBehaviorSlot(eItemType type);
|
static BehaviorSlot FindBehaviorSlot(const std::string& equipLocation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the inventory type is a temp inventory
|
* Checks if the inventory type is a temp inventory
|
||||||
@@ -403,6 +402,8 @@ public:
|
|||||||
|
|
||||||
std::map<BehaviorSlot, uint32_t> GetSkills() { return m_Skills; };
|
std::map<BehaviorSlot, uint32_t> GetSkills() { return m_Skills; };
|
||||||
|
|
||||||
|
void ClearSkills() { m_Skills.clear(); };
|
||||||
|
|
||||||
bool SetSkill(int slot, uint32_t skillId);
|
bool SetSkill(int slot, uint32_t skillId);
|
||||||
bool SetSkill(BehaviorSlot slot, uint32_t skillId);
|
bool SetSkill(BehaviorSlot slot, uint32_t skillId);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ PossessableComponent::PossessableComponent(Entity* parent, const int32_t compone
|
|||||||
m_AnimationFlag = static_cast<eAnimationFlags>(item.animationFlag);
|
m_AnimationFlag = static_cast<eAnimationFlags>(item.animationFlag);
|
||||||
|
|
||||||
// Get the possession Type from the CDClient
|
// Get the possession Type from the CDClient
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT possessionType, depossessOnHit FROM PossessableComponent WHERE id = ?;");
|
auto query = CDClientDatabase::CreatePreppedStmt("SELECT possessionType, depossessOnHit, skillSet FROM PossessableComponent WHERE id = ?;");
|
||||||
|
|
||||||
query.bind(1, static_cast<int>(componentID));
|
query.bind(1, static_cast<int>(componentID));
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ PossessableComponent::PossessableComponent(Entity* parent, const int32_t compone
|
|||||||
if (!result.eof()) {
|
if (!result.eof()) {
|
||||||
m_PossessionType = static_cast<ePossessionType>(result.getIntField("possessionType", 1)); // Default to Attached Visible
|
m_PossessionType = static_cast<ePossessionType>(result.getIntField("possessionType", 1)); // Default to Attached Visible
|
||||||
m_DepossessOnHit = static_cast<bool>(result.getIntField("depossessOnHit", 0));
|
m_DepossessOnHit = static_cast<bool>(result.getIntField("depossessOnHit", 0));
|
||||||
|
m_SkillSet = result.getIntField("skillSet", 0);
|
||||||
} else {
|
} else {
|
||||||
m_PossessionType = ePossessionType::ATTACHED_VISIBLE;
|
m_PossessionType = ePossessionType::ATTACHED_VISIBLE;
|
||||||
m_DepossessOnHit = false;
|
m_DepossessOnHit = false;
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool GetDepossessOnHit() const { return m_DepossessOnHit; };
|
bool GetDepossessOnHit() const { return m_DepossessOnHit; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the skill set ID for this possessable (0 = no skill set)
|
||||||
|
* @return the skill set ID
|
||||||
|
*/
|
||||||
|
int32_t GetSkillSet() const { return m_SkillSet; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forcibly depossess the Entity
|
* Forcibly depossess the Entity
|
||||||
*/
|
*/
|
||||||
@@ -118,4 +124,9 @@ private:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool m_ItemSpawned = false;
|
bool m_ItemSpawned = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Skill set ID from PossessableComponent CDClient table (0 = none)
|
||||||
|
*/
|
||||||
|
int32_t m_SkillSet = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
#include "PossessorComponent.h"
|
#include "PossessorComponent.h"
|
||||||
#include "PossessableComponent.h"
|
#include "PossessableComponent.h"
|
||||||
#include "CharacterComponent.h"
|
#include "CharacterComponent.h"
|
||||||
|
#include "HavokVehiclePhysicsComponent.h"
|
||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "GameMessages.h"
|
#include "GameMessages.h"
|
||||||
#include "eUnequippableActiveType.h"
|
#include "eUnequippableActiveType.h"
|
||||||
#include "eControlScheme.h"
|
|
||||||
#include "eStateChangeType.h"
|
|
||||||
|
|
||||||
PossessorComponent::PossessorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
PossessorComponent::PossessorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||||
m_Possessable = LWOOBJID_EMPTY;
|
m_Possessable = LWOOBJID_EMPTY;
|
||||||
@@ -42,21 +41,27 @@ void PossessorComponent::Mount(Entity* mount) {
|
|||||||
// Don't do anything if we are busy dismounting
|
// Don't do anything if we are busy dismounting
|
||||||
if (GetIsDismounting() || !mount) return;
|
if (GetIsDismounting() || !mount) return;
|
||||||
|
|
||||||
GameMessages::SendSetMountInventoryID(m_Parent, mount->GetObjectID(), UNASSIGNED_SYSTEM_ADDRESS);
|
|
||||||
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
auto* possessableComponent = mount->GetComponent<PossessableComponent>();
|
||||||
if (possessableComponent) {
|
if (possessableComponent) {
|
||||||
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
possessableComponent->SetPossessor(m_Parent->GetObjectID());
|
||||||
SetPossessable(mount->GetObjectID());
|
SetPossessable(mount->GetObjectID());
|
||||||
SetPossessableType(possessableComponent->GetPossessionType());
|
SetPossessableType(possessableComponent->GetPossessionType());
|
||||||
|
if (possessableComponent->GetSkillSet() != 0) {
|
||||||
|
GameMessages::UseSkillSet useSkillSet;
|
||||||
|
useSkillSet.target = m_Parent->GetObjectID();
|
||||||
|
useSkillSet.possessedId = mount->GetObjectID();
|
||||||
|
useSkillSet.setId = possessableComponent->GetSkillSet();
|
||||||
|
useSkillSet.Send(m_Parent->GetSystemAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
|
||||||
if (characterComponent) characterComponent->SetIsRacing(true);
|
|
||||||
|
|
||||||
// GM's to send
|
// GM's to send
|
||||||
GameMessages::SendSetJetPackMode(m_Parent, false);
|
GameMessages::SendSetJetPackMode(m_Parent, false);
|
||||||
|
if (mount->GetComponent<HavokVehiclePhysicsComponent>()) {
|
||||||
|
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||||
|
if (characterComponent) characterComponent->SetIsRacing(true);
|
||||||
GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
|
GameMessages::SendVehicleUnlockInput(mount->GetObjectID(), false, m_Parent->GetSystemAddress());
|
||||||
GameMessages::SendSetStunned(m_Parent->GetObjectID(), eStateChangeType::PUSH, m_Parent->GetSystemAddress(), LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
}
|
||||||
|
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
Game::entityManager->SerializeEntity(mount);
|
Game::entityManager->SerializeEntity(mount);
|
||||||
@@ -72,13 +77,21 @@ void PossessorComponent::Dismount(Entity* mount, bool forceDismount) {
|
|||||||
if (possessableComponent) {
|
if (possessableComponent) {
|
||||||
possessableComponent->SetPossessor(LWOOBJID_EMPTY);
|
possessableComponent->SetPossessor(LWOOBJID_EMPTY);
|
||||||
if (forceDismount) possessableComponent->ForceDepossess();
|
if (forceDismount) possessableComponent->ForceDepossess();
|
||||||
|
if (possessableComponent->GetSkillSet() != 0) {
|
||||||
|
GameMessages::UseSkillSet useSkillSet;
|
||||||
|
useSkillSet.target = m_Parent->GetObjectID();
|
||||||
|
useSkillSet.possessedId = mount->GetObjectID();
|
||||||
|
useSkillSet.setId = possessableComponent->GetSkillSet();
|
||||||
|
useSkillSet.bRemove = true;
|
||||||
|
useSkillSet.Send(m_Parent->GetSystemAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Game::entityManager->SerializeEntity(m_Parent);
|
Game::entityManager->SerializeEntity(m_Parent);
|
||||||
Game::entityManager->SerializeEntity(mount);
|
Game::entityManager->SerializeEntity(mount);
|
||||||
|
|
||||||
|
if (mount->GetComponent<HavokVehiclePhysicsComponent>()) {
|
||||||
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
auto characterComponent = m_Parent->GetComponent<CharacterComponent>();
|
||||||
if (characterComponent) characterComponent->SetIsRacing(false);
|
if (characterComponent) characterComponent->SetIsRacing(false);
|
||||||
}
|
}
|
||||||
// Make sure we don't have wacky controls
|
}
|
||||||
GameMessages::SendSetPlayerControlScheme(m_Parent, eControlScheme::SCHEME_A);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ScriptComponent::ScriptComponent(Entity* parent, const int32_t componentID, cons
|
|||||||
m_ScriptName = scriptName;
|
m_ScriptName = scriptName;
|
||||||
|
|
||||||
SetScript(scriptName);
|
SetScript(scriptName);
|
||||||
RegisterMsg(&ScriptComponent::OnGetObjectReportInfo);
|
Component::RegisterMsg(&ScriptComponent::OnGetObjectReportInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
|
void ScriptComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) {
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
|
#include "GameMessages.h"
|
||||||
|
#include <functional>
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
|
|
||||||
@@ -45,6 +48,19 @@ public:
|
|||||||
|
|
||||||
bool OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo);
|
bool OnGetObjectReportInfo(GameMessages::GetObjectReportInfo& reportInfo);
|
||||||
|
|
||||||
|
// Registers a message from a script to be listened for on the parent object
|
||||||
|
template<typename ScriptClass, typename DerivedMsgType>
|
||||||
|
void RegisterMsg(ScriptClass* scriptThis, bool (ScriptClass::*scriptHandler)(Entity&, DerivedMsgType&)) {
|
||||||
|
static_assert(std::is_base_of_v<GameMessages::GameMsg, DerivedMsgType>, "DerivedMsgType must derive from GameMessages::GameMsg base class.");
|
||||||
|
const auto boundMsg = std::bind(scriptHandler, scriptThis, std::placeholders::_1, std::placeholders::_2);
|
||||||
|
auto* const parent = m_Parent;
|
||||||
|
const auto castWrapper = [parent, boundMsg](GameMessages::GameMsg& msg) {
|
||||||
|
return boundMsg(*parent, static_cast<DerivedMsgType&>(msg));
|
||||||
|
};
|
||||||
|
DerivedMsgType msg;
|
||||||
|
m_Parent->RegisterMsg(msg.msgId, castWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -159,6 +159,10 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
|
|||||||
|
|
||||||
InventoryComponent* inv = entity->GetComponent<InventoryComponent>();
|
InventoryComponent* inv = entity->GetComponent<InventoryComponent>();
|
||||||
if (inv) {
|
if (inv) {
|
||||||
|
// Clear server-side skill state so AddItemSkills sends fresh AddSkill
|
||||||
|
// packets to the now-ready client. Skills sent during entity construction
|
||||||
|
// (Serialize) arrive before LWOSkillComponent is initialized and are dropped.
|
||||||
|
inv->ClearSkills();
|
||||||
auto items = inv->GetEquippedItems();
|
auto items = inv->GetEquippedItems();
|
||||||
for (auto pair : items) {
|
for (auto pair : items) {
|
||||||
const auto item = pair.second;
|
const auto item = pair.second;
|
||||||
|
|||||||
@@ -3944,11 +3944,19 @@ void GameMessages::SendSetMountInventoryID(Entity* entity, const LWOOBJID& objec
|
|||||||
CMSGHEADER;
|
CMSGHEADER;
|
||||||
bitStream.Write(entity->GetObjectID());
|
bitStream.Write(entity->GetObjectID());
|
||||||
bitStream.Write(MessageType::Game::SET_MOUNT_INVENTORY_ID);
|
bitStream.Write(MessageType::Game::SET_MOUNT_INVENTORY_ID);
|
||||||
bitStream.Write(objectID);
|
bitStream.Write(objectID != LWOOBJID_EMPTY);
|
||||||
|
if (objectID != LWOOBJID_EMPTY) bitStream.Write(objectID);
|
||||||
|
|
||||||
SEND_PACKET_BROADCAST;
|
SEND_PACKET_BROADCAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameMessages::UseSkillSet::Serialize(RakNet::BitStream& bitStream) const {
|
||||||
|
bitStream.Write(bRemove);
|
||||||
|
bitStream.Write(possessedId != LWOOBJID_EMPTY);
|
||||||
|
if (possessedId != LWOOBJID_EMPTY) bitStream.Write(possessedId);
|
||||||
|
bitStream.Write(setId != -1);
|
||||||
|
if (setId != -1) bitStream.Write(setId);
|
||||||
|
}
|
||||||
|
|
||||||
void GameMessages::HandleDismountComplete(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleDismountComplete(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
// Get the objectID from the bitstream
|
// Get the objectID from the bitstream
|
||||||
@@ -3984,9 +3992,6 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream& inStream, Entity* e
|
|||||||
|
|
||||||
// Update the entity that was possessing
|
// Update the entity that was possessing
|
||||||
Game::entityManager->SerializeEntity(entity);
|
Game::entityManager->SerializeEntity(entity);
|
||||||
|
|
||||||
// We aren't mounted so remove the stun
|
|
||||||
GameMessages::SendSetStunned(entity->GetObjectID(), eStateChangeType::POP, UNASSIGNED_SYSTEM_ADDRESS, LWOOBJID_EMPTY, true, false, true, false, false, false, false, true, true, true, true, true, true, true, true, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3994,11 +3999,15 @@ void GameMessages::HandleDismountComplete(RakNet::BitStream& inStream, Entity* e
|
|||||||
|
|
||||||
void GameMessages::HandleAcknowledgePossession(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleAcknowledgePossession(RakNet::BitStream& inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
Game::entityManager->SerializeEntity(entity);
|
Game::entityManager->SerializeEntity(entity);
|
||||||
|
bool hasObjectId{};
|
||||||
|
inStream.Read(hasObjectId);
|
||||||
|
if (hasObjectId) {
|
||||||
LWOOBJID objectId{};
|
LWOOBJID objectId{};
|
||||||
inStream.Read(objectId);
|
inStream.Read(objectId);
|
||||||
auto* mount = Game::entityManager->GetEntity(objectId);
|
auto* mount = Game::entityManager->GetEntity(objectId);
|
||||||
if (mount) Game::entityManager->SerializeEntity(mount);
|
if (mount) Game::entityManager->SerializeEntity(mount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Racing
|
//Racing
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ enum class BehaviorSlot : int32_t;
|
|||||||
enum class eVendorTransactionResult : uint32_t;
|
enum class eVendorTransactionResult : uint32_t;
|
||||||
enum class eReponseMoveItemBetweenInventoryTypeCode : int32_t;
|
enum class eReponseMoveItemBetweenInventoryTypeCode : int32_t;
|
||||||
enum class eMissionState : int;
|
enum class eMissionState : int;
|
||||||
|
enum class AiState : uint32_t;
|
||||||
|
|
||||||
enum class eCameraTargetCyclingMode : int32_t {
|
enum class eCameraTargetCyclingMode : int32_t {
|
||||||
ALLOW_CYCLE_TEAMMATES,
|
ALLOW_CYCLE_TEAMMATES,
|
||||||
@@ -965,11 +966,27 @@ namespace GameMessages {
|
|||||||
LWOOBJID childID{};
|
LWOOBJID childID{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct UseSkillSet : public GameMsg {
|
||||||
|
UseSkillSet() : GameMsg(MessageType::Game::USE_SKILL_SET) {}
|
||||||
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
||||||
|
|
||||||
|
bool bRemove{};
|
||||||
|
LWOOBJID possessedId{ LWOOBJID_EMPTY };
|
||||||
|
int32_t setId{ -1 };
|
||||||
|
};
|
||||||
|
|
||||||
struct ObjectLoaded : public GameMsg {
|
struct ObjectLoaded : public GameMsg {
|
||||||
ObjectLoaded() : GameMsg(MessageType::Game::OBJECT_LOADED) {}
|
ObjectLoaded() : GameMsg(MessageType::Game::OBJECT_LOADED) {}
|
||||||
|
|
||||||
LWOOBJID objectID{};
|
LWOOBJID objectID{};
|
||||||
LOT lot{};
|
LOT lot{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NotifyCombatAIStateChange : public GameMsg {
|
||||||
|
NotifyCombatAIStateChange() : GameMsg(MessageType::Game::NOTIFY_COMBAT_AI_STATE_CHANGE) {}
|
||||||
|
|
||||||
|
AiState newState{};
|
||||||
|
AiState prevState{};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
#endif // GAMEMESSAGES_H
|
#endif // GAMEMESSAGES_H
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_FV
|
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_FV
|
||||||
|
"DragonRonin.cpp"
|
||||||
"FvMaelstromCavalry.cpp"
|
"FvMaelstromCavalry.cpp"
|
||||||
"FvMaelstromDragon.cpp"
|
"FvMaelstromDragon.cpp"
|
||||||
PARENT_SCOPE)
|
PARENT_SCOPE)
|
||||||
|
|||||||
6
dScripts/02_server/Enemy/FV/DragonRonin.cpp
Normal file
6
dScripts/02_server/Enemy/FV/DragonRonin.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "DragonRonin.h"
|
||||||
|
|
||||||
|
void DragonRonin::OnStartup(Entity* self) {
|
||||||
|
self->SetVar<float>(u"suicideTimer", 40.0f);
|
||||||
|
CountdownDestroyAI::OnStartup(self);
|
||||||
|
}
|
||||||
7
dScripts/02_server/Enemy/FV/DragonRonin.h
Normal file
7
dScripts/02_server/Enemy/FV/DragonRonin.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CountdownDestroyAI.h"
|
||||||
|
|
||||||
|
class DragonRonin : public CountdownDestroyAI {
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
};
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_GENERAL
|
set(DSCRIPTS_SOURCES_02_SERVER_ENEMY_GENERAL
|
||||||
"BaseEnemyMech.cpp"
|
"BaseEnemyMech.cpp"
|
||||||
"BaseEnemyApe.cpp"
|
"BaseEnemyApe.cpp"
|
||||||
|
"CountdownDestroyAI.cpp"
|
||||||
"GfApeSmashingQB.cpp"
|
"GfApeSmashingQB.cpp"
|
||||||
"TreasureChestDragonServer.cpp"
|
"TreasureChestDragonServer.cpp"
|
||||||
"EnemyNjBuff.cpp"
|
"EnemyNjBuff.cpp"
|
||||||
|
|||||||
50
dScripts/02_server/Enemy/General/CountdownDestroyAI.cpp
Normal file
50
dScripts/02_server/Enemy/General/CountdownDestroyAI.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#include "CountdownDestroyAI.h"
|
||||||
|
|
||||||
|
#include "BaseCombatAIComponent.h"
|
||||||
|
#include "ScriptComponent.h"
|
||||||
|
|
||||||
|
void CountdownDestroyAI::OnStartup(Entity* self) {
|
||||||
|
CountdownStartup(*self);
|
||||||
|
auto* scriptComp = self->GetComponent<ScriptComponent>();
|
||||||
|
if (scriptComp) scriptComp->RegisterMsg(this, &CountdownDestroyAI::OnNotifyCombatAIStateChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountdownDestroyAI::CountdownStartup(Entity& self) {
|
||||||
|
auto suicideTimer = self.GetVar<float>(u"suicideTimer");
|
||||||
|
if (suicideTimer == 0.0f) suicideTimer = 60;
|
||||||
|
self.AddTimer("Dead", suicideTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountdownDestroyAI::OnHit(Entity* self, Entity* attacker) {
|
||||||
|
if (!self->GetVar<bool>(u"ShouldBeDead")) return;
|
||||||
|
self->CancelTimer("IsBeingAttacked");
|
||||||
|
self->AddTimer("Dead", 5.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountdownDestroyAI::OnTimerDone(Entity* self, std::string timerName) {
|
||||||
|
if (timerName == "Dead") {
|
||||||
|
self->SetVar<bool>(u"ShouldBeDead", true);
|
||||||
|
if (self->GetVar<bool>(u"Busy")) {
|
||||||
|
self->AddTimer("IsBeingAttacked", 5.0f);
|
||||||
|
} else {
|
||||||
|
self->Smash();
|
||||||
|
}
|
||||||
|
} else if (timerName == "IsBeingAttacked") {
|
||||||
|
self->Smash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CountdownDestroyAI::OnNotifyCombatAIStateChange(Entity& self, GameMessages::NotifyCombatAIStateChange& notifyMsg) {
|
||||||
|
const auto curState = notifyMsg.newState;
|
||||||
|
if (curState == AiState::dead) return true;
|
||||||
|
|
||||||
|
if (curState == AiState::aggro || curState == AiState::tether) {
|
||||||
|
self.SetVar(u"Busy", true);
|
||||||
|
} else {
|
||||||
|
self.SetVar(u"Busy", false);
|
||||||
|
if (self.GetVar<bool>(u"ShouldBeDead")) {
|
||||||
|
self.Smash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
13
dScripts/02_server/Enemy/General/CountdownDestroyAI.h
Normal file
13
dScripts/02_server/Enemy/General/CountdownDestroyAI.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
#include "GameMessages.h"
|
||||||
|
|
||||||
|
class CountdownDestroyAI : public CppScripts::Script {
|
||||||
|
public:
|
||||||
|
void OnStartup(Entity* self) override;
|
||||||
|
void CountdownStartup(Entity& self);
|
||||||
|
void OnHit(Entity* self, Entity* attacker) override;
|
||||||
|
void OnTimerDone(Entity* self, std::string timerName) override;
|
||||||
|
bool OnNotifyCombatAIStateChange(Entity& self, GameMessages::NotifyCombatAIStateChange& msg);
|
||||||
|
};
|
||||||
@@ -6,6 +6,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_NJHUB
|
|||||||
"EnemySkeletonSpawner.cpp"
|
"EnemySkeletonSpawner.cpp"
|
||||||
"FallingTile.cpp"
|
"FallingTile.cpp"
|
||||||
"FlameJetServer.cpp"
|
"FlameJetServer.cpp"
|
||||||
|
"LightningOrbServer.cpp"
|
||||||
"ImaginationShrineServer.cpp"
|
"ImaginationShrineServer.cpp"
|
||||||
"Lieutenant.cpp"
|
"Lieutenant.cpp"
|
||||||
"MonCoreNookDoors.cpp"
|
"MonCoreNookDoors.cpp"
|
||||||
|
|||||||
12
dScripts/02_server/Map/njhub/LightningOrbServer.cpp
Normal file
12
dScripts/02_server/Map/njhub/LightningOrbServer.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include "LightningOrbServer.h"
|
||||||
|
|
||||||
|
void LightningOrbServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||||
|
GameMessages::GetPosition playerPos;
|
||||||
|
playerPos.Send(target->GetObjectID());
|
||||||
|
GameMessages::GetPosition selfPos;
|
||||||
|
selfPos.Send(self->GetObjectID());
|
||||||
|
const NiPoint3 newVec((playerPos.pos.x - selfPos.pos.x) * 2.5, 15, (playerPos.pos.z - selfPos.pos.z) * 2.5);
|
||||||
|
// ahhhh aron said to put a TODO here moving platforms don't work lol. disable this so people can actually do the puzzle
|
||||||
|
// GameMessages::SendKnockback(target->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, newVec);
|
||||||
|
// GameMessages::SendPlayFXEffect(target->GetObjectID(), -1, u"knockback", "knockback");
|
||||||
|
}
|
||||||
8
dScripts/02_server/Map/njhub/LightningOrbServer.h
Normal file
8
dScripts/02_server/Map/njhub/LightningOrbServer.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class LightningOrbServer : public CppScripts::Script
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnCollisionPhantom(Entity* self, Entity* target) override;
|
||||||
|
};
|
||||||
@@ -135,8 +135,11 @@
|
|||||||
#include "FvMaelstromCavalry.h"
|
#include "FvMaelstromCavalry.h"
|
||||||
#include "FvHorsemenTrigger.h"
|
#include "FvHorsemenTrigger.h"
|
||||||
#include "FvFlyingCreviceDragon.h"
|
#include "FvFlyingCreviceDragon.h"
|
||||||
|
#include "FvDragonInstanceServer.h"
|
||||||
#include "FvMaelstromDragon.h"
|
#include "FvMaelstromDragon.h"
|
||||||
|
#include "DragonRonin.h"
|
||||||
#include "FvDragonSmashingGolemQb.h"
|
#include "FvDragonSmashingGolemQb.h"
|
||||||
|
#include "CountdownDestroyAI.h"
|
||||||
#include "TreasureChestDragonServer.h"
|
#include "TreasureChestDragonServer.h"
|
||||||
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
||||||
#include "FvFreeGfNinjas.h"
|
#include "FvFreeGfNinjas.h"
|
||||||
@@ -274,6 +277,7 @@
|
|||||||
#include "MonCoreNookDoors.h"
|
#include "MonCoreNookDoors.h"
|
||||||
#include "MonCoreSmashableDoors.h"
|
#include "MonCoreSmashableDoors.h"
|
||||||
#include "FlameJetServer.h"
|
#include "FlameJetServer.h"
|
||||||
|
#include "LightningOrbServer.h"
|
||||||
#include "BurningTile.h"
|
#include "BurningTile.h"
|
||||||
#include "NjEarthDragonPetServer.h"
|
#include "NjEarthDragonPetServer.h"
|
||||||
#include "NjEarthPetServer.h"
|
#include "NjEarthPetServer.h"
|
||||||
@@ -490,7 +494,10 @@ namespace {
|
|||||||
{"scripts\\ai\\FV\\L_ACT_NINJA_TURRET_1.lua", []() {return new ActNinjaTurret();}},
|
{"scripts\\ai\\FV\\L_ACT_NINJA_TURRET_1.lua", []() {return new ActNinjaTurret();}},
|
||||||
{"scripts\\02_server\\Map\\FV\\L_FV_HORSEMEN_TRIGGER.lua", []() {return new FvHorsemenTrigger();}},
|
{"scripts\\02_server\\Map\\FV\\L_FV_HORSEMEN_TRIGGER.lua", []() {return new FvHorsemenTrigger();}},
|
||||||
{"scripts\\ai\\FV\\L_FV_FLYING_CREVICE_DRAGON.lua", []() {return new FvFlyingCreviceDragon();}},
|
{"scripts\\ai\\FV\\L_FV_FLYING_CREVICE_DRAGON.lua", []() {return new FvFlyingCreviceDragon();}},
|
||||||
|
{"scripts\\ai\\FV\\Dragon_Instance\\L_FV_DRAGON_INSTANCE_SERVER.lua", []() {return new FvDragonInstanceServer();}},
|
||||||
|
{"scripts\\02_server\\Enemy\\FV\\L_FV_DRAGON_RONIN.lua", []() {return new DragonRonin();}},
|
||||||
{"scripts\\02_server\\Enemy\\FV\\L_FV_MAELSTROM_DRAGON.lua", []() {return new FvMaelstromDragon();}},
|
{"scripts\\02_server\\Enemy\\FV\\L_FV_MAELSTROM_DRAGON.lua", []() {return new FvMaelstromDragon();}},
|
||||||
|
{"scripts\\02_server\\Enemy\\General\\L_COUNTDOWN_DESTROY_AI.lua", []() {return new CountdownDestroyAI();}},
|
||||||
{"scripts\\ai\\FV\\L_FV_DRAGON_SMASHING_GOLEM_QB.lua", []() {return new FvDragonSmashingGolemQb();}},
|
{"scripts\\ai\\FV\\L_FV_DRAGON_SMASHING_GOLEM_QB.lua", []() {return new FvDragonSmashingGolemQb();}},
|
||||||
{"scripts\\02_server\\Enemy\\General\\L_TREASURE_CHEST_DRAGON_SERVER.lua", []() {return new TreasureChestDragonServer();}},
|
{"scripts\\02_server\\Enemy\\General\\L_TREASURE_CHEST_DRAGON_SERVER.lua", []() {return new TreasureChestDragonServer();}},
|
||||||
{"scripts\\ai\\GENERAL\\L_INSTANCE_EXIT_TRANSFER_PLAYER_TO_LAST_NON_INSTANCE.lua", []() {return new InstanceExitTransferPlayerToLastNonInstance();}},
|
{"scripts\\ai\\GENERAL\\L_INSTANCE_EXIT_TRANSFER_PLAYER_TO_LAST_NON_INSTANCE.lua", []() {return new InstanceExitTransferPlayerToLastNonInstance();}},
|
||||||
@@ -628,6 +635,7 @@ namespace {
|
|||||||
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
|
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
|
||||||
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
|
{"scripts\\02_server\\Map\\njhub\\L_MON_CORE_SMASHABLE_DOORS.lua", []() {return new MonCoreSmashableDoors();}},
|
||||||
{"scripts\\02_server\\Map\\njhub\\L_FLAME_JET_SERVER.lua", []() {return new FlameJetServer();}},
|
{"scripts\\02_server\\Map\\njhub\\L_FLAME_JET_SERVER.lua", []() {return new FlameJetServer();}},
|
||||||
|
{"scripts\\02_server\\Map\\njhub\\L_LIGHTNING_ORB_SERVER.lua", []() {return new LightningOrbServer();}},
|
||||||
{"scripts\\02_server\\Map\\njhub\\L_BURNING_TILE.lua", []() {return new BurningTile();}},
|
{"scripts\\02_server\\Map\\njhub\\L_BURNING_TILE.lua", []() {return new BurningTile();}},
|
||||||
{"scripts\\02_server\\Map\\njhub\\L_SPAWN_EARTH_PET_SERVER.lua", []() {return new NjEarthDragonPetServer();}},
|
{"scripts\\02_server\\Map\\njhub\\L_SPAWN_EARTH_PET_SERVER.lua", []() {return new NjEarthDragonPetServer();}},
|
||||||
{"scripts\\02_server\\Map\\njhub\\L_EARTH_PET_SERVER.lua", []() {return new NjEarthPetServer();}},
|
{"scripts\\02_server\\Map\\njhub\\L_EARTH_PET_SERVER.lua", []() {return new NjEarthPetServer();}},
|
||||||
|
|||||||
@@ -18,7 +18,13 @@ set(DSCRIPTS_SOURCES_AI_FV
|
|||||||
"FvMaelstromGeyser.cpp"
|
"FvMaelstromGeyser.cpp"
|
||||||
"TriggerGas.cpp")
|
"TriggerGas.cpp")
|
||||||
|
|
||||||
|
add_subdirectory(Dragon_Instance)
|
||||||
|
|
||||||
|
foreach(file ${DSCRIPTS_SOURCES_AI_FV_DRAGON_INSTANCE})
|
||||||
|
set(DSCRIPTS_SOURCES_AI_FV ${DSCRIPTS_SOURCES_AI_FV} "Dragon_Instance/${file}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
add_library(dScriptsAiFV OBJECT ${DSCRIPTS_SOURCES_AI_FV})
|
add_library(dScriptsAiFV OBJECT ${DSCRIPTS_SOURCES_AI_FV})
|
||||||
target_include_directories(dScriptsAiFV PUBLIC ".")
|
target_include_directories(dScriptsAiFV PUBLIC "." "Dragon_Instance")
|
||||||
target_precompile_headers(dScriptsAiFV REUSE_FROM dScriptsBase)
|
target_precompile_headers(dScriptsAiFV REUSE_FROM dScriptsBase)
|
||||||
|
|
||||||
|
|||||||
3
dScripts/ai/FV/Dragon_Instance/CMakeLists.txt
Normal file
3
dScripts/ai/FV/Dragon_Instance/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set(DSCRIPTS_SOURCES_AI_FV_DRAGON_INSTANCE
|
||||||
|
"FvDragonInstanceServer.cpp"
|
||||||
|
PARENT_SCOPE)
|
||||||
14
dScripts/ai/FV/Dragon_Instance/FvDragonInstanceServer.cpp
Normal file
14
dScripts/ai/FV/Dragon_Instance/FvDragonInstanceServer.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "FvDragonInstanceServer.h"
|
||||||
|
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "DestroyableComponent.h"
|
||||||
|
|
||||||
|
void FvDragonInstanceServer::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||||
|
auto* const destComp = player->GetComponent<DestroyableComponent>();
|
||||||
|
if (destComp) {
|
||||||
|
destComp->SetHealth(destComp->GetMaxHealth());
|
||||||
|
destComp->SetArmor(destComp->GetMaxArmor());
|
||||||
|
destComp->SetImagination(destComp->GetMaxImagination());
|
||||||
|
Game::entityManager->SerializeEntity(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
dScripts/ai/FV/Dragon_Instance/FvDragonInstanceServer.h
Normal file
7
dScripts/ai/FV/Dragon_Instance/FvDragonInstanceServer.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "CppScripts.h"
|
||||||
|
|
||||||
|
class FvDragonInstanceServer : public CppScripts::Script {
|
||||||
|
public:
|
||||||
|
void OnPlayerLoaded(Entity* self, Entity* player) override;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user