[Commands] Cleanup #reloadzps Command. (#2129)

* [Commands] Cleanup #reloadzps Command.
- Cleanup messages and logic.
- Make reloading of zone points global instead of zone specific.

* Further cleanup.
- Add zone->GetZoneDescription().
- Add mob->GetTargetDescription(mob).

* Final cleanup.

* Typo.
This commit is contained in:
Kinglykrab 2022-05-07 03:23:15 -04:00 committed by GitHub
parent 0b3065d7a9
commit 7df9b2974b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
111 changed files with 2035 additions and 2864 deletions

View File

@ -416,6 +416,15 @@ enum ConsiderLevel : uint8 {
Scowls
};
enum TargetDescriptionType : uint8 {
LCSelf,
UCSelf,
LCYou,
UCYou,
LCYour,
UCYour
};
enum ReloadWorld : uint8 {
NoRepop = 0,
Repop,

View File

@ -232,6 +232,7 @@
#define ServerOP_ReloadMerchants 0x4016
#define ServerOP_ReloadAAData 0x4017
#define ServerOP_ReloadTraps 0x4018
#define ServerOP_ReloadZonePoints 0x4019
#define ServerOP_ReloadStaticZoneData 0x4020
#define ServerOP_CZDialogueWindow 0x4500

File diff suppressed because it is too large Load Diff

View File

@ -40,13 +40,13 @@ public:
void SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);
void SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message);
void SendKeepAlive();
bool SetZone(uint32 iZoneID, uint32 iInstanceID = 0, bool iStaticZone = false);
void TriggerBootup(uint32 iZoneID = 0, uint32 iInstanceID = 0, const char* iAdminName = 0, bool iMakeStatic = false);
bool SetZone(uint32 zone_id, uint32 instance_id = 0, bool is_static_zone = false);
void TriggerBootup(uint32 zone_id = 0, uint32 instance_id = 0, const char* admin_name = 0, bool is_static_zone = false);
void Disconnect() { auto handle = tcpc->Handle(); if (handle) { handle->Disconnect(); } }
void IncomingClient(Client* client);
void LSBootUpdate(uint32 zoneid, uint32 iInstanceID = 0, bool startup = false);
void LSSleepUpdate(uint32 zoneid);
void LSShutDownUpdate(uint32 zoneid);
void LSBootUpdate(uint32 zone_id, uint32 instance_id = 0, bool startup = false);
void LSSleepUpdate(uint32 zone_id);
void LSShutDownUpdate(uint32 zone_id);
uint32 GetPrevZoneID() { return zone_server_previous_zone_id; }
void ChangeWID(uint32 iCharID, uint32 iWID);
void SendGroupIDs();

View File

@ -37,15 +37,14 @@
extern Zone* zone;
//#define LOSDEBUG 6
void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbose) {
void EntityList::DescribeAggro(Client *to_who, NPC *from_who, float d, bool verbose) {
float distance_squared = (d * d);
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"Describing aggro for {} ({}).",
from_who->GetCleanName(),
from_who->GetID()
to_who->GetTargetDescription(from_who)
).c_str()
);
@ -53,18 +52,14 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
bool will_aggro_npcs = from_who->WillAggroNPCs();
if (is_engaged) {
Mob *top = from_who->GetHateTop();
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"I am currently engaged with {}.",
(
!top ?
"nothing" :
fmt::format(
"{} ({})",
top->GetCleanName(),
top->GetID()
)
from_who->GetTargetDescription(top)
)
).c_str()
);
@ -90,12 +85,11 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
)
);
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is on Faction {} ({}).",
from_who->GetCleanName(),
from_who->GetID(),
"{} is on Faction {} ({}).",
to_who->GetTargetDescription(from_who),
faction_name,
faction_id
).c_str()
@ -115,12 +109,11 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
if (is_engaged) {
uint32 hate_amount = from_who->GetHateAmount(npc);
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is {}on my hate list{}.",
npc->GetCleanName(),
npc->GetID(),
"{} is {}on my hate list{}.",
to_who->GetTargetDescription(npc),
!hate_amount ? "not " : "",
(
!hate_amount ?
@ -133,21 +126,20 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo
).c_str()
);
} else if (!will_aggro_npcs) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is an NPC and I cannot aggro NPCs.",
npc->GetCleanName(),
npc->GetID()
"{} is an NPC and I cannot aggro NPCs.",
to_who->GetTargetDescription(npc)
).c_str()
);
} else {
from_who->DescribeAggro(towho, npc, verbose);
from_who->DescribeAggro(to_who, npc, verbose);
}
}
}
void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
void NPC::DescribeAggro(Client *to_who, Mob *mob, bool verbose) {
//this logic is duplicated from below, try to keep it up to date.
float aggro_range = GetAggroRange();
float x_range = std::abs(mob->GetX() - GetX());
@ -158,12 +150,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
y_range > aggro_range ||
z_range > aggro_range
) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is out of range. X Range: {} Y Range: {} Z Range: {} Aggro Range: {}",
mob->GetCleanName(),
mob->GetID(),
"{} is out of range. X Range: {} Y Range: {} Z Range: {} Aggro Range: {}",
to_who->GetTargetDescription(mob),
x_range,
y_range,
z_range,
@ -174,12 +165,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
}
if (mob->IsInvisible(this)) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is invisible to me. ",
mob->GetCleanName(),
mob->GetID()
"{} is invisible to me.",
to_who->GetTargetDescription(mob)
).c_str()
);
return;
@ -194,12 +184,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
mob->CastToClient()->GetGM()
)
) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is a GM or is not connected. ",
mob->GetCleanName(),
mob->GetID()
"{} is a GM or is not connected.",
to_who->GetTargetDescription(mob)
).c_str()
);
return;
@ -207,12 +196,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
if (mob == GetOwner()) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is my owner. ",
mob->GetCleanName(),
mob->GetID()
"{} is my owner.",
to_who->GetTargetDescription(mob)
).c_str()
);
return;
@ -221,12 +209,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
float distance_squared = DistanceSquared(mob->GetPosition(), m_Position);
float aggro_range_squared = (aggro_range * aggro_range);
if (distance_squared > aggro_range_squared) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is out of range. Distance: {:.2f} Aggro Range: {:.2f}",
mob->GetCleanName(),
mob->GetID(),
"{} is out of range. Distance: {:.2f} Aggro Range: {:.2f}",
to_who->GetTargetDescription(mob),
distance_squared,
aggro_range_squared
).c_str()
@ -241,12 +228,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
GetBodyType() != BT_Undead &&
!AlwaysAggro()
) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) considers Red to me.",
mob->GetCleanName(),
mob->GetID()
"{} considers Red to me.",
to_who->GetTargetDescription(mob)
).c_str()
);
return;
@ -257,12 +243,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
mob->GetLevelCon(GetLevel()) == CON_GRAY &&
!AlwaysAggro()
) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) considers Red to me.",
mob->GetCleanName(),
mob->GetID()
"{} considers Red to me.",
to_who->GetTargetDescription(mob)
).c_str()
);
return;
@ -283,21 +268,19 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
}
if (!mob_faction_id) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) has no primary Faction.",
mob->GetCleanName(),
mob->GetID()
"{} has no primary Faction.",
to_who->GetTargetDescription(mob)
).c_str()
);
} else if (mob_faction_id < 0) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is on special Faction {}.",
mob->GetCleanName(),
mob->GetID(),
"{} is on special Faction {}.",
to_who->GetTargetDescription(mob),
mob_faction_id
).c_str()
);
@ -306,12 +289,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
bool has_entry = false;
for (auto faction : faction_list) {
if (static_cast<int>(faction->factionID) == mob_faction_id) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) has {} standing with Faction {} ({}) with their Faction Level of {}",
mob->GetCleanName(),
mob->GetID(),
"{} has {} standing with Faction {} ({}) with their Faction Level of {}",
to_who->GetTargetDescription(mob),
(
faction->npc_value != 0 ?
(
@ -332,12 +314,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
}
if (!has_entry) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is on Faction {} ({}), for which I do not have an entry.",
mob->GetCleanName(),
mob->GetID(),
"{} is on Faction {} ({}), for which I do not have an entry.",
to_who->GetTargetDescription(mob),
faction_name,
mob_faction_id
).c_str()
@ -348,7 +329,7 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
auto faction_value = mob->GetReverseFactionCon(this);
if(
if (
!(
faction_value == FACTION_THREATENINGLY ||
faction_value == FACTION_SCOWLS ||
@ -359,12 +340,11 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
)
)
) {
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) does not have low enough faction, their Faction Level is {} ({}).",
mob->GetCleanName(),
mob->GetID(),
"{} does not have low enough faction, their Faction Level is {} ({}).",
to_who->GetTargetDescription(mob),
FactionValueToString(faction_value),
faction_value
).c_str()
@ -372,23 +352,21 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
return;
}
if(!CheckLosFN(mob)) {
towho->Message(
if (!CheckLosFN(mob)) {
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) is out of sight.",
mob->GetCleanName(),
mob->GetID()
"{} is out of sight.",
to_who->GetTargetDescription(mob)
).c_str()
);
}
towho->Message(
to_who->Message(
Chat::White,
fmt::format(
"{} ({}) meets all conditions, I should be attacking them.",
mob->GetCleanName(),
mob->GetID()
"{} meets all conditions, I should be attacking them.",
to_who->GetTargetDescription(mob)
).c_str()
);
}

View File

@ -1267,7 +1267,7 @@ public:
return (task_state ? task_state->EnabledTaskCount(task_set_id) : -1);
}
inline int IsTaskCompleted(int task_id) { return (task_state ? task_state->IsTaskCompleted(task_id) : -1); }
inline void ShowClientTasks(Client *client) { if (task_state) { task_state->ShowClientTasks(client); }}
inline void ShowClientTasks(Client *client) { if (task_state) { task_state->ShowClientTasks(this, client); }}
inline void CancelAllTasks() { if (task_state) { task_state->CancelAllTasks(this); }}
inline int GetActiveTaskCount() { return (task_state ? task_state->GetActiveTaskCount() : 0); }
inline int GetActiveTaskID(int index) { return (task_state ? task_state->GetActiveTaskID(index) : -1); }

View File

@ -799,9 +799,8 @@ void Client::CompleteConnect()
Message(
Chat::Yellow,
fmt::format(
"{} ({}) will expire in {}.",
zone->GetLongName(),
zone->GetInstanceID(),
"{} will expire in {}.",
zone->GetZoneDescription(),
time_string
).c_str()
);

View File

@ -296,7 +296,7 @@ int command_init(void)
command_add("reloadtraps", "[0|1] - Reloads and repops traps, globally if specified (1 = global)", AccountStatus::QuestTroupe, command_reloadtraps) ||
command_add("reloadtitles", "- Reload player titles from the database", AccountStatus::GMLeadAdmin, command_reloadtitles) ||
command_add("reloadworld", "[0|1|2] - Reload quests global and repop NPCs if specified (0 = No Repop, 1 = Repop, 2 = Force Repop)", AccountStatus::Max, command_reloadworld) ||
command_add("reloadzps", "- Reload zone points from database", AccountStatus::GMLeadAdmin, command_reloadzps) ||
command_add("reloadzps", "- Reload zone points from database globally", AccountStatus::GMLeadAdmin, command_reloadzps) ||
command_add("removeitem", "[Item ID] [Amount] - Removes the specified Item ID by Amount from you or your player target's inventory (Amount defaults to 1 if not used)", AccountStatus::GMAdmin, command_removeitem) ||
command_add("repop", "[Force] - Repop the zone with optional force repop", AccountStatus::GMAdmin, command_repop) ||
command_add("resetaa", "- Resets a Player's AA in their profile and refunds spent AA's to unspent, may disconnect player.", AccountStatus::GMMgmt, command_resetaa) ||
@ -1104,15 +1104,7 @@ void command_emptyinventory(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Inventory cleared for {}, {} items deleted.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
removed_count
).c_str()
);
@ -1120,16 +1112,9 @@ void command_emptyinventory(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} no items to delete.",
(
c == target ?
"You have" :
fmt::format(
"{} ({}) has",
target->GetCleanName(),
target->GetID()
)
)
"{} {} no items to delete.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has"
).c_str()
);
}

View File

@ -331,7 +331,7 @@ public:
void StopMobAI();
void DescribeAggro(Client *towho, NPC *from_who, float dist, bool verbose);
void DescribeAggro(Client *to_who, NPC *from_who, float dist, bool verbose);
void Message(uint32 to_guilddbid, uint32 type, const char* message, ...);
void MessageStatus(uint32 to_guilddbid, int to_minstatus, uint32 type, const char* message, ...);

View File

@ -206,10 +206,8 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Spawn2 {} Deleted | Name: {} ({})",
spawn2_id,
target->GetCleanName(),
target->GetID()
"Spawn2 {} Deleted | Name: {}",
spawn2_id,c->GetTargetDescription(target)
).c_str()
);
target->Depop(false);
@ -324,10 +322,9 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Spawn2 {} Respawn Modified | Name: {} ({}) Respawn Timer: {} Variance: {}",
"Spawn2 {} Respawn Modified | Name: {} Respawn Timer: {} Variance: {}",
spawn2_id,
target->GetCleanName(),
target->GetID(),
c->GetTargetDescription(target),
respawn_timer,
variance
).c_str()
@ -468,10 +465,9 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Spawn2 {} Moved | Name: {} ({})",
"Spawn2 {} Moved | Name: {}",
spawn2_id,
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
c->Message(
@ -520,10 +516,9 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Spawngroup {} Version Modified | Name: {} ({}) Version: {}",
"Spawngroup {} Version Modified | Name: {} Version: {}",
target->GetSpawnGroupId(),
target->GetCleanName(),
target->GetID(),
c->GetTargetDescription(target),
version
).c_str()
);

View File

@ -17,15 +17,7 @@ void command_aggrozone(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Aggroing zone on {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -51,11 +51,9 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) considers {} ({}) as {} ({}).",
target->GetCleanName(),
target->GetID(),
mob_to_consider->GetCleanName(),
mob_to_consider->GetID(),
"{} considers {} as {} ({}).",
c->GetTargetDescription(target),
c->GetTargetDescription(mob_to_consider),
EQ::constants::GetConsiderLevelName(consider_level),
consider_level
).c_str()
@ -72,9 +70,8 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is now on Faction {}.",
target->GetCleanName(),
target->GetID(),
"{} is now on Faction {}.",
c->GetTargetDescription(target),
(
faction_name.empty() ?
std::to_string(faction_id) :
@ -97,9 +94,8 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) now has a guard spot of {:.2f}, {:.2f}, {:.2f} with a heading of {:.2f}.",
target->GetCleanName(),
target->GetID(),
"{} now has a guard spot of {:.2f}, {:.2f}, {:.2f} with a heading of {:.2f}.",
c->GetTargetDescription(target),
target_position.x,
target_position.y,
target_position.z,
@ -147,9 +143,8 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) now has a roambox from {}, {} to {}, {} with {} and {} and a distance of {}.",
target->GetCleanName(),
target->GetID(),
"{} now has a roambox from {}, {} to {}, {} with {} and {} and a distance of {}.",
c->GetTargetDescription(target),
min_x,
min_y,
max_x,
@ -205,9 +200,8 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) now has a roambox with a max distance of {} and a roam distance variance of {} with {} and {}.",
target->GetCleanName(),
target->GetID(),
"{} now has a roambox with a max distance of {} and a roam distance variance of {} with {} and {}.",
c->GetTargetDescription(target),
max_distance,
roam_distance_variance,
(
@ -246,9 +240,8 @@ void command_ai(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is now using Spell List {}.",
target->GetCleanName(),
target->GetID(),
"{} is now using Spell List {}.",
c->GetTargetDescription(target),
spell_list_id
).c_str()
);

View File

@ -19,10 +19,9 @@ void command_attack(Client *c, const Seperator *sep)
c->Message(
Chat::EchoChat1,
fmt::format(
"{} whispers, 'Attacking {} ({}).'",
"{} whispers, 'Attacking {}.'",
c->GetTarget()->GetCleanName(),
entity->GetCleanName(),
entity->GetID()
c->GetTargetDescription(entity)
).c_str()
);
} else {

View File

@ -7,39 +7,27 @@ void command_bind(Client *c, const Seperator *sep)
target = c->GetTarget()->CastToClient();
}
target->SetBindPoint();
bool in_persistent_instance = (
zone->GetInstanceID() != 0 &&
zone->IsInstancePersistent()
);
auto target_string = (
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
bool bind_allowed = (
!zone->GetInstanceID() ||
(
zone->GetInstanceID() != 0 &&
zone->IsInstancePersistent()
)
);
if (!bind_allowed) {
c->Message(Chat::White, "Yu cannot bind here.");
return;
}
target->SetBindPoint();
c->Message(
Chat::White,
fmt::format(
"Set Bind Point for {} | Zone: {} ({}) ID: {} {}",
target_string,
zone->GetLongName(),
zone->GetShortName(),
zone->GetZoneID(),
(
in_persistent_instance ?
fmt::format(
" Instance ID: {}",
zone->GetInstanceID()
) :
""
)
"Set Bind Point for {} | Zone: {}",
c->GetTargetDescription(target),
zone->GetZoneDescription()
).c_str()
);
@ -47,7 +35,7 @@ void command_bind(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set Bind Point for {} | XYZ: {:.2f}, {:.2f}, {:.2f}",
target_string,
c->GetTargetDescription(target),
target->GetX(),
target->GetY(),
target->GetZ()

View File

@ -54,15 +54,7 @@ void command_castspell(Client *c, const Seperator *sep)
"Cast {} ({}) on {}{}.",
GetSpellName(spell_id),
spell_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
instant_cast ? " instantly" : ""
).c_str()
);

View File

@ -4,16 +4,19 @@ void command_checklos(Client *c, const Seperator *sep)
{
if (!c->GetTarget()) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
bool has_los = c->CheckLosFN(c->GetTarget());
auto target = c->GetTarget();
bool has_los = c->CheckLosFN(target);
c->Message(
Chat::White,
fmt::format(
"You {}have line of sight to {} ({}).",
"You {}have line of sight to {}.",
has_los ? "" : "do not ",
c->GetTarget()->GetCleanName(),
c->GetTarget()->GetID()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -110,10 +110,9 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Deleting {} corpse {} ({}).",
"Deleting {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
target->CastToCorpse()->Delete();
@ -155,11 +154,10 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Setting the owner to {} ({}) for the player corpse {} ({}).",
"Setting the owner to {} ({}) for the player corpse {}.",
database.GetCharNameByID(character_id),
target->CastToCorpse()->SetCharID(character_id),
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else {
@ -181,10 +179,9 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Reset looter for {} corpse {} ({}).",
"Reset looter for {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else if (is_remove_cash) {
@ -206,10 +203,9 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Removed cash from {} corpse {} ({}).",
"Removed cash from {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
}
@ -240,10 +236,9 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Locking {} corpse {} ({}).",
"Locking {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else if (is_unlock) {
@ -261,10 +256,9 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Unlocking {} corpse {} ({}).",
"Unlocking {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
target->GetName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else if (is_depop) {
@ -286,9 +280,8 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Depopping player corpse {} ({}).",
target->GetName(),
target->GetID()
"Depopping player corpse {}.",
c->GetTargetDescription(target)
).c_str()
);
target->CastToCorpse()->DepopPlayerCorpse();
@ -318,9 +311,8 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Depopping all player corpses for {} ({}).",
target->GetName(),
target->GetID()
"Depopping all player corpses for {}.",
c->GetTargetDescription(target)
).c_str()
);
target->CastToClient()->DepopAllCorpses();

View File

@ -42,15 +42,7 @@ void command_countitem(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} {} {} {}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
(
item_count ?

View File

@ -8,9 +8,8 @@ void command_distance(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is {:.2f} units from you.",
target->GetCleanName(),
target->GetID(),
"{} is {:.2f} units from you.",
c->GetTargetDescription(target),
Distance(
c->GetPosition(),
target->GetPosition()

View File

@ -20,15 +20,7 @@ void command_endurance(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to full Endurance ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
endurance
).c_str()
);

View File

@ -154,16 +154,13 @@ void command_faction(Client *c, const Seperator *sep)
}
else if (!strcasecmp(sep->arg[1], "view")) {
if (c->GetTarget() && c->GetTarget()->IsNPC()) {
Mob *target = c->GetTarget();
uint32 npc_id = target->GetNPCTypeID();
uint32 npc_faction_id = target->CastToNPC()->GetPrimaryFaction();
std::string npc_name = target->GetCleanName();
auto target = c->GetTarget();
auto npc_faction_id = target->CastToNPC()->GetPrimaryFaction();
c->Message(
Chat::White,
fmt::format(
"{} ({}) has a Primary Faction of {} ({}).",
npc_name,
npc_id,
"{} has a Primary Faction of {} ({}).",
c->GetTargetDescription(target),
content_db.GetFactionName(npc_faction_id),
npc_faction_id
).c_str()

View File

@ -210,15 +210,7 @@ void command_feature(Client *c, const Seperator *sep)
fmt::format(
"{} set for {} to {}.",
feature_changed,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
is_size ?
fmt::format(

View File

@ -99,13 +99,7 @@ void command_flagedit(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} now {} the flag for {} ({}).",
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
zone_long_name,
zone_id
@ -229,13 +223,7 @@ void command_flagedit(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} no longer {} the flag for {} ({}).",
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
zone_long_name,
zone_id

View File

@ -28,15 +28,7 @@ void command_flymode(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Fly Mode for {} is now {} ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
EQ::constants::GetFlyModeName(flymode_id),
flymode_id
).c_str()

View File

@ -2,41 +2,42 @@
void command_fov(Client *c, const Seperator *sep)
{
if (c->GetTarget()) {
auto target = c->GetTarget();
std::string behind_message = (
c->BehindMob(
target,
c->GetX(),
c->GetY()
) ?
"behind" :
"not behind"
);
std::string gender_message = (
target->GetGender() == MALE ?
"he" :
(
target->GetGender() == FEMALE ?
"she" :
"it"
)
);
c->Message(
Chat::White,
fmt::format(
"You are {} {} ({}), {} has a heading of {}.",
behind_message,
target->GetCleanName(),
target->GetID(),
gender_message,
target->GetHeading()
).c_str()
);
}
else {
if (!c->GetTarget()) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
auto target = c->GetTarget();
std::string behind_message = (
c->BehindMob(
target,
c->GetX(),
c->GetY()
) ?
"behind" :
"not behind"
);
std::string gender_message = (
target->GetGender() == MALE ?
"he" :
(
target->GetGender() == FEMALE ?
"she" :
"it"
)
);
c->Message(
Chat::White,
fmt::format(
"You are {} {}, {} has a heading of {}.",
behind_message,
c->GetTargetDescription(target),
gender_message,
target->GetHeading()
).c_str()
);
}

View File

@ -2,15 +2,25 @@
void command_freeze(Client *c, const Seperator *sep)
{
if (c->GetTarget()) {
auto target = c->GetTarget();
if (target != c) {
target->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
} else {
c->Message(Chat::White, "You cannot freeze yourself.");
}
} else {
if (!c->GetTarget()) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
auto target = c->GetTarget();
if (c == target) {
c->Message(Chat::White, "You cannot freeze yourself.");
return;
}
target->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
c->Message(
Chat::White,
fmt::format(
"You have frozen {}.",
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -30,15 +30,7 @@ void command_gender(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Gender changed for {} to {} ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
GetGenderName(gender_id),
gender_id
).c_str()

View File

@ -12,16 +12,9 @@ void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} {} buried corpse{}.",
(
c == target ?
"You have" :
fmt::format(
"{} ({}) has",
target->GetCleanName(),
target->GetID()
)
),
"{} {} {} buried corpse{}.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
(
corpse_count ?
std::to_string(corpse_count) :

View File

@ -13,16 +13,9 @@ void command_ginfo(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} not in a group.",
(
c == target ?
"You are" :
fmt::format(
"{} ({}) is",
target->GetCleanName(),
target->GetID()
)
)
"{} {} not in a group.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "are" : "is"
).c_str()
);
return;
@ -30,13 +23,7 @@ void command_ginfo(Client *c, const Seperator *sep)
std::string popup_title = fmt::format(
"Group Info for {}",
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target, TargetDescriptionType::UCSelf)
);
std::string popup_text = "<table>";
popup_text += fmt::format(

View File

@ -36,15 +36,7 @@ void command_givemoney(Client *c, const Seperator *sep)
fmt::format(
"Added {} to {}.",
ConvertMoneyToString(platinum, gold, silver, copper),
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -19,9 +19,8 @@ void command_gm(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is {} flagged as a GM.",
target->GetCleanName(),
target->GetID(),
"{} is {} flagged as a GM.",
c->GetTargetDescription(target),
gm_flag ? "now" : "no longer"
).c_str()
);

View File

@ -24,15 +24,7 @@ void command_gmspeed(Client *c, const Seperator *sep)
fmt::format(
"Turning GM Speed {} for {}.",
gm_speed_flag ? "on" : "off",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
@ -40,15 +32,7 @@ void command_gmspeed(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Note: {} must zone for it to take effect.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target, TargetDescriptionType::UCYou)
).c_str()
);
}

View File

@ -519,16 +519,18 @@ void command_guild(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} is not in a guild.",
client->GetCleanName()
"{} {} not in a guild.",
c->GetTargetDescription(client, TargetDescriptionType::UCYou),
c == target ? "are" : "is"
).c_str()
);
} else if (guild_mgr.IsGuildLeader(client->GuildID(), client->CharacterID())) {
c->Message(
Chat::White,
fmt::format(
"{} is the leader of {}.",
client->GetName(),
"{} {} the leader of {}.",
c->GetTargetDescription(client, TargetDescriptionType::UCYou),
c == target ? "are" : "is",
guild_mgr.GetGuildNameByID(client->GuildID())
).c_str()
);
@ -536,8 +538,9 @@ void command_guild(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} is a(n) {} of {}.",
client->GetName(),
"{} {} a(n) {} of {}.",
c->GetTargetDescription(client, TargetDescriptionType::UCYou),
c == target ? "are" : "is",
guild_mgr.GetRankName(client->GuildID(), client->GuildRank()),
guild_mgr.GetGuildNameByID(client->GuildID())
).c_str()

View File

@ -13,15 +13,7 @@ void command_heal(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to full Health ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
target->GetMaxHP()
).c_str()
);

View File

@ -100,29 +100,19 @@ void command_instance(Client *c, const Seperator *sep)
uint32 zone_id = database.ZoneIDFromInstanceID(instance_id);
uint32 version = database.VersionFromInstanceID(instance_id);
uint32 current_id = database.GetInstanceID(zone_id, character_id, version);
if (!current_id) {
std::string target_string = (
c == target ?
"yourself" :
fmt::format(
"{} ({})",
character_name,
character_id
)
);
if (!current_id) {
c->Message(
Chat::White,
(
database.AddClientToInstance(instance_id, character_id) ?
fmt::format(
"Added {} to Instance ID {}.",
target_string,
c->GetTargetDescription(target),
instance_id
) :
fmt::format(
"Failed to add {} to Instance ID {}.",
target_string,
c->GetTargetDescription(target),
instance_id
)
).c_str()
@ -297,28 +287,18 @@ void command_instance(Client *c, const Seperator *sep)
return;
}
std::string target_string = (
c->CharacterID() == character_id ?
"yourself" :
fmt::format(
"{} ({})",
character_name,
character_id
)
);
c->Message(
Chat::White,
(
database.RemoveClientFromInstance(instance_id, character_id) ?
fmt::format(
"Removed {} from Instance ID {}.",
target_string,
c->GetTargetDescription(target),
instance_id
) :
fmt::format(
"Failed to remove {} from Instance ID {}.",
target_string,
c->GetTargetDescription(target),
instance_id
)
).c_str()

View File

@ -19,7 +19,7 @@ void command_invul(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} {} now {}.",
c == target ? "You" : target->GetCleanName(),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "are" : "is",
invul_flag ? "invulnerable" : "vulnerable"
).c_str()

View File

@ -20,15 +20,7 @@ void command_lastname(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} now {} a last name of '{}'.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
last_name
).c_str()

View File

@ -13,15 +13,7 @@ void command_loc(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Location for {} | XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f}",
(
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
target_position.x,
target_position.y,
target_position.z,

View File

@ -17,15 +17,7 @@ void command_mana(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to full Mana ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
mana
).c_str()
);

View File

@ -33,16 +33,9 @@ void command_memspell(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} not have a place to memorize {} ({}).",
(
c == target ?
"You do" :
fmt::format(
"{} ({}) does",
target->GetCleanName(),
target->GetID()
)
),
"{} {} not have a place to memorize {} ({}).",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "do" : "does",
GetSpellName(spell_id),
spell_id
).c_str()
@ -68,12 +61,11 @@ void command_memspell(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) memorized to spell gem {} for {} ({}).",
"{} ({}) memorized to spell gem {} for {}.",
GetSpellName(spell_id),
spell_id,
spell_gem,
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -2,93 +2,84 @@
void command_npccast(Client *c, const Seperator *sep)
{
if (c->GetTarget() && c->GetTarget()->IsNPC()) {
NPC *target = c->GetTarget()->CastToNPC();
if (!sep->IsNumber(1) && sep->arg[1] && sep->IsNumber(2)) {
const char *entity_name = sep->arg[1] ? sep->arg[1] : 0;
auto spell_id = sep->arg[2] ? std::stoul(sep->arg[2]) : 0;
Mob *spell_target = entity_list.GetMob(entity_name);
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) casting {} ({}) on {} ({}).",
target->GetCleanName(),
target->GetID(),
GetSpellName(static_cast<uint16>(spell_id)),
spell_id,
spell_target->GetCleanName(),
spell_target->GetID()
).c_str()
);
target->CastSpell(spell_id, spell_target->GetID());
}
else {
if (!spell_target) {
c->Message(
Chat::White,
fmt::format(
"Entity {} was not found",
entity_name
).c_str()
);
}
else if (!spell_id || !IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} was not found",
spell_id
).c_str()
);
}
}
}
else if (sep->IsNumber(1) && sep->IsNumber(2)) {
uint16 entity_id = sep->arg[1] ? std::stoul(sep->arg[1]) : 0;
auto spell_id = sep->arg[2] ? std::stoul(sep->arg[2]) : 0;
Mob *spell_target = entity_list.GetMob(entity_id);
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) casting {} ({}) on {} ({}).",
target->GetCleanName(),
target->GetID(),
GetSpellName(static_cast<uint16>(spell_id)),
spell_id,
spell_target->GetCleanName(),
spell_target->GetID()
).c_str()
);
target->CastSpell(spell_id, spell_target->GetID());
}
else {
if (!spell_target) {
c->Message(
Chat::White,
fmt::format(
"Entity ID {} was not found",
entity_id
).c_str()
);
}
else if (!spell_id || !IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} was not found",
spell_id
).c_str()
);
}
}
}
}
else {
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto target = c->GetTarget()->CastToNPC();
if (!sep->IsNumber(1) && sep->arg[1] && sep->IsNumber(2)) {
std::string entity_name = sep->arg[1] ? sep->arg[1] : 0;
auto spell_id = sep->arg[2] ? std::stoul(sep->arg[2]) : 0;
auto spell_target = entity_list.GetMob(entity_name.c_str());
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
c->Message(
Chat::White,
fmt::format(
"{} casting {} ({}) on {}.",
c->GetTargetDescription(target),
GetSpellName(static_cast<uint16>(spell_id)),
spell_id,
c->GetTargetDescription(spell_target)
).c_str()
);
target->CastSpell(spell_id, spell_target->GetID());
} else {
if (!spell_target) {
c->Message(
Chat::White,
fmt::format(
"Entity {} was not found",
entity_name
).c_str()
);
} else if (!spell_id || !IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} was not found",
spell_id
).c_str()
);
}
}
} else if (sep->IsNumber(1) && sep->IsNumber(2)) {
uint16 entity_id = static_cast<uint16>(std::stoul(sep->arg[1]));
auto spell_id = std::stoul(sep->arg[2]);
auto spell_target = entity_list.GetMob(entity_id);
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
c->Message(
Chat::White,
fmt::format(
"{} casting {} ({}) on {}.",
c->GetTargetDescription(target),
GetSpellName(static_cast<uint16>(spell_id)),
spell_id,
c->GetTargetDescription(spell_target)
).c_str()
);
target->CastSpell(spell_id, spell_target->GetID());
} else {
if (!spell_target) {
c->Message(
Chat::White,
fmt::format(
"Entity ID {} was not found",
entity_id
).c_str()
);
} else if (!spell_id || !IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} was not found",
spell_id
).c_str()
);
}
}
}
}

View File

@ -65,7 +65,9 @@ void command_npcloot(Client *c, const Seperator *sep)
return;
}
c->GetTarget()->CastToNPC()->AddItem(
auto target = c->GetTarget();
target->CastToNPC()->AddItem(
item_id,
item_charges,
equip_item,
@ -97,11 +99,10 @@ void command_npcloot(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Added {} ({}) to {} ({}).",
"Added {} ({}) to {}.",
item_link,
item_id,
c->GetTarget()->GetCleanName(),
c->GetTarget()->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else if (is_money) {
@ -143,9 +144,8 @@ void command_npcloot(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) now has {}.",
target->GetCleanName(),
target->GetID(),
"{} now has {}.",
c->GetTargetDescription(target),
money_string
).c_str()
);
@ -172,12 +172,11 @@ void command_npcloot(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Removed {} {} ({}) from {} ({}).",
"Removed {} {} ({}) from {}.",
item_count,
database.CreateItemLink(item_id),
item_id,
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
@ -188,20 +187,18 @@ void command_npcloot(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) has no items to remove.",
target->GetCleanName(),
target->GetID()
"{} has no items to remove.",
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(
Chat::White,
fmt::format(
"{} Item{} removed from {} ({}).",
"{} Item{} removed from {}.",
total_item_count,
total_item_count != 1 ? "s" : "",
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
}
@ -214,21 +211,19 @@ void command_npcloot(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Removed {} {} ({}) from {} ({}).",
"Removed {} {} ({}) from {}.",
item_count,
database.CreateItemLink(item_id),
item_id,
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(
Chat::White,
fmt::format(
"{} ({}) does not have any {} ({}).",
target->GetCleanName(),
target->GetID(),
"{} does not have any {} ({}).",
c->GetTargetDescription(target),
database.CreateItemLink(item_id),
item_id
).c_str()

View File

@ -2,26 +2,31 @@
void command_npcspawn(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
int arguments = sep->argnum;
if (!arguments) {
c->Message(Chat::White, "Command Syntax: #npcspawn [Add|Create|Delete|Remove|Update]");
return;
}
if (!(c->GetTarget() && c->GetTarget()->IsNPC())) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
NPC *target = c->GetTarget()->CastToNPC();
std::string spawn_type = str_tolower(sep->arg[1]);
uint32 extra = 0;
bool is_add = spawn_type.find("add") != std::string::npos;
bool is_create = spawn_type.find("create") != std::string::npos;
bool is_delete = spawn_type.find("delete") != std::string::npos;
bool is_remove = spawn_type.find("remove") != std::string::npos;
bool is_update = spawn_type.find("update") != std::string::npos;
if (!is_add && !is_create && !is_delete && !is_remove && !is_update) {
auto target = c->GetTarget()->CastToNPC();
uint32 extra = 0;
bool is_add = !strcasecmp(sep->arg[1], "add");
bool is_create = !strcasecmp(sep->arg[1], "create");
bool is_delete = !strcasecmp(sep->arg[1], "delete");
bool is_remove = !strcasecmp(sep->arg[1], "remove");
bool is_update = !strcasecmp(sep->arg[1], "update");
if (
!is_add &&
!is_create &&
!is_delete &&
!is_remove &&
!is_update
) {
c->Message(Chat::White, "Command Syntax: #npcspawn [Add|Create|Delete|Remove|Update]");
return;
}
@ -29,16 +34,17 @@ void command_npcspawn(Client *c, const Seperator *sep)
if (is_add || is_create) {
extra = (
sep->IsNumber(2) ?
(
is_add ?
std::stoi(sep->arg[2]) :
1
) : (
(
is_add ?
1200 :
0
std::stoi(sep->arg[2]) :
1
) : (
is_add ?
1200 :
0
)
); // Default to 1200 for Add, 0 for Create if not set
content_db.NPCSpawnDB(
is_add ? NPCSpawnTypes::AddNewSpawngroup : NPCSpawnTypes::CreateNewSpawn,
zone->GetShortName(),
@ -47,35 +53,37 @@ void command_npcspawn(Client *c, const Seperator *sep)
target,
extra
);
c->Message(
Chat::White,
fmt::format(
"Spawn {} | Name: {} ({})",
"Spawn {} | Name: {}",
is_add ? "Added" : "Created",
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
}
else if (is_delete || is_remove || is_update) {
uint8 spawn_update_type = (
uint8 spawn_update_type = (
is_delete ?
NPCSpawnTypes::DeleteSpawn :
(
is_remove ?
NPCSpawnTypes::RemoveSpawn :
NPCSpawnTypes::UpdateAppearance
)
NPCSpawnTypes::DeleteSpawn :
(
is_remove ?
NPCSpawnTypes::RemoveSpawn :
NPCSpawnTypes::UpdateAppearance
)
);
std::string spawn_message = (
std::string spawn_message = (
is_delete ?
"Deleted" :
(
is_remove ?
"Removed" :
"Updated"
)
"Deleted" :
(
is_remove ?
"Removed" :
"Updated"
)
);
content_db.NPCSpawnDB(
spawn_update_type,
zone->GetShortName(),
@ -83,13 +91,13 @@ void command_npcspawn(Client *c, const Seperator *sep)
c,
target
);
c->Message(
Chat::White,
fmt::format(
"Spawn {} | Name: {} ({})",
"Spawn {} | Name: {}",
spawn_message,
target->GetCleanName(),
target->GetID()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -32,15 +32,7 @@ void command_nukebuffs(Client *c, const Seperator *sep)
fmt::format(
"Faded all{} buffs for {}.",
buff_type,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -23,15 +23,7 @@ void command_nukeitem(Client *c, const Seperator *sep)
deleted_count,
database.CreateItemLink(item_id),
item_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
} else {
@ -41,15 +33,7 @@ void command_nukeitem(Client *c, const Seperator *sep)
"Could not find any {} ({}) to delete from {}.",
database.CreateItemLink(item_id),
item_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -95,9 +95,8 @@ void command_peqzone(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"You are already in {} ({}).",
zone->GetLongName(),
zone->GetShortName()
"You are already in {}.",
zone->GetZoneDescription()
).c_str()
);
return;

View File

@ -17,7 +17,7 @@ void command_permaclass(Client *c, const Seperator *sep)
LogInfo("Class changed by {} for {} to {} ({})",
c->GetCleanName(),
target->GetCleanName(),
c->GetTargetDescription(target),
GetClassIDName(class_id),
class_id
);
@ -31,7 +31,7 @@ void command_permaclass(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Class changed for {} to {} ({}).",
target->GetCleanName(),
c->GetTargetDescription(target),
GetClassIDName(class_id),
class_id
).c_str()

View File

@ -23,7 +23,7 @@ void command_permagender(Client *c, const Seperator *sep)
LogInfo("Gender changed by {} for {} to {} ({})",
c->GetCleanName(),
target->GetCleanName(),
c->GetTargetDescription(target),
GetGenderName(gender_id),
gender_id
);
@ -36,15 +36,7 @@ void command_permagender(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Gender changed for {} to {} ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
GetGenderName(gender_id),
gender_id
).c_str()

View File

@ -22,7 +22,7 @@ void command_permarace(Client *c, const Seperator *sep)
LogInfo("Race changed by {} for {} to {} ({})",
c->GetCleanName(),
target->GetCleanName(),
c->GetTargetDescription(target),
GetRaceIDName(race_id),
race_id
);
@ -36,15 +36,7 @@ void command_permarace(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Race changed for {} to {} ({}).",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
GetRaceIDName(race_id),
race_id
).c_str()

View File

@ -27,9 +27,8 @@ void command_push(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Pushing {} ({}) with a push back of {:.2f} and a push up of {:.2f}.",
target->GetCleanName(),
target->GetID(),
"Pushing {} with a push back of {:.2f} and a push up of {:.2f}.",
c->GetTargetDescription(target),
back,
up
).c_str()

View File

@ -19,8 +19,9 @@ void command_pvp(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} now follows the ways of {}.",
target->GetCleanName(),
"{} now follow{} the ways of {}.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c != target ? "s" : "",
pvp_state ? "Discord" : "Order"
).c_str()
);

View File

@ -43,9 +43,8 @@ void command_qglobal(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Failed to disable quest global flag for {} ({}).",
target->GetCleanName(),
target->GetID()
"Failed to disable quest global flag for {}.",
c->GetTargetDescription(target)
).c_str()
);
return;
@ -60,9 +59,8 @@ void command_qglobal(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) will no longer be able to view quest globals, {} them to apply this change.",
target->GetCleanName(),
target->GetID(),
"{} will no longer be able to view quest globals, {} them to apply this change.",
c->GetTargetDescription(target),
repop_link
).c_str()
);
@ -78,9 +76,8 @@ void command_qglobal(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Failed to enable quest global flag for {} ({}).",
target->GetCleanName(),
target->GetID()
"Failed to enable quest global flag for {}.",
c->GetTargetDescription(target)
).c_str()
);
return;
@ -95,9 +92,8 @@ void command_qglobal(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) will now be able to view quest globals, {} them to apply this change.",
target->GetCleanName(),
target->GetID(),
"{} will now be able to view quest globals, {} them to apply this change.",
c->GetTargetDescription(target),
repop_link
).c_str()
);
@ -118,9 +114,8 @@ void command_qglobal(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) {} view quest globals.",
target->GetCleanName(),
target->GetID(),
"{} {} view quest globals.",
c->GetTargetDescription(target),
npc_type->qglobal ? "can" : "cannot"
).c_str()
);

View File

@ -13,18 +13,20 @@ void command_randomfeatures(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) has had their features randomized.",
target->GetCleanName(),
target->GetID()
"{} {} had {} features randomized.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "had",
c == target ? "your" : "their"
).c_str()
);
} else {
c->Message(
Chat::White,
fmt::format(
"{} ({}) is not a player race, their race is {} ({}).",
target->GetCleanName(),
target->GetID(),
"{} {} not a player race, {} race is {} ({}).",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "are" : "is",
c == target ? "your" : "their",
GetRaceIDName(target->GetRace()),
target->GetRace()
).c_str()

View File

@ -14,16 +14,9 @@ void command_refreshgroup(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} not in a group.",
(
c == target ?
"You are" :
fmt::format(
"{} ({}} is",
target->GetCleanName(),
target->GetID()
)
)
"{} {} not in a group.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "are" : "is"
).c_str()
);
return;
@ -35,15 +28,7 @@ void command_refreshgroup(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Group has been refreshed for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);

View File

@ -2,7 +2,9 @@
void command_reloadzps(Client *c, const Seperator *sep)
{
content_db.LoadStaticZonePoints(&zone->zone_point_list, zone->GetShortName(), zone->GetInstanceVersion());
c->Message(Chat::White, "Reloading server zone_points.");
c->Message(Chat::White, "Attempting to reloading server zone points globally.");
auto pack = new ServerPacket(ServerOP_ReloadZonePoints, 0);
worldserver.SendPacket(pack);
safe_delete(pack);
}

View File

@ -12,16 +12,6 @@ void command_removeitem(Client *c, const Seperator *sep)
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
auto target_string = (
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
);
auto item_id = std::stoi(sep->arg[1]);
if (!database.GetItem(item_id)) {
@ -49,7 +39,7 @@ void command_removeitem(Client *c, const Seperator *sep)
amount,
item_link,
item_id,
target_string
c->GetTargetDescription(target)
).c_str()
);
} else {
@ -62,7 +52,7 @@ void command_removeitem(Client *c, const Seperator *sep)
item_count,
item_link,
item_id,
target_string,
c->GetTargetDescription(target),
c == target ? "you" : "they",
amount,
item_link,
@ -77,7 +67,7 @@ void command_removeitem(Client *c, const Seperator *sep)
"Could not find any {} ({}) to delete from {}.",
database.CreateItemLink(item_id),
item_id,
target_string
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -14,15 +14,7 @@ void command_resetaa(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Successfully reset all Alternate Advancements for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -21,15 +21,7 @@ void command_resetaa_timer(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Reset all Alternate Advancement timers for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
target->ResetAlternateAdvancementTimers();
@ -43,15 +35,7 @@ void command_resetaa_timer(Client *c, const Seperator *sep)
fmt::format(
"Reset Alternate Advancement timer {} for {}.",
timer_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
target->ResetAlternateAdvancementTimer(timer_id);

View File

@ -21,15 +21,7 @@ void command_resetdisc_timer(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Reset all Discipline timers for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
target->ResetAllDisciplineTimers();
@ -43,15 +35,7 @@ void command_resetdisc_timer(Client *c, const Seperator *sep)
fmt::format(
"Reset Discipline timer {} for {}.",
timer_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
target->ResetDisciplineTimer(timer_id);

View File

@ -49,9 +49,8 @@ void command_revoke(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Found {} ({}) in this zone.",
revoke_client->GetName(),
revoke_client->GetID()
"Found {} in this zone.",
c->GetTargetDescription(revoke_client)
).c_str()
);
revoke_client->SetRevoked(revoked);

View File

@ -77,9 +77,8 @@ void command_roambox(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Failed to set roambox for {} ({}).",
target->GetCleanName(),
target->GetID()
"Failed to set roambox for {}.",
c->GetTargetDescription(target)
).c_str()
);
return;
@ -88,10 +87,9 @@ void command_roambox(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Roambox set to box size of {} for {} ({}) on spawn group ID {} with a delay of {} ({}).",
"Roambox set to box size of {} for {} on spawn group ID {} with a delay of {} ({}).",
box_size,
target->GetCleanName(),
target->GetID(),
c->GetTargetDescription(target),
spawn_group_id,
ConvertMillisecondsToTime(delay),
delay

View File

@ -15,24 +15,25 @@ void command_save(Client *c, const Seperator *sep)
return;
}
if (c->GetTarget()->IsClient()) {
auto target = c->GetTarget();
if (target->IsClient()) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) {} saved.",
c->GetTarget()->GetCleanName(),
c->GetTarget()->GetID(),
c->GetTarget()->CastToClient()->Save(2) ? "successfully" : "failed to be"
"{} {} been {} saved.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
target->CastToClient()->Save(2) ? "successfully" : "failed to be"
).c_str()
);
} else if (c->GetTarget()->IsPlayerCorpse()) {
} else if (target->IsPlayerCorpse()) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) {} saved.",
c->GetTarget()->GetCleanName(),
c->GetTarget()->CastToCorpse()->GetCorpseDBID(),
c->GetTarget()->CastToMob()->Save() ? "successfully" : "failed to be"
"{} has been {} saved.",
c->GetTargetDescription(target),
target->CastToMob()->Save() ? "successfully" : "failed to be"
).c_str()
);
}

View File

@ -8,7 +8,7 @@ void command_scribespells(Client *c, const Seperator *sep)
}
if (sep->argnum < 1 || !sep->IsNumber(1)) {
c->Message(Chat::White, "FORMAT: #scribespells <max level> <min level>");
c->Message(Chat::White, "Usage: #scribespells [Max Level] [Min Level]");
return;
}
@ -31,12 +31,12 @@ void command_scribespells(Client *c, const Seperator *sep)
}
if (max_level < 1 || min_level < 1) {
c->Message(Chat::White, "ERROR: Level must be greater than or equal to 1.");
c->Message(Chat::White, "Level must be greater than or equal to 1.");
return;
}
if (min_level > max_level) {
c->Message(Chat::White, "ERROR: Minimum Level must be less than or equal to Maximum Level.");
c->Message(Chat::White, "Minimum Level must be less than or equal to Maximum Level.");
return;
}
@ -59,7 +59,7 @@ void command_scribespells(Client *c, const Seperator *sep)
fmt::format(
"{} scribed for {}.",
spell_message,
target->GetCleanName()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -18,9 +18,8 @@ void command_sensetrap(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is too far away.",
target->GetCleanName(),
target->GetID()
"{} is too far away.",
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -68,15 +68,7 @@ void command_set_adventure_points(Client *c, const Seperator *sep)
EQ::constants::GetLDoNThemeName(theme_id)
)
),
(
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);

View File

@ -48,15 +48,7 @@ void command_setaapts(Client *c, const Seperator *sep)
std::string aa_message = fmt::format(
"{} now {} {} {}AA Point{}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
aa_points,
group_raid_string,

View File

@ -54,15 +54,7 @@ void command_setaaxp(Client *c, const Seperator *sep)
std::string aa_exp_message = fmt::format(
"{} now {} {} {}AA Experience.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
aa_experience,
group_raid_string

View File

@ -37,15 +37,7 @@ void command_setaltcurrency(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} now {} {} {}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
(
amount ?

View File

@ -43,15 +43,7 @@ void command_setanim(Client *c, const Seperator *sep)
"Set animation to {} ({}) for {}.",
animation_name,
animation_id,
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
).c_str()
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -42,15 +42,7 @@ void command_setcrystals(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"{} now {} {} {}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
crystal_amount,
crystal_link

View File

@ -35,15 +35,7 @@ void command_setendurance(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to {} Endurance{}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
set_to_max ?
"full" :

View File

@ -27,15 +27,7 @@ void command_sethp(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to {} Health{}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
set_to_max ?
"full" :

View File

@ -37,7 +37,7 @@ void command_setlanguage(Client *c, const Seperator *sep)
LogInfo(
"Set language request from [{}], Target: [{}] Language ID: [{}] Language Value: [{}]",
c->GetCleanName(),
target->GetCleanName(),
c->GetTargetDescription(target),
language_id,
language_value
);
@ -52,7 +52,7 @@ void command_setlanguage(Client *c, const Seperator *sep)
EQ::constants::GetLanguageName(language_id),
language_id,
language_value,
target->GetCleanName()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -35,15 +35,7 @@ void command_setmana(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Set {} to {} Mana{}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
set_to_max ?
"full" :

View File

@ -19,15 +19,7 @@ void command_setpvppoints(Client *c, const Seperator *sep)
target->SendPVPStats();
std::string pvp_message = fmt::format(
"{} now {} {} PVP Point{}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
pvp_points,
pvp_points != 1 ? "s" : ""

View File

@ -23,7 +23,7 @@ void command_setskill(Client *c, const Seperator *sep)
LogInfo(
"Set skill request from [{}], Target: [{}] Skill ID: [{}] Skill Value: [{}]",
c->GetCleanName(),
target->GetCleanName(),
c->GetTargetDescription(target),
skill_id,
skill_value
);
@ -45,7 +45,7 @@ void command_setskill(Client *c, const Seperator *sep)
EQ::skills::GetSkillName((EQ::skills::SkillType) skill_id),
skill_id,
skill_value,
target->GetCleanName()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -21,7 +21,7 @@ void command_setskillall(Client *c, const Seperator *sep)
LogInfo(
"Set ALL skill request from [{}], target:[{}]",
c->GetCleanName(),
target->GetCleanName()
c->GetTargetDescription(target)
);
auto skill_level = static_cast<uint16>(std::stoul(sep->arg[1]));
@ -31,13 +31,7 @@ void command_setskillall(Client *c, const Seperator *sep)
fmt::format(
"Setting all skills to {} for {}.",
skill_level,
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target)
).c_str()
);

View File

@ -35,15 +35,7 @@ void command_setstartzone(Client *c, const Seperator *sep)
fmt::format(
"Start Zone {} for {} |{}",
is_reset ? "Reset" : "Changed",
(
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
(
zone_id ?
fmt::format(

View File

@ -46,13 +46,7 @@ void command_showskills(Client *c, const Seperator *sep)
std::string popup_title = fmt::format(
"Skills for {} [{} to {}]",
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
),
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
start_skill_id,
max_skill_id
);
@ -71,13 +65,7 @@ void command_showskills(Client *c, const Seperator *sep)
start_skill_id,
EQ::skills::GetSkillName((EQ::skills::SkillType) max_skill_id),
max_skill_id,
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target)
).c_str()
);

View File

@ -30,28 +30,12 @@ void command_stun(Client *c, const Seperator *sep)
duration ?
fmt::format(
"You stunned {} for {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
ConvertMillisecondsToTime(duration)
) :
fmt::format(
"You unstunned {}.",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
c->GetTargetDescription(target)
)
);
c->Message(

View File

@ -67,9 +67,8 @@ void command_summon(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Summoning {} ({}) to {:.2f}, {:.2f}, {:.2f} in {} ({}).",
target->GetCleanName(),
target->GetID(),
"Summoning {} to {:.2f}, {:.2f}, {:.2f} in {} ({}).",
c->GetTargetDescription(target),
c->GetX(),
c->GetY(),
c->GetZ(),

View File

@ -19,16 +19,9 @@ void command_summonburiedplayercorpse(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} not have any buried corpses.",
(
c == target ?
"You do" :
fmt::format(
"{} ({}) does",
target->GetCleanName(),
target->GetID()
)
)
"{} {} not have any buried corpses.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "do" : "does"
).c_str()
);
}

View File

@ -80,9 +80,9 @@ void command_task(Client *c, const Seperator *sep)
return;
}
Client *client_target = c;
Client *target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
client_target = c->GetTarget()->CastToClient();
target = c->GetTarget()->CastToClient();
}
bool is_assign = !strcasecmp(sep->arg[1], "assign");
@ -177,21 +177,13 @@ void command_task(Client *c, const Seperator *sep)
if (is_assign) {
auto task_id = std::stoul(sep->arg[2]);
if (task_id && task_id < MAXTASKS) {
client_target->AssignTask(task_id, 0, false);
target->AssignTask(task_id, 0, false);
c->Message(
Chat::Yellow,
fmt::format(
"Assigned task ID {} to {}.",
task_id,
(
client_target == c ?
"yourself" :
fmt::format(
"{} ({})",
client_target->GetCleanName(),
client_target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
}
@ -201,23 +193,15 @@ void command_task(Client *c, const Seperator *sep)
Chat::Yellow,
fmt::format(
"Task timers have been purged for {}.",
(
client_target == c ?
"yourself" :
fmt::format(
"{} ({})",
client_target->GetCleanName(),
client_target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
if (client_target != c) {
client_target->Message(Chat::Yellow, "Your task timers have been purged by a GM.");
if (c != target) {
target->Message(Chat::Yellow, "Your task timers have been purged by a GM.");
}
client_target->PurgeTaskTimers();
target->PurgeTaskTimers();
return;
} else if (is_reload) {
if (arguments >= 2) {
@ -282,62 +266,45 @@ void command_task(Client *c, const Seperator *sep)
return;
} else if (is_show) {
c->ShowClientTasks(client_target);
target->ShowClientTasks(c);
return;
} else if (is_uncomplete) {
if (sep->IsNumber(2)) {
auto task_id = std::stoul(sep->arg[2]);
if (task_id && task_id < MAXTASKS) {
if (
CompletedTasksRepository::DeleteWhere(
database,
fmt::format(
"charid = {} AND taskid = {}",
client_target->CharacterID(),
task_id
)
)
) {
c->Message(
Chat::Yellow,
fmt::format(
"Successfully uncompleted task ID {} for {}.",
task_id,
(
client_target == c ?
"yourself" :
fmt::format(
"{} ({})",
client_target->GetCleanName(),
client_target->GetID()
)
)
).c_str()
);
return;
} else {
c->Message(
Chat::Yellow,
fmt::format(
"{} not completed task ID {}.",
(
client_target == c ?
"You have" :
fmt::format(
"{} ({}) has",
client_target->GetCleanName(),
client_target->GetID()
)
),
task_id
).c_str()
);
return;
}
} else {
if (!task_id || task_id > MAXTASKS) {
c->Message(Chat::White, "Invalid task ID specified.");
return;
}
if (
CompletedTasksRepository::DeleteWhere(
database,
fmt::format(
"charid = {} AND taskid = {}",
target->CharacterID(),
task_id
)
)
) {
c->Message(
Chat::Yellow,
fmt::format(
"Successfully uncompleted task ID {} for {}.",
task_id,
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(
Chat::Yellow,
fmt::format(
"{} {} not completed task ID {}.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has",
task_id
).c_str()
);
}
}
} else if (is_update) {
if (arguments >= 3) {
@ -359,21 +326,12 @@ void command_task(Client *c, const Seperator *sep)
task_id,
activity_id,
count,
(
client_target == c ?
"yourself" :
fmt::format(
"{} ({})",
client_target->GetCleanName(),
client_target->GetID()
)
)
c->GetTargetDescription(target)
).c_str()
);
client_target->UpdateTaskActivity(task_id, activity_id, count);
c->ShowClientTasks(client_target);
target->UpdateTaskActivity(task_id, activity_id, count);
target->ShowClientTasks(c);
}
return;
}
}

View File

@ -41,15 +41,7 @@ void command_texture(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Texture Changed for {} | Texture: {}{}",
(
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
texture,
(
Mob::IsPlayerRace(target->GetModel()) ?

View File

@ -12,13 +12,7 @@ void command_timers(Client *c, const Seperator *sep)
std::string popup_title = fmt::format(
"Recast Timers for {}",
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target, TargetDescriptionType::UCSelf)
);
std::string popup_text = "<table>";

View File

@ -44,15 +44,7 @@ void command_title(Client *c, const Seperator *sep)
"Title has been {}{} for {}{}",
is_remove ? "removed" : "changed",
!is_remove && save_title ? " and saved" : "",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
is_remove ?
"." :

View File

@ -44,15 +44,7 @@ void command_titlesuffix(Client *c, const Seperator *sep)
"Title suffix has been {}{} for {}{}",
is_remove ? "removed" : "changed",
!is_remove && save_suffix ? " and saved" : "",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c->GetTargetDescription(target),
(
is_remove ?
"." :

View File

@ -8,7 +8,7 @@ void command_traindisc(Client *c, const Seperator *sep)
}
if (sep->argnum < 1 || !sep->IsNumber(1)) {
c->Message(Chat::White, "FORMAT: #traindisc <max level> <min level>");
c->Message(Chat::White, "Usage: #traindisc [Max Level] [Min Level]");
return;
}
@ -32,12 +32,12 @@ void command_traindisc(Client *c, const Seperator *sep)
}
if (max_level < 1 || min_level < 1) {
c->Message(Chat::White, "ERROR: Level must be greater than or equal to 1.");
c->Message(Chat::White, "Level must be greater than or equal to 1.");
return;
}
if (min_level > max_level) {
c->Message(Chat::White, "ERROR: Minimum Level must be less than or equal to Maximum Level.");
c->Message(Chat::White, "Minimum Level must be less than or equal to Maximum Level.");
return;
}
@ -60,7 +60,7 @@ void command_traindisc(Client *c, const Seperator *sep)
fmt::format(
"{} learned for {}.",
discipline_message,
target->GetCleanName()
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -12,13 +12,7 @@ void command_undye(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Undyed armor for {}.",
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -7,6 +7,15 @@ void command_unfreeze(Client *c, const Seperator *sep)
return;
}
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_STAND);
auto target = c->GetTarget();
target->SendAppearancePacket(AT_Anim, ANIM_STAND);
c->Message(
Chat::White,
fmt::format(
"You have unfrozen {}.",
c->GetTargetDescription(target)
).c_str()
);
}

View File

@ -33,16 +33,9 @@ void command_unmemspell(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} not have {} ({}) memorized.",
(
c == target ?
"You do" :
fmt::format(
"{} ({}) does",
target->GetCleanName(),
target->GetID()
)
),
"{} {} not have {} ({}) memorized.",
c->GetTargetDescription(target),
c == target ? "do" : "does",
GetSpellName(spell_id),
spell_id
).c_str()
@ -56,11 +49,10 @@ void command_unmemspell(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) unmemorized for {} ({}) from spell gem {}.",
"{} ({}) unmemorized for {} from spell gem {}.",
GetSpellName(spell_id),
spell_id,
target->GetCleanName(),
target->GetID(),
c->GetTargetDescription(target),
spell_gem
).c_str()
);

View File

@ -12,16 +12,9 @@ void command_unmemspells(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} no spells to unmemorize.",
(
c == target ?
"You have" :
fmt::format(
"{} ({}) has",
target->GetCleanName(),
target->GetID()
)
)
"{} {} no spells to unmemorize.",
c->GetTargetDescription(target, TargetDescriptionType::UCYou),
c == target ? "have" : "has"
).c_str()
);
return;
@ -33,9 +26,8 @@ void command_unmemspells(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) has had {} spells unmemorized.",
target->GetCleanName(),
target->GetID(),
"{} has had {} spells unmemorized.",
c->GetTargetDescription(target),
memmed_count
).c_str()
);

View File

@ -38,27 +38,16 @@ void command_unscribespell(Client *c, const Seperator *sep)
"Unscribing {} ({}) for {}.",
spell_name,
spell_id,
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(
Chat::White,
fmt::format(
"{} not have {} ({}) scribed.",
c == target ?
"You do" :
fmt::format(
"{} ({}) does",
target->GetCleanName(),
target->GetID()
),
"{} {} not have {} ({}) scribed.",
c->GetTargetDescription(target),
c == target ? "do" : "does",
spell_name,
spell_id
).c_str()

View File

@ -38,27 +38,16 @@ void command_untraindisc(Client *c, const Seperator *sep)
"Untraining {} ({}) for {}.",
spell_name,
spell_id,
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(
Chat::White,
fmt::format(
"{} not have {} ({}) trained.",
c == target ?
"You do" :
fmt::format(
"{} ({}) does",
target->GetCleanName(),
target->GetID()
),
"{} {} not have {} ({}) trained.",
c->GetTargetDescription(target),
c == target ? "do" : "does",
spell_name,
spell_id
).c_str()

View File

@ -6,16 +6,6 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
auto target_string = (
c == target ?
"Yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
);
auto platinum = (
target->GetMoney(3, 0) +
@ -52,7 +42,7 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"Money for {} | {}",
target_string,
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
ConvertMoneyToString(
platinum,
gold,
@ -70,7 +60,7 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
fmt::format(
"{} for {} | {}",
database.CreateItemLink(RuleI(Zone, EbonCrystalItemID)),
target_string,
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
ebon_crystals
).c_str()
);
@ -83,21 +73,21 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
fmt::format(
"{} for {} | {}",
database.CreateItemLink(RuleI(Zone, RadiantCrystalItemID)),
target_string,
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
radiant_crystals
).c_str()
);
}
for (const auto& alternate_currency : zone->AlternateCurrencies) {
auto currency_value = target->GetAlternateCurrencyValue(alternate_currency.id);
for (const auto& ac : zone->AlternateCurrencies) {
auto currency_value = target->GetAlternateCurrencyValue(ac.id);
if (currency_value) {
c->Message(
Chat::White,
fmt::format(
"{} for {} | {}",
database.CreateItemLink(alternate_currency.item_id),
target_string,
database.CreateItemLink(ac.item_id),
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
currency_value
).c_str()
);
@ -116,7 +106,7 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
fmt::format(
"{} for {} | {}",
EQ::constants::GetLDoNThemeName(ldon_currency_id),
target_string,
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
ldon_currency_value
).c_str()
);
@ -129,7 +119,7 @@ void command_viewcurrencies(Client *c, const Seperator *sep)
Chat::White,
fmt::format(
"PVP Points for {} | {}",
target_string,
c->GetTargetDescription(target, TargetDescriptionType::UCSelf),
pvp_points
).c_str()
);

View File

@ -13,9 +13,8 @@ void command_wpinfo(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"{} ({}) is not a part of any grid.",
target->GetCleanName(),
target->GetID()
"{} is not a part of any grid.",
c->GetTargetDescription(target)
).c_str()
);
return;

View File

@ -80,9 +80,8 @@ void command_zclip(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Clipping Changed | Zone: {} ({}) Permanent: {}",
zone->GetLongName(),
zone->GetZoneID(),
"Clipping Changed | Zone: {} Permanent: {}",
zone->GetZoneDescription(),
permanent ? "Yes" : "No"
).c_str()
);

View File

@ -56,9 +56,8 @@ void command_zcolor(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Fog Color Changed | Zone: {} ({}) Red: {} Green: {} Blue: {} Permanent: {}",
zone->GetLongName(),
zone->GetZoneID(),
"Fog Color Changed | Zone: {} Red: {} Green: {} Blue: {} Permanent: {}",
zone->GetZoneDescription(),
red,
green,
blue,

View File

@ -44,17 +44,8 @@ void command_zsafecoords(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Safe Coordinates Changed | Zone: {} ({}){} XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f} Permanent: {} ",
zone->GetLongName(),
zone->GetZoneID(),
(
zone->GetInstanceVersion() ?
fmt::format(
" Version: {}",
zone->GetInstanceVersion()
) :
""
),
"Safe Coordinates Changed | Zone: {} XYZ: {:.2f}, {:.2f}, {:.2f} Heading: {:.2f} Permanent: {} ",
zone->GetZoneDescription(),
x,
y,
z,

View File

@ -34,9 +34,8 @@ void command_zsky(Client *c, const Seperator *sep)
c->Message(
Chat::White,
fmt::format(
"Sky Changed | Zone: {} ({}) Sky Type: {} Permanent: {}",
zone->GetLongName(),
zone->GetZoneID(),
"Sky Changed | Zone: {} Sky Type: {} Permanent: {}",
zone->GetZoneDescription(),
sky_type,
permanent ? "Yes" : "No"
).c_str()

Some files were not shown because too many files have changed in this diff Show More