本文整理汇总了C++中IPlayer::SetAttack方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayer::SetAttack方法的具体用法?C++ IPlayer::SetAttack怎么用?C++ IPlayer::SetAttack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer::SetAttack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
int nResult = false;
int nRetCode = false;
int i = 0;
printf("%s\n", argv[0]);
srand( (unsigned)time( NULL ) );
memset(g_szGMCommandList, 0, MAX_GM_COUNT * MAX_GM_SIZE);
nRetCode = ProcessArg(argc, argv);
if (!nRetCode)
{
Help();
goto Exit0;
}
//g_thePlayers.empty();
for (i = g_AccoutIDMin; i <= g_AccoutIDMax; i++)
{
char szAccountName[0x100];
sprintf(szAccountName, "Robot%04d", i);
printf("Create %s ... ", szAccountName);
IPlayer *pPlayer = new CPlayer(
g_szServerIP, g_nServerPort,
szAccountName
);
//Sleep(300);
if (!pPlayer)
{
printf("fail!\n");
continue;
}
printf("ok!\n");
// flying add these, make the robot at the specified position
if (g_nFlgSetPos)
pPlayer->SetPos(g_ptBirthPos.x, g_ptBirthPos.y);
// flying add these, make the robot auto attack to the NPCs
if (g_nFlgSetAttack)
pPlayer->SetAttack();
pPlayer->SetSilence(g_nFlgSetSilence);
pPlayer->SetChatTimer(g_nFlgChatTimer);
pPlayer->ConnectToGateway();
g_thePlayers.push_back( pPlayer );
}
printf("Press \'Q\' to End Program\n");
while (true)
{
int ch = 0;
PLAYER_LIST::iterator it;
for ( it = g_thePlayers.begin(); it != g_thePlayers.end(); it ++ )
{
while (true)
{
if (!kbhit())
break;
ch = getch();
ch = toupper(ch);
if ((ch == 'Q') || (ch == 27)) // ESC
break;
}
if ((ch == 'Q') || (ch == 27)) // ESC
break;
//Sleep(rand() % 40);
CPlayer *pPlayer = (CPlayer *)(*it);
if (pPlayer == NULL)
{
Sleep(100);
continue;
}
if ((pPlayer->GetStatus()) != CPlayer::enumExitGame)
continue;
OnlineGameLib::Win32::_tstring sAccountName;
pPlayer->GetAccountName(sAccountName);
delete pPlayer;
pPlayer = NULL;
*it = NULL;
printf("Destory %s ... ok!\n", sAccountName.c_str());
//.........这里部分代码省略.........