#pragma once /// @brief 게임에서 사용하는 컨텐츠 내용들 // #include "ItemBase.h" #include "CreatureBase.h" #include #include #include #include "Enc.h" class SAvatarProperty { public: SAvatarProperty( ENC_INT nContentID ); ~SAvatarProperty(); void ProcMsgAtStatic( struct SGameMessage * pMsg ); use_property_union( SAvatarProperty ) { def_property_df( Name, const char*, m_strName.c_str(), SetName ); def_property_dd( Race, int, m_nRace, m_nRace ); def_property_dd( Sex, int, m_nSex, m_nSex ); def_property( ContentID, ENC_INT, m_nContentID.get, _ ); def_property_df( HP, int, m_nHP, SetHP ); def_property_df( MP, int, m_nMP, SetMP ); def_property_df( MaxHP, int, m_nMaxHP, SetMaxHP ); def_property_df( MaxMP, int, m_nMaxMP, SetMaxMP ); def_property_dd( JobID, int, m_nJob, m_nJob ); def_property_df( Level, int, m_nLevel, _ ); def_property_df( JobLevel, int, m_nJobLevel, _ ); def_property_dd( FaceID, int, m_faceId, m_faceId ); def_property_dd( HairID, int, m_hairId, m_hairId ); def_property( PercentEXP, int, GetPercentEXP, _ ); def_property_dd( EXP, __int64, m_nEXP, _ ); def_property_dd( JP, __int64, m_nJP, _ ); /// 2011.04.29 int->__int64 - prodongi def_property_df( Status, unsigned, m_status, SetStatus ); ///< 상태:앉기,서기,테이밍 def_property_dd( ObjType, unsigned char, m_ObjType, m_ObjType ); def_property( AttackRange, AR_UNIT, GetAttackRange, _ ); ///< 게임상 미터 단위 def_property( DBAttackRange, float, GetDBAttackRange, _ ); ////////////////////////////////////////////////////////////////////////// //AvatarEx 내부 사용 용 def_property_dd( InnRace, int, m_nInnRace, m_nInnRace ); def_property_dd( InnSex, int, m_nInnSex, m_nInnSex ); def_property_dd( InnFaceID, int, m_InnfaceId, m_InnfaceId ); def_property_dd( InnHairID, int, m_InnhairId, m_InnhairId ); def_property( InnContentID, ENC_INT, m_nInnContentID.get, _ ); def_property_dd( InnObjType, unsigned char, m_InnObjType, m_InnObjType ); ////////////////////////////////////////////////////////////////////////// }; int SetLevel( int nLevel ); int SetJobLevel( int nJobLevel ); void SetJobID(int id); /// 2011.07.11 - prodongi bool IsLive(); void AddExp( __int64 nExp ); void AddJP( __int64 nJp ); void SetInnContentID( ENC_INT nContentID ); protected: void SetName( const char* pCreatureName ); void SetHP( int nHP ); void SetMaxHP( int nMaxHP ); void SetMP( int nMP ); void SetMaxMP( int nMaxMP ); int GetPercentEXP(); void SetStatus( unsigned status ); void SetInnInfo( struct SGameMessage* pMsg ); AR_UNIT GetAttackRange(); float GetDBAttackRange(); std::string m_strName; c_hidint< int, 32 > m_nCreatureIndex; c_hidint< unsigned char, 780 > m_ObjType; ////////////////////////////////////////////////////////////////////////// //Content Data c_hidint< int, 7870 > m_nRace; ///< 종족 c_hidint< int, 12 > m_nSex; ///< 성별 c_hidint< int, 22739 > m_nGold; ///< GOLD c_hidint< int, 1828 > m_nHP; ///< HP~ c_hidint< int, 6958 > m_nMP; ///< MP~ c_hidint< int, 18 > m_nMaxHP; ///< HP MAX c_hidint< int, 28 > m_nMaxMP; ///< MP MAX c_hidint< int, 162 > m_nJobPoint; ///< JOB POINT c_hidint< int, 31 > m_nJobLevel; ///< JOB LEVEL c_hidint< int, 8976 > m_nJob; ///< JOB c_hidint< int, 213 > m_nLevel; ///< LEVEL c_hidint< __int64, 21 > m_nEXP; ///< EXP c_hidint< __int64, 7 > m_n64_PreviosExp; c_hidint< __int64, 67 > m_n64_MaxExp; c_hidint< int, 97 > m_nCurExp; c_hidint< __int64, 33 > m_nJP; ///< JP /// 2011.04.29 int -> __int64 - prodongi c_hidint< int, 1678 > m_nOldExp; c_hidint< int, 122121 > m_nOldJP; CreatureStat m_stat; ///< 스탯 CreatureAttribute m_attribute; ///< 속성 c_hidint< int, 876 > m_nCharisma; ///< 매력 c_hidint< int, 457 > m_nMoral; ///< 도덕 ////////////////////////////////////////////////////////////////////////// unsigned m_status; ///< 상태:앉기,서기, PKMODE ItemBase::ItemCode m_faceId; int m_faceTextureId; ItemBase::ItemCode m_hairId; bool m_is_first_enter; bool m_bLocal; struct ENC_INT_id_less { bool operator () ( const ENC_INT& a, const ENC_INT& b ) { return *( __int64 * )( &a ) < *( __int64 * )( &b ); } }; template< int N > struct NOISY_ENC_INT { void init( const ENC_INT& noise ) { for ( int i = 0; i < N; i++ ) val[i].set_new_value( noise ); std::sort( val, val + N, ENC_INT_id_less() ); } const ENC_INT& get() const { return val[ (uintptr_t(this)/4) % N ]; } void set( const ENC_INT& v ) { // "val[ (uintptr_t(this)/4) % N ] = v;" 를 트레이스하기 어렵게 쓴 것임 // 한번 더 인코딩. ENC_INT kv; kv.set_new_value( v ); if ( *( __int64 * ) ( &val[(uintptr_t(this)/4) % N] ) < *( __int64 * ) ( &kv ) ) { val[ 0 ] = kv; std::sort( val, val + (uintptr_t(this)/4) % N + 1, ENC_INT_id_less() ); } else { val[ N-1 ] = kv; std::sort( val + (uintptr_t(this)/4) % N, val + N, ENC_INT_id_less() ); } } ENC_INT val[ N ]; }; NOISY_ENC_INT< 16 > m_nContentID; ///< Mob ID, NPC ID 등등 ////////////////////////////////////////////////////////////////////////// //AvatarEx 내부 사용 용 c_hidint< unsigned char, 454 > m_InnObjType; c_hidint< int, 43612 > m_nInnRace; c_hidint< int, 776 > m_nInnSex; ItemBase::ItemCode m_InnfaceId; int m_InFaceTexureId; ItemBase::ItemCode m_InnhairId; NOISY_ENC_INT< 16 > m_nInnContentID; ////////////////////////////////////////////////////////////////////////// };