本文整理汇总了C++中InventoryItemRef类的典型用法代码示例。如果您正苦于以下问题:C++ InventoryItemRef类的具体用法?C++ InventoryItemRef怎么用?C++ InventoryItemRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InventoryItemRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Command_dogma
PyResult Command_dogma( Client* who, CommandDB* db, PyServiceMgr* services, const Seperator& args )
{
//"dogma" "140019878" "agility" "=" "0.2"
if( !(args.argCount() == 5) ) {
throw PyException( MakeCustomError("Correct Usage: /dogma [itemID] [attributeName] = [value]") );
}
if( !args.isNumber( 1 ) ){
throw PyException( MakeCustomError("Invalid itemID. \n Correct Usage: /dogma [itemID] [attributeName] = [value]") );
}
uint32 itemID = atoi( args.arg( 1 ).c_str() );
if( args.isNumber( 2 ) ) {
throw PyException( MakeCustomError("Invalid attributeName. \n Correct Usage: /dogma [itemID] [attributeName] = [value]") );
}
const char *attributeName = args.arg( 2 ).c_str();
if( !args.isNumber( 4 ) ){
throw PyException( MakeCustomError("Invalid attribute value. \n Correct Usage: /dogma [itemID] [attributeName] = [value]") );
}
double attributeValue = atof( args.arg( 4 ).c_str() );
//get item
InventoryItemRef item = services->item_factory.GetItem( itemID );
//get attributeID
uint32 attributeID = db->GetAttributeID( attributeName );
sLog.Warning( "GMCommands: Command_dogma()", "This command will modify attribute and send change to client, but change does not take effect in client for some reason." );
item->SetAttribute( attributeID, attributeValue );
return NULL;
}
示例2: Command_setattr
PyResult Command_setattr( Client* who, CommandDB* db, PyServiceMgr* services, const Seperator& args )
{
if( args.argCount() < 4 ) {
throw PyException( MakeCustomError("Correct Usage: /setattr [itemID] [attributeID] [value]") );
}
if( !args.isNumber( 1 ) )
throw PyException( MakeCustomError( "1st argument must be itemID (got %s).", args.arg( 1 ).c_str() ) );
const uint32 itemID = atoi( args.arg( 1 ).c_str() );
if( !args.isNumber( 2 ) )
throw PyException( MakeCustomError( "2nd argument must be attributeID (got %s).", args.arg( 2 ).c_str() ) );
const ItemAttributeMgr::Attr attribute = (ItemAttributeMgr::Attr)atoi( args.arg( 2 ).c_str() );
if( !args.isNumber( 3 ) )
throw PyException( MakeCustomError( "3rd argument must be value (got %s).", args.arg( 3 ).c_str() ) );
const double value = atof( args.arg( 3 ).c_str() );
InventoryItemRef item = services->item_factory.GetItem( itemID );
if( !item )
throw PyException( MakeCustomError( "Failed to load item %u.", itemID ) );
//item->attributes.SetReal( attribute, value );
sLog.Warning( "GMCommands: Command_dogma()", "This command will modify attribute and send change to client, but change does not take effect in client for some reason." );
item->SetAttribute(attribute, (float)value);
return new PyString( "Operation successful." );
}
示例3: RemoveRig
void Ship::RemoveRig( InventoryItemRef item, uint32 inventoryID )
{
m_ModuleManager->UnfitModule(item->itemID());
//delete the item
item->Delete();
}
示例4: StackAll
void Inventory::StackAll(EVEItemFlags locFlag, uint32 forOwner)
{
std::map<uint32, InventoryItemRef> types;
std::map<uint32, InventoryItemRef>::iterator cur, end;
cur = mContents.begin();
end = mContents.end();
for(; cur != end; )
{
// Iterator becomes invalid when the item
// is moved out; we have to increment before
// calling Merge().
InventoryItemRef i = cur->second;
cur++;
if( !i->singleton() && ( forOwner == 0 || forOwner == i->ownerID() ) )
{
std::map<uint32, InventoryItemRef>::iterator res = types.find( i->typeID() );
if( res == types.end() )
types.insert( std::make_pair( i->typeID(), i ) );
else
res->second->Merge( i );
}
}
}
示例5: AddItem
void Character::AddItem(InventoryItemRef item)
{
Inventory::AddItem( item );
if( item->flag() == flagSkill
|| item->flag() == flagSkillInTraining )
{
// Skill has been added ...
if( item->categoryID() != EVEDB::invCategories::Skill ) {
_log( ITEM__WARNING, "%s (%u): %s has been added with flag %d.", itemName().c_str(), itemID(), item->category().name().c_str(), (int)item->flag() );
} else
{
SkillRef skill = SkillRef::StaticCast( item );
if( !skill->singleton() )
{
_log( ITEM__TRACE, "%s (%u): Injecting %s.", itemName().c_str(), itemID(), item->itemName().c_str() );
// Make it singleton and set initial skill values.
skill->ChangeSingleton( true );
skill->SetAttribute(AttrSkillLevel, 0);
skill->SetAttribute(AttrSkillPoints, 0);
if( skill->flag() != flagSkillInTraining )
skill->SetAttribute(AttrExpiryTime, 0);
}
}
}
}
示例6: UnfitModule
void ModuleManager::UnfitModule(uint32 itemID)
{
GenericModule * mod = m_Modules->GetModule(itemID);
if( mod != NULL )
{
if( mod->isLoaded() )
{
InventoryItemRef loadedChargeRef = mod->getLoadedChargeRef();
if( IsStation(m_Ship->locationID()) )
loadedChargeRef->Move(m_Ship->locationID(), flagHangar); // used to be (m_pOperator->GetLocationID(), flag)
else
{
m_Ship->ValidateAddItem(flagCargoHold,loadedChargeRef);
//if( m_Ship->ValidateAddItem(flagCargoHold,loadedChargeRef) )
//{
loadedChargeRef->Move(m_Ship->itemID(), flagCargoHold); // used to be (m_pOperator->GetLocationID(), flag)
mod->unload();
//}
//else
// throw PyException( MakeCustomError( "Not enough cargo space!") );
}
}
mod->offline();
m_Modules->RemoveModule(itemID);
}
}
示例7: ValidateItemSpecifics
bool Ship::ValidateItemSpecifics(InventoryItemRef equip) const
{
//declaring explicitly as int...not sure if this is needed or not
int groupID = m_pOperator->GetShip()->groupID();
int typeID = m_pOperator->GetShip()->typeID();
EvilNumber canFitShipGroup1 = equip->getAttribute(AttrCanFitShipGroup1);
EvilNumber canFitShipGroup2 = equip->getAttribute(AttrCanFitShipGroup2);
EvilNumber canFitShipGroup3 = equip->getAttribute(AttrCanFitShipGroup3);
EvilNumber canFitShipGroup4 = equip->getAttribute(AttrCanFitShipGroup4);
EvilNumber canFitShipType1 = equip->getAttribute(AttrCanFitShipType1);
EvilNumber canFitShipType2 = equip->getAttribute(AttrCanFitShipType2);
EvilNumber canFitShipType3 = equip->getAttribute(AttrCanFitShipType3);
EvilNumber canFitShipType4 = equip->getAttribute(AttrCanFitShipType4);
if( canFitShipGroup1 != 0 || canFitShipGroup2 != 0 || canFitShipGroup3 != 0 || canFitShipGroup4 != 0 )
if( canFitShipGroup1 != groupID && canFitShipGroup2 != groupID && canFitShipGroup3 != groupID && canFitShipGroup4 != groupID )
return false;
/*
if( canFitShipGroup1 != 0 )
if( canFitShipGroup1 != groupID )
return false;
if( canFitShipGroup2 != 0 )
if( canFitShipGroup2 != groupID )
return false;
if( canFitShipGroup3 != 0 )
if( canFitShipGroup3 != groupID )
return false;
if( canFitShipGroup4 != 0 )
if( canFitShipGroup4 != groupID )
return false;
*/
if( canFitShipType1 != 0 || canFitShipType2 != 0 || canFitShipType3 != 0 || canFitShipType4 != 0 )
if( canFitShipType1 != typeID && canFitShipType2 != typeID && canFitShipType3 != typeID && canFitShipType4 != typeID )
return false;
/*
if( canFitShipType1 != 0 )
if( canFitShipType1 != typeID )
return false;
if( canFitShipType2 != 0 )
if( canFitShipType2 != typeID )
return false;
if( canFitShipType3 != 0 )
if( canFitShipType3 != typeID )
return false;
if( canFitShipType4 != 0 )
if( canFitShipType4 != typeID )
return false;
*/
return true;
}
示例8: InventoryItemRef
InventoryItemRef ItemFactory::SpawnItem(ItemData &data) {
InventoryItemRef i = InventoryItem::Spawn(*this, data);
if( !i )
return InventoryItemRef();
// spawn successful; store the ref
m_items.insert( std::make_pair( i->itemID(), i ) );
return i;
}
示例9: InventoryItemRef
InventoryItemRef InventoryItem::LoadEntity(ItemFactory &factory, uint32 itemID, const ItemData &data)
{
const ItemType *type = factory.GetType( data.typeID );
InventoryItemRef itemRef = InventoryItemRef( new InventoryItem(factory, itemID, *type, data) );
itemRef->_Load();
return itemRef;
}
示例10: RemoveRig
void Ship::RemoveRig( InventoryItemRef item, uint32 inventoryID )
{
m_ModuleManager->UninstallRig(item->itemID());
//move the item to the void or w/e
m_pOperator->MoveItem(item->itemID(), inventoryID, flagAutoFit);
//delete the item
item->Delete();
}
示例11: HasImplant
bool Character::HasImplant( uint32 implantTypeID )
{
uint32 i = 0;
for( i = 0; i < m_implants.size(); i++ )
{
InventoryItemRef item = m_factory.GetItem( m_implants.at( i ).itemID );
if( item->typeID() == implantTypeID ) return true;
}
return false;
}
示例12: HasBooster
bool Character::HasBooster( uint32 boosterTypeID )
{
uint32 i = 0;
for( i = 0; i < m_boosters.size(); i++ )
{
InventoryItemRef item = m_factory.GetItem( m_boosters.at( i ).itemID );
if( item->typeID() == boosterTypeID ) return true;
}
return false;
}
示例13: InstallRig
bool ModuleManager::InstallRig(InventoryItemRef item, EVEItemFlags flag)
{
if(item->groupID() >= 773 && item->groupID() <= 786 && item->groupID() != 783)
{
_fitModule(item,flag);
return true;
}
else
SysLog::Debug("ModuleManager","%s tried to fit item %u, which is not a rig", m_Ship->GetOperator()->GetName(), item->itemID());
return false;
}
示例14: AddItem
void Ship::AddItem(InventoryItemRef item)
{
InventoryEx::AddItem( item );
if( item->flag() >= flagSlotFirst &&
item->flag() <= flagSlotLast &&
item->categoryID() != EVEDB::invCategories::Charge)
{
// make singleton
item->ChangeSingleton( true );
}
}
示例15: SwapSubSystem
bool ModuleManager::SwapSubSystem(InventoryItemRef item, EVEItemFlags flag)
{
if(item->groupID() >= 954 && item->groupID() <= 958)
{
_fitModule(item,flag);
return true;
}
else
SysLog::Debug("ModuleManager","%s tried to fit item %u, which is not a subsystem", m_Ship->GetOperator()->GetName(), item->itemID());
return false;
}