diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index de5a7ef3..d3dca79c 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -155,12 +155,12 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd void PetComponent::OnUse(Entity* originator) { LOG("PET USE!"); - if(m_ReadyToDig) { + /*if(m_ReadyToDig) { LOG("Dig initiated!"); m_TresureTime = 2.0f; //m_ReadyToDig = false; SetAbility(PetAbilityType::DigAtPosition); - } + }*/ if (m_Owner != LWOOBJID_EMPTY) { return; @@ -434,9 +434,9 @@ void PetComponent::Update(float deltaTime) { skipTresure: - m_MovementAI->SetHaltDistance(haltDistance); + //m_MovementAI->SetHaltDistance(haltDistance); - m_MovementAI->SetMaxSpeed(2.5f); + //m_MovementAI->SetMaxSpeed(2.5f); m_MovementAI->SetDestination(destination); diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index 57f4a01f..808df6a3 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -8,10 +8,6 @@ enum PetStatus : uint32_t { NONE, - UNKNOWN1 = 0x1, - UNKNOWN2 = 0x2, - UNKNOWN3 = 0x4, - UNKNOWN4 = 0x8, BEING_TAMED = 0x10, IS_NOT_WAITING = 0x20, // Right name? - used to be decimal 20 PLAY_SPAWN_ANIM = 0x80, diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 9e27cc0f..6b7fd0c2 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -803,6 +803,92 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit petComponent->Command(commandPos, entity->GetObjectID(), commandType, typeId, true); } + // Pet speed utility + if (chatCommand == "setpetmaxspeed" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { + if (args.size() != 1) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid number of arguments!"); + return; + } + + float petMaxSpeed; + if (!GeneralUtils::TryParse(args[0], petMaxSpeed)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid speed!"); + return; + } + + // Determine if player has a pet summoned + auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID()); + if (!petComponent) { + ChatPackets::SendSystemMessage(sysAddr, u"No active pet found!"); + return; + } + + auto* movementAIComponent = petComponent->GetParentEntity()->GetComponent(); + if (!movementAIComponent) return; + + movementAIComponent->SetMaxSpeed(petMaxSpeed); + + std::u16string msg = u"Set pet max speed to " + (GeneralUtils::to_u16string(petMaxSpeed)); + ChatPackets::SendSystemMessage(sysAddr, msg); + } + + // Set pet acceleration + if (chatCommand == "setpetaccel" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { + if (args.size() != 1) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid number of arguments!"); + return; + } + + float petAccel; + if (!GeneralUtils::TryParse(args[0], petAccel)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid acceleration!"); + return; + } + + // Determine if player has a pet summoned + auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID()); + if (!petComponent) { + ChatPackets::SendSystemMessage(sysAddr, u"No active pet found!"); + return; + } + + auto* movementAIComponent = petComponent->GetParentEntity()->GetComponent(); + if (!movementAIComponent) return; + + movementAIComponent->SetAcceleration(petAccel); + + std::u16string msg = u"Set pet acceleration to " + (GeneralUtils::to_u16string(petAccel)); + ChatPackets::SendSystemMessage(sysAddr, msg); + } + + // Set pet halt distance + if (chatCommand == "setpethalt" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { + if (args.size() != 1) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid number of arguments!"); + return; + } + + float petHaltDistance; + if (!GeneralUtils::TryParse(args[0], petHaltDistance)) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid halt distance!"); + return; + } + + // Determine if player has a pet summoned + auto* petComponent = PetComponent::GetActivePet(entity->GetObjectID()); + if (!petComponent) { + ChatPackets::SendSystemMessage(sysAddr, u"No active pet found!"); + return; + } + + auto* movementAIComponent = petComponent->GetParentEntity()->GetComponent(); + if (!movementAIComponent) return; + + movementAIComponent->SetHaltDistance(petHaltDistance); + + std::u16string msg = u"Set pet halt distance to " + (GeneralUtils::to_u16string(petHaltDistance)); + ChatPackets::SendSystemMessage(sysAddr, msg); + } if (chatCommand == "playeffect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) { int32_t effectID = 0;