本文整理汇总了C++中PyList::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PyList::AddItem方法的具体用法?C++ PyList::AddItem怎么用?C++ PyList::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyList
的用法示例。
在下文中一共展示了PyList::AddItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
void ItemAttributeMgr::Clear(Attr attr) {
PyRep *oldValue = NULL;
if(GetNotify() == true && !IsRechargable(attr)) {
// get old value
oldValue = PyGet(attr);
}
// clear the attribute
EVEAdvancedAttributeMgr::Clear(attr);
// delete the attribute from DB (no matter if it really is there)
if(GetSave() == true) {
m_factory.db().EraseAttribute(m_item.itemID(), attr);
}
if(GetNotify() == true) {
std::map<Attr, TauCap>::const_iterator i = m_tauCap.find(attr);
if(i != m_tauCap.end()) {
// build the special list for rechargables
PyList *l = new PyList;
l->AddItem( PyGet( attr ) );
l->AddItemLong( Win32TimeNow() );
l->AddItem( _PyGet( GetReal( i->second.tau ) / 5.0 ) );
l->AddItem( PyGet( i->second.cap ) );
oldValue = l;
}
// send change
_SendAttributeChange(attr, oldValue, new PyFloat(GetReal(attr)));
}
}
示例2: SetIntEx
void ItemAttributeMgr::SetIntEx(Attr attr, const int_t &v, bool persist) {
PyRep *oldValue = NULL;
if(GetNotify() == true && !IsRechargable(attr)) {
// get old value
oldValue = PyGet(attr);
}
// set the attribute value
EVEAdvancedAttributeMgr::SetInt(attr, v);
// check if we shall save to DB
if(GetSave() == true && (persist || IsPersistent(attr))) {
// save to DB
m_factory.db().UpdateAttribute_int(m_item.itemID(), attr, v);
}
if(GetNotify() == true) {
std::map<Attr, TauCap>::const_iterator i = m_tauCap.find(attr);
if(i != m_tauCap.end()) {
// build the special list for rechargables
PyList *l = new PyList;
l->AddItemInt( v );
l->AddItemLong( Win32TimeNow() );
l->AddItem( _PyGet( GetReal( i->second.tau ) / 5.0 ) );
l->AddItem( PyGet( i->second.cap ) );
oldValue = l;
}
// send change
_SendAttributeChange(attr, oldValue, new PyFloat(v));
}
}
示例3: GetItemRow
PyPackedRow* InventoryItem::GetItemRow() const
{
PyList *keywords = new PyList();
keywords->AddItem(new_tuple(new PyString("stacksize"), new PyToken("util.StackSize")));
keywords->AddItem(new_tuple(new PyString("singleton"), new PyToken("util.Singleton")));
DBRowDescriptor* header = new DBRowDescriptor(keywords);
header->AddColumn( "itemID", DBTYPE_I8 );
header->AddColumn( "typeID", DBTYPE_I4 );
header->AddColumn( "ownerID", DBTYPE_I4 );
header->AddColumn( "locationID", DBTYPE_I8 );
header->AddColumn( "flagID", DBTYPE_I2 );
header->AddColumn( "quantity", DBTYPE_I4 );
header->AddColumn( "groupID", DBTYPE_I2 );
header->AddColumn( "categoryID", DBTYPE_I4 );
header->AddColumn( "customInfo", DBTYPE_STR );
//header->AddColumn( "singleton", DBTYPE_BOOL );
//header->AddColumn( "stacksize" , DBTYPE_I4 );
PyPackedRow* row = new PyPackedRow( header );
GetItemRow( row );
return row;
}
示例4: PyTuple
PyTuple *Character::GetSkillQueue() {
// return skills from skill queue
PyList *list = new PyList;
SkillQueue::iterator cur, end;
cur = m_skillQueue.begin();
end = m_skillQueue.end();
for(; cur != end; cur++)
{
SkillQueue_Element el;
el.typeID = cur->typeID;
el.level = cur->level;
list->AddItem( el.Encode() );
}
// now encapsulate it in a tuple with the free points
PyTuple *tuple = new PyTuple(2);
tuple->SetItem(0, list);
// sending 0, as done on retail, doesn't fuck up calculation for some reason
// so we can take the same shortcut here
tuple->SetItem(1, new PyInt(0));
return tuple;
}
示例5: GetItemsList
PyList* Contract::GetItemsList() const
{
std::map<uint32, ContractGetItemsRef>::const_iterator cur, end;
std::map<uint32, ContractGetItemsRef> item = items();
PyList* res = new PyList;
DBRowDescriptor* header = new DBRowDescriptor;
header->AddColumn( "contractID", DBTYPE_I4 );
header->AddColumn( "itemID", DBTYPE_I4 );
header->AddColumn( "quantity", DBTYPE_I4 );
header->AddColumn( "itemTypeID", DBTYPE_I4 );
header->AddColumn( "inCrate", DBTYPE_BOOL );
header->AddColumn( "parentID", DBTYPE_I4 );
header->AddColumn( "productivityLevel", DBTYPE_I4 );
header->AddColumn( "materialLevel", DBTYPE_I4 );
header->AddColumn( "copy", DBTYPE_I4 );
header->AddColumn( "licensedProductionRunsRemaining", DBTYPE_I4 );
header->AddColumn( "damage", DBTYPE_R8 );
header->AddColumn( "flagID", DBTYPE_I2 );
cur = item.begin();
end = item.end();
for(; cur != end; *cur++ )
{
InventoryItemRef itemInfo = m_itemFactory.GetItem( cur->second->m_itemID );
PyPackedRow* into = new PyPackedRow( header );
GetItemRow( itemInfo, into );
res->AddItem( into );
}
std::map<uint32, ContractRequestItemRef>::const_iterator c, e;
std::map<uint32, ContractRequestItemRef> requestItem = requestItems();
c = requestItem.begin();
e = requestItem.end();
for(; cur != end; *cur++ )
{
PyPackedRow* into = new PyPackedRow( header );
GetRequestItemRow( c->second, into );
res->AddItem( into );
}
return res;
}
示例6: StopCycle
void Webifier::StopCycle(bool abort)
{
double timeLeft = m_AMPC->GetRemainingCycleTimeMS();
timeLeft /= 100;
// Create Special Effect:
m_Ship->GetPilot()->GetShipSE()->DestinyMgr()->SendSpecialEffect
(
m_Ship,
m_Item->itemID(),
m_Item->typeID(),
m_targetID,
0,
"effect.decreaseTargetSpeed",
0,
0,
0,
timeLeft,
0
);
// Create Destiny Updates:
GodmaOther go;
go.shipID = m_Ship->itemID();
go.slotID = m_Item->flag();
go.chargeTypeID = 0;
GodmaEnvironment ge;
ge.selfID = m_Item->itemID();
ge.charID = m_Ship->ownerID();
ge.shipID = go.shipID;
ge.targetID = m_targetID;
ge.other = go.Encode();
ge.area = new PyList;
ge.effectID = effectDecreaseTargetSpeed;
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = ge.selfID;
shipEff.effectID = ge.effectID;
shipEff.timeNow = Win32TimeNow();
shipEff.start = 0;
shipEff.active = 0;
shipEff.environment = ge.Encode();
shipEff.startTime = (shipEff.timeNow - (timeLeft * Win32Time_Second));
shipEff.duration = timeLeft;
shipEff.repeat = 0;
shipEff.error = new PyNone;
PyList* events = new PyList;
events->AddItem(shipEff.Encode());
Notify_OnMultiEvent multi;
multi.events = events;
PyTuple* tmp2 = multi.Encode();
m_Ship->GetPilot()->SendNotification("OnMultiEvent", "clientID", &tmp2);
}
示例7: Deactivate
void EnergyTurret::Deactivate()
{
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = m_Item->itemID();
shipEff.effectID = 10;
shipEff.when = Win32TimeNow();
shipEff.start = 0;
shipEff.active = 0;
PyList* env = new PyList;
env->AddItem(new PyInt(shipEff.itemID));
env->AddItem(new PyInt(m_Ship->ownerID()));
env->AddItem(new PyInt(m_Ship->itemID()));
env->AddItem(new PyInt(targetID));
env->AddItem(new PyNone);
env->AddItem(new PyNone);
env->AddItem(new PyInt(10));
shipEff.environment = env;
shipEff.startTime = shipEff.when;
shipEff.duration = 1584;
shipEff.repeat = new PyInt(0);
shipEff.randomSeed = new PyNone;
shipEff.error = new PyNone;
PyList* events = new PyList;
events->AddItem(shipEff.Encode());
Notify_OnMultiEvent multi;
multi.events = events;
PyTuple* tmp = multi.Encode();
m_Ship->GetOperator()->SendDogmaNotification("OnMultiEvent", "clientID", &tmp);
}
示例8: StopCycle
void MissileLauncher::StopCycle(bool abort)
{
// Do one last cycle:
DoCycle();
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = m_Item->itemID();
shipEff.effectID = effectMissileLaunching;
shipEff.when = Win32TimeNow();
shipEff.start = 0;
shipEff.active = 0;
PyList* env = new PyList;
env->AddItem(new PyInt(shipEff.itemID));
env->AddItem(new PyInt(m_Ship->ownerID()));
env->AddItem(new PyInt(m_Ship->itemID()));
env->AddItem(new PyInt(m_targetID));
env->AddItem(new PyNone);
env->AddItem(new PyNone);
env->AddItem(new PyInt(shipEff.effectID));
shipEff.environment = env;
shipEff.startTime = shipEff.when;
shipEff.duration = 1.0; //m_ActiveModuleProc->GetRemainingCycleTimeMS(); // At least, I'm assuming this is the remaining time left in the cycle
shipEff.repeat = new PyInt(0);
shipEff.randomSeed = new PyNone;
shipEff.error = new PyNone;
PyList* events = new PyList;
events->AddItem(shipEff.Encode());
Notify_OnMultiEvent multi;
multi.events = events;
PyTuple* tmp = multi.Encode();
m_Ship->GetOperator()->SendDogmaNotification("OnMultiEvent", "clientID", &tmp);
// Create Special Effect:
m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
(
m_Ship,
m_Item->itemID(),
m_Item->typeID(),
m_targetID,
m_chargeRef->itemID(),
"effects.MissileDeployment",
1,
0,
0,
1.0,
0
);
m_ActiveModuleProc->DeactivateCycle();
}
示例9: _ShowCycle
void HybridTurret::_ShowCycle()
{
//m_Item->SetActive(true, effectProjectileFired, m_Item->GetAttribute(AttrSpeed).get_float(), true);
// Create Destiny Updates:
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = m_Item->itemID();
shipEff.effectID = effectProjectileFired; // From EVEEffectID::
shipEff.when = Win32TimeNow();
shipEff.start = 1;
shipEff.active = 1;
PyList* env = new PyList;
env->AddItem(new PyInt(shipEff.itemID));
env->AddItem(new PyInt(m_Ship->ownerID()));
env->AddItem(new PyInt(m_Ship->itemID()));
env->AddItem(new PyInt(m_targetID));
env->AddItem(new PyNone);
env->AddItem(new PyNone);
env->AddItem(new PyInt(shipEff.effectID));
shipEff.environment = env;
shipEff.startTime = shipEff.when;
shipEff.duration = m_Item->GetAttribute(AttrSpeed).get_float();
shipEff.repeat = new PyInt(1000);
shipEff.randomSeed = new PyNone;
shipEff.error = new PyNone;
PyTuple* tmp = new PyTuple(3);
//tmp->SetItem(1, dmgMsg.Encode());
tmp->SetItem(2, shipEff.Encode());
std::vector<PyTuple*> events;
//events.push_back(dmgMsg.Encode());
events.push_back(shipEff.Encode());
std::vector<PyTuple*> updates;
//updates.push_back(dmgChange.Encode());
m_Ship->GetOperator()->GetDestiny()->SendDestinyUpdate(updates, events, false);
// Create Special Effect:
m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
(
m_Ship,
m_Item->itemID(),
m_Item->typeID(),
m_targetID,
m_chargeRef->typeID(),
"effects.HybridFired",
1,
1,
1,
m_Item->GetAttribute(AttrSpeed).get_float(),
1000
);
}
示例10:
PyList *Character::GetSkillQueue() {
// return skills from skill queue
PyList *list = new PyList;
SkillQueue::iterator cur, end;
cur = m_skillQueue.begin();
end = m_skillQueue.end();
for(; cur != end; cur++)
{
SkillQueue_Element el;
el.typeID = cur->typeID;
el.level = cur->level;
list->AddItem( el.Encode() );
}
return list;
}
示例11: StopCycle
void ShieldHardener::StopCycle(bool abort)
{
// Create Destiny Updates:
GodmaOther go;
go.shipID = m_Ship->itemID();
go.slotID = m_Item->flag();
go.chargeTypeID = 0;
GodmaEnvironment ge;
ge.selfID = m_Item->itemID();
ge.charID = m_Ship->ownerID();
ge.shipID = go.shipID;
ge.targetID = 0;
ge.other = go.Encode();
ge.area = new PyList;
ge.effectID = effectModifyActiveShieldResonanceAndNullifyPassiveResonance;
uint32 timeLeft = m_AMPC->GetRemainingCycleTimeMS();
timeLeft /= 100;
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = ge.selfID;
shipEff.effectID = ge.effectID;
shipEff.timeNow = Win32TimeNow();
shipEff.start = 0;
shipEff.active = 0;
shipEff.environment = ge.Encode();
shipEff.startTime = (shipEff.timeNow - (timeLeft * Win32Time_Second));
shipEff.duration = timeLeft;
shipEff.repeat = 0;
shipEff.error = new PyNone;
PyList* events = new PyList;
events->AddItem(shipEff.Encode());
Notify_OnMultiEvent multi;
multi.events = events;
PyTuple* tmp = multi.Encode();
m_Ship->GetPilot()->SendNotification("OnMultiEvent", "clientID", &tmp);
}
示例12: PyString
PyObject *DBResultToRowset(DBQueryResult &result)
{
uint32 r;
uint32 cc = result.ColumnCount();
PyDict *args = new PyDict();
PyObject *res = new PyObject(
new PyString( "util.Rowset" ), args
);
/* check if we have a empty query result and return a empty RowSet */
if( cc == 0 )
return res;
//list off the column names:
PyList *header = new PyList( cc );
args->SetItemString("header", header);
for(r = 0; r < cc; r++) {
header->SetItemString( r, result.ColumnName(r));
}
//RowClass:
args->SetItemString("RowClass", new PyToken("util.Row"));
//lines:
PyList *rowlist = new PyList();
args->SetItemString("lines", rowlist);
//add a line entry for each result row:
DBResultRow row;
while(result.GetRow(row)) {
PyList *linedata = new PyList( cc );
rowlist->AddItem(linedata);
for(r = 0; r < cc; r++) {
linedata->SetItem( r, DBColumnToPyRep(row, r) );
}
}
return res;
}
示例13: List
CRowSet* Inventory::List( EVEItemFlags _flag, uint32 forOwner ) const
{
PyList *keywords = new PyList();
keywords->AddItem(new_tuple(new PyString("stacksize"), new PyToken("util.StackSize")));
keywords->AddItem(new_tuple(new PyString("singleton"), new PyToken("util.Singleton")));
DBRowDescriptor* header = new DBRowDescriptor(keywords);
header->AddColumn( "itemID", DBTYPE_I8 );
header->AddColumn( "typeID", DBTYPE_I4 );
header->AddColumn( "ownerID", DBTYPE_I4 );
header->AddColumn( "locationID", DBTYPE_I8 );
header->AddColumn( "flagID", DBTYPE_I2 );
header->AddColumn( "quantity", DBTYPE_I4 );
header->AddColumn( "groupID", DBTYPE_I2 );
header->AddColumn( "categoryID", DBTYPE_I4 );
header->AddColumn( "customInfo", DBTYPE_STR );
//header->AddColumn( "singleton", DBTYPE_BOOL );
//header->AddColumn( "stacksize" , DBTYPE_I4 );
CRowSet* rowset = new CRowSet( &header );
List( rowset, _flag, forOwner );
return rowset;
}
示例14: Deactivate
void EnergyTurret::Deactivate()
{
Notify_OnGodmaShipEffect shipEff;
shipEff.itemID = m_Item->itemID();
shipEff.effectID = effectTargetAttack;
shipEff.when = Win32TimeNow();
shipEff.start = 0;
shipEff.active = 0;
PyList* env = new PyList;
env->AddItem(new PyInt(shipEff.itemID));
env->AddItem(new PyInt(m_Ship->ownerID()));
env->AddItem(new PyInt(m_Ship->itemID()));
env->AddItem(new PyInt(m_targetEntity->GetID()));
env->AddItem(new PyNone);
env->AddItem(new PyNone);
env->AddItem(new PyInt(10));
shipEff.environment = env;
shipEff.startTime = shipEff.when;
shipEff.duration = m_ActiveModuleProc->GetRemainingCycleTimeMS(); // At least, I'm assuming this is the remaining time left in the cycle
shipEff.repeat = new PyInt(0);
shipEff.randomSeed = new PyNone;
shipEff.error = new PyNone;
PyList* events = new PyList;
events->AddItem(shipEff.Encode());
Notify_OnMultiEvent multi;
multi.events = events;
PyTuple* tmp = multi.Encode();
m_Ship->GetOperator()->SendDogmaNotification("OnMultiEvent", "clientID", &tmp);
m_ActiveModuleProc->DeactivateCycle();
}
示例15: SetOnline
void InventoryItem::SetOnline(bool online) {
SetAttribute(AttrIsOnline, int(online));
Client *c = sEntityList.FindCharacter(m_ownerID);
if(c == NULL)
{
sLog.Error("InventoryItem", "unable to set ourselfs online//offline because we can't find the client");
return;
}
Notify_OnGodmaShipEffect ogf;
ogf.itemID = m_itemID;
ogf.effectID = effectOnline;
ogf.when = Win32TimeNow();
ogf.start = online?1:0;
ogf.active = online?1:0;
PyList *environment = new PyList;
environment->AddItem(new PyInt(ogf.itemID));
environment->AddItem(new PyInt(m_ownerID));
environment->AddItem(new PyInt(m_locationID));
environment->AddItem(new PyNone);
environment->AddItem(new PyNone);
environment->AddItem(new PyNone);
environment->AddItem(new PyInt(ogf.effectID));
ogf.environment = environment;
ogf.startTime = ogf.when;
ogf.duration = 10000;
ogf.repeat = online?new PyInt(1000):new PyInt(0);
ogf.randomSeed = new PyNone();
ogf.error = new PyNone();
Notify_OnMultiEvent multi;
multi.events = new PyList;
multi.events->AddItem( ogf.Encode() );
PyTuple* tmp = multi.Encode(); //this is consumed below
c->SendNotification("OnMultiEvent", "clientID", &tmp);
}