Fix lua raid GetGroup(client) and add lua raid GetGroupNumber(index)

This number will return group number and not let us iterate a bunch of
times to verify group numbers
This commit is contained in:
Michael Cook (mackal) 2018-08-15 21:35:19 -04:00
parent 54abeba1ce
commit 585ef81fde
2 changed files with 14 additions and 1 deletions

View File

@ -122,6 +122,16 @@ Lua_Client Lua_Raid::GetMember(int index) {
return self->members[index].member; return self->members[index].member;
} }
int Lua_Raid::GetGroupNumber(int index) {
Lua_Safe_Call_Int();
if(index >= 72 || index < 0 || self->members[index].GroupNumber == RAID_GROUPLESS) {
return -1;
}
return self->members[index].GroupNumber;
}
luabind::scope lua_register_raid() { luabind::scope lua_register_raid() {
return luabind::class_<Lua_Raid>("Raid") return luabind::class_<Lua_Raid>("Raid")
@ -133,6 +143,7 @@ luabind::scope lua_register_raid() {
.def("GroupCount", (int(Lua_Raid::*)(uint32))&Lua_Raid::GroupCount) .def("GroupCount", (int(Lua_Raid::*)(uint32))&Lua_Raid::GroupCount)
.def("RaidCount", (int(Lua_Raid::*)(void))&Lua_Raid::RaidCount) .def("RaidCount", (int(Lua_Raid::*)(void))&Lua_Raid::RaidCount)
.def("GetGroup", (uint32(Lua_Raid::*)(const char*))&Lua_Raid::GetGroup) .def("GetGroup", (uint32(Lua_Raid::*)(const char*))&Lua_Raid::GetGroup)
.def("GetGroup", (uint32(Lua_Raid::*)(Lua_Client))&Lua_Raid::GetGroup)
.def("SplitExp", (void(Lua_Raid::*)(uint32,Lua_Mob))&Lua_Raid::SplitExp) .def("SplitExp", (void(Lua_Raid::*)(uint32,Lua_Mob))&Lua_Raid::SplitExp)
.def("GetTotalRaidDamage", (uint32(Lua_Raid::*)(Lua_Mob))&Lua_Raid::GetTotalRaidDamage) .def("GetTotalRaidDamage", (uint32(Lua_Raid::*)(Lua_Mob))&Lua_Raid::GetTotalRaidDamage)
.def("SplitMoney", (void(Lua_Raid::*)(uint32,uint32,uint32,uint32))&Lua_Raid::SplitMoney) .def("SplitMoney", (void(Lua_Raid::*)(uint32,uint32,uint32,uint32))&Lua_Raid::SplitMoney)
@ -146,7 +157,8 @@ luabind::scope lua_register_raid() {
.def("TeleportGroup", (int(Lua_Raid::*)(Lua_Mob,uint32,uint32,float,float,float,float,uint32))&Lua_Raid::TeleportGroup) .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) .def("TeleportRaid", (int(Lua_Raid::*)(Lua_Mob,uint32,uint32,float,float,float,float))&Lua_Raid::TeleportRaid)
.def("GetID", (int(Lua_Raid::*)(void))&Lua_Raid::GetID) .def("GetID", (int(Lua_Raid::*)(void))&Lua_Raid::GetID)
.def("GetMember", (Lua_Client(Lua_Raid::*)(int))&Lua_Raid::GetMember); .def("GetMember", (Lua_Client(Lua_Raid::*)(int))&Lua_Raid::GetMember)
.def("GetGroupNumber", (int(Lua_Raid::*)(int))&Lua_Raid::GetGroupNumber);
} }
#endif #endif

View File

@ -47,6 +47,7 @@ public:
void TeleportRaid(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h); void TeleportRaid(Lua_Mob sender, uint32 zone_id, uint32 instance_id, float x, float y, float z, float h);
int GetID(); int GetID();
Lua_Client GetMember(int index); Lua_Client GetMember(int index);
int GetGroupNumber(int index);
}; };
#endif #endif