⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teambattle.h

📁 国内著名网络游戏dragon的服务端完整源码 内附完整数据库结构
💻 H
字号:
#include "defaultheader.h"
#include "Citem.h"
#ifndef __teambattle_h__
#define __teambattle_h__

extern void Script( int num );
extern void CalcWinLoseScore( WINLOSEPOINT &win_lose, int wintype );
extern void SendFightMapChat( short int cn, t_packet *packet );		// 傈眉俊霸 焊辰促.
extern void SendFightMapChatMyTeam( short int cn, t_packet *packet );
extern void SendGamblingResult(CHARLIST* pGambler, int nPayment, DWORD dwMoney);

//////////////////////////////////////////////////////////////////
// 白喉 酒捞袍
struct k_game_item
{
	int count;
	int *lpItem;

	k_game_item()
	{
		count = 0;
		lpItem = 0;
	}
	~k_game_item() { SAFE_DELETE_ARRAY(lpItem); }
};

class CGambleItem
{
private:
	k_game_item m_GambleItem[MAX_GAMBLE_ITEM_KIND][MAX_GAMBLE_ITEM_TYPE]; // CSD-030520

public :
	CGambleItem()
	{
	}

	~CGambleItem()
	{	//< CSD-030517
		for (int i = 0; i < MAX_GAMBLE_ITEM_KIND; ++i)
		{	
			for (int j = 0; j < MAX_GAMBLE_ITEM_TYPE; ++j)
			{
				Release(i, j);
			}
		}		
	}	//> CSD-030517

public:
	int SetSize( int house, int type, int count );
	int Release( int houes, int type );

public:
	void SetItem( int house, int type, int pos, int item_no )
	{
		m_GambleItem[house][type].lpItem[pos] = item_no;
	}

	int GetItem(int house, int type, int pos)
	{	//< CSD-040223
		return m_GambleItem[house][type].lpItem[pos];
	}	//> CSD-040223
	
	int Rand(int house, int type)
	{	//< CSD-040223
		if (m_GambleItem[house][type].count)
		{
			return rand()%m_GambleItem[house][type].count;
		}

		return -1;
	}	//> CSD-040223

	int GetRandItem(int house, int type)
	{	//< CSD-040223
		const int nRandom = Rand(house, type);
		return (nRandom == -1) ? -1:GetItem(house, type, nRandom);
	}	//> CSD-040223
};
extern CGambleItem g_GambleItem;
//////////////////////////////////////////////////////////////////
// >> 011019 ygi
class CTodayGambleItem
{
public :
	ItemAttr m_TodayItem;
public :
	CTodayGambleItem()
	{
		DeleteTodyaItem();
	}
	int DeleteTodyaItem()
	{
		memset( &m_TodayItem, 0, sizeof( ItemAttr ) );
		return 1;
	}
	ItemAttr GetTodayItem()
	{
		return m_TodayItem;
	}
	int SetTodayItem( ItemAttr *item )
	{
		m_TodayItem = *item;
		return 1;
	}
	int CreateTodayItem();
};

extern CTodayGambleItem g_TodayGambleItem;
extern int RefreshTodayItem();
extern k_nation_item_data g_nation_item;	// 惫啊 绊鞭 酒捞袍

// 弊 胶沛阑 绢蠢评捞 瞒瘤 沁绰啊?

const int  STONE_SCORE_FIRST=	IA2_NOTMOVE;		// 1: 檬扁 老锭 
const int  STONE_SCORE_2	=	IA2_OPENED;		//	2 磊府
const int  STONE_SCORE_1	=	IA2_BROKEN;		// 霉掳磊府

class CColossusStone
{
public :
	ITEMLIST * stone;
	CColossusStone *next;
public : 
	CColossusStone() { next = 0; }
	~CColossusStone() { SAFE_DELETE(next); }
};

class CColossusStoneMgr
{
public :
	CColossusStone	m_StoneList;
	DWORD m_GotStoneTime;		// 倒阑 傈何 瞒瘤茄 矫埃
	int m_GotStoneTeam;			// 倒阑 傈何 瞒瘤茄 评
	int m_MaxStone;


public:
	CColossusStoneMgr()
	{
		m_MaxStone = 0;
		SetWinCondition();
	}
	int SetWinCondition( DWORD time = 0, int team = 0 )
	{
		if( !time || !m_GotStoneTime || team != m_GotStoneTime )
		{
			m_GotStoneTime = time;
			m_GotStoneTeam = team;
		}
		return 1;
	}
	bool IsEnd()
	{
		if( !m_GotStoneTime ) return false;
		if( g_curr_time - m_GotStoneTime > 30 ) return true;
		else return false;
	}
	~CColossusStoneMgr()
	{
	}

	int AddStone( int id );
	ITEMLIST *GetList( int count );
	void GetTeamCount( int team[4] );
	void SetStoneByTeam( int id, int team );		// 茄评捞 胶沛阑 扒靛啡阑锭;
	void SetStoneFirst();		// 檬扁 技泼	
	int GetMaxStone();
};

extern void SetStoneByTeam( ITEMLIST *item, int team );
extern int GetTeamByStone( DWORD attr );
extern CColossusStoneMgr g_ColossusStone;
extern int GetFightTeamNumber( CHARLIST *ch );		// 0, 1, 2, 3


class CGuildHouseUnit
{
public :
	int id;
	int level;				// 殿鞭
	int nation;				// 粮犁窍绰 困摹 惫啊
	int blue;				// 备概俊 鞘夸茄 颇鄂 矫弊齿 荐
	int red;				// 备概俊 鞘夸茄 弧埃 矫弊齿 荐
	char map_name[20];		// 困摹 甘
	int x;					// 困摹 谅钎 ( 涝备 谅钎 )
	int y;
	int guild_code;			// 家蜡 辨靛
	int year;
	int month;
	int day;
	int	event_no;		// 秦寸 甘俊 嘛绢 初篮 惯魄 锅龋

public : 
	CGuildHouseUnit() { clear(); }
	int GoToHouse( short int cn );		// 促弗 甘捞搁 甘捞悼阑 矫累窍绊 鞍篮 甘老 版快浚 甘捞悼 风凭阑 角青矫挪促.
	void clear() { id = 0; }
	
};

//#define MAX_GUILD_HOUSE	100
class CGuildHouse
{
public :
	int m_Max;
	CGuildHouseUnit	m_aGuildHouse[MAX_GUILD_HOUSE];
public :
	CGuildHouse() { m_Max = 0; }
	CGuildHouseUnit *GetPointByEventNo( char *map_name, int event_no );	// 秦寸 甘苞 捞亥飘 锅龋肺 喀器府酒 努饭胶俊 立辟
	int GoToHouse( CHARLIST *ch );	// 秦寸 骏器府酒肺 捞悼
	CGuildHouseUnit *GetPointByGuildCode( int guild_code );		// 辨靛 内靛肺 骏器府酒 努饭胶俊 立辟
	int IsMyGuildHouse( CHARLIST *ch, int event_no );
	int SetMax( int max ) { if( max >= m_Max ) m_Max = max+1; return 1; }
	int clear();
	CGuildHouseUnit	*GetHouseByGuildCode( int guild_code );
	CGuildHouseUnit	*GetHouseByIndex( int index )
	{ 
		return &m_aGuildHouse[index]; 
	}
};

extern CGuildHouse	g_GuildHouse;



//< soto-030324
#define		MAX_GUARDIAN_GUILD	3

// 瘤虐固 辨靛. // 汗厘捞 官差绰 辨靛绰 1困辨靛父 官诧促.
class CGuardianGuild
{
private:
	int m_nGuildCount; // 泅犁 瘤虐固 辨靛狼 荐甫 唱鸥辰促.
	int	m_n1stGuildCode; // 1困牢 辨靛 内靛甫 舅酒辰促.
	vector<int>m_vtGuildList;
	
	// 救狼内靛甫 八荤窍瘤 臼绊 辨靛 内靛甫 殿废茄促.(吝汗狼 困氰捞 乐促)
	int	ForcingAddGuild(int nGuildCode)
	{		
		m_vtGuildList.push_back(nGuildCode);
		return ++m_nGuildCount;
	}
public:
	CGuardianGuild() //积己磊
	{ 
		m_vtGuildList.reserve(MAX_GUARDIAN_GUILD);
		m_nGuildCount = 0;
		m_n1stGuildCode = -1; 

	} // 积己磊.
	
	bool IsGuardianGuild(int nGuildCode)// 捞 辨靛内靛啊 瘤虐固 辨靛狼 内靛捞衬?
	{
		for(int i = 0;i < m_nGuildCount;i++)
		{
			if(m_vtGuildList[i] == nGuildCode) return true;
		}
		return false;
	}	
	
	int AddGuild(int nGuildCode)//吝汗登瘤 臼霸 眠啊 矫挪促.
	{
		if(!IsGuardianGuild(nGuildCode))
		{
			m_nGuildCount = ForcingAddGuild(nGuildCode);
		}

		return m_nGuildCount;
	}
	
	int FirstGuild()//1殿 辨靛内靛甫 舅酒辰促.// 绝阑锭绰 -1阑 府畔.
	{
		if(!m_nGuildCount)return -1;

		return m_n1stGuildCode;
	}

	int GetCount()
	{
		if(m_vtGuildList.empty()){return 0;}
		const int nCount = m_vtGuildList.size();
		return __min(nCount,MAX_GUARDIAN);
	}

	int	GetGuildCode(int nIndex)
	{
		if(nIndex < m_nGuildCount)
			return m_vtGuildList[nIndex];
		return -1;
	}

	// 老殿牢 辨靛绰 窍唱啊 酒聪扼.. 阿惫啊喊肺 窍唱肺 官差菌促. 寸辟 3俺瘤.
	bool	Is1StGuild(int nGuildCode){ return IsGuardianGuild(nGuildCode); }// soto-030324

	void Set1stGuild(int nGuildCode)//1殿牢 辨靛甫 殿废茄促.
	{
		if(!m_nGuildCount)//泅犁 辨靛啊 酒公档 殿废 登绢 乐瘤 臼阑锭.
		{
			ForcingAddGuild(nGuildCode);
			m_n1stGuildCode = nGuildCode;
		}
		else // 窍唱 捞惑狼 辨靛啊 殿废登绢 乐阑锭.
		{
			if(IsGuardianGuild(nGuildCode)) // 府胶飘俊 殿废等 内靛牢啊?
			{
				m_n1stGuildCode = nGuildCode;
			}
			else
			{
				ForcingAddGuild(nGuildCode);
				m_n1stGuildCode = nGuildCode;
			}
		}
	}

	void ClearGuild()
	{ 
		m_vtGuildList.clear();
		m_n1stGuildCode = -1;
		m_nGuildCount = 0;
	}
};

extern CGuardianGuild	g_CGuardianGuild; // 瘤虐固 辨靛 包府 傈开 努贰胶. // soto
//> soto-030324
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -