Files
2026-06-01 12:46:52 +02:00

302 lines
13 KiB
C++

#pragma once
/** @brief Game의 네트웍 메세지, KeyBoard, Mouse 들의 윈도우 메세지를 Game Msg로 변환해서 돌려 준다.
@warning 주의 : 네트웍, KeyBoard, Mouse 들의 메세지들은 직접 Game 안에서 사용 하지 않는다. */
#include <queue>
#include <Map>
//#include <string>
#include <Windows.h>
#include "KObject.h"
#include <mmo/ArType.h>
class SGameVM : public KObject
{
public:
SGameVM();
~SGameVM();
void Process( DWORD dwTime );
/// NetWork 메세지 받기
bool onReadEvent( struct IStreamSocketConnection * pConn, struct IQueue* pRecvQueue );
/// 윈도우 메세지 받기
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool IsProcGameMsg()
{
// if( m_bActiveRecycle && !m_ReQueueGame.empty() )
if( !m_ReQueueGame.empty() )
return !m_ReQueueGame.empty();
return !m_QueueGame.empty();
}
/// 하나씩 꺼내서 처리한다.
struct SGameMessage* GetGameMsg();
void AddRecycle( struct SGameMessage* pMsg );
void AddDelMsg( struct SGameMessage* pMsg );
void ProcDel();
void AddSafeKeeping( struct SGameMessage* pMsg );
void onHotkey( struct GameHotKeystrcut & HotKey );
void SetGameManager( class SGameManager* pGameManager ) { m_pGameManager = pGameManager; }
virtual void *Perform( KID id, KArg& msg );
// void SetActiveRecycle( BOOL bActive ) { m_bActiveRecycle = bActive; } // 필요하지 않아 보여서 삭제 2009.3.25 by 정동섭
/// 2010.10.06 id에 해당되는 스트링을 찾는다 - prodongi
void lookUpNetStr(unsigned short id, std::string& str);
protected:
void Init();
void Destroy();
bool ISProcNetMsg() { return !m_QueueNet.empty(); }
struct TS_MESSAGE* GetNetMsg();
/// 바로 처리할 메세지
void ProcMsgAtStatic( struct SGameMessage* pMsg );
void onMsgMove ( struct TS_MOVE* pMsg );
void onMsgMoveAck ( struct TS_MOVE_ACK* pMsg );
void onMsgRegionAck( struct TS_REGION_ACK* pMsg );
void onMsgLeave ( struct TS_LEAVE * pMsg );
void onMsgEnter ( struct TS_ENTER * pMsg );
void onMsgLogin ( struct TS_LOGIN_RESULT * pMsg );
void onMsgCharacterList( struct TS_SC_CHARACTER_LIST* pMsg );
void onMsgTimeSync ( struct TS_TIMESYNC * pMsg );
void onAttackEvent ( struct TS_ATTACK_EVENT * pMsg );
void OnDoubleAttackEvent( struct TS_DOUBLE_WEAPON_ATTACK_EVENT * pMsg );
void onCantAttack ( struct TS_SC_CANT_ATTACK* pMsg);
void onMsgHairInfo( struct TS_SC_HAIR_INFO* pMsg);
void OnStatInfo ( struct TS_SC_STAT_INFO* pMsg );
void OnGoldUpdate ( struct TS_SC_GOLD_UPDATE* pMsg );
void OnLevelUpdate ( struct TS_SC_LEVEL_UPDATE* pMsg );
void OnExpUpdate ( struct TS_SC_EXP_UPDATE* pMsg );
void OnBonusExpUpdate( struct TS_SC_BONUS_EXP_JP* pMsg );
void OnAddSummonInfo ( struct TS_SC_ADD_SUMMON_INFO* pMsg );
void OnRemoveSummonInfo( struct TS_SC_REMOVE_SUMMON_INFO* pMsg);
void OnEquipSummonInfo ( struct TS_EQUIP_SUMMON* pMsg );
void OnUnsummon ( struct TS_SC_UNSUMMON* pMsg );
void OnUnsummonNotice ( struct TS_SC_UNSUMMON_NOTICE* pMsg );
void OnSummonEvolution ( struct TS_SC_SUMMON_EVOLUTION* pMsg );
void OnTamingInfo ( struct TS_SC_TAMING_INFO* pMsg );
void OnMountSummon ( struct TS_SC_MOUNT_SUMMON* pMsg );
void OnUnMountSummon ( struct TS_SC_UNMOUNT_SUMMON* pMsg );
void OnSummonNameChange( struct TS_SC_SHOW_SUMMON_NAME_CHANGE* pMsg );
// sonador 10.2.1 팻 시스템 구현
void OnUnsummonPet ( struct TS_SC_UNSUMMON_PET* pMsg );
void OnAddPetInfo ( struct TS_SC_ADD_PET_INFO* pMsg );
void OnRemovePetInfo ( struct TS_SC_REMOVE_PET_INFO* pMsg );
void OnShowSetPetName ( struct TS_SC_SHOW_SET_PET_NAME* pMsg );
void OnSkillEvent ( struct TS_SC_SKILL* pMsg );
void OnSkillList ( struct TS_SC_SKILL_LIST* pMsg );
void onMsgDropInfo ( struct TS_SC_ITEM_DROP_INFO* pMsg );
void onWearInfo( struct TS_WEAR_INFO* pMsg );
void onMsgDrop ( struct TS_SC_DROP_RESULT* pMsg );
void onMsgSkillCardInfo( struct TS_SC_SKILLCARD_INFO* pMsg );
void onItemWearInfo ( struct TS_SC_ITEM_WEAR_INFO* pMsg );
void OnMsgInven( struct TS_SC_INVENTORY* pMsg );
void OnMsgTakeItemResult( struct TS_SC_TAKE_ITEM_RESULT* pMsg );
/// quest
void OnQuestList( struct TS_SC_QUEST_LIST* pMsg );
void OnQuestStatus( struct TS_SC_QUEST_STATUS* pMsg );
/// guild
void OnShowCreateGuild( struct TS_SC_SHOW_CREATE_GUILD* pMsg );
/// guild alliance
void OnShowCreateAlliance( struct TS_SC_SHOW_CREATE_ALLIANCE* pMsg );
// storage
void OnMsgOpenStorage ( struct TS_SC_OPEN_STORAGE* pMsg );
void OnMsgOpenSoulstoneCraft ( struct TS_SC_SHOW_SOULSTONE_CRAFT_WINDOW* pMsg );
void OnMsgOpenSoulstoneRepair( struct TS_SC_SHOW_SOULSTONE_REPAIR_WINDOW* pMsg );
/// chatting
void OnMsgChattingLocal( struct TS_SC_CHAT_LOCAL* pMsg );
void OnMsgChatting ( struct TS_SC_CHAT* pMsg );
// 2010.05.19 HIDE_EQUIP_INFO - prodongi
void OnMsgHideEquipInfo(struct TS_SC_HIDE_EQUIP_INFO* pMsg);
void onMarket ( struct TS_SC_MARKET* pMsg );
void onEraseItem ( struct TS_SC_ERASE_ITEM* pMsg ); // 아이템파괴.
void onDestroyItem ( struct TS_SC_DESTROY_ITEM* pMsg );
void onUpdateItemCount( struct TS_SC_UPDATE_ITEM_COUNT* pMsg );
void onMixResult ( struct TS_SC_MIX_RESULT* pMsg );
void onTrade ( struct TS_TRADE* pMsg );
void onBoothTradeInfo ( struct TS_SC_BOOTH_TRADE_INFO* pMsg );
void onMsgBoothClopsed( struct TS_SC_BOOTH_CLOSED* pMsg );
void onMsgWatchBooth ( struct TS_SC_WATCH_BOOTH* pMsg );
void onBoothName ( struct TS_SC_GET_BOOTHS_NAME* pMsg );
void onUseItemResult ( struct TS_SC_USE_ITEM_RESULT* pMsg );
void OnDead ( struct TS_MESSAGE* pMsg );
void OnState ( struct TS_SC_STATE* pMsg );
void OnProperty ( struct TS_SC_PROPERTY* pMsg );
void OnHPMP ( struct TS_SC_HPMP* pMsg );
void OnDialog ( struct TS_SC_DIALOG* pMsg );
void OnShowWindow ( struct TS_SC_SHOW_WINDOW* pMsg );
void OnGeneralMessageBox(struct TS_SC_GENERAL_MESSAGE_BOX* pMsg);
void OnChangeLocation ( struct TS_SC_CHANGE_LOCATION* pMsg );
/// 날씨 정보를 받는다
void OnWeatherInfo ( struct TS_SC_WEATHER_INFO* pMsg );
void OnGametime ( struct TS_SC_GAME_TIME* pMsg );
void OnEmotion ( struct TS_SC_EMOTION* pMsg );
void OnGetChaos ( struct TS_SC_GET_CHAOS* pMsg );
void OnEnergy ( struct TS_SC_ENERGY* pMsg );
void OnItemCoolTime ( struct TS_SC_ITEM_COOL_TIME* pMsg );
void OnStateResult ( struct TS_SC_STATE_RESULT* pMsg );
/// 채팅 관련 결과
void OnChatResult ( struct TS_SC_CHAT_RESULT* pMsg );
//1:1 대련
// 2009-01-30 : hunee
void OnMsgCompeteRequest ( struct TS_SC_COMPETE_REQUEST* pMsg);
void OnMsgCompeteAnswer ( struct TS_SC_COMPETE_ANSWER* pMsg);
void OnMsgCompeteCountdown ( struct TS_SC_COMPETE_COUNTDOWN* pMsg);
void OnMsgCompeteStart ( struct TS_SC_COMPETE_START* pMsg);
void OnMsgCompeteEnd ( struct TS_SC_COMPETE_END* pMsg);
void OnMsgRanking ( struct TS_SC_RANKING_TOP_RECORD* pMsg );
// 스킬레벨의변동이발생
void onAddedSkillList( struct TS_SC_ADDED_SKILL_LIST* pMsg );
/// cheat 관련
void OnWarp ( struct TS_SC_WARP* pMsg );
/// 뭔가 결과
void OnResult( struct TS_SC_RESULT* pMsg );
/// 상태 변경
void OnStatusChange( struct TS_SC_STATUS_CHANGE* pMsg );
//HP/MP/SP 설정
// void OnHP ( struct TS_SC_HP* pMsg );
// void OnMP ( struct TS_SC_MP* pMsg );
void OnRegenHPMP( struct TS_SC_REGEN_HPMP* pMsg );
void OnSP ( struct TS_SC_SP* pMsg );
void OnTarget( struct TS_SC_TARGET* pMsg );
// { [sonador][3.1.2] 경매장 구현
void OnMsgResultAuctionSearch ( struct TS_SC_AUCTION_SEARCH* pMsg ); ///< 경매장 검색에 대한 서버로 부터의 결과 메시지 처리
void OnMsgResultAuctionSellingList ( struct TS_SC_AUCTION_SELLING_LIST* pMsg ); ///< 등록 물품 목록 요청 결과 처리
void OnMsgResultAuctionBiddedList ( struct TS_SC_AUCTION_BIDDED_LIST* pMsg ); ///< 입찰 물품 목록 요청 결과 처리
void OnMsgResultAuctionItemKeepingList ( struct TS_SC_ITEM_KEEPING_LIST* pMsg ); ///< 보관함 물품 목록 요청 결과 처리
// }
// #2.1.2.11.1 {
void OnMsgHuntaHolicInstanceList( struct TS_SC_HUNTAHOLIC_INSTANCE_LIST* pMsg );
void OnMsgHuntaHolicInstanceInfo( struct TS_SC_HUNTAHOLIC_INSTANCE_INFO* pMsg );
void OnMsgHuntaHolicHuntingScore( struct TS_SC_HUNTAHOLIC_HUNTING_SCORE* pMsg );
void OnMsgHuntaHolicUpdateScroe ( struct TS_SC_HUNTAHOLIC_UPDATE_SCORE* pMsg );
void OnMsgHuntaHolicBeginHunting( struct TS_SC_HUNTAHOLIC_BEGIN_HUNTING* pMsg );
void OnMsgHuntaHolicMaxPointReached( struct TS_SC_HUNTAHOLIC_MAX_POINT_ACHIEVED* pMsg ); // sonador #2.1.2.11.5
// #2.1.2.11.1 }
//인스턴스게임
//sfreer 2009.11.04
void OnMsgHuntaHolicBeginCountDown( struct TS_SC_HUNTAHOLIC_BEGIN_COUNTDOWN* pMsg ); //
void OnMsgInstanceGameScoreRequest( struct TS_SC_INSTANCE_GAME_SCORE_REQUEST* pMsg ); //
void OnMsgXTrapCheck( struct TS_SC_XTRAP_CHECK* pMsg );
void OnMsgCreatureFarmInfo ( struct TS_SC_FARM_INFO* pMsg ); // servantes 2011.02.23
void OnMsgAssignResult ( struct TS_SC_RESULT_FOSTER* pMsg ); //servantes 2011.02.25
void OnMsgNurseResult ( struct TS_SC_RESULT_NURSE* pMsg ); //2011.03.04 - servantes
void OnMsgRegainResult ( struct TS_SC_RESULT_RETRIEVE* pMsg ); //2011.03.07 - servantes
/// 2011.05.12 - prodongi
void OnMsgSkillLevelList(struct TS_SC_SKILL_LEVEL_LIST* pMsg);
void OnMsgTitle_List ( struct TS_SC_TITLE_LIST* pMsg );
void OnMsgTitle_ConditonList( struct TS_SC_TITLE_CONDITION_LIST* pMsg );
void OnMsgTitle_RemainTime( struct TS_SC_REMAIN_TITLE_TIME* pMsg );
void OnMsgTitle_SetMain( struct TS_SC_SET_MAIN_TITLE* pMsg );
void OnMsgTitle_SetSub( struct TS_SC_SET_SUB_TITLE* pMsg );
void OnMsgTitle_Bookmark( struct TS_SC_BOOKMARK_TITLE* pMsg );
void OnMsgTitle_Achieve( struct TS_SC_ACHIEVE_TITLE* pMsg );
void OnMsgTitle_Open( struct TS_SC_OPEN_TITLE* pMsg );
void OnMsgTite_ChangeCondition( struct TS_SC_CHANGE_TITLE_CONDITION* pMsg );
void OnBattleArenaJoinQueue(struct TS_SC_BATTLE_ARENA_JOIN_QUEUE* msg);
void OnBattleArenaLeave(struct TS_SC_BATTLE_ARENA_LEAVE* msg);
void OnBattleArenaBattleInfo(struct TS_SC_BATTLE_ARENA_BATTLE_INFO* msg);
void OnBattleArenaExerciseReadyStatus(struct TS_SC_BATTLE_ARENA_EXERCISE_READY_STATUS* msg);
void OnBattleArenaBattleStatus(struct TS_SC_BATTLE_ARENA_BATTLE_STATUS* msg);
void OnBattleArenaBattleScore(struct TS_SC_BATTLE_ARENA_BATTLE_SCORE* msg);
void OnBattleArenaJoinBattle(struct TS_SC_BATTLE_ARENA_JOIN_BATTLE* msg);
void OnBattleArenaDisconnectBattle(struct TS_SC_BATTLE_ARENA_DISCONNECT_BATTLE* msg);
void OnBattleArenaReconnectBattle(struct TS_SC_BATTLE_ARENA_RECONNECT_BATTLE* msg);
void OnBattleArenaResult(struct TS_SC_BATTLE_ARENA_RESULT* msg);
void OnBattleArenaAbsenceCheck(struct TS_SC_BATTLE_ARENA_ABSENCE_CHECK* msg);
void OnBattleArenaPenaltyInfo(struct TS_SC_BATTLE_ARENA_PENALTY_INFO* msg);
void OnBattleArenaUpdateWaitUserCount(struct TS_SC_BATTLE_ARENA_UPDATE_WAIT_USER_COUNT* msg);
void OnDecomposeResult( struct TS_SC_DECOMPOSE_RESULT* pMsg );
void OnChangeSkinColor( struct TS_SC_SKIN_INFO* pMsg );
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Upload Server
void OnUploadServerLogin( struct TS_UC_LOGIN_RESULT * );
void OnUploadServerGuildIconUpload( struct TS_UC_UPLOAD * );
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void OnPartyMatchList ( struct TS_SC_PARTYMATCH_LIST * );
void OnPartyMatchMember( struct TS_SC_PARTYMATCH_MEMBER * );
std::vector<struct SGameMessage*> m_vDelList; ///< Game Msg 지울 것;
std::queue<struct SGameMessage*> m_ReQueueGame; // Generated Game Message
std::queue<struct SGameMessage*> m_QueueGame; // Generated Game Message
std::queue<struct TS_MESSAGE*> m_QueueNet; ///< Net Msg;
std::vector<struct SGameMessage*> m_vSafeKeepingList; ///< Game Msg 보관;
DWORD m_dwTime; ///< 현재 Process Time
//Mouse
BOOL m_bLPress;
BOOL m_bRPress;
POINT m_ptOldPoint;
std::map<std::string, int> MAP_PROPERTY; //
//World Msg
//BOOL m_bActiveRecycle; // 필요하지 않아 보여서 삭제 2009.3.25 by 정동섭
class SGameManager* m_pGameManager;
DWORD m_dwAttackTime;
AR_HANDLE m_hLocal;
KHash< std::string, hashPr_mod_int > m_hNetStr;
};