Пример #1
0
void CUIActorMenu::UpdatePrices()
{
	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();

	UpdateActor();
	UpdatePartnerBag();
	u32 actor_price   = CalcItemsPrice( m_pTradeActorList,   m_partner_trade, true  );
	u32 partner_price = CalcItemsPrice( m_pTradePartnerList, m_partner_trade, false );

	string64 buf;
	sprintf_s( buf, "%d RU", actor_price );		m_ActorTradePrice->SetText( buf );		m_ActorTradePrice->AdjustWidthToText();
	sprintf_s( buf, "%d RU", partner_price );	m_PartnerTradePrice->SetText( buf );	m_PartnerTradePrice->AdjustWidthToText();

	float actor_weight   = CalcItemsWeight( m_pTradeActorList );
	float partner_weight = CalcItemsWeight( m_pTradePartnerList );

	sprintf_s( buf, "(%.1f %s)", actor_weight, kg_str );		m_ActorTradeWeightMax->SetText( buf );
	sprintf_s( buf, "(%.1f %s)", partner_weight, kg_str );	m_PartnerTradeWeightMax->SetText( buf );

	Fvector2 pos = m_ActorTradePrice->GetWndPos();
	pos.x = m_ActorTradeWeightMax->GetWndPos().x - m_ActorTradePrice->GetWndSize().x - 5.0f;
	m_ActorTradePrice->SetWndPos( pos );
	pos.x = pos.x - m_ActorTradeCaption->GetWndSize().x - 5.0f;
	m_ActorTradeCaption->SetWndPos( pos );

	pos = m_PartnerTradePrice->GetWndPos();
	pos.x = m_PartnerTradeWeightMax->GetWndPos().x - m_PartnerTradePrice->GetWndSize().x - 5.0f;
	m_PartnerTradePrice->SetWndPos( pos );
	pos.x = pos.x - m_PartnerTradeCaption->GetWndSize().x - 5.0f;
	m_PartnerTradeCaption->SetWndPos( pos );
}
Пример #2
0
void CUIActorMenu::UpdatePartnerBag()
{
	string64 buf;

	CBaseMonster* monster = smart_cast<CBaseMonster*>( m_pPartnerInvOwner );
	if ( monster || m_pPartnerInvOwner->use_simplified_visual() ) 
	{
		m_PartnerWeight->SetText( "" );
	}
	else if ( m_pPartnerInvOwner->InfinitiveMoney() ) 
	{
		m_PartnerMoney->SetText( "--- RU" );
	}
	else
	{
		sprintf_s( buf, "%d RU", m_pPartnerInvOwner->get_money() );
		m_PartnerMoney->SetText( buf );
	}	

	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();
	float total	= CalcItemsWeight( m_pTradePartnerBagList );
	sprintf_s( buf, "%.1f %s", total, kg_str );
	m_PartnerWeight->SetText( buf );
	m_PartnerWeight->AdjustWidthToText();

	Fvector2 pos = m_PartnerWeight->GetWndPos();
	pos.x = m_PartnerWeight_end_x - m_PartnerWeight->GetWndSize().x - 5.0f;
	m_PartnerWeight->SetWndPos( pos );
	pos.x = pos.x - m_PartnerBottomInfo->GetWndSize().x - 5.0f;
	m_PartnerBottomInfo->SetWndPos( pos );
}
Пример #3
0
bool CUITradeWnd::CanMoveToOther(PIItem pItem)
{

	float r1				= CalcItemsWeight(&m_uidata->UIOurTradeList);	// our
	float r2				= CalcItemsWeight(&m_uidata->UIOthersTradeList);	// other

	float itmWeight			= pItem->Weight();
	float otherInvWeight	= m_pOthersInv->CalcTotalWeight();
	float otherMaxWeight	= m_pOthersInv->GetMaxWeight();

	if (!m_pOthersInvOwner->trade_parameters().enabled(
			CTradeParameters::action_buy(0),
			pItem->object().cNameSect()
		))
		return				(false);

	if(otherInvWeight-r2+r1+itmWeight > otherMaxWeight)
		return				false;

	return true;
}
Пример #4
0
bool CUIActorMenu::CanMoveToPartner(PIItem pItem)
{
	if(!pItem->CanTrade())
		return false;

	if ( !m_pPartnerInvOwner->trade_parameters().enabled(
		CTradeParameters::action_buy(0), pItem->object().cNameSect() ) )
	{
		return false;
	}

	float r1				= CalcItemsWeight( m_pTradeActorList );		// actor
	float r2				= CalcItemsWeight( m_pTradePartnerList );	// partner
	float itmWeight			 = pItem->Weight();
	float partner_inv_weight = m_pPartnerInvOwner->inventory().CalcTotalWeight();
	float partner_max_weight = m_pPartnerInvOwner->MaxCarryWeight();

	if ( partner_inv_weight - r2 + r1 + itmWeight > partner_max_weight )
	{
		return false;
	}
	return true;
}
Пример #5
0
void CUIActorMenu::UpdateDeadBodyBag()
{
	string64 buf;

	LPCSTR kg_str = CStringTable().translate( "st_kg" ).c_str();
	float total	= CalcItemsWeight( m_pDeadBodyBagList );
	sprintf_s( buf, "%.1f %s", total, kg_str );
	m_PartnerWeight->SetText( buf );
	m_PartnerWeight->AdjustWidthToText();

	Fvector2 pos = m_PartnerWeight->GetWndPos();
	pos.x = m_PartnerWeight_end_x - m_PartnerWeight->GetWndSize().x - 5.0f;
	m_PartnerWeight->SetWndPos( pos );
	pos.x = pos.x - m_PartnerBottomInfo->GetWndSize().x - 5.0f;
	m_PartnerBottomInfo->SetWndPos( pos );
}