UINT GCChatHandler::Execute(GCChat* pPacket, Player* pPlayer) { SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; pAgent->getLog()->addLogFmt( "%d:%s:%s", pPacket->GetChatType(), pPacket->GetSourName(), pPacket->GetContex() ); return PACKET_EXE_CONTINUE; }
UINT LCRetCreateCharHandler::Execute(LCRetCreateChar* pPacket, Player* pPlayer) { __ENTER_FUNCTION SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; if(pPacket) { ASKCREATECHAR_RESULT res = pPacket->GetResult(); switch(res) { case ASKCREATECHAR_SUCCESS: //成功 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_success\")"); break; } case ASKCREATECHAR_SERVER_BUSY: //服务器忙,重试 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_repeat\")"); break; } case ASKCREATECHAR_OP_TIMES: //操作过于频繁 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_too_fast\")"); break; } case ASKCREATECHAR_FULL: //角色已经满了 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_full\")"); break; } case ASKCREATECHAR_OP_ERROR: //错误操作流程 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_proc\")"); break; } case ASKCREATECHAR_INTERNAL_ERROR: //内部错误 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_inner\")"); break; } case ASKCREATECHAR_SAME_NAME: // 名字重复 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_name\")"); break; } default: // 未知错误 { pAgent->getLuaState()->DoString("Procedure_CharCreate_SetState(\"create_char_unknow\")"); break; } } } return PACKET_EXE_CONTINUE; __LEAVE_FUNCTION return PACKET_EXE_ERROR; }
UINT GCStallApplyHandler::Execute(GCStallApply* pPacket, Player* pPlayer) { SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; BYTE IsCanStall = pPacket->GetIsCanStall(); if(IsCanStall == TRUE) { pAgent->getLuaState()->DoString("Procedure_Main_SetState(\"baitan_confirm_suc\")"); } return PACKET_EXE_CONTINUE; }
UINT GCConnectHandler::Execute(GCConnect* pPacket, Player* pPlayer) { SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; //save variable pAgent->getVariable()->setAs_Int("Scene_ID", (INT)pPacket->GetSceneID()); pAgent->getVariable()->setAs_Vector2("Scene_EnterPos", (float)pPacket->GetWorldPos()->m_fX, (float)pPacket->GetWorldPos()->m_fZ); pAgent->getLuaState()->DoString("Procedure_GameServer_SetState(\"conn_val_success\")"); return PACKET_EXE_CONTINUE; }
UINT GCNotifyChangeSceneHandler::Execute(GCNotifyChangeScene* pPacket, Player* pPlayer) { SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; // 发送请求消息 CGAskChangeScene msg; msg.SetSourSceneID(pPacket->getCurrentSceneID()); msg.SetDestSceneID(pPacket->getTargetSceneID()); pAgent->getNetManager()->sendPacket(&msg); // 设置目标场景 WORLD_POS* pos = pPacket->getTargetPos(); pAgent->getVariable()->setAs_Int( "DestScene_ID", pPacket->getTargetSceneID() ); pAgent->getVariable()->setAs_Vector2( "DestScene_EnterPos", pos->m_fX, pos->m_fZ ); return PACKET_EXE_CONTINUE; }
UINT GCNewPlayer_MoveHandler::Execute(GCNewPlayer_Move* pPacket, Player* pPlayer) { //return PACKET_EXE_CONTINUE; SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; if( pPacket ) { pAgent->getObjectManager()->createObject( OT_PLAYEROTHER, (INT)pPacket->GetObjID() ); //char szCommand[1024]; //sprintf( szCommand, "New_Player_IN(\"%d\")", (INT)pPacket->getObjID() ); //pAgent->getLuaState()->DoString(szCommand); //CGCharAskBaseAttrib msg; //msg.setTargetID((INT)pPacket->getObjID()); //pAgent->getNetManager()->sendPacket(&msg); } return PACKET_EXE_CONTINUE; }
UINT GCDelObjectHandler::Execute(GCDelObject* pPacket, Player* pPlayer) { SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; if( pPacket ) { int nObj = pAgent->getObjectManager()->findServerObject( (INT)pPacket->getObjID() ); if( nObj != -1 ) { pAgent->getObjectManager()->destroyObject( nObj ); } else { nObj = pAgent->getObjectManager()->findServerObject( (INT)pPacket->getObjID() ); } //pAgent->getObjectManager()->destroyObject( (INT)pPacket->getObjID() ); } return PACKET_EXE_CONTINUE; }
UINT LCRetCharLoginHandler::Execute(LCRetCharLogin* pPacket, Player* pPlayer) { __ENTER_FUNCTION SMITH::Agent* pAgent = (SMITH::Agent*)pPlayer; const char * szErrorDesc[] = { "成功", "世界满了", "服务器忙,重试", "角色载入出错", "操作过于频繁", "不是角色的所有者", "服务器维护", "非法的SceneID", "角色在线稍后重进", "无足够点数", "月卡到期", "非法流程", }; if(pPacket) { ASKCHARLOGIN_RESULT res; res = pPacket->GetResult(); switch(res) { case ASKCHARLOGIN_SUCCESS: //成功 { UINT iPort = pPacket->GetServerPort(); CHAR* pServerIP = pPacket->GetServerIP(); UINT iUserKey = pPacket->GetUserKey(); pAgent->getVariable()->setVariable("GameServer_Address", pServerIP ); pAgent->getVariable()->setAs_Int("GameServer_Port", iPort ); pAgent->getVariable()->setAs_Int("GameServer_Key", iUserKey ); pAgent->getLuaState()->DoString("Procedure_CharSel_SetState(\"enter_scene\")"); break; } case ASKCHARLIST_WORLD_FULL: case ASKCHARLOGIN_SERVER_BUSY: case ASKCHARLOGIN_LOADDB_ERROR: case ASKCHARLOGIN_OP_TIMES: case ASKCHARLOGIN_NOT_OWNER: case ASKCHARLOGIN_SERVER_STOP: case ASKCHARLOGIN_INVALID_SCENE: case ASKCHARLOGIN_CHARLIVING: case ASKCHARLOGIN_NO_POINT: case ASKCHARLOGIN_END_TIME: case ASKCHARLOGIN_NOT_LOGON: { pAgent->getVariable()->setVariable("CharLogin_ErrorDesc", szErrorDesc[res]); pAgent->getLuaState()->DoString("Procedure_CharSel_SetState(\"enter_scene_error\")"); break; } default: { char szErrorDesc[32]; _snprintf(szErrorDesc, 32, "未知错误%d", res); pAgent->getVariable()->setVariable("CharLogin_ErrorDesc", szErrorDesc); pAgent->getLuaState()->DoString("Procedure_CharSel_SetState(\"enter_scene_error\")"); break; } } } return PACKET_EXE_CONTINUE; __LEAVE_FUNCTION return PACKET_EXE_ERROR; }