mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Cleanup] Add initiator/owner checks to various methods in questmgr.cpp (#3306)
* [Cleanup] Add initiator/owner checks to various methods in questmgr.cpp # Notes - Add `initiator` check to `quest::permaclass()`. - Add `initiator` check to `quest::permarace()`. - Add `initiator` check to `quest::permagender()`. - Add `initiator` check to `quest::scribespells()`. - Add `initiator` check to `quest::traindiscs()`. - Add `initiator` check to `quest::unscribespells()`. - Add `initiator` check to `quest::untraindiscs()`. - Cleanup `initiator` check in `quest::pvp()`. - Cleanup `initiator` check in `quest::movepc()`. - Cleanup `initiator` check in `quest::gmmove()`. - Cleanup `initiator` check in `quest::movegrp()`. - Add `owner` check to `quest::doanim()`. - Cleanup `initiator` check in `quest::addskill()`. - Cleanup `initiator` check in `quest::setlanguage()`. - Cleanup `initiator` check in `quest::setskill()`. * Update questmgr.cpp * Update questmgr.cpp * Update questmgr.cpp * Update questmgr.cpp
This commit is contained in:
parent
e3761cf2a3
commit
576f99f292
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "../common/classes.h"
|
||||
#include "../common/data_verification.h"
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/skills.h"
|
||||
@ -1156,7 +1157,11 @@ void QuestManager::surname(std::string last_name) {
|
||||
|
||||
void QuestManager::permaclass(int class_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
//Makes the client the class specified
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetBaseClass(class_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base class change by QuestManager");
|
||||
@ -1164,7 +1169,11 @@ void QuestManager::permaclass(int class_id) {
|
||||
|
||||
void QuestManager::permarace(int race_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
//Makes the client the race specified
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetBaseRace(race_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base race change by QuestManager");
|
||||
@ -1172,7 +1181,11 @@ void QuestManager::permarace(int race_id) {
|
||||
|
||||
void QuestManager::permagender(int gender_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
//Makes the client the gender specified
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetBaseGender(gender_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base gender change by QuestManager");
|
||||
@ -1180,21 +1193,41 @@ void QuestManager::permagender(int gender_id) {
|
||||
|
||||
uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return initiator->ScribeSpells(min_level, max_level);
|
||||
}
|
||||
|
||||
uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return initiator->LearnDisciplines(min_level, max_level);
|
||||
}
|
||||
|
||||
void QuestManager::unscribespells() {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->UnscribeSpellAll();
|
||||
}
|
||||
|
||||
void QuestManager::untraindiscs() {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->UntrainDiscAll();
|
||||
}
|
||||
|
||||
@ -1202,7 +1235,6 @@ void QuestManager::givecash(uint32 copper, uint32 silver, uint32 gold, uint32 pl
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (
|
||||
initiator &&
|
||||
initiator->IsClient() &&
|
||||
(
|
||||
copper ||
|
||||
silver ||
|
||||
@ -1221,79 +1253,103 @@ void QuestManager::givecash(uint32 copper, uint32 silver, uint32 gold, uint32 pl
|
||||
|
||||
void QuestManager::pvp(const char *mode) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (!strcasecmp(mode,"on"))
|
||||
{
|
||||
if (initiator)
|
||||
initiator->SetPVP(true);
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (initiator)
|
||||
initiator->SetPVP(false);
|
||||
|
||||
initiator->SetPVP(Strings::ToBool(mode));
|
||||
}
|
||||
|
||||
void QuestManager::movepc(int zone_id, float x, float y, float z, float heading) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator)
|
||||
initiator->MovePC(zone_id, x, y, z, heading);
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->MovePC(zone_id, x, y, z, heading);
|
||||
}
|
||||
|
||||
void QuestManager::gmmove(float x, float y, float z) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator)
|
||||
initiator->GMMove(x, y, z);
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->GMMove(x, y, z);
|
||||
}
|
||||
|
||||
void QuestManager::movegrp(int zoneid, float x, float y, float z) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator)
|
||||
{
|
||||
Group *g = entity_list.GetGroupByClient(initiator);
|
||||
if (g != nullptr) {
|
||||
g->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f);
|
||||
}
|
||||
else {
|
||||
Raid *r = entity_list.GetRaidByClient(initiator);
|
||||
if (r != nullptr) {
|
||||
uint32 gid = r->GetGroup(initiator);
|
||||
if (gid >= 0 && gid < 12) {
|
||||
r->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f, gid);
|
||||
}
|
||||
else {
|
||||
initiator->MovePC(zoneid, x, y, z, 0.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Group *g = entity_list.GetGroupByClient(initiator)) {
|
||||
g->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f);
|
||||
} else {
|
||||
if (Raid *r = entity_list.GetRaidByClient(initiator)) {
|
||||
const auto group_id = r->GetGroup(initiator);
|
||||
if (EQ::ValueWithin(group_id, 0, MAX_RAID_GROUPS)) {
|
||||
r->TeleportGroup(owner, zoneid, 0, x, y, z, 0.0f, group_id);
|
||||
} else {
|
||||
initiator->MovePC(zoneid, x, y, z, 0.0f);
|
||||
}
|
||||
} else {
|
||||
initiator->MovePC(zoneid, x, y, z, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::doanim(int animation_id, int animation_speed, bool ackreq, eqFilterType filter) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->DoAnim(animation_id, animation_speed, ackreq, filter);
|
||||
}
|
||||
|
||||
void QuestManager::addskill(int skill_id, int value) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (skill_id < 0 || skill_id > EQ::skills::HIGHEST_SKILL)
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
if (initiator)
|
||||
initiator->AddSkill((EQ::skills::SkillType) skill_id, value);
|
||||
}
|
||||
|
||||
if (!EQ::ValueWithin(skill_id, EQ::skills::Skill1HBlunt, EQ::skills::HIGHEST_SKILL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->AddSkill((EQ::skills::SkillType) skill_id, value);
|
||||
}
|
||||
|
||||
void QuestManager::setlanguage(int skill_id, int value) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator)
|
||||
initiator->SetLanguageSkill(skill_id, value);
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetLanguageSkill(skill_id, value);
|
||||
}
|
||||
|
||||
void QuestManager::setskill(int skill_id, int value) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (skill_id < 0 || skill_id > EQ::skills::HIGHEST_SKILL)
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
if (initiator)
|
||||
initiator->SetSkill((EQ::skills::SkillType) skill_id, value);
|
||||
}
|
||||
|
||||
if (!EQ::ValueWithin(skill_id, EQ::skills::Skill1HBlunt, EQ::skills::HIGHEST_SKILL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetSkill((EQ::skills::SkillType) skill_id, value);
|
||||
}
|
||||
|
||||
void QuestManager::setallskill(int value) {
|
||||
@ -1980,21 +2036,41 @@ void QuestManager::toggle_spawn_event(int event_id, bool enable, bool strict, bo
|
||||
|
||||
bool QuestManager::has_zone_flag(int zone_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
return initiator ? initiator->HasZoneFlag(zone_id) : false;
|
||||
|
||||
if (!initiator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return initiator->HasZoneFlag(zone_id);
|
||||
}
|
||||
|
||||
void QuestManager::set_zone_flag(int zone_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SetZoneFlag(zone_id);
|
||||
}
|
||||
|
||||
void QuestManager::clear_zone_flag(int zone_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->ClearZoneFlag(zone_id);
|
||||
}
|
||||
|
||||
void QuestManager::sethp(int64 hpperc) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
int64 newhp = (owner->GetMaxHP() * (100 - hpperc)) / 100;
|
||||
owner->Damage(owner, newhp, SPELL_UNKNOWN, EQ::skills::SkillHandtoHand, false, 0, false);
|
||||
}
|
||||
@ -2111,171 +2187,260 @@ bool QuestManager::isdooropen(uint32 doorid) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void QuestManager::npcrace(int race_id)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendIllusionPacket(race_id);
|
||||
}
|
||||
|
||||
void QuestManager::npcgender(int gender_id)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendIllusionPacket(owner->GetRace(), gender_id);
|
||||
}
|
||||
|
||||
void QuestManager::npcsize(int newsize)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->ChangeSize(newsize, true);
|
||||
}
|
||||
|
||||
void QuestManager::npctexture(int newtexture)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendIllusionPacket(owner->GetRace(), 0xFF, newtexture);
|
||||
}
|
||||
|
||||
void QuestManager::playerrace(int race_id)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendIllusionPacket(race_id);
|
||||
}
|
||||
|
||||
void QuestManager::playergender(int gender_id)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendIllusionPacket(initiator->GetRace(), gender_id);
|
||||
}
|
||||
|
||||
void QuestManager::playersize(int newsize)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->ChangeSize(newsize, true);
|
||||
}
|
||||
|
||||
void QuestManager::playertexture(int newtexture)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendIllusionPacket(initiator->GetRace(), 0xFF, newtexture);
|
||||
}
|
||||
|
||||
void QuestManager::playerfeature(const char* feature, int setting)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
uint16 Race = initiator->GetRace();
|
||||
uint8 Gender = initiator->GetGender();
|
||||
uint8 Texture = 0xFF;
|
||||
uint8 HelmTexture = 0xFF;
|
||||
uint8 HairColor = initiator->GetHairColor();
|
||||
uint8 BeardColor = initiator->GetBeardColor();
|
||||
uint8 EyeColor1 = initiator->GetEyeColor1();
|
||||
uint8 EyeColor2 = initiator->GetEyeColor2();
|
||||
uint8 HairStyle = initiator->GetHairStyle();
|
||||
uint8 LuclinFace = initiator->GetLuclinFace();
|
||||
uint8 Beard = initiator->GetBeard();
|
||||
uint32 DrakkinHeritage = initiator->GetDrakkinHeritage();
|
||||
uint32 DrakkinTattoo = initiator->GetDrakkinTattoo();
|
||||
uint32 DrakkinDetails = initiator->GetDrakkinDetails();
|
||||
float Size = initiator->GetSize();
|
||||
|
||||
if (!strcasecmp(feature,"race"))
|
||||
Race = setting;
|
||||
else if (!strcasecmp(feature,"gender"))
|
||||
Gender = setting;
|
||||
else if (!strcasecmp(feature,"texture"))
|
||||
Texture = setting;
|
||||
else if (!strcasecmp(feature,"helm"))
|
||||
HelmTexture = setting;
|
||||
else if (!strcasecmp(feature,"haircolor"))
|
||||
HairColor = setting;
|
||||
else if (!strcasecmp(feature,"beardcolor"))
|
||||
BeardColor = setting;
|
||||
else if (!strcasecmp(feature,"eyecolor1"))
|
||||
EyeColor1 = setting;
|
||||
else if (!strcasecmp(feature,"eyecolor2"))
|
||||
EyeColor2 = setting;
|
||||
else if (!strcasecmp(feature,"hair"))
|
||||
HairStyle = setting;
|
||||
else if (!strcasecmp(feature,"face"))
|
||||
LuclinFace = setting;
|
||||
else if (!strcasecmp(feature,"beard"))
|
||||
Beard = setting;
|
||||
else if (!strcasecmp(feature,"heritage"))
|
||||
DrakkinHeritage = setting;
|
||||
else if (!strcasecmp(feature,"tattoo"))
|
||||
DrakkinTattoo = setting;
|
||||
else if (!strcasecmp(feature,"details"))
|
||||
DrakkinDetails = setting;
|
||||
else if (!strcasecmp(feature,"size"))
|
||||
Size = (float)setting / 10; //dividing by 10 to allow 1 decimal place for adjusting size
|
||||
else
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendIllusionPacket(Race, Gender, Texture, HelmTexture, HairColor, BeardColor,
|
||||
EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF,
|
||||
DrakkinHeritage, DrakkinTattoo, DrakkinDetails, Size);
|
||||
uint16 Race = initiator->GetRace();
|
||||
uint8 Gender = initiator->GetGender();
|
||||
uint8 Texture = 0xFF;
|
||||
uint8 HelmTexture = 0xFF;
|
||||
uint8 HairColor = initiator->GetHairColor();
|
||||
uint8 BeardColor = initiator->GetBeardColor();
|
||||
uint8 EyeColor1 = initiator->GetEyeColor1();
|
||||
uint8 EyeColor2 = initiator->GetEyeColor2();
|
||||
uint8 HairStyle = initiator->GetHairStyle();
|
||||
uint8 LuclinFace = initiator->GetLuclinFace();
|
||||
uint8 Beard = initiator->GetBeard();
|
||||
uint32 DrakkinHeritage = initiator->GetDrakkinHeritage();
|
||||
uint32 DrakkinTattoo = initiator->GetDrakkinTattoo();
|
||||
uint32 DrakkinDetails = initiator->GetDrakkinDetails();
|
||||
float Size = initiator->GetSize();
|
||||
|
||||
if (!strcasecmp(feature, "race")) {
|
||||
Race = setting;
|
||||
} else if (!strcasecmp(feature, "gender")) {
|
||||
Gender = setting;
|
||||
} else if (!strcasecmp(feature, "texture")) {
|
||||
Texture = setting;
|
||||
} else if (!strcasecmp(feature, "helm")) {
|
||||
HelmTexture = setting;
|
||||
} else if (!strcasecmp(feature, "haircolor")) {
|
||||
HairColor = setting;
|
||||
} else if (!strcasecmp(feature, "beardcolor")) {
|
||||
BeardColor = setting;
|
||||
} else if (!strcasecmp(feature, "eyecolor1")) {
|
||||
EyeColor1 = setting;
|
||||
} else if (!strcasecmp(feature, "eyecolor2")) {
|
||||
EyeColor2 = setting;
|
||||
} else if (!strcasecmp(feature, "hair")) {
|
||||
HairStyle = setting;
|
||||
} else if (!strcasecmp(feature, "face")) {
|
||||
LuclinFace = setting;
|
||||
} else if (!strcasecmp(feature, "beard")) {
|
||||
Beard = setting;
|
||||
} else if (!strcasecmp(feature, "heritage")) {
|
||||
DrakkinHeritage = setting;
|
||||
} else if (!strcasecmp(feature, "tattoo")) {
|
||||
DrakkinTattoo = setting;
|
||||
} else if (!strcasecmp(feature, "details")) {
|
||||
DrakkinDetails = setting;
|
||||
} else if (!strcasecmp(feature, "size")) {
|
||||
Size = (float) setting / 10; //dividing by 10 to allow 1 decimal place for adjusting size
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendIllusionPacket(
|
||||
Race,
|
||||
Gender,
|
||||
Texture,
|
||||
HelmTexture,
|
||||
HairColor,
|
||||
BeardColor,
|
||||
EyeColor1,
|
||||
EyeColor2,
|
||||
HairStyle,
|
||||
LuclinFace,
|
||||
Beard,
|
||||
0xFF,
|
||||
DrakkinHeritage,
|
||||
DrakkinTattoo,
|
||||
DrakkinDetails,
|
||||
Size
|
||||
);
|
||||
}
|
||||
|
||||
void QuestManager::npcfeature(const char* feature, int setting)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
uint16 Race = owner->GetRace();
|
||||
uint8 Gender = owner->GetGender();
|
||||
uint8 Texture = owner->GetTexture();
|
||||
uint8 HelmTexture = owner->GetHelmTexture();
|
||||
uint8 HairColor = owner->GetHairColor();
|
||||
uint8 BeardColor = owner->GetBeardColor();
|
||||
uint8 EyeColor1 = owner->GetEyeColor1();
|
||||
uint8 EyeColor2 = owner->GetEyeColor2();
|
||||
uint8 HairStyle = owner->GetHairStyle();
|
||||
uint8 LuclinFace = owner->GetLuclinFace();
|
||||
uint8 Beard = owner->GetBeard();
|
||||
uint32 DrakkinHeritage = owner->GetDrakkinHeritage();
|
||||
uint32 DrakkinTattoo = owner->GetDrakkinTattoo();
|
||||
uint32 DrakkinDetails = owner->GetDrakkinDetails();
|
||||
float Size = owner->GetSize();
|
||||
|
||||
if (!strcasecmp(feature,"race"))
|
||||
Race = setting;
|
||||
else if (!strcasecmp(feature,"gender"))
|
||||
Gender = setting;
|
||||
else if (!strcasecmp(feature,"texture"))
|
||||
Texture = setting;
|
||||
else if (!strcasecmp(feature,"helm"))
|
||||
HelmTexture = setting;
|
||||
else if (!strcasecmp(feature,"haircolor"))
|
||||
HairColor = setting;
|
||||
else if (!strcasecmp(feature,"beardcolor"))
|
||||
BeardColor = setting;
|
||||
else if (!strcasecmp(feature,"eyecolor1"))
|
||||
EyeColor1 = setting;
|
||||
else if (!strcasecmp(feature,"eyecolor2"))
|
||||
EyeColor2 = setting;
|
||||
else if (!strcasecmp(feature,"hair"))
|
||||
HairStyle = setting;
|
||||
else if (!strcasecmp(feature,"face"))
|
||||
LuclinFace = setting;
|
||||
else if (!strcasecmp(feature,"beard"))
|
||||
Beard = setting;
|
||||
else if (!strcasecmp(feature,"heritage"))
|
||||
DrakkinHeritage = setting;
|
||||
else if (!strcasecmp(feature,"tattoo"))
|
||||
DrakkinTattoo = setting;
|
||||
else if (!strcasecmp(feature,"details"))
|
||||
DrakkinDetails = setting;
|
||||
else if (!strcasecmp(feature,"size"))
|
||||
Size = (float)setting / 10; //dividing by 10 to allow 1 decimal place for adjusting size
|
||||
else
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendIllusionPacket(Race, Gender, Texture, HelmTexture, HairColor, BeardColor,
|
||||
EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF,
|
||||
DrakkinHeritage, DrakkinTattoo, DrakkinDetails, Size);
|
||||
uint16 Race = owner->GetRace();
|
||||
uint8 Gender = owner->GetGender();
|
||||
uint8 Texture = owner->GetTexture();
|
||||
uint8 HelmTexture = owner->GetHelmTexture();
|
||||
uint8 HairColor = owner->GetHairColor();
|
||||
uint8 BeardColor = owner->GetBeardColor();
|
||||
uint8 EyeColor1 = owner->GetEyeColor1();
|
||||
uint8 EyeColor2 = owner->GetEyeColor2();
|
||||
uint8 HairStyle = owner->GetHairStyle();
|
||||
uint8 LuclinFace = owner->GetLuclinFace();
|
||||
uint8 Beard = owner->GetBeard();
|
||||
uint32 DrakkinHeritage = owner->GetDrakkinHeritage();
|
||||
uint32 DrakkinTattoo = owner->GetDrakkinTattoo();
|
||||
uint32 DrakkinDetails = owner->GetDrakkinDetails();
|
||||
float Size = owner->GetSize();
|
||||
|
||||
if (!strcasecmp(feature, "race")) {
|
||||
Race = setting;
|
||||
} else if (!strcasecmp(feature, "gender")) {
|
||||
Gender = setting;
|
||||
} else if (!strcasecmp(feature, "texture")) {
|
||||
Texture = setting;
|
||||
} else if (!strcasecmp(feature, "helm")) {
|
||||
HelmTexture = setting;
|
||||
} else if (!strcasecmp(feature, "haircolor")) {
|
||||
HairColor = setting;
|
||||
} else if (!strcasecmp(feature, "beardcolor")) {
|
||||
BeardColor = setting;
|
||||
} else if (!strcasecmp(feature, "eyecolor1")) {
|
||||
EyeColor1 = setting;
|
||||
} else if (!strcasecmp(feature, "eyecolor2")) {
|
||||
EyeColor2 = setting;
|
||||
} else if (!strcasecmp(feature, "hair")) {
|
||||
HairStyle = setting;
|
||||
} else if (!strcasecmp(feature, "face")) {
|
||||
LuclinFace = setting;
|
||||
} else if (!strcasecmp(feature, "beard")) {
|
||||
Beard = setting;
|
||||
} else if (!strcasecmp(feature, "heritage")) {
|
||||
DrakkinHeritage = setting;
|
||||
} else if (!strcasecmp(feature, "tattoo")) {
|
||||
DrakkinTattoo = setting;
|
||||
} else if (!strcasecmp(feature, "details")) {
|
||||
DrakkinDetails = setting;
|
||||
} else if (!strcasecmp(feature, "size")) {
|
||||
Size = (float) setting / 10; //dividing by 10 to allow 1 decimal place for adjusting size
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendIllusionPacket(
|
||||
Race,
|
||||
Gender,
|
||||
Texture,
|
||||
HelmTexture,
|
||||
HairColor,
|
||||
BeardColor,
|
||||
EyeColor1,
|
||||
EyeColor2,
|
||||
HairStyle,
|
||||
LuclinFace,
|
||||
Beard,
|
||||
0xFF,
|
||||
DrakkinHeritage,
|
||||
DrakkinTattoo,
|
||||
DrakkinDetails,
|
||||
Size
|
||||
);
|
||||
}
|
||||
|
||||
void QuestManager::popup(const char *title, const char *text, uint32 popupid, uint32 buttons, uint32 Duration)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
if(initiator)
|
||||
initiator->SendPopupToClient(title, text, popupid, buttons, Duration);
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->SendPopupToClient(title, text, popupid, buttons, Duration);
|
||||
}
|
||||
|
||||
int QuestManager::createbotcount(uint8 class_id) {
|
||||
@ -2753,47 +2918,40 @@ void QuestManager::whisper(const char *message) {
|
||||
int QuestManager::getlevel(uint8 type)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (type == 0)
|
||||
{
|
||||
return (initiator->GetLevel());
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
Group *g = entity_list.GetGroupByClient(initiator);
|
||||
if (g != nullptr)
|
||||
return (g->GetAvgLevel());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if(type == 2)
|
||||
{
|
||||
Raid *r = entity_list.GetRaidByClient(initiator);
|
||||
if (r != nullptr)
|
||||
return (r->GetAvgLevel());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if(type == 3)
|
||||
{
|
||||
Raid *r = entity_list.GetRaidByClient(initiator);
|
||||
if(r != nullptr)
|
||||
{
|
||||
return (r->GetAvgLevel());
|
||||
}
|
||||
Group *g = entity_list.GetGroupByClient(initiator);
|
||||
if(g != nullptr)
|
||||
{
|
||||
return (g->GetAvgLevel());
|
||||
}
|
||||
else
|
||||
return (initiator->GetLevel());
|
||||
}
|
||||
else if(type == 4)
|
||||
{
|
||||
return (initiator->CastToClient()->GetLevel2());
|
||||
}
|
||||
else
|
||||
|
||||
if (!initiator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (type == 0) {
|
||||
return initiator->GetLevel();
|
||||
} else if (type == 1) {
|
||||
if (Group *g = entity_list.GetGroupByClient(initiator)) {
|
||||
return g->GetAvgLevel();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (Raid *r = entity_list.GetRaidByClient(initiator)) {
|
||||
return r->GetAvgLevel();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (type == 3) {
|
||||
if (Raid *r = entity_list.GetRaidByClient(initiator)) {
|
||||
return r->GetAvgLevel();
|
||||
}
|
||||
|
||||
if (Group *g = entity_list.GetGroupByClient(initiator)) {
|
||||
return g->GetAvgLevel();
|
||||
} else {
|
||||
return initiator->GetLevel();
|
||||
}
|
||||
} else if (type == 4) {
|
||||
return initiator->CastToClient()->GetLevel2();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 QuestManager::CreateGroundObject(uint32 itemid, const glm::vec4& position, uint32 decay_time)
|
||||
@ -2818,36 +2976,33 @@ void QuestManager::ModifyNPCStat(std::string stat, std::string value)
|
||||
}
|
||||
}
|
||||
|
||||
int QuestManager::collectitems_processSlot(int16 slot_id, uint32 item_id,
|
||||
bool remove)
|
||||
{
|
||||
int QuestManager::collectitems_processSlot(
|
||||
int16 slot_id,
|
||||
uint32 item_id,
|
||||
bool remove
|
||||
) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
EQ::ItemInstance *item = nullptr;
|
||||
int quantity = 0;
|
||||
|
||||
item = initiator->GetInv().GetItem(slot_id);
|
||||
|
||||
// If we have found matching item, add quantity
|
||||
if (item && item->GetID() == item_id)
|
||||
{
|
||||
// If item is stackable, add its charges (quantity)
|
||||
if (item->IsStackable())
|
||||
{
|
||||
quantity = item->GetCharges();
|
||||
}
|
||||
else
|
||||
{
|
||||
quantity = 1;
|
||||
}
|
||||
|
||||
// Remove item from inventory
|
||||
if (remove)
|
||||
{
|
||||
initiator->DeleteItemInInventory(slot_id, 0, true);
|
||||
}
|
||||
if (!initiator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return quantity;
|
||||
const auto item = initiator->GetInv().GetItem(slot_id);
|
||||
|
||||
// If we have found matching item, add quantity
|
||||
if (item && item->GetID() == item_id) {
|
||||
// If item is stackable, add its charges (quantity)
|
||||
const auto quantity = item->IsStackable() ? item->GetCharges() : 1;
|
||||
|
||||
// Remove item from inventory
|
||||
if (remove) {
|
||||
initiator->DeleteItemInInventory(slot_id, 0, true);
|
||||
}
|
||||
|
||||
return quantity;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns number of item_id that exist in inventory
|
||||
@ -2857,13 +3012,11 @@ int QuestManager::collectitems(uint32 item_id, bool remove)
|
||||
int quantity = 0;
|
||||
int slot_id;
|
||||
|
||||
for (slot_id = EQ::invslot::GENERAL_BEGIN; slot_id <= EQ::invslot::GENERAL_END; ++slot_id)
|
||||
{
|
||||
for (slot_id = EQ::invslot::GENERAL_BEGIN; slot_id <= EQ::invslot::GENERAL_END; ++slot_id) {
|
||||
quantity += collectitems_processSlot(slot_id, item_id, remove);
|
||||
}
|
||||
|
||||
for (slot_id = EQ::invbag::GENERAL_BAGS_BEGIN; slot_id <= EQ::invbag::GENERAL_BAGS_END; ++slot_id)
|
||||
{
|
||||
for (slot_id = EQ::invbag::GENERAL_BAGS_BEGIN; slot_id <= EQ::invbag::GENERAL_BAGS_END; ++slot_id) {
|
||||
quantity += collectitems_processSlot(slot_id, item_id, remove);
|
||||
}
|
||||
|
||||
@ -2872,11 +3025,21 @@ int QuestManager::collectitems(uint32 item_id, bool remove)
|
||||
|
||||
int QuestManager::countitem(uint32 item_id) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return initiator->CountItem(item_id);
|
||||
}
|
||||
|
||||
void QuestManager::removeitem(uint32 item_id, uint32 quantity) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->RemoveItem(item_id, quantity);
|
||||
}
|
||||
|
||||
@ -3321,9 +3484,17 @@ uint8 QuestManager::FactionValue()
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
FACTION_VALUE oldfac;
|
||||
uint8 newfac = 0;
|
||||
if(initiator && owner->IsNPC()) {
|
||||
oldfac = initiator->GetFactionLevel(initiator->GetID(), owner->GetID(), initiator->GetFactionRace(), initiator->GetClass(), initiator->GetDeity(), owner->GetPrimaryFaction(), owner);
|
||||
uint8 newfac = 0;
|
||||
if (initiator && owner && owner->IsNPC()) {
|
||||
oldfac = initiator->GetFactionLevel(
|
||||
initiator->GetID(),
|
||||
owner->GetID(),
|
||||
initiator->GetFactionRace(),
|
||||
initiator->GetClass(),
|
||||
initiator->GetDeity(),
|
||||
owner->GetPrimaryFaction(),
|
||||
owner
|
||||
);
|
||||
|
||||
// now, reorder the faction to have it make sense (higher values are better)
|
||||
switch (oldfac) {
|
||||
@ -3362,62 +3533,76 @@ uint8 QuestManager::FactionValue()
|
||||
|
||||
void QuestManager::enabletitle(int titleset) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->EnableTitle(titleset);
|
||||
}
|
||||
|
||||
bool QuestManager::checktitle(int titleset) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
return initiator ? initiator->CheckTitle(titleset) : false;
|
||||
|
||||
if (!initiator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return initiator->CheckTitle(titleset);
|
||||
}
|
||||
|
||||
void QuestManager::removetitle(int titleset) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
if (!initiator) {
|
||||
return;
|
||||
}
|
||||
|
||||
initiator->RemoveTitle(titleset);
|
||||
}
|
||||
|
||||
void QuestManager::wearchange(uint8 slot, uint16 texture, uint32 hero_forge_model /*= 0*/, uint32 elite_material /*= 0*/)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
if(owner){
|
||||
owner->SendTextureWC(slot, texture, hero_forge_model, elite_material);
|
||||
if(owner->IsNPC()) {
|
||||
owner->CastToNPC()->NPCSlotTexture(slot, texture);
|
||||
}
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner->SendTextureWC(slot, texture, hero_forge_model, elite_material);
|
||||
if (owner->IsNPC()) {
|
||||
owner->CastToNPC()->NPCSlotTexture(slot, texture);
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::voicetell(const char *str, int macronum, int racenum, int gendernum)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
if(owner && str)
|
||||
{
|
||||
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (str) {
|
||||
Client *c = entity_list.GetClientByName(str);
|
||||
|
||||
if(c)
|
||||
{
|
||||
if (c) {
|
||||
auto outapp = new EQApplicationPacket(OP_VoiceMacroOut, sizeof(VoiceMacroOut_Struct));
|
||||
|
||||
VoiceMacroOut_Struct* vmo = (VoiceMacroOut_Struct*)outapp->pBuffer;
|
||||
|
||||
auto* vmo = (VoiceMacroOut_Struct *) outapp->pBuffer;
|
||||
strn0cpy(vmo->From, owner->GetCleanName(), sizeof(vmo->From));
|
||||
|
||||
vmo->Type = 1;
|
||||
|
||||
vmo->Voice = (racenum * 2) + gendernum;
|
||||
|
||||
vmo->Type = 1;
|
||||
vmo->Voice = (racenum * 2) + gendernum;
|
||||
vmo->MacroNumber = macronum;
|
||||
|
||||
c->QueuePacket(outapp);
|
||||
|
||||
safe_delete(outapp);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
LogQuests("from [{}]. Client [{}] not found", owner->GetName(), str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::SendMail(const char *to, const char *from, const char *subject, const char *message) {
|
||||
if(to == nullptr || from == nullptr || subject == nullptr || message == nullptr) {
|
||||
if (!to || !from || !subject || !message) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user