mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01: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,39 +1099,40 @@ void command_emptyinventory(Client *c, const Seperator *sep)
|
||||
}
|
||||
}
|
||||
|
||||
if (c != target) {
|
||||
auto target_name = target->GetCleanName();
|
||||
if (removed_count) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Inventory cleared for {}, {} items deleted.",
|
||||
target_name,
|
||||
removed_count
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} has no items to delete.",
|
||||
target_name
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
if (removed_count) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Inventory cleared for {}, {} items deleted.",
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
removed_count
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
if (removed_count) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your inventory has been cleared, {} items deleted.",
|
||||
removed_count
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
c->Message(Chat::White, "You have no items to delete.");
|
||||
}
|
||||
}
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} no items to delete.",
|
||||
(
|
||||
c == target ?
|
||||
"You have" :
|
||||
fmt::format(
|
||||
"{} ({}) has",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// All new code added to command.cpp should be BEFORE this comment line. Do no append code to this file below the BOTS code block.
|
||||
|
||||
@ -48,29 +48,24 @@ void command_castspell(Client *c, const Seperator *sep)
|
||||
c->CastSpell(spell_id, target->GetID(), EQ::spells::CastingSlot::Item, spells[spell_id].cast_time);
|
||||
}
|
||||
|
||||
if (c != target) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Cast {} ({}) on {}{}.",
|
||||
GetSpellName(spell_id),
|
||||
spell_id,
|
||||
target->GetCleanName(),
|
||||
instant_cast ? " instantly" : ""
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Cast {} ({}) on yourself{}.",
|
||||
GetSpellName(spell_id),
|
||||
spell_id,
|
||||
instant_cast ? " instantly" : ""
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Cast {} ({}) on {}{}.",
|
||||
GetSpellName(spell_id),
|
||||
spell_id,
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
instant_cast ? " instantly" : ""
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,16 +2,45 @@
|
||||
|
||||
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) {
|
||||
if ((c->GetTarget()) && c->Admin() >= commandGenderOthers) {
|
||||
t = c->GetTarget();
|
||||
}
|
||||
t->SendIllusionPacket(t->GetRace(), atoi(sep->arg[1]));
|
||||
Mob *target = c;
|
||||
if (c->GetTarget() && c->Admin() >= commandGenderOthers) {
|
||||
target = c->GetTarget();
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "Usage: #gender [0/1/2]");
|
||||
|
||||
auto gender_id = std::stoi(sep->arg[1]);
|
||||
if (gender_id < 0 || gender_id > 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(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} {} {} buried corpse{}.",
|
||||
"{} {} buried corpse{}.",
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
"You have" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
"{} ({}) has",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
(
|
||||
corpse_count ?
|
||||
std::to_string(corpse_count) :
|
||||
|
||||
@ -13,9 +13,16 @@ void command_ginfo(Client *c, const Seperator *sep)
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} {} not in a group.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
c == target ? "are" : "is"
|
||||
"{} not in a group.",
|
||||
(
|
||||
c == target ?
|
||||
"You are" :
|
||||
fmt::format(
|
||||
"{} ({}) is",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
@ -25,7 +32,15 @@ void command_ginfo(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Group Info for {} | ID: {} Members: {}",
|
||||
c == target ? "Yourself" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"Yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
target_group->GetID(),
|
||||
target_group->GroupCount()
|
||||
).c_str()
|
||||
|
||||
@ -36,7 +36,15 @@ void command_givemoney(Client *c, const Seperator *sep)
|
||||
fmt::format(
|
||||
"Added {} to {}.",
|
||||
ConvertMoneyToString(platinum, gold, silver, copper),
|
||||
c == target ? "yourself" : target->GetCleanName()
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
@ -12,15 +12,15 @@ void command_loc(Client *c, const Seperator *sep)
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} Location | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}",
|
||||
"Location for {} | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}",
|
||||
(
|
||||
c == target ?
|
||||
"Your" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
"Yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
target_position.x,
|
||||
target_position.y,
|
||||
|
||||
@ -23,7 +23,15 @@ void command_nukeitem(Client *c, const Seperator *sep)
|
||||
deleted_count,
|
||||
database.CreateItemLink(item_id),
|
||||
item_id,
|
||||
c == target ? "yourself" : target->GetCleanName()
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
@ -33,7 +41,15 @@ void command_nukeitem(Client *c, const Seperator *sep)
|
||||
"Could not find any {} ({}) to delete from {}.",
|
||||
database.CreateItemLink(item_id),
|
||||
item_id,
|
||||
c == target ? "yourself" : target->GetCleanName()
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
@ -15,6 +15,11 @@ void command_permagender(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
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 {} ({})",
|
||||
c->GetCleanName(),
|
||||
@ -31,7 +36,15 @@ void command_permagender(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Gender changed for {} to {} ({}).",
|
||||
c == target ? "yourself" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
GetGenderName(gender_id),
|
||||
gender_id
|
||||
).c_str()
|
||||
|
||||
@ -36,7 +36,15 @@ void command_permarace(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Race changed for {} to {} ({}).",
|
||||
c == target ? "yourself" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
GetRaceIDName(race_id),
|
||||
race_id
|
||||
).c_str()
|
||||
|
||||
@ -13,12 +13,11 @@ void command_scribespells(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint8 rule_max_level = (uint8) RuleI(Character, MaxLevel);
|
||||
uint8 max_level = (uint8) std::stoi(sep->arg[1]);
|
||||
uint8 min_level = (
|
||||
uint8 max_level = (uint8) std::stoi(sep->arg[1]);
|
||||
uint8 min_level = (
|
||||
sep->IsNumber(2) ?
|
||||
(uint8)
|
||||
std::stoi(sep->arg[2]) :
|
||||
1
|
||||
(uint8) std::stoi(sep->arg[2]) :
|
||||
1
|
||||
); // Default to Level 1 if there isn't a 2nd argument
|
||||
|
||||
if (!c->GetGM()) { // Default to Character:MaxLevel if we're not a GM and Level is higher than the max level
|
||||
@ -42,15 +41,18 @@ void command_scribespells(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint16 scribed_spells = target->ScribeSpells(min_level, max_level);
|
||||
if (target != c) {
|
||||
if (c != target) {
|
||||
std::string spell_message = (
|
||||
scribed_spells > 0 ?
|
||||
(
|
||||
scribed_spells == 1 ?
|
||||
"A new spell" :
|
||||
fmt::format("{} New spells", scribed_spells)
|
||||
) :
|
||||
"No new spells"
|
||||
(
|
||||
scribed_spells == 1 ?
|
||||
"A new spell" :
|
||||
fmt::format(
|
||||
"{} New spells",
|
||||
scribed_spells
|
||||
)
|
||||
) :
|
||||
"No new spells"
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@ -18,10 +18,10 @@ void command_setaapts(Client *c, const Seperator *sep)
|
||||
|
||||
std::string aa_type = str_tolower(sep->arg[1]);
|
||||
std::string group_raid_string;
|
||||
uint32 aa_points = static_cast<uint32>(std::min(std::stoull(sep->arg[2]), (unsigned long long) 2000000000));
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
bool is_raid = aa_type.find("raid") != std::string::npos;
|
||||
uint32 aa_points = static_cast<uint32>(std::min(std::stoull(sep->arg[2]), (unsigned long long) 2000000000));
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
bool is_raid = aa_type.find("raid") != std::string::npos;
|
||||
if (!is_aa && !is_group && !is_raid) {
|
||||
c->Message(Chat::White, "Usage: #setaapts [AA|Group|Raid] [AA Amount]");
|
||||
return;
|
||||
@ -48,7 +48,15 @@ void command_setaapts(Client *c, const Seperator *sep)
|
||||
|
||||
std::string aa_message = fmt::format(
|
||||
"{} now {} {} {}AA Point{}.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
aa_points,
|
||||
group_raid_string,
|
||||
|
||||
@ -16,15 +16,15 @@ void command_setaaxp(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
std::string aa_type = str_tolower(sep->arg[1]);
|
||||
std::string aa_type = str_tolower(sep->arg[1]);
|
||||
std::string group_raid_string;
|
||||
uint32 aa_experience = static_cast<uint32>(std::min(
|
||||
uint32 aa_experience = static_cast<uint32>(std::min(
|
||||
std::stoull(sep->arg[2]),
|
||||
(unsigned long long) 2000000000
|
||||
));
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
bool is_raid = aa_type.find("raid") != std::string::npos;
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
bool is_raid = aa_type.find("raid") != std::string::npos;
|
||||
if (!is_aa && !is_group && !is_raid) {
|
||||
c->Message(Chat::White, "Usage: #setaaxp [AA|Group|Raid] [AA Experience]");
|
||||
return;
|
||||
@ -54,7 +54,15 @@ void command_setaaxp(Client *c, const Seperator *sep)
|
||||
|
||||
std::string aa_exp_message = fmt::format(
|
||||
"{} now {} {} {}AA Experience.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
aa_experience,
|
||||
group_raid_string
|
||||
|
||||
@ -13,13 +13,13 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
std::string crystal_type = str_tolower(sep->arg[1]);
|
||||
uint32 crystal_amount = static_cast<uint32>(std::min(
|
||||
std::string crystal_type = str_tolower(sep->arg[1]);
|
||||
uint32 crystal_amount = static_cast<uint32>(std::min(
|
||||
std::stoull(sep->arg[2]),
|
||||
(unsigned long long) 2000000000
|
||||
));
|
||||
bool is_ebon = crystal_type.find("ebon") != std::string::npos;
|
||||
bool is_radiant = crystal_type.find("radiant") != std::string::npos;
|
||||
bool is_ebon = crystal_type.find("ebon") != std::string::npos;
|
||||
bool is_radiant = crystal_type.find("radiant") != std::string::npos;
|
||||
if (!is_ebon && !is_radiant) {
|
||||
c->Message(Chat::White, "Usage: #setcrystals [Ebon|Radiant] [Crystal Amount]");
|
||||
return;
|
||||
@ -27,15 +27,14 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
||||
|
||||
uint32 crystal_item_id = (
|
||||
is_ebon ?
|
||||
RuleI(Zone, EbonCrystalItemID) :
|
||||
RuleI(Zone, RadiantCrystalItemID)
|
||||
RuleI(Zone, EbonCrystalItemID) :
|
||||
RuleI(Zone, RadiantCrystalItemID)
|
||||
);
|
||||
|
||||
auto crystal_link = database.CreateItemLink(crystal_item_id);
|
||||
if (is_radiant) {
|
||||
target->SetRadiantCrystals(crystal_amount);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
target->SetEbonCrystals(crystal_amount);
|
||||
}
|
||||
|
||||
@ -43,7 +42,15 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} now {} {} {}.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
crystal_amount,
|
||||
crystal_link
|
||||
|
||||
@ -19,7 +19,15 @@ void command_setpvppoints(Client *c, const Seperator *sep)
|
||||
target->SendPVPStats();
|
||||
std::string pvp_message = fmt::format(
|
||||
"{} now {} {} PVP Point{}.",
|
||||
c == target ? "You" : target->GetCleanName(),
|
||||
(
|
||||
c == target ?
|
||||
"You" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
c == target ? "have" : "has",
|
||||
pvp_points,
|
||||
pvp_points != 1 ? "s" : ""
|
||||
|
||||
@ -19,12 +19,10 @@ void command_stun(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget();
|
||||
if (target->IsClient()) {
|
||||
target->CastToClient()->Stun(duration);
|
||||
}
|
||||
else if (target->IsNPC()) {
|
||||
} else if (target->IsNPC()) {
|
||||
target->CastToNPC()->Stun(duration);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
c->Stun(duration);
|
||||
}
|
||||
|
||||
@ -34,12 +32,12 @@ void command_stun(Client *c, const Seperator *sep)
|
||||
"You stunned {} for {}.",
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
),
|
||||
ConvertMillisecondsToTime(duration)
|
||||
) :
|
||||
@ -47,12 +45,12 @@ void command_stun(Client *c, const Seperator *sep)
|
||||
"You unstunned {}.",
|
||||
(
|
||||
c == target ?
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
"yourself" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
target->GetCleanName(),
|
||||
target->GetID()
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -42,15 +42,18 @@ void command_traindisc(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint16 learned_disciplines = target->LearnDisciplines(min_level, max_level);
|
||||
if (target != c) {
|
||||
if (c != target) {
|
||||
std::string discipline_message = (
|
||||
learned_disciplines > 0 ?
|
||||
(
|
||||
learned_disciplines == 1 ?
|
||||
"A new discipline" :
|
||||
fmt::format("{} New disciplines", learned_disciplines)
|
||||
) :
|
||||
"No new disciplines"
|
||||
(
|
||||
learned_disciplines == 1 ?
|
||||
"A new discipline" :
|
||||
fmt::format(
|
||||
"{} New disciplines",
|
||||
learned_disciplines
|
||||
)
|
||||
) :
|
||||
"No new disciplines"
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user