コード例 #1
0
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
0
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
0
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
0
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 f**k up calculation for some reason
	// so we can take the same shortcut here
	tuple->SetItem(1, new PyInt(0));

    return tuple;
}
コード例 #5
0
ファイル: Contract.cpp プロジェクト: Almamu/evemu_apocrypha
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
0
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
0
ファイル: EnergyTurret.cpp プロジェクト: B3N4K/evemu_server
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
0
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
0
ファイル: HybridTurret.cpp プロジェクト: Camwarp/evemu_server
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
0
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
0
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
0
ファイル: EVEDBUtils.cpp プロジェクト: Almamu/evemu_apocrypha
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
0
ファイル: Inventory.cpp プロジェクト: Almamu/evemu_server
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
0
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
0
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);
}
コード例 #16
0
void InventoryItem::SetActive(bool active, uint32 effectID, double duration, bool repeat)
{
	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 shipEffect;

	shipEffect.itemID = m_itemID;
	shipEffect.effectID = effectID;
	shipEffect.when = Win32TimeNow();
	shipEffect.start = active?1:0;
	shipEffect.active = active?1:0;

	PyList* env = new PyList;
	env->AddItem(new PyInt(m_itemID));
	env->AddItem(new PyInt(ownerID()));
	env->AddItem(new PyInt(m_locationID));
	env->AddItem(new PyNone);				//targetID
	env->AddItem(new PyNone);				//otherID
	env->AddItem(new PyNone);				//area
	env->AddItem(new PyInt(effectID));

	shipEffect.environment = env;
	shipEffect.startTime = shipEffect.when;
	shipEffect.duration = duration;
	shipEffect.repeat = repeat?new PyInt(1000):new PyInt(0);
	shipEffect.randomSeed = new PyNone;
	shipEffect.error = new PyNone;

	Notify_OnMultiEvent multi;
    multi.events = new PyList;
    multi.events->AddItem(shipEffect.Encode());

    PyTuple* tmp = multi.Encode();   //this is consumed below
    c->SendNotification("OnMultiEvent", "clientID", &tmp);
}
コード例 #17
0
ファイル: SearchDB.cpp プロジェクト: Camwarp/evemu_server
PyRep *SearchDB::QuickQuery(std::string match, std::vector<int> *SearchID) {
    DBQueryResult     res; 
    DBResultRow       row;
    uint32            i, size;
    std::stringstream st;
    std::stringstream supplement;
    std::string       query      = "";
    std::string       equal      = "";
    std::string       matchEsc   = "";

    //SearchIDs are :
    // 1 : agent
    // 2 : character
    // 3 : corporation
    // 4 : alliance
    // 5 : faction
    // 6 : constellation
    // 7 : solar system
    // 8 : region
    // 9 : station

    // Find out if search is exact or not and remove the trailing '*'
    std::size_t found=match.find('*');
    if (found!=std::string::npos) {
      match.erase (std::remove(match.begin(), match.end(), '*'), match.end());
      equal = " RLIKE ";
    } else {
      equal = " = ";
    }


    // If the SearchID is for character we must filter out agents
    size = SearchID->size();
    if ((size == 1) && (SearchID->at(0)) == 2){
        supplement << "AND itemId >= ";
        supplement << EVEMU_MINIMUM_ID;
    }

    // Transform SearchId in groupID to search the rights typeIDs
    int transform[9] = {1,1,2,32,19,4,5,3,15};
    for(i=0; i<size; i++)
    {
        st << transform[SearchID->at(i)-1];
        if (i<(size-1))
            st << ", ";
    }
    
    // Escape the match string
    sDatabase.DoEscapeString(matchEsc, match.c_str());

    //Form the query and execute it
    query = "SELECT itemID,itemName FROM entity"
            " WHERE itemName RLIKE '%s' %s"
            " AND typeID in (SELECT typeID FROM invTypes LEFT JOIN invGroups ON invTypes.groupid = invGroups.groupID"
            " WHERE invGroups.groupID IN (%s))"
            " ORDER BY itemName";


    _log(SERVICE__MESSAGE, query.c_str(), matchEsc.c_str(), supplement.str().c_str() ,st.str().c_str());

    if(!sDatabase.RunQuery(res,query.c_str(), matchEsc.c_str(), supplement.str().c_str() , st.str().c_str() ))
    {
        _log(SERVICE__ERROR, "Error in LookupChars query: %s", res.error.c_str());
        return NULL;
    }

    // The cliant wants a List if Ids in return
    PyList *result = new PyList();
    while( res.GetRow( row ) ){
        result->AddItem( new PyInt(row.GetUInt(0) ));
    }

    return result;


}
コード例 #18
0
void EnergyTurret::DoCycle()
{
	if( m_ActiveModuleProc->ShouldProcessActiveCycle() )
	{
		// Check to see if our target is still in this bubble or has left or been destroyed:
		if( !(m_Ship->GetOperator()->GetSystemEntity()->Bubble()->GetEntity(m_targetID)) )
		{
			// Target has left our bubble or been destroyed, deactivate this module:
			Deactivate();
			return;
		}

		// Create Destiny Updates:
		DoDestiny_OnDamageStateChange dmgChange;
		dmgChange.entityID = m_targetEntity->GetID();

		PyList *states = new PyList;
		states->AddItem(new PyFloat(0));
		states->AddItem(new PyFloat(0));
		states->AddItem(new PyFloat(0.99));
		dmgChange.state = states;

		Notify_OnDamageMessage dmgMsg;
		dmgMsg.messageID = "";		// Can be left blank as Damage.cpp fills this in.  This can be one in this set {"AttackHit1", "AttackHit2", "AttackHit3", "AttackHit4", "AttackHit5", "AttackHit6"}
		dmgMsg.weapon = m_Item->itemID();
		dmgMsg.splash = "";
		dmgMsg.target = m_targetEntity->GetID();
		dmgMsg.damage = (m_Item->GetAttribute(AttrDamageMultiplier).get_float() * 48.0);

		Notify_OnGodmaShipEffect shipEff;
		shipEff.itemID = m_Item->itemID();
		shipEff.effectID = effectTargetAttack;		// 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_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_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, true);

		// Create Special Effect:
		m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
		(
			m_Ship,
			m_Item->itemID(),
			m_Item->typeID(),
			m_targetID,
			m_chargeRef->itemID(),
			"effects.Laser",
			1,
			1,
			m_Item->GetAttribute(AttrSpeed).get_float(),
			1
		);

		// Create Damage action:
		//Damage( SystemEntity *_source,
        //    InventoryItemRef _weapon,
        //    double _kinetic,
        //    double _thermal,
        //    double _em,
        //    double _explosive,
        //    EVEEffectID _effect );
		double kinetic_damage = 0.0;
		double thermal_damage = 0.0;
		double em_damage = 0.0;
		double explosive_damage = 0.0;

		// This still somehow needs skill, ship, module, and implant bonuses to be applied:
		// This still somehow needs to have optimal range and falloff attributes applied as a damage modification factor:
		if( m_chargeRef->HasAttribute(AttrKineticDamage) )
			kinetic_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrKineticDamage)).get_float();
		if( m_chargeRef->HasAttribute(AttrThermalDamage) )
			thermal_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrThermalDamage)).get_float();
		if( m_chargeRef->HasAttribute(AttrEmDamage) )
			em_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrEmDamage)).get_float();
		if( m_chargeRef->HasAttribute(AttrExplosiveDamage) )
			explosive_damage = (m_Item->GetAttribute(AttrDamageMultiplier) * m_chargeRef->GetAttribute(AttrExplosiveDamage)).get_float();

		Damage damageDealt
		(
			m_Ship->GetOperator()->GetSystemEntity(),
			m_Item,
			kinetic_damage,			// kinetic damage
			thermal_damage,			// thermal damage
			em_damage,				// em damage
			explosive_damage,		// explosive damage
			effectTargetAttack		// from EVEEffectID::
		);
		
		m_targetEntity->ApplyDamage( damageDealt );
	}
}
コード例 #19
0
ファイル: MarketDB.cpp プロジェクト: Camwarp/evemu_server
PyRep *MarketDB::GetOrders( uint32 regionID, uint32 typeID )
{
    DBQueryResult res;

    PyList* tup = new PyList();

    /*DBColumnTypeMap colmap;
    colmap["volRemaining"] = DBTYPE_R8;
    colmap["price"] = DBTYPE_CY;
    colmap["issued"] = DBTYPE_FILETIME;

    colmap["orderID"] = DBTYPE_I4;
    colmap["volEntered"] = DBTYPE_I4;
    colmap["minVolume"] = DBTYPE_I4;
    colmap["stationID"] = DBTYPE_I4;
    colmap["regionID"] = DBTYPE_I4;
    colmap["solarSystemID"] = DBTYPE_I4;
    colmap["jumps"] = DBTYPE_I4;

    colmap["duration"] = DBTYPE_I2;
    colmap["typeID"] = DBTYPE_I2;
    colmap["range"] = DBTYPE_I2;

    colmap["bid"] = DBTYPE_BOOL;

    //ordering: (painstakingly determined from packets)
    DBColumnOrdering ordering;
    ordering.push_back("price");
    ordering.push_back("volRemaining");
    ordering.push_back("issued");
    ordering.push_back("orderID");
    ordering.push_back("volEntered");
    ordering.push_back("minVolume");
    ordering.push_back("stationID");
    ordering.push_back("regionID");
    ordering.push_back("solarSystemID");
    ordering.push_back("jumps");    //not working right...
    ordering.push_back("typeID");
    ordering.push_back("range");
    ordering.push_back("duration");
    ordering.push_back("bid");*/

    //query sell orders
    //TODO: consider the `jumps` field... is it actually used? might be a pain in the ass if we need to actually populate it based on each queryier's location
    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    price, volRemaining, typeID, `range`, orderID,"
        "   volEntered, minVolume, bid, issued as issueDate, duration,"
        "   stationID, regionID, solarSystemID, jumps"
        " FROM market_orders "
        " WHERE regionID=%u AND typeID=%u AND bid=%d", regionID, typeID, TransactionTypeSell))
    {
        codelog( MARKET__ERROR, "Error in query: %s", res.error.c_str() );

        PyDecRef( tup );
        return NULL;
    }
    sLog.Debug("MarketDB::GetOrders", "Fetched %d sell orders for type %d", res.GetRowCount(), typeID);

    //this is wrong.
    tup->AddItem( DBResultToCRowset( res ) );

    //query buy orders
    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    price, volRemaining, typeID, `range`, orderID,"
        "   volEntered, minVolume, bid, issued as issueDate, duration,"
        "   stationID, regionID, solarSystemID, jumps"
        " FROM market_orders "
        " WHERE regionID=%u AND typeID=%u AND bid=%d", regionID, typeID, TransactionTypeBuy))
    {
        codelog( MARKET__ERROR, "Error in query: %s", res.error.c_str() );

        PyDecRef( tup );
        return NULL;
    }
    sLog.Debug("MarketDB::GetOrders", "Fetched %d buy orders for type %d", res.GetRowCount(), typeID);

    //this is wrong.
    tup->AddItem( DBResultToCRowset( res ) );

    return tup;
}
コード例 #20
0
ファイル: Afterburner.cpp プロジェクト: Almamu/evemu_server
void Afterburner::_ShowCycle()
{
	//m_Item->SetActive(true, 1253, m_Item->GetAttribute(AttrDuration).get_float(), true);

	double implantBonuses = 1.0;	// TODO: gather and accumulate all implant bonuses for MWDs/Afterburners
	double accelerationControlSkillLevel = 0.0;	// TODO: Figure out how to get access to skills list of character running this ship and get this value
	double boostSpeed = m_Ship->GetAttribute(AttrMaxVelocity).get_float() * (1.0 + (m_Item->GetAttribute(AttrSpeedFactor).get_float() / 100.0 * (1 + accelerationControlSkillLevel * 0.05) * (implantBonuses) * (m_Item->GetAttribute(AttrSpeedBoostFactor).get_float() / (m_Ship->GetAttribute(AttrMass).get_float()))));

	// Tell Destiny Manager about our new speed so it properly tracks ship movement:
	m_Ship->GetOperator()->GetDestiny()->SetMaxVelocity(boostSpeed);
	m_Ship->GetOperator()->GetDestiny()->SetSpeedFraction(1.0);

	DoDestiny_SetBallMass mass;
	mass.entityID = m_Ship->itemID();
	mass.mass = m_Ship->GetAttribute(AttrMass).get_float();

	DoDestiny_SetMaxSpeed speed;
	speed.entityID = m_Ship->itemID();
	speed.speedValue = boostSpeed;

	std::vector<PyTuple *> updates;
	updates.push_back(mass.Encode());
	updates.push_back(speed.Encode());

	//m_Ship->GetOperator()->GetDestiny()->SendDestinyUpdate(updates, false);

	// Create Destiny Updates:
	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = 1254;		// 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 PyNone);
	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(AttrDuration).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(),
		0,
		0,
		"effects.SpeedBoost",
		0,
		1,
		1,
		m_Item->GetAttribute(AttrDuration).get_float(),
		1000
		);
}
コード例 #21
0
ファイル: Afterburner.cpp プロジェクト: Almamu/evemu_server
void Afterburner::StopCycle(bool abort)
{
	//m_Item->SetActive(false, 1253, 0.0, false);

	// Tell Destiny Manager about our new speed so it properly tracks ship movement:
	m_Ship->GetOperator()->GetDestiny()->SetMaxVelocity(m_Ship->GetDefaultAttribute(AttrMaxVelocity).get_float());
	m_Ship->GetOperator()->GetDestiny()->SetSpeedFraction(1.0);

	DoDestiny_SetMaxSpeed speed;
	speed.entityID = m_Ship->itemID();
	speed.speedValue = m_Ship->GetDefaultAttribute(AttrMaxVelocity).get_float();

	DoDestiny_SetBallMass mass;
	mass.entityID = m_Ship->itemID();
	mass.mass = m_Ship->GetAttribute(AttrMass).get_float();

	std::vector<PyTuple *> updates;
	updates.push_back(speed.Encode());
	updates.push_back(mass.Encode());

	m_ActiveModuleProc->DeactivateCycle();

	m_Ship->GetOperator()->GetDestiny()->SendDestinyUpdate(updates, false);

	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = 1254;
	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 PyNone);
	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);

	m_ActiveModuleProc->DeactivateCycle();

	// Create Special Effect:
	m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
		(
		m_Ship,
		m_Item->itemID(),
		m_Item->typeID(),
		0,
		0,
		"effects.SpeedBoost",
		0,
		0,
		0,
		1.0,
		0
		);
}
コード例 #22
0
void MissileLauncher::_ShowCycle()
{
	// Create Destiny Updates:
	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = effectMissileLaunching;		// 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.MissileDeployment",
		1,
		1,
		1,
		m_Item->GetAttribute(AttrSpeed).get_float(),
		1000
	);

	// Actually Launch a missile, creating a new Destiny object for it, but we don't know how to do this yet...

	// TODO - RESEARCH
	// (packets sent by server upon missile launch)
	/*
	Packet #1
[PyObjectData Name: macho.Notification]
  [PyTuple 7 items]
    [PyInt 12]
    [PyObjectData Name: macho.MachoAddress]
      [PyTuple 4 items]
        [PyInt 1]
        [PyInt 790408]
        [PyNone]
        [PyNone]
    [PyObjectData Name: macho.MachoAddress]
      [PyTuple 4 items]
        [PyInt 4]
        [PyString "DoDestinyUpdate"]
        [PyList 0 items]
        [PyString "clientID"]
    [PyInt 5894042]
    [PyTuple 1 items]
      [PyTuple 2 items]
        [PyInt 0]
        [PySubStream 888 bytes]
          [PyTuple 2 items]
            [PyInt 0]
            [PyTuple 2 items]
              [PyInt 1]
              [PyTuple 3 items]
                [PyList 3 items]
                  [PyTuple 2 items]
                    [PyInt 62665]
                    [PyTuple 2 items]
                      [PyString "PackagedAction"]
                      [PySubStream 270 bytes]
                        [PyList 1 items]
                          [PyTuple 2 items]
                            [PyInt 62665]
                            [PyTuple 2 items]
                              [PyString "AddBalls2"]
                              [PyTuple 1 items]
                                [PyTuple 2 items]
                                  [PyString "??  ?+??Pl?|  ?C????8?B)??u3??As"?E??B     ??@ ????????7)a[?? ?E                          zD  ???"]
                                  [PyList 1 items]
                                    [PyDict 11 kvp]
                                      [PyString "itemID"]
                                      [PyIntegerVar missileEntityID]
                                      [PyString "typeID"]
                                      [PyInt 203]
                                      [PyString "name"]
                                      [PyString "Cruise Missile"]
                                      [PyString "sourceModuleID"]
                                      [PyIntegerVar moduleID]		- the missile launcher module
                                      [PyString "corpID"]
                                      [PyInt corpID]
                                      [PyString "allianceID"]
                                      [PyInt allianceID]
                                      [PyString "warFactionID"]
                                      [PyNone]						- would by PyInt with warFactionID
                                      [PyString "securityStatus"]
                                      [PyFloat 2.65811580082965]
                                      [PyString "ownerID"]
                                      [PyInt ownerID]				- this is probably characterID
                                      [PyString "numLaunchers"]
                                      [PyInt 1]
                                      [PyString "nameID"]
                                      [PyInt 63844]
                  [PyTuple 2 items]
                    [PyInt 62665]
                    [PyTuple 2 items]
                      [PyString "OnDamageStateChange"]
                      [PyTuple 2 items]
                        [PyIntegerVar xxxxxx]
                        [PyList 3 items]
                          [PyTuple 3 items]
                            [PyFloat 0.570742342960805]
                            [PyFloat 200000]
                            [PyIntegerVar xxxxxx]
                          [PyFloat 1]
                          [PyFloat 1]
                  [PyTuple 2 items]
                    [PyInt 62665]
                    [PyTuple 2 items]
                      [PyString "OnDamageStateChange"]
                      [PyTuple 2 items]
                        [PyIntegerVar xxxxxx]
                        [PyList 3 items]
                          [PyTuple 3 items]
                            [PyFloat 6.93745520230552E-06]
                            [PyFloat 425000]
                            [PyIntegerVar timeStamp]
                          [PyFloat 0.810598232437212]
                          [PyFloat 1]
                [PyBool True]
                [PyList 10 items]
                  [PyTuple 7 items]
                    [PyString "OnModuleAttributeChange"]
                    [PyInt xxxxxx]
                    [PyIntegerVar xxxxxx]
                    [PyInt 266]
                    [PyIntegerVar xxxxxx]
                    [PyFloat 3320.81907103188]
                    [PyFloat 3640.81907103188]
                  [PyTuple 7 items]
                    [PyString "OnModuleAttributeChange"]
                    [PyInt xxxxxx]
                    [PyIntegerVar xxxxxx]
                    [PyInt 18]
                    [PyIntegerVar timeStamp]
                    [PyFloat 4077.04701492647]
                    [PyList 4 items]
                      [PyFloat 4077.04701492647]
                      [PyIntegerVar timeStamp]
                      [PyFloat 104400]
                      [PyFloat 4860]
                  [PyTuple 5 items]
                    [PyString "OnEffectHit"]
                    [PyIntegerVar xxxxxx]
                    [PyInt 10]
                    [PyIntegerVar xxxxxx]
                    [PyFloat 42.3334296258933]
                  [PyList 3 items]
                    [PyString "OnDamageMessage"]
                    [PyString "AttackHit2"]
                    [PyDict 4 kvp]
                      [PyString "weapon"]
                      [PyInt 21638]
                      [PyString "splash"]
                      [PyString ""]
                      [PyString "target"]
                      [PyIntegerVar xxxxxx]
                      [PyString "damage"]
                      [PyFloat 42.3334296258933]
                  [PyTuple 5 items]
                    [PyString "OnEffectHit"]
                    [PyIntegerVar xxxxxx]
                    [PyInt 10]
                    [PyIntegerVar xxxxxx]
                    [PyFloat 59.3261381082436]
                  [PyList 3 items]
                    [PyString "OnDamageMessage"]
                    [PyString "AttackHit3"]
                    [PyDict 4 kvp]
                      [PyString "weapon"]
                      [PyInt 21638]
                      [PyString "splash"]
                      [PyString ""]
                      [PyString "target"]
                      [PyIntegerVar xxxxxx]
                      [PyString "damage"]
                      [PyFloat 59.3261381082436]
                  [PyTuple 5 items]
                    [PyString "OnEffectHit"]
                    [PyIntegerVar xxxxxx]
                    [PyInt 10]
                    [PyIntegerVar xxxxxx]
                    [PyFloat 69.8373107175934]
                  [PyList 3 items]
                    [PyString "OnDamageMessage"]
                    [PyString "AttackHit4"]
                    [PyDict 4 kvp]
                      [PyString "weapon"]
                      [PyInt 21638]
                      [PyString "splash"]
                      [PyString ""]
                      [PyString "target"]
                      [PyIntegerVar xxxxxx]
                      [PyString "damage"]
                      [PyFloat 69.8373107175934]
                  [PyTuple 7 items]
                    [PyString "OnModuleAttributeChange"]
                    [PyInt 649670823]
                    [PyTuple 3 items]
                      [PyIntegerVar xxxxxx]
                      [PyInt 31]
                      [PyInt 203]
                    [PyInt 805]
                    [PyIntegerVar timeStamp]
                    [PyInt 23]
                    [PyInt 24]
                  [PyTuple 12 items]
                    [PyString "OnGodmaShipEffect"]
                    [PyIntegerVar xxxxxx]
                    [PyInt 101]
                    [PyIntegerVar timeStamp]
                    [PyInt 1]
                    [PyInt 1]
                    [PyList 7 items]
                      [PyIntegerVar xxxxxx]
                      [PyIntegerVar xxxxxx]
                      [PyIntegerVar xxxxxx]
                      [PyIntegerVar xxxxxx]
                      [PyTuple 3 items]
                        [PyIntegerVar xxxxxx]
                        [PyInt 31]
                        [PyInt 203]
                      [PyList 0 items]
                      [PyInt 101]
                    [PyIntegerVar timeStamp]
                    [PyFloat 10454.4]
                    [PyInt 1000]
                    [PyNone]
                    [PyNone]
    [PyNone]
    [PyNone]


	Packet #2
		[PyObjectData Name: macho.Notification]
		  [PyTuple 7 items]
			[PyInt 12]
			[PyObjectData Name: macho.MachoAddress]
			  [PyTuple 4 items]
				[PyInt 1]
				[PyInt 790408]
				[PyNone]
				[PyNone]
			[PyObjectData Name: macho.MachoAddress]
			  [PyTuple 4 items]
				[PyInt 4]
				[PyString "DoDestinyUpdate"]
				[PyList 0 items]
				[PyString "clientID"]
			[PyInt 5894042]
			[PyTuple 1 items]
			  [PyTuple 2 items]
				[PyInt 0]
				[PySubStream 145 bytes]
				  [PyTuple 2 items]
					[PyInt 0]
					[PyTuple 2 items]
					  [PyInt 1]
					  [PyTuple 2 items]
						[PyList 2 items]
						  [PyTuple 2 items]
							[PyInt 62665]
							[PyTuple 2 items]
							  [PyString "OnSpecialFX"]
							  [PyTuple 14 items]
								[PyIntegerVar shipID]
								[PyIntegerVar moduleID]
								[PyInt 16519]
								[PyIntegerVar targetID]
								[PyInt 203]
								[PyList 0 items]
								[PyString "effects.MissileDeployment"]
								[PyBool True]
								[PyInt 1]
								[PyInt 1]
								[PyFloat 10454.4]
								[PyInt 1000]
								[PyIntegerVar timeStamp]
								[PyNone]
						  [PyTuple 2 items]
							[PyInt 62665]
							[PyTuple 2 items]
							  [PyString "LaunchMissile"]
							  [PyTuple 5 items]
								[PyIntegerVar missileEntityID]
								[PyIntegerVar targetID]
								[PyIntegerVar shipID]
								[PyInt 1]
								[PyInt 1]
						[PyBool False]
			[PyNone]
			[PyNone]
	*/
}
コード例 #23
0
PyResult ContractMgrService::Handle_GetContract( PyCallArgs& call )
{
	Call_SingleIntegerArg arg;
	PyDict* _contract = new PyDict;

	if( !arg.Decode( &call.tuple ) )
	{
		codelog(SERVICE__ERROR, "%s: Bad arguments to GetContract in contractMgr", call.client->GetCharacterName() );
		return NULL;
	}

	// Manual creation of PyPackedRow
	DBRowDescriptor *header = new DBRowDescriptor();
	header->AddColumn( "contractID",			DBTYPE_I4 );
	header->AddColumn( "issuerID",				DBTYPE_I4 );
	header->AddColumn( "issuerCorpID",			DBTYPE_I4 );
	header->AddColumn( "type",					DBTYPE_UI1 );
	header->AddColumn( "availability",			DBTYPE_I4 );
	header->AddColumn( "assigneeID",			DBTYPE_I4 );
	header->AddColumn( "numDays",				DBTYPE_I4 );
	header->AddColumn( "startStationID",		DBTYPE_I4 );
	header->AddColumn( "endStationID",			DBTYPE_I4 );
	header->AddColumn( "startSolarSystemID",	DBTYPE_I4 );
	header->AddColumn( "endSolarSystemID",		DBTYPE_I4 );
	header->AddColumn( "startRegionID",			DBTYPE_I4 );
	header->AddColumn( "endRegionID",			DBTYPE_I4 );
	header->AddColumn( "price",					DBTYPE_CY );
	header->AddColumn( "reward",				DBTYPE_CY );
	header->AddColumn( "collateral",			DBTYPE_CY );
	header->AddColumn( "title",					DBTYPE_WSTR );
	header->AddColumn( "description",			DBTYPE_WSTR );
	header->AddColumn( "forCorp",				DBTYPE_BOOL );
	header->AddColumn( "status",				DBTYPE_UI1 );
	header->AddColumn( "acceptorID",			DBTYPE_I4 );
	header->AddColumn( "dateIssued",			DBTYPE_FILETIME );
	header->AddColumn( "dateExpired",			DBTYPE_FILETIME );
	header->AddColumn( "dateAccepted",			DBTYPE_FILETIME );
	header->AddColumn( "dateCompleted",			DBTYPE_FILETIME );
	header->AddColumn( "volume",				DBTYPE_R8 );
	header->AddColumn( "issuerAllianceID",		DBTYPE_I4 );
	header->AddColumn( "issuerWalletKey",		DBTYPE_I4 );
	header->AddColumn( "acceptorWalletKey",		DBTYPE_I4 );
	header->AddColumn( "crateID",				DBTYPE_I4 );

	ContractRef contract = m_contractManager->GetContract( arg.arg );
	
	uint32 n = 0;

	PyPackedRow* into = new PyPackedRow( header );
	into->SetField( "contractID",			new PyInt(		contract->contractID() ) );
	into->SetField( "issuerID",				new PyInt(		contract->issuerID() ) );
	into->SetField( "issuerCorpID",			new PyInt(		contract->issuerCorpID() ) );
	into->SetField( "type",					new PyInt(		contract->type() ) );
	into->SetField( "availability",			new PyInt(		contract->avail() ) );
	into->SetField( "assigneeID",			new PyInt(		contract->assigneeID() ) );
	into->SetField( "numDays",				new PyInt(		0 ) );
	into->SetField( "startStationID",		new PyInt(		contract->startStationID() ) );
	into->SetField( "endStationID",			new PyInt(		contract->endStationID() ) );
	into->SetField( "startSolarSystemID",   new PyInt(		contract->startSolarSystemID() ) );
	into->SetField( "endSolarSystemID",		new PyInt(		contract->endSolarSystemID() ) );
	into->SetField( "startRegionID",		new PyInt(		contract->startRegionID() ) );
	into->SetField( "endRegionID",			new PyInt(		contract->endRegionID() ) );
	into->SetField( "price",				new PyFloat(	contract->price() ) );
	into->SetField( "reward",				new PyFloat(	contract->reward() ) );
	into->SetField( "collateral",			new PyFloat(	contract->collateral() ) );
	into->SetField( "title",				new PyString(	"title" ) );
	into->SetField( "description",			new PyString(	"description" ) );
	into->SetField( "forCorp",				new PyBool(		contract->forCorp() ) );
	into->SetField( "status",				new PyInt(		contract->status() ) );
	into->SetField( "acceptorID",			new PyInt(		contract->acceptorID() ) );
	into->SetField( "dateIssued",			new PyLong(		contract->dateIssued() ) );
	into->SetField( "dateExpired",			new PyLong(		contract->dateExpired() ) );
	into->SetField( "dateAccepted",			new PyLong(		contract->dateAccepted() ) );
	into->SetField( "dateCompleted",		new PyLong(		contract->dateCompleted() ) );
	into->SetField( "volume",				new PyFloat(	contract->volume() ) );
	into->SetField( "issuerAllianceID",		new PyInt(		contract->issuerAllianceID() ) );
	into->SetField( "issuerWalletKey",		new PyInt(		contract->issuerWalletKey() ) );
	into->SetField( "acceptorWalletKey",	new PyInt(		0 ) );
	into->SetField( "crateID",				new PyInt(		0 ) );

	PyList* itemList = new PyList;

	DBRowDescriptor *itemHeader = new DBRowDescriptor();
	itemHeader->AddColumn( "contractID",						DBTYPE_I4 );
	itemHeader->AddColumn( "itemID",							DBTYPE_I4 );
	itemHeader->AddColumn( "quantity",							DBTYPE_I4 );
	itemHeader->AddColumn( "itemTypeID",						DBTYPE_I4 );
	itemHeader->AddColumn( "inCrate",							DBTYPE_BOOL );
	itemHeader->AddColumn( "parentID",							DBTYPE_I4 );
	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++ )
	{
		PyPackedRow* data = new PyPackedRow( itemHeader );
		data->SetField( "contractID",						new PyInt(	arg.arg ) );
		data->SetField(	"itemID",							new PyInt(	0 ) );
		data->SetField(	"quantity",							new PyInt(	c->second->m_quantity ) );
		data->SetField(	"itemTypeID",						new PyInt(	c->second->m_typeID ) );
		data->SetField( "inCrate",							new PyBool( false ) );
		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 ) );
		data->SetField( "damage",							new PyFloat( 0.0 ) );
		data->SetField( "flagID",							new PyInt(   0 ) );

		itemList->AddItem( data );
	}

	DBRowDescriptor *bidsHeader = new DBRowDescriptor();
	bidsHeader->AddColumn( "bidID",					DBTYPE_I4 );
	bidsHeader->AddColumn( "contractID",			DBTYPE_I4 );
	bidsHeader->AddColumn( "issuerID",				DBTYPE_I4 );
	bidsHeader->AddColumn( "quantity",				DBTYPE_I4 );
	bidsHeader->AddColumn( "issuerCorpID",			DBTYPE_I4 );
	bidsHeader->AddColumn( "issuerStationID",		DBTYPE_I4 );
	bidsHeader->AddColumn( "issuerSolarSystemID",	DBTYPE_I4 );
	bidsHeader->AddColumn( "issuerRegionID",		DBTYPE_I4 );
	CRowSet *bids_rowset = new CRowSet( &bidsHeader );

	_contract->SetItemString( "items",		itemList );
	_contract->SetItemString( "bids",		bids_rowset );
	_contract->SetItemString( "contract",	into);

	PyObject* res = new PyObject( new PyString( "util.KeyVal" ), _contract );

	return res;
}
コード例 #24
0
//this is a crap load of work... there HAS to be a better way to do this..
PyObject *MarketDB::GetMarketGroups() {
	DBQueryResult res;

	//returns cached object marketProxy.GetMarketGroups
	//marketGroupID, parentGroupID, marketGroupName, description, graphicID, hasTypes, types
	//this is going to be a real pain... another "nested" query thing...
	// I really wanna know how they do this crap with their MS SQL server.. 
	// I hope its not as much of a nightmare as it is for us....

	//first we need to query out all the types because we need them to 
	// fill in the 'types' subquery for each row of the result
	std::map< int, std::set<uint32> > types;	//maps marketGroupID -> typeID
	if(!sDatabase.RunQuery(res,
		"SELECT"
		"	marketGroupID,typeID"
		" FROM invTypes"
		" WHERE marketGroupID IS NOT NULL"
		" ORDER BY marketGroupID"))
	{
		codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
		return NULL;
	}
	
	DBResultRow row;
	while(res.GetRow(row))
		types[row.GetUInt(0)].insert(row.GetUInt(1));

	if(!sDatabase.RunQuery(res,
		"SELECT"
		"	marketGroupID, parentGroupID"
		" FROM invMarketGroups"))
	{
		codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
		return NULL;
	}

	std::map<int, int> parentChild;	//maps child -> parent
	std::map<int, std::set<int> > childParent; //maps parent -> all children.
	while(res.GetRow(row)) {
		//figure out the parent ID, mapping NULL to -1 for our map.
		int marketGroupID = row.GetUInt(0);
		int parentGroupID = row.IsNull(1) ? -1 : row.GetUInt(1);

		parentChild[marketGroupID] = parentGroupID;
		childParent[parentGroupID].insert(marketGroupID);
	}

	//now we need to propigate all of the items up the tree (a parent group's items list contains ALL items of its children.)
	_PropigateItems(types, parentChild, childParent, -1);

	//now we get to do the other query.
	if(!sDatabase.RunQuery(res,
		"SELECT"
		"	marketGroupID, parentGroupID, marketGroupName, description, graphicID, hasTypes"
		" FROM invMarketGroups"))
	{
		codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
		return NULL;
	}

	//doing this the long (non XML) way to avoid the extra copies due to the huge volume of data here.
	PyDict *args = new PyDict();

	PyDict *parentSets = new PyDict();
	PyList *header = new PyList();
	
	header->AddItemString("marketGroupID");
	header->AddItemString("parentGroupID");
	header->AddItemString("marketGroupName");
	header->AddItemString("description");
	header->AddItemString("graphicID");
	header->AddItemString("hasTypes");
	header->AddItemString("types");	//this column really contains an entire list.
	header->AddItemString("dataID");
	
	args->SetItemString("header", header);
	args->SetItemString("idName", new PyString("parentGroupID"));
	args->SetItemString("RowClass", new PyToken("util.Row"));
	args->SetItemString("idName2", new PyNone);
	args->SetItemString("items", parentSets);
	
	//now fill in items.
	// we have to satisfy this structure... which uses parentGroupID as the
	// main dict key, each dict entry is then a list of MarketGroup_Entrys
	// which have that parentGroupID
	//marketGroupID, parentGroupID, marketGroupName, description, graphicID, hasTypes, types
	std::map< int, std::set<uint32> >::const_iterator tt;
	MarketGroup_Entry entry;
    PyList* list;
    PyList* parents = new PyList();
	while( res.GetRow(row) )
	{
		entry.marketGroupID = row.GetUInt( 0 );

		//figure out the parent ID, mapping NULL to -1 for our map.
		entry.parentGroupID = ( row.IsNull( 1 ) ? -1 : row.GetUInt( 1 ) );

		entry.marketGroupName = row.GetText( 2 );
		entry.description = row.GetText( 3 );
		entry.graphicID = ( row.IsNull( 4 ) ? -1 : row.GetUInt( 4 ) );		
		entry.hasTypes = row.GetUInt( 5 );

		// Insert all types
		entry.types.clear();
		tt = types.find( entry.marketGroupID );
		if( tt != types.end() )
			entry.types.insert( entry.types.begin(), tt->second.begin(), tt->second.end() );

        if(entry.parentGroupID == -1)
			list = parents;
		else
			list = static_cast<PyList*> (parentSets->GetItem(new PyInt( entry.parentGroupID )));
        if(list == NULL)
            list = new PyList();
        list->AddItem(entry.Encode());
        PySafeIncRef(list);
        if(entry.parentGroupID != -1)
			parentSets->SetItem(new PyInt(entry.parentGroupID), list);
	}
    parentSets->SetItem(new PyNone, parents);

	return new PyObject( "util.FilterRowset", args );
}
コード例 #25
0
ファイル: EnergyTurret.cpp プロジェクト: B3N4K/evemu_server
void EnergyTurret::Activate(uint32 targetID)
{

	DoDestiny_OnDamageStateChange dmgChange;
	dmgChange.entityID = targetID;

	PyList *states = new PyList;
	states->AddItem(new PyFloat(0));
	states->AddItem(new PyFloat(0));
	states->AddItem(new PyFloat(0.99));
	dmgChange.state = states;

	m_Ship->SetAttribute(AttrCharge, 139);
	
	Notify_OnEffectHit effHit;
	effHit.itemID = m_Item->itemID();
	effHit.effectID = 10;
	effHit.targetID = targetID;
	effHit.damage = 5;

	Notify_OnDamageMessage dmgMsg;
	dmgMsg.messageID = "AttackHit3";
	dmgMsg.weapon = 3634;
	dmgMsg.splash = "";
	dmgMsg.target = targetID;
	dmgMsg.damage = 5;

	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = 10;
	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(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(1000);
	shipEff.randomSeed = new PyNone;
	shipEff.error = new PyNone;

	PyTuple* tmp = new PyTuple(3);
	tmp->SetItem(0, effHit.Encode());
	tmp->SetItem(1, dmgMsg.Encode());
	tmp->SetItem(2, shipEff.Encode());

	std::vector<PyTuple*> events;
	events.push_back(effHit.Encode());
	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, true);
}
コード例 #26
0
ファイル: SuperWeapon.cpp プロジェクト: Almamu/evemu_server
void SuperWeapon::StopCycle(bool abort)
{
	// TODO:
	// 1. Enable warping and jump drive

	std::string effectString;
	switch (m_Item->typeID())
	{
		case 24550:
			effectString = "effects.SuperWeaponAmarr";
			m_effectID = effectSuperWeaponAmarr;
			break;

		case 24552:
			effectString = "effects.SuperWeaponCaldari";
			m_effectID = effectSuperWeaponCaldari;
			break;

		case 24554:
			effectString = "effects.SuperWeaponGallente";
			m_effectID = effectSuperWeaponGallente;
			break;

		case 23674:
			effectString = "effects.SuperWeaponMinmatar";
			m_effectID = effectSuperWeaponMinmatar;
			break;

		default:
			effectString = "";
			m_effectID = 0;
			break;
	}

	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = m_effectID;
	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);

	m_ActiveModuleProc->DeactivateCycle();

	// Create Special Effect:
	m_Ship->GetOperator()->GetDestiny()->SendSpecialEffect
		(
		m_Ship,
		m_Item->itemID(),
		m_Item->typeID(),
		m_targetID,
		0,
		effectString,
		1,
		0,
		0,
		1.0,
		0
		);
}
コード例 #27
0
ファイル: SuperWeapon.cpp プロジェクト: Almamu/evemu_server
void SuperWeapon::_ShowCycle()
{
	std::string effectString;
	switch (m_Item->typeID())
	{
	case 24550:
		effectString = "effects.SuperWeaponAmarr";
		m_effectID = effectSuperWeaponAmarr;
		break;

	case 24552:
		effectString = "effects.SuperWeaponCaldari";
		m_effectID = effectSuperWeaponCaldari;
		break;

	case 24554:
		effectString = "effects.SuperWeaponGallente";
		m_effectID = effectSuperWeaponGallente;
		break;

	case 23674:
		effectString = "effects.SuperWeaponMinmatar";
		m_effectID = effectSuperWeaponMinmatar;
		break;

	default:
		effectString = "";
		m_effectID = 0;
		break;
	}

	// Create Destiny Updates:
	Notify_OnGodmaShipEffect shipEff;
	shipEff.itemID = m_Item->itemID();
	shipEff.effectID = m_effectID;		// 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(AttrDuration).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,
		0,
		effectString,
		1,
		1,
		1,
		m_Item->GetAttribute(AttrDuration).get_float(),
		1000
		);
}