updated pet command functionality

This commit is contained in:
jadebenn 2023-11-19 17:31:31 -06:00
parent 81a54e7e0f
commit 23664c0a9b
2 changed files with 34 additions and 5 deletions

View File

@ -381,7 +381,7 @@ void PetComponent::Update(float deltaTime) {
return; return;
} }
if (m_TresureTime > 0.0f) { //TODO: Find better trigger if (m_TresureTime > 0.0f) { //TODO: Find better trigger?
InteractDig(deltaTime); InteractDig(deltaTime);
return; return;
} }
@ -1037,6 +1037,12 @@ void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandTy
if (owner->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (owner->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
ChatPackets::SendSystemMessage(owner->GetSystemAddress(), u"Commmand Type: " + (GeneralUtils::to_u16string(commandType)) + u" - Type Id: " + (GeneralUtils::to_u16string(typeId))); ChatPackets::SendSystemMessage(owner->GetSystemAddress(), u"Commmand Type: " + (GeneralUtils::to_u16string(commandType)) + u" - Type Id: " + (GeneralUtils::to_u16string(typeId)));
} }
// Add movement functionality
if (position != NiPoint3::ZERO) {
m_MovementAI->SetDestination(position);
m_Timer = 9; //Is this setting how long until the next update tick?
}
} }
LWOOBJID PetComponent::GetOwnerId() const { LWOOBJID PetComponent::GetOwnerId() const {

View File

@ -736,19 +736,19 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
//Pet command utility //Pet command utility
if (chatCommand == "petcommand" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) { if (chatCommand == "petcommand" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
if (args.size() < 2) { if (args.size() < 5) {
ChatPackets::SendSystemMessage(sysAddr, u"Too few arguments!"); ChatPackets::SendSystemMessage(sysAddr, u"Too few arguments!");
return; return;
} }
int32_t commandType; int32_t commandType;
if (!GeneralUtils::TryParse(args[0], commandType)) { if (!GeneralUtils::TryParse(args[0+3], commandType)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type!"); ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type!");
return; return;
} }
int32_t typeId; int32_t typeId;
if (!GeneralUtils::TryParse(args[1], typeId)) { if (!GeneralUtils::TryParse(args[1+3], typeId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type id!"); ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type id!");
return; return;
} }
@ -760,7 +760,30 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
return; return;
} }
petComponent->Command(NiPoint3::ZERO, LWOOBJID_EMPTY, commandType, typeId, true); //Determine the positional coordinates
NiPoint3 commandPos{};
float x, y, z;
if (!GeneralUtils::TryParse(args[0], x)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid x.");
return;
}
if (!GeneralUtils::TryParse(args[1], y)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid y.");
return;
}
if (!GeneralUtils::TryParse(args[2], z)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid z.");
return;
}
// Set command position
commandPos.SetX(x);
commandPos.SetY(y);
commandPos.SetZ(z);
petComponent->Command(commandPos, entity->GetObjectID(), commandType, typeId, true);
} }