本文整理汇总了C++中WorldServer类的典型用法代码示例。如果您正苦于以下问题:C++ WorldServer类的具体用法?C++ WorldServer怎么用?C++ WorldServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorldServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ProcessDisconnect
void ServerManager::Process()
{
ProcessDisconnect();
EmuTCPConnection *tcp_c = nullptr;
while(tcp_c = tcps->NewQueuePop())
{
in_addr tmp;
tmp.s_addr = tcp_c->GetrIP();
server_log->Log(log_network, "New world server connection from %s:%d", inet_ntoa(tmp), tcp_c->GetrPort());
WorldServer *cur = GetServerByAddress(tcp_c->GetrIP());
if(cur)
{
server_log->Log(log_network, "World server already existed for %s, removing existing connection and updating current.", inet_ntoa(tmp));
cur->GetConnection()->Free();
cur->SetConnection(tcp_c);
cur->Reset();
}
else
{
WorldServer *w = new WorldServer(tcp_c);
world_servers.push_back(w);
}
}
list<WorldServer*>::iterator iter = world_servers.begin();
while(iter != world_servers.end())
{
if((*iter)->Process() == false)
{
server_log->Log(log_world, "World server %s had a fatal error and had to be removed from the login.", (*iter)->GetLongName().c_str());
delete (*iter);
iter = world_servers.erase(iter);
}
else
{
++iter;
}
}
}
开发者ID:bwilliams1,项目名称:Server,代码行数:40,代码来源:server_manager.cpp
示例2: ProcessLoop
void ProcessLoop(void *tmp) {
#else
void *ProcessLoop(void *tmp) {
#endif
srand(time(NULL));
bool worldwasconnected = worldserver.Connected();
ProcessLoopRunning = true;
while(RunLoops) {
if (worldserver.Connected()) {
worldserver.Process();
worldwasconnected = true;
}
else {
if (worldwasconnected && ZoneLoaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (ZoneLoaded) {
if (numclients > 0) // Don't run entity_list Process() unless there are clients inside.
entity_list.Process();
else
entity_list.BoatProcessOnly(); // Tazadar : We move boats even if the zone is empty !
if (!zone->Process()) {
Zone::Shutdown();
}
}
Sleep(1);
}
ProcessLoopRunning = false;
#ifndef WIN32
return 0;
#endif
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:33,代码来源:net.cpp
示例3: GuildApproved
void GuildApproval::GuildApproved()
{
char petitext[PBUFFER] = "A new guild was founded! Guildname: ";
char gmembers[MBUFFER] = " ";
if(!owner)
return;
database.GetVariable("GuildCreation", founders, 3);
uint8 tmp = atoi(founders);
uint32 tmpeq = guild_mgr.CreateGuild(guild, owner->CharacterID());
guild_mgr.SetGuild(owner->CharacterID(),tmpeq,2);
owner->SendAppearancePacket(AT_GuildID,true,false);
for(int i=0;i<tmp;i++)
{
if(members[i])
{
owner->Message(CC_Default, "%s",members[i]->GetName());
owner->Message(CC_Default, "%i",members[i]->CharacterID());
guild_mgr.SetGuild(members[i]->CharacterID(),tmpeq,0);
size_t len = MBUFFER - strlen(gmembers)+1;
strncat(gmembers," ",len);
strncat(gmembers,members[i]->GetName(),len);
}
}
size_t len = PBUFFER - strlen(petitext)+1;
strncat(petitext,guild,len);
strncat(petitext," Leader: ",len);
strncat(petitext,owner->CastToClient()->GetName(),len);
strncat(petitext," Members:",len);
strncat(petitext,gmembers,len);
Petition* pet = new Petition(owner->CastToClient()->CharacterID());
pet->SetAName(owner->CastToClient()->AccountName());
pet->SetClass(owner->CastToClient()->GetClass());
pet->SetLevel(owner->CastToClient()->GetLevel());
pet->SetCName(owner->CastToClient()->GetName());
pet->SetRace(owner->CastToClient()->GetRace());
pet->SetLastGM("");
pet->SetCName(owner->CastToClient()->GetName()); //aza77 is this really 2 times needed ??
pet->SetPetitionText(petitext);
pet->SetZone(zone->GetZoneID());
pet->SetUrgency(0);
petition_list.AddPetition(pet);
database.InsertPetitionToDB(pet);
petition_list.UpdateGMQueue();
petition_list.UpdateZoneListQueue();
worldserver.SendEmoteMessage(0, 0, 80, 15, "%s has made a petition. #%i", owner->CastToClient()->GetName(), pet->GetID());
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_RefreshGuild;
pack->size = tmp;
pack->pBuffer = new uchar[pack->size];
memcpy(pack->pBuffer, &tmpeq, 4);
worldserver.SendPacket(pack);
safe_delete(pack);
owner->Message(CC_Default, "Your guild was created.");
owner = 0;
}
开发者ID:jcon321,项目名称:Server,代码行数:56,代码来源:guild_mgr.cpp
示例4: GroupUpdate
void Raid::GroupUpdate(uint32 gid, bool initial)
{
if(gid > 11) //ungrouped member doesn't need grouping.
return;
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
{
if(strlen(members[x].membername) > 0){
if(members[x].GroupNumber == gid){
if(members[x].member) {
SendGroupUpdate(members[x].member);
SendGroupLeadershipAA(members[x].member, gid);
}
}
}
}
if(initial){
ServerPacket *pack = new ServerPacket(ServerOP_UpdateGroup, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->gid = gid;
rga->rid = GetID();
rga->zoneid = zone->GetZoneID();
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
}
开发者ID:surlyone,项目名称:Server,代码行数:26,代码来源:raids.cpp
示例5: Process
void RemoteCallSubscriptionHandler::Process() {
//create a check for all these connection ids packet
uint32 sz = 12;
auto iter = connection_ids.begin();
while(iter != connection_ids.end()) {
sz += (uint32)iter->first.size();
sz += 5;
++iter;
}
if (!zone)
return;
ServerPacket *pack = new ServerPacket(ServerOP_WIClientSession, sz);
pack->WriteUInt32((uint32)zone->GetZoneID());
pack->WriteUInt32((uint32)zone->GetInstanceID());
pack->WriteUInt32((uint32)connection_ids.size());
iter = connection_ids.begin();
while(iter != connection_ids.end()) {
pack->WriteUInt32((uint32)iter->first.size());
pack->WriteString(iter->first.c_str());
++iter;
}
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:jcon321,项目名称:Server,代码行数:28,代码来源:remote_call_subscribe.cpp
示例6: AddMember
void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bool looter){
if(!c)
return;
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_members SET raidid=%lu, charid=%lu, groupid=%lu, _class=%d, level=%d, name='%s', isgroupleader=%d, israidleader=%d, islooter=%d", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter ),errbuf,&result)){
mysql_free_result(result);
}
safe_delete_array(query);
LearnMembers();
VerifyRaid();
if(group < 12)
GroupUpdate(group);
SendRaidAddAll(c->GetName());
c->SetRaidGrouped(true);
ServerPacket *pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
strn0cpy(rga->playername, c->GetName(), 64);
rga->zoneid = zone->GetZoneID();
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Derision,项目名称:Server,代码行数:29,代码来源:raids.cpp
示例7: SetGroupLeader
void Raid::SetGroupLeader(const char *who, bool glFlag)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET isgroupleader=%lu WHERE name='%s'", (unsigned long)glFlag, who),errbuf,&result)){
mysql_free_result(result);
}
safe_delete_array(query);
LearnMembers();
VerifyRaid();
//if(glFlag == true){ //we're setting the flag
//this->SendMakeGroupLeaderPacket(who);
//}
ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
strn0cpy(rga->playername, who, 64);
rga->zoneid = zone->GetZoneID();
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Derision,项目名称:Server,代码行数:26,代码来源:raids.cpp
示例8: DisbandRaid
void Raid::DisbandRaid()
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){
mysql_free_result(result);
}
safe_delete_array(query);
LearnMembers();
VerifyRaid();
SendRaidDisbandAll();
ServerPacket *pack = new ServerPacket(ServerOP_RaidDisband, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
strn0cpy(rga->playername, " ", 64);
rga->zoneid = zone->GetZoneID();
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
forceDisband = true;
}
开发者ID:Derision,项目名称:Server,代码行数:25,代码来源:raids.cpp
示例9: LockRaid
void Raid::LockRaid(bool lockFlag)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET locked=%d WHERE raidid=%lu", lockFlag, (unsigned long)GetID()),errbuf,&result)){
mysql_free_result(result);
}
safe_delete_array(query);
locked = lockFlag;
if(lockFlag)
SendRaidLock();
else
SendRaidUnlock();
ServerPacket *pack = new ServerPacket(ServerOP_RaidLockFlag, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
rga->zoneid = zone->GetZoneID();
rga->gid = lockFlag;
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Derision,项目名称:Server,代码行数:25,代码来源:raids.cpp
示例10: RemoveMember
void Raid::RemoveMember(const char *c)
{
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
MYSQL_RES *result;
if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members where name='%s'", c ),errbuf,&result)){
mysql_free_result(result);
}
Client *m = entity_list.GetClientByName(c);
safe_delete_array(query);
disbandCheck = true;
SendRaidRemoveAll(c);
SendRaidDisband(m);
LearnMembers();
VerifyRaid();
if(m){
m->SetRaidGrouped(false);
}
ServerPacket *pack = new ServerPacket(ServerOP_RaidRemove, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
rga->instance_id = zone->GetInstanceID();
strn0cpy(rga->playername, c, 64);
rga->zoneid = zone->GetZoneID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Derision,项目名称:Server,代码行数:30,代码来源:raids.cpp
示例11: SetRaidLeader
void Raid::SetRaidLeader(const char *wasLead, const char *name)
{
std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead);
auto results = database.QueryDatabase(query);
if (!results.Success())
LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name);
results = database.QueryDatabase(query);
if (!results.Success())
LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str());
strn0cpy(leadername, name, 64);
Client *c = entity_list.GetClientByName(name);
if(c)
SetLeader(c);
LearnMembers();
VerifyRaid();
SendMakeLeaderPacket(name);
ServerPacket *pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct));
ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer;
rga->rid = GetID();
strn0cpy(rga->playername, name, 64);
rga->zoneid = zone->GetZoneID();
rga->instance_id = zone->GetInstanceID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:surlyone,项目名称:Server,代码行数:31,代码来源:raids.cpp
示例12: SendGuildMembers
void Client::SendGuildMembers() {
uint32 len;
uint8 *data = guild_mgr.MakeGuildMembers(GuildID(), GetName(), len);
if(data == nullptr)
return; //invalid guild, shouldent happen.
auto outapp = new EQApplicationPacket(OP_GuildMemberList);
outapp->size = len;
outapp->pBuffer = data;
data = nullptr;
Log(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size);
FastQueuePacket(&outapp);
auto pack =
new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct));
ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer;
srogms->FromID = CharacterID();
srogms->GuildID = GuildID();
worldserver.SendPacket(pack);
safe_delete(pack);
// We need to send the Guild URL and Channel name again, as sending OP_GuildMemberList appears to clear this information out.
SendGuildURL();
SendGuildChannel();
}
开发者ID:N0ctrnl,项目名称:VAServer,代码行数:31,代码来源:guild.cpp
示例13: SendQuery
void QueryServ::SendQuery(std::string Query)
{
ServerPacket* pack = new ServerPacket(ServerOP_QSSendQuery, Query.length() + 5);
pack->WriteUInt32(Query.length()); /* Pack Query String Size so it can be dynamically broken out at queryserv */
pack->WriteString(Query.c_str()); /* Query */
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Kiddinglife,项目名称:Server,代码行数:8,代码来源:queryserv.cpp
示例14: UpdateZoneListQueue
void PetitionList::UpdateZoneListQueue() {
ServerPacket* pack = new ServerPacket(ServerOP_Petition, sizeof(ServerPetitionUpdate_Struct));
ServerPetitionUpdate_Struct* pupdate = (ServerPetitionUpdate_Struct*) pack->pBuffer;
pupdate->petid = 0x00;
pupdate->status = 0x00;
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:Leere,项目名称:Server,代码行数:8,代码来源:petitions.cpp
示例15: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
worldserver.Disconnect();
// safe_delete(worldserver);
_log(ZONE__INIT, "Shutting down...");
}
开发者ID:Zamthos,项目名称:Server,代码行数:8,代码来源:net.cpp
示例16: SendGuildDelete
void ZoneGuildManager::SendGuildDelete(uint32 guild_id) {
Log.Out(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id);
ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct));
ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer;
s->guild_id = guild_id;
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:jcon321,项目名称:Server,代码行数:8,代码来源:guild_mgr.cpp
示例17: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
worldserver.Disconnect();
// safe_delete(worldserver);
LogFile->write(EQEMuLog::Status, "Shutting down...");
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:8,代码来源:net.cpp
示例18: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
MNetLoop.lock();
RunLoops = false;
worldserver.Disconnect();
MNetLoop.unlock();
// safe_delete(worldserver);
EQC::Common::PrintF(CP_ZONESERVER, "Shutting down...\n");
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:10,代码来源:net.cpp
示例19: RequestOnlineGuildMembers
void ZoneGuildManager::RequestOnlineGuildMembers(uint32 FromID, uint32 GuildID)
{
ServerPacket* pack = new ServerPacket(ServerOP_RequestOnlineGuildMembers, sizeof(ServerRequestOnlineGuildMembers_Struct));
ServerRequestOnlineGuildMembers_Struct *srogm = (ServerRequestOnlineGuildMembers_Struct*)pack->pBuffer;
srogm->FromID = FromID;
srogm->GuildID = GuildID;
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:jcon321,项目名称:Server,代码行数:11,代码来源:guild_mgr.cpp
示例20: SendGuildRefresh
void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
Log.Out(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
ServerPacket* 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;
worldserver.SendPacket(pack);
safe_delete(pack);
}
开发者ID:jcon321,项目名称:Server,代码行数:12,代码来源:guild_mgr.cpp
注:本文中的WorldServer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论