本文整理汇总了C++中AdventureManager::GetAdventureData方法的典型用法代码示例。如果您正苦于以下问题:C++ AdventureManager::GetAdventureData方法的具体用法?C++ AdventureManager::GetAdventureData怎么用?C++ AdventureManager::GetAdventureData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdventureManager
的用法示例。
在下文中一共展示了AdventureManager::GetAdventureData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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++;
}
}
示例2: Process
//.........这里部分代码省略.........
break;
}
case ServerOP_QGlobalDelete:
{
if(pack->size != sizeof(ServerQGlobalDelete_Struct))
{
break;
}
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_AdventureRequest:
{
adventure_manager.CalculateAdventureRequestReply((const char*)pack->pBuffer);
break;
}
case ServerOP_AdventureRequestCreate:
{
adventure_manager.TryAdventureCreate((const char*)pack->pBuffer);
break;
}
case ServerOP_AdventureDataRequest:
{
AdventureFinishEvent fe;
while(adventure_manager.PopFinishedEvent((const char*)pack->pBuffer, fe))
{
adventure_manager.SendAdventureFinish(fe);
}
adventure_manager.GetAdventureData((const char*)pack->pBuffer);
break;
}
case ServerOP_AdventureClickDoor:
{
ServerPlayerClickedAdventureDoor_Struct *pcad = (ServerPlayerClickedAdventureDoor_Struct*)pack->pBuffer;
adventure_manager.PlayerClickedDoor(pcad->player, pcad->zone_id, pcad->id);
break;
}
case ServerOP_AdventureLeave:
{
adventure_manager.LeaveAdventure((const char*)pack->pBuffer);
break;
}
case ServerOP_AdventureCountUpdate:
{
ServerAdventureCount_Struct *sc = (ServerAdventureCount_Struct*)pack->pBuffer;
adventure_manager.IncrementCount(sc->instance_id);
break;
}
case ServerOP_AdventureAssaCountUpdate:
{
adventure_manager.IncrementAssassinationCount(*((uint16*)pack->pBuffer));
break;
}
case ServerOP_AdventureZoneData:
{
adventure_manager.GetZoneData(*((uint16*)pack->pBuffer));
示例3: Finished
void Adventure::Finished(AdventureWinStatus ws)
{
list<string>::iterator iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
if(current)
{
if(current->Online() == CLE_Status_InZone)
{
//We can send our packets only.
ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer;
strcpy(af->player, (*iter).c_str());
af->theme = GetTemplate()->theme;
if(ws == AWS_Win)
{
af->win = true;
af->points = GetTemplate()->win_points;
}
else if(ws == AWS_SecondPlace)
{
af->win = true;
af->points = GetTemplate()->lose_points;
}
else
{
af->win = false;
af->points = 0;
}
pack->Deflate();
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
delete pack;
}
else
{
AdventureFinishEvent afe;
afe.name = (*iter);
if(ws == AWS_Win)
{
afe.theme = GetTemplate()->theme;
afe.points = GetTemplate()->win_points;
afe.win = true;
}
else if(ws == AWS_SecondPlace)
{
afe.theme = GetTemplate()->theme;
afe.points = GetTemplate()->lose_points;
afe.win = true;
}
else
{
afe.win = false;
afe.points = 0;
}
adventure_manager.AddFinishedEvent(afe);
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
}
}
else
{
AdventureFinishEvent afe;
afe.name = (*iter);
if(ws == AWS_Win)
{
afe.theme = GetTemplate()->theme;
afe.points = GetTemplate()->win_points;
afe.win = true;
}
else if(ws == AWS_SecondPlace)
{
afe.theme = GetTemplate()->theme;
afe.points = GetTemplate()->lose_points;
afe.win = true;
}
else
{
afe.win = false;
afe.points = 0;
}
adventure_manager.AddFinishedEvent(afe);
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
}
iter++;
}
adventure_manager.GetAdventureData(this);
}