mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Commands] Cleanup #memspell Command. (#1801)
- Cleanup message and logic. - Add support for memorizing spell to target if you have GM enabled.
This commit is contained in:
parent
6a42639386
commit
8a27fce3a8
@ -240,7 +240,7 @@ int command_init(void)
|
|||||||
command_add("makepet", "[level] [class] [race] [texture] - Make a pet", AccountStatus::Guide, command_makepet) ||
|
command_add("makepet", "[level] [class] [race] [texture] - Make a pet", AccountStatus::Guide, command_makepet) ||
|
||||||
command_add("mana", "- Fill your or your target's mana", AccountStatus::Guide, command_mana) ||
|
command_add("mana", "- Fill your or your target's mana", AccountStatus::Guide, command_mana) ||
|
||||||
command_add("maxskills", "Maxes skills for you.", AccountStatus::GMMgmt, command_max_all_skills) ||
|
command_add("maxskills", "Maxes skills for you.", AccountStatus::GMMgmt, command_max_all_skills) ||
|
||||||
command_add("memspell", "[slotid] [spellid] - Memorize spellid in the specified slot", AccountStatus::Guide, command_memspell) ||
|
command_add("memspell", "[Slot] [Spell ID] - Memorize a Spell by ID in the specified Slot", AccountStatus::Guide, command_memspell) ||
|
||||||
command_add("merchant_close_shop", "Closes a merchant shop", AccountStatus::GMAdmin, command_merchantcloseshop) ||
|
command_add("merchant_close_shop", "Closes a merchant shop", AccountStatus::GMAdmin, command_merchantcloseshop) ||
|
||||||
command_add("merchant_open_shop", "Opens a merchants shop", AccountStatus::GMAdmin, command_merchantopenshop) ||
|
command_add("merchant_open_shop", "Opens a merchants shop", AccountStatus::GMAdmin, command_merchantopenshop) ||
|
||||||
command_add("modifynpcstat", "- Modifys a NPC's stats", AccountStatus::GMLeadAdmin, command_modifynpcstat) ||
|
command_add("modifynpcstat", "- Modifys a NPC's stats", AccountStatus::GMLeadAdmin, command_modifynpcstat) ||
|
||||||
|
|||||||
@ -2,21 +2,47 @@
|
|||||||
|
|
||||||
void command_memspell(Client *c, const Seperator *sep)
|
void command_memspell(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
uint32 slot;
|
int arguments = sep->argnum;
|
||||||
uint16 spell_id;
|
if (
|
||||||
|
!arguments ||
|
||||||
if (!(sep->IsNumber(1) && sep->IsNumber(2))) {
|
!sep->IsNumber(1) ||
|
||||||
c->Message(Chat::White, "Usage: #MemSpell slotid spellid");
|
!sep->IsNumber(2)
|
||||||
|
) {
|
||||||
|
c->Message(Chat::White, "Usage: #memspell [Slot] [Spell ID]");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
slot = atoi(sep->arg[1]) - 1;
|
Client* target = c;
|
||||||
spell_id = atoi(sep->arg[2]);
|
if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) {
|
||||||
if (slot > EQ::spells::SPELL_GEM_COUNT || spell_id >= SPDAT_RECORDS) {
|
target = c->GetTarget()->CastToClient();
|
||||||
c->Message(Chat::White, "Error: #MemSpell: Arguement out of range");
|
}
|
||||||
}
|
|
||||||
else {
|
uint32 spell_gem = std::stoul(sep->arg[1]);
|
||||||
c->MemSpell(spell_id, slot);
|
uint32 slot = (spell_gem - 1);
|
||||||
c->Message(Chat::White, "Spell slot changed, have fun!");
|
uint16 spell_id = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||||
}
|
if (
|
||||||
|
IsValidSpell(spell_id) &&
|
||||||
|
slot < EQ::spells::SPELL_GEM_COUNT
|
||||||
|
) {
|
||||||
|
target->MemSpell(spell_id, slot);
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} ({}) has been memorized to Spell Gem {} ({}) for {}.",
|
||||||
|
GetSpellName(spell_id),
|
||||||
|
spell_id,
|
||||||
|
spell_gem,
|
||||||
|
slot,
|
||||||
|
(
|
||||||
|
c == target ?
|
||||||
|
"yourself" :
|
||||||
|
fmt::format(
|
||||||
|
"{} ({})",
|
||||||
|
target->GetCleanName(),
|
||||||
|
target->GetID()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user