本文整理汇总了C++中ZSList类的典型用法代码示例。如果您正苦于以下问题:C++ ZSList类的具体用法?C++ ZSList怎么用?C++ ZSList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZSList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SendPacket
bool ClientList::SendPacket(const char* to, ServerPacket* pack) {
if (to == 0 || to[0] == 0) {
zoneserver_list.SendPacket(pack);
return true;
}
else if (to[0] == '*') {
// Cant send a packet to a console....
return false;
}
else {
ClientListEntry* cle = FindCharacter(to);
if (cle != nullptr) {
if (cle->Server() != nullptr) {
cle->Server()->SendPacket(pack);
return true;
}
return false;
} else {
ZoneServer* zs = zoneserver_list.FindByName(to);
if (zs != nullptr) {
zs->SendPacket(pack);
return true;
}
return false;
}
}
return false;
}
开发者ID:eqmactop,项目名称:Server,代码行数:28,代码来源:clientlist.cpp
示例2: handle_rc_relay
void handle_rc_relay(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
std::string error;
std::map<std::string, std::string> res;
uint32 zone_id = 0;
uint32 instance_id = 0;
ZoneServer *zs = nullptr;
if(params.size() < 2) {
error = "Missing zone relay params";
RemoteCallResponse(connection_id, request_id, res, error);
return;
}
zone_id = (uint32)atoi(params[0].c_str());
instance_id = (uint32)atoi(params[1].c_str());
if(!zone_id && !instance_id) {
error = "Zone not booted";
RemoteCallResponse(connection_id, request_id, res, error);
return;
}
if(instance_id) {
zs = zoneserver_list.FindByInstanceID(instance_id);
} else {
zs = zoneserver_list.FindByZoneID(zone_id);
}
if(!zs) {
error = "Zone server not found";
RemoteCallResponse(connection_id, request_id, res, error);
return;
}
uint32 sz = (uint32)(request_id.size() + connection_id.size() + method.size() + 3 + 16);
uint32 p_sz = (uint32)params.size() - 2;
for(uint32 i = 0; i < p_sz; ++i) {
auto ¶m = params[i + 2];
sz += (uint32)param.size();
sz += 5;
}
ServerPacket *pack = new ServerPacket(ServerOP_WIRemoteCall, sz);
pack->WriteUInt32((uint32)request_id.size());
pack->WriteString(request_id.c_str());
pack->WriteUInt32((uint32)connection_id.size());
pack->WriteString(connection_id.c_str());
pack->WriteUInt32((uint32)method.size());
pack->WriteString(method.c_str());
pack->WriteUInt32(p_sz);
for(uint32 i = 0; i < p_sz; ++i) {
auto ¶m = params[i + 2];
pack->WriteUInt32((uint32)param.size());
pack->WriteString(param.c_str());
}
zs->SendPacket(pack);
safe_delete(pack);
}
开发者ID:jcon321,项目名称:Server,代码行数:60,代码来源:remote_call.cpp
示例3: SetStatus
void Adventure::SetStatus(AdventureStatus new_status)
{
if(new_status == AS_WaitingForPrimaryEndTime)
{
status = new_status;
safe_delete(current_timer);
current_timer = new Timer(adventure_template->duration * 1000);
database.SetInstanceDuration(instance_id, adventure_template->duration + 60);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = adventure_template->duration + 60;
pack->Deflate();
zoneserver_list.SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else if(new_status == AS_WaitingForSecondaryEndTime)
{
status = new_status;
safe_delete(current_timer);
current_timer = new Timer(1800000);
database.SetInstanceDuration(instance_id, 1860);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = 1860;
pack->Deflate();
zoneserver_list.SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else if(new_status == AS_Finished)
{
status = new_status;
safe_delete(current_timer);
current_timer = new Timer(1800000);
database.SetInstanceDuration(instance_id, 1800);
ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
ut->instance_id = instance_id;
ut->new_duration = 1860;
pack->Deflate();
zoneserver_list.SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else
{
return;
}
list<string>::iterator iter = players.begin();
while(iter != players.end())
{
adventure_manager.GetAdventureData((*iter).c_str());
iter++;
}
}
开发者ID:Vaion,项目名称:Server,代码行数:59,代码来源:Adventure.cpp
示例4: itoa
map<string,string> EQW::GetZoneDetails(Const_char *zone_ref) {
map<string,string> res;
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
if(zs == NULL) {
res["error"] = "Invalid zone.";
return(res);
}
res["type"] = zs->IsStaticZone()?"static":"dynamic";
res["zone_id"] = itoa(zs->GetZoneID());
res["launch_name"] = zs->GetLaunchName();
res["launched_name"] = zs->GetLaunchedName();
res["short_name"] = zs->GetZoneName();
res["long_name"] = zs->GetZoneLongName();
res["port"] = itoa(zs->GetCPort());
res["player_count"] = itoa(zs->NumPlayers());
//this isnt gunna work for dynamic zones...
res["launcher"] = "";
if(zs->GetZoneID() != 0) {
LauncherLink *ll = launcher_list.FindByZone(zs->GetLaunchName());
if(ll != NULL)
res["launcher"] = ll->GetName();
}
return(res);
}
开发者ID:Xackery,项目名称:provztz,代码行数:28,代码来源:EQW.cpp
示例5: SendGroupIDs
void ZoneServer::SendGroupIDs() {
ServerPacket* pack = new ServerPacket(ServerOP_GroupIDReply, sizeof(ServerGroupIDReply_Struct));
ServerGroupIDReply_Struct* sgi = (ServerGroupIDReply_Struct*)pack->pBuffer;
zoneserver_list.NextGroupIDs(sgi->start, sgi->end);
SendPacket(pack);
delete pack;
}
开发者ID:Vaion,项目名称:Server,代码行数:7,代码来源:zoneserver.cpp
示例6: handle_rc_get_zone_info
void handle_rc_get_zone_info(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
std::string error;
std::map<std::string, std::string> res;
if(params.size() != 1) {
error = "Expected only one zone_id.";
RemoteCallResponse(connection_id, request_id, res, error);
return;
}
ZoneServer *zs = zoneserver_list.FindByID(atoi(params[0].c_str()));
if(zs == nullptr) {
error = "Invalid zone";
RemoteCallResponse(connection_id, request_id, res, error);
return;
}
res["type"] = zs->IsStaticZone() ? "static" : "dynamic";
res["zone_id"] = itoa(zs->GetZoneID());
res["instance_id"] = itoa(zs->GetInstanceID());
res["launch_name"] = zs->GetLaunchName();
res["launched_name"] = zs->GetLaunchedName();
res["short_name"] = zs->GetZoneName();
res["long_name"] = zs->GetZoneLongName();
res["port"] = itoa(zs->GetCPort());
res["player_count"] = itoa(zs->NumPlayers());
RemoteCallResponse(connection_id, request_id, res, error);
}
开发者ID:jcon321,项目名称:Server,代码行数:27,代码来源:remote_call.cpp
示例7: SendGuildDelete
void WorldGuildManager::SendGuildDelete(uint32 guild_id) {
Log(Logs::Detail, Logs::Guilds, "Broadcasting guild delete for guild %d to world", guild_id);
auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
s->guild_id = guild_id;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
开发者ID:N0ctrnl,项目名称:VAServer,代码行数:8,代码来源:wguild_mgr.cpp
示例8: ChangeWID
void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) {
ServerPacket* pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct));
ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*) pack->pBuffer;
scw->charid = iCharID;
scw->newwid = iWID;
zoneserver_list.SendPacket(pack);
delete pack;
}
开发者ID:Vaion,项目名称:Server,代码行数:8,代码来源:zoneserver.cpp
示例9: SendCharRefresh
void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) {
Log(Logs::Detail, Logs::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id);
auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct));
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
s->guild_id = guild_id;
s->old_guild_id = old_guild_id;
s->char_id = charid;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
开发者ID:N0ctrnl,项目名称:VAServer,代码行数:10,代码来源:wguild_mgr.cpp
示例10: SendOnlineGuildMembers
void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
{
int PacketLength = 8;
uint32 Count = 0;
ClientListEntry* from = this->FindCLEByCharacterID(FromID);
if(!from)
{
_log(WORLD__CLIENT_ERR,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
return;
}
LinkedListIterator<ClientListEntry*> Iterator(clientlist);
Iterator.Reset();
while(Iterator.MoreElements())
{
ClientListEntry* CLE = Iterator.GetData();
if(CLE && (CLE->GuildID() == GuildID))
{
PacketLength += (strlen(CLE->name()) + 5);
++Count;
}
Iterator.Advance();
}
Iterator.Reset();
ServerPacket* pack = new ServerPacket(ServerOP_OnlineGuildMembersResponse, PacketLength);
char *Buffer = (char *)pack->pBuffer;
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, FromID);
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, Count);
while(Iterator.MoreElements())
{
ClientListEntry* CLE = Iterator.GetData();
if(CLE && (CLE->GuildID() == GuildID))
{
VARSTRUCT_ENCODE_STRING(Buffer, CLE->name());
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, CLE->zone());
}
Iterator.Advance();
}
zoneserver_list.SendPacket(from->zone(), from->instance(), pack);
safe_delete(pack);
}
开发者ID:eqmactop,项目名称:Server,代码行数:55,代码来源:clientlist.cpp
示例11: SendGuildRefresh
void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
Log(Logs::Detail, Logs::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct));
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
s->guild_id = guild_id;
s->name_change = name;
s->motd_change = motd;
s->rank_change = rank;
s->relation_change = relation;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
开发者ID:N0ctrnl,项目名称:VAServer,代码行数:12,代码来源:wguild_mgr.cpp
示例12: handle_rc_list_zones
void handle_rc_list_zones(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
std::vector<uint32> zones;
zoneserver_list.GetZoneIDList(zones);
std::map<std::string, std::string> res;
uint32 sz = (uint32)zones.size();
for(uint32 i = 0; i < sz; ++i) {
res[itoa(i)] = (itoa(zones[i]));
}
std::string error;
RemoteCallResponse(connection_id, request_id, res, error);
}
开发者ID:jcon321,项目名称:Server,代码行数:13,代码来源:remote_call.cpp
示例13:
//returns an array of zone_refs (opaque)
vector<string> EQW::ListBootedZones() {
vector<string> res;
vector<int32> zones;
zoneserver_list.GetZoneIDList(zones);
vector<int32>::iterator cur, end;
cur = zones.begin();
end = zones.end();
for(; cur != end; cur++) {
res.push_back(itoa(*cur));
}
return(res);
}
开发者ID:Xackery,项目名称:provztz,代码行数:16,代码来源:EQW.cpp
示例14: WorldTCPConnection
ZoneServer::ZoneServer(EmuTCPConnection* itcpc)
: WorldTCPConnection(), tcpc(itcpc), ls_zboot(5000) {
ID = zoneserver_list.GetNextID();
memset(zone_name, 0, sizeof(zone_name));
memset(compiled, 0, sizeof(compiled));
zoneID = 0;
instanceID = 0;
memset(clientaddress, 0, sizeof(clientaddress));
clientport = 0;
BootingUp = false;
authenticated = false;
staticzone = false;
pNumPlayers = 0;
}
开发者ID:Vaion,项目名称:Server,代码行数:15,代码来源:zoneserver.cpp
示例15: EnforceSessionLimit
//Account Limiting Code to limit the number of characters allowed on from a single account at once.
void ClientList::EnforceSessionLimit(int32 iLSAccountID) {
ClientListEntry* ClientEntry = 0;
LinkedListIterator<ClientListEntry*> iterator(clientlist, BACKWARD);
int CharacterCount = 0;
iterator.Reset();
while(iterator.MoreElements()) {
ClientEntry = iterator.GetData();
if ((ClientEntry->LSAccountID() == iLSAccountID) &&
((ClientEntry->Admin() <= (RuleI(World, ExemptAccountLimitStatus))) || (RuleI(World, ExemptAccountLimitStatus) < 0))) {
CharacterCount++;
if (CharacterCount >= (RuleI(World, AccountSessionLimit))){
// If we have a char name, they are in a zone, so send a kick to the zone server
if(strlen(ClientEntry->name()))
{
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, ClientEntry->name());
skp->adminrank = 255;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
ClientEntry->SetOnline(CLE_Status_Offline);
iterator.RemoveCurrent();
continue;
}
}
iterator.Advance();
}
}
开发者ID:epicemu,项目名称:Server,代码行数:46,代码来源:clientlist.cpp
示例16: SendAdventureMessage
void Adventure::SendAdventureMessage(uint32 type, const char *msg)
{
ServerPacket *pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(msg) + 1);
ServerEmoteMessage_Struct *sms = (ServerEmoteMessage_Struct*)pack->pBuffer;
sms->type = type;
strcpy(sms->message, msg);
list<string>::iterator iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
if(current)
{
strcpy(sms->to, (*iter).c_str());
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
}
iter++;
}
delete pack;
}
开发者ID:Vaion,项目名称:Server,代码行数:19,代码来源:Adventure.cpp
示例17: Connect
bool LoginServer::Connect() {
char tmp[25];
if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){
minilogin = true;
_log(WORLD__LS, "Setting World to MiniLogin Server type");
}
else
minilogin = false;
if (minilogin && WorldConfig::get()->WorldAddress.length()==0) {
_log(WORLD__LS_ERR, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
return false;
}
char errbuf[TCPConnection_ErrorBufferSize];
if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) {
_log(WORLD__LS_ERR, "Unable to resolve '%s' to an IP.",LoginServerAddress);
return false;
}
if (LoginServerIP == 0 || LoginServerPort == 0) {
_log(WORLD__LS_ERR, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort);
return false;
}
if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) {
_log(WORLD__LS, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort);
if (minilogin)
SendInfo();
else
SendNewInfo();
SendStatus();
zoneserver_list.SendLSZones();
return true;
}
else {
_log(WORLD__LS_ERR, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf);
return false;
}
}
开发者ID:Vaion,项目名称:Server,代码行数:40,代码来源:LoginServer.cpp
示例18: SendGuildPacket
void ClientList::SendGuildPacket(uint32 guild_id, ServerPacket* pack) {
std::set<uint32> zone_ids;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
if (iterator.GetData()->GuildID() == guild_id) {
zone_ids.insert(iterator.GetData()->zone());
}
iterator.Advance();
}
//now we know all the zones, send it to each one... this is kinda a shitty way to do this
//since its basically O(n^2)
std::set<uint32>::iterator cur, end;
cur = zone_ids.begin();
end = zone_ids.end();
for(; cur != end; cur++) {
zoneserver_list.SendPacket(*cur, pack);
}
}
开发者ID:eqmactop,项目名称:Server,代码行数:22,代码来源:clientlist.cpp
示例19: DisconnectByIP
void ClientList::DisconnectByIP(uint32 iIP) {
ClientListEntry* countCLEIPs = 0;
LinkedListIterator<ClientListEntry*> iterator(clientlist);
iterator.Reset();
while(iterator.MoreElements()) {
countCLEIPs = iterator.GetData();
if ((countCLEIPs->GetIP() == iIP)) {
if(strlen(countCLEIPs->name())) {
ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer;
strcpy(skp->adminname, "SessionLimit");
strcpy(skp->name, countCLEIPs->name());
skp->adminrank = 255;
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
countCLEIPs->SetOnline(CLE_Status_Offline);
iterator.RemoveCurrent();
}
iterator.Advance();
}
}
开发者ID:eqmactop,项目名称:Server,代码行数:23,代码来源:clientlist.cpp
示例20: ProcessZonePacket
void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
switch(pack->opcode) {
case ServerOP_RefreshGuild: {
if(pack->size != sizeof(ServerGuildRefresh_Struct)) {
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct));
return;
}
ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change);
//broadcast this packet to all zones.
zoneserver_list.SendPacket(pack);
//preform a local refresh.
if(!RefreshGuild(s->guild_id)) {
Log(Logs::Detail, Logs::Guilds, "Unable to preform local refresh on guild %d", s->guild_id);
//can we do anything?
}
break;
}
case ServerOP_GuildCharRefresh: {
if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) {
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct));
return;
}
ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id);
//preform the local update
client_list.UpdateClientGuild(s->char_id, s->guild_id);
//broadcast this update to any zone with a member in this guild.
//client_list.SendGuildPacket(s->guild_id, pack);
//because im sick of this not working, sending it to all zones, just spends a bit more bandwidth.
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_DeleteGuild: {
if(pack->size != sizeof(ServerGuildID_Struct)) {
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct));
return;
}
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
Log(Logs::Detail, Logs::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id);
//broadcast this packet to all zones.
zoneserver_list.SendPacket(pack);
//preform a local refresh.
if(!LocalDeleteGuild(s->guild_id)) {
Log(Logs::Detail, Logs::Guilds, "Unable to preform local delete on guild %d", s->guild_id);
//can we do anything?
}
break;
}
case ServerOP_GuildMemberUpdate: {
if(pack->size != sizeof(ServerGuildMemberUpdate_Struct))
{
Log(Logs::Detail, Logs::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct));
return;
}
zoneserver_list.SendPacket(pack);
break;
}
default:
Log(Logs::Detail, Logs::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode);
break;
}
}
开发者ID:N0ctrnl,项目名称:VAServer,代码行数:79,代码来源:wguild_mgr.cpp
注:本文中的ZSList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论