27 #include "../common/logsys.h"
28 #include "../common/PyPacket.h"
29 #include "../common/PyRep.h"
30 #include "../common/PyVisitor.h"
31 #include "../packets/AccountPkts.h"
32 #include "../packets/General.h"
33 #include "../packets/Destiny.h"
34 #include "../common/PyDumpVisitor.h"
35 #include "../common/PyXMLGenerator.h"
36 #include "../common/CachedObjectMgr.h"
37 #include "../common/RowsetReader.h"
38 #include "../common/DestinyBinDump.h"
46 DoDestinyUpdateMain dumain;
47 DoDestinyUpdateMain_2 dumain2;
48 PyRepList::iterator cur, end;
52 if(!dumain2.Decode(¬ify->
args)) {
54 codelog(COLLECT__ERROR,
"Unable to decode destiny update main (2).");
57 cur = dumain2.updates.begin();
58 end = dumain2.updates.end();
60 if(!dumain.Decode(¬ify->
args)) {
62 codelog(COLLECT__ERROR,
"Unable to decode destiny update main.");
65 cur = dumain.updates.begin();
66 end = dumain.updates.end();
70 for(; cur != end; cur++) {
74 _log(COLLECT__DESTINY_REP,
"DoDestinyUpdate Action:");
75 PyLookupDump dumper(&
lookResolver, COLLECT__DESTINY_REP);
78 DoDestinyAction action;
79 if(!action.Decode(&r)) {
80 codelog(COLLECT__ERROR,
"Unable to decode destiny update action");
85 if(!action.update->CheckType(PyRep::Tuple)) {
86 codelog(COLLECT__ERROR,
"Expected tuple in DoDestinyAction, got %s", action.update->TypeString());
89 PyRepTuple *t = (PyRepTuple *) action.update;
90 if(t->items.size() != 2) {
91 codelog(COLLECT__ERROR,
"Expected size 2 tuple in DoDestinyAction, got %d", t->items.size());
94 if(!t->items[0]->CheckType(PyRep::String)) {
95 codelog(COLLECT__ERROR,
"Expected string in DoDestinyAction update type, got %s", t->items[0]->TypeString());
99 PyRepString *updtype = (PyRepString *) t->items[0];
101 _log(COLLECT__NOTIFY_SUMMARY,
" Destiny Update: %s", updtype->value.c_str());
104 std::map<std::string, _DestinyDispatch>::const_iterator res;
107 _log(COLLECT__DESTINY,
"Dispatching action '%s' with ID %d", updtype->value.c_str(), action.update_id);
109 (this->*dsp)(packet, &action);
112 dumain.updates.items.clear();
115 void EVECollectDispatcher::Destiny_AddBalls(
const PyPacket *packet, DoDestinyAction *action) {
116 DoDestiny_AddBalls upd;
117 if(!upd.Decode(&action->update)) {
118 codelog(COLLECT__ERROR,
"Failed to decode arguments");
122 const byte *data = upd.destiny_binary->GetBuffer();
123 uint32 len = upd.destiny_binary->GetLength();
125 _log(COLLECT__DESTINY_HEX,
"AddBalls binary data:");
126 _hex(COLLECT__DESTINY_HEX, data, len);
132 void EVECollectDispatcher::Destiny_SetState(
const PyPacket *packet, DoDestinyAction *action) {
133 DoDestiny_SetState upd;
134 if(!upd.Decode(&action->update)) {
135 codelog(COLLECT__ERROR,
"Failed to decode arguments");
139 const byte *data = upd.destiny_state->GetBuffer();
140 uint32 len = upd.destiny_state->GetLength();
142 _log(COLLECT__DESTINY_HEX,
"SetState binary data: (ego=%u)", upd.ego);
143 _hex(COLLECT__DESTINY_HEX, data, len);
#define _log(type, fmt,...)
#define _hex(type, data, len)
#define codelog(type, fmt,...)
PyLookupResolver lookResolver
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
std::map< std::string, _DestinyDispatch > m_destinyDisp
void(EVECollectDispatcher::* _DestinyDispatch)(const PyPacket *packet, DoDestinyAction *action)
virtual bool visit(PyVisitor &v) const =0
Visits object.