mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
* [Commands] Cleanup #dbspawn2 Command. Add some descriptive messages so that you get some feedback from the command. * Update dbspawn2.cpp
105 lines
2.1 KiB
C++
Executable File
105 lines
2.1 KiB
C++
Executable File
#include "../client.h"
|
|
|
|
void command_dbspawn2(Client *c, const Seperator *sep)
|
|
{
|
|
auto arguments = sep->argnum;
|
|
if (
|
|
!arguments ||
|
|
!sep->IsNumber(1) ||
|
|
!sep->IsNumber(2) ||
|
|
!sep->IsNumber(3)
|
|
) {
|
|
c->Message(Chat::White, "Usage: #dbspawn2 [Spawngroup ID] [Respawn] [Variance] [Condition ID] [Condition Minimum]");
|
|
c->Message(Chat::White, "Note: Respawn and Variance are in Seconds.");
|
|
return;
|
|
}
|
|
|
|
auto position = c->GetPosition();
|
|
|
|
auto spawngroup_id = std::stoul(sep->arg[1]);
|
|
auto respawn = std::stoul(sep->arg[2]);
|
|
auto variance = std::stoul(sep->arg[3]);
|
|
|
|
auto condition_id = sep->IsNumber(4) ? static_cast<uint16>(std::stoul(sep->arg[4])) : static_cast<uint16>(0);
|
|
auto condition_minimum = sep->IsNumber(5) ? static_cast<int16>(std::stoul(sep->arg[5])) : static_cast<int16>(0);
|
|
|
|
if (!database.CreateSpawn2(
|
|
c,
|
|
spawngroup_id,
|
|
zone->GetShortName(),
|
|
position,
|
|
respawn,
|
|
variance,
|
|
condition_id,
|
|
condition_minimum
|
|
)) {
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Failed to add Spawngroup ID {} to {} at {:.2f}, {:.2f}, {:.2f}, {:.2f}.",
|
|
spawngroup_id,
|
|
zone->GetZoneDescription(),
|
|
position.x,
|
|
position.y,
|
|
position.z,
|
|
position.w
|
|
).c_str()
|
|
);
|
|
return;
|
|
}
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | ID: {}",
|
|
spawngroup_id
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | Zone: {}",
|
|
zone->GetZoneDescription()
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | Position: {:.2f}, {:.2f}, {:.2f}, {:.2f}",
|
|
position.x,
|
|
position.y,
|
|
position.z,
|
|
position.w
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | Respawn: {} ({})",
|
|
Strings::SecondsToTime(respawn),
|
|
respawn
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | Variance: {} ({})",
|
|
Strings::SecondsToTime(variance),
|
|
variance
|
|
).c_str()
|
|
);
|
|
|
|
c->Message(
|
|
Chat::White,
|
|
fmt::format(
|
|
"Spawngroup Added | Condition ID: {} Condition Minimum: {}",
|
|
condition_id,
|
|
condition_minimum
|
|
).c_str()
|
|
);
|
|
}
|