EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TradeService.h
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: Luck
24  Updates: Allan
25 */
26 
27 #ifndef __TRADE_SERVICE_H_INCL__
28 #define __TRADE_SERVICE_H_INCL__
29 
30 #include "PyService.h"
31 #include "packets/Trade.h"
32 
33 class Client;
34 class TradeBound;
35 
36 class TradeService : public PyService
37 {
38 public:
40  virtual ~TradeService();
41 
43 
44  void InitiateTrade(Client* pClient, PyRep* resp);
45  void RemoveActiveSession(uint32 myID);
46 
47  void CancelTrade(Client* pClient);
48  void TransferContainerContents(SystemManager* pSysMgr, InventoryItemRef itemRef, uint32 newOwnerID);
49 
50  struct ActiveSession {
55  };
56  std::map<uint32, ActiveSession> m_activeSessions; // mapped as myID, ActiveSession
57 
58 protected:
59  class Dispatcher;
60  Dispatcher* const m_dispatch;
62 
63  virtual PyBoundObject* CreateBoundObject(Client* pClient, const PyRep* bind_args);
64 
65  PyCallable_DECL_CALL(InitiateTrade);
66 
68 
69 };
70 
72 {
73  friend class TradeBound;
74  friend class TradeService;
75 
76 public:
79 
80  struct Session {
85  bool myState;
86  bool herState;
87  double myMoney;
88  double herMoney;
90  };
91 
92  struct TradeItems {
101  bool singleton;
102  std::string customInfo;
103  };
104 
105  Session m_tradeSession; // 2 party trade session of this bound object
106 
107  std::list<TradeItems> m_tradelist; //list of items for this trade session
108 
109 };
110 
111 #endif//__TRADE_SERVICE_H_INCL__
TradeService(PyServiceMgr *mgr)
Base Python wire object.
Definition: PyRep.h:66
uint32 m_SessionID
Definition: TradeService.h:67
std::map< uint32, ActiveSession > m_activeSessions
Definition: TradeService.h:56
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
PyCallable_DECL_CALL(InitiateTrade)
void TransferContainerContents(SystemManager *pSysMgr, InventoryItemRef itemRef, uint32 newOwnerID)
void CancelTrade(Client *pClient)
uint32 GetTradeSessionID()
Session m_tradeSession
Definition: TradeService.h:105
void InitiateTrade(Client *pClient, PyRep *resp)
Definition: Client.h:66
PyServiceMgr * m_SvcMgr
Definition: TradeService.h:61
unsigned __int32 uint32
Definition: eve-compat.h:50
void RemoveActiveSession(uint32 myID)
signed __int64 int64
Definition: eve-compat.h:51
Dispatcher *const m_dispatch
Definition: TradeService.h:59
std::list< TradeItems > m_tradelist
Definition: TradeService.h:107
virtual ~TradeService()