示例#1
0
void Process(Packet_CALL call)
{
    if( Find(call.tid) ) return;

    if( ServerSlot *slot=FindFree() )
    {
        slot->process(call);
    }
}
示例#2
0
void Process(Packet_RECALL recall)
{
    if( ServerSlot *slot=Find(recall.tid) )
    {
        slot->process(recall);
    }
    else if( ServerSlot *slot=FindFree() )
    {
        slot->process_first(recall);
    }
}
//---------------------------------------------------------------------------
//	功能:创建一支队伍
//---------------------------------------------------------------------------
int		KTeamSet::CreateTeam(int nPlayerID)//, char *lpszName)
{
	int nTeamID;
	nTeamID = FindFree();
	if (nTeamID < 0)
		return -2;
//	if (!CheckName(lpszName))
//		return -1;
	if (g_Team[nTeamID].CreateTeam(nPlayerID));//, lpszName))
		return nTeamID;
	return -1;
}
示例#4
0
int KItemSet::Add(KItem* pItem)
{
	KASSERT(NULL != pItem);

	int i = FindFree();

	if (!i)
		return 0;

	Item[i] = *pItem;
#ifdef _SERVER
	SetID(i);
#endif
	m_FreeIdx.Remove(i);
	m_UseIdx.Insert(i);
	return i;

}
//---------------------------------------------------------------------------
//	功能:添加一个队伍成员
//---------------------------------------------------------------------------
BOOL	KTeam::AddMember(DWORD dwNpcID, int nLevel, char *lpszNpcName)
{
	for (int i = 0; i < MAX_TEAM_MEMBER; i++)
	{
		if (m_nMember[i] == (int)dwNpcID)
			return TRUE;
	}

	int nFreeNo;
	nFreeNo = FindFree();
	if (nFreeNo < 0)
		return FALSE;
	m_nMember[nFreeNo] = dwNpcID;
	m_nMemLevel[nFreeNo + 1] = nLevel;
	strcpy(m_szMemName[nFreeNo + 1], lpszNpcName);
	m_nMemNum++;

	return TRUE;
}
示例#6
0
/*!*****************************************************************************
// Function		: KItemSet::Add
// Purpose		: 
// Return		: int 数组编号
// Argumant		: int 道具类型(装备?药品?矿石?……)
// Argumant		: int 魔法等级(如对应于装备,就是一般装备,蓝色装备,亮金等……)
// Argumant		: int 五行属性
// Argumant		: int 等级
// Argumant		: int 幸运值
// Comments		:
// Author		: Spe
*****************************************************************************/
int KItemSet::Add(int nItemGenre, int nSeries, 
				  int nLevel, int nLuck, int nDetailType/*=-1*/, 
				  int nParticularType/*=-1*/, int* pnMagicLevel, int nVersion/*=0*/, UINT nRandomSeed)
{
	int i = FindFree();
	
	if (i == 0)
		return 0;

	KItem*	pItem = &Item[i];

	pItem->m_GeneratorParam.nVersion = nVersion;
	pItem->m_GeneratorParam.uRandomSeed = nRandomSeed;
	switch(nItemGenre)
	{
	case item_equip:			// 装备类
		ItemGen.Gen_Equipment(nDetailType, nParticularType, nSeries, nLevel, pnMagicLevel, nLuck, nVersion, pItem);
		break;
	case item_medicine:			// 药品类
		ItemGen.Gen_Medicine(nDetailType, nLevel, nVersion, pItem);
		break;
	case item_mine:				// 矿石类
		break;
	case item_materials:		// 药材类
		break;
	case item_task:				// 默认是任务类
		ItemGen.Gen_Quest(nDetailType, pItem);
		break;
	case item_townportal:
		ItemGen.Gen_TownPortal(pItem);
		break;
	default:
		break;
	}

#ifdef _SERVER
	SetID(i);
#endif
	m_FreeIdx.Remove(i);
	m_UseIdx.Insert(i);
	return i;
}
//---------------------------------------------------------------------------
//	功能:添加一个队伍成员
//---------------------------------------------------------------------------
BOOL	KTeam::AddMember(int nPlayerIndex)
{
	// 队伍是否为空
	if (m_nCaptain < 0)
		return FALSE;
	// 阵营是否相同
	if ( !CheckAddCondition(nPlayerIndex) )
		return FALSE;
	// 是否已经满员
	if (CheckFull())
		return FALSE;

	int n;
	n = FindFree();
	if (n < 0)
		return FALSE;
	m_nMember[n] = nPlayerIndex;
	m_nMemNum++;

	return TRUE;
}