Merge DarkflameServer

This commit is contained in:
TheMatt2
2022-01-30 13:40:08 -05:00
77 changed files with 1019 additions and 331 deletions

View File

@@ -498,29 +498,28 @@ Entity* DestroyableComponent::GetKiller() const
return EntityManager::Instance()->GetEntity(m_KillerID);
}
bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignoreFactions) const
bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignoreFactions, const bool targetEnemy, const bool targetFriend) const
{
auto* entity = EntityManager::Instance()->GetEntity(target);
auto* targetEntity = EntityManager::Instance()->GetEntity(target);
if (entity == nullptr)
if (targetEntity == nullptr)
{
Game::logger->Log("DestroyableComponent", "Invalid entity for checking validity (%llu)!\n", target);
return false;
}
auto* destroyable = entity->GetComponent<DestroyableComponent>();
auto* targetDestroyable = targetEntity->GetComponent<DestroyableComponent>();
if (destroyable == nullptr)
if (targetDestroyable == nullptr)
{
return false;
}
auto* quickbuild = entity->GetComponent<RebuildComponent>();
auto* targetQuickbuild = targetEntity->GetComponent<RebuildComponent>();
if (quickbuild != nullptr)
if (targetQuickbuild != nullptr)
{
const auto state = quickbuild->GetState();
const auto state = targetQuickbuild->GetState();
if (state != REBUILD_COMPLETED)
{
@@ -533,19 +532,12 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
return true;
}
auto enemyList = GetEnemyFactionsIDs();
// Get if the target entity is an enemy and friend
bool isEnemy = IsEnemy(targetEntity);
bool isFriend = IsFriend(targetEntity);
auto candidateList = destroyable->GetFactionIDs();
for (auto value : candidateList)
{
if (std::find(enemyList.begin(), enemyList.end(), value) != enemyList.end())
{
return true;
}
}
return false;
// Return true if the target type matches what we are targeting
return (isEnemy && targetEnemy) || (isFriend && targetFriend);
}

View File

@@ -371,7 +371,7 @@ public:
* @param ignoreFactions whether or not check for the factions, e.g. just return true if the entity cannot be smashed
* @return if the target ID is a valid enemy
*/
bool CheckValidity(LWOOBJID target, bool ignoreFactions = false) const;
bool CheckValidity(LWOOBJID target, bool ignoreFactions = false, bool targetEnemy = true, bool targetFriend = false) const;
/**
* Attempt to damage this entity, handles everything from health and armor to absorption, immunity and callbacks.

View File

@@ -1001,10 +1001,6 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks)
set->OnEquip(lot);
}
if (lot == 1727) GameMessages::SendSetJetpackMode(m_Parent, false, true, false);
if (lot == 7292) GameMessages::SendSetJetpackMode(m_Parent, true, true, false);
if (lot == 14442) GameMessages::SendSetJetpackMode(m_Parent, false, true, true);
if (item->GetInfo().isBOE)
{
item->SetBound(true);
@@ -1042,10 +1038,6 @@ void InventoryComponent::UnEquipItem(Item* item)
set->OnUnEquip(lot);
}
if (lot == 1727) GameMessages::SendSetJetpackMode(m_Parent, false, false, false);
if (lot == 7292) GameMessages::SendSetJetpackMode(m_Parent, true, false, false);
if (lot == 14442) GameMessages::SendSetJetpackMode(m_Parent, false, false, true);
RemoveBuff(item->GetLot());
RemoveItemSkills(item->GetLot());

View File

@@ -257,7 +257,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity *player,
m_Parent->GetObjectID(), playerID, UNASSIGNED_SYSTEM_ADDRESS);
});
GameMessages::SendSetJetpackMode(player, false, false, false);
GameMessages::SendSetJetPackMode(player, false);
// Set the vehicle's state.
GameMessages::SendNotifyVehicleOfRacingObject(carEntity->GetObjectID(),

View File

@@ -513,7 +513,7 @@ void ActivityInstance::StartZone() {
if (player == nullptr)
return;
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", player->GetSystemAddress().ToString(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", player->GetCharacter()->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
if (player->GetCharacter()) {
player->GetCharacter()->SetZoneID(zoneID);
player->GetCharacter()->SetZoneInstance(zoneInstance);