Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository

This commit is contained in:
Akkadius
2020-04-06 02:55:46 -05:00
34 changed files with 1497 additions and 144 deletions
+8
View File
@@ -4018,6 +4018,14 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
//Message(Chat::Red, "You cant cast right now, you arent in control of yourself!");
return;
}
// Hack for broken RoF2 which allows casting after a zoned IVU/IVA
if (invisible_undead || invisible_animals) {
BuffFadeByEffect(SE_InvisVsAnimals);
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
BuffFadeByEffect(SE_Invisibility); // Included per JJ for completeness - client handles this one atm
}
CastSpell_Struct* castspell = (CastSpell_Struct*)app->pBuffer;
+141 -2
View File
@@ -196,6 +196,7 @@ int command_init(void)
command_add("disarmtrap", "Analog for ldon disarm trap for the newer clients since we still don't have it working.", 80, command_disarmtrap) ||
command_add("distance", "- Reports the distance between you and your target.", 80, command_distance) ||
command_add("doanim", "[animnum] [type] - Send an EmoteAnim for you or your target", 50, command_doanim) ||
command_add("editmassrespawn", "[name-search] [second-value] - Mass (Zone wide) NPC respawn timer editing command", 100, command_editmassrespawn) ||
command_add("emote", "['name'/'world'/'zone'] [type] [message] - Send an emote message", 80, command_emote) ||
command_add("emotesearch", "Searches NPC Emotes", 80, command_emotesearch) ||
command_add("emoteview", "Lists all NPC Emotes", 80, command_emoteview) ||
@@ -6497,6 +6498,144 @@ void command_doanim(Client *c, const Seperator *sep)
c->DoAnim(atoi(sep->arg[1]),atoi(sep->arg[2]));
}
void command_editmassrespawn(Client* c, const Seperator* sep)
{
if (strcasecmp(sep->arg[1], "usage") == 0) {
c->Message(Chat::White, "#editmassrespawn [exact_match: =]npc_type_name new_respawn_seconds (apply)");
return;
}
std::string search_npc_type;
if (sep->arg[1]) {
search_npc_type = sep->arg[1];
}
int change_respawn_seconds = 0;
if (sep->arg[2] && sep->IsNumber(2)) {
change_respawn_seconds = atoi(sep->arg[2]);
}
bool change_apply = false;
if (sep->arg[3] && strcasecmp(sep->arg[3], "apply") == 0) {
change_apply = true;
}
std::string search_encapsulator = "%";
if (search_npc_type[0] == '=') {
search_npc_type = search_npc_type.substr(1);
search_encapsulator = "";
}
std::string query = fmt::format(
SQL(
SELECT npc_types.id, spawn2.spawngroupID, spawn2.id, npc_types.name, spawn2.respawntime
FROM spawn2
INNER JOIN spawnentry ON spawn2.spawngroupID = spawnentry.spawngroupID
INNER JOIN npc_types ON spawnentry.npcID = npc_types.id
WHERE spawn2.zone LIKE '{}'
AND spawn2.version = '{}'
AND npc_types.name LIKE '{}{}{}'
ORDER BY npc_types.id, spawn2.spawngroupID, spawn2.id
),
zone->GetShortName(),
zone->GetInstanceVersion(),
search_encapsulator,
search_npc_type,
search_encapsulator
);
std::string status = "(Searching)";
if (change_apply) {
status = "(Applying)";
}
int results_count = 0;
auto results = database.QueryDatabase(query);
if (results.Success() && results.RowCount()) {
results_count = results.RowCount();
for (auto row : results) {
c->Message(
Chat::Yellow,
fmt::format(
"NPC (npcid:{}) (sgid:{}) (s2id:{}) [{}] Respawn: Current [{}] New [{}] {}",
row[0],
row[1],
row[2],
row[3],
row[4],
change_respawn_seconds,
status
).c_str()
);
}
c->Message(Chat::Yellow, "Found (%i) NPC's that match this search...", results_count);
if (change_respawn_seconds > 0) {
if (change_apply) {
results = database.QueryDatabase(
fmt::format(
SQL(
UPDATE spawn2
SET respawntime = '{}'
WHERE id IN (
SELECT spawn2.id
FROM spawn2
INNER JOIN spawnentry ON spawn2.spawngroupID = spawnentry.spawngroupID
INNER JOIN npc_types ON spawnentry.npcID = npc_types.id
WHERE spawn2.zone LIKE '{}'
AND spawn2.version = '{}'
AND npc_types.name LIKE '{}{}{}'
)
),
change_respawn_seconds,
zone->GetShortName(),
zone->GetInstanceVersion(),
search_encapsulator,
search_npc_type,
search_encapsulator
)
);
if (results.Success()) {
c->Message(Chat::Yellow, "Changes applied to (%i) NPC 'Spawn2' entries", results_count);
zone->Repop();
}
else {
c->Message(Chat::Yellow, "Found (0) NPC's that match this search...");
}
}
else {
std::string saylink = fmt::format(
"#editmassrespawn {}{} {} apply",
(search_encapsulator.empty() ? "=" : ""),
search_npc_type,
change_respawn_seconds
);
c->Message(
Chat::Yellow, "To apply these changes, click <%s> or type [%s]",
EQEmu::SayLinkEngine::GenerateQuestSaylink(saylink, false, "Apply").c_str(),
saylink.c_str()
);
}
}
}
else {
c->Message(Chat::Yellow, "Found (0) NPC's that match this search...");
}
}
void command_randomfeatures(Client *c, const Seperator *sep)
{
Mob *target=c->GetTarget();
@@ -7807,7 +7946,7 @@ void command_npcemote(Client *c, const Seperator *sep)
void command_npceditmass(Client *c, const Seperator *sep)
{
if (strcasecmp(sep->arg[1], "usage") == 0) {
c->Message(Chat::White, "#npceditmass search_column [exact_match: =]search_value change_column change_value");
c->Message(Chat::White, "#npceditmass search_column [exact_match: =]search_value change_column change_value (apply)");
return;
}
@@ -7955,7 +8094,7 @@ void command_npceditmass(Client *c, const Seperator *sep)
std::string saylink = fmt::format(
"#npceditmass {} {}{} {} {} apply",
search_column,
(exact_match ? '=' : '\0'),
(exact_match ? "=" : ""),
search_value,
change_column,
change_value
+1
View File
@@ -91,6 +91,7 @@ void command_disablerecipe(Client *c, const Seperator *sep);
void command_disarmtrap(Client *c, const Seperator *sep);
void command_distance(Client *c, const Seperator *sep);
void command_doanim(Client *c, const Seperator *sep);
void command_editmassrespawn(Client* c, const Seperator* sep);
void command_emote(Client *c, const Seperator *sep);
void command_emotesearch(Client* c, const Seperator *sep);
void command_emoteview(Client* c, const Seperator *sep);
+191 -1
View File
@@ -822,6 +822,54 @@ XS(XS__isdisctome) {
XSRETURN(1);
}
XS(XS__getracename);
XS(XS__getracename) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getracename(uint16 race_id)");
dXSTARG;
uint16 race_id = (int) SvIV(ST(0));
std::string race_name = quest_manager.getracename(race_id);
sv_setpv(TARG, race_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__getspellname);
XS(XS__getspellname) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getspellname(uint32 spell_id)");
dXSTARG;
uint32 spell_id = (int) SvIV(ST(0));
std::string spell_name = quest_manager.getspellname(spell_id);
sv_setpv(TARG, spell_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__getskillname);
XS(XS__getskillname) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getskillname(int skill_id)");
dXSTARG;
int skill_id = (int) SvIV(ST(0));
std::string skill_name = quest_manager.getskillname(skill_id);
sv_setpv(TARG, skill_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__safemove);
XS(XS__safemove) {
dXSARGS;
@@ -2342,7 +2390,6 @@ XS(XS__updatetaskactivity) {
XS(XS__resettaskactivity);
XS(XS__resettaskactivity) {
dXSARGS;
unsigned int task, activity;
if (items == 2) {
int task_id = (int) SvIV(ST(0));
int activity_id = (int) SvIV(ST(1));
@@ -2613,6 +2660,23 @@ XS(XS__istaskappropriate) {
XSRETURN(1);
}
XS(XS__gettaskname);
XS(XS__gettaskname) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: quest::gettaskname(uint32 task_id)");
}
dXSTARG;
uint32 task_id = (int) SvIV(ST(0));
std::string task_name = quest_manager.gettaskname(task_id);
sv_setpv(TARG, task_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__popup); // prototype to pass -Wmissing-prototypes
XS(XS__popup) {
dXSARGS;
@@ -2797,6 +2861,51 @@ XS(XS__collectitems) {
XSRETURN_IV(quantity);
}
XS(XS__countitem);
XS(XS__countitem) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::countitem(int item_id)");
uint32 item_id = (int) SvIV(ST(0));
int quantity = quest_manager.countitem(item_id);
XSRETURN_IV(quantity);
}
XS(XS__getitemname);
XS(XS__getitemname) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getitemname(uint32 item_id)");
dXSTARG;
uint32 item_id = (int) SvIV(ST(0));
std::string item_name = quest_manager.getitemname(item_id);
sv_setpv(TARG, item_name.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__getnpcnamebyid);
XS(XS__getnpcnamebyid) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getnpcnamebyid(uint32 npc_id)");
dXSTARG;
uint32 npc_id = (int) SvIV(ST(0));
const char *npc_name = quest_manager.getnpcnamebyid(npc_id);
sv_setpv(TARG, npc_name);
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
XS(XS__UpdateSpawnTimer);
XS(XS__UpdateSpawnTimer) {
dXSARGS;
@@ -3063,6 +3172,25 @@ XS(XS__RemoveFromInstanceByCharID) {
XSRETURN_EMPTY;
}
XS(XS__CheckInstanceByCharID);
XS(XS__CheckInstanceByCharID) {
dXSARGS;
if (items != 2) {
Perl_croak(aTHX_ "Usage: quest::CheckInstanceByCharID(uint16 instance_id, uint32 char_id)");
}
bool RETVAL;
dXSTARG;
uint16 instance_id = (int) SvUV(ST(0));
uint32 char_id = (int) SvUV(ST(1));
RETVAL = quest_manager.CheckInstanceByCharID(instance_id, char_id);
XSprePUSH;
PUSHu((IV) RETVAL);
XSRETURN(1);
}
XS(XS__RemoveAllFromInstance);
XS(XS__RemoveAllFromInstance) {
dXSARGS;
@@ -3151,6 +3279,57 @@ XS(XS__saylink) {
XSRETURN(1);
}
XS(XS__getcharnamebyid);
XS(XS__getcharnamebyid) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getcharnamebyid(uint32 char_id)");
dXSTARG;
Const_char *RETVAL;
uint32 char_id = (int) SvUV(ST(0));
RETVAL = quest_manager.getcharnamebyid(char_id);
sv_setpv(TARG, RETVAL);
XSprePUSH;
PUSHTARG;
}
XS(XS__getcharidbyname);
XS(XS__getcharidbyname) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getcharidbyname(string name)");
dXSTARG;
uint32 RETVAL;
const char *name = (const char *) SvPV_nolen(ST(0));
RETVAL = quest_manager.getcharidbyname(name);
XSprePUSH;
PUSHu((UV)RETVAL);
XSRETURN(1);
}
XS(XS__getcurrencyid);
XS(XS__getcurrencyid) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getcurrencyid(uint32 item_id)");
dXSTARG;
int RETVAL;
uint32 item_id = (int) SvUV(ST(0));;
RETVAL = quest_manager.getcurrencyid(item_id);
XSprePUSH;
PUSHi((IV)RETVAL);
XSRETURN(1);
}
XS(XS__getguildnamebyid);
XS(XS__getguildnamebyid) {
dXSARGS;
@@ -3927,6 +4106,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file);
newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file);
newXS(strcpy(buf, "RemoveFromInstanceByCharID"), XS__RemoveFromInstanceByCharID, file);
newXS(strcpy(buf, "CheckInstanceByCharID"), XS__CheckInstanceByCharID, file);
newXS(strcpy(buf, "SendMail"), XS__SendMail, file);
newXS(strcpy(buf, "SetRunning"), XS__SetRunning, file);
newXS(strcpy(buf, "activespeakactivity"), XS__activespeakactivity, file);
@@ -3951,6 +4131,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "clearspawntimers"), XS__clearspawntimers, file);
newXS(strcpy(buf, "collectitems"), XS__collectitems, file);
newXS(strcpy(buf, "completedtasksinset"), XS__completedtasksinset, file);
newXS(strcpy(buf, "countitem"), XS__countitem, file);
newXS(strcpy(buf, "createdoor"), XS__CreateDoor, file);
newXS(strcpy(buf, "creategroundobject"), XS__CreateGroundObject, file);
newXS(strcpy(buf, "creategroundobjectfrommodel"), XS__CreateGroundObjectFromModel, file);
@@ -3990,18 +4171,27 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "follow"), XS__follow, file);
newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file);
newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file);
newXS(strcpy(buf, "getcharidbyname"), XS__getcharidbyname, file);
newXS(strcpy(buf, "getcurrencyid"), XS__getcurrencyid, file);
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
newXS(strcpy(buf, "getitemname"), XS__getitemname, file);
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
newXS(strcpy(buf, "getnpcnamebyid"), XS__getnpcnamebyid, file);
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
newXS(strcpy(buf, "getcharnamebyid"), XS__getcharnamebyid, file);
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file);
newXS(strcpy(buf, "getgroupidbycharid"), XS__getgroupidbycharid, file);
newXS(strcpy(buf, "getraididbycharid"), XS__getraididbycharid, file);
newXS(strcpy(buf, "getracename"), XS__getracename, file);
newXS(strcpy(buf, "getspellname"), XS__getspellname, file);
newXS(strcpy(buf, "getskillname"), XS__getskillname, file);
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);
newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file);
newXS(strcpy(buf, "getplayercorpsecountbyzoneid"), XS__getplayercorpsecountbyzoneid, file);
newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file);
newXS(strcpy(buf, "gettaskname"), XS__gettaskname, file);
newXS(strcpy(buf, "givecash"), XS__givecash, file);
newXS(strcpy(buf, "gmmove"), XS__gmmove, file);
newXS(strcpy(buf, "gmsay"), XS__gmsay, file);
+55
View File
@@ -393,6 +393,18 @@ bool lua_is_disc_tome(int item_id) {
return quest_manager.isdisctome(item_id);
}
std::string lua_get_race_name(uint32 race_id) {
return quest_manager.getracename(race_id);
}
std::string lua_get_spell_name(uint32 spell_id) {
return quest_manager.getspellname(spell_id);
}
std::string lua_get_skill_name(int skill_id) {
return quest_manager.getskillname(skill_id);
}
void lua_safe_move() {
quest_manager.safemove();
}
@@ -729,6 +741,10 @@ bool lua_is_task_appropriate(int task) {
return quest_manager.istaskappropriate(task);
}
std::string lua_get_task_name(uint32 task_id) {
return quest_manager.gettaskname(task_id);
}
void lua_popup(const char *title, const char *text, uint32 id, uint32 buttons, uint32 duration) {
quest_manager.popup(title, text, id, buttons, duration);
}
@@ -781,6 +797,10 @@ int lua_collect_items(uint32 item_id, bool remove) {
return quest_manager.collectitems(item_id, remove);
}
int lua_count_item(uint32 item_id) {
return quest_manager.countitem(item_id);
}
void lua_update_spawn_timer(uint32 id, uint32 new_time) {
quest_manager.UpdateSpawnTimer(id, new_time);
}
@@ -803,6 +823,10 @@ std::string lua_item_link(int item_id) {
return quest_manager.varlink(text, item_id);
}
std::string lua_get_item_name(uint32 item_id) {
return quest_manager.getitemname(item_id);
}
std::string lua_say_link(const char *phrase, bool silent, const char *link_name) {
char text[256] = { 0 };
strncpy(text, phrase, 255);
@@ -854,6 +878,18 @@ bool lua_delete_data(std::string bucket_key) {
return DataBucket::DeleteData(bucket_key);
}
const char *lua_get_char_name_by_id(uint32 char_id) {
return database.GetCharNameByID(char_id);
}
uint32 lua_get_char_id_by_name(const char* name) {
return quest_manager.getcharidbyname(name);
}
int lua_get_currency_id(uint32 item_id) {
return quest_manager.getcurrencyid(item_id);
}
const char *lua_get_guild_name_by_id(uint32 guild_id) {
return quest_manager.getguildnamebyid(guild_id);
}
@@ -866,6 +902,10 @@ int lua_get_group_id_by_char_id(uint32 char_id) {
return database.GetGroupIDByCharID(char_id);
}
const char *lua_get_npc_name_by_id(uint32 npc_id) {
return quest_manager.getnpcnamebyid(npc_id);
}
int lua_get_raid_id_by_char_id(uint32 char_id) {
return database.GetRaidIDByCharID(char_id);
}
@@ -922,6 +962,10 @@ void lua_remove_from_instance_by_char_id(uint32 instance_id, uint32 char_id) {
quest_manager.RemoveFromInstanceByCharID(instance_id, char_id);
}
bool lua_check_instance_by_char_id(uint32 instance_id, uint32 char_id) {
return quest_manager.CheckInstanceByCharID(instance_id, char_id);
}
void lua_remove_all_from_instance(uint32 instance_id) {
quest_manager.RemoveAllFromInstance(instance_id);
}
@@ -1644,6 +1688,9 @@ luabind::scope lua_register_general() {
luabind::def("depop_zone", &lua_depop_zone),
luabind::def("repop_zone", &lua_repop_zone),
luabind::def("is_disc_tome", &lua_is_disc_tome),
luabind::def("get_race_name", (std::string(*)(uint16))&lua_get_race_name),
luabind::def("get_spell_name", (std::string(*)(uint32))&lua_get_spell_name),
luabind::def("get_skill_name", (std::string(*)(int))&lua_get_skill_name),
luabind::def("safe_move", &lua_safe_move),
luabind::def("rain", &lua_rain),
luabind::def("snow", &lua_snow),
@@ -1711,6 +1758,7 @@ luabind::scope lua_register_general() {
luabind::def("active_tasks_in_set", &lua_active_tasks_in_set),
luabind::def("completed_tasks_in_set", &lua_completed_tasks_in_set),
luabind::def("is_task_appropriate", &lua_is_task_appropriate),
luabind::def("get_task_name", (std::string(*)(uint32))&lua_get_task_name),
luabind::def("popup", &lua_popup),
luabind::def("clear_spawn_timers", &lua_clear_spawn_timers),
luabind::def("zone_emote", &lua_zone_emote),
@@ -1724,11 +1772,13 @@ luabind::scope lua_register_general() {
luabind::def("create_door", &lua_create_door),
luabind::def("modify_npc_stat", &lua_modify_npc_stat),
luabind::def("collect_items", &lua_collect_items),
luabind::def("count_item", &lua_count_item),
luabind::def("update_spawn_timer", &lua_update_spawn_timer),
luabind::def("merchant_set_item", (void(*)(uint32,uint32))&lua_merchant_set_item),
luabind::def("merchant_set_item", (void(*)(uint32,uint32,uint32))&lua_merchant_set_item),
luabind::def("merchant_count_item", &lua_merchant_count_item),
luabind::def("item_link", &lua_item_link),
luabind::def("get_item_name", (std::string(*)(uint32))&lua_get_item_name),
luabind::def("say_link", (std::string(*)(const char*,bool,const char*))&lua_say_link),
luabind::def("say_link", (std::string(*)(const char*,bool))&lua_say_link),
luabind::def("say_link", (std::string(*)(const char*))&lua_say_link),
@@ -1739,9 +1789,13 @@ luabind::scope lua_register_general() {
luabind::def("set_data", (void(*)(std::string, std::string))&lua_set_data),
luabind::def("set_data", (void(*)(std::string, std::string, std::string))&lua_set_data),
luabind::def("delete_data", (bool(*)(std::string))&lua_delete_data),
luabind::def("get_char_name_by_id", &lua_get_char_name_by_id),
luabind::def("get_char_id_by_name", (uint32(*)(const char*))&lua_get_char_id_by_name),
luabind::def("get_currency_id", &lua_get_currency_id),
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
luabind::def("get_guild_id_by_char_id", &lua_get_guild_id_by_char_id),
luabind::def("get_group_id_by_char_id", &lua_get_group_id_by_char_id),
luabind::def("get_npc_name_by_id", &lua_get_npc_name_by_id),
luabind::def("get_raid_id_by_char_id", &lua_get_raid_id_by_char_id),
luabind::def("create_instance", &lua_create_instance),
luabind::def("destroy_instance", &lua_destroy_instance),
@@ -1757,6 +1811,7 @@ luabind::scope lua_register_general() {
luabind::def("assign_raid_to_instance", &lua_assign_raid_to_instance),
luabind::def("remove_from_instance", &lua_remove_from_instance),
luabind::def("remove_from_instance_by_char_id", &lua_remove_from_instance_by_char_id),
luabind::def("check_instance_by_char_id", (bool(*)(uint16, uint32))&lua_check_instance_by_char_id),
luabind::def("remove_all_from_instance", &lua_remove_all_from_instance),
luabind::def("flag_instance_by_group_leader", &lua_flag_instance_by_group_leader),
luabind::def("flag_instance_by_raid_leader", &lua_flag_instance_by_raid_leader),
+10 -12
View File
@@ -67,6 +67,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/event/timer.h"
#include "../common/net/eqstream.h"
#include "../common/net/servertalk_server.h"
#include "../common/content/world_content_service.h"
#include <iostream>
#include <string>
@@ -93,9 +94,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#endif
#include "../common/content/world_content_service.h"
volatile bool RunLoops = true;
extern volatile bool is_zone_loaded;
@@ -609,19 +607,19 @@ int main(int argc, char** argv) {
return 0;
}
void Shutdown()
{
Zone::Shutdown(true);
LogInfo("Shutting down...");
LogSys.CloseFileLogs();
EQ::EventLoop::Get().Shutdown();
}
void CatchSignal(int sig_num) {
#ifdef _WINDOWS
LogInfo("Recieved signal: [{}]", sig_num);
#endif
RunLoops = false;
}
void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
LogInfo("Shutting down...");
LogSys.CloseFileLogs();
Shutdown();
}
/* Update Window Title with relevant information */
+7
View File
@@ -747,6 +747,13 @@ void Client::AI_Process()
RunTo(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z);
}
}
if (RuleB(Character, ProcessFearedProximity) && proximity_timer.Check()) {
entity_list.ProcessMove(this, glm::vec3(GetX(), GetY(), GetZ()));
if (RuleB(TaskSystem, EnableTaskSystem) && RuleB(TaskSystem, EnableTaskProximity))
ProcessTaskProximities(GetX(), GetY(), GetZ());
m_Proximity = glm::vec3(GetX(), GetY(), GetZ());
}
return;
}
+1 -1
View File
@@ -962,7 +962,7 @@ void NPC::Depop(bool StartSpawnTimer) {
}
bool NPC::DatabaseCastAccepted(int spell_id) {
for (int i=0; i < 12; i++) {
for (int i=0; i < EFFECT_COUNT; i++) {
switch(spells[spell_id].effectid[i]) {
case SE_Stamina: {
if(IsEngaged() && GetHPRatio() < 100)
+104
View File
@@ -906,6 +906,31 @@ bool QuestManager::isdisctome(int item_id) {
return(true);
}
std::string QuestManager::getracename(uint16 race_id) {
return GetRaceIDName(race_id);
}
std::string QuestManager::getspellname(uint32 spell_id) {
if (!IsValidSpell(spell_id)) {
return "INVALID SPELL ID IN GETSPELLNAME";
}
std::string spell_name = GetSpellName(spell_id);
return spell_name;
}
std::string QuestManager::getskillname(int skill_id) {
if (skill_id >= 0 && skill_id < EQEmu::skills::SkillCount) {
std::map<EQEmu::skills::SkillType, std::string> Skills = EQEmu::skills::GetSkillTypeMap();
for (auto skills_iter : Skills) {
if (skill_id == skills_iter.first) {
return skills_iter.second;
}
}
}
return std::string();
}
void QuestManager::safemove() {
QuestManagerCurrentQuestVars();
if (initiator && initiator->IsClient())
@@ -2432,6 +2457,16 @@ bool QuestManager::istaskappropriate(int task) {
return false;
}
std::string QuestManager::gettaskname(uint32 task_id) {
QuestManagerCurrentQuestVars();
if (RuleB(TaskSystem, EnableTaskSystem)) {
return taskmanager->GetTaskName(task_id);
}
return std::string();
}
void QuestManager::clearspawntimers() {
if(!zone)
return;
@@ -2580,6 +2615,32 @@ int QuestManager::collectitems(uint32 item_id, bool remove)
return quantity;
}
int QuestManager::countitem(uint32 item_id) {
QuestManagerCurrentQuestVars();
int quantity = 0;
EQEmu::ItemInstance *item = nullptr;
static const int16 slots[][2] = {
{ EQEmu::invslot::POSSESSIONS_BEGIN, EQEmu::invslot::POSSESSIONS_END },
{ EQEmu::invbag::GENERAL_BAGS_BEGIN, EQEmu::invbag::GENERAL_BAGS_END },
{ EQEmu::invbag::CURSOR_BAG_BEGIN, EQEmu::invbag::CURSOR_BAG_END},
{ EQEmu::invslot::BANK_BEGIN, EQEmu::invslot::BANK_END },
{ EQEmu::invbag::BANK_BAGS_BEGIN, EQEmu::invbag::BANK_BAGS_END },
{ EQEmu::invslot::SHARED_BANK_BEGIN, EQEmu::invslot::SHARED_BANK_END },
{ EQEmu::invbag::SHARED_BANK_BAGS_BEGIN, EQEmu::invbag::SHARED_BANK_BAGS_END },
};
const size_t size = sizeof(slots) / sizeof(slots[0]);
for (int slot_index = 0; slot_index < size; ++slot_index) {
for (int slot_id = slots[slot_index][0]; slot_id <= slots[slot_index][1]; ++slot_id) {
item = initiator->GetInv().GetItem(slot_id);
if (item && item->GetID() == item_id) {
quantity += item->IsStackable() ? item->GetCharges() : 1;
}
}
}
return quantity;
}
void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime)
{
bool found = false;
@@ -2670,6 +2731,23 @@ const char* QuestManager::varlink(char* perltext, int item_id) {
return perltext;
}
std::string QuestManager::getitemname(uint32 item_id) {
const EQEmu::ItemData* item_data = database.GetItem(item_id);
if (!item_data) {
return "INVALID ITEM ID IN GETITEMNAME";
}
std::string item_name = item_data->Name;
return item_name;
}
const char *QuestManager::getnpcnamebyid(uint32 npc_id) {
if (npc_id > 0) {
return database.GetNPCNameByID(npc_id);
}
return "";
}
uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 duration)
{
QuestManagerCurrentQuestVars();
@@ -2811,6 +2889,10 @@ void QuestManager::RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id
database.RemoveClientFromInstance(instance_id, char_id);
}
bool QuestManager::CheckInstanceByCharID(uint16 instance_id, uint32 char_id) {
return database.CharacterInInstanceGroup(instance_id, char_id);
}
void QuestManager::RemoveAllFromInstance(uint16 instance_id)
{
QuestManagerCurrentQuestVars();
@@ -2869,6 +2951,28 @@ std::string QuestManager::saylink(char *saylink_text, bool silent, const char *l
return EQEmu::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, link_name);
}
const char* QuestManager::getcharnamebyid(uint32 char_id) {
if (char_id > 0) {
return database.GetCharNameByID(char_id);
}
return "";
}
uint32 QuestManager::getcharidbyname(const char* name) {
return database.GetCharacterID(name);
}
int QuestManager::getcurrencyid(uint32 item_id) {
auto iter = zone->AlternateCurrencies.begin();
while (iter != zone->AlternateCurrencies.end()) {
if (item_id == (*iter).item_id) {
return (*iter).id;
}
++iter;
}
return 0;
}
const char* QuestManager::getguildnamebyid(int guild_id) {
if (guild_id > 0)
return guild_mgr.GetGuildName(guild_id);
+11
View File
@@ -107,6 +107,9 @@ public:
void level(int newlevel);
void traindisc(int discipline_tome_item_id);
bool isdisctome(int item_id);
std::string getracename(uint16 race_id);
std::string getspellname(uint32 spell_id);
std::string getskillname(int skill_id);
void safemove();
void rain(int weather);
void snow(int weather);
@@ -213,12 +216,15 @@ public:
int activetasksinset(int taskset);
int completedtasksinset(int taskset);
bool istaskappropriate(int task);
std::string gettaskname(uint32 task_id);
void clearspawntimers();
void ze(int type, const char *str);
void we(int type, const char *str);
int getlevel(uint8 type);
int collectitems(uint32 item_id, bool remove);
int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove);
int countitem(uint32 item_id);
std::string getitemname(uint32 item_id);
void enabletitle(int titleset);
bool checktitle(int titlecheck);
void removetitle(int titlecheck);
@@ -242,6 +248,7 @@ public:
void AssignRaidToInstance(uint16 instance_id);
void RemoveFromInstance(uint16 instance_id);
void RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id);
bool CheckInstanceByCharID(uint16 instance_id, uint32 char_id);
//void RemoveGroupFromInstance(uint16 instance_id); //potentially useful but not implmented at this time.
//void RemoveRaidFromInstance(uint16 instance_id); //potentially useful but not implmented at this time.
void RemoveAllFromInstance(uint16 instance_id);
@@ -250,9 +257,13 @@ public:
void FlagInstanceByRaidLeader(uint32 zone, int16 version);
const char* varlink(char* perltext, int item_id);
std::string saylink(char *saylink_text, bool silent, const char *link_name);
const char* getcharnamebyid(uint32 char_id);
uint32 getcharidbyname(const char* name);
int getcurrencyid(uint32 item_id);
const char* getguildnamebyid(int guild_id);
int getguildidbycharid(uint32 char_id);
int getgroupidbycharid(uint32 char_id);
const char* getnpcnamebyid(uint32 npc_id);
int getraididbycharid(uint32 char_id);
void SetRunning(bool val);
bool IsRunning();
+16 -4
View File
@@ -3426,6 +3426,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
bool isproc, int level_override)
{
bool is_damage_or_lifetap_spell = IsDamageSpell(spell_id) || IsLifetapSpell(spell_id);
// well we can't cast a spell on target without a target
if(!spelltar)
{
@@ -3967,9 +3969,6 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
// send to people in the area, ignoring caster and target
//live dosent send this to anybody but the caster
//entity_list.QueueCloseClients(spelltar, action_packet, true, 200, this, true, spelltar->IsClient() ? FILTER_PCSPELLS : FILTER_NPCSPELLS);
// TEMPORARY - this is the message for the spell.
// double message on effects that use ChangeHP - working on this
message_packet = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct));
CombatDamage_Struct *cd = (CombatDamage_Struct *)message_packet->pBuffer;
cd->target = action->target;
@@ -3980,7 +3979,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
cd->hit_heading = action->hit_heading;
cd->hit_pitch = action->hit_pitch;
cd->damage = 0;
if(!IsEffectInSpell(spell_id, SE_BindAffinity)){
if(!IsEffectInSpell(spell_id, SE_BindAffinity) && !is_damage_or_lifetap_spell){
entity_list.QueueCloseClients(
spelltar, /* Sender */
message_packet, /* Packet */
@@ -3990,6 +3989,19 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r
true, /* Packet ACK */
(spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells) /* Message Filter Type: (8 or 9) */
);
} else if (is_damage_or_lifetap_spell &&
(IsClient() ||
(HasOwner() &&
GetOwner()->IsClient()
)
)
) {
(HasOwner() ? GetOwner() : this)->CastToClient()->QueuePacket(
message_packet,
true,
Mob::CLIENT_CONNECTINGALL,
(spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells)
);
}
safe_delete(action_packet);
safe_delete(message_packet);
+11
View File
@@ -955,6 +955,17 @@ bool TaskManager::AppropriateLevel(int TaskID, int PlayerLevel) {
}
std::string TaskManager::GetTaskName(uint32 task_id)
{
if (task_id > 0 && task_id < MAXTASKS) {
if (Tasks[task_id] != nullptr) {
return Tasks[task_id]->Title;
}
}
return std::string();
}
int TaskManager::GetTaskMinLevel(int TaskID)
{
if (Tasks[TaskID]->MinLevel)
+1
View File
@@ -299,6 +299,7 @@ public:
bool AppropriateLevel(int TaskID, int PlayerLevel);
int GetTaskMinLevel(int TaskID);
int GetTaskMaxLevel(int TaskID);
std::string GetTaskName(uint32 task_id);
void TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, int TaskSetID);
void TaskQuestSetSelector(Client *c, ClientTaskState *state, Mob *mob, int count, int *tasks); // task list provided by QuestManager (perl/lua)
void SendActiveTasksToClient(Client *c, bool TaskComplete=false);
+11 -4
View File
@@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
extern EntityList entity_list;
extern Zone* zone;
extern volatile bool is_zone_loaded;
extern void CatchSignal(int);
extern void Shutdown();
extern WorldServer worldserver;
extern PetitionList petition_list;
extern uint32 numclients;
@@ -192,8 +192,15 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (pack->size != sizeof(ServerConnectInfo))
break;
ServerConnectInfo* sci = (ServerConnectInfo*)pack->pBuffer;
LogInfo("World assigned Port: [{}] for this zone", sci->port);
ZoneConfig::SetZonePort(sci->port);
if (sci->port == 0) {
LogCritical("World did not have a port to assign from this server, the port range was not large enough.");
Shutdown();
}
else {
LogInfo("World assigned Port: [{}] for this zone", sci->port);
ZoneConfig::SetZonePort(sci->port);
}
break;
}
case ServerOP_ChannelMessage: {
@@ -482,7 +489,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
case ServerOP_ShutdownAll: {
entity_list.Save();
CatchSignal(2);
Shutdown();
break;
}
case ServerOP_ZoneShutdown: {
+1 -1
View File
@@ -3708,7 +3708,7 @@ void ZoneDatabase::LoadBuffs(Client *client)
if (!IsValidSpell(buffs[index].spellid))
continue;
for (int effectIndex = 0; effectIndex < 12; ++effectIndex) {
for (int effectIndex = 0; effectIndex < EFFECT_COUNT; ++effectIndex) {
if (spells[buffs[index].spellid].effectid[effectIndex] == SE_Charm) {
buffs[index].spellid = SPELL_UNKNOWN;