本文整理汇总了C++中ZSList::FindByInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSList::FindByInstanceID方法的具体用法?C++ ZSList::FindByInstanceID怎么用?C++ ZSList::FindByInstanceID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSList
的用法示例。
在下文中一共展示了ZSList::FindByInstanceID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: Clearance
void Client::Clearance(int8 response)
{
ZoneServer* zs = nullptr;
if(instanceID > 0)
{
zs = zoneserver_list.FindByInstanceID(instanceID);
}
else
{
zs = zoneserver_list.FindByZoneID(zoneID);
}
if(zs == 0 || response == -1 || response == 0)
{
if (zs == 0)
{
clog(WORLD__CLIENT_ERR,"Unable to find zoneserver in Client::Clearance!!");
} else {
clog(WORLD__CLIENT_ERR, "Invalid response %d in Client::Clearance", response);
}
ZoneUnavail();
return;
}
EQApplicationPacket* outapp;
if (zs->GetCAddress() == nullptr) {
clog(WORLD__CLIENT_ERR, "Unable to do zs->GetCAddress() in Client::Clearance!!");
ZoneUnavail();
return;
}
if (zoneID == 0) {
clog(WORLD__CLIENT_ERR, "zoneID is nullptr in Client::Clearance!!");
ZoneUnavail();
return;
}
const char* zonename = database.GetZoneName(zoneID);
if (zonename == 0) {
clog(WORLD__CLIENT_ERR, "zonename is nullptr in Client::Clearance!!");
ZoneUnavail();
return;
}
// @bp This is the chat server
/*
char packetData[] = "64.37.148.34.9876,MyServer,Testchar,23cd2c95";
outapp = new EQApplicationPacket(OP_0x0282, sizeof(packetData));
strcpy((char*)outapp->pBuffer, packetData);
QueuePacket(outapp);
delete outapp;
*/
// Send zone server IP data
outapp = new EQApplicationPacket(OP_ZoneServerInfo, sizeof(ZoneServerInfo_Struct));
ZoneServerInfo_Struct* zsi = (ZoneServerInfo_Struct*)outapp->pBuffer;
const char *zs_addr=zs->GetCAddress();
if (!zs_addr[0]) {
if (cle->IsLocalClient()) {
struct in_addr in;
in.s_addr = zs->GetIP();
zs_addr=inet_ntoa(in);
if (!strcmp(zs_addr,"127.0.0.1"))
zs_addr=WorldConfig::get()->LocalAddress.c_str();
} else {
zs_addr=WorldConfig::get()->WorldAddress.c_str();
}
}
strcpy(zsi->ip, zs_addr);
zsi->port =zs->GetCPort();
clog(WORLD__CLIENT,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port);
QueuePacket(outapp);
safe_delete(outapp);
if (cle)
cle->SetOnline(CLE_Status_Zoning);
}
示例3: EnterWorld
void Client::EnterWorld(bool TryBootup) {
if (zoneID == 0)
return;
ZoneServer* zs = nullptr;
if(instanceID > 0)
{
if(database.VerifyInstanceAlive(instanceID, GetCharID()))
{
if(database.VerifyZoneInstance(zoneID, instanceID))
{
zs = zoneserver_list.FindByInstanceID(instanceID);
}
else
{
instanceID = 0;
zs = nullptr;
database.MoveCharacterToBind(GetCharID());
ZoneUnavail();
return;
}
}
else
{
instanceID = 0;
zs = nullptr;
database.MoveCharacterToBind(GetCharID());
ZoneUnavail();
return;
}
}
else
zs = zoneserver_list.FindByZoneID(zoneID);
const char *zone_name=database.GetZoneName(zoneID, true);
if (zs) {
// warn the world we're comming, so it knows not to shutdown
zs->IncommingClient(this);
}
else {
if (TryBootup) {
clog(WORLD__CLIENT,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID);
autobootup_timeout.Start();
pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID);
if (pwaitingforbootup == 0) {
clog(WORLD__CLIENT_ERR,"No zoneserver available to boot up.");
ZoneUnavail();
}
return;
}
else {
clog(WORLD__CLIENT_ERR,"Requested zone %s is no running.",zone_name);
ZoneUnavail();
return;
}
}
pwaitingforbootup = 0;
cle->SetChar(charid, char_name);
database.UpdateLiveChar(char_name, GetAccountID());
clog(WORLD__CLIENT,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID);
// database.SetAuthentication(account_id, char_name, zone_name, ip);
if (seencharsel) {
if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) {
clog(WORLD__CLIENT_ERR,"Enter world failed. Zone is locked.");
ZoneUnavail();
return;
}
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_AcceptWorldEntrance;
pack->size = sizeof(WorldToZone_Struct);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer;
wtz->account_id = GetAccountID();
wtz->response = 0;
zs->SendPacket(pack);
delete pack;
}
else { // if they havent seen character select screen, we can assume this is a zone
// to zone movement, which should be preauthorized before they leave the previous zone
Clearance(1);
}
}
示例4: Process
//.........这里部分代码省略.........
// called, so it will be available when they ask to zone.
//
if(pack->size != sizeof(ZoneToZone_Struct))
break;
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
ClientListEntry* client = NULL;
if(WorldConfig::get()->UpdateStats)
client = client_list.FindCharacter(ztz->name);
zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n",
ztz->name, ztz->current_zone_id, ztz->requested_zone_id);
if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) // this is a request from the egress zone
{
zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name);
if
(
ztz->admin < 80 &&
ztz->ignorerestrictions < 2 &&
zoneserver_list.IsZoneLocked(ztz->requested_zone_id)
)
{
ztz->response = 0;
SendPacket(pack);
break;
}
ZoneServer *ingress_server = NULL;
if(ztz->requested_instance_id > 0)
{
ingress_server = zoneserver_list.FindByInstanceID(ztz->requested_instance_id);
}
else
{
ingress_server = zoneserver_list.FindByZoneID(ztz->requested_zone_id);
}
if(ingress_server) // found a zone already running
{
_log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name);
ztz->response = 1;
}
else // need to boot one
{
int server_id;
if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){
_log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name);
// bootup successful, ready to rock
ztz->response = 1;
ingress_server = zoneserver_list.FindByID(server_id);
}
else
{
_log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name);
// bootup failed, send back error code 0
ztz->response = 0;
}
}
if(ztz->response!=0 && client)
client->LSZoneChange(ztz);
SendPacket(pack); // send back to egress server
if(ingress_server) // if we couldn't boot one, this is 0
示例5: Process
//.........这里部分代码省略.........
struct in_addr in;
in.s_addr = GetIP();
_log(WEB_INTERFACE__ERROR, "WebInterface authorization failed.");
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
Disconnect();
return false;
}
}
else
{
_log(WEB_INTERFACE__ERROR, "**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthorized zone access.");
authenticated = true;
}
delete pack;
continue;
}
switch(pack->opcode)
{
case 0:
break;
case ServerOP_KeepAlive:
{
// ignore this
break;
}
case ServerOP_ZAAuth:
{
_log(WEB_INTERFACE__ERROR, "Got authentication from WebInterface when they are already authenticated.");
break;
}
case ServerOP_WIRemoteCall:
{
char *id = nullptr;
char *session_id = nullptr;
char *method = nullptr;
id = new char[pack->ReadUInt32() + 1];
pack->ReadString(id);
session_id = new char[pack->ReadUInt32() + 1];
pack->ReadString(session_id);
method = new char[pack->ReadUInt32() + 1];
pack->ReadString(method);
uint32 param_count = pack->ReadUInt32();
std::vector<std::string> params;
for(uint32 i = 0; i < param_count; ++i) {
char *p = new char[pack->ReadUInt32() + 1];
pack->ReadString(p);
params.push_back(p);
safe_delete_array(p);
}
if (remote_call_methods.count(method) != 0) {
auto f = remote_call_methods[method];
f(method, session_id, id, params);
}
safe_delete_array(id);
safe_delete_array(session_id);
safe_delete_array(method);
break;
}
case ServerOP_WIClientSessionResponse: {
uint32 zone_id = pack->ReadUInt32();
uint32 instance_id = pack->ReadUInt32();
ZoneServer *zs = nullptr;
if(instance_id != 0) {
zs = zoneserver_list.FindByInstanceID(instance_id);
} else {
zs = zoneserver_list.FindByZoneID(zone_id);
}
if(zs) {
ServerPacket *npack = new ServerPacket(ServerOP_WIClientSessionResponse, pack->size - 8);
memcpy(npack->pBuffer, pack->pBuffer + 8, pack->size - 8);
zs->SendPacket(npack);
safe_delete(npack);
}
break;
}
default:
{
_log(WEB_INTERFACE__ERROR, "Unknown ServerOPcode from WebInterface 0x%04x, size %d", pack->opcode, pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
}
delete pack;
}
return(true);
}