Otclient  14/8/2020
protocolgamesend.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #include "protocolgame.h"
24 #include "game.h"
25 #include "client.h"
28 #include <framework/util/crypt.h>
29 
30 void ProtocolGame::send(const OutputMessagePtr& outputMessage)
31 {
32  // avoid usage of automated sends (bot modules)
34  return;
35  Protocol::send(outputMessage);
36 }
37 
38 void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
39 {
40  if(m_enableSendExtendedOpcode) {
42  msg->addU8(Proto::ClientExtendedOpcode);
43  msg->addU8(opcode);
44  msg->addString(buffer);
45  send(msg);
46  } else {
47  g_logger.error(stdext::format("Unable to send extended opcode %d, extended opcodes are not enabled", opcode));
48  }
49 }
50 
51 void ProtocolGame::sendLoginPacket(uint challengeTimestamp, uint8 challengeRandom)
52 {
54 
55  msg->addU8(Proto::ClientPendingGame);
56  msg->addU16(g_game.getOs());
57  msg->addU16(g_game.getProtocolVersion());
58 
60  msg->addU32(g_game.getClientVersion());
61 
63  msg->addU16(g_things.getContentRevision());
64 
66  msg->addU8(0);
67 
68  int offset = msg->getMessageSize();
69  // first RSA byte must be 0
70  msg->addU8(0);
71 
73  // xtea key
75  msg->addU32(m_xteaKey[0]);
76  msg->addU32(m_xteaKey[1]);
77  msg->addU32(m_xteaKey[2]);
78  msg->addU32(m_xteaKey[3]);
79  msg->addU8(0); // is gm set?
80  }
81 
83  msg->addString(m_sessionKey);
84  msg->addString(m_characterName);
85  } else {
87  msg->addString(m_accountName);
88  else
89  msg->addU32(stdext::from_string<uint32>(m_accountName));
90 
91  msg->addString(m_characterName);
92  msg->addString(m_accountPassword);
93 
95  msg->addString(m_authenticatorToken);
96  }
97 
99  msg->addU32(challengeTimestamp);
100  msg->addU8(challengeRandom);
101  }
102 
103  std::string extended = callLuaField<std::string>("getLoginExtendedData");
104  if(!extended.empty())
105  msg->addString(extended);
106 
107  // complete the bytes for rsa encryption with zeros
108  int paddingBytes = g_crypt.rsaGetSize() - (msg->getMessageSize() - offset);
109  assert(paddingBytes >= 0);
110  msg->addPaddingBytes(paddingBytes);
111 
112  // encrypt with RSA
114  msg->encryptRsa();
115 
117  enableChecksum();
118 
119  send(msg);
120 
123 }
124 
126 {
128  msg->addU8(Proto::ClientEnterGame);
129  send(msg);
130 }
131 
133 {
135  msg->addU8(Proto::ClientLeaveGame);
136  send(msg);
137 }
138 
140 {
142  sendExtendedOpcode(2, "");
143  else {
145  msg->addU8(Proto::ClientPing);
146  Protocol::send(msg);
147  }
148 }
149 
151 {
153  msg->addU8(Proto::ClientPingBack);
154  send(msg);
155 }
156 
157 void ProtocolGame::sendAutoWalk(const std::vector<Otc::Direction>& path)
158 {
160  msg->addU8(Proto::ClientAutoWalk);
161  msg->addU8(path.size());
162  for(Otc::Direction dir : path) {
163  uint8 byte;
164  switch(dir) {
165  case Otc::East:
166  byte = 1;
167  break;
168  case Otc::NorthEast:
169  byte = 2;
170  break;
171  case Otc::North:
172  byte = 3;
173  break;
174  case Otc::NorthWest:
175  byte = 4;
176  break;
177  case Otc::West:
178  byte = 5;
179  break;
180  case Otc::SouthWest:
181  byte = 6;
182  break;
183  case Otc::South:
184  byte = 7;
185  break;
186  case Otc::SouthEast:
187  byte = 8;
188  break;
189  default:
190  byte = 0;
191  break;
192  }
193  msg->addU8(byte);
194  }
195  send(msg);
196 }
197 
199 {
201  msg->addU8(Proto::ClientWalkNorth);
202  send(msg);
203 }
204 
206 {
208  msg->addU8(Proto::ClientWalkEast);
209  send(msg);
210 }
211 
213 {
215  msg->addU8(Proto::ClientWalkSouth);
216  send(msg);
217 }
218 
220 {
222  msg->addU8(Proto::ClientWalkWest);
223  send(msg);
224 }
225 
227 {
229  msg->addU8(Proto::ClientStop);
230  send(msg);
231 }
232 
234 {
236  msg->addU8(Proto::ClientWalkNorthEast);
237  send(msg);
238 }
239 
241 {
243  msg->addU8(Proto::ClientWalkSouthEast);
244  send(msg);
245 }
246 
248 {
250  msg->addU8(Proto::ClientWalkSouthWest);
251  send(msg);
252 }
253 
255 {
257  msg->addU8(Proto::ClientWalkNorthWest);
258  send(msg);
259 }
260 
262 {
264  msg->addU8(Proto::ClientTurnNorth);
265  send(msg);
266 }
267 
269 {
271  msg->addU8(Proto::ClientTurnEast);
272  send(msg);
273 }
274 
276 {
278  msg->addU8(Proto::ClientTurnSouth);
279  send(msg);
280 }
281 
283 {
285  msg->addU8(Proto::ClientTurnWest);
286  send(msg);
287 }
288 
289 void ProtocolGame::sendEquipItem(int itemId, int countOrSubType)
290 {
292  msg->addU8(Proto::ClientEquipItem);
293  msg->addU16(itemId);
294  msg->addU8(countOrSubType);
295  send(msg);
296 }
297 
298 void ProtocolGame::sendMove(const Position& fromPos, int thingId, int stackpos, const Position& toPos, int count)
299 {
301  msg->addU8(Proto::ClientMove);
302  addPosition(msg, fromPos);
303  msg->addU16(thingId);
304  msg->addU8(stackpos);
305  addPosition(msg, toPos);
306  msg->addU8(count);
307  send(msg);
308 }
309 
310 void ProtocolGame::sendInspectNpcTrade(int itemId, int count)
311 {
313  msg->addU8(Proto::ClientInspectNpcTrade);
314  msg->addU16(itemId);
315  msg->addU8(count);
316  send(msg);
317 }
318 
319 void ProtocolGame::sendBuyItem(int itemId, int subType, int amount, bool ignoreCapacity, bool buyWithBackpack)
320 {
322  msg->addU8(Proto::ClientBuyItem);
323  msg->addU16(itemId);
324  msg->addU8(subType);
325  msg->addU8(amount);
326  msg->addU8(ignoreCapacity ? 0x01 : 0x00);
327  msg->addU8(buyWithBackpack ? 0x01 : 0x00);
328  send(msg);
329 }
330 
331 void ProtocolGame::sendSellItem(int itemId, int subType, int amount, bool ignoreEquipped)
332 {
334  msg->addU8(Proto::ClientSellItem);
335  msg->addU16(itemId);
336  msg->addU8(subType);
338  msg->addU16(amount);
339  else
340  msg->addU8(amount);
341  msg->addU8(ignoreEquipped ? 0x01 : 0x00);
342  send(msg);
343 }
344 
346 {
348  msg->addU8(Proto::ClientCloseNpcTrade);
349  send(msg);
350 }
351 
352 void ProtocolGame::sendRequestTrade(const Position& pos, int thingId, int stackpos, uint creatureId)
353 {
355  msg->addU8(Proto::ClientRequestTrade);
356  addPosition(msg, pos);
357  msg->addU16(thingId);
358  msg->addU8(stackpos);
359  msg->addU32(creatureId);
360  send(msg);
361 }
362 
363 void ProtocolGame::sendInspectTrade(bool counterOffer, int index)
364 {
366  msg->addU8(Proto::ClientInspectTrade);
367  msg->addU8(counterOffer ? 0x01 : 0x00);
368  msg->addU8(index);
369  send(msg);
370 }
371 
373 {
375  msg->addU8(Proto::ClientAcceptTrade);
376  send(msg);
377 }
378 
380 {
382  msg->addU8(Proto::ClientRejectTrade);
383  send(msg);
384 }
385 
386 void ProtocolGame::sendUseItem(const Position& position, int itemId, int stackpos, int index)
387 {
389  msg->addU8(Proto::ClientUseItem);
390  addPosition(msg, position);
391  msg->addU16(itemId);
392  msg->addU8(stackpos);
393  msg->addU8(index);
394  send(msg);
395 }
396 
397 void ProtocolGame::sendUseItemWith(const Position& fromPos, int itemId, int fromStackPos, const Position& toPos, int toThingId, int toStackPos)
398 {
400  msg->addU8(Proto::ClientUseItemWith);
401  addPosition(msg, fromPos);
402  msg->addU16(itemId);
403  msg->addU8(fromStackPos);
404  addPosition(msg, toPos);
405  msg->addU16(toThingId);
406  msg->addU8(toStackPos);
407  send(msg);
408 }
409 
410 void ProtocolGame::sendUseOnCreature(const Position& pos, int thingId, int stackpos, uint creatureId)
411 {
413  msg->addU8(Proto::ClientUseOnCreature);
414  addPosition(msg, pos);
415  msg->addU16(thingId);
416  msg->addU8(stackpos);
417  msg->addU32(creatureId);
418  send(msg);
419 }
420 
421 void ProtocolGame::sendRotateItem(const Position& pos, int thingId, int stackpos)
422 {
424  msg->addU8(Proto::ClientRotateItem);
425  addPosition(msg, pos);
426  msg->addU16(thingId);
427  msg->addU8(stackpos);
428  send(msg);
429 }
430 
431 void ProtocolGame::sendCloseContainer(int containerId)
432 {
434  msg->addU8(Proto::ClientCloseContainer);
435  msg->addU8(containerId);
436  send(msg);
437 }
438 
439 void ProtocolGame::sendUpContainer(int containerId)
440 {
442  msg->addU8(Proto::ClientUpContainer);
443  msg->addU8(containerId);
444  send(msg);
445 }
446 
447 void ProtocolGame::sendEditText(uint id, const std::string& text)
448 {
450  msg->addU8(Proto::ClientEditText);
451  msg->addU32(id);
452  msg->addString(text);
453  send(msg);
454 }
455 
456 void ProtocolGame::sendEditList(uint id, int doorId, const std::string& text)
457 {
459  msg->addU8(Proto::ClientEditList);
460  msg->addU8(doorId);
461  msg->addU32(id);
462  msg->addString(text);
463  send(msg);
464 }
465 
466 void ProtocolGame::sendLook(const Position& position, int thingId, int stackpos)
467 {
469  msg->addU8(Proto::ClientLook);
470  addPosition(msg, position);
471  msg->addU16(thingId);
472  msg->addU8(stackpos);
473  send(msg);
474 }
475 
477 {
479  msg->addU8(Proto::ClientLookCreature);
480  msg->addU32(creatureId);
481  send(msg);
482 }
483 
484 void ProtocolGame::sendTalk(Otc::MessageMode mode, int channelId, const std::string& receiver, const std::string& message)
485 {
486  if(message.empty())
487  return;
488 
489  if(message.length() > 255) {
490  g_logger.traceError("message too large");
491  return;
492  }
493 
495  msg->addU8(Proto::ClientTalk);
496  msg->addU8(Proto::translateMessageModeToServer(mode));
497 
498  switch(mode) {
502  msg->addString(receiver);
503  break;
504  case Otc::MessageChannel:
508  msg->addU16(channelId);
509  break;
510  default:
511  break;
512  }
513 
514  msg->addString(message);
515  send(msg);
516 }
517 
519 {
521  msg->addU8(Proto::ClientRequestChannels);
522  send(msg);
523 }
524 
525 void ProtocolGame::sendJoinChannel(int channelId)
526 {
528  msg->addU8(Proto::ClientJoinChannel);
529  msg->addU16(channelId);
530  send(msg);
531 }
532 
534 {
536  msg->addU8(Proto::ClientLeaveChannel);
537  msg->addU16(channelId);
538  send(msg);
539 }
540 
541 void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver)
542 {
545  msg->addString(receiver);
546  send(msg);
547 }
548 
549 void ProtocolGame::sendOpenRuleViolation(const std::string& reporter)
550 {
552  msg->addU8(Proto::ClientOpenRuleViolation);
553  msg->addString(reporter);
554  send(msg);
555 }
556 
557 void ProtocolGame::sendCloseRuleViolation(const std::string& reporter)
558 {
561  msg->addString(reporter);
562  send(msg);
563 }
564 
566 {
569  send(msg);
570 }
571 
573 {
575  msg->addU8(Proto::ClientCloseNpcChannel);
576  send(msg);
577 }
578 
579 void ProtocolGame::sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight, Otc::PVPModes pvpMode)
580 {
582  msg->addU8(Proto::ClientChangeFightModes);
583  msg->addU8(fightMode);
584  msg->addU8(chaseMode);
585  msg->addU8(safeFight ? 0x01: 0x00);
587  msg->addU8(pvpMode);
588  send(msg);
589 }
590 
591 void ProtocolGame::sendAttack(uint creatureId, uint seq)
592 {
594  msg->addU8(Proto::ClientAttack);
595  msg->addU32(creatureId);
597  msg->addU32(seq);
598  send(msg);
599 }
600 
601 void ProtocolGame::sendFollow(uint creatureId, uint seq)
602 {
604  msg->addU8(Proto::ClientFollow);
605  msg->addU32(creatureId);
607  msg->addU32(seq);
608  send(msg);
609 }
610 
612 {
614  msg->addU8(Proto::ClientInviteToParty);
615  msg->addU32(creatureId);
616  send(msg);
617 }
618 
620 {
622  msg->addU8(Proto::ClientJoinParty);
623  msg->addU32(creatureId);
624  send(msg);
625 }
626 
628 {
630  msg->addU8(Proto::ClientRevokeInvitation);
631  msg->addU32(creatureId);
632  send(msg);
633 }
634 
636 {
638  msg->addU8(Proto::ClientPassLeadership);
639  msg->addU32(creatureId);
640  send(msg);
641 }
642 
644 {
646  msg->addU8(Proto::ClientLeaveParty);
647  send(msg);
648 }
649 
651 {
653  msg->addU8(Proto::ClientShareExperience);
654  msg->addU8(active ? 0x01 : 0x00);
655  if(g_game.getClientVersion() < 910)
656  msg->addU8(0);
657  send(msg);
658 }
659 
661 {
663  msg->addU8(Proto::ClientOpenOwnChannel);
664  send(msg);
665 }
666 
667 void ProtocolGame::sendInviteToOwnChannel(const std::string& name)
668 {
671  msg->addString(name);
672  send(msg);
673 }
674 
675 void ProtocolGame::sendExcludeFromOwnChannel(const std::string& name)
676 {
679  msg->addString(name);
680  send(msg);
681 }
682 
684 {
687  send(msg);
688 }
689 
691 {
693  msg->addU8(Proto::ClientRefreshContainer);
694  msg->addU8(containerId);
695  send(msg);
696 }
697 
699 {
701  msg->addU8(Proto::ClientRequestOutfit);
702  send(msg);
703 }
704 
706 {
708  msg->addU8(Proto::ClientChangeOutfit);
710  msg->addU16(outfit.getId());
711  else
712  msg->addU8(outfit.getId());
713  msg->addU8(outfit.getHead());
714  msg->addU8(outfit.getBody());
715  msg->addU8(outfit.getLegs());
716  msg->addU8(outfit.getFeet());
718  msg->addU8(outfit.getAddons());
720  msg->addU16(outfit.getMount());
721  send(msg);
722 }
723 
725 {
728  msg->addU8(Proto::ClientMount);
729  msg->addU8(mount);
730  send(msg);
731  } else {
732  g_logger.error("ProtocolGame::sendMountStatus does not support the current protocol.");
733  }
734 }
735 
736 void ProtocolGame::sendAddVip(const std::string& name)
737 {
739  msg->addU8(Proto::ClientAddVip);
740  msg->addString(name);
741  send(msg);
742 }
743 
745 {
747  msg->addU8(Proto::ClientRemoveVip);
748  msg->addU32(playerId);
749  send(msg);
750 }
751 
752 void ProtocolGame::sendEditVip(uint playerId, const std::string& description, int iconId, bool notifyLogin)
753 {
755  msg->addU8(Proto::ClientEditVip);
756  msg->addU32(playerId);
757  msg->addString(description);
758  msg->addU32(iconId);
759  msg->addU8(notifyLogin);
760  send(msg);
761 }
762 
763 void ProtocolGame::sendBugReport(const std::string& comment)
764 {
766  msg->addU8(Proto::ClientBugReport);
767  msg->addString(comment);
768  send(msg);
769 }
770 
771 void ProtocolGame::sendRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
772 {
774  msg->addU8(Proto::ClientRuleViolation);
775  msg->addString(target);
776  msg->addU8(reason);
777  msg->addU8(action);
778  msg->addString(comment);
779  msg->addString(statement);
780  msg->addU16(statementId);
781  msg->addU8(ipBanishment);
782  send(msg);
783 }
784 
785 void ProtocolGame::sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d)
786 {
788  msg->addU8(Proto::ClientDebugReport);
789  msg->addString(a);
790  msg->addString(b);
791  msg->addString(c);
792  msg->addString(d);
793  send(msg);
794 }
795 
797 {
799  msg->addU8(Proto::ClientRequestQuestLog);
800  send(msg);
801 }
802 
804 {
806  msg->addU8(Proto::ClientRequestQuestLine);
807  msg->addU16(questId);
808  send(msg);
809 }
810 
811 void ProtocolGame::sendNewNewRuleViolation(int reason, int action, const std::string& characterName, const std::string& comment, const std::string& translation)
812 {
814  msg->addU8(Proto::ClientNewRuleViolation);
815  msg->addU8(reason);
816  msg->addU8(action);
817  msg->addString(characterName);
818  msg->addString(comment);
819  msg->addString(translation);
820  send(msg);
821 }
822 
823 void ProtocolGame::sendRequestItemInfo(int itemId, int subType, int index)
824 {
826  msg->addU8(Proto::ClientRequestItemInfo);
827  msg->addU8(subType);
828  msg->addU16(itemId);
829  msg->addU8(index);
830  send(msg);
831 }
832 
833 void ProtocolGame::sendAnswerModalDialog(uint32 dialog, int button, int choice)
834 {
836  msg->addU8(Proto::ClientAnswerModalDialog);
837  msg->addU32(dialog);
838  msg->addU8(button);
839  msg->addU8(choice);
840  send(msg);
841 }
842 
844 {
846  return;
847 
849  msg->addU8(Proto::ClientBrowseField);
850  addPosition(msg, position);
851  send(msg);
852 }
853 
854 void ProtocolGame::sendSeekInContainer(int cid, int index)
855 {
857  return;
858 
860  msg->addU8(Proto::ClientSeekInContainer);
861  msg->addU8(cid);
862  msg->addU16(index);
863  send(msg);
864 }
865 
866 void ProtocolGame::sendBuyStoreOffer(int offerId, int productType, const std::string& name)
867 {
869  msg->addU8(Proto::ClientBuyStoreOffer);
870  msg->addU32(offerId);
871  msg->addU8(productType);
872 
873  if(productType == Otc::ProductTypeNameChange)
874  msg->addString(name);
875 
876  send(msg);
877 }
878 
879 void ProtocolGame::sendRequestTransactionHistory(int page, int entriesPerPage)
880 {
883  if(g_game.getClientVersion() <= 1096) {
884  msg->addU16(page);
885  msg->addU32(entriesPerPage);
886  } else {
887  msg->addU32(page);
888  msg->addU8(entriesPerPage);
889  }
890 
891  send(msg);
892 }
893 
894 void ProtocolGame::sendRequestStoreOffers(const std::string& categoryName, int serviceType)
895 {
898 
900  msg->addU8(serviceType);
901  }
902  msg->addString(categoryName);
903 
904  send(msg);
905 }
906 
907 void ProtocolGame::sendOpenStore(int serviceType, const std::string& category)
908 {
910  msg->addU8(Proto::ClientOpenStore);
911 
913  msg->addU8(serviceType);
914  msg->addString(category);
915  }
916 
917  send(msg);
918 }
919 
920 void ProtocolGame::sendTransferCoins(const std::string& recipient, int amount)
921 {
923  msg->addU8(Proto::ClientTransferCoins);
924  msg->addString(recipient);
925  msg->addU16(amount);
926  send(msg);
927 }
928 
930 {
933  msg->addU8(entriesPerPage);
934 
935  send(msg);
936 }
937 
938 
939 void ProtocolGame::sendChangeMapAwareRange(int xrange, int yrange)
940 {
942  return;
943 
946  msg->addU8(xrange);
947  msg->addU8(yrange);
948  send(msg);
949 }
950 
951 void ProtocolGame::addPosition(const OutputMessagePtr& msg, const Position& position)
952 {
953  msg->addU16(position.x);
954  msg->addU16(position.y);
955  msg->addU8(position.z);
956 }
ProtocolGame::sendWalkSouthWest
void sendWalkSouthWest()
Definition: protocolgamesend.cpp:247
Proto::ClientDebugReport
@ ClientDebugReport
Definition: protocolcodes.h:257
Proto::ClientOpenStore
@ ClientOpenStore
Definition: protocolcodes.h:269
Outfit::getMount
int getMount() const
Definition: outfit.h:60
Otc::GamePVPMode
@ GamePVPMode
Definition: const.h:393
Proto::ClientBugReport
@ ClientBugReport
Definition: protocolcodes.h:255
ProtocolGame::sendChangeMapAwareRange
void sendChangeMapAwareRange(int xrange, int yrange)
Definition: protocolgamesend.cpp:939
ProtocolGame::sendCancelAttackAndFollow
void sendCancelAttackAndFollow()
Definition: protocolgamesend.cpp:683
Otc::GameAttackSeq
@ GameAttackSeq
Definition: const.h:375
Proto::ClientBrowseField
@ ClientBrowseField
Definition: protocolcodes.h:247
Proto::ClientUseItem
@ ClientUseItem
Definition: protocolcodes.h:212
Game::mount
void mount(bool mount)
Definition: game.cpp:1372
ProtocolGame::sendLeaveParty
void sendLeaveParty()
Definition: protocolgamesend.cpp:643
Proto::ClientUseOnCreature
@ ClientUseOnCreature
Definition: protocolcodes.h:214
ProtocolGame::sendExcludeFromOwnChannel
void sendExcludeFromOwnChannel(const std::string &name)
Definition: protocolgamesend.cpp:675
Proto::ClientInspectNpcTrade
@ ClientInspectNpcTrade
Definition: protocolcodes.h:204
Outfit::getBody
int getBody() const
Definition: outfit.h:56
ProtocolGame::sendBugReport
void sendBugReport(const std::string &comment)
Definition: protocolgamesend.cpp:763
Proto::ClientFollow
@ ClientFollow
Definition: protocolcodes.h:233
Proto::ClientEditVip
@ ClientEditVip
Definition: protocolcodes.h:254
Outfit::getId
int getId() const
Definition: outfit.h:53
ProtocolGame::sendWalkSouthEast
void sendWalkSouthEast()
Definition: protocolgamesend.cpp:240
Otc::North
@ North
Definition: const.h:162
ProtocolGame::sendJoinChannel
void sendJoinChannel(int channelId)
Definition: protocolgamesend.cpp:525
Otc::ChaseModes
ChaseModes
Definition: const.h:211
ProtocolGame::sendCloseNpcChannel
void sendCloseNpcChannel()
Definition: protocolgamesend.cpp:572
ProtocolGame::sendLeaveChannel
void sendLeaveChannel(int channelId)
Definition: protocolgamesend.cpp:533
Position::x
int x
Definition: position.h:243
ProtocolGame::sendNewNewRuleViolation
void sendNewNewRuleViolation(int reason, int action, const std::string &characterName, const std::string &comment, const std::string &translation)
Definition: protocolgamesend.cpp:811
ProtocolGame::sendPing
void sendPing()
Definition: protocolgamesend.cpp:139
Otc::GamePlayerAddons
@ GamePlayerAddons
Definition: const.h:387
Proto::ClientRequestTrade
@ ClientRequestTrade
Definition: protocolcodes.h:208
ProtocolGame::sendCancelRuleViolation
void sendCancelRuleViolation()
Definition: protocolgamesend.cpp:565
Proto::ClientRequestItemInfo
@ ClientRequestItemInfo
Definition: protocolcodes.h:262
g_crypt
Crypt g_crypt
Definition: crypt.cpp:44
Otc::MessageChannel
@ MessageChannel
Definition: const.h:294
Proto::ClientTurnNorth
@ ClientTurnNorth
Definition: protocolcodes.h:198
uint32
uint32_t uint32
Definition: types.h:35
Proto::ClientWalkSouthWest
@ ClientWalkSouthWest
Definition: protocolcodes.h:196
ProtocolGame::sendSeekInContainer
void sendSeekInContainer(int cid, int index)
Definition: protocolgamesend.cpp:854
ProtocolGame::sendOpenOwnChannel
void sendOpenOwnChannel()
Definition: protocolgamesend.cpp:660
ProtocolGame::sendUseOnCreature
void sendUseOnCreature(const Position &pos, int thingId, int stackpos, uint creatureId)
Definition: protocolgamesend.cpp:410
Proto::ClientRotateItem
@ ClientRotateItem
Definition: protocolcodes.h:215
Proto::ClientRejectTrade
@ ClientRejectTrade
Definition: protocolcodes.h:211
Proto::ClientRequestStoreOffers
@ ClientRequestStoreOffers
Definition: protocolcodes.h:270
Otc::GameLoginPacketEncryption
@ GameLoginPacketEncryption
Definition: const.h:406
Crypt::rsaGetSize
int rsaGetSize()
Definition: crypt.cpp:350
ProtocolGame::sendBuyItem
void sendBuyItem(int itemId, int subType, int amount, bool ignoreCapacity, bool buyWithBackpack)
Definition: protocolgamesend.cpp:319
ProtocolGame::addPosition
void addPosition(const OutputMessagePtr &msg, const Position &position)
Definition: protocolgamesend.cpp:951
Logger::error
void error(const std::string &what)
Definition: logger.h:54
Otc::GameAccountNames
@ GameAccountNames
Definition: const.h:347
Proto::ClientCloseNpcTrade
@ ClientCloseNpcTrade
Definition: protocolcodes.h:207
ProtocolGame::send
void send(const OutputMessagePtr &outputMessage)
Definition: protocolgamesend.cpp:30
Game::getClientVersion
int getClientVersion()
Definition: game.h:316
ProtocolGame::sendLoginPacket
void sendLoginPacket(uint challengeTimestamp, uint8 challengeRandom)
Definition: protocolgamesend.cpp:51
Proto::ClientEditList
@ ClientEditList
Definition: protocolcodes.h:219
Otc::GameExtendedClientPing
@ GameExtendedClientPing
Definition: const.h:370
ProtocolGame::sendMove
void sendMove(const Position &fromPos, int thingId, int stackpos, const Position &toPos, int count)
Definition: protocolgamesend.cpp:298
Proto::ClientWalkNorth
@ ClientWalkNorth
Definition: protocolcodes.h:189
Otc::GameContentRevision
@ GameContentRevision
Definition: const.h:408
Otc::MessageGamemasterChannel
@ MessageGamemasterChannel
Definition: const.h:300
Outfit::getFeet
int getFeet() const
Definition: outfit.h:58
ProtocolGame::sendPassLeadership
void sendPassLeadership(uint creatureId)
Definition: protocolgamesend.cpp:635
Proto::ClientOpenRuleViolation
@ ClientOpenRuleViolation
Definition: protocolcodes.h:227
g_game
Game g_game
Definition: game.cpp:37
Position::y
int y
Definition: position.h:244
ProtocolGame::sendRotateItem
void sendRotateItem(const Position &pos, int thingId, int stackpos)
Definition: protocolgamesend.cpp:421
Proto::ClientBuyItem
@ ClientBuyItem
Definition: protocolcodes.h:205
Otc::GamePlayerMounts
@ GamePlayerMounts
Definition: const.h:357
ProtocolGame::sendWalkWest
void sendWalkWest()
Definition: protocolgamesend.cpp:219
Otc::GameProtocolChecksum
@ GameProtocolChecksum
Definition: const.h:346
ProtocolGame::sendAnswerModalDialog
void sendAnswerModalDialog(uint32 dialog, int button, int choice)
Definition: protocolgamesend.cpp:833
Outfit::getAddons
int getAddons() const
Definition: outfit.h:59
Otc::GameChallengeOnLogin
@ GameChallengeOnLogin
Definition: const.h:348
stdext::format
std::string format()
Definition: format.h:82
Proto::ClientAddVip
@ ClientAddVip
Definition: protocolcodes.h:252
ProtocolGame::sendAddVip
void sendAddVip(const std::string &name)
Definition: protocolgamesend.cpp:736
ProtocolGame::sendDebugReport
void sendDebugReport(const std::string &a, const std::string &b, const std::string &c, const std::string &d)
Definition: protocolgamesend.cpp:785
ProtocolGame::sendInviteToOwnChannel
void sendInviteToOwnChannel(const std::string &name)
Definition: protocolgamesend.cpp:667
Proto::ClientWalkEast
@ ClientWalkEast
Definition: protocolcodes.h:190
Proto::ClientAutoWalk
@ ClientAutoWalk
Definition: protocolcodes.h:188
ProtocolGame::sendRuleViolation
void sendRuleViolation(const std::string &target, int reason, int action, const std::string &comment, const std::string &statement, int statementId, bool ipBanishment)
Definition: protocolgamesend.cpp:771
Proto::ClientStop
@ ClientStop
Definition: protocolcodes.h:193
Proto::ClientUpContainer
@ ClientUpContainer
Definition: protocolcodes.h:217
ProtocolGame::sendFollow
void sendFollow(uint creatureId, uint seq)
Definition: protocolgamesend.cpp:601
Proto::ClientPassLeadership
@ ClientPassLeadership
Definition: protocolcodes.h:237
crypt.h
Proto::ClientEnterGame
@ ClientEnterGame
Definition: protocolcodes.h:172
Otc::GameLooktypeU16
@ GameLooktypeU16
Definition: const.h:385
Otc::NorthEast
@ NorthEast
Definition: const.h:166
Position::z
short z
Definition: position.h:245
Otc::ProductTypeNameChange
@ ProductTypeNameChange
Definition: const.h:492
ProtocolGame::sendTurnWest
void sendTurnWest()
Definition: protocolgamesend.cpp:282
ThingTypeManager::getContentRevision
uint16 getContentRevision()
Definition: thingtypemanager.h:69
Protocol::m_xteaKey
uint32 m_xteaKey[4]
Definition: protocol.h:67
Proto::ClientUseItemWith
@ ClientUseItemWith
Definition: protocolcodes.h:213
ProtocolGame::sendRequestOutfit
void sendRequestOutfit()
Definition: protocolgamesend.cpp:698
ProtocolGame::sendOpenTransactionHistory
void sendOpenTransactionHistory(int entriesPerPage)
Definition: protocolgamesend.cpp:929
Game::getProtocolVersion
int getProtocolVersion()
Definition: game.h:313
ProtocolGame::sendBuyStoreOffer
void sendBuyStoreOffer(int offerId, int productType, const std::string &name)
Definition: protocolgamesend.cpp:866
Proto::ClientInspectTrade
@ ClientInspectTrade
Definition: protocolcodes.h:209
Otc::GameSessionKey
@ GameSessionKey
Definition: const.h:412
ProtocolGame::sendTurnNorth
void sendTurnNorth()
Definition: protocolgamesend.cpp:261
ProtocolGame::sendCloseContainer
void sendCloseContainer(int containerId)
Definition: protocolgamesend.cpp:431
ProtocolGame::sendSellItem
void sendSellItem(int itemId, int subType, int amount, bool ignoreEquipped)
Definition: protocolgamesend.cpp:331
ProtocolGame::sendShareExperience
void sendShareExperience(bool active)
Definition: protocolgamesend.cpp:650
Otc::Direction
Direction
Definition: const.h:161
Proto::ClientLeaveGame
@ ClientLeaveGame
Definition: protocolcodes.h:173
Protocol::enableXteaEncryption
void enableXteaEncryption()
Definition: protocol.h:53
ProtocolGame::sendRequestItemInfo
void sendRequestItemInfo(int itemId, int subType, int index)
Definition: protocolgamesend.cpp:823
Outfit
Definition: outfit.h:29
ProtocolGame::sendStop
void sendStop()
Definition: protocolgamesend.cpp:226
Proto::ClientSellItem
@ ClientSellItem
Definition: protocolcodes.h:206
ProtocolGame::sendEditVip
void sendEditVip(uint playerId, const std::string &description, int iconId, bool notifyLogin)
Definition: protocolgamesend.cpp:752
Proto::ClientMove
@ ClientMove
Definition: protocolcodes.h:203
ProtocolGame::sendRequestStoreOffers
void sendRequestStoreOffers(const std::string &categoryName, int serviceType)
Definition: protocolgamesend.cpp:894
Otc::GameClientVersion
@ GameClientVersion
Definition: const.h:407
ProtocolGame::sendChangeFightModes
void sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight, Otc::PVPModes pvpMode)
Definition: protocolgamesend.cpp:579
uint
unsigned int uint
Definition: types.h:31
Otc::MessageMode
MessageMode
Definition: const.h:286
ProtocolGame::sendInspectNpcTrade
void sendInspectNpcTrade(int itemId, int count)
Definition: protocolgamesend.cpp:310
Proto::ClientRequestChannels
@ ClientRequestChannels
Definition: protocolcodes.h:223
Proto::ClientRequestQuestLog
@ ClientRequestQuestLog
Definition: protocolcodes.h:259
g_logger
Logger g_logger
Definition: logger.cpp:35
ProtocolGame::sendLookCreature
void sendLookCreature(uint creatureId)
Definition: protocolgamesend.cpp:476
Proto::ClientWalkNorthWest
@ ClientWalkNorthWest
Definition: protocolcodes.h:197
Proto::ClientWalkSouth
@ ClientWalkSouth
Definition: protocolcodes.h:191
Proto::ClientRefreshContainer
@ ClientRefreshContainer
Definition: protocolcodes.h:246
ProtocolGame::sendEditList
void sendEditList(uint id, int doorId, const std::string &text)
Definition: protocolgamesend.cpp:456
Proto::ClientOpenPrivateChannel
@ ClientOpenPrivateChannel
Definition: protocolcodes.h:226
ProtocolGame::sendAutoWalk
void sendAutoWalk(const std::vector< Otc::Direction > &path)
Definition: protocolgamesend.cpp:157
Otc::West
@ West
Definition: const.h:165
Proto::ClientNewRuleViolation
@ ClientNewRuleViolation
Definition: protocolcodes.h:261
Outfit::getLegs
int getLegs() const
Definition: outfit.h:57
Proto::translateMessageModeToServer
uint8 translateMessageModeToServer(Otc::MessageMode mode)
Definition: protocolcodes.cpp:184
ProtocolGame::sendRemoveVip
void sendRemoveVip(uint playerId)
Definition: protocolgamesend.cpp:744
Protocol::enableChecksum
void enableChecksum()
Definition: protocol.h:55
Proto::ClientLeaveParty
@ ClientLeaveParty
Definition: protocolcodes.h:238
Proto::ClientAnswerModalDialog
@ ClientAnswerModalDialog
Definition: protocolcodes.h:268
Otc::GameBrowseField
@ GameBrowseField
Definition: const.h:401
ProtocolGame::sendCloseRuleViolation
void sendCloseRuleViolation(const std::string &reporter)
Definition: protocolgamesend.cpp:557
ProtocolGame::sendWalkEast
void sendWalkEast()
Definition: protocolgamesend.cpp:205
ProtocolGame::sendWalkNorthEast
void sendWalkNorthEast()
Definition: protocolgamesend.cpp:233
Otc::GameContainerPagination
@ GameContainerPagination
Definition: const.h:383
Position
Definition: position.h:33
ProtocolGame::sendRequestQuestLog
void sendRequestQuestLog()
Definition: protocolgamesend.cpp:796
ProtocolGame::sendRequestTrade
void sendRequestTrade(const Position &pos, int thingId, int stackpos, uint creatureId)
Definition: protocolgamesend.cpp:352
Proto::ClientAcceptTrade
@ ClientAcceptTrade
Definition: protocolcodes.h:210
Proto::ClientJoinParty
@ ClientJoinParty
Definition: protocolcodes.h:235
Otc::MessageRVRAnswer
@ MessageRVRAnswer
Definition: const.h:337
ProtocolGame::sendInviteToParty
void sendInviteToParty(uint creatureId)
Definition: protocolgamesend.cpp:611
Proto::ClientPingBack
@ ClientPingBack
Definition: protocolcodes.h:175
Game::getFeature
bool getFeature(Otc::GameFeature feature)
Definition: game.h:310
Proto::ClientEditText
@ ClientEditText
Definition: protocolcodes.h:218
ProtocolGame::sendAttack
void sendAttack(uint creatureId, uint seq)
Definition: protocolgamesend.cpp:591
Otc::GameDoubleShopSellAmount
@ GameDoubleShopSellAmount
Definition: const.h:382
Otc::GameAuthenticator
@ GameAuthenticator
Definition: const.h:410
ProtocolGame::sendPingBack
void sendPingBack()
Definition: protocolgamesend.cpp:150
ProtocolGame::sendAcceptTrade
void sendAcceptTrade()
Definition: protocolgamesend.cpp:372
Otc::PVPModes
PVPModes
Definition: const.h:216
ProtocolGame::sendWalkNorth
void sendWalkNorth()
Definition: protocolgamesend.cpp:198
ProtocolGame::sendWalkNorthWest
void sendWalkNorthWest()
Definition: protocolgamesend.cpp:254
ProtocolGame::sendOpenRuleViolation
void sendOpenRuleViolation(const std::string &reporter)
Definition: protocolgamesend.cpp:549
Proto::ClientCloseNpcChannel
@ ClientCloseNpcChannel
Definition: protocolcodes.h:230
Protocol::send
virtual void send(const OutputMessagePtr &outputMessage)
Definition: protocol.cpp:72
ProtocolGame::sendRejectTrade
void sendRejectTrade()
Definition: protocolgamesend.cpp:379
Otc::GameIngameStoreServiceType
@ GameIngameStoreServiceType
Definition: const.h:418
Otc::MessageChannelHighlight
@ MessageChannelHighlight
Definition: const.h:295
Otc::SouthEast
@ SouthEast
Definition: const.h:167
platform.h
ProtocolGame::sendTurnSouth
void sendTurnSouth()
Definition: protocolgamesend.cpp:275
Proto::ClientLook
@ ClientLook
Definition: protocolcodes.h:220
ProtocolGame::sendTalk
void sendTalk(Otc::MessageMode mode, int channelId, const std::string &receiver, const std::string &message)
Definition: protocolgamesend.cpp:484
ProtocolGame::sendInspectTrade
void sendInspectTrade(bool counterOffer, int index)
Definition: protocolgamesend.cpp:363
Proto::ClientTransferCoins
@ ClientTransferCoins
Definition: protocolcodes.h:258
ProtocolGame::sendEquipItem
void sendEquipItem(int itemId, int countOrSubType)
Definition: protocolgamesend.cpp:289
Proto::ClientOpenOwnChannel
@ ClientOpenOwnChannel
Definition: protocolcodes.h:241
ProtocolGame::sendLook
void sendLook(const Position &position, int thingId, int stackpos)
Definition: protocolgamesend.cpp:466
Otc::South
@ South
Definition: const.h:164
ProtocolGame::sendExtendedOpcode
void sendExtendedOpcode(uint8 opcode, const std::string &buffer)
Definition: protocolgamesend.cpp:38
Proto::ClientBuyStoreOffer
@ ClientBuyStoreOffer
Definition: protocolcodes.h:271
Proto::ClientChangeMapAwareRange
@ ClientChangeMapAwareRange
Definition: protocolcodes.h:182
ProtocolGame::sendRevokeInvitation
void sendRevokeInvitation(uint creatureId)
Definition: protocolgamesend.cpp:627
Proto::ClientAttack
@ ClientAttack
Definition: protocolcodes.h:232
Proto::ClientWalkWest
@ ClientWalkWest
Definition: protocolcodes.h:192
Proto::ClientRequestTransactionHistory
@ ClientRequestTransactionHistory
Definition: protocolcodes.h:273
Otc::MessageGamemasterPrivateTo
@ MessageGamemasterPrivateTo
Definition: const.h:302
Proto::ClientExtendedOpcode
@ ClientExtendedOpcode
Definition: protocolcodes.h:181
Protocol::generateXteaKey
void generateXteaKey()
Definition: protocol.cpp:145
Otc::GameChangeMapAwareRange
@ GameChangeMapAwareRange
Definition: const.h:373
ProtocolGame::sendMountStatus
void sendMountStatus(bool mount)
Definition: protocolgamesend.cpp:724
Otc::NorthWest
@ NorthWest
Definition: const.h:169
Proto::ClientWalkSouthEast
@ ClientWalkSouthEast
Definition: protocolcodes.h:195
ProtocolGame::sendBrowseField
void sendBrowseField(const Position &position)
Definition: protocolgamesend.cpp:843
ProtocolGame::sendUseItemWith
void sendUseItemWith(const Position &fromPos, int itemId, int fromStackPos, const Position &toPos, int toThingId, int toStackPos)
Definition: protocolgamesend.cpp:397
stdext::shared_object_ptr
Definition: shared_object.h:39
Proto::ClientExcludeFromOwnChannel
@ ClientExcludeFromOwnChannel
Definition: protocolcodes.h:243
ProtocolGame::sendTransferCoins
void sendTransferCoins(const std::string &recipient, int amount)
Definition: protocolgamesend.cpp:920
ProtocolGame::sendJoinParty
void sendJoinParty(uint creatureId)
Definition: protocolgamesend.cpp:619
Proto::ClientLeaveChannel
@ ClientLeaveChannel
Definition: protocolcodes.h:225
Proto::ClientJoinChannel
@ ClientJoinChannel
Definition: protocolcodes.h:224
Proto::ClientTalk
@ ClientTalk
Definition: protocolcodes.h:222
Proto::ClientInviteToOwnChannel
@ ClientInviteToOwnChannel
Definition: protocolcodes.h:242
ProtocolGame::sendOpenPrivateChannel
void sendOpenPrivateChannel(const std::string &receiver)
Definition: protocolgamesend.cpp:541
ProtocolGame::sendRequestTransactionHistory
void sendRequestTransactionHistory(int page, int entriesPerPage)
Definition: protocolgamesend.cpp:879
Otc::East
@ East
Definition: const.h:163
Proto::ClientPing
@ ClientPing
Definition: protocolcodes.h:174
ProtocolGame::sendEditText
void sendEditText(uint id, const std::string &text)
Definition: protocolgamesend.cpp:447
Game::getOs
int getOs()
Definition: game.cpp:1739
Proto::ClientRequestOutfit
@ ClientRequestOutfit
Definition: protocolcodes.h:249
Proto::ClientRevokeInvitation
@ ClientRevokeInvitation
Definition: protocolcodes.h:236
Proto::ClientCloseContainer
@ ClientCloseContainer
Definition: protocolcodes.h:216
Outfit::getHead
int getHead() const
Definition: outfit.h:55
ProtocolGame::sendTurnEast
void sendTurnEast()
Definition: protocolgamesend.cpp:268
game.h
Otc::GamePreviewState
@ GamePreviewState
Definition: const.h:405
Proto::ClientRemoveVip
@ ClientRemoveVip
Definition: protocolcodes.h:253
ProtocolGame::sendRequestQuestLine
void sendRequestQuestLine(int questId)
Definition: protocolgamesend.cpp:803
ProtocolGame::sendChangeOutfit
void sendChangeOutfit(const Outfit &outfit)
Definition: protocolgamesend.cpp:705
Otc::MessagePrivateTo
@ MessagePrivateTo
Definition: const.h:292
Proto::ClientChangeFightModes
@ ClientChangeFightModes
Definition: protocolcodes.h:231
ProtocolGame::sendCloseNpcTrade
void sendCloseNpcTrade()
Definition: protocolgamesend.cpp:345
Proto::ClientPendingGame
@ ClientPendingGame
Definition: protocolcodes.h:171
protocolgame.h
ProtocolGame::sendEnterGame
void sendEnterGame()
Definition: protocolgamesend.cpp:125
Proto::ClientRuleViolation
@ ClientRuleViolation
Definition: protocolcodes.h:256
Proto::ClientShareExperience
@ ClientShareExperience
Definition: protocolcodes.h:239
Proto::ClientRequestQuestLine
@ ClientRequestQuestLine
Definition: protocolcodes.h:260
Proto::ClientEquipItem
@ ClientEquipItem
Definition: protocolcodes.h:202
Otc::FightModes
FightModes
Definition: const.h:205
ProtocolGame::sendOpenStore
void sendOpenStore(int serviceType, const std::string &category)
Definition: protocolgamesend.cpp:907
Proto::ClientSeekInContainer
@ ClientSeekInContainer
Definition: protocolcodes.h:248
Proto::ClientOpenTransactionHistory
@ ClientOpenTransactionHistory
Definition: protocolcodes.h:272
Otc::MessageChannelManagement
@ MessageChannelManagement
Definition: const.h:293
Proto::ClientTurnEast
@ ClientTurnEast
Definition: protocolcodes.h:199
ProtocolGame::sendUseItem
void sendUseItem(const Position &position, int itemId, int stackpos, int index)
Definition: protocolgamesend.cpp:386
OutputMessage
Definition: outputmessage.h:30
ProtocolGame::sendRequestChannels
void sendRequestChannels()
Definition: protocolgamesend.cpp:518
Game::checkBotProtection
bool checkBotProtection()
Definition: game.cpp:1471
ProtocolGame::sendLogout
void sendLogout()
Definition: protocolgamesend.cpp:132
g_things
ThingTypeManager g_things
Definition: thingtypemanager.cpp:38
Proto::ClientWalkNorthEast
@ ClientWalkNorthEast
Definition: protocolcodes.h:194
Proto::ClientTurnWest
@ ClientTurnWest
Definition: protocolcodes.h:201
client.h
Proto::ClientCancelAttackAndFollow
@ ClientCancelAttackAndFollow
Definition: protocolcodes.h:244
Otc::SouthWest
@ SouthWest
Definition: const.h:168
Proto::ClientMount
@ ClientMount
Definition: protocolcodes.h:251
uint8
uint8_t uint8
Definition: types.h:37
ProtocolGame::sendWalkSouth
void sendWalkSouth()
Definition: protocolgamesend.cpp:212
Proto::ClientInviteToParty
@ ClientInviteToParty
Definition: protocolcodes.h:234
Proto::ClientCancelRuleViolation
@ ClientCancelRuleViolation
Definition: protocolcodes.h:229
Proto::ClientLookCreature
@ ClientLookCreature
Definition: protocolcodes.h:221
ProtocolGame::sendUpContainer
void sendUpContainer(int containerId)
Definition: protocolgamesend.cpp:439
application.h
ProtocolGame::sendRefreshContainer
void sendRefreshContainer(int containerId)
Definition: protocolgamesend.cpp:690
Proto::ClientCloseRuleViolation
@ ClientCloseRuleViolation
Definition: protocolcodes.h:228
Proto::ClientChangeOutfit
@ ClientChangeOutfit
Definition: protocolcodes.h:250
Proto::ClientTurnSouth
@ ClientTurnSouth
Definition: protocolcodes.h:200