Exemplo n.º 1
0
VOID CObject_PlayerOther::Debug_ChangeSpeed(FLOAT fStep)
{
	FLOAT fSpeed = GetCharacterData()->Get_MoveSpeed() + fStep;

	if(fSpeed < 0.0f) fSpeed = 0.0f;
	if(fSpeed > 10.0f) fSpeed = 10.0f;

	GetCharacterData()->Set_MoveSpeed(fSpeed);
}
Exemplo n.º 2
0
VOID CObject_PlayerOther::UpdateHairMesh(VOID)
{
	if(m_pRenderInterface != NULL)
	{
		INT nHairMesh = GetCharacterData()->Get_HairMesh();
		if(nHairMesh == INVALID_ID)
		{
			nHairMesh = m_pCharRace->nDefHairGeo;
		}
		if(nHairMesh != INVALID_ID)
		{
			//-----------------------------------------------------------
			//角色头发模型数据库
			DBC_DEFINEHANDLE(s_pCharHairMesh, DBC_CHARACTER_HAIR_GEO);
			//查找相应记录
			const _DBC_CHAR_HAIR_GEO* pHairMesh = (const _DBC_CHAR_HAIR_GEO*)s_pCharHairMesh->Search_Index_EQU(nHairMesh);
			if(pHairMesh != NULL)
			{
				m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_HAIR_MESH, pHairMesh->pMeshFile);
			}
			else
			{
				m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_HAIR_MESH, "");
			}
			//如果是UI物体,重新设置VisibleFlag
			if(GetFakeObjectFlag())
			{
				m_pRenderInterface->Actor_SetUIVisibleFlag();
			}
		}
	}
}
Exemplo n.º 3
0
VOID CObject_PlayerOther::UpdateFaceMesh(VOID)
{
	if(m_pRenderInterface != NULL)
	{
		INT nFaceMeshID = GetCharacterData()->Get_FaceMesh();
		if(nFaceMeshID == INVALID_ID)
		{
			nFaceMeshID = m_pCharRace->nDefHeadGeo;
		}
		if(nFaceMeshID != INVALID_ID)
		{
			//-----------------------------------------------------------
			//角色头部模型数据库
			DBC_DEFINEHANDLE(s_pCharHeadGeo, DBC_CHARACTER_HEAD_GEO);
			//查找相应记录
			const _DBC_CHAR_HEAD_GEO* pFaceGeo = (const _DBC_CHAR_HEAD_GEO* )s_pCharHeadGeo->Search_Index_EQU(nFaceMeshID);
			if(pFaceGeo != NULL)
			{
				m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_FACE_MESH, pFaceGeo->pMeshFile);
			}
			else
			{
				m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_FACE_MESH, "");
			}

			//如果是UI物体,重新设置VisibleFlag
			if(GetFakeObjectFlag())
			{
				m_pRenderInterface->Actor_SetUIVisibleFlag();
			}
		}
	}
}
Exemplo n.º 4
0
unsigned int Client::GetAccountTotalOnlineTime()
{
    unsigned int totalTimeConnected = GetCharacterData()->GetOnlineTimeThisSession();
    Result result(db->Select("SELECT SUM(time_connected_sec) FROM characters WHERE account_id = %d", accountID.Unbox()));
    if (result.IsValid())
        totalTimeConnected += result[0].GetUInt32("SUM(time_connected_sec)");

    return totalTimeConnected;
}
Exemplo n.º 5
0
VOID CObject_PlayerOther::UpdateHairColor(VOID)
{
	//-----------------------------------------------------------
	//渲染层设置
	if(m_pRenderInterface)
	{
		UINT uHairColor = GetCharacterData()->Get_HairColor();
		m_pRenderInterface->Actor_SetHairColor(uHairColor);
	}
}
Exemplo n.º 6
0
/** Gets the width of the specified character in this font, in pixels.

Note: For OpenType fonts this function returns the horizontal advance of
the character, which may be different from the actual width.

@param aChar The character whose width should be determined. 
@return The width of the specified character in this font, in pixels. 
@see CFont::CharWidthInPixels() 
@publishedAll 
@released
*/
EXPORT_C TInt CFbsFont::DoCharWidthInPixels(TChar aChar) const
	{
	TOpenFontCharMetrics metrics;
	const TUint8* bitmap;
	TSize size;
	if (GetCharacterData(aChar,metrics,bitmap,size) != ENoCharacterData)
		{
		return metrics.HorizAdvance();
		}
	return 0;
	}
Exemplo n.º 7
0
VOID CObject_PlayerOther::UpdateCharRace(VOID)
{
	m_pCharRace = NULL;

	CCharacterData *pCharacterData = GetCharacterData();
	if(pCharacterData != NULL && pCharacterData->Get_RaceID() != INVALID_ID)
	{
		DBC_DEFINEHANDLE(s_pCharacterRace, DBC_CHARACTER_RACE);
		m_pCharRace = (const _DBC_CHAR_RACE*)(s_pCharacterRace->Search_Index_EQU(pCharacterData->Get_RaceID()));
	}
}
Exemplo n.º 8
0
int Client::GetAllianceID()
{
    psCharacter * mychar = GetCharacterData();
    if (mychar == NULL)
        return 0;

    psGuildInfo * guild = mychar->GetGuild();
    if (guild == NULL)
        return 0;
    
    return guild->GetAllianceID();
}
Exemplo n.º 9
0
/** Gets the character metrics and a pointer to the compressed glyph bitmap for 
the specified character. 
This function is deprecated, because TCharacterMetrics cannot store metrics 
larger than 127 or less than 127  use GetCharacterData() instead.
@param aCode The code for the character to be checked. 
@param aBytes On return, contains a pointer to the compressed glyph bitmap. 
@return The character metrics for the font. 
@publishedAll 
@released
@deprecated
*/
EXPORT_C TCharacterMetrics CFbsFont::CharacterMetrics(TInt aCode,const TUint8*& aBytes) const
	{
	TCharacterMetrics metrics;
	// Save time by not converting from TCharacterMetrics to TOpenFontCharMetrics and back if this is a real bitmap font.
	if (iHandle)
		{	
 		CBitmapFont* bitmap_font = Address();

 		if (!bitmap_font->IsOpenFont())
			metrics = bitmap_font->CharacterMetrics(aCode,aBytes);
		else
			{
			TOpenFontCharMetrics new_metrics;
			aBytes = NULL;
			TSize size;
			if (GetCharacterData(aCode,new_metrics,aBytes,size) != ENoCharacterData)
				new_metrics.GetTCharacterMetrics(metrics);
			}
		}
	return metrics;
	}
Exemplo n.º 10
0
bool Client::AllowDisconnect()
{
    if(!GetActor() || !GetCharacterData())
        return true;

    if(GetActor()->GetInvincibility())
        return true;

    if(!zombie)
    {
        zombie = true;
        // max 3 minute timeout period
        zombietimeout = csGetTicks() + 3 * 60 * 1000;
    }
    else if(csGetTicks() > zombietimeout)
    {
        return true;
    }

    return allowedToDisconnect;
}
Exemplo n.º 11
0
RC_RESULT CObject_PlayerOther::OnCommand(const SCommand_Object *pCmd )
{
	RC_RESULT rcResult = RC_SKIP;

	switch ( pCmd->m_wID )
	{
	case OC_UPDATE_EQUIPMENT:
		{
			UINT	dwModifyFlags	= pCmd->m_adwParam[0];
			UINT	*pData			= (UINT*)(pCmd->m_apParam[1]);
			UINT	i, dwIndex;
			dwIndex = 0;
			for ( i = 0; i < HEQUIP_NUMBER; i++ )
			{
				if ( dwModifyFlags & (1<<i) )
				{
					GetCharacterData()->Set_Equip((HUMAN_EQUIP)i, pData[dwIndex]);
					dwIndex++;
				}
			}
			rcResult = RC_OK;
		}
		break;
	case OC_UPDATE_TEAM_FLAG:
		{
			if(this != CObjectManager::GetMe()->GetMySelf())
			{
				CCharacterData* pData = GetCharacterData();
				pData->Set_HaveTeamFlag( pCmd->m_abParam[0] );
				pData->Set_TeamLeaderFlag( pCmd->m_abParam[1] );
				pData->Set_TeamFullFlag( pCmd->m_abParam[2] );
			}
			rcResult = RC_OK;
		}
		break;
	case OC_TEAM_FOLLOW_MEMBER:
		{
			CCharacterData* pData = GetCharacterData();

			pData->Set_TeamFollowListCount( pCmd->m_adwParam[0] );

			for( INT i=0; i<(INT)(pCmd->m_adwParam[0]); ++i )
			{
				pData->Set_TeamFollowedMember(i, pCmd->m_adwParam[i+1]);
			}

			rcResult = RC_OK;
		}
		break;
	case OC_UPDATE_TEAM_FOLLOW_FLAG:
		{
			CCharacterData* pData = GetCharacterData();

			pData->Set_TeamFollowFlag( pCmd->m_abParam[0] );
			CharacterLogic_GetAI()->OnAIStopped();

			rcResult = RC_OK;
		}
		break;
	default:
		return CObject_PlayerNPC::OnCommand(pCmd);
	}

	return rcResult;
}
Exemplo n.º 12
0
VOID CObject_PlayerOther::EquipItem_BodyLocator(HUMAN_EQUIP nPart, INT nID)
{
	//-----------------------------------------------------------
	//渲染层设置
	if(!m_pRenderInterface)
	{
		return;
	}

	//-----------------------------------------------------------
	//角色挂接类数据库
	DBC_DEFINEHANDLE(s_pWeaponItem, DBC_ITEM_VISUAL_LOCATOR);
	const _DBC_ITEM_VISUAL_LOCATOR* pEquipVisual = (const _DBC_ITEM_VISUAL_LOCATOR*)s_pWeaponItem->Search_Index_EQU(nID);
	if(!pEquipVisual)
	{
		return;
	}

	//右手
	if(pEquipVisual->pObjFile_Right && pEquipVisual->pObjFile_Right[0] != '\0')
	{
		m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_CURRENT_RIGHTWEAPON, pEquipVisual->pObjFile_Right);
		m_pRenderInterface->SetRightWeaponMat(szIDSTRING_WEAPON_MAT, pEquipVisual->pMatName_Right);
		/*		
		tObject_Item* MyWeapon = CDataPool::GetMe()->UserEquip_GetItem(HEQUIP_WEAPON);

		CObject_Item_Equip::EXTRA_DEFINE* Extra = (CObject_Item_Equip::EXTRA_DEFINE*)((CObject_Item_Equip*)(CObject_Item*)MyWeapon)->GetExtraInfo();

		CObject_Item_Equip::EQUIP_ATTACH_GEM Gems = Extra->m_vEquipAttachGem;

		INT Gem_MaxLevel = 0;
		LPCTSTR szColor;

		for(INT GemIndex = 0; GemIndex < Gems.size(); GemIndex++)
		{
		UINT uGemType = Gems[GemIndex].m_GemType;

		// 从数据库中查找到这个Gem的信息
		DBC_DEFINEHANDLE(s_pItem_Gem, DBC_ITEM_GEM);
		//搜索纪录
		const _DBC_ITEM_GEM* pGem = (const _DBC_ITEM_GEM*)s_pItem_Gem->Search_Index_EQU(uGemType);
		if(!pGem) continue;

		if(pGem->nQuality > Gem_MaxLevel)
		{
		Gem_MaxLevel = pGem->nQuality;
		szColor = pGem->szColor;
		}
		}
		*/
		/////////////// code//////////////////
		UINT uGemType = GetCharacterData()->Get_EquipGem(HEQUIP_WEAPON);
		if(INVALID_ID != uGemType)
		{
			DBC_DEFINEHANDLE(s_pItem_Gem, DBC_ITEM_GEM);
			//搜索纪录
			const _DBC_ITEM_GEM* pGem = (const _DBC_ITEM_GEM*)s_pItem_Gem->Search_Index_EQU(uGemType);
			UINT nColor = 0;
			LPCTSTR szColor;
			szColor = pGem->szColor;

			INT eff_index = pGem->nEffectIndex;
			eff_index--;//表编号从1开始,对应列从0开始

			//如果策划在这列填了-1,表示不显示颜色。
			if(szColor[0] != '-' && szColor[1] != '1' && (eff_index >= 0) ) 
			{
				sscanf(szColor,"%8X",&nColor);

				if( pEquipVisual->pEffectName[eff_index] )//&& pEquipVisual->pEffectName[0] != '\0')
				{
					m_pRenderInterface->SetRightWeaponEffect(pEquipVisual->pEffectName[eff_index],nColor);
				}
			}
			else
			{
				m_pRenderInterface->SetRightWeaponEffect('\0',0);
			}
		}
		else
		{
//			if(pEquipVisual->pEffectName[eff_index] && pEquipVisual->pEffectName[0] != '\0')
//			{
				m_pRenderInterface->SetRightWeaponEffect('\0',0);
//			}
		}
	}
	else
		m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_CURRENT_RIGHTWEAPON, "");

	//左手
	if(pEquipVisual->pObjFile_Left && pEquipVisual->pObjFile_Left[0] != '\0' )
	{
		m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_CURRENT_LEFTWEAPON, pEquipVisual->pObjFile_Left);
		m_pRenderInterface->SetLeftWeaponMat(szIDSTRING_WEAPON_MAT, pEquipVisual->pMatName_Left);


		UINT uGemType = GetCharacterData()->Get_EquipGem(HEQUIP_WEAPON);
		if(INVALID_ID != uGemType)
		{
			DBC_DEFINEHANDLE(s_pItem_Gem, DBC_ITEM_GEM);
			//搜索纪录
			const _DBC_ITEM_GEM* pGem = (const _DBC_ITEM_GEM*)s_pItem_Gem->Search_Index_EQU(uGemType);
			UINT nColor = 0;
			LPCTSTR szColor;
			szColor = pGem->szColor;
			INT eff_index = pGem->nEffectIndex;
			eff_index--;//表编号从1开始,对应列从0开始

			//如果策划在这列填了-1,表示不显示颜色。
			if(szColor[0] != '-' && szColor[1] != '1' && (eff_index >= 0)) 
			{
				sscanf(szColor,"%8X",&nColor);


				if( pEquipVisual->pEffectName[eff_index] )//&& pEquipVisual->pEffectName[0] != '\0')
				{
					m_pRenderInterface->SetLeftWeaponEffect(pEquipVisual->pEffectName[eff_index],nColor);
				}
			}
			else
			{
				m_pRenderInterface->SetLeftWeaponEffect('\0',0);
			}
		}
		else
		{
//			if(pEquipVisual->pEffectName && pEquipVisual->pEffectName[0] != '\0')
//			{
				m_pRenderInterface->SetLeftWeaponEffect('\0',0);
//			}
		}
	}
	else
		m_pRenderInterface->Actor_SetObjectProperty(szIDSTRING_CURRENT_LEFTWEAPON, "");
}
Exemplo n.º 13
0
VOID CObject_PlayerOther::EquipItem_BodyPart(HUMAN_EQUIP nPart, INT nID)
{
	//-----------------------------------------------------------
	//渲染层设置
	if(!m_pRenderInterface)
	{
		return;
	}

	//-----------------------------------------------------------
	//角色装备类数据库
	DBC_DEFINEHANDLE(s_pEquipItem, DBC_ITEM_VISUAL_CHAR);
	const _DBC_ITEM_VISUAL_CHAR* pEquipVisual = (const _DBC_ITEM_VISUAL_CHAR*)s_pEquipItem->Search_Index_EQU(nID);
	if(!pEquipVisual)
	{
		return;
	}

	//种族(男,女)
	INT nRaceID = GetCharacterData()->Get_RaceID();
	TDAssert(nRaceID >= 0 && nRaceID<CHAR_RACE_NUM);
	if(nRaceID < 0 || nRaceID >= CHAR_RACE_NUM)
	{
		return ;
	}

	switch(nPart)
	{
	case HEQUIP_CAP:				//帽子
		{
			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_CAP_MESH, pEquipVisual->pVisualEntity[nRaceID*2+0]);

			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_CAP_MAT, pEquipVisual->pVisualEntity[nRaceID*2+1]);
		}
		break;
	case HEQUIP_ARMOR:				//身体
		{
			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_MAINBODY_MESH, pEquipVisual->pVisualEntity[nRaceID*2+0]);

			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_MAINBODY_MAT, pEquipVisual->pVisualEntity[nRaceID*2+1]);
		}
		break;
	case HEQUIP_CUFF:				//手臂
		{
			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_ARM_MESH, pEquipVisual->pVisualEntity[nRaceID*2+0]);

			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_ARM_MAT, pEquipVisual->pVisualEntity[nRaceID*2+1]);
		}
		break;
	case HEQUIP_BOOT:				//鞋
		{
			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_FOOT_MESH, pEquipVisual->pVisualEntity[nRaceID*2+0]);

			m_pRenderInterface->Actor_SetObjectProperty(
				szIDSTRING_FOOT_MAT, pEquipVisual->pVisualEntity[nRaceID*2+1]);
		}
		break;
	}
}
Exemplo n.º 14
0
VOID CObject_PlayerOther::UpdateEquip(HUMAN_EQUIP point)
{
	CCharacterData *pCharacterData = GetCharacterData();
	if(pCharacterData == NULL)
	{
		return ;
	}

	if(point == HEQUIP_WEAPON && IsHideWeapon())
	{
		return ;
	}

	if(!GetFakeObjectFlag())
	{
		if(pCharacterData->Get_ModelID() != INVALID_ID)
		{
			return ;
		}
	}

	//生成一个临时的Item对象
	CObject_Item_Equip *pTempEquip = NULL;
	INT nID = pCharacterData->Get_Equip(point);
	if(nID != INVALID_ID)
	{
		pTempEquip = (CObject_Item_Equip *)CObject_Item::NewItem(nID);
	}

	//如果是装备根据装配点装备物品
	if(pTempEquip != NULL && ICLASS_EQUIP == pTempEquip->GetItemClass())
	{
		switch(pTempEquip->GetItemType())
		{
		case HEQUIP_WEAPON:				//武器,挂接类装备
			{
				EquipItem_BodyLocator(pTempEquip->GetItemType(), pTempEquip->GetVisualID());
				SetWeaponType( pTempEquip->GetWeaponType() );
			}
			break;
		case HEQUIP_CAP:				//帽子, 身体, 手臂, 鞋, 装备类物品
		case HEQUIP_ARMOR:				
		case HEQUIP_CUFF:				
		case HEQUIP_BOOT:	
			{
				EquipItem_BodyPart(pTempEquip->GetItemType(), pTempEquip->GetVisualID());
			}
			break;
		case HEQUIP_SASH:				//腰带, 戒子, 项链
		case HEQUIP_RING:				
		case HEQUIP_NECKLACE:		
		default:
			break;
		}
	}
	else
	{
		//卸载装备
		UnEquipItem(point);
	}

	//如果是UI物体,重新设置VisibleFlag
	if(GetFakeObjectFlag())
	{
		m_pRenderInterface->Actor_SetUIVisibleFlag();
	}

	CObject_Item::DestroyItem(pTempEquip);
}