mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Commands] Cleanup #gender Command. (#1832)
- Cleanup message and logic. - Cleanup other spots using similar logic so they're all uniform.
This commit is contained in:
parent
2dc3ca52db
commit
e87b8e2682
@ -1099,14 +1099,20 @@ void command_emptyinventory(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != target) {
|
|
||||||
auto target_name = target->GetCleanName();
|
|
||||||
if (removed_count) {
|
if (removed_count) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Inventory cleared for {}, {} items deleted.",
|
"Inventory cleared for {}, {} items deleted.",
|
||||||
target_name,
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
removed_count
|
removed_count
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
@ -1114,23 +1120,18 @@ void command_emptyinventory(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} has no items to delete.",
|
"{} no items to delete.",
|
||||||
target_name
|
(
|
||||||
).c_str()
|
c == target ?
|
||||||
);
|
"You have" :
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (removed_count) {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Your inventory has been cleared, {} items deleted.",
|
"{} ({}) has",
|
||||||
removed_count
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
c->Message(Chat::White, "You have no items to delete.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,30 +48,25 @@ void command_castspell(Client *c, const Seperator *sep)
|
|||||||
c->CastSpell(spell_id, target->GetID(), EQ::spells::CastingSlot::Item, spells[spell_id].cast_time);
|
c->CastSpell(spell_id, target->GetID(), EQ::spells::CastingSlot::Item, spells[spell_id].cast_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != target) {
|
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Cast {} ({}) on {}{}.",
|
"Cast {} ({}) on {}{}.",
|
||||||
GetSpellName(spell_id),
|
GetSpellName(spell_id),
|
||||||
spell_id,
|
spell_id,
|
||||||
target->GetCleanName(),
|
(
|
||||||
instant_cast ? " instantly" : ""
|
c == target ?
|
||||||
).c_str()
|
"yourself" :
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Cast {} ({}) on yourself{}.",
|
"{} ({})",
|
||||||
GetSpellName(spell_id),
|
target->GetCleanName(),
|
||||||
spell_id,
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
instant_cast ? " instantly" : ""
|
instant_cast ? " instantly" : ""
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,45 @@
|
|||||||
|
|
||||||
void command_gender(Client *c, const Seperator *sep)
|
void command_gender(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
Mob *t = c->CastToMob();
|
int arguments = sep->argnum;
|
||||||
|
if (!arguments || !sep->IsNumber(1)) {
|
||||||
|
c->Message(Chat::White, "Usage: #gender [Gender ID]");
|
||||||
|
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 500) {
|
Mob *target = c;
|
||||||
if ((c->GetTarget()) && c->Admin() >= commandGenderOthers) {
|
if (c->GetTarget() && c->Admin() >= commandGenderOthers) {
|
||||||
t = c->GetTarget();
|
target = c->GetTarget();
|
||||||
}
|
}
|
||||||
t->SendIllusionPacket(t->GetRace(), atoi(sep->arg[1]));
|
|
||||||
}
|
auto gender_id = std::stoi(sep->arg[1]);
|
||||||
else {
|
if (gender_id < 0 || gender_id > 2) {
|
||||||
c->Message(Chat::White, "Usage: #gender [0/1/2]");
|
c->Message(Chat::White, "Usage: #gender [Gender ID]");
|
||||||
|
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target->SendIllusionPacket(
|
||||||
|
target->GetRace(),
|
||||||
|
gender_id
|
||||||
|
);
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Gender changed for {} to {} ({}).",
|
||||||
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
GetGenderName(gender_id),
|
||||||
|
gender_id
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,17 +12,16 @@ void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} {} {} buried corpse{}.",
|
"{} {} buried corpse{}.",
|
||||||
(
|
(
|
||||||
c == target ?
|
c == target ?
|
||||||
"You" :
|
"You have" :
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} ({})",
|
"{} ({}) has",
|
||||||
target->GetCleanName(),
|
target->GetCleanName(),
|
||||||
target->GetID()
|
target->GetID()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
c == target ? "have" : "has",
|
|
||||||
(
|
(
|
||||||
corpse_count ?
|
corpse_count ?
|
||||||
std::to_string(corpse_count) :
|
std::to_string(corpse_count) :
|
||||||
|
|||||||
@ -13,9 +13,16 @@ void command_ginfo(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} {} not in a group.",
|
"{} not in a group.",
|
||||||
c == target ? "You" : target->GetCleanName(),
|
(
|
||||||
c == target ? "are" : "is"
|
c == target ?
|
||||||
|
"You are" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({}) is",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -25,7 +32,15 @@ void command_ginfo(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Group Info for {} | ID: {} Members: {}",
|
"Group Info for {} | ID: {} Members: {}",
|
||||||
c == target ? "Yourself" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"Yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
target_group->GetID(),
|
target_group->GetID(),
|
||||||
target_group->GroupCount()
|
target_group->GroupCount()
|
||||||
).c_str()
|
).c_str()
|
||||||
|
|||||||
@ -36,7 +36,15 @@ void command_givemoney(Client *c, const Seperator *sep)
|
|||||||
fmt::format(
|
fmt::format(
|
||||||
"Added {} to {}.",
|
"Added {} to {}.",
|
||||||
ConvertMoneyToString(platinum, gold, silver, copper),
|
ConvertMoneyToString(platinum, gold, silver, copper),
|
||||||
c == target ? "yourself" : target->GetCleanName()
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,10 +12,10 @@ void command_loc(Client *c, const Seperator *sep)
|
|||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} Location | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}",
|
"Location for {} | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}",
|
||||||
(
|
(
|
||||||
c == target ?
|
c == target ?
|
||||||
"Your" :
|
"Yourself" :
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} ({})",
|
"{} ({})",
|
||||||
target->GetCleanName(),
|
target->GetCleanName(),
|
||||||
|
|||||||
@ -23,7 +23,15 @@ void command_nukeitem(Client *c, const Seperator *sep)
|
|||||||
deleted_count,
|
deleted_count,
|
||||||
database.CreateItemLink(item_id),
|
database.CreateItemLink(item_id),
|
||||||
item_id,
|
item_id,
|
||||||
c == target ? "yourself" : target->GetCleanName()
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -33,7 +41,15 @@ void command_nukeitem(Client *c, const Seperator *sep)
|
|||||||
"Could not find any {} ({}) to delete from {}.",
|
"Could not find any {} ({}) to delete from {}.",
|
||||||
database.CreateItemLink(item_id),
|
database.CreateItemLink(item_id),
|
||||||
item_id,
|
item_id,
|
||||||
c == target ? "yourself" : target->GetCleanName()
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,11 @@ void command_permagender(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto gender_id = std::stoi(sep->arg[1]);
|
auto gender_id = std::stoi(sep->arg[1]);
|
||||||
|
if (gender_id < 0 || gender_id > 2) {
|
||||||
|
c->Message(Chat::White, "Usage: #permagender [Gender ID]");
|
||||||
|
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LogInfo("Gender changed by {} for {} to {} ({})",
|
LogInfo("Gender changed by {} for {} to {} ({})",
|
||||||
c->GetCleanName(),
|
c->GetCleanName(),
|
||||||
@ -31,7 +36,15 @@ void command_permagender(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Gender changed for {} to {} ({}).",
|
"Gender changed for {} to {} ({}).",
|
||||||
c == target ? "yourself" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
GetGenderName(gender_id),
|
GetGenderName(gender_id),
|
||||||
gender_id
|
gender_id
|
||||||
).c_str()
|
).c_str()
|
||||||
|
|||||||
@ -36,7 +36,15 @@ void command_permarace(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Race changed for {} to {} ({}).",
|
"Race changed for {} to {} ({}).",
|
||||||
c == target ? "yourself" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
GetRaceIDName(race_id),
|
GetRaceIDName(race_id),
|
||||||
race_id
|
race_id
|
||||||
).c_str()
|
).c_str()
|
||||||
|
|||||||
@ -16,8 +16,7 @@ void command_scribespells(Client *c, const Seperator *sep)
|
|||||||
uint8 max_level = (uint8) std::stoi(sep->arg[1]);
|
uint8 max_level = (uint8) std::stoi(sep->arg[1]);
|
||||||
uint8 min_level = (
|
uint8 min_level = (
|
||||||
sep->IsNumber(2) ?
|
sep->IsNumber(2) ?
|
||||||
(uint8)
|
(uint8) std::stoi(sep->arg[2]) :
|
||||||
std::stoi(sep->arg[2]) :
|
|
||||||
1
|
1
|
||||||
); // Default to Level 1 if there isn't a 2nd argument
|
); // Default to Level 1 if there isn't a 2nd argument
|
||||||
|
|
||||||
@ -42,13 +41,16 @@ void command_scribespells(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16 scribed_spells = target->ScribeSpells(min_level, max_level);
|
uint16 scribed_spells = target->ScribeSpells(min_level, max_level);
|
||||||
if (target != c) {
|
if (c != target) {
|
||||||
std::string spell_message = (
|
std::string spell_message = (
|
||||||
scribed_spells > 0 ?
|
scribed_spells > 0 ?
|
||||||
(
|
(
|
||||||
scribed_spells == 1 ?
|
scribed_spells == 1 ?
|
||||||
"A new spell" :
|
"A new spell" :
|
||||||
fmt::format("{} New spells", scribed_spells)
|
fmt::format(
|
||||||
|
"{} New spells",
|
||||||
|
scribed_spells
|
||||||
|
)
|
||||||
) :
|
) :
|
||||||
"No new spells"
|
"No new spells"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -48,7 +48,15 @@ void command_setaapts(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::string aa_message = fmt::format(
|
std::string aa_message = fmt::format(
|
||||||
"{} now {} {} {}AA Point{}.",
|
"{} now {} {} {}AA Point{}.",
|
||||||
c == target ? "You" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"You" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
c == target ? "have" : "has",
|
c == target ? "have" : "has",
|
||||||
aa_points,
|
aa_points,
|
||||||
group_raid_string,
|
group_raid_string,
|
||||||
|
|||||||
@ -54,7 +54,15 @@ void command_setaaxp(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::string aa_exp_message = fmt::format(
|
std::string aa_exp_message = fmt::format(
|
||||||
"{} now {} {} {}AA Experience.",
|
"{} now {} {} {}AA Experience.",
|
||||||
c == target ? "You" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"You" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
c == target ? "have" : "has",
|
c == target ? "have" : "has",
|
||||||
aa_experience,
|
aa_experience,
|
||||||
group_raid_string
|
group_raid_string
|
||||||
|
|||||||
@ -34,8 +34,7 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
|||||||
auto crystal_link = database.CreateItemLink(crystal_item_id);
|
auto crystal_link = database.CreateItemLink(crystal_item_id);
|
||||||
if (is_radiant) {
|
if (is_radiant) {
|
||||||
target->SetRadiantCrystals(crystal_amount);
|
target->SetRadiantCrystals(crystal_amount);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
target->SetEbonCrystals(crystal_amount);
|
target->SetEbonCrystals(crystal_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +42,15 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} now {} {} {}.",
|
"{} now {} {} {}.",
|
||||||
c == target ? "You" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"You" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
c == target ? "have" : "has",
|
c == target ? "have" : "has",
|
||||||
crystal_amount,
|
crystal_amount,
|
||||||
crystal_link
|
crystal_link
|
||||||
|
|||||||
@ -19,7 +19,15 @@ void command_setpvppoints(Client *c, const Seperator *sep)
|
|||||||
target->SendPVPStats();
|
target->SendPVPStats();
|
||||||
std::string pvp_message = fmt::format(
|
std::string pvp_message = fmt::format(
|
||||||
"{} now {} {} PVP Point{}.",
|
"{} now {} {} PVP Point{}.",
|
||||||
c == target ? "You" : target->GetCleanName(),
|
(
|
||||||
|
c == target ?
|
||||||
|
"You" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
),
|
||||||
c == target ? "have" : "has",
|
c == target ? "have" : "has",
|
||||||
pvp_points,
|
pvp_points,
|
||||||
pvp_points != 1 ? "s" : ""
|
pvp_points != 1 ? "s" : ""
|
||||||
|
|||||||
@ -19,12 +19,10 @@ void command_stun(Client *c, const Seperator *sep)
|
|||||||
target = c->GetTarget();
|
target = c->GetTarget();
|
||||||
if (target->IsClient()) {
|
if (target->IsClient()) {
|
||||||
target->CastToClient()->Stun(duration);
|
target->CastToClient()->Stun(duration);
|
||||||
}
|
} else if (target->IsNPC()) {
|
||||||
else if (target->IsNPC()) {
|
|
||||||
target->CastToNPC()->Stun(duration);
|
target->CastToNPC()->Stun(duration);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
c->Stun(duration);
|
c->Stun(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,13 +42,16 @@ void command_traindisc(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16 learned_disciplines = target->LearnDisciplines(min_level, max_level);
|
uint16 learned_disciplines = target->LearnDisciplines(min_level, max_level);
|
||||||
if (target != c) {
|
if (c != target) {
|
||||||
std::string discipline_message = (
|
std::string discipline_message = (
|
||||||
learned_disciplines > 0 ?
|
learned_disciplines > 0 ?
|
||||||
(
|
(
|
||||||
learned_disciplines == 1 ?
|
learned_disciplines == 1 ?
|
||||||
"A new discipline" :
|
"A new discipline" :
|
||||||
fmt::format("{} New disciplines", learned_disciplines)
|
fmt::format(
|
||||||
|
"{} New disciplines",
|
||||||
|
learned_disciplines
|
||||||
|
)
|
||||||
) :
|
) :
|
||||||
"No new disciplines"
|
"No new disciplines"
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user