mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-25 06:53:35 +00:00
updated pet command functionality
This commit is contained in:
parent
81a54e7e0f
commit
23664c0a9b
@ -381,7 +381,7 @@ void PetComponent::Update(float deltaTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_TresureTime > 0.0f) { //TODO: Find better trigger
|
||||
if (m_TresureTime > 0.0f) { //TODO: Find better trigger?
|
||||
InteractDig(deltaTime);
|
||||
return;
|
||||
}
|
||||
@ -1037,6 +1037,12 @@ void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandTy
|
||||
if (owner->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
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 {
|
||||
|
@ -736,19 +736,19 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
//Pet command utility
|
||||
if (chatCommand == "petcommand" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
if (args.size() < 2) {
|
||||
if (args.size() < 5) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Too few arguments!");
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t commandType;
|
||||
if (!GeneralUtils::TryParse(args[0], commandType)) {
|
||||
if (!GeneralUtils::TryParse(args[0+3], commandType)) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type!");
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t typeId;
|
||||
if (!GeneralUtils::TryParse(args[1], typeId)) {
|
||||
if (!GeneralUtils::TryParse(args[1+3], typeId)) {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Invalid command type id!");
|
||||
return;
|
||||
}
|
||||
@ -760,7 +760,30 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user