2020-10-04 23:54:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-03-17 19:07:40 +00:00
|
|
|
#include "core/Core.hpp"
|
|
|
|
#include "servers/CNShardServer.hpp"
|
2022-04-23 01:13:00 +00:00
|
|
|
#include "Entities.hpp"
|
2020-10-04 23:54:08 +00:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <list>
|
|
|
|
|
2022-04-23 01:13:00 +00:00
|
|
|
struct Player;
|
|
|
|
enum EntityKind;
|
|
|
|
|
|
|
|
struct Group {
|
|
|
|
std::vector<EntityRef> members;
|
|
|
|
int32_t conditionBitFlag;
|
|
|
|
|
2022-04-24 20:50:03 +00:00
|
|
|
std::vector<EntityRef> filter(EntityKind kind) {
|
2022-04-23 01:13:00 +00:00
|
|
|
std::vector<EntityRef> filtered;
|
|
|
|
std::copy_if(members.begin(), members.end(), std::back_inserter(filtered), [kind](EntityRef e) {
|
|
|
|
return e.kind == kind;
|
|
|
|
});
|
|
|
|
return filtered;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-16 22:29:13 +00:00
|
|
|
namespace Groups {
|
2021-12-16 02:34:15 +00:00
|
|
|
void init();
|
2020-10-05 00:03:13 +00:00
|
|
|
|
2022-04-23 01:13:00 +00:00
|
|
|
void sendToGroup(Group* group, void* buf, uint32_t type, size_t size);
|
2020-10-04 23:54:08 +00:00
|
|
|
void groupTickInfo(Player* plr);
|
2022-04-23 01:13:00 +00:00
|
|
|
void groupKick(Player* plr);
|
|
|
|
|
|
|
|
void addToGroup(EntityRef member, Group* group);
|
|
|
|
void removeFromGroup(EntityRef member, Group* group);
|
|
|
|
void disbandGroup(Group* group);
|
2020-10-04 23:54:08 +00:00
|
|
|
}
|