当前位置: 首页>>代码示例>>C++>>正文


C++ InventoryItemRef::HasAttribute方法代码示例

本文整理汇总了C++中InventoryItemRef::HasAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ InventoryItemRef::HasAttribute方法的具体用法?C++ InventoryItemRef::HasAttribute怎么用?C++ InventoryItemRef::HasAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InventoryItemRef的用法示例。


在下文中一共展示了InventoryItemRef::HasAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: source

Damage::Damage(
    SystemEntity *_source,
    InventoryItemRef _weapon,
    InventoryItemRef _charge,
    EVEEffectID _effect): source(_source), charge(_charge), effect(_effect)
{
	if(_charge->HasAttribute(AttrKineticDamage))
		kinetic = (_charge->GetAttribute(AttrKineticDamage) * _weapon->GetAttribute(AttrDamageMultiplier)).get_float();
	else
		kinetic = 0.0;

	if(_charge->HasAttribute(AttrThermalDamage))
		thermal = (_charge->GetAttribute(AttrThermalDamage) * _weapon->GetAttribute(AttrDamageMultiplier)).get_float();
	else
		thermal = 0.0;

	if(_charge->HasAttribute(AttrEmDamage))
		em = (_charge->GetAttribute(AttrEmDamage) * _weapon->GetAttribute(AttrDamageMultiplier)).get_float();
	else
		em = 0.0;

	if(_charge->HasAttribute(AttrExplosiveDamage))
		explosive = (_charge->GetAttribute(AttrExplosiveDamage) * _weapon->GetAttribute(AttrDamageMultiplier)).get_float();
	else
		explosive = 0.0;
	
	weapon = _weapon;

}
开发者ID:Reve,项目名称:evemu_retribution,代码行数:29,代码来源:Damage.cpp

示例2: GetItemRow

void Contract::GetItemRow( InventoryItemRef item, PyPackedRow* into ) const
{
    into->SetField( "contractID",								new PyInt( contractID() ) );
    into->SetField( "itemID",									new PyInt( item->itemID() ) );
    into->SetField( "quantity",									new PyInt( item->quantity() ) );
    into->SetField( "itemTypeID",								new PyInt( item->typeID() ) );
    into->SetField( "inCrate",									new PyBool( true ) );

    if( item->categoryID() == EVEDB::invCategories::Blueprint )
    {
        BlueprintRef bp = m_itemFactory.GetBlueprint( item->itemID() );
        into->SetField( "parentID",								new PyInt( bp->parentBlueprintTypeID() ) );
        into->SetField( "productivityLevel",					new PyInt( bp->productivityLevel() ) );
        into->SetField( "materialLevel",						new PyInt( bp->materialLevel() ) );
        into->SetField( "copy",									new PyInt( bp->copy() ) );
        into->SetField( "licensedProductionRunsRemaining",		new PyInt( bp->licensedProductionRunsRemaining() ) );
    }
    else
    {
        into->SetField( "parentID",								new PyInt( 0 ) );
        into->SetField( "productivityLevel",					new PyInt( 0 ) );
        into->SetField( "materialLevel",						new PyInt( 0 ) );
        into->SetField( "copy",									new PyInt( 0 ) );
        into->SetField( "licensedProductionRunsRemaining",		new PyInt( 0 ) );
    }

    if( item->HasAttribute( AttrDamage ) )
        into->SetField( "damage",								new PyInt( item->GetAttribute( AttrDamage ).get_int() ) );
    else
        into->SetField( "damage",								new PyInt( 0 ) );

    into->SetField( "flagID",									new PyInt( item->flag() ) );
}
开发者ID:Almamu,项目名称:evemu_apocrypha,代码行数:33,代码来源:Contract.cpp

示例3: DynamicSystemEntity

NPC::NPC(
    SystemManager *system,
    PyServiceMgr &services,
    InventoryItemRef self,
    uint32 corporationID,
    uint32 allianceID,
    const GPoint &position,
    SpawnEntry *spawner)
: DynamicSystemEntity(new DestinyManager(this, system), self),
  m_system(system),
  m_services(services),
  m_spawner(spawner),
//  m_itemID(self->itemID()),
//  m_typeID(self->typeID()),
//  m_ownerID(self->ownerID()),
  m_corporationID(corporationID),
  m_allianceID(allianceID),
  m_orbitingID(0)
{
    //NOTE: this is bad if we inherit NPC!
    m_AI = new NPCAIMgr(this);

	// SET ALL ATTRIBUTES MISSING FROM DATABASE BEFORE USING THEM FOR ANYTHING:
    // Create default dynamic attributes in the AttributeMap:
    self->SetAttribute(AttrIsOnline,            1);                                             // Is Online
    self->SetAttribute(AttrShieldCharge,        self->GetAttribute(AttrShieldCapacity));		// Shield Charge
    self->SetAttribute(AttrArmorDamage,         0.0);                                           // Armor Damage
    self->SetAttribute(AttrMass,                self->type().attributes.mass());				// Mass
    self->SetAttribute(AttrRadius,              self->type().attributes.radius());				// Radius
    self->SetAttribute(AttrVolume,              self->type().attributes.volume());				// Volume
    self->SetAttribute(AttrCapacity,            self->type().attributes.capacity());			// Capacity
    self->SetAttribute(AttrInertia,             1);                                             // Inertia
    self->SetAttribute(AttrCharge,              self->GetAttribute(AttrCapacitorCapacity));		// Set Capacitor Charge to the Capacitor Capacity
	self->SetAttribute(AttrShieldCharge,        self->GetAttribute(AttrShieldCapacity));		// Shield Charge

	// Agility - WARNING!  NO NPC Ships have Agility, so we're setting it to 1 for ALL NPC ships
	if( !(self->HasAttribute(AttrAgility)) )
        self->SetAttribute(AttrAgility, 1 );

	// Hull Damage
	if( !(self->HasAttribute(AttrDamage)) )
        self->SetAttribute(AttrDamage, 0 );
	// AttrHullEmDamageResonance
	if( !(self->HasAttribute(AttrHullEmDamageResonance)) )
		self->SetAttribute(AttrHullEmDamageResonance, 0.0);
	// AttrHullExplosiveDamageResonance
	if( !(self->HasAttribute(AttrHullExplosiveDamageResonance)) )
		self->SetAttribute(AttrHullExplosiveDamageResonance, 0.0);
	// AttrHullKineticDamageResonance
	if( !(self->HasAttribute(AttrHullKineticDamageResonance)) )
		self->SetAttribute(AttrHullKineticDamageResonance, 0.0);
	// AttrHullThermalDamageResonance
	if( !(self->HasAttribute(AttrHullThermalDamageResonance)) )
		self->SetAttribute(AttrHullThermalDamageResonance, 0.0);

	// AttrOrbitRange
	if( !(self->HasAttribute(AttrOrbitRange)) )
		self->SetAttribute(AttrOrbitRange, 5000);


	// Set internal and Destiny values FROM these Attributes, now that they are all setup:
    m_destiny->SetPosition(position, false);
	m_destiny->SetShipCapabilities(self);
	m_destiny->SetSpeedFraction(1.0);
	m_destiny->Halt();

	/* Gets the value from the NPC and put on our own vars */
    //m_shieldCharge = self->shieldCharge();
    m_shieldCharge = self->GetAttribute(AttrShieldCharge).get_float();
    m_armorDamage = 0.0;
    m_hullDamage = 0.0;
}
开发者ID:Reve,项目名称:evemu_retribution,代码行数:72,代码来源:NPC.cpp

示例4: Handle_GetContract


//.........这里部分代码省略.........
	itemHeader->AddColumn( "productivityLevel",					DBTYPE_I4 );
	itemHeader->AddColumn( "materialLevel",						DBTYPE_I4 );
	itemHeader->AddColumn( "copy",								DBTYPE_I4 );
	itemHeader->AddColumn( "licensedProductionRunsRemaining",	DBTYPE_I4 );
	itemHeader->AddColumn( "damage",							DBTYPE_R8 );
	itemHeader->AddColumn( "flagID",							DBTYPE_I2 );

	std::map<uint32, ContractGetItemsRef>::const_iterator cur, end;
	std::map<uint32, ContractGetItemsRef> items = contract->items();

	cur = items.begin();
	end = items.end();

	for(; cur != end; cur++ )
	{
		PyPackedRow* data = new PyPackedRow( itemHeader );

		InventoryItemRef item = m_manager->item_factory.GetItem( cur->second->m_itemID );
		data->SetField( "contractID",							new PyInt(	contract->contractID() ) );
		data->SetField( "itemID",								new PyInt(	item->itemID() ) );
		data->SetField( "quantity",								new PyInt(	cur->second->m_quantity ) );
		data->SetField( "itemTypeID",							new PyInt(	item->typeID() ) );
		data->SetField( "inCrate",								new PyBool(	true ) );

		if( item->categoryID() == EVEDB::invCategories::Blueprint )
		{
			BlueprintRef bp = m_manager->item_factory.GetBlueprint( item->itemID() );
			data->SetField( "parentID",							new PyInt( bp->parentBlueprintTypeID() ) );
			data->SetField( "productivityLevel",				new PyInt( bp->productivityLevel() ) );
			data->SetField( "materialLevel",					new PyInt( bp->materialLevel() ) );
			data->SetField( "copy",								new PyInt( bp->copy() ) );
			data->SetField( "licensedProductionRunsRemaining",	new PyInt( bp->licensedProductionRunsRemaining() ) );

			if( bp->HasAttribute( 3 ) )
				data->SetField( "damage",						new PyFloat( bp->GetAttribute( 3 ).get_float() ) );
			else
				data->SetField( "damage",						new PyFloat( 0.0 ) );

			data->SetField( "flagID",							new PyInt( bp->flag() ) );
		}
		else
		{
			data->SetField( "parentID",							new PyInt( 0 ) );
			data->SetField( "productivityLevel",				new PyInt( 0 ) );
			data->SetField( "materialLevel",					new PyInt( 0 ) );
			data->SetField( "copy",								new PyInt( 0 ) );
			data->SetField( "licensedProductionRunsRemaining",	new PyInt( 0 ) );

			if( item->HasAttribute( 3 ) )
				data->SetField( "damage",						new PyFloat( item->GetAttribute( 3 ).get_float() ) );
			else
				data->SetField( "damage",						new PyFloat( 0.0 ) );

			data->SetField( "flagID",							new PyInt( item->flag() ) );
		}

		itemList->AddItem( data );
	}

	std::map<uint32, ContractRequestItemRef>::const_iterator c, e;
	std::map<uint32, ContractRequestItemRef> requestItems = contract->requestItems();

	c = requestItems.begin();
	e = requestItems.end();

	for(; c != e; c++ )
开发者ID:LeoVasconcellos,项目名称:evemu_apocrypha,代码行数:67,代码来源:ContractMgrService.cpp


注:本文中的InventoryItemRef::HasAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。