[Commands] Cleanup #npcstats Command. (#1690)

- Cleanup menu and add stats that were not there before.
- Only display some data if necessary (i.e only show loot/money if they have loot/money)
- Add skill name helper method.
- Add faction name helper method.
- Add Charmed stats and other getter methods.
- Cleanup QueryLoot() method.
This commit is contained in:
Kinglykrab 2021-11-07 17:20:43 -05:00 committed by GitHub
parent e1de3d2ae0
commit 194c71727d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 697 additions and 156 deletions

View File

@ -177,8 +177,7 @@ bool EQ::skills::IsMeleeDmg(SkillType skill)
const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap()
{
/* VS2013 code
static const std::map<SkillUseTypes, std::string> skill_use_types_map = {
static const std::map<SkillType, std::string> skill_type_map = {
{ Skill1HBlunt, "1H Blunt" },
{ Skill1HSlashing, "1H Slashing" },
{ Skill2HBlunt, "2H Blunt" },
@ -258,103 +257,22 @@ const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap(
{ SkillTripleAttack, "Triple Attack" },
{ Skill2HPiercing, "2H Piercing" }
};
*/
/* VS2012 code - begin */
static const char* skill_use_names[SkillCount] = {
"1H Blunt",
"1H Slashing",
"2H Blunt",
"2H Slashing",
"Abjuration",
"Alteration",
"Apply Poison",
"Archery",
"Backstab",
"Bind Wound",
"Bash",
"Block",
"Brass Instruments",
"Channeling",
"Conjuration",
"Defense",
"Disarm",
"Disarm Traps",
"Divination",
"Dodge",
"Double Attack",
"Dragon Punch",
"Dual Wield",
"Eagle Strike",
"Evocation",
"Feign Death",
"Flying Kick",
"Forage",
"Hand to Hand",
"Hide",
"Kick",
"Meditate",
"Mend",
"Offense",
"Parry",
"Pick Lock",
"1H Piercing",
"Riposte",
"Round Kick",
"Safe Fall",
"Sense Heading",
"Singing",
"Sneak",
"Specialize Abjuration",
"Specialize Alteration",
"Specialize Conjuration",
"Specialize Divination",
"Specialize Evocation",
"Pick Pockets",
"Stringed Instruments",
"Swimming",
"Throwing",
"Tiger Claw",
"Tracking",
"Wind Instruments",
"Fishing",
"Make Poison",
"Tinkering",
"Research",
"Alchemy",
"Baking",
"Tailoring",
"Sense Traps",
"Blacksmithing",
"Fletching",
"Brewing",
"Alcohol Tolerance",
"Begging",
"Jewelry Making",
"Pottery",
"Percussion Instruments",
"Intimidation",
"Berserking",
"Taunt",
"Frenzy",
"Remove Traps",
"Triple Attack",
"2H Piercing"
};
static std::map<SkillType, std::string> skill_type_map;
skill_type_map.clear();
for (int i = Skill1HBlunt; i < SkillCount; ++i)
skill_type_map[(SkillType)i] = skill_use_names[i];
/* VS2012 code - end */
return skill_type_map;
}
std::string EQ::skills::GetSkillName(SkillType skill)
{
if (skill >= Skill1HBlunt && skill <= Skill2HPiercing) {
std::map<SkillType, std::string> skills = GetSkillTypeMap();
for (auto current_skill : skills) {
if (skill == current_skill.first) {
return current_skill.second;
}
}
}
return std::string();
}
EQ::SkillProfile::SkillProfile()
{
memset(&Skill, 0, (sizeof(uint32) * PACKET_SKILL_ARRAY_SIZE));

View File

@ -171,6 +171,7 @@ namespace EQ
extern const std::map<SkillType, std::string>& GetSkillTypeMap();
std::string GetSkillName(SkillType skill);
} /*skills*/
struct SkillProfile { // prototype - not implemented

View File

@ -1935,34 +1935,596 @@ void command_fov(Client *c, const Seperator *sep)
void command_npcstats(Client *c, const Seperator *sep)
{
if (c->GetTarget() == 0)
c->Message(Chat::White, "ERROR: No target!");
else if (!c->GetTarget()->IsNPC())
c->Message(Chat::White, "ERROR: Target is not a NPC!");
else {
auto target_npc = c->GetTarget()->CastToNPC();
c->Message(Chat::White, "# NPC Stats");
c->Message(Chat::White, "- Name: %s NpcID: %u", target_npc->GetName(), target_npc->GetNPCTypeID());
c->Message(Chat::White, "- Race: %i Level: %i Class: %i Material: %i", target_npc->GetRace(), target_npc->GetLevel(), target_npc->GetClass(), target_npc->GetTexture());
c->Message(Chat::White, "- Current HP: %i Max HP: %i", target_npc->GetHP(), target_npc->GetMaxHP());
//c->Message(Chat::White, "Weapon Item Number: %s", target_npc->GetWeapNo());
c->Message(Chat::White, "- Gender: %i Size: %f Bodytype: %d", target_npc->GetGender(), target_npc->GetSize(), target_npc->GetBodyType());
c->Message(Chat::White, "- Runspeed: %.3f Walkspeed: %.3f", static_cast<float>(0.025f * target_npc->GetRunspeed()), static_cast<float>(0.025f * target_npc->GetWalkspeed()));
c->Message(Chat::White, "- Spawn Group: %i Grid: %i", target_npc->GetSpawnGroupId(), target_npc->GetGrid());
if (target_npc->proximity) {
c->Message(Chat::White, "- Proximity: Enabled");
c->Message(Chat::White, "-- Cur_X: %1.3f, Cur_Y: %1.3f, Cur_Z: %1.3f", target_npc->GetX(), target_npc->GetY(), target_npc->GetZ());
c->Message(Chat::White, "-- Min_X: %1.3f(%1.3f), Max_X: %1.3f(%1.3f), X_Range: %1.3f", target_npc->proximity->min_x, (target_npc->proximity->min_x - target_npc->GetX()), target_npc->proximity->max_x, (target_npc->proximity->max_x - target_npc->GetX()), (target_npc->proximity->max_x - target_npc->proximity->min_x));
c->Message(Chat::White, "-- Min_Y: %1.3f(%1.3f), Max_Y: %1.3f(%1.3f), Y_Range: %1.3f", target_npc->proximity->min_y, (target_npc->proximity->min_y - target_npc->GetY()), target_npc->proximity->max_y, (target_npc->proximity->max_y - target_npc->GetY()), (target_npc->proximity->max_y - target_npc->proximity->min_y));
c->Message(Chat::White, "-- Min_Z: %1.3f(%1.3f), Max_Z: %1.3f(%1.3f), Z_Range: %1.3f", target_npc->proximity->min_z, (target_npc->proximity->min_z - target_npc->GetZ()), target_npc->proximity->max_z, (target_npc->proximity->max_z - target_npc->GetZ()), (target_npc->proximity->max_z - target_npc->proximity->min_z));
c->Message(Chat::White, "-- Say: %s", (target_npc->proximity->say ? "Enabled" : "Disabled"));
if (c->GetTarget() && c->GetTarget()->IsNPC()) {
auto target = c->GetTarget()->CastToNPC();
std::string target_name = target->GetCleanName();
std::string target_last_name = target->GetLastName();
bool has_charmed_stats = (
target->GetCharmedAccuracy() != 0 ||
target->GetCharmedArmorClass() != 0 ||
target->GetCharmedAttack() != 0 ||
target->GetCharmedAttackDelay() != 0 ||
target->GetCharmedAvoidance() != 0 ||
target->GetCharmedMaxDamage() != 0 ||
target->GetCharmedMinDamage() != 0
);
// Spawn Data
c->Message(
Chat::White,
fmt::format(
"Spawn | Group: {} Point: {} Grid: {}",
target->GetSpawnGroupId(),
target->GetSpawnPointID(),
target->GetGrid()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Spawn | Raid: {} Rare: {}",
target->IsRaidTarget() ? "Yes" : "No",
target->IsRareSpawn() ? "Yes" : "No",
target->GetSkipGlobalLoot() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Spawn | Skip Global Loot: {} Ignore Despawn: {}",
target->GetSkipGlobalLoot() ? "Yes" : "No",
target->GetIgnoreDespawn() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Spawn | Findable: {} Trackable: {} Underwater: {}",
target->IsFindable() ? "Yes" : "No",
target->IsTrackable() ? "Yes" : "No",
target->IsUnderwaterOnly() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Spawn | Stuck Behavior: {} Fly Mode: {}",
target->GetStuckBehavior(),
static_cast<int>(target->GetFlyMode())
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Spawn | Aggro NPCs: {} Always Aggro: {}",
target->GetNPCAggro() ? "Yes" : "No",
target->GetAlwaysAggro() ? "Yes" : "No"
).c_str()
);
// NPC
c->Message(
Chat::White,
fmt::format(
"NPC | ID: {} Name: {}{} Level: {}",
target->GetNPCTypeID(),
target_name,
(
!target_last_name.empty() ?
fmt::format(" ({})", target_last_name) :
""
),
target->GetLevel()
).c_str()
);
// Race / Class / Gender
c->Message(
Chat::White,
fmt::format(
"Race: {} ({}) Class: {} ({}) Gender: {} ({})",
GetRaceIDName(target->GetRace()),
target->GetRace(),
GetClassIDName(target->GetClass()),
target->GetClass(),
GetGenderName(target->GetGender()),
target->GetGender()
).c_str()
);
// Faction
if (target->GetNPCFactionID()) {
auto faction_id = target->GetNPCFactionID();
auto faction_name = content_db.GetFactionName(faction_id);
c->Message(
Chat::White,
fmt::format(
"Faction: {} ({})",
faction_name,
faction_id
).c_str()
);
}
else {
c->Message(Chat::White, "-Proximity: Disabled");
// Adventure Template
if (target->GetAdventureTemplate()) {
c->Message(
Chat::White,
fmt::format(
"Adventure Template: {}",
target->GetAdventureTemplate()
).c_str()
);
}
c->Message(Chat::White, "");
c->Message(Chat::White, "EmoteID: %i", target_npc->GetEmoteID());
target_npc->QueryLoot(c);
// Body
c->Message(
Chat::White,
fmt::format(
"Body | Size: {:.2f} Type: {}",
target->GetSize(),
target->GetBodyType()
).c_str()
);
// Face
c->Message(
Chat::White,
fmt::format(
"Features | Face: {} Eye One: {} Eye Two: {}",
target->GetLuclinFace(),
target->GetEyeColor1(),
target->GetEyeColor2()
).c_str()
);
// Hair
c->Message(
Chat::White,
fmt::format(
"Features | Hair: {} Hair Color: {}",
target->GetHairStyle(),
target->GetHairColor()
).c_str()
);
// Beard
c->Message(
Chat::White,
fmt::format(
"Features | Beard: {} Beard Color: {}",
target->GetBeard(),
target->GetBeardColor()
).c_str()
);
// Drakkin Features
if (target->GetRace() == RACE_DRAKKIN_522) {
c->Message(
Chat::White,
fmt::format(
"Drakkin Features | Heritage: {} Tattoo: {} Details: {}",
target->GetDrakkinHeritage(),
target->GetDrakkinTattoo(),
target->GetDrakkinDetails()
).c_str()
);
}
// Textures
c->Message(
Chat::White,
fmt::format(
"Textures | Armor: {} Helmet: {}",
target->GetTexture(),
target->GetHelmTexture()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Textures | Arms: {} Bracers: {} Hands: {}",
target->GetArmTexture(),
target->GetBracerTexture(),
target->GetHandTexture()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Textures | Legs: {} Feet: {}",
target->GetLegTexture(),
target->GetFeetTexture()
).c_str()
);
// Hero's Forge
if (target->GetHeroForgeModel()) {
c->Message(
Chat::White,
fmt::format(
"Hero's Forge: {}",
target->GetHeroForgeModel()
).c_str()
);
}
// Owner Data
if (target->GetOwner()) {
auto owner_name = target->GetOwner()->GetCleanName();
auto owner_type = (
target->GetOwner()->IsNPC() ?
"NPC" :
(
target->GetOwner()->IsClient() ?
"Client" :
"Other"
)
);
auto owner_id = target->GetOwnerID();
c->Message(
Chat::White,
fmt::format(
"Owner | Name: {} ({}) Type: {}",
owner_name,
owner_id,
owner_type
).c_str()
);
}
// Pet Data
if (target->GetPet()) {
auto pet_name = target->GetPet()->GetCleanName();
auto pet_id = target->GetPetID();
c->Message(
Chat::White,
fmt::format(
"Pet | Name: {} ({})",
pet_name,
pet_id
).c_str()
);
}
// Merchant Data
if (target->MerchantType) {
c->Message(
Chat::White,
fmt::format(
"Merchant | ID: {} Currency Type: {}",
target->MerchantType,
target->GetAltCurrencyType()
).c_str()
);
}
// Spell Data
if (target->AI_HasSpells() || target->AI_HasSpellsEffects()) {
c->Message(
Chat::White,
fmt::format(
"Spells | ID: {} Effects ID: {}",
target->GetNPCSpellsID(),
target->GetNPCSpellsEffectsID()
).c_str()
);
}
// Health
c->Message(
Chat::White,
fmt::format(
"Health: {}/{} ({:.2f}%) Regen: {}",
target->GetHP(),
target->GetMaxHP(),
target->GetHPRatio(),
target->GetHPRegen()
).c_str()
);
// Mana
if (target->GetMaxMana() > 0) {
c->Message(
Chat::White,
fmt::format(
"Mana: {}/{} ({:.2f}%) Regen: {}",
target->GetMana(),
target->GetMaxMana(),
target->GetManaRatio(),
target->GetManaRegen()
).c_str()
);
}
// Damage
c->Message(
Chat::White,
fmt::format(
"Damage | Min: {} Max: {}",
target->GetMinDMG(),
target->GetMaxDMG()
).c_str()
);
// Attack Count / Delay
c->Message(
Chat::White,
fmt::format(
"Attack | Count: {} Delay: {}",
target->GetNumberOfAttacks(),
target->GetAttackDelay()
).c_str()
);
// Weapon Textures
c->Message(
Chat::White,
fmt::format(
"Weapon Textures | Primary: {} Secondary: {} Ammo: {}",
target->GetEquipmentMaterial(EQ::textures::weaponPrimary),
target->GetEquipmentMaterial(EQ::textures::weaponSecondary),
target->GetAmmoIDfile()
).c_str()
);
// Weapon Types
c->Message(
Chat::White,
fmt::format(
"Weapon Types | Primary: {} ({}) Secondary: {} ({})",
EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(target->GetPrimSkill())),
target->GetPrimSkill(),
EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(target->GetSecSkill())),
target->GetSecSkill()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Weapon Types | Ranged: {} ({})",
EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(target->GetRangedSkill())),
target->GetRangedSkill()
).c_str()
);
// Combat Stats
c->Message(
Chat::White,
fmt::format(
"Combat Stats | Accuracy: {} Armor Class: {} Attack: {}",
target->GetAccuracyRating(),
target->GetAC(),
target->GetATK()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Combat Stats | Avoidance: {} Slow Mitigation: {}",
target->GetAvoidanceRating(),
target->GetSlowMitigation()
).c_str()
);
// Stats
c->Message(
Chat::White,
fmt::format(
"Stats | Agility: {} Charisma: {} Dexterity: {} Intelligence: {}",
target->GetAGI(),
target->GetCHA(),
target->GetDEX(),
target->GetINT()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Stats | Stamina: {} Strength: {} Wisdom: {}",
target->GetSTA(),
target->GetSTR(),
target->GetWIS()
).c_str()
);
// Charmed Stats
if (has_charmed_stats) {
c->Message(
Chat::White,
fmt::format(
"Charmed Stats | Attack: {} Attack Delay: {}",
target->GetCharmedAttack(),
target->GetCharmedAttackDelay()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Charmed Stats | Accuracy: {} Avoidance: {}",
target->GetCharmedAccuracy(),
target->GetCharmedAvoidance()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Charmed Stats | Min Damage: {} Max Damage: {}",
target->GetCharmedMinDamage(),
target->GetCharmedMaxDamage()
).c_str()
);
}
// Resists
c->Message(
Chat::White,
fmt::format(
"Resists | Cold: {} Disease: {} Fire: {} Magic: {}",
target->GetCR(),
target->GetDR(),
target->GetFR(),
target->GetMR()
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Resists | Poison: {} Corruption: {} Physical: {}",
target->GetPR(),
target->GetCorrup(),
target->GetPhR()
).c_str()
);
// Scaling
c->Message(
Chat::White,
fmt::format(
"Scaling | Heal: {} Spell: {}",
target->GetHealScale(),
target->GetSpellScale()
).c_str()
);
// See Invisible / Invisible vs. Undead / Hide / Improved Hide
c->Message(
Chat::White,
fmt::format(
"Can See | Invisible: {} Invisible vs. Undead: {}",
target->SeeInvisible() ? "Yes" : "No",
target->SeeInvisibleUndead() ? "Yes" : "No"
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Can See | Hide: {} Improved Hide: {}",
target->SeeHide() ? "Yes" : "No",
target->SeeImprovedHide() ? "Yes" : "No"
).c_str()
);
// Aggro / Assist Radius
c->Message(
Chat::White,
fmt::format(
"Radius | Aggro: {} Assist: {}",
target->GetAggroRange(),
target->GetAssistRange()
).c_str()
);
// Emote
c->Message(
Chat::White,
fmt::format(
"Emote: {}",
target->GetEmoteID()
).c_str()
);
// Run/Walk Speed
c->Message(
Chat::White,
fmt::format(
"Speed | Run: {} Walk: {}",
target->GetRunspeed(),
target->GetWalkspeed()
).c_str()
);
// Position
c->Message(
Chat::White,
fmt::format(
"Position | {}, {}, {}, {}",
target->GetX(),
target->GetY(),
target->GetZ(),
target->GetHeading()
).c_str()
);
// Experience Modifier
c->Message(
Chat::White,
fmt::format(
"Experience Modifier: {}",
target->GetKillExpMod()
).c_str()
);
// Quest Globals
c->Message(
Chat::White,
fmt::format(
"Quest Globals: {}",
target->qglobal ? "Enabled" : "Disabled"
).c_str()
);
// Proximity
if (target->IsProximitySet()) {
c->Message(
Chat::White,
fmt::format(
"Proximity | Say: {}",
target->proximity->say ? "Enabled" : "Disabled"
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Proximity X | Min: {} Max: {} Range: {}",
target->GetProximityMinX(),
target->GetProximityMinX(),
(target->GetProximityMinX() - target->GetProximityMinX())
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Proximity Y | Min: {} Max: {} Range: {}",
target->GetProximityMinY(),
target->GetProximityMaxY(),
(target->GetProximityMaxY() - target->GetProximityMinY())
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Proximity Z | Min: {} Max: {} Range: {}",
target->GetProximityMinZ(),
target->GetProximityMaxZ(),
(target->GetProximityMaxZ() - target->GetProximityMinZ())
).c_str()
);
}
// Loot Data
if (target->GetLoottableID()) {
target->QueryLoot(c);
}
} else {
c->Message(Chat::White, "You must target an NPC to use this command.");
}
}

View File

@ -643,35 +643,67 @@ void NPC::ClearItemList() {
void NPC::QueryLoot(Client* to)
{
to->Message(Chat::White, "| # Current Loot (%s) LootTableID: %i", GetName(), GetLoottableID());
int item_count = 0;
for (auto cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++item_count) {
if (!(*cur)) {
LogError("NPC::QueryLoot() - ItemList error, null item");
continue;
}
if (!(*cur)->item_id || !database.GetItem((*cur)->item_id)) {
LogError("NPC::QueryLoot() - Database error, invalid item");
continue;
}
EQ::SayLinkEngine linker;
linker.SetLinkType(EQ::saylink::SayLinkLootItem);
linker.SetLootData(*cur);
if (itemlist.size() > 0) {
to->Message(
0,
"| -- Item %i: %s ID: %u min_level: %u max_level: %u",
item_count,
linker.GenerateLink().c_str(),
(*cur)->item_id,
(*cur)->trivial_min_level,
(*cur)->trivial_max_level
Chat::White,
fmt::format(
"Loot | Name: {} ID: {} Loottable ID: {}",
GetName(),
GetNPCTypeID(),
GetLoottableID()
).c_str()
);
int item_count = 0;
for (auto current_item : itemlist) {
int item_number = (item_count + 1);
if (!current_item) {
LogError("NPC::QueryLoot() - ItemList error, null item.");
continue;
}
if (!current_item->item_id || !database.GetItem(current_item->item_id)) {
LogError("NPC::QueryLoot() - Database error, invalid item.");
continue;
}
EQ::SayLinkEngine linker;
linker.SetLinkType(EQ::saylink::SayLinkLootItem);
linker.SetLootData(current_item);
to->Message(
Chat::White,
fmt::format(
"Item {} | Name: {} ID: {} Min Level: {} Max Level: {}",
item_number,
linker.GenerateLink().c_str(),
current_item->item_id,
current_item->trivial_min_level,
current_item->trivial_max_level
).c_str()
);
item_count++;
}
}
to->Message(Chat::White, "| %i Platinum %i Gold %i Silver %i Copper", platinum, gold, silver, copper);
bool has_money = (
platinum > 0 ||
gold > 0 ||
silver > 0 ||
copper > 0
);
if (has_money) {
to->Message(
Chat::White,
fmt::format(
"Money | Platinum: {} Gold: {} Silver: {} Copper: {}",
platinum,
gold,
silver,
copper
).c_str()
);
}
}
bool NPC::HasItem(uint32 item_id) {

View File

@ -497,6 +497,25 @@ public:
uint32 GetRoamboxDelay() const;
uint32 GetRoamboxMinDelay() const;
inline uint8 GetArmTexture() { return armtexture; }
inline uint8 GetBracerTexture() { return bracertexture; }
inline uint8 GetHandTexture() { return handtexture; }
inline uint8 GetFeetTexture() { return feettexture; }
inline uint8 GetLegTexture() { return legtexture; }
inline int GetCharmedAccuracy() { return charm_accuracy_rating; }
inline int GetCharmedArmorClass() { return charm_ac; }
inline int GetCharmedAttack() { return charm_atk; }
inline int GetCharmedAttackDelay() { return charm_attack_delay; }
inline int GetCharmedAvoidance() { return charm_avoidance_rating; }
inline int GetCharmedMaxDamage() { return charm_max_dmg; }
inline int GetCharmedMinDamage() { return charm_min_dmg; }
inline bool GetAlwaysAggro() { return always_aggro; }
inline bool GetNPCAggro() { return npc_aggro; }
inline bool GetIgnoreDespawn() { return ignore_despawn; }
inline bool GetSkipGlobalLoot() { return skip_global_loot; }
std::unique_ptr<Timer> AIautocastspell_timer;
virtual int GetStuckBehavior() const { return NPCTypedata_ours ? NPCTypedata_ours->stuck_behavior : NPCTypedata->stuck_behavior; }

View File

@ -1012,15 +1012,7 @@ std::string QuestManager::getspellname(uint32 spell_id) {
}
std::string QuestManager::getskillname(int skill_id) {
if (skill_id >= 0 && skill_id < EQ::skills::SkillCount) {
std::map<EQ::skills::SkillType, std::string> Skills = EQ::skills::GetSkillTypeMap();
for (auto skills_iter : Skills) {
if (skill_id == skills_iter.first) {
return skills_iter.second;
}
}
}
return std::string();
return EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(skill_id));
}
void QuestManager::safemove() {

View File

@ -3981,6 +3981,22 @@ bool ZoneDatabase::GetFactionName(int32 faction_id, char* name, uint32 buflen) {
}
std::string ZoneDatabase::GetFactionName(int32 faction_id)
{
std::string faction_name;
if (
faction_id <= 0 ||
faction_id > static_cast<int>(max_faction) ||
!faction_array[faction_id]
) {
return faction_name;
}
faction_name = faction_array[faction_id]->name;
return faction_name;
}
//o--------------------------------------------------------------
//| Name: GetNPCFactionList; Dec. 16, 2001
//o--------------------------------------------------------------

View File

@ -403,6 +403,7 @@ public:
bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0);
bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001
bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001
std::string GetFactionName(int32 faction_id);
bool GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // improve faction handling
bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001
bool LoadFactionData();