mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Commands] Cleanup #attack Command. (#2103)
- Cleanup messages and logic.
This commit is contained in:
parent
35044becc1
commit
04f3d6286c
@ -122,7 +122,7 @@ int command_init(void)
|
|||||||
command_add("appearance", "[type] [value] - Send an appearance packet for you or your target", AccountStatus::GMLeadAdmin, command_appearance) ||
|
command_add("appearance", "[type] [value] - Send an appearance packet for you or your target", AccountStatus::GMLeadAdmin, command_appearance) ||
|
||||||
command_add("appearanceeffects", "- [view] [set] [remove] appearance effects.", AccountStatus::GMAdmin, command_appearanceeffects) ||
|
command_add("appearanceeffects", "- [view] [set] [remove] appearance effects.", AccountStatus::GMAdmin, command_appearanceeffects) ||
|
||||||
command_add("apply_shared_memory", "[shared_memory_name] - Tells every zone and world to apply a specific shared memory segment by name.", AccountStatus::GMImpossible, command_apply_shared_memory) ||
|
command_add("apply_shared_memory", "[shared_memory_name] - Tells every zone and world to apply a specific shared memory segment by name.", AccountStatus::GMImpossible, command_apply_shared_memory) ||
|
||||||
command_add("attack", "[targetname] - Make your NPC target attack targetname", AccountStatus::GMLeadAdmin, command_attack) ||
|
command_add("attack", "[Entity Name] - Make your NPC target attack an entity by name", AccountStatus::GMLeadAdmin, command_attack) ||
|
||||||
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", AccountStatus::GMImpossible, command_augmentitem) ||
|
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", AccountStatus::GMImpossible, command_augmentitem) ||
|
||||||
command_add("ban", "[name] [reason]- Ban by character name", AccountStatus::GMLeadAdmin, command_ban) ||
|
command_add("ban", "[name] [reason]- Ban by character name", AccountStatus::GMLeadAdmin, command_ban) ||
|
||||||
command_add("beard", "- Change the beard of your target", AccountStatus::QuestTroupe, command_beard) ||
|
command_add("beard", "- Change the beard of your target", AccountStatus::QuestTroupe, command_beard) ||
|
||||||
|
|||||||
@ -2,17 +2,37 @@
|
|||||||
|
|
||||||
void command_attack(Client *c, const Seperator *sep)
|
void command_attack(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
if (c->GetTarget() && c->GetTarget()->IsNPC() && sep->arg[1] != 0) {
|
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
||||||
Mob *sictar = entity_list.GetMob(sep->argplus[1]);
|
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||||
if (sictar) {
|
return;
|
||||||
c->GetTarget()->CastToNPC()->AddToHateList(sictar, 1, 0);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
c->Message(Chat::White, "Error: %s not found", sep->arg[1]);
|
std::string entity_name = sep->argplus[1];
|
||||||
|
if (entity_name.empty()) {
|
||||||
|
c->Message(Chat::White, "Usage: #attack [Entity Name]");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
auto entity = entity_list.GetMob(entity_name.c_str());
|
||||||
c->Message(Chat::White, "Usage: (needs NPC targeted) #attack targetname");
|
if (entity) {
|
||||||
|
c->GetTarget()->AddToHateList(entity, 1);
|
||||||
|
c->Message(
|
||||||
|
Chat::EchoChat1,
|
||||||
|
fmt::format(
|
||||||
|
"{} whispers, 'Attacking {} ({}).'",
|
||||||
|
c->GetTarget()->GetCleanName(),
|
||||||
|
entity->GetCleanName(),
|
||||||
|
entity->GetID()
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"No entity by the name of '{}' could be found.",
|
||||||
|
entity_name
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user