mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Commands] Cleanup #zcolor Command. (#1813)
* [Commands] Cleanup #zcolor Command. - Cleanup message and logic. - Add parameter to allow data to be saved to database. * Update zcolor.cpp
This commit is contained in:
parent
8f3cce6585
commit
4672e48fbd
@ -390,8 +390,10 @@ int command_init(void)
|
|||||||
command_add("wpinfo", "- Show waypoint info about your NPC target", AccountStatus::GMAreas, command_wpinfo) ||
|
command_add("wpinfo", "- Show waypoint info about your NPC target", AccountStatus::GMAreas, command_wpinfo) ||
|
||||||
command_add("worldwide", "Performs world-wide GM functions such as cast (can be extended for other commands). Use caution", AccountStatus::GMImpossible, command_worldwide) ||
|
command_add("worldwide", "Performs world-wide GM functions such as cast (can be extended for other commands). Use caution", AccountStatus::GMImpossible, command_worldwide) ||
|
||||||
command_add("xtargets", "Show your targets Extended Targets and optionally set how many xtargets they can have.", AccountStatus::GMImpossible, command_xtargets) ||
|
command_add("xtargets", "Show your targets Extended Targets and optionally set how many xtargets they can have.", AccountStatus::GMImpossible, command_xtargets) ||
|
||||||
|
command_add("zclip", "[min] [max] - modifies and resends zhdr packet", AccountStatus::QuestTroupe, command_zclip) ||
|
||||||
|
command_add("zheader", "[zonename] - Load zheader for zonename from the database", AccountStatus::QuestTroupe, command_zheader) ||
|
||||||
command_add("zclip", "[Minimum Clip] [Maximum Clip] [Fog Minimum Clip] [Fog Maximum Clip] [Permanent (0 = False, 1 = True)] - Change zone clipping", AccountStatus::QuestTroupe, command_zclip) ||
|
command_add("zclip", "[Minimum Clip] [Maximum Clip] [Fog Minimum Clip] [Fog Maximum Clip] [Permanent (0 = False, 1 = True)] - Change zone clipping", AccountStatus::QuestTroupe, command_zclip) ||
|
||||||
command_add("zcolor", "[red] [green] [blue] - Change sky color", AccountStatus::QuestTroupe, command_zcolor) ||
|
command_add("zcolor", "[Red] [Green] [Blue] [Permanent (0 = False, 1 = True)] - Change sky color", AccountStatus::QuestTroupe, command_zcolor) ||
|
||||||
command_add("zheader", "[Zone ID|Zone Short Name] [Version] - Load a zone header from the database", AccountStatus::QuestTroupe, command_zheader) ||
|
command_add("zheader", "[Zone ID|Zone Short Name] [Version] - Load a zone header from the database", AccountStatus::QuestTroupe, command_zheader) ||
|
||||||
command_add("zone", "[zonename] [x] [y] [z] - Go to specified zone (coords optional)", AccountStatus::Guide, command_zone) ||
|
command_add("zone", "[zonename] [x] [y] [z] - Go to specified zone (coords optional)", AccountStatus::Guide, command_zone) ||
|
||||||
command_add("zonebootup", "[ZoneServerID] [shortname] - Make a zone server boot a specific zone", AccountStatus::GMLeadAdmin, command_zonebootup) ||
|
command_add("zonebootup", "[ZoneServerID] [shortname] - Make a zone server boot a specific zone", AccountStatus::GMLeadAdmin, command_zonebootup) ||
|
||||||
|
|||||||
@ -2,29 +2,67 @@
|
|||||||
|
|
||||||
void command_zcolor(Client *c, const Seperator *sep)
|
void command_zcolor(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
// modifys and resends zhdr packet
|
int arguments = sep->argnum;
|
||||||
if (sep->arg[3][0] == 0) {
|
if (
|
||||||
c->Message(Chat::White, "Usage: #zcolor <red> <green> <blue>");
|
!arguments ||
|
||||||
|
!sep->IsNumber(1) ||
|
||||||
|
!sep->IsNumber(2) ||
|
||||||
|
!sep->IsNumber(3)
|
||||||
|
) {
|
||||||
|
c->Message(Chat::White, "Usage: #zcolor [Red] [Green] [Blue] [Permanent (0 = False, 1 = True)]");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (atoi(sep->arg[1]) < 0 || atoi(sep->arg[1]) > 255) {
|
|
||||||
c->Message(Chat::White, "ERROR: Red can not be less than 0 or greater than 255!");
|
auto red = std::stoul(sep->arg[1]);
|
||||||
|
auto green = std::stoul(sep->arg[2]);
|
||||||
|
auto blue = std::stoul(sep->arg[3]);
|
||||||
|
auto permanent = sep->arg[4] ? atobool(sep->arg[4]) : false;
|
||||||
|
if (
|
||||||
|
red < 0 ||
|
||||||
|
red > 255 ||
|
||||||
|
green < 0 ||
|
||||||
|
green > 255 ||
|
||||||
|
blue < 0 ||
|
||||||
|
blue > 255
|
||||||
|
) {
|
||||||
|
c->Message(Chat::White, "Colors cannot be less than 0 or greater than 255.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (atoi(sep->arg[2]) < 0 || atoi(sep->arg[2]) > 255) {
|
|
||||||
c->Message(Chat::White, "ERROR: Green can not be less than 0 or greater than 255!");
|
if (permanent) {
|
||||||
|
auto query = fmt::format(
|
||||||
|
"UPDATE zone SET fog_red = {}, fog_green = {}, fog_blue = {} "
|
||||||
|
"WHERE zoneidnumber = {} AND version = {}",
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
blue,
|
||||||
|
zone->GetZoneID(),
|
||||||
|
zone->GetInstanceVersion()
|
||||||
|
);
|
||||||
|
database.QueryDatabase(query);
|
||||||
}
|
}
|
||||||
else if (atoi(sep->arg[3]) < 0 || atoi(sep->arg[3]) > 255) {
|
|
||||||
c->Message(Chat::White, "ERROR: Blue can not be less than 0 or greater than 255!");
|
for (int fog_index = 0; fog_index < 4; fog_index++) {
|
||||||
}
|
zone->newzone_data.fog_red[fog_index] = static_cast<uint8>(red);
|
||||||
else {
|
zone->newzone_data.fog_green[fog_index] = static_cast<uint8>(green);
|
||||||
for (int z = 0; z < 4; z++) {
|
zone->newzone_data.fog_blue[fog_index] = static_cast<uint8>(blue);
|
||||||
zone->newzone_data.fog_red[z] = atoi(sep->arg[1]);
|
|
||||||
zone->newzone_data.fog_green[z] = atoi(sep->arg[2]);
|
|
||||||
zone->newzone_data.fog_blue[z] = atoi(sep->arg[3]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||||
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
||||||
entity_list.QueueClients(c, outapp);
|
entity_list.QueueClients(c, outapp);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Fog Color Changed | Zone: {} ({}) Red: {} Green: {} Blue: {} Permanent: {}",
|
||||||
|
zone->GetLongName(),
|
||||||
|
zone->GetZoneID(),
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
blue,
|
||||||
|
permanent ? "Yes" : "No"
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user