Exemple #1
0
void CUIBagWnd::AttachAddon(CUICellItem* itm, CSE_ALifeItemWeapon::EWeaponAddonState add_on, bool external){
	R_ASSERT(itm);
	CWeapon* wpn = (CWeapon*)itm->m_pData;	
	CUICellItem* add_itm = NULL;
	CUIWeaponCellItem* wpn_itm = smart_cast<CUIWeaponCellItem*>(itm);
	R_ASSERT(wpn_itm);

	switch (add_on){
		case CSE_ALifeItemWeapon::eWeaponAddonScope:
			add_itm = GetItemBySectoin(*wpn->GetScopeName());
			break;
		case CSE_ALifeItemWeapon::eWeaponAddonSilencer:			
			add_itm = GetItemBySectoin(*wpn->GetSilencerName());
			break;
		case CSE_ALifeItemWeapon::eWeaponAddonGrenadeLauncher:	
			add_itm = GetItemBySectoin(*wpn->GetGrenadeLauncherName());		
			break;
		default:	NODEFAULT;
	}

	if (external)
        m_info[add_itm->m_index].external = external;
	BuyItem(add_itm);
	wpn->Attach((CInventoryItem*)add_itm->m_pData, true);

	wpn_itm->Update();

	if (external){
		switch (add_on){
			case CSE_ALifeItemWeapon::eWeaponAddonScope:
				SET_EXTERNAL_COLOR(wpn_itm->get_addon_static(CUIWeaponCellItem::eScope));
				break;
			case CSE_ALifeItemWeapon::eWeaponAddonSilencer:			
				SET_EXTERNAL_COLOR(wpn_itm->get_addon_static(CUIWeaponCellItem::eSilencer));
				break;
			case CSE_ALifeItemWeapon::eWeaponAddonGrenadeLauncher:	
				SET_EXTERNAL_COLOR(wpn_itm->get_addon_static(CUIWeaponCellItem::eLauncher));
				break;
			default:	
				NODEFAULT;
		}
	}
}
Exemple #2
0
shared_str CUIMpTradeWnd::GetAddonNameSect(SBuyItemInfo* itm, item_addon_type at)
{
	CInventoryItem* item_	= (CInventoryItem*)itm->m_cell_item->m_pData;
	CWeapon* w				= smart_cast<CWeapon*>(item_);
	
	switch(at)
	{
	case at_scope:
		{
			return w->GetScopeName();
		}break;

	case at_silencer:
		{
			return w->GetSilencerName();
		}break;

	case at_glauncher:
		{
			return w->GetGrenadeLauncherName();
		}break;
	};
	return NULL;
}