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

412 lines
14 KiB
C++

#pragma once
#include <Windows.h>
//#include <vector>
#include <mmo/ArType.h>
#include "CreatureBase.h"
#include "GameType.h"
#include "SGameUIMgr.h"
enum OUTPUT_TIMING
{
S_CAST_ATTACK = 1,
S_CAST_COMBAT = 2,
S_CAST_MAGIC = 3,
S_CAST_ATTACK_COMBAT = 4,
S_CAST_ATTACK_COMBAT_MAGIC = 5,
S_HIT_ATTACK = 21,
S_HIT_COMBAT = 22,
S_HIT_MAGIC = 23,
S_HIT_ATTACK_COMBAT = 24,
S_HIT_ATTACK_COMBAT_MAGIC = 25,
T_HIT_ATTACK = 41,
T_HIT_COMBAT = 42,
T_HIT_MAGIC = 43,
T_HIT_ATTACK_COMBAT = 44,
T_HIT_ATTACK_COMBAT_MAGIC = 45,
};
/** 플레이어 정보
플레이어 타겟
플레이어 거래 상태등 관리
플레이어 지속효과/타겟 지속효과 */
class SStateSlot
{
public:
SStateSlot();
~SStateSlot();
public:
virtual void Process( DWORD dwTime );
void SetTargetHandle( AR_HANDLE handle ) { m_hTarget = handle; };
void SetStateHandle( AR_HANDLE handle ) { state_handle = handle; };
void SetStateCode( int nStateCode ) { state_code = nStateCode; };
void SetStateLevel( int nLevel ) { state_level = nLevel; };
void SetStateValue( int nValue ) { state_value = nValue; }
void SetEndTime( AR_TIME ar_end_time ) { end_time = ar_end_time; };
void SetStateTime( DWORD start_time, DWORD end_time );
void SetStateHarmful( bool Harmful ) { m_bHarmful = Harmful; };
void ForceStop() { m_bStateStop = true; }
const AR_HANDLE GetStateHandle() const { return state_handle; };
const int GetStateCode() const { return state_code; };
const int GetStateLevel() const { return state_level; };
const int GetStateValue() const { return state_value; }
const AR_TIME GetEndTime() const { return end_time; };
//const AR_TIME GetStartTime() const { return start_time; };
const DWORD GetBeginTime() const { return m_dwBeginTime; };
const DWORD GetRemainTime() const
{
return (m_dwRemainTime == static_cast< DWORD >( -1 )) ? 0 : m_dwRemainTime;
}
const DWORD GetMaxTime() const { return m_dwMaxMilliTime; };
const bool IsHarmful() const { return m_bHarmful; };
const bool IsTargetState( AR_HANDLE hTarget ) const { return (hTarget && hTarget == m_hTarget); };
const AR_HANDLE GetTargetHandle() const { return m_hTarget; };
void CheckTime();
const bool IsStop() const { return m_bStateStop; };
void SetToggleType( bool bToggle ) { m_bIsToggleSkill = bToggle; }
bool IsToggleSkill() const { return m_bIsToggleSkill; } /// 2011.01.18 const 추가- prodongi
DWORD ConvertTimeToMilli( AR_TIME at_time );
bool IsValidProcTime() { return m_bIsValidProcTime; };
protected:
AR_HANDLE m_hTarget;
int state_handle; ///< 상태이상 핸들
int state_code; ///< 상태이상 종류
int state_level; ///< 상태이상의 레벨 (0이면 풀리는 메세지임)
int state_value;
AR_TIME end_time; ///< 끝나는 시간 (0이면 영원히)
DWORD m_dwBeginTime;
DWORD m_dwRemainTime;
DWORD m_dwMaxMilliTime;
DWORD m_dwTime;
bool m_bStateStop;
bool m_bIsToggleSkill;
bool m_bHarmful;
bool m_bIsValidProcTime;
};
class SPlayerInfo
{
public:
enum JOB_INDEX
{
JOB_INDEX_MAX = 3,
};
SPlayerInfo();
virtual ~SPlayerInfo();
public:
void SetLevel( int nLevel );
void SetExp( __int64 nExp );
void SetHP( int nHP ) { m_nHP = nHP; };
void SetMP( int nMP ) { m_nMP = nMP; };
void SetMaxHP( int nMaxHP ) { m_nMaxHP = nMaxHP; };
void SetMaxMP( int nMaxMP ) { m_nMaxMP = nMaxMP; };
void SetJLv( int nJLv ) { m_nJLv = nJLv; };
void SetJP( __int64 nJP ) { m_nJp = nJP; }; /// 2011.04.29 int->__int64 - prodongi
void SetJobID( int nJobID ) { m_nJobID = nJobID; SetJobName(); };
void SetOldJobID( int nJobID, int nIndex ) { m_nOldJobID[nIndex] = nJobID; };
void SetOldJobLv( int nJobLv, int nIndex ) { m_nOldJobLv[nIndex] = nJobLv; };
void SetTP(int tp) { m_tp = tp; }; /// 2011.03.28 - prodongi
void SetAP(int ap) { m_ap = ap; } /// 2012.06.08 - prodongi
void SetAlias(char const* alias) { m_alias = alias; }
void SetName( const char* szName ) { m_strName = szName; };
void SetJobName();
void RefreshExpInfo();
void SetWeight( int nWeight ) { m_Attribute.nMaxWeight = nWeight; };
void SetStrength( int nStrength ) { m_Stat.strength = nStrength; };
void SetAgility( int nAgility ) { m_Stat.agility = nAgility; };
void SetDex( int nDex ) { m_Stat.dexterity = nDex; };
void SetIntelligence( int nIntelligence ) { m_Stat.intelligence = nIntelligence; };
void SetLuck( int nLuck ) { m_Stat.luck = nLuck; };
void SetVital( int nVital ) { m_Stat.vital = nVital; };
void SetMental( int nMental ) { m_Stat.mentality = nMental; };
void SetSpeed( int nSpeed ) { m_Attribute.nMoveSpeed = nSpeed; };
virtual void SetGold( money_t nGold ) { m_nGold = nGold; }
void SetInvenWeight( float fWeight ) { m_fInvenWeigth = fWeight; };
void SetPermission ( int nValue ) { m_nPermission = nValue; }
void SetPk_count ( int nValue ) { m_nPk_count = nValue; }
void SetDk_count ( int nValue ) { m_nDk_count = nValue; }
void SetRace ( int nValue ) { m_nRace = nValue; }
void SetCharisma ( int nValue ) { m_nCharisma = nValue; }
// bintitle. 2011.11.07. int => __int64.
void SetMoral ( __int64 nValue ) { m_nMoral = nValue; }
void SetLogin_time ( int nValue ) { m_nLogin_time = nValue; }
void SetSex ( int nValue ) { m_nSex = nValue; }
void SetX ( int nValue ) { m_nX = nValue; }
void SetY ( int nValue ) { m_nY = nValue; }
void SetStorage_gold( int nValue ) { m_nStorage_gold= nValue; }
void SetStamina ( int nValue ) { m_nStamina = nValue; }
void SetChaos ( int nValue ) { m_nChaos = nValue; }
void SetMax_chaos ( int nValue ) { m_nMax_chaos = nValue; }
void SetMax_stamina ( int nValue ) { m_nMax_stamina = nValue; }
void SetChannel ( int nValue ) { m_nChannel = nValue; }
void SetStaminaRegen( int nRegen ) { m_nStaminaRegen = nRegen; }
void SetContinuousPlayTime( AR_TIME nValue ) { m_arContinuous_play_time = nValue; }
void SetPennaltyPlayTime( AR_TIME nValue ) { m_arPennalty_play_time = nValue; }
void SetMaxContinuousPlayTime( AR_TIME nValue ) { m_arMaxContinuous_play_time = nValue; }
void SetEtherealStoneDurability( int nValue ) { m_nEtherealStoneDurability = nValue; } // 에테리얼스톤.
void SetHuntaHolicPoint( int nValue ) { m_nHuntaHolicPoint = nValue; } // 헌터홀릭포인트.
int GetPermission () { return m_nPermission ; }
int GetPk_count () { return m_nPk_count ; }
int GetDk_count () { return m_nDk_count ; }
int GetRace () { return m_nRace ; }
int GetCharisma () { return m_nCharisma ; }
// bintitle. 2011.11.07. int => __int64.
__int64 GetMoral() { return m_nMoral; }
int GetLogin_time () { return m_nLogin_time ; }
int GetSex () { return m_nSex ; }
int GetX () { return m_nX ; }
int GetY () { return m_nY ; }
int GetStorage_gold() { return m_nStorage_gold; }
int GetStamina () { return m_nStamina ; }
int GetChaos () { return m_nChaos ; }
int GetMax_chaos () { return m_nMax_chaos ; }
int GetMax_stamina () { return m_nMax_stamina ; }
int GetChannel () { return m_nChannel ; }
int GetStaminaRegen() { return m_nStaminaRegen; }
int GetEtherealStoneDurability() { return m_nEtherealStoneDurability; } // 에테리얼스톤
int GetHuntaHolicPoint() { return m_nHuntaHolicPoint; } // 헌터홀릭포인트.
AR_TIME GetContinuousPlayTime() { return m_arContinuous_play_time; }
AR_TIME GetPennaltyPlayTime() { return m_arPennalty_play_time; }
AR_TIME GetMaxContinuousPlayTime() { return m_arMaxContinuous_play_time; }
const int GetWeight() { return m_Attribute.nMaxWeight; };
const int GetLevel() const { return m_nLevel; };
const __int64 GetExp() const { return m_nExp; };
const int GetHP() const { return m_nHP; };
const int GetMP() const { return m_nMP; };
const int GetMaxHP() const { return m_nMaxHP; };
const int GetMaxMP() const { return m_nMaxMP; };
const int GetJLv() const { return m_nJLv; };
const __int64 GetJP() const { return m_nJp; }; /// 2011.04.29 int->__int64 - prodongi
const int GetJobID() const { return m_nJobID; };
int GetTP() const { return m_tp; } /// 2011.03.28 - prodongi
int GetAP() const { return m_ap; }; /// 2012.06.08 - prodongi
char const* GetAlias() const { return m_alias.c_str(); }
bool IsAlias() const { return !m_alias.empty(); }
bool IsFirstTpSet() const { return m_isFirstTpSet; }
void setFalseFirstTpSet() { m_isFirstTpSet = false; }
const int GetOldJobID( int nIndex ) const
{
if( JOB_INDEX_MAX <= nIndex || nIndex < 0 )
return -1;
return m_nOldJobID[nIndex];
};
const int GetOldJobLv( int nIndex ) const
{
if( JOB_INDEX_MAX <= nIndex || nIndex < 0 )
return -1;
return m_nOldJobLv[nIndex];
};
const char* GetName() const { return m_strName.c_str(); };
const char* GetJobName() const { return m_strJobName.c_str(); };
const __int64 GetMaxExp() const { return m_n64_MaxExp; };
const __int64 GetPreviosExp() const { return m_n64_PreviosExp; };
const __int64 GetCurExp() const { return m_nCurExp; };
const money_t GetGold() const { return m_nGold; };
const float GetInvenWeigth() const { return m_fInvenWeigth; };
void SetStat( const CreatureStat& stat, const CreatureAttribute& attribute );
void SetStatByItem( const CreatureStat& stat, const CreatureAttribute& attribute );
const CreatureStat& GetStat() const { return m_Stat; };
const CreatureAttribute& GetAttribute() const { return m_Attribute; };
const CreatureAttribute& GetItemAttribute() const { return m_AttributeByItem; }
//캐릭 상태
void SetStatus( unsigned status ) { m_nStatus = status; }
unsigned GetStatus() { return m_nStatus; }
/// 처음 셋팅이냐
bool IsFirstImmoralSetting() { return m_bIsFirstImmoralSett; }
/// 처음 셋팅했다
void SetFirstImmoralSetting() { m_bIsFirstImmoralSett = false; }
virtual void Clear();
protected:
unsigned m_nStatus;
int m_nLevel;
__int64 m_nExp;
int m_nHP;
int m_nMP;
int m_nMaxHP;
int m_nMaxMP;
int m_nJLv;
__int64 m_nJp; /// 2011.04.29 int->__int64 - prodongi
int m_nJobID;
int m_nOldJobID[JOB_INDEX_MAX];
int m_nOldJobLv[JOB_INDEX_MAX];
money_t m_nGold;
float m_fInvenWeigth;
int m_nPermission ;
int m_nPk_count ;
int m_nDk_count ;
int m_nRace ;
int m_nCharisma ;
// bintitle. 2011.11.07. int => __int64.
__int64 m_nMoral ;
int m_nLogin_time ;
int m_nSex ;
int m_nX ;
int m_nY ;
int m_nSpeed ;
int m_nStorage_gold;
int m_nStamina ;
int m_nChaos ;
int m_nMax_chaos ;
int m_nMax_stamina ;
int m_nChannel ;
int m_nStaminaRegen;
int m_nEtherealStoneDurability; // 에테리얼스톤. bintitle. 2010.08.25.
int m_nHuntaHolicPoint; // 헌터홀릭포인트. bintitle. 2010.09.03.
int m_tp; /// 2011.03.28 특성 포인트 - prodongi
int m_ap; /// 2012.06.08 아레나 포인트 - prodongi
std::string m_alias; /// 2012.07.20 아레나 별칭 - prodongi
bool m_isFirstTpSet;
AR_TIME m_arContinuous_play_time;
AR_TIME m_arPennalty_play_time;
AR_TIME m_arMaxContinuous_play_time;
bool m_bIsFirstImmoralSett;
std::string m_strName;
std::string m_strJobName;
CreatureStat m_Stat;
CreatureAttribute m_Attribute;
CreatureStat m_StatByItem;
CreatureAttribute m_AttributeByItem;
// 레벨에 따른 previos/max 가 적용된 exp
__int64 m_n64_PreviosExp; ///< 전레벨 경험치
__int64 m_n64_MaxExp; ///< 현재 레벨 최대 경험치
__int64 m_nCurExp; ///< 현재 경험치
};
class SPlayerInfoMgr : public SPlayerInfo, public SGameUIMgr
{
public:
SPlayerInfoMgr();
virtual ~SPlayerInfoMgr();
public:
virtual void Process( DWORD dwTime );
enum
{
STATE_NONE = -1,
STATE_TRADE = 0,
STATE_STORAGE,
STATE_STALL,
};
void ChangeState( int nState );
const int GetState() const { return m_nPlayerState; };
// 타겟 처리
void SetPlayerHandle( AR_HANDLE hPlayer ) { m_hPlayer = hPlayer; };
void SetTarget( AR_HANDLE hTarget, const char* szName, unsigned char objtype )
{
m_hTarget = hTarget;
m_strTargetName = szName;
m_GameObjType = objtype;
};
void SetTradeTarget( AR_HANDLE hTarget, const char* szName );
virtual void SetGold( money_t nGold );
const AR_HANDLE GetPlayerHandle() const { return m_hPlayer; };
const AR_HANDLE GetTarget() const { return m_hTarget; };
const AR_HANDLE GetTradeTarget() const { return m_hTradeTarget; };
const char* GetTargetName() const { return m_strTargetName.c_str(); };
const char* GetTradeTargetName() const { return m_strTradeTargetName.c_str(); };
unsigned char GetGameObjType() const { return m_GameObjType; }
// 캐릭 정보
SPlayerInfo& GetPlayerInfo() { return *this; };
int GetCurrentLocation();
// 조건 체크
const bool IsLocalPlayer( AR_HANDLE hTarget ) const { return (hTarget && hTarget == m_hPlayer); };
const bool IsTargetPlayer( AR_HANDLE hTarget ) const { return (hTarget && hTarget == m_hTarget); };
const bool IsTradeTargetPlayer( AR_HANDLE hTarget ) const { return (hTarget && hTarget == m_hTradeTarget); };
/// 스탯
void SetPlayerStat( const CreatureStat& stat, const CreatureAttribute& attribute, int nType );
bool IsSCastAttack( int nAttackType );
bool IsSHitAttack( int nAttackType );
bool IsTHitAttack( int nAttackType );
bool IsSCastCombat( int nCombatType, int nFxType );
bool IsSHitCombat( int nCombatType, int nFxType );
bool IsTHitCombat( int nCombatType, int nFxType );
bool IsSCastMagic( int nMagicType, int nFxType );
bool IsSHitMagic( int nMagicType, int nFxType );
bool IsTHitMagic( int nMagicType, int nFxType );
void ResetInfo();
void Clear();
private:
void checkValidArenaJoinSituationAtTrade(); /// 2012.05.21 거래를 시작 할 때 호출이 되며, 아레나 대기중 상황 체크 - prodongi
protected:
int m_nPlayerState;
AR_HANDLE m_hPlayer;
AR_HANDLE m_hTarget;
AR_HANDLE m_hTradeTarget;
std::string m_strTargetName;
std::string m_strTradeTargetName;
DWORD m_dwTime;
unsigned char m_GameObjType;
};