EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AggressionMgrService.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: caytchen
24 */
25 
26 #include "eve-server.h"
27 
28 #include "PyBoundObject.h"
29 #include "PyServiceCD.h"
31 
33 
34 class AggressionMgrBound
35 : public PyBoundObject
36 {
37 public:
38  PyCallable_Make_Dispatcher(AggressionMgrBound)
39 
40  AggressionMgrBound(PyServiceMgr* mgr)
41  : PyBoundObject(mgr), m_dispatch(new Dispatcher(this))
42  {
43  _SetCallDispatcher(m_dispatch);
44 
45  m_strBoundObjectName = "AggressionMgrBound";
46 
47  PyCallable_REG_CALL(AggressionMgrBound, GetCriminalTimeStamps);
48  PyCallable_REG_CALL(AggressionMgrBound, CheckLootRightExceptions);
49  }
50 
52  {
53  delete m_dispatch;
54  }
55 
56  virtual void Release()
57  {
58  // this is not recommended
59  delete this;
60  }
61 
62 protected:
63  PyCallable_DECL_CALL(GetCriminalTimeStamps);
64  PyCallable_DECL_CALL(CheckLootRightExceptions);
65 
66  Dispatcher *const m_dispatch;
67 };
68 
69 PyResult AggressionMgrBound::Handle_GetCriminalTimeStamps(PyCallArgs &call)
70 {
71  // arguments: charID
72  Call_SingleIntegerArg arg;
73  if (!arg.Decode(&call.tuple)) {
74  _log(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
75  return nullptr;
76  }
77 
78  return new PyDict();
79 }
80 
81 PyResult AggressionMgrBound::Handle_CheckLootRightExceptions(PyCallArgs &call)
82 {
83  // arguments: containerID
84  Call_SingleIntegerArg arg;
85  if (!arg.Decode(&call.tuple)) {
86  _log(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
87  return nullptr;
88  }
89 
90  // return true to allow looting
91  return new PyBool(true);
92 }
93 
95 : PyService(mgr, "aggressionMgr"), m_dispatch(new Dispatcher(this))
96 {
98 }
99 
101 {
102  delete m_dispatch;
103 }
104 
106 {
107  _log(CLIENT__MESSAGE, "AggressionMgrService bind request for:");
108  bind_args->Dump(CLIENT__MESSAGE, " ");
109  /*
110  * 18:26:21 [ClientMessage] AggressionMgrService bind request for:
111  * 18:26:21 [ClientMessage] Integer field: 30002547 <<-- systemID
112  */
113 
115  // this obj is system-wide, per system. bound object can be used for multiple clients
116  return (new AggressionMgrBound(m_manager));
117 }
Base Python wire object.
Definition: PyRep.h:66
Dispatcher *const m_dispatch
virtual void Release()
#define _log(type, fmt,...)
Definition: logsys.h:124
Python's dictionary.
Definition: PyRep.h:719
virtual ~AggressionMgrBound()
AggressionMgrService(PyServiceMgr *mgr)
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
void _SetCallDispatcher(CallDispatcher *d)
Definition: PyCallable.h:87
Python boolean.
Definition: PyRep.h:323
Dispatcher *const m_dispatch
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
PyServiceMgr *const m_manager
Definition: PyService.h:91
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
Definition: Client.h:66
#define PyCallable_Make_Dispatcher(objname)
Definition: PyServiceCD.h:81
PyCallable_DECL_CALL(GetCriminalTimeStamps)
PyCallable_Make_InnerDispatcher(AggressionMgrService) class AggressionMgrBound
PyTuple * tuple
Definition: PyCallable.h:50