mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Commands] Cleanup #dbspawn2 Command. (#2493)
* [Commands] Cleanup #dbspawn2 Command. Add some descriptive messages so that you get some feedback from the command. * Update dbspawn2.cpp
This commit is contained in:
parent
53dcd14534
commit
2218f46b5b
@ -117,7 +117,7 @@ int command_init(void)
|
||||
command_add("damage", "[Amount] - Damage yourself or your target", AccountStatus::GMAdmin, command_damage) ||
|
||||
command_add("databuckets", "View|Delete [key] [limit]- View data buckets, limit 50 default or Delete databucket by key", AccountStatus::QuestTroupe, command_databuckets) ||
|
||||
command_add("date", "[Year] [Month] [Day] [Hour] [Minute] - Set EQ time (Hour and Minute are optional)", AccountStatus::EQSupport, command_date) ||
|
||||
command_add("dbspawn2", "[spawngroup] [respawn] [variance] - Spawn an NPC from a predefined row in the spawn2 table", AccountStatus::GMAdmin, command_dbspawn2) ||
|
||||
command_add("dbspawn2", "[Spawngroup ID] [Respawn] [Variance] [Condition ID] [Condition Minimum] - Spawn an NPC from a predefined row in the spawn2 table, Respawn and Variance are in Seconds (condition is optional)", AccountStatus::GMAdmin, command_dbspawn2) ||
|
||||
command_add("delacct", "[accountname] - Delete an account", AccountStatus::GMLeadAdmin, command_delacct) ||
|
||||
command_add("delpetition", "[petition number] - Delete a petition", AccountStatus::ApprenticeGuide, command_delpetition) ||
|
||||
command_add("depop", "Depop your NPC target", AccountStatus::Guide, command_depop) ||
|
||||
|
||||
@ -2,30 +2,103 @@
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) {
|
||||
LogInfo("Spawning database spawn");
|
||||
uint16 cond = 0;
|
||||
int16 cond_min = 0;
|
||||
if (sep->IsNumber(4)) {
|
||||
cond = atoi(sep->arg[4]);
|
||||
if (sep->IsNumber(5)) {
|
||||
cond_min = atoi(sep->arg[5]);
|
||||
}
|
||||
}
|
||||
database.CreateSpawn2(
|
||||
c,
|
||||
atoi(sep->arg[1]),
|
||||
zone->GetShortName(),
|
||||
c->GetPosition(),
|
||||
atoi(sep->arg[2]),
|
||||
atoi(sep->arg[3]),
|
||||
cond,
|
||||
cond_min
|
||||
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;
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #dbspawn2 spawngroup respawn variance [condition_id] [condition_min]");
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user