mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Require zone id to get expedition by instance id
This is a breaking api change eq.get_expedition_by_instance_id(instance_id) is replaced with eq.get_expedition_by_zone_instance(zone_id, instance_id) This replaces the FindCachedExpeditionByInstanceID method of obtaining expeditions via instance id with a new method that requires the dz zone id as well
This commit is contained in:
parent
cd98b8bc6f
commit
79287fc507
@ -1279,7 +1279,7 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
if (zone && zone->GetInstanceID() != 0)
|
||||
{
|
||||
// expeditions may prevent looting based on client's lockouts
|
||||
auto expedition = Expedition::FindCachedExpeditionByInstanceID(zone->GetInstanceID());
|
||||
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (expedition && !expedition->CanClientLootCorpse(client, GetNPCTypeID(), GetID()))
|
||||
{
|
||||
client->MessageString(Chat::Red, LOOT_NOT_ALLOWED, inst->GetItem()->Name);
|
||||
|
||||
@ -6070,7 +6070,7 @@ XS(XS__get_expedition) {
|
||||
Expedition* RETVAL = nullptr;
|
||||
if (zone && zone->GetInstanceID() != 0)
|
||||
{
|
||||
RETVAL = Expedition::FindCachedExpeditionByInstanceID(zone->GetInstanceID());
|
||||
RETVAL = Expedition::FindCachedExpeditionByZoneInstance(zone->GetZoneID(), zone->GetInstanceID());
|
||||
}
|
||||
|
||||
EXTEND(sp, 1); // grow stack, function had 0 arguments
|
||||
@ -6101,16 +6101,17 @@ XS(XS__get_expedition_by_char_id) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__get_expedition_by_instance_id);
|
||||
XS(XS__get_expedition_by_instance_id) {
|
||||
XS(XS__get_expedition_by_zone_instance);
|
||||
XS(XS__get_expedition_by_zone_instance) {
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
Perl_croak(aTHX_ "Usage: quest::GetExpeditionByInstanceID(uint16 instance_id)");
|
||||
if (items != 2) {
|
||||
Perl_croak(aTHX_ "Usage: quest::GetExpeditionByZoneInstance(uint16 zone_id, uint16 instance_id)");
|
||||
}
|
||||
|
||||
uint16 instance_id = (uint16)SvUV(ST(0));
|
||||
uint16 zone_id = (uint16)SvUV(ST(0));
|
||||
uint16 instance_id = (uint16)SvUV(ST(1));
|
||||
|
||||
Expedition* RETVAL = Expedition::FindCachedExpeditionByInstanceID(instance_id);
|
||||
Expedition* RETVAL = Expedition::FindCachedExpeditionByZoneInstance(zone_id, instance_id);
|
||||
|
||||
ST(0) = sv_newmortal();
|
||||
if (RETVAL) {
|
||||
@ -6512,7 +6513,7 @@ EXTERN_C XS(boot_quest) {
|
||||
newXS(strcpy(buf, "getcurrencyid"), XS__getcurrencyid, file);
|
||||
newXS(strcpy(buf, "get_expedition"), XS__get_expedition, file);
|
||||
newXS(strcpy(buf, "get_expedition_by_char_id"), XS__get_expedition_by_char_id, file);
|
||||
newXS(strcpy(buf, "get_expedition_by_instance_id"), XS__get_expedition_by_instance_id, file);
|
||||
newXS(strcpy(buf, "get_expedition_by_zone_instance"), XS__get_expedition_by_zone_instance, file);
|
||||
newXS(strcpy(buf, "get_expedition_lockout_by_char_id"), XS__get_expedition_lockout_by_char_id, file);
|
||||
newXS(strcpy(buf, "get_expedition_lockouts_by_char_id"), XS__get_expedition_lockouts_by_char_id, file);
|
||||
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
|
||||
|
||||
@ -353,13 +353,14 @@ Expedition* Expedition::FindCachedExpeditionByID(uint32_t expedition_id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Expedition* Expedition::FindCachedExpeditionByInstanceID(uint32_t instance_id)
|
||||
Expedition* Expedition::FindCachedExpeditionByZoneInstance(uint32_t zone_id, uint32_t instance_id)
|
||||
{
|
||||
if (instance_id && zone)
|
||||
if (zone && zone_id != 0 && instance_id != 0)
|
||||
{
|
||||
for (const auto& cached_expedition : zone->expedition_cache)
|
||||
{
|
||||
if (cached_expedition.second->GetInstanceID() == instance_id)
|
||||
if (cached_expedition.second->GetDynamicZone().GetZoneID() == zone_id &&
|
||||
cached_expedition.second->GetDynamicZone().GetInstanceID() == instance_id)
|
||||
{
|
||||
return cached_expedition.second.get();
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
static Expedition* FindCachedExpeditionByCharacterID(uint32_t character_id);
|
||||
static Expedition* FindCachedExpeditionByCharacterName(const std::string& char_name);
|
||||
static Expedition* FindCachedExpeditionByID(uint32_t expedition_id);
|
||||
static Expedition* FindCachedExpeditionByInstanceID(uint32_t instance_id);
|
||||
static Expedition* FindCachedExpeditionByZoneInstance(uint32_t zone_id, uint32_t instance_id);
|
||||
static std::vector<ExpeditionLockoutTimer> GetExpeditionLockoutsByCharacterID(uint32_t character_id);
|
||||
static void HandleWorldMessage(ServerPacket* pack);
|
||||
static void AddLockoutByCharacterID(uint32_t character_id, const std::string& expedition_name,
|
||||
|
||||
@ -2183,7 +2183,7 @@ void lua_set_content_flag(std::string flag_name, bool enabled){
|
||||
Lua_Expedition lua_get_expedition() {
|
||||
if (zone && zone->GetInstanceID() != 0)
|
||||
{
|
||||
return Expedition::FindCachedExpeditionByInstanceID(zone->GetInstanceID());
|
||||
return Expedition::FindCachedExpeditionByZoneInstance(zone->GetZoneID(), zone->GetInstanceID());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -2192,8 +2192,8 @@ Lua_Expedition lua_get_expedition_by_char_id(uint32 char_id) {
|
||||
return Expedition::FindCachedExpeditionByCharacterID(char_id);
|
||||
}
|
||||
|
||||
Lua_Expedition lua_get_expedition_by_instance_id(uint32 instance_id) {
|
||||
return Expedition::FindCachedExpeditionByInstanceID(instance_id);
|
||||
Lua_Expedition lua_get_expedition_by_zone_instance(uint32 zone_id, uint32 instance_id) {
|
||||
return Expedition::FindCachedExpeditionByZoneInstance(zone_id, instance_id);
|
||||
}
|
||||
|
||||
luabind::object lua_get_expedition_lockout_by_char_id(lua_State* L, uint32 char_id, std::string expedition_name, std::string event_name) {
|
||||
@ -2889,7 +2889,7 @@ luabind::scope lua_register_general() {
|
||||
|
||||
luabind::def("get_expedition", &lua_get_expedition),
|
||||
luabind::def("get_expedition_by_char_id", &lua_get_expedition_by_char_id),
|
||||
luabind::def("get_expedition_by_instance_id", &lua_get_expedition_by_instance_id),
|
||||
luabind::def("get_expedition_by_zone_instance", &lua_get_expedition_by_zone_instance),
|
||||
luabind::def("get_expedition_lockout_by_char_id", &lua_get_expedition_lockout_by_char_id),
|
||||
luabind::def("get_expedition_lockouts_by_char_id", (luabind::object(*)(lua_State*, uint32))&lua_get_expedition_lockouts_by_char_id),
|
||||
luabind::def("get_expedition_lockouts_by_char_id", (luabind::object(*)(lua_State*, uint32, std::string))&lua_get_expedition_lockouts_by_char_id),
|
||||
|
||||
@ -1492,7 +1492,7 @@ bool Zone::Process() {
|
||||
if(Instance_Timer->Check())
|
||||
{
|
||||
// if this is a dynamic zone instance notify system associated with it
|
||||
Expedition* expedition = Expedition::FindCachedExpeditionByInstanceID(GetInstanceID());
|
||||
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(GetZoneID(), GetInstanceID());
|
||||
if (expedition)
|
||||
{
|
||||
expedition->RemoveAllMembers(false); // entity list will teleport clients out immediately
|
||||
@ -2722,7 +2722,7 @@ DynamicZone Zone::GetDynamicZone()
|
||||
return {}; // invalid
|
||||
}
|
||||
|
||||
auto expedition = Expedition::FindCachedExpeditionByInstanceID(GetInstanceID());
|
||||
auto expedition = Expedition::FindCachedExpeditionByZoneInstance(GetZoneID(), GetInstanceID());
|
||||
if (expedition)
|
||||
{
|
||||
return expedition->GetDynamicZone();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user