added some pet debug commands

This commit is contained in:
jadebenn 2023-12-09 22:24:35 -06:00
parent 93592c775b
commit 1c01219ae9
3 changed files with 90 additions and 8 deletions

View File

@ -155,12 +155,12 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd
void PetComponent::OnUse(Entity* originator) { void PetComponent::OnUse(Entity* originator) {
LOG("PET USE!"); LOG("PET USE!");
if(m_ReadyToDig) { /*if(m_ReadyToDig) {
LOG("Dig initiated!"); LOG("Dig initiated!");
m_TresureTime = 2.0f; m_TresureTime = 2.0f;
//m_ReadyToDig = false; //m_ReadyToDig = false;
SetAbility(PetAbilityType::DigAtPosition); SetAbility(PetAbilityType::DigAtPosition);
} }*/
if (m_Owner != LWOOBJID_EMPTY) { if (m_Owner != LWOOBJID_EMPTY) {
return; return;
@ -434,9 +434,9 @@ void PetComponent::Update(float deltaTime) {
skipTresure: skipTresure:
m_MovementAI->SetHaltDistance(haltDistance); //m_MovementAI->SetHaltDistance(haltDistance);
m_MovementAI->SetMaxSpeed(2.5f); //m_MovementAI->SetMaxSpeed(2.5f);
m_MovementAI->SetDestination(destination); m_MovementAI->SetDestination(destination);

View File

@ -8,10 +8,6 @@
enum PetStatus : uint32_t { enum PetStatus : uint32_t {
NONE, NONE,
UNKNOWN1 = 0x1,
UNKNOWN2 = 0x2,
UNKNOWN3 = 0x4,
UNKNOWN4 = 0x8,
BEING_TAMED = 0x10, BEING_TAMED = 0x10,
IS_NOT_WAITING = 0x20, // Right name? - used to be decimal 20 IS_NOT_WAITING = 0x20, // Right name? - used to be decimal 20
PLAY_SPAWN_ANIM = 0x80, PLAY_SPAWN_ANIM = 0x80,

View File

@ -803,6 +803,92 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
petComponent->Command(commandPos, entity->GetObjectID(), commandType, typeId, true); 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<MovementAIComponent>();
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<MovementAIComponent>();
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<MovementAIComponent>();
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) { if (chatCommand == "playeffect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) {
int32_t effectID = 0; int32_t effectID = 0;