|
|
|
@@ -170,7 +170,7 @@ void PropertyManagementComponent::UpdatePropertyDetails(std::string name, std::s
|
|
|
|
|
info.name = propertyName;
|
|
|
|
|
info.description = propertyDescription;
|
|
|
|
|
info.lastUpdatedTime = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database::Get()->UpdateLastSave(info);
|
|
|
|
|
Database::Get()->UpdatePropertyDetails(info);
|
|
|
|
|
|
|
|
|
@@ -203,14 +203,22 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) {
|
|
|
|
|
|
|
|
|
|
auto prop_path = zone->GetPath(m_Parent->GetVarAsString(u"propertyName"));
|
|
|
|
|
|
|
|
|
|
if (prop_path){
|
|
|
|
|
if (prop_path) {
|
|
|
|
|
if (!prop_path->property.displayName.empty()) name = prop_path->property.displayName;
|
|
|
|
|
description = prop_path->property.displayDesc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetOwnerId(playerId);
|
|
|
|
|
|
|
|
|
|
propertyId = ObjectIDManager::GenerateRandomObjectID();
|
|
|
|
|
// Due to legacy IDs being random
|
|
|
|
|
propertyId = ObjectIDManager::GetPersistentID();
|
|
|
|
|
const uint32_t maxTries = 100;
|
|
|
|
|
uint32_t tries = 0;
|
|
|
|
|
while (Database::Get()->GetPropertyInfo(propertyId) && tries < maxTries) {
|
|
|
|
|
tries++;
|
|
|
|
|
LOG("Found a duplicate property %llu, getting a new propertyId", propertyId);
|
|
|
|
|
propertyId = ObjectIDManager::GetPersistentID();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IProperty::Info info;
|
|
|
|
|
info.id = propertyId;
|
|
|
|
@@ -374,46 +382,45 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
|
|
|
|
node->position = position;
|
|
|
|
|
node->rotation = rotation;
|
|
|
|
|
|
|
|
|
|
ObjectIDManager::RequestPersistentID([this, node, modelLOT, entity, position, rotation, originalRotation](uint32_t persistentId) {
|
|
|
|
|
SpawnerInfo info{};
|
|
|
|
|
SpawnerInfo info{};
|
|
|
|
|
|
|
|
|
|
info.templateID = modelLOT;
|
|
|
|
|
info.nodes = { node };
|
|
|
|
|
info.templateScale = 1.0f;
|
|
|
|
|
info.activeOnLoad = true;
|
|
|
|
|
info.amountMaintained = 1;
|
|
|
|
|
info.respawnTime = 10;
|
|
|
|
|
info.templateID = modelLOT;
|
|
|
|
|
info.nodes = { node };
|
|
|
|
|
info.templateScale = 1.0f;
|
|
|
|
|
info.activeOnLoad = true;
|
|
|
|
|
info.amountMaintained = 1;
|
|
|
|
|
info.respawnTime = 10;
|
|
|
|
|
|
|
|
|
|
info.emulated = true;
|
|
|
|
|
info.emulator = Game::entityManager->GetZoneControlEntity()->GetObjectID();
|
|
|
|
|
info.emulated = true;
|
|
|
|
|
info.emulator = Game::entityManager->GetZoneControlEntity()->GetObjectID();
|
|
|
|
|
|
|
|
|
|
info.spawnerID = persistentId;
|
|
|
|
|
GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT);
|
|
|
|
|
info.spawnerID = ObjectIDManager::GetPersistentID();
|
|
|
|
|
GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT);
|
|
|
|
|
|
|
|
|
|
const auto spawnerId = Game::zoneManager->MakeSpawner(info);
|
|
|
|
|
const auto spawnerId = Game::zoneManager->MakeSpawner(info);
|
|
|
|
|
|
|
|
|
|
auto* spawner = Game::zoneManager->GetSpawner(spawnerId);
|
|
|
|
|
auto* spawner = Game::zoneManager->GetSpawner(spawnerId);
|
|
|
|
|
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"userModelID", info.spawnerID));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<int>(u"modelType", 2));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"userModelID", info.spawnerID));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<int>(u"modelType", 2));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
|
|
|
|
info.nodes[0]->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
|
|
|
|
|
|
|
|
|
auto* model = spawner->Spawn();
|
|
|
|
|
auto* modelComponent = model->GetComponent<ModelComponent>();
|
|
|
|
|
if (modelComponent) modelComponent->Pause();
|
|
|
|
|
auto* model = spawner->Spawn();
|
|
|
|
|
auto* modelComponent = model->GetComponent<ModelComponent>();
|
|
|
|
|
if (modelComponent) modelComponent->Pause();
|
|
|
|
|
|
|
|
|
|
models.insert_or_assign(model->GetObjectID(), spawnerId);
|
|
|
|
|
models.insert_or_assign(model->GetObjectID(), spawnerId);
|
|
|
|
|
|
|
|
|
|
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), position, m_Parent->GetObjectID(), 14, originalRotation);
|
|
|
|
|
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), position, m_Parent->GetObjectID(), 14, originalRotation);
|
|
|
|
|
|
|
|
|
|
GameMessages::SendUGCEquipPreCreateBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), 0, spawnerId);
|
|
|
|
|
GameMessages::SendUGCEquipPreCreateBasedOnEditMode(entity->GetObjectID(), entity->GetSystemAddress(), 0, spawnerId);
|
|
|
|
|
|
|
|
|
|
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
|
|
|
|
|
Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelPlaced(entity);
|
|
|
|
|
|
|
|
|
|
Game::entityManager->GetZoneControlEntity()->OnZonePropertyModelPlaced(entity);
|
|
|
|
|
});
|
|
|
|
|
// Progress place model missions
|
|
|
|
|
auto missionComponent = entity->GetComponent<MissionComponent>();
|
|
|
|
|
if (missionComponent != nullptr) missionComponent->Progress(eMissionTaskType::PLACE_MODEL, 0);
|
|
|
|
@@ -693,7 +700,7 @@ void PropertyManagementComponent::Save() {
|
|
|
|
|
// save the behaviors of the model
|
|
|
|
|
for (const auto& [behaviorId, behaviorStr] : modelBehaviors) {
|
|
|
|
|
if (behaviorStr.empty() || behaviorId == -1 || behaviorId == 0) continue;
|
|
|
|
|
IBehaviors::Info info {
|
|
|
|
|
IBehaviors::Info info{
|
|
|
|
|
.behaviorId = behaviorId,
|
|
|
|
|
.characterId = character->GetID(),
|
|
|
|
|
.behaviorInfo = behaviorStr
|
|
|
|
@@ -821,7 +828,7 @@ void PropertyManagementComponent::OnChatMessageReceived(const std::string& sMess
|
|
|
|
|
if (!model) continue;
|
|
|
|
|
auto* const modelComponent = model->GetComponent<ModelComponent>();
|
|
|
|
|
if (!modelComponent) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelComponent->OnChatMessageReceived(sMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|