📄 dungeon.h
字号:
SAFE_DELETE_ARRAY(m_pData);
CloseDungeon();
}
void CloseDungeon()
{
ClearVote();
DeletePotalMember();
}
void ClearVote()
{
SAFE_DELETE(pVoteTrue);
SAFE_DELETE(pVoteFalse);
}
void SetVote()
{
ClearVote();
pVoteTrue = new TKeinList< int >;
pVoteFalse = new TKeinList< int >;
}
void DeletePotalMember()
{
if( pPotalList ) delete pPotalList;
pPotalList = 0;
}
void InitPotalMember() // 器呕捞 积己 瞪锭 荤侩
{
DeletePotalMember();
pPotalList = new TKeinList< int >;
}
void AddPotalMember( int cn )
{
int *data = new int;
*data = cn;
if( !pPotalList )
{
InitPotalMember();
}
pPotalList->AddNode( data );
}
int SendEventWhenAddItem( int id, int cn )
{
int ret = 0;
for( int i=0; i<m_nCount; i++ )
{
ret += m_pData[i].SendEventWhenAddItem( id, cn );
}
return ret;
}
bool CheckObject( int cn, int event_no )
{
int ret = 0;
for( int i=0; i<m_nCount; i++ )
{
if( m_pData[i].m_bActive )
ret += m_pData[i].CheckObject( cn, event_no )?1:0;
}
return ret?true:false;
}
void SetSatus( char *value )
{
int scenario_end = 1;
for( int i=0; i<m_nCount; i++ )
{
if( value[m_pData[i].m_nLayer-1] )
{
m_pData[i].SetActive();
scenario_end = 0;
}
else
{
m_pData[i].SetClose();
}
}
if( scenario_end ) // 傈何 泼扁磊..
GetOutDugeon( CDungeonMapMgr::GOT_END_SCENARIO );
}
CDungeonMap* GetDungeonMapByLayer( int layer )
{
for( int i=0; i<m_nCount; i++ )
{
if( m_pData[i].m_nLayer == layer ) return &m_pData[i];
}
return NULL;
}
CDungeonMap* GetActiveDungeonMap()
{
for( int i=m_nCount-1; i>=0; i-- )
{
if( m_pData[i].m_bActive ) return &m_pData[i];
}
return NULL;
}
CDungeonMap* GetDungeonMap() // 贸澜铂 啊廉柯促.
{
return &m_pData[0];
}
void LoadTrap()
{
for( int i=0; i<m_nCount; i++ )
{
m_pData[i].Load( m_pData[i].m_nLayer );
}
}
void Proc()
{
for( int i=0; i<m_nCount; i++ )
{
m_pData[i].Proc();
}
}
int GetTrapCount( int &count, int &active_count , int &active_time )
{
CDungeonMap* pDM = GetActiveDungeonMap();
return pDM?pDM->GetTrapCount( count, active_count, active_time ):0;
}
int KilledScenarioBoss( CHARLIST *user, CHARLIST *npc )
{
for( int i=0; i<m_nCount; i++ )
{
m_pData[i].KillBoss( user, npc );
}
return 1;
}
int CloseConnect( int cn )
{
if( pVoteTrue )
{
pVoteTrue->DeleteNode( cn );
pVoteFalse->DeleteNode( cn );
return 1;
}
if( pPotalList )
{
pPotalList->DeleteNode( cn );
return 1;
}
else return 0;
}
void GetOutDugeon( int type );
int ScenarioFightProc( CDungeonObject *pDO );
int EndUserFightByDragon();
int DropDragonItem();
void NewJoin( short int cn )
{
// 攫单靛 尝烙 泅惑 秦搬 // 030811
for( int i=0; i<m_nCount; i++ )
{
m_pData[i].NewJoin( cn );
}
}
};
class CDungeonBasic
{
public:
enum
{
TYPE_STATUS = 1,
TYPE_STATUS_REGIST = 2,
};
typedef vector<START_UP_INFO> VECTOR_START_UP; // CSD-030323
typedef VECTOR_START_UP::iterator ITOR_START_UP; // CSD-030323
public :
int m_nId;
int m_nDungeonMapPort1;
int m_nDungeonMapPort2;
union
{
int m_nActive;
BYTE m_pActive[4];
};
protected:
int m_nIndex;
VECTOR_START_UP m_vtStartUpInfo;
public:
int m_nContinueTime; // 咀萍宏 登绢 乐绰 矫埃 - 2矫埃
int m_nStartTime; // 泅犁 惑怕 柳青等 矫埃
int m_nWaitTime; // 扁崔妨具 窍绰 矫埃
public :
CDungeonBasic()
{
m_nId = 0;
m_nContinueTime = 0;
m_nStartTime = 0;
m_nWaitTime = 0;
m_nDungeonMapPort1 = 0;
m_nDungeonMapPort2 = 0;
m_nActive = 0;
m_nIndex = -1;
m_vtStartUpInfo.clear();
}
~CDungeonBasic()
{
m_vtStartUpInfo.clear();
}
void SetID(int nID) { m_nId = nID; }
void AddStartUpInfo(DWORD idIndex, int nApplyDay, int nStartHour, int nEndHour)
{
START_UP_INFO infStartUp;
infStartUp.idIndex = idIndex;
infStartUp.nApplyDay = nApplyDay;
infStartUp.nStartHour = nStartHour;
infStartUp.nEndHour = nEndHour;
infStartUp.nEndMinute = 0;
infStartUp.nStartMinute = 0;
m_vtStartUpInfo.push_back(infStartUp);
}
START_UP_INFO* GetStartUpInfo(DWORD idIndex)
{
for (int i = 0; i < GetStartUpInfoCount(); ++i)
{
if (idIndex == m_vtStartUpInfo[i].idIndex)
{
return &m_vtStartUpInfo[i];
}
}
return NULL;
}
int GetStartUpInfoCount()const{return m_vtStartUpInfo.size();}//030321 lsw
VECTOR_START_UP& GetStartUpList()
{
return m_vtStartUpInfo;
}
void SetStartUpInfo(DWORD idIndex, int nApplyDay, int nStartHour, int nStartMinute, int nEndHour, int nEndMinute)
{
for (int i = 0; i < GetStartUpInfoCount(); ++i)
{
if (idIndex == m_vtStartUpInfo[i].idIndex)
{
m_vtStartUpInfo[i].nApplyDay = nApplyDay;
m_vtStartUpInfo[i].nStartHour = nStartHour;
m_vtStartUpInfo[i].nStartMinute = nStartMinute;
m_vtStartUpInfo[i].nEndHour = nEndHour;
m_vtStartUpInfo[i].nEndMinute = nEndMinute;
return;
}
}
}
bool IsExistStartUp(DWORD idIndex)const
{
for (int i = 0; i < GetStartUpInfoCount(); ++i)
{
if (idIndex == m_vtStartUpInfo[i].idIndex)
{
return true;
}
}
return false;
}
void SetDungeonMapPort1(int nPort) { m_nDungeonMapPort1 = nPort; }
void SetDungeonMapPort2(int nPort) { m_nDungeonMapPort2 = nPort; }
int SetInt(int* data)
{ //< CSD-030723
int* set_int = &m_nId;
for (int i = 0; i < MAX_CDUNGEONBASIC_INT; ++i)
{
set_int[i] = data[i];
}
return 1;
} //> CSD-030723
int Proc();
int SendScenarioStatus();
int SaveDungeonStatus();
int SetActiveFlag( int layer, int value=0, int type = 0 )
{
if( !layer ) m_nActive = 0;
else
{
if( type )
{
for( int i=0; i<4; i++ )
{
if( i == layer-1 ) continue;
m_pActive[i] = 0;
}
}
m_pActive[layer-1] = value;
}
SendScenarioStatus();
return 1;
}
int IsActive( int layer )
{
if( layer < 0 ) return 0;
return m_pActive[layer-1];
}
bool IsOpenDungeon(int nIndex) const
{
struct tm* NewTime;
time_t LongTime;
time(&LongTime);
NewTime = localtime(&LongTime);
if (NewTime->tm_wday != m_vtStartUpInfo[nIndex].nApplyDay)
{
return false;
}
if (g_hour != m_vtStartUpInfo[nIndex].nStartHour)
{
return false;
}
if (g_min != m_vtStartUpInfo[nIndex].nStartMinute)
{
return false;
}
return true;
}
bool IsCloseDungeon(int nIndex) const
{
if (nIndex < 0)
{
return false;
}
if (g_hour != m_vtStartUpInfo[nIndex].nEndHour)
{
return false;
}
if (g_min != m_vtStartUpInfo[nIndex].nEndMinute)
{
return false;
}
return true;
}
// calcurate remain time // 031110 YGI
int GetRemainTime( ) const
{
if(m_nIndex< 0)
{
return false;
}
int temp_time = 0;
temp_time = (m_vtStartUpInfo[m_nIndex].nEndHour%24) - (g_hour%24);
temp_time += 24;
temp_time %= 24;
temp_time = 60*temp_time+m_vtStartUpInfo[m_nIndex].nEndMinute - g_min;
return temp_time;
}
};
class CDungeonMgr // 4俺狼 带傈阑 包府
{
CDungeonBasic** m_pData;
int m_nCount;
public :
TKeinList<CDungeonHistory> m_History;
public :
CDungeonMgr( int N )
{
m_pData = new CDungeonBasic*[N];
for( int i=0; i<N; i++ )
{
m_pData[i] = 0;
}
m_nCount = N;
}
~CDungeonMgr()
{
for( int i=0; i<m_nCount; i++ )
{
CDungeonBasic* pTemp = GetDungeon(i);
if( pTemp )
{
SAFE_DELETE(pTemp);
}
}
SAFE_DELETE_ARRAY(m_pData);
m_nCount = 0;
}
int SaveDungeonStatus()
{
for( int i=0; i<m_nCount; i++ )
{
CDungeonBasic* pTemp = GetDungeon(i);
if(pTemp)
{
pTemp->SaveDungeonStatus();
}
}
return 1;
}
bool SetData( int i, CDungeonBasic *pData )
{
if( i>=m_nCount ){return false;}
SAFE_DELETE(m_pData[i]);
m_pData[i] = pData;
return true;
}
CDungeonBasic* GetDungeon( int index )
{
if( index>=m_nCount ) {return NULL;}
return m_pData[index];
}
CDungeonBasic* GetDungeonByPort( WORD port )
{
for( int i=0; i<m_nCount; i++ )
{
CDungeonBasic* pTemp = GetDungeon(i);
if( pTemp )
{
if( pTemp->m_nDungeonMapPort1 == port
|| pTemp->m_nDungeonMapPort2 == port )
{
return m_pData[i];
}
}
}
return NULL;
}
int GetCount() { return m_nCount; }
int Proc();
int CheckActive( int port ) // 弊 甘俊 甸绢哎 荐 乐绰瘤 绝绰瘤
{
CDungeonBasic* temp = GetDungeonByPort(port);
if( temp )
{
if( !temp->m_nActive || temp->m_pActive[0] ) return 1;
}
return 0;
}
int SendScenarioStatus()
{
for( int i=0; i<m_nCount; i++ )
{
CDungeonBasic* pTemp = GetDungeon(i);
if( pTemp )
{
pTemp->SendScenarioStatus();
}
}
return 1;
}
};
//////////////////////////////////////////////////////////////////
#define DRAGON_ITEMCONTROL_NUMBER 81
class CScenarioDragonItem
{
public :
ItemAttr *m_pTotalItem;
int m_nTotalCount;
public :
CScenarioDragonItem()
{
m_pTotalItem = 0;
m_nTotalCount = 0;
}
~CScenarioDragonItem()
{
SAFE_DELETE_ARRAY(m_pTotalItem);
m_pTotalItem = 0;
m_nTotalCount = 0;
}
int MakeDragonItem( int total );
int DropDragonItem( TKeinList<int> *pLink1, TKeinList<int> *pLink2 );
};
//////////////////////////////////////////////////////////////////
extern void SendTileAttr( int index, int type, int number, int x, int y, int range, short int cn );
extern int LoadDungeonTrap( CDungeonObject *pData, int layer );
extern int LoadDungeonMapEach( int port, int *temp );
extern CDungeonMapMgr *g_pDungeonMap; // 秦寸 甘俊 乐绰 带傈甸( 1摸, 2摸 )狼 包府 努贰胶
extern CDungeonMgr *g_pDungeonMgr; // 葛电 带傈( 酒厚胶 固泵,.. )狼 包府 努贰胶
extern CScenarioDragonItem *g_pDragonItem;
extern void RecvGetScenarioInfo( t_packet *p, short int cn );
extern void RecvGetScenarioInfoMap( t_packet *p, int type = 0 );
extern void RecvScenarioCommand( t_packet *p );
extern void RecvCheckGotoScenarioDungeon( t_packet *p, short int cn );
extern void RecvCheckGotoScenarioDungeonResult( t_packet *p, short int cn );
extern void SendCheckGotoScenarioDungeon( short int cn, char *map_name, int x, int y );
extern int SendDungeonHistory( CDungeonHistory *pHistory );
extern void RecvScenarioMessageMap( t_packet *p, short int cn );
extern void SendRegistDungeonMgrServer( int type, void *msg, int size );
extern void RecvScenarioDetailInfo( t_packet *p, short int cn );
extern void RecvScenarioDetailInfoMap( t_packet *p, short int cn );
extern void SendDeleteScenarioEventBox( int index );
extern void RecvScenarioTrapKeyInfo( t_packet *p, short int cn );
extern void SendScenarioMessage( short int cn, int type, void *data = NULL, int size = 0 );
extern void DeleteScenarioItem( CHARLIST *ch );
extern void RecvDragonVote( t_packet *p, short int cn );
extern void ScenarioDragonEndWar();
extern void ScenarioDragonMsgFunc();
extern void RecvGetScenarioTime( t_packet *p, short int cn );
extern void SendGetScenarioTime(int port, int cn, k_client_scenario_time_info* pPacket); // CSD-030306
extern void RecvChangeScenarioTime( t_packet *p, short int cn );
extern int KilledScenarioBoss( CHARLIST *user, CHARLIST *npc ); // 矫唱扼府坷 阁胶磐啊 磷菌促.
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -