EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AgentBound Class Reference

#include "AgentBound.h"

Inheritance diagram for AgentBound:
Collaboration diagram for AgentBound:

Public Member Functions

 PyCallable_Make_Dispatcher (AgentBound) AgentBound(PyServiceMgr *mgr
 
virtual ~AgentBound ()
 
virtual void Release ()
 
 PyCallable_DECL_CALL (DoAction)
 
 PyCallable_DECL_CALL (GetMyJournalDetails)
 
 PyCallable_DECL_CALL (GetAgentLocationWrap)
 
 PyCallable_DECL_CALL (GetInfoServiceDetails)
 
 PyCallable_DECL_CALL (GetMissionKeywords)
 
 PyCallable_DECL_CALL (GetMissionJournalInfo)
 
 PyCallable_DECL_CALL (GetMissionBriefingInfo)
 
 PyCallable_DECL_CALL (GetMissionObjectiveInfo)
 
 PyCallable_DECL_CALL (GetDungeonShipRestrictions)
 
 PyCallable_DECL_CALL (RemoveOfferFromJournal)
 
 PyCallable_DECL_CALL (GetOfferJournalInfo)
 
 PyCallable_DECL_CALL (GetEntryPoint)
 
 PyCallable_DECL_CALL (GotoLocation)
 
 PyCallable_DECL_CALL (WarpToLocation)
 
- Public Member Functions inherited from PyBoundObject
 PyBoundObject (PyServiceMgr *mgr)
 
virtual ~PyBoundObject ()
 
uint32 nodeID () const
 
uint32 bindID () const
 
std::string GetBindStr () const
 
const char * GetName () const
 
virtual PyResult Call (const std::string &method, PyCallArgs &args)
 
- Public Member Functions inherited from PyCallable
 PyCallable ()
 
virtual ~PyCallable ()
 

Public Attributes

Agentagt
 

Protected Attributes

Agentm_agent
 
Dispatcher * m_dispatch
 
- Protected Attributes inherited from PyBoundObject
PyServiceMgr *const m_manager
 
std::string m_strBoundObjectName
 

Private Member Functions

AgentBound.cpp

agent specific code removed from AgentMgrService.cpp

: Allan

Date
: 26 June 2018
PyTupleGetMissionObjectives (Client *pClient, MissionOffer &offer)
 
PyDictGetMissionObjectiveInfo (Client *pClient, MissionOffer &offer)
 

Additional Inherited Members

- Protected Member Functions inherited from PyBoundObject
void _SetNodeBindID (uint32 nodeID, uint32 bindID)
 
- Protected Member Functions inherited from PyCallable
void _SetCallDispatcher (CallDispatcher *d)
 

Detailed Description

Definition at line 21 of file AgentBound.h.

Constructor & Destructor Documentation

virtual AgentBound::~AgentBound ( )
inlinevirtual

Definition at line 30 of file AgentBound.h.

References m_dispatch.

30 { delete m_dispatch; }
Dispatcher * m_dispatch
Definition: AgentBound.h:53

Member Function Documentation

PyDict * AgentBound::GetMissionObjectiveInfo ( Client pClient,
MissionOffer offer 
)
private

Definition at line 605 of file AgentBound.cpp.

References _log, PyList::AddItem(), MissionOffer::bonusTime, MissionOffer::characterID, Mission::Status::Complete, MissionOffer::dateAccepted, MissionOffer::dateIssued, MissionOffer::destinationSystemID, PyRep::Dump(), GetMissionObjectives(), MissionOffer::important, Mission::Status::Incomplete, is_log_enabled, Client::IsMissionComplete(), itemTypeCredits, itemTypeTrit, EvE::Time::Minute, MissionOffer::missionID, MissionOffer::originSystemID, MissionOffer::rewardISK, MissionOffer::rewardItemID, MissionOffer::rewardItemQty, PyTuple::SetItem(), PyDict::SetItemString(), and MissionOffer::stateID.

606 {
607  PyDict* objectiveData = new PyDict();
608  objectiveData->SetItemString("missionTitleID", new PyInt(offer.missionID));
609  objectiveData->SetItemString("contentID", new PyInt(offer.characterID));
610  objectiveData->SetItemString("importantStandings", new PyInt(offer.important)); // boolean integer
611  // will need to test for this to set correctly.....
612  if (pClient->IsMissionComplete(offer)) { // Mission::Status:: data here 0=no, 1=yes, 2=cheat
613  objectiveData->SetItemString("completionStatus", new PyInt(Mission::Status::Complete));
614  } else {
615  objectiveData->SetItemString("completionStatus", new PyInt(Mission::Status::Incomplete));
616  }
617  objectiveData->SetItemString("missionState", new PyInt(offer.stateID /*Mission::State::Offered*/)); // Mission::State:: data here for agentGift populating. Accepted/failed to display gift items as accepted
618  objectiveData->SetItemString("loyaltyPoints", new PyInt(0));
619  objectiveData->SetItemString("researchPoints", new PyInt(0));
620 
621  /* this puts title/msg at bottom of right pane
622  if (offer.stateID == Mission::State::Accepted)
623  if (offer.typeID == Mission::Type::Courier) {
624  PyTuple* missionExtra = new PyTuple(2); // this is tuple(2) headerID, bodyID -- std locale msgIDs
625  missionExtra->SetItem(0, new PyString("Reminder....")); // this should be separate title from mission name
626  missionExtra->SetItem(1, new PyString("Remember to get the %s from your hangar before you leave.", call.client->GetCourierItemRef(m_agent->GetID())->name())); // this is additional info about mission, etc.
627  objectiveData->SetItemString("missionExtra", missionExtra);
628  } */
629 
630  PyList* locList = new PyList(); // tuple of list of locationIDs (pickup and dropoff)
631  locList->AddItem(new PyInt(offer.originSystemID));
632  locList->AddItem(new PyInt(offer.destinationSystemID));
633  objectiveData->SetItemString("locations", locList);
634 
635  PyList* giftList = new PyList(); // this is list of tuple(3) typeID, quantity, extra
636  /*
637  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
638  extra->SetItemString("specificItemID", PyStatic.NewNone());
639  extra->SetItemString("blueprintInfo", PyStatic.NewNone());
640  PyTuple* agentGift = new PyTuple(3);
641  agentGift->SetItem(0, PyStatic.NewNone());
642  agentGift->SetItem(1, PyStatic.NewNone());
643  agentGift->SetItem(2, extra);
644  giftList->AddItem(agentGift);
645  */
646  objectiveData->SetItemString("agentGift", giftList);
647 
648  PyList* normList = new PyList(); // this is list of tuple(3) typeID, quantity, extra
649  if (offer.rewardISK) {
650  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
651  //extra->SetItemString("specificItemID", PyStatic.NewNone());
652  //extra->SetItemString("blueprintInfo", PyStatic.NewNone());
653  PyTuple* normalRewards = new PyTuple(3);
654  normalRewards->SetItem(0, new PyInt(itemTypeCredits));
655  normalRewards->SetItem(1, new PyInt(offer.rewardISK));
656  normalRewards->SetItem(2, extra);
657  normList->AddItem(normalRewards);
658  }
659  if (offer.rewardItemID) {
660  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
661  //extra->SetItemString("specificItemID", PyStatic.NewNone());
662  //extra->SetItemString("blueprintInfo", PyStatic.NewNone());
663  PyTuple* normalRewards = new PyTuple(3);
664  normalRewards->SetItem(0, new PyInt(offer.rewardItemID));
665  normalRewards->SetItem(1, new PyInt(offer.rewardItemQty));
666  normalRewards->SetItem(2, extra);
667  normList->AddItem(normalRewards);
668  }
669  objectiveData->SetItemString("normalRewards", normList);
670 
671  PyList* collateralList = new PyList(); // this is list of tuple(3) typeID, quantity, extra
672  /*
673  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
674  extra->SetItemString("specificItemID", PyStatic.NewNone());
675  extra->SetItemString("blueprintInfo", PyStatic.NewNone());
676  PyTuple* collateral = new PyTuple(3);
677  collateral->SetItem(0, PyStatic.NewNone());
678  collateral->SetItem(1, PyStatic.NewNone());
679  collateral->SetItem(2, extra);
680  */
681  objectiveData->SetItemString("collateral", collateralList);
682 
683  PyList* bonusList = new PyList(); // this is list of tuple(4) timeRemaining, typeID, quantity, extra
684  if (offer.bonusTime > 0) {
685  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
686  //extra->SetItemString("specificItemID", PyStatic.NewNone());
687  //extra->SetItemString("blueprintInfo", PyStatic.NewNone());
688  PyTuple* bonusRewards = new PyTuple(4);
689  if (offer.dateAccepted > 0) {
690  bonusRewards->SetItem(0, new PyLong(offer.bonusTime - (offer.dateAccepted - offer.dateIssued) * EvE::Time::Minute)); // bonus time - elapsed time * minutes
691  } else {
692  bonusRewards->SetItem(0, new PyLong(offer.bonusTime * EvE::Time::Minute)); // bonus time * minutes
693  }
694  bonusRewards->SetItem(1, new PyInt(itemTypeCredits)); // bonus is *usually* isk. for now, we'll keep it as isk (easier)
695  bonusRewards->SetItem(2, new PyInt(offer.rewardISK *2));
696  bonusRewards->SetItem(3, extra);
697  bonusList->AddItem(bonusRewards);
698  }
699  // bonusList can be multiple items, usualy only item or isk for time bonus
700  if (false/*bonus2*/) {
701  PyDict* extra = new PyDict(); // 'extra' is either specificItemID or blueprint data.
702  //extra->SetItemString("specificItemID", PyStatic.NewNone());
703  //extra->SetItemString("blueprintInfo", PyStatic.NewNone());
704  PyTuple* bonusRewards2 = new PyTuple(4);
705  bonusRewards2->SetItem(0, new PyLong(12000000000)); //20m
706  bonusRewards2->SetItem(1, new PyInt(itemTypeTrit));
707  bonusRewards2->SetItem(2, new PyInt(offer.rewardISK));
708  bonusRewards2->SetItem(3, extra);
709  bonusList->AddItem(bonusRewards2);
710  }
711  objectiveData->SetItemString("bonusRewards", bonusList);
712  /* for collateral and rewards, as follows...
713  typeID, quantity, extra in objectiveData['normalRewards']
714  typeID, quantity, extra in objectiveData['collateral']
715  typeID, quantity, extra in objectiveData['agentGift']
716  or
717  timeRemaining, typeID, quantity, extra in objectiveData['bonusRewards']
718 
719  specificItemID = extra.get('specificItemID', 0)
720  blueprintInfo = extra.get('blueprintInfo', None)
721  */
722 
723  objectiveData->SetItemString("objectives", GetMissionObjectives(pClient, offer));
724  PyList* dunList = new PyList(); // this is a list of dunData dicts
725  /*
726  PyDict* dunData = new PyDict();
727  dunData->SetItemString("dungeonID", new PyInt(1000));
728  dunData->SetItemString("completionStatus", new PyInt(Dungeon::Status::Started));
729  dunData->SetItemString("optional", new PyInt());
730  dunData->SetItemString("briefingMessage", new PyInt());
731  dunData->SetItemString("objectiveCompleted", new PyBool(false));
732  dunData->SetItemString("ownerID", new PyInt(m_agent->GetID()));
733  dunData->SetItemString("shipRestrictions", new PyInt(0)); // 0=normal 1=special with link to *something else*
734  dunData->SetItemString("location", m_agent->GetLocationWrap());
735  */
736  objectiveData->SetItemString("dungeons", dunList);
737  /* dunData data....
738  * dungeonID
739  * completionStatus
740  * optional
741  * briefingMessage
742  * objectiveCompleted
743  * ownerID
744  * location
745  location['locationID']
746  location['locationType']
747  location['solarsystemID']
748  location['coords']
749  location['agentID']
750  ?location['referringAgentID']
751  ?location['shipTypeID']
752  * shipRestrictions 0=normal 1=special with link to *something else*
753  */
754 
755  if (is_log_enabled(AGENT__RSP_DUMP)) {
756  _log(AGENT__RSP_DUMP, "AgentBound::Handle_GetMissionObjectiveInfo() RSP:" );
757  objectiveData->Dump(AGENT__RSP_DUMP, " ");
758  }
759 
760  return objectiveData;
761 }
double dateAccepted
Definition: EVE_Missions.h:60
uint16 missionID
Definition: EVE_Missions.h:34
#define _log(type, fmt,...)
Definition: logsys.h:124
Python's dictionary.
Definition: PyRep.h:719
double dateIssued
Definition: EVE_Missions.h:59
bool IsMissionComplete(MissionOffer &data)
Definition: Client.cpp:1764
uint32 characterID
Definition: EVE_Missions.h:45
Python tuple.
Definition: PyRep.h:567
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
void AddItem(PyRep *i)
Definition: PyRep.h:701
uint16 rewardItemQty
Definition: EVE_Missions.h:37
#define is_log_enabled(type)
Definition: logsys.h:78
uint32 originSystemID
Definition: EVE_Missions.h:50
uint32 destinationSystemID
Definition: EVE_Missions.h:53
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
uint16 bonusTime
Definition: EVE_Missions.h:33
Python integer.
Definition: PyRep.h:231
uint32 rewardISK
Definition: EVE_Missions.h:46
uint16 rewardItemID
Definition: EVE_Missions.h:36
PyTuple * GetMissionObjectives(Client *pClient, MissionOffer &offer)
Definition: AgentBound.cpp:763
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

PyTuple * AgentBound::GetMissionObjectives ( Client pClient,
MissionOffer offer 
)
private

Definition at line 763 of file AgentBound.cpp.

References MissionOffer::agentID, Mission::Type::Anomic, Mission::Type::Arc, Mission::Type::Burner, Client::ContainsTypeQty(), Mission::Type::Cosmos, Mission::Type::Courier, MissionOffer::courierAmount, MissionOffer::courierItemVolume, MissionOffer::courierTypeID, Mission::Type::Data, MissionOffer::destinationID, MissionOffer::destinationOwnerID, MissionOffer::destinationSystemID, MissionOffer::destinationTypeID, Mission::Type::Encounter, Agent::GetLocTypeID(), m_agent, Mission::Type::Mining, MissionOffer::originID, MissionOffer::originOwnerID, MissionOffer::originSystemID, PyStatic, Mission::Type::Research, sDataMgr, PyTuple::SetItem(), PyDict::SetItemString(), Mission::Type::Storyline, Mission::Type::Trade, Mission::Type::Tutorial, and MissionOffer::typeID.

Referenced by GetMissionObjectiveInfo().

764 {
765  // set mission objectiveData based on mission type.
766  PyDict* dropoffLocation = new PyDict();
767  if (sDataMgr.IsStation(offer.destinationID)) {
768  dropoffLocation->SetItemString("typeID", new PyInt(offer.destinationTypeID) );
769  dropoffLocation->SetItemString("locationID", new PyInt(offer.destinationID) );
770  dropoffLocation->SetItemString("solarsystemID", new PyInt(offer.destinationSystemID) );
771  } else {
772  dropoffLocation->SetItemString("shipTypeID", new PyInt(offer.destinationTypeID) );
773  dropoffLocation->SetItemString("agentID", new PyInt(offer.destinationOwnerID) );
774  // get agent in space location and set here
775  PyTuple* coords = new PyTuple(3);
776  coords->SetItem(0, new PyFloat(0)); //x
777  coords->SetItem(1, new PyFloat(0)); //y
778  coords->SetItem(2, new PyFloat(0)); //z
779  dropoffLocation->SetItemString("coords", coords);
780  dropoffLocation->SetItemString("referringAgentID", new PyInt(offer.agentID) );
781  }
782 
783  PyTuple* objectives = new PyTuple(1);
784  switch (offer.typeID) {
786  case Mission::Type::Courier: {
787  PyDict* pickupLocation = new PyDict();
788  pickupLocation->SetItemString("typeID", new PyInt(m_agent->GetLocTypeID()) );
789  pickupLocation->SetItemString("locationID", new PyInt(offer.originID) );
790  pickupLocation->SetItemString("solarsystemID", new PyInt(offer.originSystemID) );
791  PyDict* cargo = new PyDict();
792  cargo->SetItemString("hasCargo", new PyBool(pClient->ContainsTypeQty(offer.courierTypeID, offer.courierAmount)));
793  cargo->SetItemString("typeID", new PyInt(offer.courierTypeID));
794  cargo->SetItemString("quantity", new PyInt(offer.courierAmount));
795  cargo->SetItemString("volume", new PyFloat(offer.courierItemVolume * offer.courierAmount)); // calculated shipment volume. *this is direct to window*
796  PyTuple* objData = new PyTuple(5);
797  objData->SetItem(0, new PyInt(offer.originOwnerID));
798  objData->SetItem(1, pickupLocation/*m_agent->GetLocationWrap()*/);
799  objData->SetItem(2, new PyInt(offer.destinationOwnerID));
800  objData->SetItem(3, dropoffLocation/*m_agent->GetLocationWrap()*/);
801  objData->SetItem(4, cargo);
802  PyTuple* objType = new PyTuple(2); // this is list of tuple(2) objType, objData
803  objType->SetItem(0, new PyString("transport"));
804  objType->SetItem(1, objData);
805  objectives->SetItem(0, objType);
806  } break;
808  case Mission::Type::Mining: {
809  PyDict* cargo = new PyDict();
810  cargo->SetItemString("hasCargo", new PyBool(pClient->ContainsTypeQty(offer.courierTypeID, offer.courierAmount)));
811  cargo->SetItemString("typeID", new PyInt(offer.courierTypeID));
812  cargo->SetItemString("quantity", new PyInt(offer.courierAmount));
813  cargo->SetItemString("volume", new PyFloat(offer.courierItemVolume * offer.courierAmount)); // calculated shipment volume. *this is direct to window*
814  PyTuple* objData = new PyTuple(3);
815  objData->SetItem(0, new PyInt(offer.destinationOwnerID));
816  objData->SetItem(1, dropoffLocation/*m_agent->GetLocationWrap()*/);
817  objData->SetItem(2, cargo);
818  PyTuple* objType = new PyTuple(2); // this is list of tuple(2) objType, objData
819  objType->SetItem(0, new PyString("fetch"));
820  objType->SetItem(1, objData);
821  objectives->SetItem(0, objType);
822  } break;
824  case Mission::Type::Arc:
827  case Mission::Type::Data:
831  objectives->SetItem(0, PyStatic.NewNone());
832  } break;
833  }
834 
835  return objectives;
836 
837  /* objectives data...
838  if objType == 'agent': -- report to agent
839  agentID, agentLocation = objData
840  agentLocation['locationID']
841  agentLocation['locationType']
842  agentLocation['solarsystemID']
843  if not in station
844  agentLocation['coords']
845  agentLocation['agentID']
846  ?agentLocation['referringAgentID']
847  ?agentLocation['shipTypeID']
848 
849  elif objType == 'transport': -- courier and trade missions
850  pickupOwnerID, pickupLocation, dropoffOwnerID, dropoffLocation, cargo = objData
851  pickupLocation['locationID']
852  pickupLocation['locationType']
853  pickupLocation['solarsystemID']
854  dropoffLocation['locationID']
855  dropoffLocation['locationType']
856  dropoffLocation['solarsystemID']
857  if not in station
858  dropoffLocation['coords']
859  dropoffLocation['agentID']
860  ?dropoffLocation['referringAgentID']
861  ?dropoffLocation['shipTypeID']
862  cargo['hasCargo']
863  cargo['typeID']
864  cargo['volume']
865  cargo['quantity']
866 
867  elif objType == 'fetch': -- encounter and mining missions
868  dropoffOwnerID, dropoffLocation, cargo = objData
869  dropoffLocation['locationID']
870  dropoffLocation['locationType']
871  dropoffLocation['solarsystemID']
872  if not in station
873  dropoffLocation['coords']
874  dropoffLocation['agentID']
875  ?dropoffLocation['referringAgentID']
876  ?dropoffLocation['shipTypeID']
877  cargo['hasCargo']
878  cargo['typeID']
879  cargo['volume']
880  cargo['quantity']
881  */
882 }
Python string.
Definition: PyRep.h:430
uint32 agentID
Definition: EVE_Missions.h:42
Python's dictionary.
Definition: PyRep.h:719
uint16 destinationTypeID
Definition: EVE_Missions.h:40
Python floating point number.
Definition: PyRep.h:292
float courierItemVolume
Definition: EVE_Missions.h:57
Python tuple.
Definition: PyRep.h:567
bool ContainsTypeQty(uint16 typeID, uint32 qty) const
Definition: Client.cpp:1744
Agent * m_agent
Definition: AgentBound.h:52
Python boolean.
Definition: PyRep.h:323
uint32 originSystemID
Definition: EVE_Missions.h:50
uint32 destinationSystemID
Definition: EVE_Missions.h:53
uint16 courierTypeID
Definition: EVE_Missions.h:38
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
uint32 destinationOwnerID
Definition: EVE_Missions.h:52
uint16 courierAmount
Definition: EVE_Missions.h:39
uint32 GetLocTypeID()
Definition: Agent.h:41
uint32 destinationID
Definition: EVE_Missions.h:51
uint32 originID
Definition: EVE_Missions.h:48
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
uint32 originOwnerID
Definition: EVE_Missions.h:49
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

AgentBound::PyCallable_DECL_CALL ( DoAction  )
AgentBound::PyCallable_DECL_CALL ( GetMyJournalDetails  )
AgentBound::PyCallable_DECL_CALL ( GetAgentLocationWrap  )
AgentBound::PyCallable_DECL_CALL ( GetInfoServiceDetails  )
AgentBound::PyCallable_DECL_CALL ( GetMissionKeywords  )
AgentBound::PyCallable_DECL_CALL ( GetMissionJournalInfo  )
AgentBound::PyCallable_DECL_CALL ( GetMissionBriefingInfo  )
AgentBound::PyCallable_DECL_CALL ( GetMissionObjectiveInfo  )
AgentBound::PyCallable_DECL_CALL ( GetDungeonShipRestrictions  )
AgentBound::PyCallable_DECL_CALL ( RemoveOfferFromJournal  )
AgentBound::PyCallable_DECL_CALL ( GetOfferJournalInfo  )
AgentBound::PyCallable_DECL_CALL ( GetEntryPoint  )
AgentBound::PyCallable_DECL_CALL ( GotoLocation  )
AgentBound::PyCallable_DECL_CALL ( WarpToLocation  )
AgentBound::PyCallable_Make_Dispatcher ( AgentBound  )
virtual void AgentBound::Release ( )
inlinevirtual

Implements PyBoundObject.

Definition at line 31 of file AgentBound.h.

31  {
32  //I hate this statement
33  delete this;
34  }

Member Data Documentation

Agent* AgentBound::agt

Definition at line 28 of file AgentBound.h.

Agent* AgentBound::m_agent
protected

Definition at line 52 of file AgentBound.h.

Referenced by GetMissionObjectives().

Dispatcher* AgentBound::m_dispatch
protected

Definition at line 53 of file AgentBound.h.

Referenced by ~AgentBound().


The documentation for this class was generated from the following files: