Files
Leviathan/Client/Game/game/GameSystem/SSummonSlotMgr.h
T
2026-06-01 12:46:52 +02:00

277 lines
10 KiB
C++

#pragma once
#include <windows.h>
#include <mmo/ArType.h>
//#include <vector>
#include "CreatureBase.h"
#include "SGameUIMgr.h"
//////////////////////////////////////////////////////////////////////////
/**소환수 슬롯
크리처 정보 */
class SCreatureInfo
{
public:
SCreatureInfo();
~SCreatureInfo() {}
void SetCreatureInfo( struct SMSG_ADD_SUMMON_INFO* pAddSummonInfoMsg );
void SetUpdateInfo( struct SMSG_SUMMON_EVOLUTION* pMsg );
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 SetLevel( int nLevel );
void SetExp( __int64 nExp );
void SetJP( __int64 nJP ) { m_nJp = nJP; }; /// 2011.04.29 int->__int64 - prodongi
void SetSP( int nSP ) { m_nSp = nSP; };
void SetName( const char* szName ) { m_strName = szName; };
void RefreshExpInfo();
const AR_HANDLE GetCardHandle() const { return m_card_handle; }
const int GetID() const { return m_nCreatureID; };
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 GetLevel() const { return m_nLevel; };
const __int64 GetExp() const{ return m_nExp; };
const __int64 GetJP() const { return m_nJp; }; /// 2011.04.29 int->__int64 - prodongi
const int GetSP() const { return m_nSp; };
const char* GetName() const { return m_strName.c_str(); };
const __int64 GetCurExp() const { return m_nCurExp; };
const __int64 GetMaxExp() const { return m_n64_MaxExp; };
const int GetOverBreed() const;
void SetEvolutionLevel( const int* pEvolLevel );
const int GetEvolLevel( int nEvol ) const
{
if( nEvol < MAX_CREATURE_EVOLUTION )
return m_nCreatureLevel[nEvol];
assert( false && "SCreatureInfo::GetEvolLevel 문제있다!!!" );
return -1;
}
enum { MAX_CREATURE_EVOLUTION = 3, };
private:
int m_nLevel;
__int64 m_nExp;
int m_nHP;
int m_nMP;
int m_nMaxHP;
int m_nMaxMP;
__int64 m_nJp; /// 2011.04.29 int->__int64 - prodongi
int m_nSp;
std::string m_strName;
int m_nCreatureID;
AR_HANDLE m_card_handle;
// 레벨에 따른 previos/max 가 적용된 exp
__int64 m_n64_PreviosExp; ///< 전 레벨 경험치
__int64 m_n64_MaxExp; ///< 현재 레벨 최대 경험치
__int64 m_nCurExp; ///< 현재 경험치
int m_nCreatureLevel[MAX_CREATURE_EVOLUTION];
};
/// 크리처 스탯
class SCreatureStat
{
public:
SCreatureStat() {};
~SCreatureStat() {};
void SetCreatureStat( const CreatureStat& stat, const CreatureAttribute& attribute );
void SetCreatureStatByItem( const CreatureStat& stat, const CreatureAttribute& attribute );
const CreatureStat& GetStat() const { return m_Stat; };
const CreatureAttribute& GetAttribute() const { return m_Attribute; };
private:
CreatureStat m_Stat;
CreatureAttribute m_Attribute;
int m_nHPRegenPer;
int m_nHPRegen;
int m_nMPRegenPer;
int m_nMPRegen;
};
class SCreatureSlot
{
public:
SCreatureSlot();
~SCreatureSlot();
void SetCreature( struct SMSG_ADD_SUMMON_INFO* pMsg ); //
/// 소환중, 소환중 아님
void SetSlotState();
AR_HANDLE GetCardHandle();
AR_HANDLE GetCreatureHandle();
const int GetCreatureCode() const; // 2011.03.02 servantes
const BOOL IsUseSlot() const; // 2011.03.02 servantes
// 인터페이스에서 사용
void SetCreatureItem( AR_HANDLE hItem, int nPos );
const int GetCreatureItemCount() const;
const AR_HANDLE GetCreatureItem( int nIndex ) const;
int getMaxMP() const; /// 2011.05.27 - prodongi
int getMP() const; /// 2011.05.27 - prodongi
enum
{
TYPE_SELF = 0,
TYPE_ITEM,
};
void SetCreatureInfo( struct SMSG_ADD_SUMMON_INFO* pAddSummonInfoMsg );
void SetUpdateInfo( struct SMSG_SUMMON_EVOLUTION* pMsg );
void SetCreatureStat( const CreatureStat& stat, const CreatureAttribute& attribute, int nType );
const SCreatureStat* GetCreatureStat( int nType ) const;
const SCreatureInfo* GetCreatureInfo() const;
void SetCreatureHP( int nHP ) { m_CreatureInfo.SetHP(nHP); };
void SetCreatureMP( int nMP ) { m_CreatureInfo.SetMP(nMP); };
void SetCreatureMaxHP( int nMaxHP ) { m_CreatureInfo.SetMaxHP(nMaxHP); };
void SetCreatureMaxMP( int nMaxMP ) { m_CreatureInfo.SetMaxMP(nMaxMP); };
void SetCreatureLevel( int nLevel ) { m_CreatureInfo.SetLevel(nLevel); };
void SetCreatureExp( __int64 nExp ) { m_CreatureInfo.SetExp(nExp); };
void SetCreatureJP( __int64 nJP ) { m_CreatureInfo.SetJP(nJP); }; /// 2011.04.29 int->__int64 - prodongi
void SetCreatureSP( int nSP ) { m_CreatureInfo.SetSP(nSP); };
void SetCreatureName( const char* szName ) { m_CreatureInfo.SetName(szName); };
void SetEvolutionLevel( const int* pEvolLevel ) { m_CreatureInfo.SetEvolutionLevel( pEvolLevel ); };
protected:
void Init();
SMSG_ADD_SUMMON_INFO* m_pSummonInfo;
BOOL m_bIsExist; ///< 크리쳐가 들어 있나?
/// 크리처가 장착하고 있는 아이템
enum
{
MAX_SUMMON_SLOT = 2,
MAX_CREATURE_SLOT = 15, //AziaMafia PEts 12 // MAX_CREATURE_SLOT = 6
};
AR_HANDLE m_hItem[MAX_CREATURE_SLOT];
SCreatureInfo m_CreatureInfo;
SCreatureStat m_CreatureStat;
SCreatureStat m_CreatureStatByItem;
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// m_hSelCreatureCard
// m_hSelSummonCreature
//////////////////////////////////////////////////////////////////////////
/// 소환수 슬롯 관리
class SCreatureSlotMgr : public SGameUIMgr
{
public:
SCreatureSlotMgr();
~SCreatureSlotMgr();
/// 크리처 리스트에서 선택된 크리처
void SetSelectCreatureCard( AR_HANDLE hCard );
const AR_HANDLE GetSelectedCreatureCard() const { return m_hSelCreatureCard; };
const AR_HANDLE GetSelectedCreature() const { return m_hSelCreature; };
/// 소환중인 크리처 중에서 활성화된 크리처
void SetSelectSummonCreature( AR_HANDLE handle );
const AR_HANDLE GetSelectSummonCreature() const { return m_hSelSummonCreature; };
void SetActiveCreatureQuickSlot( AR_HANDLE hCreature ) { m_hActiveCreatureQuickSlot = hCreature; };
const AR_HANDLE GetActiveCreatureQuickSlot() const { return m_hActiveCreatureQuickSlot; };
void SetEquipCreature( struct SMSG_EQUIP_SUMMON * pMsg );
/// 소환수 추가
void AddCreature ( struct SMSG_ADD_SUMMON_INFO* pMsg );
/// 소환수 삭제
void DelCreature ( AR_HANDLE card_handle );
/// 인터페이스에서 사용
enum
{
MAX_SUMMON_SLOT = 2,
MAX_CREATURE_SLOT = 15, //AziaMafia PEts 12
};
const bool IsExistCreatureCard( AR_HANDLE hCard ) const;
const bool IsEquipedCreature( AR_HANDLE hCreature ) const;
bool isInCreatureCard(unsigned int index) const; /// 2011.06.07 m_hCreatureCard슬롯에 크리처가 있는지 없는지
// 2010.07.07 스킬 초기화 할 경우에 TM_EQUIP_SUMMON가 먼저 날라와 m_hCreatureCard이 0으로 세팅이 되버려서 체크가 안되는 경우가 있다
// 이런 경우에 쓰임- prodongi
const bool IsEquipedCreatureCheckZeroCount( AR_HANDLE hCreature ) const;
const bool IsExistCreature( AR_HANDLE hCreature ) const;
const bool IsExistSummonedCreature( AR_HANDLE hCreature ) const;
const bool IsExistSummonedCreatureByCard( AR_HANDLE hCreatureCard ) const; // 2011.05.23 - servantes
const int GetSummonedCreatureCnt() const;
const std::vector<SCreatureSlot*> & GetCreatureList() const { return m_vecCreatureList; };
const SCreatureSlot* GetCreatureSlot( AR_HANDLE hCreature ) const;
const AR_HANDLE GetEquipedCreatureCard( int nIndex ) const;
const AR_HANDLE GetEquipedCreature( int nIndex ) const;
const AR_HANDLE GetEquipedCreature( AR_HANDLE hCard ) const;
const AR_HANDLE GetEquipedCreatureCard( AR_HANDLE hCreature ) const;
const int GetEquipedCardIndex( AR_HANDLE hCard ) const;
const int GetEquipedCardIndexByCreature( AR_HANDLE hCreature ) const;
const int GetEquipedCreatureCount() const;
const SCreatureStat* GetCreatureStat( AR_HANDLE hCreature, int nType ) const;
const SCreatureInfo* GetCreatureInfo( AR_HANDLE hCreature ) const;
const SCreatureInfo* GetCreatureInfoByCardHandle( AR_HANDLE hCardHandle );
const AR_HANDLE GetCreatureHandleByCardHandle( AR_HANDLE hCardHandle ) const;
const int GetSummonedCreatureCount() const;
const AR_HANDLE GetSummonedCreature( int nIndex ) const { return m_hSummonedCreature[nIndex]; };
void SetCreatureInfo( struct SMSG_ADD_SUMMON_INFO* pAddSummonInfoMsg );
void SetUpdateInfo( struct SMSG_SUMMON_EVOLUTION* pMsg );
void SetCreatureStat( AR_HANDLE hCreature, const CreatureStat& stat, const CreatureAttribute& attribute, int nType );
void SetCreatureHP( AR_HANDLE hCreature, int nHP );
void SetCreatureMP( AR_HANDLE hCreature, int nMP );
void SetCreatureMaxHP( AR_HANDLE hCreature, int nMaxHP );
void SetCreatureMaxMP( AR_HANDLE hCreature, int nMaxMP );
void SetCreatureLevel( AR_HANDLE hCreature, int nLevel );
void SetCreatureEvolutionLevel( AR_HANDLE hCardHandle, const int* pEvolLevel );
void SetCreatureExp( AR_HANDLE hCreature, __int64 nExp );
void SetCreatureJP( AR_HANDLE hCreature, __int64 nJP ); /// 2011.04.29 int->__int64 - prodongi
void SetCreatureSP( AR_HANDLE hCreature, int nSP );
void SetCreatureName( AR_HANDLE hCreature, const char* szName );
// 소환한 크리처
void AddSummonCreature( AR_HANDLE hCreature );
void DelSummonCreature( AR_HANDLE hCreature );
// 크리처 아이템
void SetCreatureItem( AR_HANDLE hCreature, AR_HANDLE hItem, int nPos );
const AR_HANDLE GetCreatureItem( AR_HANDLE hCreature, int nIndex ) const;
const int GetCreatureItemCount( AR_HANDLE hCreature ) const;
void Clear();
void ResetInfo();
protected:
AR_HANDLE m_hSelCreatureCard; ///< 현재 선택된 크리처 카드 핸들
AR_HANDLE m_hSelCreature;
AR_HANDLE m_hSelSummonCreature; ///< 소환된 크리처 중 선택된 크리처 핸들
AR_HANDLE m_hActiveCreatureQuickSlot; ///< 소환된 크리처 중 quick slot 의 주인 크리처 핸들
AR_HANDLE m_hCurDispSummonCreature; ///< 현재 윈도우에 표시 될 크리쳐
AR_HANDLE m_hCreatureCard[MAX_CREATURE_SLOT]; ///< 편성된 크리처
AR_HANDLE m_hSummonedCreature[MAX_SUMMON_SLOT]; ///< 소환한 크리처
std::vector< SCreatureSlot * > m_vecCreatureList; ///< 소유한 크리처
};