本文整理汇总了C++中ShipRef类的典型用法代码示例。如果您正苦于以下问题:C++ ShipRef类的具体用法?C++ ShipRef怎么用?C++ ShipRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ShipRef类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _modifyShipAttributes
// implements a rudimentary but working stacking penalty. Currently only penalizes for stacking same item,
// but should penalize for modifying the same attribute, with some exceptions. These exceptions are why
// it has not been implemented fully, as more data is needed and this is just a proof of concept.
// No module code will have to be changed to implement the fully functional stacking penalty
void ModifyShipAttributesComponent::_modifyShipAttributes(ShipRef ship, uint32 targetAttrID, uint32 sourceAttrID, EVECalculationType type)
{
//first we must reset the attribute in order to properly recalculate the attribute
ship->ResetAttribute(targetAttrID, false);
//recalculate the attribute for the ship with the new modifier
ship->SetAttribute(targetAttrID, _calculateNewValue(targetAttrID, sourceAttrID, type, m_Ship->GetStackedItems(m_Mod->typeID(), m_Mod->GetModulePowerLevel())));
}
示例2: ShipRef
ShipRef ItemFactory::SpawnShip(ItemData &data) {
ShipRef s = Ship::Spawn(*this, data);
if( !s )
return ShipRef();
m_items.insert( std::make_pair( s->itemID(), s ) );
return s;
}
示例3: TimeToLock
uint32 TargetManager::TimeToLock(ShipRef ship, SystemEntity *target) const {
EvilNumber scanRes = ship->GetAttribute(AttrScanResolution);
EvilNumber sigRad(500);
if( target->Item().get() != NULL )
if( target->Item()->HasAttribute(AttrSignatureRadius) )
sigRad = target->Item()->GetAttribute(AttrSignatureRadius);
EvilNumber time = ( EvilNumber(40000) / ( scanRes ) ) /( EvilNumber::pow( e_log( sigRad + e_sqrt( sigRad * sigRad + 1) ), 2) );
return static_cast<uint32>(time.get_float() * 1000); // Timer uses ms instead of seconds
}
示例4: StartTargeting
bool TargetManager::StartTargeting(SystemEntity *who, ShipRef ship) { // needs another argument: "ShipRef ship" to access ship attributes
//first make sure they are not already in the list
std::map<SystemEntity *, TargetEntry *>::iterator res;
res = m_targets.find(who);
if(res != m_targets.end()) {
//what to do?
_log(TARGET__TRACE, "Told to start targeting %u, but we are already processing them. Ignoring request.", who->GetID());
return false;
}
//Check that they aren't targeting themselves
if(who == m_self)
return false;
// Calculate Time to Lock target:
uint32 lockTime = TimeToLock( ship, who );
// Check against max locked target count
uint32 maxLockedTargets = ship->GetAttribute(AttrMaxLockedTargets).get_int();
if( m_targets.size() >= maxLockedTargets )
return false;
// Check against max locked target range
double maxTargetLockRange = ship->GetAttribute(AttrMaxTargetRange).get_float();
GVector rangeToTarget( who->GetPosition(), m_self->GetPosition() );
if( rangeToTarget.length() > maxTargetLockRange )
return false;
TargetEntry *te = new TargetEntry(who);
te->state = TargetEntry::Locking;
te->timer.Start(lockTime);
m_targets[who] = te;
_log(TARGET__TRACE, "%u started targeting %u (%u ms lock time)", m_self->GetID(), who->GetID(), lockTime);
return true;
}
示例5: ValidateBoardShip
bool Ship::ValidateBoardShip(ShipRef ship, CharacterRef character)
{
SkillRef requiredSkill;
uint32 skillTypeID = 0;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill1).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill1Level).get_int()) )) )
return false;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill2).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill2Level).get_int() ))) )
return false;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill3).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill3Level).get_int() ))) )
return false;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill4).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill4Level).get_int() ))) )
return false;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill5).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill5Level).get_int() )) ))
return false;
if( (skillTypeID = static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill6).get_int())) != 0)
if( !(character->HasSkillTrainedToLevel( skillTypeID, static_cast<uint32>(ship->GetAttribute(AttrRequiredSkill6Level).get_int() )) ))
return false;
return true;
/*
//Primary Skill
if(ship->GetAttribute(AttrRequiredSkill1).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill1).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill1Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Secondary Skill
if(ship->GetAttribute(AttrRequiredSkill2).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill2).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill2Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Tertiary Skill
if(ship->GetAttribute(AttrRequiredSkill3).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill3).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill3Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quarternary Skill
if(ship->GetAttribute(AttrRequiredSkill4).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill4).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill4Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quinary Skill
if(ship->GetAttribute(AttrRequiredSkill5).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill5).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill5Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Senary Skill
if(ship->GetAttribute(AttrRequiredSkill6).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill6).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill6Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
return true;
*/
//.........这里部分代码省略.........
示例6: ShipRef
ShipRef Ship::Spawn(ItemFactory &factory, ItemData &data) {
uint32 shipID = Ship::_Spawn( factory, data );
if( shipID == 0 )
return ShipRef();
ShipRef sShipRef = Ship::Load( factory, shipID );
// Create default dynamic attributes in the AttributeMap:
sShipRef->SetAttribute(AttrIsOnline, 1); // Is Online
sShipRef->SetAttribute(AttrShieldCharge, sShipRef->GetAttribute(AttrShieldCapacity)); // Shield Charge
sShipRef->SetAttribute(AttrArmorDamage, 0.0); // Armor Damage
sShipRef->SetAttribute(AttrMass, sShipRef->type().attributes.mass()); // Mass
sShipRef->SetAttribute(AttrRadius, sShipRef->type().attributes.radius()); // Radius
sShipRef->SetAttribute(AttrVolume, sShipRef->type().attributes.volume()); // Volume
sShipRef->SetAttribute(AttrCapacity, sShipRef->type().attributes.capacity()); // Capacity
sShipRef->SetAttribute(AttrInertia, 1); // Inertia
sShipRef->SetAttribute(AttrCharge, sShipRef->GetAttribute(AttrCapacitorCapacity)); // Set Capacitor Charge to the Capacitor Capacity
// Check for existence of some attributes that may or may not have already been loaded and set them
// to default values:
// Maximum Range Capacitor
if( !(sShipRef->HasAttribute(AttrMaximumRangeCap)) )
sShipRef->SetAttribute(AttrMaximumRangeCap, 249999.0 );
// Maximum Armor Damage Resonance
if( !(sShipRef->HasAttribute(AttrArmorMaxDamageResonance)) )
sShipRef->SetAttribute(AttrArmorMaxDamageResonance, 1.0f);
// Maximum Shield Damage Resonance
if( !(sShipRef->HasAttribute(AttrShieldMaxDamageResonance)) )
sShipRef->SetAttribute(AttrShieldMaxDamageResonance, 1.0f);
// Warp Speed Multiplier
if( !(sShipRef.get()->HasAttribute(AttrWarpSpeedMultiplier)) )
sShipRef.get()->SetAttribute(AttrWarpSpeedMultiplier, 1.0f);
//Save Ship To Database.
sShipRef->SaveShip();
return sShipRef;
}
示例7: InventoryItemRef
//.........这里部分代码省略.........
cargoRef.get()->SetAttribute(AttrIsOnline, 1); // Is Online
cargoRef.get()->SetAttribute(AttrDamage, 0.0); // Structure Damage
//cargoRef.get()->SetAttribute(AttrShieldCharge, cargoRef.get()->GetAttribute(AttrShieldCapacity)); // Shield Charge
//cargoRef.get()->SetAttribute(AttrArmorDamage, 0.0); // Armor Damage
cargoRef.get()->SetAttribute(AttrMass, cargoRef.get()->type().attributes.mass()); // Mass
cargoRef.get()->SetAttribute(AttrRadius, cargoRef.get()->type().attributes.radius()); // Radius
cargoRef.get()->SetAttribute(AttrVolume, cargoRef.get()->type().attributes.volume()); // Volume
cargoRef.get()->SetAttribute(AttrCapacity, cargoRef.get()->type().attributes.capacity()); // Capacity
cargoRef.get()->SaveAttributes();
return cargoRef;
//uint32 itemID = InventoryItem::_Spawn( factory, data );
//if( itemID == 0 )
// return InventoryItemRef();
//return InventoryItem::Load( factory, itemID );
}
else
{
// Spawn new Celestial Object
uint32 itemID = CelestialObject::_Spawn( factory, data );
if( itemID == 0 )
return CelestialObjectRef();
CelestialObjectRef celestialRef = CelestialObject::Load( factory, itemID );
celestialRef.get()->SaveAttributes();
return celestialRef;
}
}
///////////////////////////////////////
// Ship:
///////////////////////////////////////
case EVEDB::invCategories::Ship: {
ShipRef shipRef = Ship::Spawn( factory, data );
shipRef.get()->SaveAttributes();
return shipRef;
}
///////////////////////////////////////
// Skill:
///////////////////////////////////////
case EVEDB::invCategories::Skill: {
return Skill::Spawn( factory, data );
}
///////////////////////////////////////
// Owner:
///////////////////////////////////////
case EVEDB::invCategories::Owner:
{
return Owner::Spawn( factory, data );
}
///////////////////////////////////////
// Module:
///////////////////////////////////////
case EVEDB::invCategories::Module:
{
// Spawn generic item:
uint32 itemID = InventoryItem::_Spawn( factory, data );
if( itemID == 0 )
return InventoryItemRef();
InventoryItemRef itemRef = InventoryItem::Load( factory, itemID );
示例8: ShipRef
ShipRef Ship::Spawn(ItemFactory &factory, ItemData &data) {
uint32 shipID = Ship::_Spawn( factory, data );
if( shipID == 0 )
return ShipRef();
ShipRef sShipRef = Ship::Load( factory, shipID );
// Create default dynamic attributes in the AttributeMap:
sShipRef->SetAttribute(AttrIsOnline, 1); // Is Online
sShipRef->SetAttribute(AttrShieldCharge, sShipRef->GetAttribute(AttrShieldCapacity)); // Shield Charge
sShipRef->SetAttribute(AttrArmorDamage, 0.0); // Armor Damage
sShipRef->SetAttribute(AttrMass, sShipRef->type().attributes.mass()); // Mass
sShipRef->SetAttribute(AttrRadius, sShipRef->type().attributes.radius()); // Radius
sShipRef->SetAttribute(AttrVolume, sShipRef->type().attributes.volume()); // Volume
sShipRef->SetAttribute(AttrCapacity, sShipRef->type().attributes.capacity()); // Capacity
sShipRef->SetAttribute(AttrInertia, 1); // Inertia
sShipRef->SetAttribute(AttrCharge, sShipRef->GetAttribute(AttrCapacitorCapacity)); // Set Capacitor Charge to the Capacitor Capacity
// Check for existence of some attributes that may or may not have already been loaded and set them
// to default values:
// Hull Damage
if( !(sShipRef->HasAttribute(AttrDamage)) )
sShipRef->SetAttribute(AttrDamage, 0 );
// Maximum Range Capacitor
if( !(sShipRef->HasAttribute(AttrMaximumRangeCap)) )
sShipRef->SetAttribute(AttrMaximumRangeCap, 249999.0 );
// Maximum Armor Damage Resonance
if( !(sShipRef->HasAttribute(AttrArmorMaxDamageResonance)) )
sShipRef->SetAttribute(AttrArmorMaxDamageResonance, 1.0f);
// Maximum Shield Damage Resonance
if( !(sShipRef->HasAttribute(AttrShieldMaxDamageResonance)) )
sShipRef->SetAttribute(AttrShieldMaxDamageResonance, 1.0f);
// Warp Speed Multiplier
if( !(sShipRef.get()->HasAttribute(AttrWarpSpeedMultiplier)) )
sShipRef.get()->SetAttribute(AttrWarpSpeedMultiplier, 1.0f);
// CPU Load of the ship (new ships have zero load with no modules fitted, of course):
if( !(sShipRef.get()->HasAttribute(AttrCpuLoad)) )
sShipRef.get()->SetAttribute(AttrCpuLoad, 0);
// Power Load of the ship (new ships have zero load with no modules fitted, of course):
if( !(sShipRef.get()->HasAttribute(AttrPowerLoad)) )
sShipRef.get()->SetAttribute(AttrPowerLoad, 0);
// Warp Scramble Status of the ship (most ships have zero warp scramble status, but some already have it defined):
if( !(sShipRef.get()->HasAttribute(AttrWarpScrambleStatus)) )
sShipRef.get()->SetAttribute(AttrWarpScrambleStatus, 0.0);
// AttrHullEmDamageResonance
if( !(sShipRef.get()->HasAttribute(AttrHullEmDamageResonance)) )
sShipRef.get()->SetAttribute(AttrHullEmDamageResonance, 0.0);
// AttrHullExplosiveDamageResonance
if( !(sShipRef.get()->HasAttribute(AttrHullExplosiveDamageResonance)) )
sShipRef.get()->SetAttribute(AttrHullExplosiveDamageResonance, 0.0);
// AttrHullKineticDamageResonance
if( !(sShipRef.get()->HasAttribute(AttrHullKineticDamageResonance)) )
sShipRef.get()->SetAttribute(AttrHullKineticDamageResonance, 0.0);
// AttrHullThermalDamageResonance
if( !(sShipRef.get()->HasAttribute(AttrHullThermalDamageResonance)) )
sShipRef.get()->SetAttribute(AttrHullThermalDamageResonance, 0.0);
// AttrTurretSlotsLeft
if( !(sShipRef.get()->HasAttribute(AttrTurretSlotsLeft)) )
sShipRef.get()->SetAttribute(AttrTurretSlotsLeft, 0);
// AttrLauncherSlotsLeft
if( !(sShipRef.get()->HasAttribute(AttrLauncherSlotsLeft)) )
sShipRef.get()->SetAttribute(AttrLauncherSlotsLeft, 0);
return sShipRef;
}
示例9: ShipRef
ShipRef Ship::Spawn(ItemData &data) {
uint32 shipID = Ship::_Spawn( data );
if( shipID == 0 )
return ShipRef();
ShipRef sShipRef = Ship::Load( shipID );
// Create default dynamic attributes in the AttributeMap:
sShipRef->setAttribute(AttrIsOnline, 1, true); // Is Online
sShipRef->setAttribute(AttrShieldCharge, sShipRef->getAttribute(AttrShieldCapacity), true); // Shield Charge
sShipRef->setAttribute(AttrArmorDamage, 0.0, true); // Armor Damage
sShipRef->setAttribute(AttrMass, sShipRef->type()->mass, true); // Mass
sShipRef->setAttribute(AttrRadius, sShipRef->type()->radius, true); // Radius
sShipRef->setAttribute(AttrVolume, sShipRef->type()->volume, true); // Volume
sShipRef->setAttribute(AttrCapacity, sShipRef->type()->capacity, true); // Capacity
sShipRef->setAttribute(AttrInertia, 1, true); // Inertia
sShipRef->setAttribute(AttrCharge, sShipRef->getAttribute(AttrCapacitorCapacity), true); // Set Capacitor Charge to the Capacitor Capacity
// Check for existence of some attributes that may or may not have already been loaded and set them
// to default values:
// Hull Damage
if (!(sShipRef->hasAttribute(AttrDamage)))
sShipRef->setAttribute(AttrDamage, 0, true);
// Theoretical Maximum Targeting Range
if (!(sShipRef->hasAttribute(AttrMaximumRangeCap)))
sShipRef->setAttribute(AttrMaximumRangeCap, ((double) BUBBLE_RADIUS_METERS), true);
// Maximum Armor Damage Resonance
if (!(sShipRef->hasAttribute(AttrArmorMaxDamageResonance)))
sShipRef->setAttribute(AttrArmorMaxDamageResonance, 1.0f, true);
// Maximum Shield Damage Resonance
if (!(sShipRef->hasAttribute(AttrShieldMaxDamageResonance)))
sShipRef->setAttribute(AttrShieldMaxDamageResonance, 1.0f, true);
// Warp Speed Multiplier
if (!(sShipRef.get()->hasAttribute(AttrWarpSpeedMultiplier)))
sShipRef.get()->setAttribute(AttrWarpSpeedMultiplier, 1.0f, true);
// CPU Load of the ship (new ships have zero load with no modules fitted, of course):
if (!(sShipRef.get()->hasAttribute(AttrCpuLoad)))
sShipRef.get()->setAttribute(AttrCpuLoad, 0, true);
// Power Load of the ship (new ships have zero load with no modules fitted, of course):
if (!(sShipRef.get()->hasAttribute(AttrPowerLoad)))
sShipRef.get()->setAttribute(AttrPowerLoad, 0, true);
// Warp Scramble Status of the ship (most ships have zero warp scramble status, but some already have it defined):
if (!(sShipRef.get()->hasAttribute(AttrWarpScrambleStatus)))
sShipRef.get()->setAttribute(AttrWarpScrambleStatus, 0.0, true);
// Shield Resonance
// AttrShieldEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldEmDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldEmDamageResonance, 1.0, true);
// AttrShieldExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldExplosiveDamageResonance, 1.0, true);
// AttrShieldKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldKineticDamageResonance, 1.0, true);
// AttrShieldThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrShieldThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrShieldThermalDamageResonance, 1.0, true);
// Armor Resonance
// AttrArmorEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorEmDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorEmDamageResonance, 1.0, true);
// AttrArmorExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorExplosiveDamageResonance, 1.0, true);
// AttrArmorKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorKineticDamageResonance, 1.0, true);
// AttrArmorThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrArmorThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrArmorThermalDamageResonance, 1.0, true);
// Hull Resonance
// AttrHullEmDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullEmDamageResonance)))
sShipRef.get()->setAttribute(AttrHullEmDamageResonance, 1.0, true);
// AttrHullExplosiveDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullExplosiveDamageResonance)))
sShipRef.get()->setAttribute(AttrHullExplosiveDamageResonance, 1.0, true);
// AttrHullKineticDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullKineticDamageResonance)))
sShipRef.get()->setAttribute(AttrHullKineticDamageResonance, 1.0, true);
// AttrHullThermalDamageResonance
if (!(sShipRef.get()->hasAttribute(AttrHullThermalDamageResonance)))
sShipRef.get()->setAttribute(AttrHullThermalDamageResonance, 1.0, true);
// AttrTurretSlotsLeft
if (!(sShipRef.get()->hasAttribute(AttrTurretSlotsLeft)))
sShipRef.get()->setAttribute(AttrTurretSlotsLeft, 0, true);
// AttrLauncherSlotsLeft
if (!(sShipRef.get()->hasAttribute(AttrLauncherSlotsLeft)))
sShipRef.get()->setAttribute(AttrLauncherSlotsLeft, 0, true);
return sShipRef;
}
示例10: ValidateBoardShip
bool Ship::ValidateBoardShip(ShipRef ship, CharacterRef character)
{
SkillRef requiredSkill;
//Primary Skill
if(ship->GetAttribute(AttrRequiredSkill1).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill1).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill1Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Secondary Skill
if(ship->GetAttribute(AttrRequiredSkill2).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill2).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill2Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Tertiary Skill
if(ship->GetAttribute(AttrRequiredSkill3).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill3).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill3Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quarternary Skill
if(ship->GetAttribute(AttrRequiredSkill4).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill4).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill4Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Quinary Skill
if(ship->GetAttribute(AttrRequiredSkill5).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill5).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill5Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
//Senary Skill
if(ship->GetAttribute(AttrRequiredSkill6).get_int() != 0)
{
requiredSkill = character->GetSkill( ship->GetAttribute(AttrRequiredSkill6).get_int() );
if( !requiredSkill )
return false;
if( ship->GetAttribute(AttrRequiredSkill6Level) > requiredSkill->GetAttribute(AttrSkillLevel) )
return false;
}
return true;
}
示例11: ShipRef
ShipRef Ship::Spawn(ItemFactory &factory,
// InventoryItem stuff:
ItemData &data
) {
uint32 shipID = Ship::_Spawn( factory, data );
if( shipID == 0 )
return ShipRef();
ShipRef sShipRef = Ship::Load( factory, shipID );
// Create default dynamic attributes in the AttributeMap:
sShipRef.get()->SetAttribute(AttrIsOnline, 1); // Is Online
sShipRef.get()->SetAttribute(AttrShieldCharge, sShipRef.get()->GetAttribute(AttrShieldCapacity)); // Shield Charge
sShipRef.get()->SetAttribute(AttrArmorDamage, 0.0); // Armor Damage
sShipRef.get()->SetAttribute(AttrMass, sShipRef.get()->type().attributes.mass()); // Mass
sShipRef.get()->SetAttribute(AttrRadius, sShipRef.get()->type().attributes.radius()); // Radius
sShipRef.get()->SetAttribute(AttrVolume, sShipRef.get()->type().attributes.volume()); // Volume
sShipRef.get()->SetAttribute(AttrCapacity, sShipRef.get()->type().attributes.capacity()); // Capacity
sShipRef.get()->SetAttribute(AttrInertia, 1); // Inertia
return sShipRef;
}
示例12: GetName
void Client::Killed(Damage &fatal_blow) {
DynamicSystemEntity::Killed(fatal_blow);
if(GetShip()->typeID() == itemTypeCapsule) {
//we have been pod killed... off we go.
//TODO: destroy all implants
//TODO: send them back to their clone.
m_system->RemoveClient(this);
} else {
//our ship has been destroyed. Off to our capsule.
//We are currently not keeping our real capsule around in the DB, so we need to make a new one.
//m_system->bubbles.Remove(this, true);
std::string capsule_name = GetName();
capsule_name += "'s Capsule";
ItemData idata(
itemTypeCapsule,
GetCharacterID(),
GetLocationID(),
flagAutoFit,
capsule_name.c_str()
);
ShipRef capsule = m_services.item_factory.SpawnShip(idata);
if( !capsule ) {
codelog(CLIENT__ERROR, "Failed to create capsule for character '%s'", GetName());
//what to do?
return;
}
ShipRef dead_ship = GetShip(); //grab a ship ref to ensure that nobody else nukes it first.
//ok, nothing can fail now, we need have our capsule, make the transition.
//put the capsule where the ship was
capsule->Relocate(dead_ship->position());
//move it out of the way
dead_ship->Move(this->GetLocationID(), (EVEItemFlags)flagNone, true );
//this updates m_self and manages destiny updates as needed.
BoardShip((ShipRef)capsule);
mSession.SetInt("shipid", capsule->itemID() );
//This sends the RemoveBall for the old ship.
//kill off the old ship.
//TODO: figure out anybody else which may be referencing this ship...
dead_ship->Delete(); //remove from the DB.
}
}