// This packet actually contains the char name after the opcode void CUser::GameStart(char *pBuf) { int index = 0; BYTE opcode = GetByte(pBuf, index); if (opcode == 1) { SendMyInfo(); m_pMain->UserInOutForMe(this); m_pMain->NpcInOutForMe(this); SendNotice(); SendTimeStatus(); // SendHackToolList(); char send_buff[] = { WIZ_GAMESTART }; Send(send_buff, sizeof(send_buff)); } else if (opcode == 2) { m_State = STATE_GAMESTART; UserInOut(USER_REGENE); if (!m_pUserData->m_bCity && m_pUserData->m_sHp <= 0) m_pUserData->m_bCity = -1; if (m_pUserData->m_bCity > 0) { int level = m_pUserData->m_bLevel; if (m_pUserData->m_bCity <= 100) level--; // make sure we don't exceed bounds if (level > MAX_LEVEL) level = MAX_LEVEL; else if (level < 1) level = 1; m_iLostExp = (m_pMain->GetExpByLevel(level) * (m_pUserData->m_bCity % 10) / 100); if (((m_pUserData->m_bCity % 10) / 100) == 1) m_iLostExp /= 2; } else { m_iLostExp = 0; } BlinkStart(); SetUserAbility(); // rental // ItemMallMagicRecast(); } }
HANDLE* EstablishSession( char *server, char *srvpipename ) { static HANDLE PipeH[2]; char pipenameSrvIn[200]; char pipenameSrvOut[200]; sprintf(pipenameSrvIn ,SERVER_READ_PIPE ,server,srvpipename); sprintf(pipenameSrvOut,SERVER_WRITE_PIPE,server,srvpipename); if ((INVALID_HANDLE_VALUE==(PipeH[0]=CreateFile(pipenameSrvOut, GENERIC_READ ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL))) || (INVALID_HANDLE_VALUE==(PipeH[1]=CreateFile(pipenameSrvIn , GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL)))) { DWORD Err=GetLastError(); char msg[128]; Errormsg("*** Unable to Connect ***"); // // Print a helpful message // switch(Err) { case 2: sprintf(msg,"Invalid PipeName %s",srvpipename);break; case 53:sprintf(msg,"Server %s not found",server);break; default: FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, Err, 0, msg, 128, NULL); break; } WRITEF((VBuff,"Diagnosis:%s\n",msg)); return(NULL); } WRITEF((VBuff,"Connected..\n\n")); SendMyInfo(PipeH); return(PipeH); }
// This packet actually contains the char name after the opcode void CUser::GameStart(Packet & pkt) { if (isInGame()) return; uint8 opcode = pkt.read<uint8>(); if (opcode == 1) { SendMyInfo(); g_pMain->UserInOutForMe(this); g_pMain->MerchantUserInOutForMe(this); g_pMain->NpcInOutForMe(this); SendNotice(); SendTime(); SendWeather(); // SendHackToolList(); Packet result(WIZ_GAMESTART); Send(&result); } else if (opcode == 2) { m_state = GAME_STATE_INGAME; UserInOut(INOUT_RESPAWN); if (!m_bCity && m_sHp <= 0) m_bCity = -1; if (m_bCity > 0) { int level = GetLevel(); if (m_bCity <= 100) level--; // make sure we don't exceed bounds if (level > MAX_LEVEL) level = MAX_LEVEL; else if (level < 1) level = 1; m_iLostExp = (g_pMain->GetExpByLevel(level) * (m_bCity % 10) / 100); if (((m_bCity % 10) / 100) == 1) m_iLostExp /= 2; } else { m_iLostExp = 0; } CheckSeedQuest(); BlinkStart(); SetUserAbility(); // rental RecastSavedMagic(m_sHp == m_iMaxHp ? true : false); //ItemMallRecast // If we've relogged while dead, we need to make sure the client // is still given the option to revive. if (isDead()) SendDeathAnimation(); g_pMain->TempleEventGetActiveEventTime(this); } m_tHPLastTimeNormal = UNIXTIME; }