From d2f8eead1f7746a29fa704c11988470ff6aacf04 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Tue, 1 Jun 2021 20:50:31 -0400 Subject: [PATCH] Add LDoN remove methods for losses and wins. --- common/servertalk.h | 6 +- zone/client.cpp | 57 ++++++++++++ zone/client.h | 2 + zone/embparser_api.cpp | 194 ++++++++++++++++++++++++++++++++++++++--- zone/lua_client.cpp | 14 ++- zone/lua_client.h | 2 + zone/lua_general.cpp | 99 ++++++++++++++++++--- zone/perl_client.cpp | 30 +++++++ zone/questmgr.cpp | 12 +++ zone/questmgr.h | 2 + zone/worldserver.cpp | 50 ++++++++--- 11 files changed, 434 insertions(+), 34 deletions(-) diff --git a/common/servertalk.h b/common/servertalk.h index b4a5000ad..a5a811ea5 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -329,8 +329,10 @@ enum { }; enum { - CZLDoNUpdateSubtype_Win = 0, - CZLDoNUpdateSubtype_Loss, + CZLDoNUpdateSubtype_WinAdd = 0, + CZLDoNUpdateSubtype_WinRemove, + CZLDoNUpdateSubtype_LossAdd, + CZLDoNUpdateSubtype_LossRemove, CZLDoNUpdateSubtype_Points }; diff --git a/zone/client.cpp b/zone/client.cpp index 10c58a265..7c89b4828 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5575,6 +5575,35 @@ void Client::AddLDoNLoss(uint32 theme_id) } } +void Client::RemoveLDoNLoss(uint32 theme_id) +{ + switch (theme_id) + { + case 1: + m_pp.ldon_losses_guk -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false); + break; + case 2: + m_pp.ldon_losses_mir -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false); + break; + case 3: + m_pp.ldon_losses_mmc -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false); + break; + case 4: + m_pp.ldon_losses_ruj -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false); + break; + case 5: + m_pp.ldon_losses_tak -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, false); + break; + default: + return; + } +} + void Client::AddLDoNWin(uint32 theme_id) { switch (theme_id) @@ -5604,6 +5633,34 @@ void Client::AddLDoNWin(uint32 theme_id) } } +void Client::RemoveLDoNWin(uint32 theme_id) +{ + switch (theme_id) + { + case 1: + m_pp.ldon_wins_guk -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true); + break; + case 2: + m_pp.ldon_wins_mir -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true); + break; + case 3: + m_pp.ldon_wins_mmc -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true); + break; + case 4: + m_pp.ldon_wins_ruj -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true); + break; + case 5: + m_pp.ldon_wins_tak -= 1; + database.UpdateAdventureStatsEntry(CharacterID(), theme_id, true); + break; + default: + return; + } +} void Client::SuspendMinion() { diff --git a/zone/client.h b/zone/client.h index 2c8dc2e2b..b16b9e2aa 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1310,6 +1310,8 @@ public: uint32 GetLDoNPointsTheme(uint32 t); void AddLDoNWin(uint32 theme_id); void AddLDoNLoss(uint32 theme_id); + void RemoveLDoNWin(uint32 theme_id); + void RemoveLDoNLoss(uint32 theme_id); void CheckLDoNHail(Mob *target); void CheckEmoteHail(Mob *target, const char* message); diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 44c159b76..5692bb5f7 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1611,10 +1611,21 @@ XS(XS__addldonwin) { XSRETURN_EMPTY; } +XS(XS__removeldonwin); +XS(XS__removeldonwin) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: quest::removeldonwin(uint32 theme_id)"); + + uint32 theme_id = (uint32) SvUV(ST(0)); + quest_manager.removeldonwin(theme_id); + XSRETURN_EMPTY; +} + XS(XS__addldonloss); XS(XS__addldonloss) { dXSARGS; - if (items != 2) + if (items != 1) Perl_croak(aTHX_ "Usage: quest::addldonloss(uint32 theme_id)"); uint32 theme_id = (uint32) SvUV(ST(0)); @@ -1622,6 +1633,17 @@ XS(XS__addldonloss) { XSRETURN_EMPTY; } +XS(XS__removeldonloss); +XS(XS__removeldonloss) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: quest::removeldonloss(uint32 theme_id)"); + + uint32 theme_id = (uint32) SvUV(ST(0)); + quest_manager.removeldonloss(theme_id); + XSRETURN_EMPTY; +} + XS(XS__setnexthpevent); XS(XS__setnexthpevent) { dXSARGS; @@ -6552,7 +6574,21 @@ XS(XS__crosszoneaddldonlossbycharid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbycharid(int character_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + int character_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonlossbycharid); +XS(XS__crosszoneremoveldonlossbycharid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbycharid(int character_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Character; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; int character_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); @@ -6581,7 +6617,21 @@ XS(XS__crosszoneaddldonwinbycharid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbycharid(int character_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + int character_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonwinbycharid); +XS(XS__crosszoneremoveldonwinbycharid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbycharid(int character_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Character; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; int character_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); @@ -6595,7 +6645,21 @@ XS(XS__crosszoneaddldonlossbygroupid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbygroupid(int group_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + int group_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonlossbygroupid); +XS(XS__crosszoneremoveldonlossbygroupid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbygroupid(int group_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Group; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; int group_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); @@ -6624,7 +6688,21 @@ XS(XS__crosszoneaddldonwinbygroupid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbygroupid(int group_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + int group_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonwinbygroupid); +XS(XS__crosszoneremoveldonwinbygroupid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbygroupid(int group_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Group; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; int group_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); @@ -6638,7 +6716,21 @@ XS(XS__crosszoneaddldonlossbyraidid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyraidid(int raid_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + int raid_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonlossbyraidid); +XS(XS__crosszoneremoveldonlossbyraidid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyraidid(int raid_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Raid; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; int raid_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); @@ -6667,7 +6759,21 @@ XS(XS__crosszoneaddldonwinbyraidid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyraidid(int raid_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + int raid_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonwinbyraidid); +XS(XS__crosszoneremoveldonwinbyraidid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyraidid(int raid_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Raid; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; int raid_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); @@ -6681,7 +6787,21 @@ XS(XS__crosszoneaddldonlossbyguildid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyguildid(int guild_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + int guild_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonlossbyguildid); +XS(XS__crosszoneremoveldonlossbyguildid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyguildid(int guild_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Guild; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; int guild_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); @@ -6710,7 +6830,21 @@ XS(XS__crosszoneaddldonwinbyguildid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyguildid(int guild_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + int guild_id = (int) SvIV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonwinbyguildid); +XS(XS__crosszoneremoveldonwinbyguildid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyguildid(int guild_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Guild; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; int guild_id = (int) SvIV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); @@ -6724,13 +6858,27 @@ XS(XS__crosszoneaddldonlossbyexpeditionid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; uint32 expedition_id = (uint32) SvUV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); XSRETURN_EMPTY; } +XS(XS__crosszoneremoveldonlossbyexpeditionid); +XS(XS__crosszoneremoveldonlossbyexpeditionid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonlossbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Expedition; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; + uint32 expedition_id = (uint32)SvUV(ST(0)); + uint32 theme_id = (uint32)SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); + XSRETURN_EMPTY; +} + XS(XS__crosszoneaddldonpointsbyexpeditionid); XS(XS__crosszoneaddldonpointsbyexpeditionid) { dXSARGS; @@ -6753,7 +6901,21 @@ XS(XS__crosszoneaddldonwinbyexpeditionid) { Perl_croak(aTHX_ "Usage: quest::crosszoneaddldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); uint8 update_type = CZLDoNUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + uint32 expedition_id = (uint32) SvUV(ST(0)); + uint32 theme_id = (uint32) SvUV(ST(1)); + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); + XSRETURN_EMPTY; +} + +XS(XS__crosszoneremoveldonwinbyexpeditionid); +XS(XS__crosszoneremoveldonwinbyexpeditionid) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::crosszoneremoveldonwinbyexpeditionid(uint32 expedition_id, uint32 theme_id)"); + + uint8 update_type = CZLDoNUpdateType_Expedition; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; uint32 expedition_id = (uint32) SvUV(ST(0)); uint32 theme_id = (uint32) SvUV(ST(1)); quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); @@ -6910,6 +7072,16 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "crosszonemoveinstancebygroupid"), XS__crosszonemoveinstancebygroupid, file); newXS(strcpy(buf, "crosszonemoveinstancebyraidid"), XS__crosszonemoveinstancebyraidid, file); newXS(strcpy(buf, "crosszonemoveinstancebyguildid"), XS__crosszonemoveinstancebyguildid, file); + newXS(strcpy(buf, "crosszoneremoveldonlossbycharid"), XS__crosszoneremoveldonlossbycharid, file); + newXS(strcpy(buf, "crosszoneremoveldonlossbygroupid"), XS__crosszoneremoveldonlossbygroupid, file); + newXS(strcpy(buf, "crosszoneremoveldonlossbyraidid"), XS__crosszoneremoveldonlossbyraidid, file); + newXS(strcpy(buf, "crosszoneremoveldonlossbyguildid"), XS__crosszoneremoveldonlossbyguildid, file); + newXS(strcpy(buf, "crosszoneremoveldonlossbyexpeditionid"), XS__crosszoneremoveldonlossbyexpeditionid, file); + newXS(strcpy(buf, "crosszoneremoveldonwinbycharid"), XS__crosszoneremoveldonwinbycharid, file); + newXS(strcpy(buf, "crosszoneremoveldonwinbygroupid"), XS__crosszoneremoveldonwinbygroupid, file); + newXS(strcpy(buf, "crosszoneremoveldonwinbyraidid"), XS__crosszoneremoveldonwinbyraidid, file); + newXS(strcpy(buf, "crosszoneremoveldonwinbyguildid"), XS__crosszoneremoveldonwinbyguildid, file); + newXS(strcpy(buf, "crosszoneremoveldonwinbyexpeditionid"), XS__crosszoneremoveldonwinbyexpeditionid, file); newXS(strcpy(buf, "crosszoneremovespellbycharid"), XS__crosszoneremovespellbycharid, file); newXS(strcpy(buf, "crosszoneremovespellbygroupid"), XS__crosszoneremovespellbygroupid, file); newXS(strcpy(buf, "crosszoneremovespellbyraidid"), XS__crosszoneremovespellbyraidid, file); diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index a84a52813..b8b5143ee 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -2093,6 +2093,16 @@ void Lua_Client::AddLDoNWin(uint32 theme_id) { self->AddLDoNWin(theme_id); } +void Lua_Client::RemoveLDoNLoss(uint32 theme_id) { + Lua_Safe_Call_Void(); + self->RemoveLDoNLoss(theme_id); +} + +void Lua_Client::RemoveLDoNWin(uint32 theme_id) { + Lua_Safe_Call_Void(); + self->RemoveLDoNWin(theme_id); +} + luabind::scope lua_register_client() { return luabind::class_("Client") .def(luabind::constructor<>()) @@ -2447,7 +2457,9 @@ luabind::scope lua_register_client() { .def("SetAAEXPModifier", (void(Lua_Client::*)(uint32,double))&Lua_Client::SetAAEXPModifier) .def("SetEXPModifier", (void(Lua_Client::*)(uint32,double))&Lua_Client::SetEXPModifier) .def("AddLDoNLoss", (void(Lua_Client::*)(uint32))&Lua_Client::AddLDoNLoss) - .def("AddLDoNWin", (void(Lua_Client::*)(uint32))&Lua_Client::AddLDoNWin); + .def("AddLDoNWin", (void(Lua_Client::*)(uint32))&Lua_Client::AddLDoNWin) + .def("RemoveLDoNLoss", (void(Lua_Client::*)(uint32))&Lua_Client::RemoveLDoNLoss) + .def("RemoveLDoNWin", (void(Lua_Client::*)(uint32))&Lua_Client::RemoveLDoNWin); } luabind::scope lua_register_inventory_where() { diff --git a/zone/lua_client.h b/zone/lua_client.h index 743d32f65..d7c588bf2 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -79,6 +79,8 @@ public: uint32 GetTotalSecondsPlayed(); void AddLDoNLoss(uint32 theme_id); void AddLDoNWin(uint32 theme_id); + void RemoveLDoNLoss(uint32 theme_id); + void RemoveLDoNWin(uint32 theme_id); void UpdateLDoNPoints(uint32 theme_id, int points); void SetDeity(int v); void AddEXP(uint32 add_exp); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 2e26b460f..0659d6a0c 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -2357,6 +2357,10 @@ void lua_add_ldon_loss(uint32 theme_id) { quest_manager.addldonloss(theme_id); } +void lua_remove_ldon_loss(uint32 theme_id) { + quest_manager.removeldonloss(theme_id); +} + void lua_add_ldon_points(uint32 theme_id, int points) { quest_manager.addldonpoints(theme_id, points); } @@ -2365,9 +2369,19 @@ void lua_add_ldon_win(uint32 theme_id) { quest_manager.addldonwin(theme_id); } +void lua_remove_ldon_win(uint32 theme_id) { + quest_manager.removeldonwin(theme_id); +} + void lua_cross_zone_add_ldon_loss_by_char_id(int character_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); +} + +void lua_cross_zone_remove_ldon_loss_by_char_id(int character_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Character; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); } @@ -2379,13 +2393,25 @@ void lua_cross_zone_add_ldon_points_by_char_id(int character_id, uint32 theme_id void lua_cross_zone_add_ldon_win_by_char_id(int character_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Character; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); +} + +void lua_cross_zone_remove_ldon_win_by_char_id(int character_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Character; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, character_id, theme_id); } void lua_cross_zone_add_ldon_loss_by_group_id(int group_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); +} + +void lua_cross_zone_remove_ldon_loss_by_group_id(int group_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Group; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); } @@ -2397,13 +2423,25 @@ void lua_cross_zone_add_ldon_points_by_group_id(int group_id, uint32 theme_id, i void lua_cross_zone_add_ldon_win_by_group_id(int group_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Group; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); +} + +void lua_cross_zone_remove_ldon_win_by_group_id(int group_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Group; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, group_id, theme_id); } void lua_cross_zone_add_ldon_loss_by_raid_id(int raid_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); +} + +void lua_cross_zone_remove_ldon_loss_by_raid_id(int raid_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Raid; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); } @@ -2415,13 +2453,25 @@ void lua_cross_zone_add_ldon_points_by_raid_id(int raid_id, uint32 theme_id, int void lua_cross_zone_add_ldon_win_by_raid_id(int raid_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Raid; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); +} + +void lua_cross_zone_remove_ldon_win_by_raid_id(int raid_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Raid; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, raid_id, theme_id); } void lua_cross_zone_add_ldon_loss_by_guild_id(int guild_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); +} + +void lua_cross_zone_remove_ldon_loss_by_guild_id(int guild_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Guild; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); } @@ -2433,13 +2483,25 @@ void lua_cross_zone_add_ldon_points_by_guild_id(int guild_id, uint32 theme_id, i void lua_cross_zone_add_ldon_win_by_guild_id(int guild_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Guild; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); +} + +void lua_cross_zone_remove_ldon_win_by_guild_id(int guild_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Guild; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, guild_id, theme_id); } void lua_cross_zone_add_ldon_loss_by_expedition_id(uint32 expedition_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_Loss; + uint8 update_subtype = CZLDoNUpdateSubtype_LossAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); +} + +void lua_cross_zone_remove_ldon_loss_by_expedition_id(uint32 expedition_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Expedition; + uint8 update_subtype = CZLDoNUpdateSubtype_LossRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); } @@ -2451,7 +2513,13 @@ void lua_cross_zone_add_ldon_points_by_expedition_id(uint32 expedition_id, uint3 void lua_cross_zone_add_ldon_win_by_expedition_id(uint32 expedition_id, uint32 theme_id) { uint8 update_type = CZLDoNUpdateType_Expedition; - uint8 update_subtype = CZLDoNUpdateSubtype_Win; + uint8 update_subtype = CZLDoNUpdateSubtype_WinAdd; + quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); +} + +void lua_cross_zone_remove_ldon_win_by_expedition_id(uint32 expedition_id, uint32 theme_id) { + uint8 update_type = CZLDoNUpdateType_Expedition; + uint8 update_subtype = CZLDoNUpdateSubtype_WinRemove; quest_manager.CrossZoneLDoNUpdate(update_type, update_subtype, expedition_id, theme_id); } @@ -3004,21 +3072,32 @@ luabind::scope lua_register_general() { luabind::def("add_ldon_loss", &lua_add_ldon_loss), luabind::def("add_ldon_points", &lua_add_ldon_points), luabind::def("add_ldon_win", &lua_add_ldon_win), + luabind::def("remove_ldon_win", &lua_remove_ldon_win), luabind::def("cross_zone_add_ldon_loss_by_char_id", &lua_cross_zone_add_ldon_loss_by_char_id), + luabind::def("cross_zone_remove_ldon_loss_by_char_id", &lua_cross_zone_remove_ldon_loss_by_char_id), luabind::def("cross_zone_add_ldon_points_by_char_id", &lua_cross_zone_add_ldon_points_by_char_id), luabind::def("cross_zone_add_ldon_win_by_char_id", &lua_cross_zone_add_ldon_win_by_char_id), + luabind::def("cross_zone_remove_ldon_win_by_char_id", &lua_cross_zone_remove_ldon_win_by_char_id), luabind::def("cross_zone_add_ldon_loss_by_group_id", &lua_cross_zone_add_ldon_loss_by_group_id), + luabind::def("cross_zone_remove_ldon_loss_by_group_id", &lua_cross_zone_remove_ldon_loss_by_group_id), luabind::def("cross_zone_add_ldon_points_by_group_id", &lua_cross_zone_add_ldon_points_by_group_id), luabind::def("cross_zone_add_ldon_win_by_group_id", &lua_cross_zone_add_ldon_win_by_group_id), + luabind::def("cross_zone_remove_ldon_win_by_group_id", &lua_cross_zone_remove_ldon_win_by_group_id), luabind::def("cross_zone_add_ldon_loss_by_raid_id", &lua_cross_zone_add_ldon_loss_by_raid_id), + luabind::def("cross_zone_remove_ldon_loss_by_raid_id", &lua_cross_zone_remove_ldon_loss_by_raid_id), luabind::def("cross_zone_add_ldon_points_by_raid_id", &lua_cross_zone_add_ldon_points_by_raid_id), luabind::def("cross_zone_add_ldon_win_by_raid_id", &lua_cross_zone_add_ldon_win_by_raid_id), + luabind::def("cross_zone_remove_ldon_win_by_raid_id", &lua_cross_zone_remove_ldon_win_by_raid_id), luabind::def("cross_zone_add_ldon_loss_by_guild_id", &lua_cross_zone_add_ldon_loss_by_guild_id), + luabind::def("cross_zone_remove_ldon_loss_by_guild_id", &lua_cross_zone_remove_ldon_loss_by_guild_id), luabind::def("cross_zone_add_ldon_points_by_guild_id", &lua_cross_zone_add_ldon_points_by_guild_id), luabind::def("cross_zone_add_ldon_win_by_guild_id", &lua_cross_zone_add_ldon_win_by_guild_id), + luabind::def("cross_zone_remove_ldon_win_by_guild_id", &lua_cross_zone_remove_ldon_win_by_guild_id), luabind::def("cross_zone_add_ldon_loss_by_expedition_id", &lua_cross_zone_add_ldon_loss_by_expedition_id), + luabind::def("cross_zone_remove_ldon_loss_by_expedition_id", &lua_cross_zone_remove_ldon_loss_by_expedition_id), luabind::def("cross_zone_add_ldon_points_by_expedition_id", &lua_cross_zone_add_ldon_points_by_expedition_id), luabind::def("cross_zone_add_ldon_win_by_expedition_id", &lua_cross_zone_add_ldon_win_by_expedition_id), + luabind::def("cross_zone_remove_ldon_win_by_expedition_id", &lua_cross_zone_remove_ldon_win_by_expedition_id), /** * Expansions */ diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 054664c69..f61ac3d67 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5318,6 +5318,34 @@ XS(XS_Client_AddLDoNWin) { XSRETURN_EMPTY; } +XS(XS_Client_RemoveLDoNLoss); +XS(XS_Client_RemoveLDoNLoss) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Client::RemoveLDoNLoss(THIS, uint32 theme_id)"); + { + Client* THIS; + uint32 theme_id = (uint32) SvUV(ST(1)); + VALIDATE_THIS_IS_CLIENT; + THIS->RemoveLDoNLoss(theme_id); + } + XSRETURN_EMPTY; +} + +XS(XS_Client_RemoveLDoNWin); +XS(XS_Client_RemoveLDoNWin) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Client::RemoveLDoNWin(THIS, uint32 theme_id)"); + { + Client* THIS; + uint32 theme_id = (uint32) SvUV(ST(1)); + VALIDATE_THIS_IS_CLIENT; + THIS->RemoveLDoNWin(theme_id); + } + XSRETURN_EMPTY; +} + #ifdef __cplusplus extern "C" #endif @@ -5536,6 +5564,8 @@ XS(boot_Client) { newXSproto(strcpy(buf, "RefundAA"), XS_Client_RefundAA, file, "$$"); newXSproto(strcpy(buf, "RemoveAllExpeditionLockouts"), XS_Client_RemoveAllExpeditionLockouts, file, "$;$"); newXSproto(strcpy(buf, "RemoveExpeditionLockout"), XS_Client_RemoveExpeditionLockout, file, "$$$"); + newXSproto(strcpy(buf, "RemoveLDoNLoss"), XS_Client_RemoveLDoNLoss, file, "$$"); + newXSproto(strcpy(buf, "RemoveLDoNwin"), XS_Client_RemoveLDoNWin, file, "$$"); newXSproto(strcpy(buf, "RemoveNoRent"), XS_Client_RemoveNoRent, file, "$"); newXSproto(strcpy(buf, "ResetAA"), XS_Client_ResetAA, file, "$"); newXSproto(strcpy(buf, "ResetDisciplineTimer"), XS_Client_ResetDisciplineTimer, file, "$$"); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 09046f775..fc1418630 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1745,6 +1745,18 @@ void QuestManager::addldonwin(uint32 theme_id) { initiator->AddLDoNWin(theme_id); } +void QuestManager::removeldonloss(uint32 theme_id) { + QuestManagerCurrentQuestVars(); + if(initiator) + initiator->RemoveLDoNLoss(theme_id); +} + +void QuestManager::removeldonwin(uint32 theme_id) { + QuestManagerCurrentQuestVars(); + if(initiator) + initiator->RemoveLDoNWin(theme_id); +} + void QuestManager::setnexthpevent(int at) { QuestManagerCurrentQuestVars(); if (owner) diff --git a/zone/questmgr.h b/zone/questmgr.h index 815a10e35..a1f14666e 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -161,6 +161,8 @@ public: void addldonpoints(uint32 theme_id, int points); void addldonloss(uint32 theme_id); void addldonwin(uint32 theme_id); + void removeldonloss(uint32 theme_id); + void removeldonwin(uint32 theme_id); void setnexthpevent(int at); void setnextinchpevent(int at); void respawn(int npc_type, int grid); diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index beef1c8f8..8ee900177 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1944,15 +1944,21 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) auto client = entity_list.GetClientByCharID(update_identifier); if (client) { switch (update_subtype) { - case CZLDoNUpdateSubtype_Loss: + case CZLDoNUpdateSubtype_LossAdd: client->AddLDoNLoss(theme_id); break; + case CZLDoNUpdateSubtype_LossRemove: + client->RemoveLDoNLoss(theme_id); + break; case CZLDoNUpdateSubtype_Points: client->UpdateLDoNPoints(theme_id, points); break; - case CZLDoNUpdateSubtype_Win: + case CZLDoNUpdateSubtype_WinAdd: client->AddLDoNWin(theme_id); break; + case CZLDoNUpdateSubtype_WinRemove: + client->RemoveLDoNWin(theme_id); + break; default: break; } @@ -1965,15 +1971,21 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) if (client_group->members[member_index] && client_group->members[member_index]->IsClient()) { auto client_group_member = client_group->members[member_index]->CastToClient(); switch (update_subtype) { - case CZLDoNUpdateSubtype_Loss: + case CZLDoNUpdateSubtype_LossAdd: client_group_member->AddLDoNLoss(theme_id); break; + case CZLDoNUpdateSubtype_LossRemove: + client_group_member->RemoveLDoNLoss(theme_id); + break; case CZLDoNUpdateSubtype_Points: client_group_member->UpdateLDoNPoints(theme_id, points); break; - case CZLDoNUpdateSubtype_Win: + case CZLDoNUpdateSubtype_WinAdd: client_group_member->AddLDoNWin(theme_id); break; + case CZLDoNUpdateSubtype_WinRemove: + client_group_member->RemoveLDoNWin(theme_id); + break; default: break; } @@ -1987,15 +1999,21 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) auto client_raid_member = client_raid->members[member_index].member; if (client_raid_member && client_raid_member->IsClient()) { switch (update_subtype) { - case CZLDoNUpdateSubtype_Loss: + case CZLDoNUpdateSubtype_LossAdd: client_raid_member->AddLDoNLoss(theme_id); break; + case CZLDoNUpdateSubtype_LossRemove: + client_raid_member->RemoveLDoNLoss(theme_id); + break; case CZLDoNUpdateSubtype_Points: client_raid_member->UpdateLDoNPoints(theme_id, points); break; - case CZLDoNUpdateSubtype_Win: + case CZLDoNUpdateSubtype_WinAdd: client_raid_member->AddLDoNWin(theme_id); break; + case CZLDoNUpdateSubtype_WinRemove: + client_raid_member->RemoveLDoNWin(theme_id); + break; default: break; } @@ -2006,15 +2024,21 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) for (auto &client : entity_list.GetClientList()) { if (client.second->GuildID() > 0 && client.second->GuildID() == update_identifier) { switch (update_subtype) { - case CZLDoNUpdateSubtype_Loss: + case CZLDoNUpdateSubtype_LossAdd: client.second->AddLDoNLoss(theme_id); break; + case CZLDoNUpdateSubtype_LossRemove: + client.second->RemoveLDoNLoss(theme_id); + break; case CZLDoNUpdateSubtype_Points: client.second->UpdateLDoNPoints(theme_id, points); break; - case CZLDoNUpdateSubtype_Win: + case CZLDoNUpdateSubtype_WinAdd: client.second->AddLDoNWin(theme_id); break; + case CZLDoNUpdateSubtype_WinRemove: + client.second->RemoveLDoNWin(theme_id); + break; default: break; } @@ -2024,15 +2048,21 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) for (auto &client : entity_list.GetClientList()) { if (client.second->GetExpedition() && client.second->GetExpedition()->GetID() == update_identifier) { switch (update_subtype) { - case CZLDoNUpdateSubtype_Loss: + case CZLDoNUpdateSubtype_LossAdd: client.second->AddLDoNLoss(theme_id); break; + case CZLDoNUpdateSubtype_LossRemove: + client.second->RemoveLDoNLoss(theme_id); + break; case CZLDoNUpdateSubtype_Points: client.second->UpdateLDoNPoints(theme_id, points); break; - case CZLDoNUpdateSubtype_Win: + case CZLDoNUpdateSubtype_WinAdd: client.second->AddLDoNWin(theme_id); break; + case CZLDoNUpdateSubtype_WinRemove: + client.second->RemoveLDoNWin(theme_id); + break; default: break; }