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); }
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); }