mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
This removes the separate Expedition class and moves lockout code and
/dz command handlers into DynamicZone classes. It also refactors some
code to reduce bloat and some database usage.
This completes the effort of moving everything to DynamicZone that
started when implementing shared tasks. It also makes sense to do this
since expeditions are just dynamic zones internally despite dzs being
used for other types. Expedition specific things are just handled with
dz type checks.
Functionally nothing should change. This is mainly internal refactoring
and moving code around along with some bug fixes and reduced database
usage.
Main changes:
- The `expeditions` database table has been removed
- Expeditions no longer use a separate id, the expedition id is just the dz id
- Expedition lock state and replay timer option were moved to the
`dynamic_zones` table
- Expeditions no longer have a separate cache from dynamic zones
- Expedition creation no longer has every zone query the database to cache it
- Expedition internal lockouts are now stored on DynamicZone
- The `expedition_lockouts` table has been renamed to `dynamic_zone_lockouts`
- Fixed a small bug with the UpdateLockoutDuration api where the
internal lockout would get the time added twice in memory in the
initiating zone (this api is likely rarely used)
- Fixed an issue where use of the group/raid DoesAnyMemberHaveExpeditionLockout
api would query once for every out of zone character.
- This api now checks all members in the current zone first and only
performs a single bulk query for out of zone members if that check
is exhausted
- Deprecated the max_check_count param of DoesAnyMemberHaveExpeditionLockout,
the quest api still exists to avoid api break but a passed arg has no effect
205 lines
6.5 KiB
C++
205 lines
6.5 KiB
C++
#ifdef LUA_EQEMU
|
|
|
|
#include "../common/data_verification.h"
|
|
|
|
#include <luabind/luabind.hpp>
|
|
#include <luabind/object.hpp>
|
|
|
|
#include "masterentity.h"
|
|
#include "lua_raid.h"
|
|
#include "lua_mob.h"
|
|
#include "lua_client.h"
|
|
#include "lua_npc.h"
|
|
|
|
bool Lua_Raid::IsRaidMember(const char *name) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsRaidMember(name);
|
|
}
|
|
|
|
bool Lua_Raid::IsRaidMember(Lua_Client c) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsRaidMember(c);
|
|
}
|
|
|
|
void Lua_Raid::CastGroupSpell(Lua_Mob caster, int spell_id, uint32 group_id) {
|
|
Lua_Safe_Call_Void();
|
|
self->CastGroupSpell(caster, spell_id, group_id);
|
|
}
|
|
|
|
int Lua_Raid::GroupCount(uint32 group_id) {
|
|
Lua_Safe_Call_Int();
|
|
return self->GroupCount(group_id);
|
|
}
|
|
|
|
int Lua_Raid::RaidCount() {
|
|
Lua_Safe_Call_Int();
|
|
return self->RaidCount();
|
|
}
|
|
|
|
int Lua_Raid::GetGroup(const char *c) {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetGroup(c);
|
|
}
|
|
|
|
int Lua_Raid::GetGroup(Lua_Client c) {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetGroup(c);
|
|
}
|
|
|
|
void Lua_Raid::SplitExp(uint64 exp, Lua_Mob other) {
|
|
Lua_Safe_Call_Void();
|
|
self->SplitExp(ExpSource::Quest, exp, other);
|
|
}
|
|
|
|
uint32 Lua_Raid::GetTotalRaidDamage(Lua_Mob other) {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetTotalRaidDamage(other);
|
|
}
|
|
|
|
void Lua_Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) {
|
|
Lua_Safe_Call_Void();
|
|
self->SplitMoney(gid, copper, silver, gold, platinum);
|
|
}
|
|
|
|
void Lua_Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Lua_Client splitter) {
|
|
Lua_Safe_Call_Void();
|
|
self->SplitMoney(gid, copper, silver, gold, platinum, splitter);
|
|
}
|
|
|
|
void Lua_Raid::BalanceHP(int penalty, uint32 group_id) {
|
|
Lua_Safe_Call_Void();
|
|
self->BalanceHP(penalty, group_id);
|
|
}
|
|
|
|
bool Lua_Raid::IsLeader(const char *c) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsLeader(c);
|
|
}
|
|
|
|
bool Lua_Raid::IsLeader(Lua_Client c) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsLeader(c);
|
|
}
|
|
|
|
Lua_Client Lua_Raid::GetLeader() {
|
|
Lua_Safe_Call_Class(Lua_Client);
|
|
return self->GetLeader();
|
|
}
|
|
|
|
std::string Lua_Raid::GetLeaderName() {
|
|
Lua_Safe_Call_String();
|
|
return self->GetLeaderName();
|
|
}
|
|
|
|
bool Lua_Raid::IsGroupLeader(const char *name) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsGroupLeader(name);
|
|
}
|
|
|
|
bool Lua_Raid::IsGroupLeader(Lua_Client c) {
|
|
Lua_Safe_Call_Bool();
|
|
return self->IsGroupLeader(c);
|
|
}
|
|
|
|
int Lua_Raid::GetHighestLevel() {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetHighestLevel();
|
|
}
|
|
|
|
int Lua_Raid::GetLowestLevel() {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetLowestLevel();
|
|
}
|
|
|
|
Lua_Client Lua_Raid::GetClientByIndex(int member_index) {
|
|
Lua_Safe_Call_Class(Lua_Client);
|
|
return self->GetClientByIndex(member_index);
|
|
}
|
|
|
|
void Lua_Raid::TeleportGroup(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h, uint32 group_id) {
|
|
Lua_Safe_Call_Void();
|
|
self->TeleportGroup(sender, zone_id, instance_id, x, y, z, h, group_id);
|
|
}
|
|
|
|
void Lua_Raid::TeleportRaid(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h) {
|
|
Lua_Safe_Call_Void();
|
|
self->TeleportRaid(sender, zone_id, instance_id, x, y, z, h);
|
|
}
|
|
|
|
int Lua_Raid::GetID() {
|
|
Lua_Safe_Call_Int();
|
|
return self->GetID();
|
|
}
|
|
|
|
Lua_Client Lua_Raid::GetMember(int member_index) {
|
|
Lua_Safe_Call_Class(Lua_Client);
|
|
|
|
if (!EQ::ValueWithin(member_index, 0, 71)) {
|
|
return Lua_Client();
|
|
}
|
|
|
|
return self->members[member_index].member;
|
|
}
|
|
|
|
int Lua_Raid::GetGroupNumber(int member_index) {
|
|
Lua_Safe_Call_Int();
|
|
|
|
if (
|
|
!EQ::ValueWithin(member_index, 0, 71) ||
|
|
self->members[member_index].group_number == RAID_GROUPLESS
|
|
) {
|
|
return -1;
|
|
}
|
|
|
|
return self->members[member_index].group_number;
|
|
}
|
|
|
|
bool Lua_Raid::DoesAnyMemberHaveExpeditionLockout(std::string expedition_name, std::string event_name)
|
|
{
|
|
Lua_Safe_Call_Bool();
|
|
return self->AnyMemberHasDzLockout(expedition_name, event_name);
|
|
}
|
|
|
|
bool Lua_Raid::DoesAnyMemberHaveExpeditionLockout(std::string expedition_name, std::string event_name, int max_check_count)
|
|
{
|
|
Lua_Safe_Call_Bool();
|
|
return self->AnyMemberHasDzLockout(expedition_name, event_name); // max_check_count deprecated
|
|
}
|
|
|
|
luabind::scope lua_register_raid() {
|
|
return luabind::class_<Lua_Raid>("Raid")
|
|
.def(luabind::constructor<>())
|
|
.property("null", &Lua_Raid::Null)
|
|
.property("valid", &Lua_Raid::Valid)
|
|
.def("BalanceHP", (void(Lua_Raid::*)(int,uint32))&Lua_Raid::BalanceHP)
|
|
.def("CastGroupSpell", (void(Lua_Raid::*)(Lua_Mob,int,uint32))&Lua_Raid::CastGroupSpell)
|
|
.def("DoesAnyMemberHaveExpeditionLockout", (bool(Lua_Raid::*)(std::string, std::string))&Lua_Raid::DoesAnyMemberHaveExpeditionLockout)
|
|
.def("DoesAnyMemberHaveExpeditionLockout", (bool(Lua_Raid::*)(std::string, std::string, int))&Lua_Raid::DoesAnyMemberHaveExpeditionLockout)
|
|
.def("GetClientByIndex", (Lua_Client(Lua_Raid::*)(int))&Lua_Raid::GetClientByIndex)
|
|
.def("GetGroup", (int(Lua_Raid::*)(Lua_Client))&Lua_Raid::GetGroup)
|
|
.def("GetGroup", (int(Lua_Raid::*)(const char*))&Lua_Raid::GetGroup)
|
|
.def("GetGroupNumber", (int(Lua_Raid::*)(int))&Lua_Raid::GetGroupNumber)
|
|
.def("GetHighestLevel", (int(Lua_Raid::*)(void))&Lua_Raid::GetHighestLevel)
|
|
.def("GetID", (int(Lua_Raid::*)(void))&Lua_Raid::GetID)
|
|
.def("GetLowestLevel", (int(Lua_Raid::*)(void))&Lua_Raid::GetLowestLevel)
|
|
.def("GetMember", (Lua_Client(Lua_Raid::*)(int))&Lua_Raid::GetMember)
|
|
.def("GetTotalRaidDamage", (uint32(Lua_Raid::*)(Lua_Mob))&Lua_Raid::GetTotalRaidDamage)
|
|
.def("GroupCount", (int(Lua_Raid::*)(uint32))&Lua_Raid::GroupCount)
|
|
.def("IsGroupLeader", (bool(Lua_Raid::*)(const char*))&Lua_Raid::IsGroupLeader)
|
|
.def("IsGroupLeader", (bool(Lua_Raid::*)(Lua_Client))&Lua_Raid::IsGroupLeader)
|
|
.def("IsLeader", (bool(Lua_Raid::*)(const char*))&Lua_Raid::IsLeader)
|
|
.def("IsLeader", (bool(Lua_Raid::*)(Lua_Client))&Lua_Raid::IsLeader)
|
|
.def("GetLeader", (Lua_Client(Lua_Raid::*)(void))&Lua_Raid::GetLeader)
|
|
.def("GetLeaderName", (std::string(Lua_Raid::*)(void)) & Lua_Raid::GetLeaderName)
|
|
.def("IsRaidMember", (bool(Lua_Raid::*)(const char*))&Lua_Raid::IsRaidMember)
|
|
.def("IsRaidMember", (bool(Lua_Raid::*)(Lua_Client))&Lua_Raid::IsRaidMember)
|
|
.def("RaidCount", (int(Lua_Raid::*)(void))&Lua_Raid::RaidCount)
|
|
.def("SplitExp", (void(Lua_Raid::*)(uint32,Lua_Mob))&Lua_Raid::SplitExp)
|
|
.def("SplitMoney", (void(Lua_Raid::*)(uint32,uint32,uint32,uint32,uint32))&Lua_Raid::SplitMoney)
|
|
.def("SplitMoney", (void(Lua_Raid::*)(uint32,uint32,uint32,uint32,uint32,Lua_Client))&Lua_Raid::SplitMoney)
|
|
.def("TeleportGroup", (int(Lua_Raid::*)(Lua_Mob,uint32,uint32,float,float,float,float,uint32))&Lua_Raid::TeleportGroup)
|
|
.def("TeleportRaid", (int(Lua_Raid::*)(Lua_Mob,uint32,uint32,float,float,float,float))&Lua_Raid::TeleportRaid);
|
|
}
|
|
|
|
#endif
|