Planeshift
|
00001 /* 00002 * messages.h 00003 * 00004 * Copyright (C) 2001-2002 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 #ifndef __MESSAGES_H__ 00020 #define __MESSAGES_H__ 00021 00022 #include "net/netbase.h" 00023 #include "net/message.h" 00024 #include <csutil/csstring.h> 00025 #include <csutil/array.h> 00026 #include <csutil/stringarray.h> 00027 #include <csutil/strset.h> 00028 #include <csutil/databuf.h> 00029 #include <csutil/md5.h> 00030 #include "util/psscf.h" 00031 #include <csgeom/vector3.h> 00032 #include "rpgrules/psmoney.h" 00033 #include "util/psconst.h" 00034 #include "util/skillcache.h" 00035 #include <ivideo/graph3d.h> 00036 00037 #include "bulkobjects/activespell.h" 00038 00043 struct iSpriteCal3DState; 00044 struct iEngine; 00045 00046 00047 class psLinearMovement; 00048 class csStringHashReversible; 00049 00050 // This holds the version number of the network code, remember to increase 00051 // this each time you do an update which breaks compatibility 00052 #define PS_NETVERSION 0x00B9 00053 // Remember to bump the version in pscssetup.h, as well. 00054 00055 00056 // NPC Networking version is separate so we don't have to break compatibility 00057 // with clients to enhance the superclients. Made it a large number to ensure 00058 // no inadvertent overlaps. 00059 #define PS_NPCNETVERSION 0x1035 00060 00061 enum Slot_Containers 00062 { 00063 CONTAINER_INVENTORY_BULK = -1, 00064 CONTAINER_INVENTORY_EQUIPMENT = -2, 00065 CONTAINER_EXCHANGE_OFFERING = -3, 00066 CONTAINER_EXCHANGE_RECEIVING = -4, 00067 00068 CONTAINER_INVENTORY_MONEY = -5, 00069 CONTAINER_OFFERING_MONEY = -6, 00070 CONTAINER_RECEIVING_MONEY = -7, 00071 00072 CONTAINER_WORLD = -8, 00073 CONTAINER_GEM_OBJECT = -9, 00074 CONTAINER_SPELL_BOOK = -10 00075 }; 00076 00077 struct iSector; 00078 00079 enum MSG_TYPES 00080 { 00081 MSGTYPE_PING = 1, 00082 MSGTYPE_AUTHENTICATE, 00083 MSGTYPE_PREAUTHENTICATE, 00084 MSGTYPE_PREAUTHAPPROVED, 00085 MSGTYPE_AUTHAPPROVED, 00086 MSGTYPE_AUTHREJECTED, 00087 MSGTYPE_DISCONNECT, 00088 MSGTYPE_CHAT, 00089 MSGTYPE_CHANNEL_JOIN, 00090 MSGTYPE_CHANNEL_JOINED, 00091 MSGTYPE_CHANNEL_LEAVE, 00092 MSGTYPE_GUILDCMD, 00093 MSGTYPE_USERCMD, 00094 MSGTYPE_SYSTEM, 00095 MSGTYPE_CHARREJECT, 00096 MSGTYPE_DEAD_RECKONING, 00097 MSGTYPE_FORCE_POSITION, 00098 MSGTYPE_CELPERSIST, 00099 MSGTYPE_CONFIRMQUESTION, 00100 MSGTYPE_USERACTION, 00101 MSGTYPE_ADMINCMD, 00102 MSGTYPE_GUIINTERACT, 00103 MSGTYPE_GUIINVENTORY, 00104 MSGTYPE_VIEW_ITEM, 00105 MSGTYPE_VIEW_CONTAINER, 00106 MSGTYPE_VIEW_SKETCH, 00107 MSGTYPE_VIEW_ACTION_LOCATION, 00108 MSGTYPE_READ_BOOK, 00109 MSGTYPE_WRITE_BOOK, 00110 MSGTYPE_UPDATE_ITEM, 00111 MSGTYPE_MODE, 00112 MSGTYPE_WEATHER, 00113 MSGTYPE_NEWSECTOR, 00114 MSGTYPE_GUIGUILD, 00115 MSGTYPE_EQUIPMENT, 00116 MSGTYPE_GUIEXCHANGE, 00117 MSGTYPE_EXCHANGE_REQUEST, 00118 MSGTYPE_EXCHANGE_ADD_ITEM, 00119 MSGTYPE_EXCHANGE_REMOVE_ITEM, 00120 MSGTYPE_EXCHANGE_ACCEPT, 00121 MSGTYPE_EXCHANGE_STATUS, 00122 MSGTYPE_EXCHANGE_END, 00123 MSGTYPE_EXCHANGE_AUTOGIVE, 00124 MSGTYPE_EXCHANGE_MONEY, 00125 MSGTYPE_GUIMERCHANT, 00126 MSGTYPE_GUISTORAGE, 00127 MSGTYPE_GROUPCMD, 00128 MSGTYPE_GUIGROUP, 00129 MSGTYPE_STATDRUPDATE, 00130 MSGTYPE_SPELL_BOOK, 00131 MSGTYPE_GLYPH_REQUEST, 00132 MSGTYPE_GLYPH_ASSEMBLE, 00133 MSGTYPE_PURIFY_GLYPH, 00134 MSGTYPE_SPELL_CAST, 00135 MSGTYPE_SPELL_CANCEL, 00136 MSGTYPE_EFFECT, 00137 MSGTYPE_EFFECT_STOP, 00138 MSGTYPE_NPCAUTHENT, 00139 MSGTYPE_NPCLIST, 00140 MSGTYPE_GUITARGETUPDATE, 00141 MSGTYPE_MAPLIST, 00142 MSGTYPE_NPCCOMMANDLIST, 00143 MSGTYPE_NPCREADY, 00144 MSGTYPE_ALLENTITYPOS, 00145 MSGTYPE_PERSIST_ALL_ENTITIES, 00146 MSGTYPE_NEW_NPC, 00147 MSGTYPE_PETITION, 00148 MSGTYPE_MSGSTRINGS, 00149 MSGTYPE_CHARACTERDATA, 00150 MSGTYPE_AUTHCHARACTER, 00151 MSGTYPE_AUTHCHARACTERAPPROVED, 00152 MSGTYPE_CHAR_CREATE_CP, 00153 MSGTYPE_COMBATEVENT, 00154 MSGTYPE_LOOT, 00155 MSGTYPE_LOOTITEM, 00156 MSGTYPE_LOOTREMOVE, 00157 MSGTYPE_GUISKILL, 00158 MSGTYPE_OVERRIDEACTION, 00159 MSGTYPE_QUESTLIST, 00160 MSGTYPE_QUESTINFO, 00161 MSGTYPE_GMGUI, 00162 MSGTYPE_WORKCMD, 00163 MSGTYPE_BUDDY_LIST, 00164 MSGTYPE_BUDDY_STATUS, 00165 MSGTYPE_MOTD, 00166 MSGTYPE_MOTDREQUEST, 00167 MSGTYPE_QUESTION, 00168 MSGTYPE_QUESTIONRESPONSE, 00169 MSGTYPE_SLOT_MOVEMENT, 00170 MSGTYPE_QUESTIONCANCEL, 00171 MSGTYPE_GUILDMOTDSET, 00172 MSGTYPE_PLAYSOUND, 00173 MSGTYPE_CHARACTERDETAILS, 00174 MSGTYPE_CHARDETAILSREQUEST, 00175 MSGTYPE_CHARDESCUPDATE, 00176 MSGTYPE_FACTION_INFO, 00177 MSGTYPE_QUESTREWARD, 00178 MSGTYPE_NAMECHANGE, 00179 MSGTYPE_GUILDCHANGE, 00180 MSGTYPE_LOCKPICK, 00181 MSGTYPE_GMSPAWNITEMS, 00182 MSGTYPE_GMSPAWNTYPES, 00183 MSGTYPE_GMSPAWNITEM, 00184 MSGTYPE_ADVICE, 00185 MSGTYPE_ACTIVEMAGIC, 00186 MSGTYPE_GROUPCHANGE, 00187 MSGTYPE_MAPACTION, 00188 MSGTYPE_CLIENTSTATUS, 00189 MSGTYPE_TUTORIAL, 00190 MSGTYPE_BANKING, 00191 MSGTYPE_CMDDROP, 00192 00193 // Movement 00194 MSGTYPE_REQUESTMOVEMENTS, 00195 MSGTYPE_MOVEINFO, 00196 MSGTYPE_MOVEMOD, 00197 MSGTYPE_MOVELOCK, 00198 00199 // Char creation messages under this 00200 MSGTYPE_CHAR_DELETE, 00201 MSGTYPE_CHAR_CREATE_PARENTS, 00202 MSGTYPE_CHAR_CREATE_CHILDHOOD, 00203 MSGTYPE_CHAR_CREATE_LIFEEVENTS, 00204 MSGTYPE_CHAR_CREATE_UPLOAD, 00205 MSGTYPE_CHAR_CREATE_VERIFY, 00206 MSGTYPE_CHAR_CREATE_NAME, 00207 MSGTYPE_PERSIST_WORLD_REQUEST, 00208 MSGTYPE_PERSIST_WORLD, 00209 MSGTYPE_PERSIST_ACTOR_REQUEST, 00210 MSGTYPE_PERSIST_ACTOR, 00211 MSGTYPE_PERSIST_ITEM, 00212 MSGTYPE_PERSIST_ACTIONLOCATION, 00213 MSGTYPE_PERSIST_ALL, 00214 MSGTYPE_REMOVE_OBJECT, 00215 MSGTYPE_CHANGE_TRAIT, 00216 00217 // Internal Server Events here 00218 MSGTYPE_DAMAGE_EVENT, 00219 MSGTYPE_DEATH_EVENT, 00220 MSGTYPE_TARGET_EVENT, 00221 MSGTYPE_ZPOINT_EVENT, 00222 MSGTYPE_BUY_EVENT, 00223 MSGTYPE_SELL_EVENT, 00224 MSGTYPE_PICKUP_EVENT, 00225 MSGTYPE_DROP_EVENT, 00226 MSGTYPE_LOOT_EVENT, 00227 MSGTYPE_CONNECT_EVENT, 00228 MSGTYPE_MOVEMENT_EVENT, 00229 MSGTYPE_GENERIC_EVENT, // catchall for many Tutorial Events 00230 00231 // Sound Events here 00232 MSGTYPE_SOUND_EVENT, 00233 00234 // Char creation message 00235 MSGTYPE_CHAR_CREATE_TRAITS, 00236 MSGTYPE_STATS, 00237 00238 // Pet Related Messages 00239 MSGTYPE_PET_COMMAND, 00240 MSGTYPE_PET_SKILL, 00241 00242 MSGTYPE_CRAFT_INFO, 00243 00244 MSGTYPE_PETITION_REQUEST, 00245 MSGTYPE_HEART_BEAT, 00246 MSGTYPE_NPC_COMMAND, 00247 00248 // Minigame messages 00249 MSGTYPE_MINIGAME_STARTSTOP, 00250 MSGTYPE_MINIGAME_BOARD, 00251 MSGTYPE_MINIGAME_UPDATE, 00252 00253 // Entance message type 00254 MSGTYPE_ENTRANCE, 00255 00256 // GM Event message 00257 MSGTYPE_GMEVENT_LIST, 00258 MSGTYPE_GMEVENT_INFO, 00259 00260 MSGTYPE_SEQUENCE, 00261 MSGTYPE_NPCRACELIST, 00262 00263 MSGTYPE_INTRODUCTION, 00264 00265 MSGTYPE_CACHEFILE, 00266 MSGTYPE_DIALOG_MENU, 00267 MSGTYPE_SIMPLE_STRING, 00268 MSGTYPE_ORDEREDTEST, 00269 MSGTYPE_GENERICCMD, 00270 00271 //Extra value made to new clients 00272 MSGTYPE_CRAFT_CANCEL, 00273 00274 //music playing messages 00275 MSGTYPE_MUSICAL_SHEET, 00276 MSGTYPE_PLAY_SONG, 00277 MSGTYPE_STOP_SONG, 00278 00279 MSGTYPE_SIMPLE_RENDER_MESH, 00280 MSGTYPE_NPC_WORKDONE, 00281 MSGTYPE_PATH_NETWORK, 00282 MSGTYPE_LOCATION, 00283 00284 // mechanisms 00285 MSGTYPE_MECS_ACTIVATE, 00286 00287 MSGTYPE_NPC_DELETED, 00288 MSGTYPE_HIRED_NPC_SCRIPT, 00289 00290 MSGTYPE_GMSPAWNGETMODS, 00291 MSGTYPE_GMSPAWNMODS, 00292 00293 MSGTYPE_ATTACK_QUEUE, 00294 MSGTYPE_ATTACK_BOOK, 00295 MSGTYPE_SPECCOMBATEVENT 00296 }; 00297 00298 class psMessageCracker; 00299 00300 00301 // Types of system messages 00302 #define MSG_ERROR 0x00000000 // Used for stuff that failed (By default, OnScreen Red) 00303 #define MSG_INFO 0x00010000 00304 #define MSG_INFO_SERVER 0x00010001 00305 #define MSG_RESULT 0x00010002 // Used for things that the user might be interested in (By default, OnScreen Yellow) 00306 #define MSG_OK 0x00010003 // Used for confimation that the action was accepted (By default, OnScreen Green) 00307 #define MSG_WHO 0x00010004 // Used for the message with /who content 00308 #define MSG_ACK 0x00010005 // Used for feedback localy (By default, OnScreen Blue) 00309 #define MSG_INFO_BASE 0x00010006 // System messages that are shown on the "Main" tab 00310 #define MSG_COMBAT 0x00020000 00311 #define MSG_COMBAT_DODGE 0x00020001 00312 #define MSG_COMBAT_BLOCK 0x00020002 00313 #define MSG_COMBAT_HITYOU 0x00020003 00314 #define MSG_COMBAT_HITOTHER 0x00020004 00315 #define MSG_COMBAT_YOURHIT 0x00020005 00316 #define MSG_COMBAT_OTHERHIT 0x00020006 00317 #define MSG_COMBAT_MISS 0x00020007 00318 #define MSG_COMBAT_OWN_DEATH 0x00020008 00319 #define MSG_COMBAT_DEATH 0x00020009 00320 #define MSG_COMBAT_VICTORY 0x0002000a 00321 #define MSG_COMBAT_STANCE 0x0002000b 00322 #define MSG_COMBAT_NEARLY_DEAD 0x0002000c 00323 #define MSG_LOOT 0x00030000 00324 #define MSG_SEC 0x00300000 00325 #define SEC_LEVEL0 0x00300000 00326 #define SEC_LEVEL1 0x00300001 00327 #define SEC_LEVEL2 0x00300002 00328 #define SEC_LEVEL3 0x00300003 00329 #define SEC_LEVEL4 0x00300004 00330 #define MSG_PURCHASE 0x00400000 00331 00332 #define TOP_SHORT_INT_VAL 65535 00333 00334 class PublishVector; 00335 class MsgHandler; 00336 00337 00343 class psMessageCracker 00344 { 00345 public: 00346 static MsgHandler* msghandler; 00347 00348 csRef<MsgEntry> msg; 00349 bool valid; 00350 int filterNumber; 00351 00352 psMessageCracker() 00353 : msg(NULL),valid(true) 00354 {} 00355 00356 virtual ~psMessageCracker() {} 00357 00361 void SendMessage(); 00362 00366 void Multicast(csArray<PublishDestination> &multi, uint32_t except, float range); 00367 00371 void FireEvent(); 00372 00381 virtual csString GetMessageTypeName() const = 0; 00382 00394 virtual csString ToString(NetBase::AccessPointers* accessPointers) = 0; 00395 //{ return "Not implemented"; } 00396 }; 00397 00398 //----------------------------------------------------------------------------- 00399 //----------------------------------------------------------------------------- 00400 00401 // PSF MESSAGE FACTORY stuff 00402 00403 typedef psMessageCracker* (*psfMsgFactoryFunc)(MsgEntry* me, NetBase::AccessPointers* accessPointers); 00404 00405 csString GetMsgTypeName(int msgType); 00406 void DecodeMessage(MsgEntry* me, NetBase::AccessPointers* accessPointers, bool filterhex, csString &msgText, int &filterNumber); 00407 00408 void psfRegisterMsgFactoryFunction(psfMsgFactoryFunc factoryfunc, int msgtype, const char* msgtypename); 00409 void psfUnRegisterMsgFactories(void); 00410 psMessageCracker* psfCreateMsg(int msgtype, 00411 MsgEntry* me, 00412 NetBase::AccessPointers* accessPointers); 00413 csString psfMsgTypeName(int msgType); 00414 int psfMsgType(const char* msgTypeName); 00415 00416 #define PSF_DECLARE_MSG_FACTORY() \ 00417 virtual csString GetMessageTypeName() const; \ 00418 static psMessageCracker* CreateMessage(MsgEntry* me, \ 00419 NetBase::AccessPointers* accessPointers) 00420 00421 #define PSF_IMPLEMENT_MSG_FACTORY_REGISTER(Class,MsgType) \ 00422 class Class##_StaticInit \ 00423 { \ 00424 public: \ 00425 Class##_StaticInit() \ 00426 { \ 00427 psfRegisterMsgFactoryFunction (Class::CreateMessage, \ 00428 MsgType,#MsgType); \ 00429 } \ 00430 } Class##_static_init__ 00431 00432 00433 #define PSF_IMPLEMENT_MSG_FACTORY_CREATE1(Class) \ 00434 psMessageCracker* Class::CreateMessage(MsgEntry* me, \ 00435 NetBase::AccessPointers* /*accessPointers*/) \ 00436 { \ 00437 return (psMessageCracker*)new Class(me); \ 00438 } 00439 00440 #define PSF_IMPLEMENT_MSG_FACTORY_TYPENAME(Class,MsgType) \ 00441 csString Class::GetMessageTypeName() const \ 00442 { \ 00443 return #MsgType; \ 00444 } 00445 00446 #define PSF_IMPLEMENT_MSG_FACTORY(Class,MsgType) \ 00447 PSF_IMPLEMENT_MSG_FACTORY_TYPENAME(Class,MsgType) \ 00448 PSF_IMPLEMENT_MSG_FACTORY_CREATE1(Class) \ 00449 PSF_IMPLEMENT_MSG_FACTORY_REGISTER(Class,MsgType) 00450 00451 #define PSF_IMPLEMENT_MSG_FACTORY_CREATE2(Class) \ 00452 psMessageCracker* Class::CreateMessage(MsgEntry* me, \ 00453 NetBase::AccessPointers* a_p) \ 00454 { \ 00455 return (psMessageCracker*)new Class(me, a_p); \ 00456 } 00457 00458 #define PSF_IMPLEMENT_MSG_FACTORY_ACCESS_POINTER(Class,MsgType) \ 00459 PSF_IMPLEMENT_MSG_FACTORY_TYPENAME(Class,MsgType) \ 00460 PSF_IMPLEMENT_MSG_FACTORY_CREATE2(Class) \ 00461 PSF_IMPLEMENT_MSG_FACTORY_REGISTER(Class,MsgType) 00462 00463 //----------------------------------------------------------------------------- 00464 //----------------------------------------------------------------------------- 00465 00467 class psMarriageMsgPropose : public psMessageCracker 00468 { 00469 public: 00470 psMarriageMsgPropose(const char* charName, const char* proposeMessage, 00471 uint32_t clientNum = 0); 00472 psMarriageMsgPropose(MsgEntry* message); 00473 00474 PSF_DECLARE_MSG_FACTORY(); 00475 00482 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00483 00484 csString charName; 00485 csString proposeMsg; 00486 }; 00487 00489 class psMarriageMsgDivorce : public psMessageCracker 00490 { 00491 public: 00492 psMarriageMsgDivorce(const char* divorceMessage, uint32_t clientNum = 0); 00493 psMarriageMsgDivorce(MsgEntry* message); 00494 00495 PSF_DECLARE_MSG_FACTORY(); 00496 00503 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00504 00505 csString divorceMsg; 00506 }; 00507 00509 class psMarriageMsgDivorceConfirm : public psMessageCracker 00510 { 00511 public: 00512 psMarriageMsgDivorceConfirm(uint32_t clientNum = 0); 00513 psMarriageMsgDivorceConfirm(MsgEntry* message); 00514 00515 PSF_DECLARE_MSG_FACTORY(); 00516 00523 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00524 }; 00525 00526 00531 class psCharDeleteMessage : public psMessageCracker 00532 { 00533 public: 00534 psCharDeleteMessage(const char* charNameToDel, uint32_t clientNum); 00535 psCharDeleteMessage(MsgEntry* message); 00536 00537 PSF_DECLARE_MSG_FACTORY(); 00538 00545 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00546 00547 csString charName; 00548 }; 00549 00555 class psPreAuthenticationMessage : public psMessageCracker 00556 { 00557 public: 00558 uint32_t netversion; 00562 psPreAuthenticationMessage(uint32_t clientnum,uint32_t version=PS_NETVERSION); 00568 psPreAuthenticationMessage(MsgEntry* message); 00569 00570 00571 PSF_DECLARE_MSG_FACTORY(); 00572 00579 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00580 00581 bool NetVersionOk(); 00582 }; 00583 00587 class psAuthenticationMessage : public psMessageCracker 00588 { 00589 public: 00590 uint32_t netversion; 00591 csString sAddr, 00592 sUser, 00593 sPassword, 00594 sPassword256, 00595 os_, 00596 os_platform, 00597 machine_type, 00598 gfxcard_, gfxversion_; 00599 uint16 os_ver_major, 00600 os_ver_minor; 00601 00607 psAuthenticationMessage(uint32_t clientnum,const char* userid, 00608 const char* password, const char* os, uint16 os_ver_major, uint16 os_ver_minor, const char *os_platform, const char *machine_type, const char* gfxcard, const char* gfxversion, const char* sPassword256 = "", uint32_t version=PS_NETVERSION); 00609 00615 psAuthenticationMessage(MsgEntry* message); 00616 00617 00618 PSF_DECLARE_MSG_FACTORY(); 00619 00626 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00627 00628 bool NetVersionOk(); 00629 }; 00630 00631 class psCharacterPickerMessage : public psMessageCracker 00632 { 00633 public: 00634 psCharacterPickerMessage(const char* character); 00635 psCharacterPickerMessage(MsgEntry* message); 00636 00637 PSF_DECLARE_MSG_FACTORY(); 00638 00645 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00646 00648 csString characterName; 00649 }; 00650 00651 class psCharacterApprovedMessage : public psMessageCracker 00652 { 00653 public: 00654 psCharacterApprovedMessage(uint32_t clientnum); 00655 psCharacterApprovedMessage(MsgEntry* message); 00656 00657 PSF_DECLARE_MSG_FACTORY(); 00658 00665 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00666 }; 00667 00671 class psPreAuthApprovedMessage : public psMessageCracker 00672 { 00673 public: 00674 00675 uint32_t ClientNum; 00677 psPreAuthApprovedMessage(uint32_t clientnum); 00678 00680 psPreAuthApprovedMessage(MsgEntry* message); 00681 00682 PSF_DECLARE_MSG_FACTORY(); 00683 00690 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00691 00692 }; 00693 00697 class psAuthApprovedMessage : public psMessageCracker 00698 { 00699 public: 00703 uint32_t msgClientValidToken; 00707 PID msgPlayerID; 00708 00710 uint8_t msgNumOfChars; 00711 00716 psAuthApprovedMessage(uint32_t clientnum, PID playerID, uint8_t numCharacters); 00717 00719 psAuthApprovedMessage(MsgEntry* message); 00720 00722 void AddCharacter(const char* fullname, const char* race, 00723 const char* mesh, const char* traits, const char* equipment); 00724 00726 void GetCharacter(MsgEntry* message,csString &fullname, csString &race, 00727 csString &mesh, csString &traits,csString &equipment); 00728 00730 void ConstructMsg(); 00731 00732 PSF_DECLARE_MSG_FACTORY(); 00733 00740 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00741 00742 private: 00743 csStringArray contents; 00744 }; 00745 00746 00750 class psAuthRejectedMessage : public psMessageCracker 00751 { 00752 public: 00754 csString msgReason; 00755 00757 psAuthRejectedMessage(uint32_t clientToken,const char* reason); 00758 00760 psAuthRejectedMessage(MsgEntry* message); 00761 00762 PSF_DECLARE_MSG_FACTORY(); 00763 00770 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00771 00772 }; 00773 00774 enum 00775 { 00776 CHAT_SYSTEM, 00777 CHAT_COMBAT, 00778 CHAT_SAY, 00779 CHAT_TELL, 00780 CHAT_GROUP, 00781 CHAT_GUILD, 00782 CHAT_ALLIANCE, 00783 CHAT_AUCTION, 00784 CHAT_SHOUT, 00785 CHAT_CHANNEL, 00786 CHAT_TELLSELF, 00787 CHAT_REPORT, 00788 CHAT_ADVISOR, 00789 CHAT_ADVICE, 00790 CHAT_ADVICE_LIST, 00791 CHAT_SERVER_TELL, 00792 CHAT_GM, 00793 CHAT_SERVER_INFO, 00794 CHAT_NPC, 00795 CHAT_NPCINTERNAL, 00796 CHAT_SYSTEM_BASE, 00797 CHAT_PET_ACTION, 00798 CHAT_NPC_ME, 00799 CHAT_NPC_MY, 00800 CHAT_NPC_NARRATE, 00801 CHAT_AWAY, 00802 CHAT_END 00803 }; 00804 00808 class psChatMessage : public psMessageCracker 00809 { 00810 public: 00812 uint8_t iChatType; 00813 00815 csString sPerson; 00816 00824 csString sOther; 00825 00827 csString sText; 00828 00830 bool translate; 00831 00833 EID actor; 00834 00835 uint16_t channelID; 00836 00840 psChatMessage(uint32_t cnum, EID actorid, const char* person, const char* other, const char* chatMessage, 00841 uint8_t type, bool translate, uint16_t channelID = 0); 00842 00847 psChatMessage(MsgEntry* message); 00848 00849 00850 PSF_DECLARE_MSG_FACTORY(); 00851 00858 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00859 00861 const char* GetTypeText(); 00862 }; 00863 00867 class psChannelJoinMessage : public psMessageCracker 00868 { 00869 public: 00870 csString channel; 00871 psChannelJoinMessage(const char* name); 00872 psChannelJoinMessage(MsgEntry* message); 00873 00874 PSF_DECLARE_MSG_FACTORY(); 00875 00882 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00883 }; 00884 00888 class psChannelJoinedMessage : public psMessageCracker 00889 { 00890 public: 00891 uint16_t id; 00892 csString channel; 00893 psChannelJoinedMessage(uint32_t clientnum, const char* name, uint16_t id); 00894 psChannelJoinedMessage(MsgEntry* message); 00895 00896 PSF_DECLARE_MSG_FACTORY(); 00897 00904 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00905 }; 00906 00910 class psChannelLeaveMessage : public psMessageCracker 00911 { 00912 public: 00913 uint16_t chanID; 00914 psChannelLeaveMessage(uint16_t id); 00915 psChannelLeaveMessage(MsgEntry* message); 00916 00917 PSF_DECLARE_MSG_FACTORY(); 00918 00919 00926 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00927 }; 00928 00933 #define MAXSYSTEMMSGSIZE 1024 00934 00935 class psSystemMessage : public psMessageCracker 00936 { 00937 protected: 00938 psSystemMessage() {} 00939 public: 00940 csString msgline; 00941 uint32_t type; 00942 00943 psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char* fmt, ...); 00944 psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char* fmt, va_list args); 00945 psSystemMessage(MsgEntry* message); 00946 00947 PSF_DECLARE_MSG_FACTORY(); 00948 00955 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00956 }; 00957 00962 class psSystemMessageSafe : public psSystemMessage 00963 { 00964 public: 00965 psSystemMessageSafe(uint32_t clientnum, uint32_t msgtype, 00966 const char* text); 00967 }; 00968 00972 struct psPetitionInfo 00973 { 00974 int id; 00975 csString petition; 00976 csString status; 00977 csString assignedgm; 00978 00979 int escalation; 00980 csString player; 00981 csString created; 00982 csString resolution; 00983 00984 bool online; 00985 }; 00986 00987 enum 00988 { 00989 PETITION_LIST = 0, 00990 PETITION_CANCEL = 1, 00991 PETITION_CLOSE = 2, 00992 PETITION_CHANGE = 3, 00993 PETITION_ASSIGN = 4, 00994 PETITION_DEASSIGN = 5, 00995 PETITION_ESCALATE = 6, 00996 PETITION_DESCALATE = 7, 00997 PETITION_DIRTY = 8 00998 }; 00999 01003 class psPetitionMessage : public psMessageCracker 01004 { 01005 public: 01006 csArray<psPetitionInfo> petitions; 01007 bool success; 01008 csString error; 01009 int msgType; 01010 bool isGM; 01011 01012 psPetitionMessage() 01013 { 01014 msgType = PETITION_LIST; 01015 } 01016 psPetitionMessage(uint32_t clientnum, csArray<psPetitionInfo>* petitionArray, const char* errMsg, 01017 bool succeed = true, int type = PETITION_LIST, bool gm = false); 01018 psPetitionMessage(MsgEntry* message); 01019 01020 PSF_DECLARE_MSG_FACTORY(); 01021 01028 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01029 }; 01030 01045 class psPetitionRequestMessage: public psMessageCracker 01046 { 01047 public: 01048 bool isGM; 01049 csString request; 01050 csString desc; 01051 int id; 01052 01053 psPetitionRequestMessage(bool gm, const char* requestCmd, int petitionID = -1, const char* petDesc = ""); 01054 psPetitionRequestMessage(MsgEntry* message); 01055 01056 PSF_DECLARE_MSG_FACTORY(); 01057 01064 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01065 }; 01066 01070 class psGMGuiMessage : public psMessageCracker 01071 { 01072 public: 01073 01074 struct PlayerInfo 01075 { 01076 csString name; 01077 csString lastName; 01078 int gender; 01079 csString guild; 01080 csString sector; 01081 }; 01082 01083 int gmSettings; 01084 csArray<PlayerInfo> players; 01085 int type; 01086 01087 enum 01088 { 01089 TYPE_QUERYPLAYERLIST, 01090 TYPE_PLAYERLIST, 01091 TYPE_GETGMSETTINGS 01092 }; 01093 01094 psGMGuiMessage(uint32_t clientnum, int gmSets); 01095 psGMGuiMessage(uint32_t clientnum, csArray<PlayerInfo>* playerArray, int type); 01096 psGMGuiMessage(MsgEntry* message); 01097 01098 PSF_DECLARE_MSG_FACTORY(); 01099 01106 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01107 }; 01108 01109 //-------------------------------------------------------------------------- 01110 01114 class psGuildCmdMessage : public psMessageCracker 01115 { 01116 public: 01117 csString command, subCmd, permission, guildname, player, levelname, accept, secret, web_page,motd, alliancename; 01118 int level; 01119 01120 01121 psGuildCmdMessage(const char* cmd); 01122 psGuildCmdMessage(MsgEntry* message); 01123 01124 PSF_DECLARE_MSG_FACTORY(); 01125 01132 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01133 }; 01134 01135 //-------------------------------------------------------------------------- 01136 01143 class psGUIGuildMessage : public psMessageCracker 01144 { 01145 public: 01146 enum Command { SUBSCRIBE_GUILD_DATA, 01147 01148 UNSUBSCRIBE_GUILD_DATA, 01149 SET_ONLINE, 01150 01151 01152 GUILD_DATA, 01153 LEVEL_DATA, 01154 MEMBER_DATA, 01155 ALLIANCE_DATA, 01156 01157 CLOSE_WINDOW, 01158 01159 NOT_IN_GUILD, 01160 01161 01162 SET_LEVEL_RIGHT, 01163 01164 SET_MEMBER_POINTS, 01165 SET_MAX_GUILD_POINTS, 01166 SET_MEMBER_PUBLIC_NOTES, 01167 SET_MEMBER_PRIVATE_NOTES, 01168 01169 SET_GUILD_NOTIFICATION, 01170 SET_ALLIANCE_NOTIFICATION 01171 }; 01172 01183 psGUIGuildMessage(uint32_t command, 01184 csString commandData); 01185 01197 psGUIGuildMessage(uint32_t clientNum, 01198 uint32_t command, 01199 csString commandData); 01200 01202 psGUIGuildMessage(MsgEntry* message); 01203 01204 PSF_DECLARE_MSG_FACTORY(); 01205 01212 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01213 01214 uint32_t command; 01215 csString commandData; 01216 }; 01217 01218 //-------------------------------------------------------------------------- 01219 01223 class psGroupCmdMessage : public psMessageCracker 01224 { 01225 public: 01226 csString command,player,accept; 01227 01228 psGroupCmdMessage(const char* cmd); 01229 psGroupCmdMessage(uint32_t clientnum,const char* cmd); 01230 psGroupCmdMessage(MsgEntry* message); 01231 01232 PSF_DECLARE_MSG_FACTORY(); 01233 01240 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01241 }; 01242 01243 //-------------------------------------------------------------------------- 01244 01249 class psUserCmdMessage : public psMessageCracker 01250 { 01251 public: 01252 csString command,player,filter,action,text,target,attack; 01253 int dice,sides,dtarget; 01254 int level; 01255 csString stance; 01256 01257 psUserCmdMessage(const char* cmd); 01258 psUserCmdMessage(MsgEntry* message); 01259 01260 PSF_DECLARE_MSG_FACTORY(); 01261 01268 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01269 }; 01270 01271 //-------------------------------------------------------------------------- 01272 01277 class psWorkCmdMessage : public psMessageCracker 01278 { 01279 public: 01280 csString command; 01281 csString player; 01282 csString filter; 01283 01284 csString repairSlotName; 01285 01286 psWorkCmdMessage(const char* cmd); 01287 psWorkCmdMessage(MsgEntry* message); 01288 01289 PSF_DECLARE_MSG_FACTORY(); 01290 01297 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01298 }; 01299 01300 //-------------------------------------------------------------------------- 01301 01306 class psAdminCmdMessage : public psMessageCracker 01307 { 01308 public: 01309 csString cmd; 01310 01311 psAdminCmdMessage(const char* cmd); 01312 psAdminCmdMessage(const char* cmd, uint32_t client = 0); 01313 01314 psAdminCmdMessage(MsgEntry* message); 01315 01316 PSF_DECLARE_MSG_FACTORY(); 01317 01324 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01325 }; 01326 01327 //-------------------------------------------------------------------------- 01328 01333 class psGenericCmdMessage : public psMessageCracker 01334 { 01335 public: 01336 csString cmd; 01337 01338 psGenericCmdMessage(const char* cmd); 01339 psGenericCmdMessage(const char* cmd, uint32_t client = 0); 01340 01341 psGenericCmdMessage(MsgEntry* message); 01342 01343 PSF_DECLARE_MSG_FACTORY(); 01344 01351 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01352 }; 01353 01354 //-------------------------------------------------------------------------- 01355 class psDisconnectMessage : public psMessageCracker 01356 { 01357 public: 01358 EID actor; 01359 csString msgReason; 01360 01361 psDisconnectMessage(uint32_t clientnum, EID actorid, const char* reason); 01362 psDisconnectMessage(MsgEntry* message); 01363 01364 PSF_DECLARE_MSG_FACTORY(); 01365 01372 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01373 }; 01374 01375 //-------------------------------------------------------------------------- 01376 01377 class psUserActionMessage : public psMessageCracker 01378 { 01379 public: 01380 EID target; 01381 csString action; 01382 csString dfltBehaviors; 01383 01384 psUserActionMessage(uint32_t clientnum, EID target, const char* action, const char* dfltBehaviors=""); 01385 psUserActionMessage(MsgEntry* message); 01386 01387 PSF_DECLARE_MSG_FACTORY(); 01388 01395 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01396 }; 01397 01398 //--------------------------------------------------------------------------- 01399 01401 class psGUIInteractMessage : public psMessageCracker 01402 { 01403 public: 01404 psGUIInteractMessage(uint32_t clientnum, uint32_t options, csString command = ""); 01405 psGUIInteractMessage(MsgEntry* message); 01406 01407 PSF_DECLARE_MSG_FACTORY(); 01408 01415 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01416 01417 enum guiOptions 01418 { 01419 PICKUP = 0x00000001, 01420 EXAMINE = 0x00000002, 01421 UNLOCK = 0x00000004, 01422 LOOT = 0x00000008, 01423 BUYSELL = 0x00000010, 01424 GIVE = 0x00000020, 01425 CLOSE = 0x00000040, 01426 USE = 0x00000080, 01427 PLAYERDESC = 0x00000100, 01428 ATTACK = 0x00000200, 01429 COMBINE = 0x00000400, 01430 EXCHANGE = 0x00000800, 01431 TRAIN = 0x00001000, 01432 NPCTALK = 0x00002000, 01433 // Pet Commands 01434 VIEWSTATS = 0x00004000, 01435 DISMISS = 0x00008000, 01436 // Marriage 01437 MARRIAGE = 0x00010000, 01438 DIVORCE = 0x00020000, 01439 // Stuff 01440 PLAYGAME = 0x00040000, 01441 ENTER = 0x00080000, 01442 LOCK = 0x00100000, 01443 ENTERLOCKED = 0x00200000, 01444 BANK = 0x00400000, 01445 INTRODUCE = 0x00800000, 01446 CONSTRUCT = 0x01000000, 01447 MOUNT = 0x02000000, 01448 UNMOUNT = 0x04000000, 01449 STORAGE = 0x08000000, 01450 GENERIC = 0x10000000 01451 }; 01452 01453 public: 01455 uint32_t options; 01456 csString genericCommand; 01457 }; 01458 01459 //-------------------------------------------------------------------------- 01460 01464 class psMapActionMessage : public psMessageCracker 01465 { 01466 public: 01467 01468 uint32_t command; 01469 enum commands 01470 { 01471 QUERY, 01472 NOT_HANDLED, 01473 SAVE, 01474 LIST, 01475 LIST_QUERY, 01476 DELETE_ACTION, 01477 RELOAD_CACHE 01478 }; 01479 01480 csStringFast<1024> actionXML; 01481 01482 // ctor 01483 psMapActionMessage(uint32_t clientnum, uint32_t cmd, const char* xml); 01484 01485 // cracker 01486 psMapActionMessage(MsgEntry* message); 01487 01488 PSF_DECLARE_MSG_FACTORY(); 01489 01496 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01497 }; 01498 01499 //--------------------------------------------------------------------------- 01501 class psAttackQueueMessage : public psMessageCracker 01502 { 01503 public: 01504 struct AAttack 01505 { 01506 csString Name; 01507 csString Image; 01508 }; 01509 psAttackQueueMessage(); 01510 psAttackQueueMessage(uint32_t clientnum); 01511 psAttackQueueMessage( MsgEntry* me, NetBase::AccessPointers* accessPointers ); 01512 01513 PSF_DECLARE_MSG_FACTORY(); 01514 01515 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01516 01517 void AddAttack(const csString& name, const csString& image); 01518 void Construct(csStringSet* msgstrings); 01519 01520 csArray<AAttack> attacks; 01521 private: 01522 uint32_t client; 01523 uint32_t size; 01524 01525 }; 01526 //--------------------------------------------------------------------------- 01528 class psModeMessage : public psMessageCracker 01529 { 01530 public: 01531 psModeMessage(uint32_t clientnum, EID actorID, uint8_t mode, uint32_t value); 01532 psModeMessage(MsgEntry* message); 01533 01534 PSF_DECLARE_MSG_FACTORY(); 01535 01542 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01543 01544 enum playerMode 01545 { 01546 PEACE = 1, 01547 COMBAT, 01548 SPELL_CASTING, 01549 WORK, 01550 DEAD, 01551 SIT, 01552 OVERWEIGHT, 01553 EXHAUSTED, 01554 DEFEATED, 01555 STATUE, 01556 PLAY, 01557 WALK, 01558 RUN 01559 }; 01560 01561 public: 01562 EID actorID; 01563 uint8_t mode; 01564 uint32_t value; 01565 }; 01566 01567 //--------------------------------------------------------------------------- 01568 01572 class psMoveLockMessage : public psMessageCracker 01573 { 01574 public: 01575 psMoveLockMessage(uint32_t clientnum, bool locked); 01576 psMoveLockMessage(MsgEntry* message); 01577 01578 PSF_DECLARE_MSG_FACTORY(); 01579 01586 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01587 01588 public: 01589 bool locked; 01590 }; 01591 01592 //--------------------------------------------------------------------------- 01593 01595 class psWeatherMessage : public psMessageCracker 01596 { 01597 public: 01598 enum playerMode 01599 { 01600 DAYNIGHT = 1, 01601 WEATHER = 2 01602 }; 01603 01604 enum Weather 01605 { 01606 RAIN = 4, 01607 SNOW = 8, 01608 FOG = 16, 01609 LIGHTNING = 32 01610 }; 01611 01612 struct NetWeatherInfo 01613 { 01614 bool has_downfall; 01615 bool downfall_is_snow; 01616 bool has_fog; 01617 bool has_lightning; 01618 csString sector; 01619 int downfall_drops; // 0 = no downfall 01620 int downfall_fade; 01621 int fog_density; // 0 = no fog 01622 int fog_fade; 01623 int r,g,b; // For fog 01624 }; 01625 01626 psWeatherMessage(uint32_t client, psWeatherMessage::NetWeatherInfo info , uint clientnum = 0); 01627 psWeatherMessage(uint32_t client, int minute, int hour, int day, int month, int year); 01628 psWeatherMessage(MsgEntry* message); 01629 01630 PSF_DECLARE_MSG_FACTORY(); 01631 01638 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01639 01640 public: 01642 int type; 01643 01645 uint minute; 01646 uint hour; 01647 uint day; 01648 uint month; 01649 uint year; 01650 01651 NetWeatherInfo weather; 01652 }; 01653 01654 01655 //--------------------------------------------------------------------------- 01656 01672 class psGUIInventoryMessage : public psMessageCracker 01673 { 01674 public: 01675 enum commands 01676 { 01677 LIST, 01678 REQUEST, 01679 UPDATE_REQUEST, 01680 UPDATE_LIST 01681 }; 01682 01683 // One of the commands as defined above. 01684 uint8_t command; 01685 01695 psGUIInventoryMessage(uint8_t command = REQUEST, uint32_t size=0); 01696 01697 01712 psGUIInventoryMessage(uint32_t clientNum, 01713 uint8_t command, 01714 uint32_t totalItems, 01715 uint32_t totalEmptiedSlots, 01716 float maxWeight, 01717 uint32_t cache_version, 01718 size_t msgsize); 01719 01720 01727 psGUIInventoryMessage(MsgEntry* message, NetBase::AccessPointers* accessPointers); 01728 01729 PSF_DECLARE_MSG_FACTORY(); 01730 01737 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01738 01739 01741 void AddItem(const char* name, 01742 const char* meshName, 01743 const char* materialName, 01744 int containerID, 01745 int slot, 01746 int stackcount, 01747 float weight, 01748 float size, 01749 const char* icon, 01750 int purifyStatus, 01751 csStringSet* msgstrings); 01752 01754 void AddEmptySlot(int containerID, int slotID); 01755 01757 void AddMoney(const psMoney &money); 01758 01759 // Used in a move message. 01760 01762 struct ItemDescription 01763 { 01764 csString name; 01765 csString meshName; 01766 csString materialName; 01767 int slot; 01768 float weight; 01769 float size; 01770 int stackcount; 01771 csString iconImage; 01772 int container; 01773 int purifyStatus; 01774 }; 01775 01776 // Item list 01777 csArray<ItemDescription> items; 01778 size_t totalItems; 01779 size_t totalEmptiedSlots; 01780 float maxWeight; 01781 psMoney money; 01782 uint32 version; 01783 }; 01784 01785 //--------------------------------------------------------------------------- 01786 01788 class psNewSectorMessage : public psMessageCracker 01789 { 01790 public: 01791 psNewSectorMessage(const csString &oldSector, const csString &newSector, csVector3 pos, bool use_yrot = false, float yrot = 0.0); 01792 psNewSectorMessage(MsgEntry* message); 01793 01794 PSF_DECLARE_MSG_FACTORY(); 01795 01802 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01803 01804 public: 01806 csString oldSector, newSector; 01807 csVector3 pos; 01808 float yrot; 01809 bool use_yrot; 01810 }; 01811 01812 //--------------------------------------------------------------------------- 01813 01815 class psLootItemMessage : public psMessageCracker 01816 { 01817 public: 01818 enum 01819 { 01820 LOOT_SELF, 01821 LOOT_ROLL 01822 }; 01823 psLootItemMessage(int client, EID entity, int item, int action); 01824 psLootItemMessage(MsgEntry* message); 01825 01826 PSF_DECLARE_MSG_FACTORY(); 01827 01834 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01835 01836 EID entity; 01837 int lootitem; 01838 int lootaction; 01839 }; 01840 01841 //--------------------------------------------------------------------------- 01842 01844 class psLootMessage : public psMessageCracker 01845 { 01846 public: 01847 psLootMessage(); 01848 psLootMessage(MsgEntry* message); 01849 01850 PSF_DECLARE_MSG_FACTORY(); 01851 01858 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01859 01860 void Populate(EID entity, csString &lootstr, int cnum); 01861 01862 EID entity_id; 01863 csString lootxml; 01864 }; 01865 01866 //--------------------------------------------------------------------------- 01867 01869 class psQuestListMessage : public psMessageCracker 01870 { 01871 public: 01872 psQuestListMessage(); 01873 psQuestListMessage(MsgEntry* message); 01874 01875 PSF_DECLARE_MSG_FACTORY(); 01876 01883 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01884 01885 void Populate(csString &queststr, int cnum); 01886 01887 csString questxml; 01888 }; 01889 01890 //--------------------------------------------------------------------------- 01891 01893 class psQuestInfoMessage : public psMessageCracker 01894 { 01895 public: 01896 enum 01897 { 01898 CMD_QUERY, 01899 CMD_INFO, 01900 CMD_DISCARD 01901 }; 01902 psQuestInfoMessage(int cnum, int cmd, int id, const char* name,const char* info); 01903 psQuestInfoMessage(MsgEntry* message); 01904 01905 PSF_DECLARE_MSG_FACTORY(); 01906 01913 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01914 01915 int command,id; 01916 csString xml; 01917 }; 01918 01919 //--------------------------------------------------------------------------- 01920 01922 class psOverrideActionMessage : public psMessageCracker 01923 { 01924 public: 01925 psOverrideActionMessage(int client, EID entity, const char* action, int duration = 0); 01926 psOverrideActionMessage(MsgEntry* message); 01927 01928 PSF_DECLARE_MSG_FACTORY(); 01929 01936 virtual csString ToString(NetBase::AccessPointers* accessPointers); 01937 01938 EID entity_id; 01939 csString action; 01940 int duration; 01941 }; 01942 01943 //--------------------------------------------------------------------------- 01944 01945 01946 //-------------------------------------------------------------------------- 01947 01955 class psEquipmentMessage : public psMessageCracker 01956 { 01957 public: 01958 enum Command { EQUIP, DEEQUIP }; 01959 01978 psEquipmentMessage(uint32_t clientNum, 01979 EID actorid, 01980 uint8_t type, 01981 int slot, 01982 csString &mesh, 01983 csString &part, 01984 csString &texture, 01985 csString &partMesh, 01986 csString &removedMesh); 01987 01988 01990 psEquipmentMessage(MsgEntry* message); 01991 01992 PSF_DECLARE_MSG_FACTORY(); 01993 02000 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02001 02002 uint8_t type; 02003 int player; 02004 csString mesh; 02005 int slot; 02006 csString part; 02007 csString texture; 02008 csString partMesh; /* Set if the body part given by pattern given in part 02009 should be replaced with this */ 02010 csString removedMesh; 02011 }; 02012 02013 //-------------------------------------------------------------------------- 02014 02020 //-------------------------------------------------------------------------- 02021 02027 class psGUIMerchantMessage : public psMessageCracker 02028 { 02029 public: 02030 enum Command { REQUEST, 02031 MERCHANT, 02032 CATEGORIES, 02033 CATEGORY, 02034 MONEY, 02035 ITEMS, 02036 BUY, 02037 SELL, 02038 VIEW, 02039 CANCEL 02040 }; 02041 02053 psGUIMerchantMessage(uint32_t clientNum, 02054 uint8_t command, 02055 csString commandData); 02056 02057 psGUIMerchantMessage(uint8_t command, 02058 csString commandData); 02059 02061 psGUIMerchantMessage(MsgEntry* message); 02062 02063 PSF_DECLARE_MSG_FACTORY(); 02064 02071 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02072 02073 uint8_t command; 02074 csString commandData; 02075 }; 02076 02077 //-------------------------------------------------------------------------- 02078 02083 class psGUIStorageMessage : public psMessageCracker 02084 { 02085 public: 02086 enum Command { REQUEST, 02087 STORAGE, 02088 CATEGORIES, 02089 CATEGORY, 02090 MONEY, 02091 ITEMS, 02092 WITHDRAW, 02093 STORE, 02094 VIEW, 02095 CANCEL 02096 }; 02097 02109 psGUIStorageMessage(uint32_t clientNum, 02110 uint8_t command, 02111 csString commandData); 02112 02113 psGUIStorageMessage(uint8_t command, 02114 csString commandData); 02115 02117 psGUIStorageMessage(MsgEntry* message); 02118 02119 PSF_DECLARE_MSG_FACTORY(); 02120 02127 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02128 02129 uint8_t command; 02130 csString commandData; 02131 }; 02132 02133 //-------------------------------------------------------------------------- 02134 02140 class psGUIGroupMessage : public psMessageCracker 02141 { 02142 public: 02143 enum Command { GROUP, 02144 MEMBERS, 02145 LEAVE 02146 }; 02147 02159 psGUIGroupMessage(uint32_t clientNum, 02160 uint8_t command, 02161 csString commandData); 02162 02163 psGUIGroupMessage(uint8_t command, 02164 csString commandData); 02165 02167 psGUIGroupMessage(MsgEntry* message); 02168 02169 PSF_DECLARE_MSG_FACTORY(); 02170 02177 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02178 02179 uint8_t command; 02180 csString commandData; 02181 }; 02182 02183 class psSpellCancelMessage : public psMessageCracker 02184 { 02185 public: 02186 psSpellCancelMessage() 02187 { 02188 msg.AttachNew(new MsgEntry()); 02189 msg->SetType(MSGTYPE_SPELL_CANCEL); 02190 msg->clientnum = 0; 02191 } 02192 psSpellCancelMessage(MsgEntry* /*message*/) {}; 02193 02194 PSF_DECLARE_MSG_FACTORY(); 02195 02202 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02203 }; 02204 02205 //-------------------------------------------------------------------------- 02210 class psCraftCancelMessage : public psMessageCracker 02211 { 02212 public: 02213 psCraftCancelMessage() 02214 { 02215 msg.AttachNew(new MsgEntry()); 02216 msg->SetType(MSGTYPE_CRAFT_CANCEL); 02217 msg->clientnum = 0; 02218 } 02219 psCraftCancelMessage(MsgEntry* message) 02220 { 02221 craftTime = message->GetInt32(); 02222 } 02223 02224 PSF_DECLARE_MSG_FACTORY(); 02225 02229 void SetCraftTime(int craftTime, uint32_t client); 02236 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02237 02238 int craftTime; 02239 }; 02240 02241 //-------------------------------------------------------------------------- 02242 02243 class psAttackBookMessage : public psMessageCracker 02244 { 02245 public: 02246 struct NetworkAttack 02247 { 02248 csString name; 02249 csString description; 02250 csString type; 02251 csString image; 02252 }; 02253 02254 psAttackBookMessage(); 02255 psAttackBookMessage( uint32_t client ); 02256 psAttackBookMessage( MsgEntry* me, NetBase::AccessPointers* accessPointers ); 02257 02258 PSF_DECLARE_MSG_FACTORY(); 02259 02260 02267 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02268 02269 void AddAttack(const csString& name, const csString& description, const csString& type, const csString& image); 02270 void Construct(csStringSet* msgstrings); 02271 02272 csArray<NetworkAttack> attacks; 02273 02274 private: 02275 uint32_t size; 02276 uint32_t client; 02277 }; 02278 //-------------------------------------------------------------------------- 02279 class psSpellBookMessage : public psMessageCracker 02280 { 02281 public: 02282 struct NetworkSpell 02283 { 02284 csString name; 02285 csString description; 02286 csString way; 02287 int realm; 02288 csString glyphs[4]; 02289 csString image; 02290 }; 02291 02292 psSpellBookMessage(); 02293 psSpellBookMessage(uint32_t client); 02294 psSpellBookMessage(MsgEntry* me, NetBase::AccessPointers* accessPointers); 02295 02296 PSF_DECLARE_MSG_FACTORY(); 02297 02304 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02305 02306 void AddSpell(const csString &name, const csString &description, const csString &way, int realm, const csString &glyph0, const csString &glyph1, const csString &glyph2, const csString &glyph3, const csString &image); 02307 void Construct(csStringSet* msgstrings); 02308 02309 csArray<NetworkSpell> spells; 02310 02311 private: 02312 uint32_t size; 02313 uint32_t client; 02314 }; 02315 02316 //-------------------------------------------------------------------------- 02317 02318 class psPurifyGlyphMessage : public psMessageCracker 02319 { 02320 public: 02321 psPurifyGlyphMessage(uint32_t glyphID); 02322 psPurifyGlyphMessage(MsgEntry* me); 02323 02324 PSF_DECLARE_MSG_FACTORY(); 02325 02332 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02333 02334 uint32_t glyph; 02335 }; 02336 02337 //-------------------------------------------------------------------------- 02338 02342 class psSpellCastMessage : public psMessageCracker 02343 { 02344 public: 02345 psSpellCastMessage(csString &spellName, float kFactor); 02346 psSpellCastMessage(MsgEntry* me); 02347 02348 PSF_DECLARE_MSG_FACTORY(); 02349 02356 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02357 02358 csString spell; 02359 float kFactor; 02360 }; 02361 02362 02363 //-------------------------------------------------------------------------- 02364 class psGlyphAssembleMessage : public psMessageCracker 02365 { 02366 public: 02367 psGlyphAssembleMessage() {} 02368 02369 psGlyphAssembleMessage(int slot0, int slot1, int slot2, int slot3, bool info = false); 02370 psGlyphAssembleMessage(uint32_t clientNum, 02371 csString spellName, csString image, csString description); 02372 psGlyphAssembleMessage(MsgEntry* me); 02373 void FromClient(MsgEntry* me); 02374 void FromServer(MsgEntry* me); 02375 02376 PSF_DECLARE_MSG_FACTORY(); 02377 02384 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02385 02386 int glyphs[4]; 02387 bool info; 02388 csString description; 02389 csString name; 02390 csString image; 02391 02392 private: 02393 bool msgFromServer; 02394 }; 02395 02396 02397 02398 class psRequestGlyphsMessage : public psMessageCracker 02399 { 02400 public: 02401 struct NetworkGlyph 02402 { 02403 csString name; 02404 csString image; 02405 uint32_t purifiedStatus; 02406 uint32_t way; 02407 uint32_t statID; 02408 }; 02409 02410 02411 psRequestGlyphsMessage(uint32_t client = 0); 02412 psRequestGlyphsMessage(MsgEntry* me); 02413 virtual ~psRequestGlyphsMessage(); 02414 02415 PSF_DECLARE_MSG_FACTORY(); 02416 02423 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02424 02425 void AddGlyph(csString name, csString image, int purifiedStatus, 02426 int way, int statID); 02427 02428 void Construct(); 02429 02430 csArray<NetworkGlyph> glyphs; 02431 private: 02432 size_t size; 02433 uint32_t client; 02434 02435 }; 02436 02437 02438 //-------------------------------------------------------------------------- 02439 class psStopEffectMessage : public psMessageCracker 02440 { 02441 public: 02442 psStopEffectMessage(uint32_t clientNum, uint32_t uid) 02443 { 02444 msg.AttachNew(new MsgEntry(sizeof(uint32_t))); 02445 02446 msg->SetType(MSGTYPE_EFFECT_STOP); 02447 msg->clientnum = clientNum; 02448 msg->Add(uid); 02449 valid = !(msg->overrun); 02450 } 02451 02452 psStopEffectMessage(uint32_t uid) 02453 { 02454 msg.AttachNew(new MsgEntry(sizeof(uint32_t))); 02455 02456 msg->SetType(MSGTYPE_EFFECT_STOP); 02457 msg->clientnum = 0; 02458 msg->Add(uid); 02459 valid = !(msg->overrun); 02460 } 02461 02462 psStopEffectMessage(MsgEntry* message) 02463 { 02464 if(!message) 02465 return; 02466 02467 uid = message->GetUInt32(); 02468 } 02469 02470 PSF_DECLARE_MSG_FACTORY(); 02471 csString ToString(NetBase::AccessPointers* /*accessPointers*/) 02472 { 02473 csString msgtext; 02474 msgtext.AppendFmt("Effect ID: %d", uid); 02475 return msgtext; 02476 } 02477 02478 uint32_t uid; 02479 }; 02480 02481 02487 class psEffectMessage : public psMessageCracker 02488 { 02489 public: 02490 02503 psEffectMessage(uint32_t clientNum, const csString &effectName, 02504 const csVector3 &effectOffset, EID anchorID, 02505 EID targetID, uint32_t uid, float scale1 = 0.0, float scale2 = 0.0, float scale3 = 0.0, float scale4 = 0.0); 02506 02520 psEffectMessage(uint32_t clientNum, const csString &effectName, 02521 const csVector3 &effectOffset, EID anchorID, 02522 EID targetID, uint32_t duration, uint32_t uid, float scale1 = 0.0, float scale2 = 0.0, float scale3 = 0.0, float scale4 = 0.0); 02523 02527 psEffectMessage(MsgEntry* message); 02528 02529 PSF_DECLARE_MSG_FACTORY(); 02530 02537 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02538 02539 csString name; 02540 csVector3 offset; 02541 EID anchorID; 02542 EID targetID; 02543 uint32_t duration; 02544 uint32_t uid; 02545 float scale[4]; // Scales of the effect, not sent on network if 0. 02546 }; 02547 02548 //-------------------------------------------------------------------------- 02549 02554 class psGUITargetUpdateMessage : public psMessageCracker 02555 { 02556 public: 02564 psGUITargetUpdateMessage(uint32_t clientNum, EID targetID); 02565 02566 psGUITargetUpdateMessage(MsgEntry* message); 02567 02568 PSF_DECLARE_MSG_FACTORY(); 02569 02576 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02577 02578 uint32_t clientNum; 02579 EID targetID; 02580 }; 02581 02582 02586 class psMsgStringsMessage : public psMessageCracker 02587 { 02588 public: 02593 csStringHashReversible* msgstrings; 02594 02596 psMsgStringsMessage(); 02597 02599 psMsgStringsMessage(uint32_t clientnum, csMD5::Digest &digest); 02600 02602 psMsgStringsMessage(uint32_t clientnum, csMD5::Digest &digest, char* stringsdata, 02603 unsigned long size, uint32_t num_strings); 02604 02606 psMsgStringsMessage(MsgEntry* message); 02607 02608 PSF_DECLARE_MSG_FACTORY(); 02609 02616 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02617 02618 csMD5::Digest* digest; 02619 bool only_carrying_digest; 02620 02621 private: 02622 uint32_t nstrings; 02623 }; 02624 02625 #if 0 02626 02629 class psCharacterDataMessage : public psMessageCracker 02630 { 02631 public: 02632 csString fullname; 02633 csString race_name; 02634 csString mesh_name; 02635 csString traits; 02636 csString equipment; 02637 02639 psCharacterDataMessage(uint32_t clientnum, 02640 csString fullname, 02641 csString race_name, 02642 csString mesh_name, 02643 csString traits, 02644 csString equipment); 02645 02647 psCharacterDataMessage(MsgEntry* message); 02648 02649 PSF_DECLARE_MSG_FACTORY(); 02650 02657 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02658 }; 02659 #endif 02660 02665 class psSpecialCombatEventMessage : public psMessageCracker 02666 { 02667 public: 02668 EID attacker_id; 02669 EID target_id; 02670 int attack_anim; 02671 int defense_anim; 02672 02674 psSpecialCombatEventMessage(uint32_t clientnum, 02675 EID attacker, 02676 EID target, 02677 int attack_anim, 02678 int defense_anim); 02679 02680 void SetClientNum(int cnum); 02681 02683 psSpecialCombatEventMessage(MsgEntry *message); 02684 02685 PSF_DECLARE_MSG_FACTORY(); 02686 02693 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02694 }; 02699 class psCombatEventMessage : public psMessageCracker 02700 { 02701 public: 02702 int event_type; 02703 EID attacker_id; 02704 EID target_id; 02705 int target_location; // Where on the target the attack hit/miss 02706 float damage; 02707 int attack_anim; 02708 int defense_anim; 02709 enum 02710 { 02711 COMBAT_DODGE, 02712 COMBAT_BLOCK, 02713 COMBAT_DAMAGE, 02714 COMBAT_MISS, 02715 COMBAT_OUTOFRANGE, 02716 COMBAT_DEATH, 02717 COMBAT_DAMAGE_NEARLY_DEAD // This is equal to COMBAT_DAMAGE plus the target is nearly dead 02718 }; 02719 02721 psCombatEventMessage(uint32_t clientnum, 02722 int event_type, 02723 EID attacker, 02724 EID target, 02725 int target_location, 02726 float damage, 02727 int attack_anim, 02728 int defense_anim); 02729 02730 void SetClientNum(int cnum); 02731 02733 psCombatEventMessage(MsgEntry* message); 02734 02735 PSF_DECLARE_MSG_FACTORY(); 02736 02743 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02744 }; 02745 02746 //-------------------------------------------------------------------------- 02747 02755 class psSoundEventMessage : public psMessageCracker 02756 { 02757 public: 02758 uint32_t type; 02760 psSoundEventMessage(uint32_t clientnum, uint32_t type); 02761 02763 psSoundEventMessage(MsgEntry* message); 02764 02765 PSF_DECLARE_MSG_FACTORY(); 02766 02773 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02774 }; 02775 //-------------------------------------------------------------------------- 02776 02777 class psStatDRMessage : public psMessageCracker 02778 { 02779 public: 02780 psStatDRMessage(uint32_t clientnum, EID eid, csArray<float> fVitals, csArray<uint32_t> uiVitals, uint8_t version, int flags); 02781 02783 psStatDRMessage(); 02784 02786 psStatDRMessage(MsgEntry* me); 02787 02788 PSF_DECLARE_MSG_FACTORY(); 02789 02796 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02797 02798 bool request; // Set to true if this is a request 02799 EID entityid; 02800 uint32_t statsDirty; 02801 uint8_t counter; 02802 02803 float hp,hp_rate,mana,mana_rate,pstam,pstam_rate; 02804 float mstam,mstam_rate,exp,prog; 02805 }; 02806 02807 //-------------------------------------------------------------------------- 02808 02811 class psStatsMessage : public psMessageCracker 02812 { 02813 public: 02821 psStatsMessage(uint32_t client, float maxHP, float maxMana, float maxWeight, float maxCapacity); 02822 02824 psStatsMessage(MsgEntry* me); 02825 02827 psStatsMessage(); 02828 02829 PSF_DECLARE_MSG_FACTORY(); 02830 02837 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02838 02839 bool request; // True if this is a request for stats 02840 float hp; 02841 float mana; 02842 float weight; 02843 float capacity; 02844 }; 02845 02846 02847 02848 02849 //-------------------------------------------------------------------------- 02850 02857 class psGUISkillMessage : public psMessageCracker 02858 { 02859 public: 02860 enum Command { REQUEST, 02861 BUY_SKILL, 02862 SKILL_LIST, 02863 SKILL_SELECTED, 02864 DESCRIPTION, 02865 QUIT 02866 }; 02867 02868 static const char* SkillCommandString[]; 02869 02881 psGUISkillMessage(uint8_t command, 02882 csString commandData); 02883 02884 psGUISkillMessage(uint32_t clientNum, 02885 uint8_t command, 02886 csString commandData, 02887 psSkillCache* skills, 02888 uint32_t str, 02889 uint32_t end, 02890 uint32_t agi, 02891 uint32_t inl, 02892 uint32_t wil, 02893 uint32_t chr, 02894 uint32_t hp, 02895 uint32_t man, 02896 uint32_t physSta, 02897 uint32_t menSta, 02898 uint32_t hpMax, 02899 uint32_t manMax, 02900 uint32_t physStaMax, 02901 uint32_t menStaMax, 02902 bool open, 02903 int32_t focus, 02904 int32_t selSkillCat, 02905 bool isTraining); 02906 02908 psGUISkillMessage(MsgEntry* message); 02909 02910 PSF_DECLARE_MSG_FACTORY(); 02911 02918 virtual csString ToString(NetBase::AccessPointers* accessPointers); 02919 02920 uint8_t command; 02921 csString commandData; 02922 psSkillCache skillCache; 02923 02924 unsigned int strength; 02925 unsigned int endurance; 02926 unsigned int agility; 02927 unsigned int intelligence; 02928 unsigned int will; 02929 unsigned int charisma; 02930 unsigned int hitpoints; 02931 unsigned int mana; 02932 unsigned int physStamina; 02933 unsigned int menStamina; 02934 02935 unsigned int hitpointsMax; 02936 unsigned int manaMax; 02937 unsigned int physStaminaMax; 02938 unsigned int menStaminaMax; 02939 bool openWindow; 02940 int32_t focusSkill; 02941 int32_t skillCat; 02942 bool trainingWindow; //Are we training or not? 02943 02944 private: 02945 bool includeStats; 02946 }; 02947 02948 02949 //-------------------------------------------------------------------------- 02950 02957 class psGUIBankingMessage : public psMessageCracker 02958 { 02959 public: 02960 enum Command { WITHDRAWFUNDS, 02961 DEPOSITFUNDS, 02962 EXCHANGECOINS, 02963 VIEWBANK 02964 }; 02965 02966 psGUIBankingMessage(uint32_t clientNum, 02967 uint8_t command, 02968 bool guild, 02969 int circlesBanked, 02970 int octasBanked, 02971 int hexasBanked, 02972 int triasBanked, 02973 int circles, 02974 int octas, 02975 int hexas, 02976 int trias, 02977 int maxCircles, 02978 int maxOctas, 02979 int maxHexas, 02980 int maxTrias, 02981 float exchangeFee, 02982 bool forceOpen); 02983 02984 psGUIBankingMessage(uint8_t command, 02985 bool guild, 02986 int circles, 02987 int octas, 02988 int hexas, 02989 int trias); 02990 02991 psGUIBankingMessage(uint8_t command, 02992 bool guild, 02993 int coins, 02994 int coin); 02995 02997 psGUIBankingMessage(MsgEntry* message); 02998 02999 PSF_DECLARE_MSG_FACTORY(); 03000 03007 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03008 03009 uint8_t command; 03010 bool guild; 03011 int circlesBanked; 03012 int octasBanked; 03013 int hexasBanked; 03014 int triasBanked; 03015 int circles; 03016 int octas; 03017 int hexas; 03018 int trias; 03019 int maxCircles; 03020 int maxOctas; 03021 int maxHexas; 03022 int maxTrias; 03023 int coins; 03024 int coin; 03025 float exchangeFee; 03026 bool openWindow; 03027 03028 private: 03029 bool sendingFull; 03030 bool sendingExchange; 03031 }; 03032 03033 //-------------------------------------------------------------------------- 03034 03041 class psPetSkillMessage : public psMessageCracker 03042 { 03043 public: 03044 enum Command { REQUEST, 03045 BUY_SKILL, 03046 SKILL_LIST, 03047 SKILL_SELECTED, 03048 DESCRIPTION, 03049 QUIT 03050 }; 03051 03063 psPetSkillMessage(uint8_t command, 03064 csString commandData); 03065 03066 psPetSkillMessage(uint32_t clientNum, 03067 uint8_t command, 03068 csString commandData, 03069 uint32_t str, 03070 uint32_t end, 03071 uint32_t agi, 03072 uint32_t inl, 03073 uint32_t wil, 03074 uint32_t chr, 03075 uint32_t hp, 03076 uint32_t man, 03077 uint32_t physSta, 03078 uint32_t menSta, 03079 uint32_t hpMax, 03080 uint32_t manMax, 03081 uint32_t physStaMax, 03082 uint32_t menStaMax, 03083 bool open, 03084 int32_t focus); 03085 03087 psPetSkillMessage(MsgEntry* message); 03088 03089 PSF_DECLARE_MSG_FACTORY(); 03090 03097 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03098 03099 uint8_t command; 03100 csString commandData; 03101 03102 unsigned int strength; 03103 unsigned int endurance; 03104 unsigned int agility; 03105 unsigned int intelligence; 03106 unsigned int will; 03107 unsigned int charisma; 03108 unsigned int hitpoints; 03109 unsigned int mana; 03110 unsigned int physStamina; 03111 unsigned int menStamina; 03112 03113 unsigned int hitpointsMax; 03114 unsigned int manaMax; 03115 unsigned int physStaminaMax; 03116 unsigned int menStaminaMax; 03117 bool openWindow; 03118 int32_t focusSkill; 03119 03120 private: 03121 bool includeStats; 03122 }; 03123 03124 //----------------------------------------------------------------------------- 03125 03126 class psDRMessage : public psMessageCracker 03127 { 03128 protected: 03129 void WriteDRInfo(uint32_t client, EID mappedid, 03130 bool on_ground, uint8_t mode, uint8_t counter, 03131 const csVector3 &pos, float yrot, iSector* sector, 03132 csString sectorName, const csVector3 &vel, csVector3 &worldVel, 03133 float ang_vel, csStringSet* msgstrings, bool donewriting=true); 03134 void ReadDRInfo(MsgEntry* me, NetBase::AccessPointers* accessPointers); 03135 void CreateMsgEntry(uint32_t client, NetBase::AccessPointers* accessPointers, iSector* sector, csString sectorName); 03136 03138 enum DRDataFlags 03139 { 03140 NOT_MOVING = 0, 03141 ACTOR_MODE = 1 << 0, 03142 ANG_VELOCITY = 1 << 1, 03143 X_VELOCITY = 1 << 2, 03144 Y_VELOCITY = 1 << 3, 03145 Z_VELOCITY = 1 << 4, 03146 X_WORLDVELOCITY = 1 << 5, 03147 Y_WORLDVELOCITY = 1 << 6, 03148 Z_WORLDVELOCITY = 1 << 7, 03149 ALL_DATA = ~0 03150 }; 03151 03152 enum { ON_GOUND = 128 }; 03153 03154 static uint8_t GetDataFlags(const csVector3 &v, const csVector3 &wv, float yrv, uint8_t mode); 03155 03156 public: 03157 uint8_t counter; 03158 bool on_ground; 03159 uint8_t mode; 03160 csVector3 pos, 03161 vel, 03162 worldVel; 03163 float yrot; 03164 iSector* sector; 03165 csString sectorName; 03166 float ang_vel; 03167 EID entityid; 03168 03169 psDRMessage() { } 03170 psDRMessage(uint32_t client, EID mappedid, uint8_t counter, 03171 NetBase::AccessPointers* accessPointers, 03172 psLinearMovement* linmove, uint8_t mode=0); 03173 psDRMessage(uint32_t client, EID mappedid, 03174 bool on_ground, uint8_t mode, uint8_t counter, 03175 const csVector3 &pos, float yrot, iSector* sector, csString sectorName, 03176 const csVector3 &vel, csVector3 &worldVel, float ang_vel, 03177 NetBase::AccessPointers* accessPointers); 03178 psDRMessage(void* data, int size, NetBase::AccessPointers* accessPointers); 03179 psDRMessage(MsgEntry* me, NetBase::AccessPointers* accessPointers); 03180 03182 bool IsNewerThan(uint8_t oldCounter); 03183 03184 PSF_DECLARE_MSG_FACTORY(); 03185 03186 void operator=(psDRMessage &other); 03187 03194 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03195 }; 03196 03197 //----------------------------------------------------------------------------- 03198 03199 class psForcePositionMessage : public psMessageCracker 03200 { 03201 public: 03202 csVector3 pos; 03203 float yrot; 03204 iSector* sector; 03205 csString sectorName; 03206 csString backgroundname; 03207 uint32_t loadTime; 03208 csVector2 start; 03209 csVector2 dest; 03210 csString loadWidget; 03211 float vel; 03212 03213 psForcePositionMessage() { } 03214 psForcePositionMessage(uint32_t client, uint8_t sequence, 03215 const csVector3 &pos, float yRot, iSector* sector, float vel, 03216 csStringSet* msgstrings, uint32_t time = 0, csString loadBackground = "", csVector2 start = 0, csVector2 dest = 0, csString loadWidget = ""); 03217 psForcePositionMessage(MsgEntry* me, NetBase::AccessPointers* accessPointers); 03218 03219 PSF_DECLARE_MSG_FACTORY(); 03220 03221 void operator=(psForcePositionMessage &other); 03222 03229 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03230 }; 03231 03232 //----------------------------------------------------------------------------- 03233 03234 class psPersistWorldRequest : public psMessageCracker 03235 { 03236 public: 03237 psPersistWorldRequest(); 03238 psPersistWorldRequest(MsgEntry* message); 03239 03240 PSF_DECLARE_MSG_FACTORY(); 03241 03248 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03249 }; 03250 03251 class psRequestAllObjects : public psMessageCracker 03252 { 03253 public: 03254 psRequestAllObjects(); 03255 psRequestAllObjects(MsgEntry* message); 03256 03257 PSF_DECLARE_MSG_FACTORY(); 03258 03265 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03266 }; 03267 03268 class psPersistWorld : public psMessageCracker 03269 { 03270 public: 03271 psPersistWorld(uint32_t clientNum, csVector3 pos, const char* sectorName); 03272 psPersistWorld(MsgEntry* me); 03273 03274 PSF_DECLARE_MSG_FACTORY(); 03275 03282 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03283 03284 csString sector; 03285 csVector3 pos; 03286 }; 03287 03288 class psPersistActorRequest : public psMessageCracker 03289 { 03290 public: 03291 psPersistActorRequest() 03292 { 03293 msg.AttachNew(new MsgEntry()); 03294 msg->SetType(MSGTYPE_PERSIST_ACTOR_REQUEST); 03295 msg->clientnum = 0; 03296 } 03297 03298 psPersistActorRequest(MsgEntry* me); 03299 03300 PSF_DECLARE_MSG_FACTORY(); 03301 03308 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03309 03310 }; 03311 03312 03313 class psPersistAllEntities : public psMessageCracker 03314 { 03315 public: 03316 psPersistAllEntities(uint32_t client) 03317 { 03318 msg.AttachNew(new MsgEntry(60000)); 03319 msg->SetType(MSGTYPE_PERSIST_ALL_ENTITIES); 03320 msg->clientnum = client; 03321 } 03322 03323 psPersistAllEntities(MsgEntry* me); 03324 03325 PSF_DECLARE_MSG_FACTORY(); 03326 03333 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03334 03341 bool AddEntityMessage(MsgEntry* newEnt); 03342 03348 MsgEntry* GetEntityMessage(); 03349 }; 03350 03351 03352 class psPersistActor : public psDRMessage 03353 { 03354 public: 03355 enum Flags 03356 { 03357 NONE = 0, 03358 INVISIBLE = 1 << 0, 03359 03360 INVINCIBLE = 1 << 1, 03361 NPC = 1 << 2, 03362 NAMEKNOWN = 1 << 3, 03363 IS_ALIVE = 1 << 4 03364 }; 03365 03366 psPersistActor(uint32_t clientnum, 03367 int type, 03368 int masqueradeType, 03369 bool control, 03370 const char* name, 03371 const char* guild, 03372 const char* factname, 03373 const char* matname, 03374 const char* race, 03375 const char* mountFactname, 03376 const char* MounterAnim, 03377 unsigned short int gender, 03378 float scale, 03379 float mountscale, 03380 const char* helmGroup, 03381 const char* BracerGroup, 03382 const char* BeltGroup, 03383 const char* CloakGroup, 03384 csVector3 collTop, csVector3 collBottom, csVector3 collOffset, 03385 const char* texParts, 03386 const char* equipmentParts, 03387 uint8_t counter, 03388 EID mappedid, csStringSet* msgstrings, psLinearMovement* linmove, 03389 uint8_t movementMode, 03390 uint8_t serverMode, 03391 PID playerID = 0, uint32_t groupID = 0, EID ownerEID = 0, 03392 uint32_t flags = NONE, PID masterID = 0, bool forNPClient = false); 03393 03394 psPersistActor(MsgEntry* me, NetBase::AccessPointers* accessPointers, bool forNPClient = false); 03395 03396 PSF_DECLARE_MSG_FACTORY(); 03397 03404 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03405 03409 void SetInstance(InstanceID instance); 03410 03414 static uint32_t PeekEID(MsgEntry* me); 03415 03416 csString name; 03417 csString guild; 03418 csString factname; 03419 csString matname; 03420 csString race; 03421 csString mountFactname; 03422 csString MounterAnim; 03423 unsigned short int gender; 03424 csString helmGroup; 03425 csString bracerGroup; 03426 csString beltGroup; 03427 csString cloakGroup; 03428 csVector3 top, bottom, offset; 03429 csString texParts; 03430 csString equipment; 03431 int type; 03432 int masqueradeType; 03433 uint8_t serverMode; 03434 PID playerID; 03435 uint32_t groupID; 03436 EID ownerEID; 03437 bool control; 03438 PID masterID; 03439 uint32_t flags; 03440 InstanceID instance; 03441 03442 int posPlayerID; 03443 int posInstance; 03444 float scale; 03445 float mountScale; 03446 }; 03447 03448 03449 class psPersistItem : public psMessageCracker 03450 { 03451 public: 03452 enum Flags 03453 { 03454 NONE = 0, 03455 NOPICKUP = 1 << 0, 03456 COLLIDE = 1 << 1, 03457 TRIBEID = 1 << 2, 03458 ITEM_UID = 1 << 3 03459 }; 03460 03461 psPersistItem(uint32_t clientnum, 03462 EID id, 03463 int type, 03464 const char* name, 03465 const char* factname, 03466 const char* matname, 03467 const char* sector, 03468 csVector3 pos, 03469 float xRot, 03470 float yRot, 03471 float zRot, 03472 uint32_t flags, 03473 csStringSet* msgstrings, 03474 uint32_t tribeid = 0, 03475 uint32_t uid = 0 03476 ); 03477 03478 psPersistItem(MsgEntry* me, NetBase::AccessPointers* accessPointers); 03479 03480 PSF_DECLARE_MSG_FACTORY(); 03481 03488 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03489 03490 csString name; 03491 csString factname; 03492 csString matname; 03493 csString sector; 03494 csVector3 pos; 03495 float xRot; 03496 float yRot; 03497 float zRot; 03498 uint32_t tribeID; 03499 EID eid; 03500 uint32_t type; 03501 uint32_t flags; 03502 uint32_t uid; 03503 }; 03504 03505 class psPersistActionLocation : public psMessageCracker 03506 { 03507 public: 03508 psPersistActionLocation(uint32_t clientNum, 03509 EID eid, 03510 int type, 03511 const char* name, 03512 const char* sector, 03513 const char* mesh 03514 ); 03515 03516 psPersistActionLocation(MsgEntry* me); 03517 03518 PSF_DECLARE_MSG_FACTORY(); 03519 03526 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03527 03528 csString name; 03529 csString sector; 03530 csString mesh; 03531 EID eid; 03532 uint32_t type; 03533 }; 03534 03535 class psRemoveObject : public psMessageCracker 03536 { 03537 public: 03538 psRemoveObject(uint32_t clientNum, EID objectEID); 03539 psRemoveObject(MsgEntry* me); 03540 03541 PSF_DECLARE_MSG_FACTORY(); 03542 03549 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03550 03551 EID objectEID; 03552 }; 03553 03554 03555 03556 class psBuddyListMsg : public psMessageCracker 03557 { 03558 public: 03559 struct BuddyData 03560 { 03561 csString name; 03562 bool online; 03563 }; 03564 03565 psBuddyListMsg(uint32_t clientNum, int totalBuddies); 03566 psBuddyListMsg(MsgEntry* me); 03567 03568 PSF_DECLARE_MSG_FACTORY(); 03569 03576 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03577 03578 void AddBuddy(int num, const char* name, bool onlineStatus); 03579 void Build(); 03580 03581 csArray<BuddyData> buddies; 03582 }; 03583 03584 03585 03586 class psBuddyStatus : public psMessageCracker 03587 { 03588 public: 03589 psBuddyStatus(uint32_t clientNum, csString &buddyName, bool online) 03590 { 03591 msg.AttachNew(new MsgEntry(buddyName.Length()+1 + sizeof(bool))); 03592 03593 msg->SetType(MSGTYPE_BUDDY_STATUS); 03594 msg->clientnum = clientNum; 03595 03596 msg->Add(buddyName); 03597 msg->Add(online); 03598 } 03599 03600 psBuddyStatus(MsgEntry* me) 03601 { 03602 buddy = me->GetStr(); 03603 onlineStatus = me->GetBool(); 03604 } 03605 03606 PSF_DECLARE_MSG_FACTORY(); 03607 03614 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03615 03616 csString buddy; 03617 bool onlineStatus; 03618 }; 03619 03620 class psMOTDMessage : public psMessageCracker 03621 { 03622 public: 03623 psMOTDMessage(uint32_t clientNum, const csString &tipMsg, const csString &motdMsg, const csString &guildMsg, const csString &guild) 03624 { 03625 msg.AttachNew(new MsgEntry(tipMsg.Length()+1 + motdMsg.Length()+1 + guildMsg.Length()+1 + guild.Length() +1)); 03626 03627 msg->SetType(MSGTYPE_MOTD); 03628 msg->clientnum = clientNum; 03629 03630 msg->Add(tipMsg); 03631 msg->Add(motdMsg); 03632 msg->Add(guildMsg); 03633 msg->Add(guild); 03634 } 03635 03636 psMOTDMessage(MsgEntry* me) 03637 { 03638 tip = me->GetStr(); 03639 motd = me->GetStr(); 03640 guildmotd = me->GetStr(); 03641 guild = me->GetStr(); 03642 } 03643 03644 PSF_DECLARE_MSG_FACTORY(); 03645 03652 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03653 03654 csString tip; 03655 csString motd; 03656 csString guildmotd; 03657 csString guild; 03658 }; 03659 03660 class psMOTDRequestMessage : public psMessageCracker 03661 { 03662 public: 03663 psMOTDRequestMessage() 03664 { 03665 msg.AttachNew(new MsgEntry()); 03666 msg->SetType(MSGTYPE_MOTDREQUEST); 03667 msg->clientnum = 0; 03668 } 03669 psMOTDRequestMessage(MsgEntry* /*me*/) {} 03670 03671 03672 PSF_DECLARE_MSG_FACTORY(); 03673 03680 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03681 }; 03682 03683 class psQuestionResponseMsg : public psMessageCracker 03684 { 03685 public: 03686 uint32_t questionID; 03687 csString answer; 03688 03689 psQuestionResponseMsg(int clientnum,uint32_t questionID,const csString &answer) 03690 { 03691 msg.AttachNew(new MsgEntry(sizeof(questionID)+answer.Length()+1)); 03692 msg->SetType(MSGTYPE_QUESTIONRESPONSE); 03693 msg->clientnum = clientnum; 03694 msg->Add(questionID); 03695 msg->Add(answer); 03696 } 03697 psQuestionResponseMsg(MsgEntry* me) 03698 { 03699 questionID = me->GetUInt32(); 03700 answer = me->GetStr(); 03701 valid = true; 03702 } 03703 03704 PSF_DECLARE_MSG_FACTORY(); 03705 03712 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03713 }; 03714 03715 class psQuestionMessage : public psMessageCracker 03716 { 03717 public: 03723 enum questionType_t 03724 { 03725 generalConfirm, 03726 secretGuildNotify, 03727 duelConfirm, 03728 marriageConfirm 03729 }; 03730 03731 uint32_t questionID; 03732 csString question; // some string - its format depends on 'type' 03733 questionType_t type; 03734 03735 psQuestionMessage(int clientnum, 03736 uint32_t questionID, 03737 const char* question, 03738 questionType_t type) 03739 { 03740 msg.AttachNew(new MsgEntry(sizeof(questionID) +strlen(question)+1 +2)); 03741 msg->SetType(MSGTYPE_QUESTION); 03742 msg->clientnum = clientnum; 03743 03744 msg->Add(questionID); 03745 msg->Add(question); 03746 msg->Add((uint16_t)type); 03747 valid=!(msg->overrun); 03748 } 03749 psQuestionMessage(MsgEntry* me) 03750 { 03751 questionID = me->GetUInt32(); 03752 question = me->GetStr(); 03753 type = (questionType_t)me->GetInt16(); 03754 valid = true; 03755 } 03756 03757 PSF_DECLARE_MSG_FACTORY(); 03758 03765 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03766 }; 03767 03768 class psAdviceMessage : public psMessageCracker 03769 { 03770 public: 03771 csString sCommand; 03772 csString sTarget; 03773 csString sMessage; 03774 03775 psAdviceMessage(int clientNum, const char* command, const char* target, const char* message) 03776 { 03777 size_t msgSize = 0; 03778 03779 if(message) msgSize = strlen(message); 03780 03781 msg.AttachNew(new MsgEntry(strlen(command) + strlen(target) + msgSize + 3)); 03782 msg->SetType(MSGTYPE_ADVICE); 03783 msg->clientnum = clientNum; 03784 msg->Add(command); 03785 msg->Add(target); 03786 msg->Add(message?message:""); 03787 valid = !(msg->overrun); 03788 }; 03789 03790 psAdviceMessage(MsgEntry* me) 03791 { 03792 sCommand = me->GetStr(); 03793 sTarget = me->GetStr(); 03794 sMessage = me->GetStr(); 03795 valid = true; 03796 }; 03797 03798 PSF_DECLARE_MSG_FACTORY(); 03799 03806 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03807 }; 03808 03810 03816 class psGUIActiveMagicMessage : public psMessageCracker 03817 { 03818 public: 03819 03820 enum commandType { Add, Remove, List }; 03821 03822 psGUIActiveMagicMessage(uint32_t clientNum, csArray<ActiveSpell*>& spells, uint32_t index, csTicks serverTime ) 03823 { 03824 // MSGTYPE_ACTIVEMAGIC + clientNum + command + valid + index + spellCount; 03825 size_t msgSize = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint8_t) + sizeof(bool) + sizeof(uint32_t) + sizeof(uint32_t); 03826 03827 size_t numSpells = spells.GetSize(); 03828 03829 for( size_t i=0; i<numSpells; i++ ) 03830 { 03831 msgSize += sizeof(uint8_t); //SPELL_TYPE 03832 msgSize += sizeof(uint32_t); //duration 03833 msgSize += spells[i]->Name().Length() + 1; 03834 msgSize += spells[i]->Image().Length() + 1; 03835 msgSize += sizeof(uint32_t); //registrationTime 03836 msgSize += sizeof(uint32_t); //serverTime 03837 } 03838 03839 msg.AttachNew(new MsgEntry(msgSize)); 03840 msg->SetType(MSGTYPE_ACTIVEMAGIC); 03841 msg->clientnum = clientNum; 03842 msg->Add((uint8_t)psGUIActiveMagicMessage::List); 03843 msg->Add((uint32_t)index); 03844 msg->Add((uint32_t)numSpells); 03845 for( size_t i=0; i<numSpells; i++ ) 03846 { 03847 msg->Add((uint8_t)spells[i]->Type()); 03848 msg->Add((uint32_t)spells[i]->Duration()); 03849 msg->Add(spells[i]->Name().GetData()); 03850 msg->Add(spells[i]->Image().GetData()); 03851 msg->Add((uint32_t)spells[i]->RegistrationTime()); 03852 msg->Add((uint32_t)serverTime); 03853 } 03854 valid = !(msg->overrun); 03855 } 03856 03858 psGUIActiveMagicMessage(MsgEntry* message) 03859 { 03860 //what type of message : Add, Remove or List. retained so older style messages won't make the system crash. 03861 command = (commandType)message->GetUInt8(); 03862 if( command != List ) 03863 { 03864 valid = false; 03865 return; 03866 } 03867 03868 //what is the index number of this message? 03869 index = message->GetUInt32(); 03870 03871 //how many spells are in the message? 03872 size_t totalSpells = message->GetUInt32(); 03873 03874 //read the spells 03875 for( size_t i=0; i<totalSpells; i++ ) 03876 { 03877 type.Push( (SPELL_TYPE) message->GetUInt8() ); 03878 duration.Push( message->GetUInt32()); 03879 name.Push( message->GetStr()); //if there was no name when the message was sent, this should read a null string 03880 image.Push( message->GetStr()); //if there was no name when the message was sent, this should read a null string 03881 registrationTime.Push( message->GetUInt32()); 03882 serverTime=message->GetUInt32(); 03883 } 03884 valid = true; 03885 } 03886 03887 PSF_DECLARE_MSG_FACTORY(); 03888 03895 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03896 03897 uint32_t index; 03898 commandType command; 03899 csArray<SPELL_TYPE> type; 03900 csArray<uint32> duration; 03901 csArray<uint32> registrationTime; 03902 uint32 serverTime; 03903 csArray<csString> name; 03904 csArray<csString> image; 03905 }; 03906 03907 //----------------------------------------------------------------------------- 03908 class psSlotMovementMsg : public psMessageCracker 03909 { 03910 public: 03911 psSlotMovementMsg(int fromContainerID, 03912 int fromSlotID, 03913 int toContainerID, 03914 int toSlotID, 03915 int stackCount, 03916 csVector3* pt3d=NULL, 03917 csVector3* rot=NULL, 03918 bool guarded=true, 03919 bool inplace=true) 03920 { 03921 msg.AttachNew(new MsgEntry(sizeof(int32_t) * 5 + 3 * sizeof(float) + 3 * sizeof(float) + 2 * sizeof(bool))); 03922 03923 msg->SetType(MSGTYPE_SLOT_MOVEMENT); 03924 msg->clientnum = 0; 03925 03926 msg->Add((int32_t) fromContainerID); 03927 msg->Add((int32_t) fromSlotID); 03928 msg->Add((int32_t) toContainerID); 03929 msg->Add((int32_t) toSlotID); 03930 msg->Add((int32_t) stackCount); 03931 if(pt3d != NULL) 03932 msg->Add(*pt3d); 03933 else 03934 { 03935 csVector3 v = 0; 03936 msg->Add(v); // Add dummy zeroes if not specified. 03937 } 03938 if(rot != NULL) 03939 { 03940 msg->Add(rot->y); 03941 } 03942 else 03943 { 03944 msg->Add(0.f); // Add 0 rotation if not specified. 03945 } 03946 msg->Add(guarded); 03947 msg->Add(inplace); 03948 if(rot != NULL) 03949 { 03950 msg->Add(rot->x); 03951 msg->Add(rot->z); 03952 } 03953 else 03954 { 03955 msg->Add(0.f); 03956 msg->Add(0.f); 03957 } 03958 } 03959 03960 psSlotMovementMsg(MsgEntry* me) 03961 { 03962 fromContainer = me->GetInt32(); 03963 fromSlot = me->GetInt32(); 03964 toContainer = me->GetInt32(); 03965 toSlot = me->GetInt32(); 03966 stackCount = me->GetInt32(); 03967 posWorld = me->GetVector3(); 03968 rot.y = me->GetFloat(); 03969 guarded = me->GetBool(); 03970 inplace = me->GetBool(); 03971 rot.x = me->GetFloat(); 03972 rot.z = me->GetFloat(); 03973 } 03974 03975 PSF_DECLARE_MSG_FACTORY(); 03976 03983 virtual csString ToString(NetBase::AccessPointers* accessPointers); 03984 03985 int fromContainer; 03986 int fromSlot; 03987 int toContainer; 03988 int toSlot; 03989 int stackCount; 03990 csVector3 posWorld; 03991 csVector3 rot; 03992 bool guarded; 03993 bool inplace; 03994 }; 03995 03996 class psCmdDropMessage : public psMessageCracker 03997 { 03998 public: 03999 psCmdDropMessage(int quantity, csString &itemName, bool container, bool guarded, bool inplace); 04000 psCmdDropMessage(MsgEntry* me); 04001 04002 PSF_DECLARE_MSG_FACTORY(); 04003 04010 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04011 04012 int quantity; 04013 csString itemName; 04014 04015 bool container; 04016 bool guarded; 04017 bool inplace; 04018 }; 04019 04020 class psQuestionCancelMessage : public psMessageCracker 04021 { 04022 public: 04023 uint32_t questionID; 04024 04025 psQuestionCancelMessage(int clientnum, uint32_t id) 04026 { 04027 msg.AttachNew(new MsgEntry(sizeof(id))); 04028 msg->SetType(MSGTYPE_QUESTIONCANCEL); 04029 msg->clientnum = clientnum; 04030 04031 msg->Add(id); 04032 } 04033 psQuestionCancelMessage(MsgEntry* me) 04034 { 04035 questionID = me->GetUInt32(); 04036 valid = true; 04037 } 04038 04039 PSF_DECLARE_MSG_FACTORY(); 04040 04047 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04048 }; 04049 04050 class psGuildMOTDSetMessage : public psMessageCracker 04051 { 04052 public: 04053 psGuildMOTDSetMessage(csString &guildMsg,csString &guild) 04054 { 04055 msg.AttachNew(new MsgEntry(guildMsg.Length()+1 + guild.Length() +1)); 04056 04057 msg->SetType(MSGTYPE_GUILDMOTDSET); 04058 msg->clientnum = 0; 04059 msg->Add(guildMsg); 04060 msg->Add(guild); 04061 } 04062 04063 psGuildMOTDSetMessage(MsgEntry* me) 04064 { 04065 guildmotd = me->GetStr(); 04066 if(!guildmotd.Length()) 04067 guildmotd = "(No message of the day.)"; 04068 guild = me->GetStr(); 04069 if(!guild.Length()) 04070 valid = false; 04071 } 04072 04073 PSF_DECLARE_MSG_FACTORY(); 04074 04081 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04082 04083 csString guildmotd; 04084 csString guild; 04085 }; 04086 04087 class psCharacterDetailsMessage : public psMessageCracker 04088 { 04089 public: 04090 struct NetworkDetailSkill 04091 { 04092 int category; 04093 csString text; 04094 }; 04095 04096 psCharacterDetailsMessage(int clientnum, const csString &name2s,unsigned short int gender2s,const csString &race2s, 04097 const csString &desc2s, const csArray<NetworkDetailSkill> &skills2s, const csString &desc_ooc, const csString &creationinfo, const csString &requestor); 04098 psCharacterDetailsMessage(MsgEntry* me); 04099 04100 PSF_DECLARE_MSG_FACTORY(); 04101 04108 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04109 04110 csString name; 04111 unsigned short int gender; 04112 csString race; 04113 csString desc; 04114 csString desc_ooc; 04115 csString creationinfo; 04116 csArray<NetworkDetailSkill> skills; 04117 04118 csString requestor; // Identifies which part of system initiated this 04119 }; 04120 04121 class psCharacterDetailsRequestMessage : public psMessageCracker 04122 { 04123 public: 04124 psCharacterDetailsRequestMessage(bool myself, bool simple, const csString &requestor) 04125 { 04126 //If myself = true, the server sends the information about the player 04127 //If myself = false, the server sends the information about the target 04128 04129 msg.AttachNew(new MsgEntry(sizeof(myself) + sizeof(simple) + requestor.Length() + 1)); 04130 msg->SetType(MSGTYPE_CHARDETAILSREQUEST); 04131 msg->clientnum = 0; 04132 msg->Add(myself); 04133 msg->Add(simple); 04134 msg->Add(requestor.GetData()); 04135 } 04136 04137 psCharacterDetailsRequestMessage(MsgEntry* me) 04138 { 04139 isMe = me->GetBool(); 04140 isSimple = me->GetBool(); 04141 requestor = me->GetStr(); 04142 } 04143 04144 PSF_DECLARE_MSG_FACTORY(); 04145 04152 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04153 04154 bool isMe; 04155 bool isSimple; 04156 csString requestor; 04157 }; 04158 04159 enum DESCTYPE 04160 { 04161 DESC_IC = 1, 04162 DESC_OOC, 04163 DESC_CC 04164 }; 04165 04166 class psCharacterDescriptionUpdateMessage : public psMessageCracker 04167 { 04168 public: 04169 psCharacterDescriptionUpdateMessage(csString &newValue, DESCTYPE desctype) 04170 { 04171 04172 msg.AttachNew(new MsgEntry(newValue.Length() +1 + sizeof(uint8_t))); 04173 msg->SetType(MSGTYPE_CHARDESCUPDATE); 04174 04175 msg->clientnum = 0; 04176 msg->Add(newValue); 04177 msg->Add((uint8_t)desctype); 04178 } 04179 04180 psCharacterDescriptionUpdateMessage(MsgEntry* me) 04181 { 04182 newValue = me->GetStr(); 04183 desctype = (DESCTYPE) me->GetUInt8(); 04184 } 04185 04186 PSF_DECLARE_MSG_FACTORY(); 04187 04194 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04195 04196 csString newValue; 04197 DESCTYPE desctype; 04198 }; 04199 04200 //------------------------------------------------------------------------------ 04201 04202 class psViewActionLocationMessage : public psMessageCracker 04203 { 04204 public: 04205 psViewActionLocationMessage(uint32_t clientnum, const char* actname, const char* desc); 04206 psViewActionLocationMessage(MsgEntry* me); 04207 04208 PSF_DECLARE_MSG_FACTORY(); 04209 04216 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04217 04218 const char* name; 04219 const char* description; 04220 }; 04221 04222 //------------------------------------------------------------------------------ 04223 04237 class psViewItemDescription : public psMessageCracker 04238 { 04239 public: 04247 psViewItemDescription(int containerID, int slotID); 04248 04262 psViewItemDescription(uint32_t to, const char* itemName, const char* description, const char* icon, 04263 uint32_t stackCount); 04264 04269 psViewItemDescription(MsgEntry* me, NetBase::AccessPointers* accessPointers); 04270 04271 PSF_DECLARE_MSG_FACTORY(); 04272 04279 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04280 04282 const char* itemName; 04283 04285 const char* itemDescription; 04286 04288 const char* itemIcon; 04289 04291 uint32_t stackCount; 04292 04294 int containerID; 04295 04297 int ContainerSlots; 04298 04300 int slotID; 04301 04303 int msgSize; 04304 04306 bool hasContents; 04307 04309 int to; 04310 04311 private: 04312 enum 04313 { 04314 REQUEST, 04315 DESCR 04316 }; 04317 int format; 04318 }; 04319 04320 04321 //------------------------------------------------------------------------------ 04322 04336 class psViewContainerDescription : public psMessageCracker 04337 { 04338 public: 04346 psViewContainerDescription(int containerID, int slotID); 04347 04361 psViewContainerDescription(uint32_t to, const char* itemName, const char* description, const char* icon, 04362 uint32_t stackCount); 04363 04368 psViewContainerDescription(MsgEntry* me, NetBase::AccessPointers* accessPointers); 04369 04370 PSF_DECLARE_MSG_FACTORY(); 04371 04378 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04379 04381 const char* itemName; 04382 04384 const char* itemDescription; 04385 04387 const char* itemIcon; 04388 04390 uint32_t stackCount; 04391 04393 int containerID; 04394 04396 int maxContainerSlots; 04397 04399 int slotID; 04400 04402 int msgSize; 04403 04405 bool hasContents; 04406 04408 bool renameable; 04409 04411 bool CanTransform; 04412 04414 int to; 04415 04417 void AddContents(const char* name, const char* meshName, const char* materialName, const char* icon, int purifyStatus, int slot, int stack); 04418 04420 void ConstructMsg(csStringSet* msgstrings); 04421 04422 struct ContainerContents 04423 { 04424 csString name; 04425 csString icon; 04426 csString meshName; 04427 csString materialName; 04428 int slotID; 04429 int stackCount; 04430 int purifyStatus; 04431 }; 04432 04433 csArray<ContainerContents> contents; 04434 04435 private: 04436 enum 04437 { 04438 REQUEST, 04439 DESCR 04440 }; 04441 int format; 04442 }; 04443 04444 04445 04446 class psViewItemUpdate : public psMessageCracker 04447 { 04448 public: 04464 psViewItemUpdate(uint32_t to, EID containerID, uint32_t slotID, bool clearSlot, const char* itemName, const char* icon, const char* meshName, const char* materialName, uint32_t stackCount, EID ownerID, csStringSet* msgstrings); 04465 04467 psViewItemUpdate(MsgEntry* me, NetBase::AccessPointers* accessPointers); 04468 04469 PSF_DECLARE_MSG_FACTORY(); 04470 04477 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04478 04479 // /// Running count of message size. Used for constructing the outgoing message. 04480 // int msgSize; 04481 04483 bool clearSlot; 04484 04486 EID containerID; 04487 04489 csString name; 04490 csString icon; 04491 csString meshName; 04492 csString materialName; 04493 int slotID; 04494 int stackCount; 04495 EID ownerID; 04496 }; 04497 04498 04499 class psWriteBookMessage : public psMessageCracker 04500 { 04501 public: 04506 psWriteBookMessage(int slotID, int containerID); 04510 psWriteBookMessage(int slotID, int containerID, csString &title, csString &content); 04514 psWriteBookMessage(uint32_t clientNum, csString &title, csString &content, bool success, int slotID, int containerID); 04518 psWriteBookMessage(uint32_t clientNum, csString &title, bool success); 04519 04520 psWriteBookMessage(MsgEntry* me); 04521 04522 PSF_DECLARE_MSG_FACTORY(); 04523 04524 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04525 04526 uint8_t messagetype; 04527 csString title, content; 04528 int slotID; 04529 int containerID; 04530 bool success; 04531 04532 enum 04533 { 04534 REQUEST, 04535 RESPONSE, 04536 SAVE, 04537 SAVERESPONSE 04538 }; 04539 }; 04540 04541 class psReadBookTextMessage : public psMessageCracker 04542 { 04543 public: 04544 psReadBookTextMessage(uint32_t clientNum, csString &itemName, csString &bookText, bool canWrite, int slotID, int containerID, csString backgroundImg); 04545 04550 psReadBookTextMessage(MsgEntry* me); 04551 04552 PSF_DECLARE_MSG_FACTORY(); 04553 04560 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04561 04562 csString name; 04563 csString text; 04565 bool canWrite; 04567 int slotID; 04568 int containerID; 04570 csString backgroundImg; 04571 }; 04572 04573 //-------------------------------------------------------------------------- 04574 04575 class psQuestRewardMessage : public psMessageCracker 04576 { 04577 public: 04578 enum 04579 { 04580 offerRewards, 04581 selectReward 04582 }; 04583 04584 psQuestRewardMessage(uint32_t clientnum, csString &newValue, uint8_t type) 04585 { 04586 msg.AttachNew(new MsgEntry(newValue.Length() + 1 + sizeof(uint8_t))); 04587 msg->SetType(MSGTYPE_QUESTREWARD); 04588 msg->clientnum = clientnum; 04589 msg->Add(newValue); 04590 msg->Add(type); 04591 } 04592 04593 psQuestRewardMessage(MsgEntry* me) 04594 { 04595 newValue = me->GetStr(); 04596 msgType = me->GetUInt8(); 04597 } 04598 04599 PSF_DECLARE_MSG_FACTORY(); 04600 04607 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04608 04609 int msgType; 04610 csString newValue; 04611 }; 04612 04613 //-------------------------------------------------------------------------- 04614 04615 class psExchangeMoneyMsg : public psMessageCracker 04616 { 04617 public: 04618 psExchangeMoneyMsg(uint32_t client, int container, 04619 int trias, int hexas, int circles,int octas); 04620 04621 psExchangeMoneyMsg(MsgEntry* me); 04622 04623 PSF_DECLARE_MSG_FACTORY(); 04624 04631 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04632 04633 int container; 04634 04635 int trias; 04636 int octas; 04637 int hexas; 04638 int circles; 04639 }; 04640 04643 class psExchangeRequestMsg : public psMessageCracker 04644 { 04645 public: 04649 psExchangeRequestMsg(bool withPlayer); 04650 04652 psExchangeRequestMsg(uint32_t client, csString &name, bool withPlayer); 04653 04654 PSF_DECLARE_MSG_FACTORY(); 04655 04662 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04663 04664 04665 psExchangeRequestMsg(MsgEntry* me); 04666 04667 csString player; 04668 bool withPlayer; 04669 }; 04670 04671 04675 class psExchangeAddItemMsg : public psMessageCracker 04676 { 04677 public: 04678 psExchangeAddItemMsg(uint32_t clientNum, 04679 const csString &name, 04680 const csString &meshFactName, 04681 const csString &materialName, 04682 int containerID, 04683 int slot, 04684 int stackcount, 04685 const csString &icon, 04686 csStringSet* msgstrings); 04687 04688 psExchangeAddItemMsg(MsgEntry* me, NetBase::AccessPointers* accessPointers); 04689 04690 PSF_DECLARE_MSG_FACTORY(); 04691 04698 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04699 04700 csString name; 04701 csString meshFactName; 04702 csString materialName; 04703 int container; 04704 int slot; 04705 int stackCount; 04706 csString icon; 04707 }; 04708 04709 //------------------------------------------------------------------------------ 04710 04714 class psExchangeRemoveItemMsg : public psMessageCracker 04715 { 04716 public: 04717 psExchangeRemoveItemMsg(uint32_t client, int container, int slot, int newStack); 04718 psExchangeRemoveItemMsg(MsgEntry* me); 04719 04720 PSF_DECLARE_MSG_FACTORY(); 04721 04728 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04729 04730 int container; // CONTAINER_EXCHANGE_* 04731 int slot; 04732 int newStackCount; 04733 }; 04734 04735 //------------------------------------------------------------------------------ 04736 04737 class psExchangeAcceptMsg : public psMessageCracker 04738 { 04739 public: 04740 psExchangeAcceptMsg(uint32_t client = 0); 04741 psExchangeAcceptMsg(MsgEntry* me); 04742 04743 PSF_DECLARE_MSG_FACTORY(); 04744 04751 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04752 }; 04753 04754 //------------------------------------------------------------------------------ 04755 04756 class psExchangeStatusMsg : public psMessageCracker 04757 { 04758 public: 04759 psExchangeStatusMsg(uint32_t client, bool playerAccept, bool otherPlayerAccept); 04760 psExchangeStatusMsg(MsgEntry* me); 04761 04762 PSF_DECLARE_MSG_FACTORY(); 04763 04770 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04771 04772 bool playerAccept; 04773 bool otherAccept; 04774 }; 04775 //------------------------------------------------------------------------------ 04776 04777 04778 class psExchangeEndMsg : public psMessageCracker 04779 { 04780 public: 04781 psExchangeEndMsg(uint32_t client = 0); 04782 psExchangeEndMsg(MsgEntry* me); 04783 04784 PSF_DECLARE_MSG_FACTORY(); 04785 04792 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04793 }; 04794 04795 04796 //------------------------------------------------------------------------------ 04797 04798 class psUpdateObjectNameMessage : public psMessageCracker 04799 { 04800 public: 04801 psUpdateObjectNameMessage(uint32_t client, EID eid, const char* newName); 04802 psUpdateObjectNameMessage(MsgEntry* me); 04803 04804 PSF_DECLARE_MSG_FACTORY(); 04805 04812 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04813 04814 EID objectID; 04815 csString newObjName; 04816 }; 04817 04818 class psUpdatePlayerGuildMessage : public psMessageCracker 04819 { 04820 public: 04821 psUpdatePlayerGuildMessage(uint32_t client, int total, const char* newGuild); 04822 psUpdatePlayerGuildMessage(uint32_t client, EID entity, const char* newGuild); // shortcut for only 1 entity 04823 psUpdatePlayerGuildMessage(MsgEntry* me); 04824 04825 PSF_DECLARE_MSG_FACTORY(); 04826 04833 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04834 04835 void AddPlayer(EID id); // Adds an object 04836 04837 csArray<uint32_t> objectID; // Array with objects 04838 csString newGuildName; 04839 }; 04840 04841 04842 class psUpdatePlayerGroupMessage : public psMessageCracker 04843 { 04844 public: 04845 psUpdatePlayerGroupMessage(int clientnum, EID objectID, uint32_t groupID); 04846 psUpdatePlayerGroupMessage(MsgEntry* me); 04847 04848 PSF_DECLARE_MSG_FACTORY(); 04849 04856 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04857 04858 EID objectID; 04859 uint32_t groupID; 04860 }; 04861 04862 //------------------------------------------------------------------------------ 04863 04866 class psNameCheckMessage : public psMessageCracker 04867 { 04868 public: 04869 psNameCheckMessage() {} 04870 psNameCheckMessage(const char* name); 04877 psNameCheckMessage(const char* firstName, const char* lastName); 04878 psNameCheckMessage(uint32_t client, bool accepted, const char* reason); 04879 psNameCheckMessage(MsgEntry* me); 04880 04881 void FromClient(MsgEntry* me); 04882 void FromServer(MsgEntry* me); 04883 04884 PSF_DECLARE_MSG_FACTORY(); 04885 04892 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04893 04894 csString firstName; 04895 csString lastName; 04896 csString reason; 04897 bool accepted; 04898 04899 private: 04900 bool msgFromServer; 04901 }; 04902 04903 //----------------------------------------------------------------------------- 04904 04905 #define PINGFLAG_REQUESTFLAGS 0x0001 04906 #define PINGFLAG_READY 0x0002 04907 #define PINGFLAG_HASBEENREADY 0x0004 04908 #define PINGFLAG_SERVERFULL 0x0008 04909 04910 class psPingMsg : public psMessageCracker 04911 { 04912 public: 04913 psPingMsg(uint32_t client, uint32_t id, uint8_t flags); 04914 psPingMsg(MsgEntry* me); 04915 04916 PSF_DECLARE_MSG_FACTORY(); 04917 04924 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04925 04926 uint32_t id; 04927 uint8_t flags; 04928 }; 04929 04930 //----------------------------------------------------------------------------- 04931 04932 class psHeartBeatMsg : public psMessageCracker 04933 { 04934 public: 04935 psHeartBeatMsg(uint32_t client); 04936 psHeartBeatMsg(MsgEntry* me); 04937 04938 PSF_DECLARE_MSG_FACTORY(); 04939 04946 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04947 }; 04948 04949 //----------------------------------------------------------------------------- 04950 04951 class psLockpickMessage : public psMessageCracker 04952 { 04953 public: 04954 psLockpickMessage(const char* password); // Password is for future use 04955 psLockpickMessage(MsgEntry* me); 04956 04957 PSF_DECLARE_MSG_FACTORY(); 04958 04965 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04966 04967 csString password; 04968 }; 04969 04970 //----------------------------------------------------------------------------- 04971 04972 class psGMSpawnItems : public psMessageCracker 04973 { 04974 public: 04975 psGMSpawnItems(uint32_t client,const char* type,unsigned int size); 04976 psGMSpawnItems(const char* type); 04977 psGMSpawnItems(MsgEntry* me); 04978 04979 PSF_DECLARE_MSG_FACTORY(); 04980 04987 virtual csString ToString(NetBase::AccessPointers* accessPointers); 04988 04989 bool request; 04990 04991 struct Item 04992 { 04993 csString name; 04994 csString mesh; 04995 csString icon; 04996 }; 04997 04998 csArray<Item> items; 04999 05000 csString type; 05001 }; 05002 05003 class psGMSpawnTypes : public psMessageCracker 05004 { 05005 public: 05006 psGMSpawnTypes(uint32_t client,unsigned int size); 05007 psGMSpawnTypes(MsgEntry* me); 05008 05009 PSF_DECLARE_MSG_FACTORY(); 05010 05017 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05018 05019 csArray<csString> types; 05020 }; 05021 05022 /* 05023 * Request item modifiers for a given item. 05024 */ 05025 class psGMSpawnGetMods : public psMessageCracker 05026 { 05027 public: 05028 psGMSpawnGetMods(const char *itemname); 05029 psGMSpawnGetMods(MsgEntry* me); 05030 05031 PSF_DECLARE_MSG_FACTORY(); 05032 05039 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05040 05041 csString item; 05042 }; 05043 05044 /* 05045 * Returns the list of item modifiers for the last request. 05046 */ 05047 class psGMSpawnMods : public psMessageCracker 05048 { 05049 public: 05050 enum ItemModType { 05051 ITEM_PREFIX, 05052 ITEM_SUFFIX, 05053 ITEM_ADJECTIVE, 05054 ITEM_NUM_TYPES 05055 }; 05056 05057 struct ItemModifier 05058 { 05059 csString name; 05060 uint32_t id; 05061 uint32_t type; 05062 }; 05063 05064 psGMSpawnMods(uint32_t client, csArray<ItemModifier>& imods); 05065 psGMSpawnMods(MsgEntry* me); 05066 05067 PSF_DECLARE_MSG_FACTORY(); 05068 05075 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05076 05077 csArray<ItemModifier> mods; 05078 }; 05079 05080 class psGMSpawnItem : public psMessageCracker 05081 { 05082 public: 05083 psGMSpawnItem( 05084 const char* item, 05085 unsigned int count, 05086 bool lockable, 05087 bool locked, 05088 const char* lskill, 05089 int lstr, 05090 bool pickupable, 05091 bool collidable, 05092 bool Unpickable, 05093 bool Transient, 05094 bool SettingItem, 05095 bool NPCOwned, 05096 bool pickupableWeak, 05097 bool random = false, 05098 float quality = 0.0f, 05099 csArray<uint32_t>* mods = 0 05100 ); 05101 05102 psGMSpawnItem(MsgEntry* me); 05103 05104 PSF_DECLARE_MSG_FACTORY(); 05105 05112 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05113 05114 csString item; 05115 unsigned int count; 05116 bool lockable,locked,pickupable,collidable,Unpickable,SettingItem,NPCOwned,Transient, pickupableWeak; 05117 05118 csString lskill; 05119 int lstr; 05120 bool random; 05121 float quality; 05122 csArray<uint32_t> mods; 05123 }; 05124 05125 class psLootRemoveMessage : public psMessageCracker 05126 { 05127 public: 05128 psLootRemoveMessage(uint32_t client,int item); 05129 psLootRemoveMessage(MsgEntry* me); 05130 05131 PSF_DECLARE_MSG_FACTORY(); 05132 05139 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05140 05141 int id; 05142 }; 05143 05144 class psCharCreateTraitsMessage : public psMessageCracker 05145 { 05146 public: 05147 psCharCreateTraitsMessage(uint32_t client, csString &string) 05148 { 05149 msg.AttachNew(new MsgEntry(string.Length()+1)); 05150 05151 msg->SetType(MSGTYPE_CHAR_CREATE_TRAITS); 05152 msg->clientnum = client; 05153 msg->Add(string); 05154 } 05155 05156 psCharCreateTraitsMessage(csString &string) 05157 { 05158 msg.AttachNew(new MsgEntry(string.Length()+1)); 05159 05160 msg->SetType(MSGTYPE_CHAR_CREATE_TRAITS); 05161 msg->clientnum = 0; 05162 msg->Add(string); 05163 } 05164 05165 psCharCreateTraitsMessage(MsgEntry* me) 05166 { 05167 string = me->GetStr(); 05168 if(!string.Length()) 05169 valid = false; 05170 } 05171 05172 PSF_DECLARE_MSG_FACTORY(); 05173 05180 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05181 05182 const csString &GetString() const 05183 { 05184 return string; 05185 } 05186 05187 private: 05188 csString string; 05189 }; 05190 05191 class psClientStatusMessage : public psMessageCracker 05192 { 05193 public: 05194 psClientStatusMessage(bool ready); 05195 psClientStatusMessage(MsgEntry* me); 05196 05197 PSF_DECLARE_MSG_FACTORY(); 05198 05205 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05206 05207 bool ready; 05208 05209 enum ClientStatus 05210 { 05211 READY = 0x1 05212 }; 05213 }; 05214 05215 class psMoveModMsg : public psMessageCracker 05216 { 05217 public: 05218 enum ModType 05219 { 05220 NONE = 0, 05221 ADDITION, 05222 MULTIPLIER, 05223 CONSTANT, 05224 PUSH 05225 }; 05226 05227 psMoveModMsg(uint32_t client, ModType type, const csVector3 &move, float Yrot); 05228 psMoveModMsg(MsgEntry* me); 05229 05230 PSF_DECLARE_MSG_FACTORY(); 05231 05238 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05239 05240 ModType type; 05241 csVector3 movementMod; 05242 float rotationMod; 05243 }; 05244 05245 class psMsgRequestMovement : public psMessageCracker 05246 { 05247 public: 05248 psMsgRequestMovement(); 05249 psMsgRequestMovement(MsgEntry* me); 05250 05251 PSF_DECLARE_MSG_FACTORY(); 05252 05259 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05260 }; 05261 05262 class psMovementInfoMessage : public psMessageCracker 05263 { 05264 public: 05265 psMovementInfoMessage(size_t modes, size_t moves); 05266 psMovementInfoMessage(MsgEntry* me); 05267 05268 PSF_DECLARE_MSG_FACTORY(); 05269 05270 void AddMode(uint32 id, const char* name, csVector3 move_mod, csVector3 rotate_mod, const char* idle_anim); 05271 void AddMove(uint32 id, const char* name, csVector3 base_move, csVector3 base_rotate); 05272 05273 void GetMode(uint32 &id, const char* &name, csVector3 &move_mod, csVector3 &rotate_mod, const char* &idle_anim); 05274 void GetMove(uint32 &id, const char* &name, csVector3 &base_move, csVector3 &base_rotate); 05275 05282 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05283 05284 // Count of each object 05285 size_t modes, moves; 05286 }; 05287 05288 //----------------------------------------------------------------------------- 05289 05293 //----------------------------------------------------------------------------- 05294 05295 class psMsgCraftingInfo : public psMessageCracker 05296 { 05297 public: 05298 psMsgCraftingInfo() 05299 { 05300 msg.AttachNew(new MsgEntry(1)); 05301 msg->SetType(MSGTYPE_CRAFT_INFO); 05302 } 05303 05304 psMsgCraftingInfo(uint32_t client, csString craftinfo) 05305 { 05306 msg.AttachNew(new MsgEntry(craftinfo.Length()+1)); 05307 05308 msg->SetType(MSGTYPE_CRAFT_INFO); 05309 msg->clientnum = client; 05310 msg->Add(craftinfo.GetData()); 05311 } 05312 05313 psMsgCraftingInfo(MsgEntry* me) 05314 { 05315 craftInfo = me->GetStr(); 05316 if(!craftInfo.Length()) 05317 valid = false; 05318 } 05319 05320 PSF_DECLARE_MSG_FACTORY(); 05321 05328 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05329 05330 csString craftInfo; 05331 }; 05332 05333 //----------------------------------------------------------------------------- 05334 05338 class psTraitChangeMessage : public psMessageCracker 05339 { 05340 public: 05341 psTraitChangeMessage(uint32_t client, EID targetID, csString &string) 05342 { 05343 msg.AttachNew(new MsgEntry(string.Length()+1 + sizeof(uint32_t))); 05344 05345 msg->SetType(MSGTYPE_CHANGE_TRAIT); 05346 msg->clientnum = client; 05347 msg->Add(targetID.Unbox()); 05348 msg->Add(string); 05349 } 05350 05351 psTraitChangeMessage(MsgEntry* me) 05352 { 05353 target = EID(me->GetUInt32()); 05354 string = me->GetStr(); 05355 if(!string.Length()) 05356 valid = false; 05357 } 05358 05359 PSF_DECLARE_MSG_FACTORY(); 05360 05367 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05368 05369 EID target; 05370 csString string; 05371 }; 05372 05373 //----------------------------------------------------------------------------- 05374 05378 class psTutorialMessage : public psMessageCracker 05379 { 05380 public: 05381 psTutorialMessage(uint32_t client, uint32_t which, const char* instructions) 05382 { 05383 msg.AttachNew(new MsgEntry(sizeof(uint32_t) + strlen(instructions)+1)); 05384 05385 msg->SetType(MSGTYPE_TUTORIAL); 05386 msg->clientnum = client; 05387 msg->Add(which); 05388 msg->Add(instructions); 05389 } 05390 05391 psTutorialMessage(MsgEntry* me) 05392 { 05393 whichMessage = me->GetUInt32(); 05394 instrs = me->GetStr(); 05395 } 05396 05397 PSF_DECLARE_MSG_FACTORY(); 05398 05405 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05406 05407 int whichMessage; 05408 csString instrs; 05409 }; 05410 05414 class psSketchMessage : public psMessageCracker 05415 { 05416 public: 05417 psSketchMessage(uint32_t client, uint32_t itemID, uint8_t flags, const char* limitxml,const char* sketch_def, bool rightToEditFlag, const char* sketch_name, const char* backgroundImg) 05418 { 05419 msg.AttachNew(new MsgEntry(sizeof(uint32_t)+1+strlen(limitxml)+1+strlen(sketch_def)+1+sizeof(bool)+strlen(sketch_name)+1+strlen(backgroundImg)+1)); 05420 05421 msg->SetType(MSGTYPE_VIEW_SKETCH); 05422 msg->clientnum = client; 05423 msg->Add(itemID); 05424 msg->Add(flags); 05425 msg->Add(limitxml); 05426 msg->Add(sketch_def); 05427 msg->Add(rightToEditFlag); 05428 msg->Add(sketch_name); 05429 msg->Add(backgroundImg); 05430 } 05431 05432 psSketchMessage(MsgEntry* me) 05433 { 05434 ItemID = me->GetUInt32(); 05435 Flags = me->GetUInt8(); 05436 limits = me->GetStr(); 05437 Sketch = me->GetStr(); 05438 rightToEdit = me->GetBool(); 05439 name = me->GetStr(); 05440 backgroundImg = me->GetStr(); 05441 } 05442 05443 PSF_DECLARE_MSG_FACTORY(); 05444 05451 virtual csString ToString(NetBase::AccessPointers* accessPointers) 05452 { 05453 (void)accessPointers; // NOT USED 05454 return csString("not implemented"); 05455 } 05456 05457 uint32_t ItemID; 05458 uint8_t Flags; 05459 csString Sketch; 05460 csString limits; 05461 bool rightToEdit; 05462 csString name; 05463 csString backgroundImg; 05464 }; 05465 05469 class psMusicalSheetMessage: public psMessageCracker 05470 { 05471 public: 05481 psMusicalSheetMessage(uint32_t client, uint32_t itemID, bool readOnly, bool play, const char* songTitle, const char* musicalSheet); 05482 05487 psMusicalSheetMessage(MsgEntry* me); 05488 05489 // From psMesageCracker 05490 //---------------------- 05491 PSF_DECLARE_MSG_FACTORY(); 05492 05493 virtual csString ToString(NetBase::AccessPointers* /*accessPointers*/) 05494 { 05495 return csString("not implemented"); 05496 } 05497 05498 uint32_t itemID; 05499 bool readOnly; 05500 bool play; 05501 csString songTitle; 05502 csString musicalSheet; 05503 }; 05504 05508 class psPlaySongMessage: public psMessageCracker 05509 { 05510 public: 05520 psPlaySongMessage(uint32_t client, uint32_t songID, bool toPlayer, 05521 const char* instrName, uint32_t scoreSize, const char* musicalScore); 05522 05527 psPlaySongMessage(MsgEntry* me); 05528 05529 05530 // From psMesageCracker 05531 //---------------------- 05532 PSF_DECLARE_MSG_FACTORY(); 05533 05534 virtual csString ToString(NetBase::AccessPointers* /*accessPointers*/) 05535 { 05536 return csString("not implemented"); 05537 } 05538 05539 uint32_t songID; 05540 bool toPlayer; 05541 csString instrName; 05542 csString musicalScore; 05543 }; 05544 05545 05550 class psStopSongMessage: public psMessageCracker 05551 { 05552 public: 05553 05554 enum 05555 { 05556 NO_SONG_ERROR = 1, 05557 ILLEGAL_SCORE, 05558 NO_INSTRUMENT 05559 }; 05560 05564 psStopSongMessage(); 05565 05573 psStopSongMessage(uint32_t client, uint32_t songID, bool toPlayer, int8_t errorCode); 05574 05579 psStopSongMessage(MsgEntry* me); 05580 05581 05582 // From psMesageCracker 05583 //---------------------- 05584 PSF_DECLARE_MSG_FACTORY(); 05585 05586 virtual csString ToString(NetBase::AccessPointers* /*accessPointers*/) 05587 { 05588 return csString("not implemented"); 05589 } 05590 05591 uint32_t songID; 05592 bool toPlayer; 05593 int8_t errorCode; 05594 }; 05595 05599 class psMGStartStopMessage : public psMessageCracker 05600 { 05601 05602 public: 05603 psMGStartStopMessage(uint32_t client, bool start); 05604 05605 psMGStartStopMessage(MsgEntry* me); 05606 05607 PSF_DECLARE_MSG_FACTORY(); 05608 05615 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05616 05618 bool msgStart; 05619 }; 05620 05624 class psMGBoardMessage : public psMessageCracker 05625 { 05626 05627 public: 05628 psMGBoardMessage(uint32_t client, uint8_t counter, 05629 uint32_t gameID, uint16_t options, int8_t cols, int8_t rows, uint8_t* layout, 05630 uint8_t numOfPieces, uint8_t piecesSize, uint8_t* pieces); 05631 05632 psMGBoardMessage(MsgEntry* me); 05633 05634 PSF_DECLARE_MSG_FACTORY(); 05635 05642 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05643 05645 bool IsNewerThan(uint8_t oldCounter); 05646 05648 uint8_t msgCounter; 05649 05651 uint32_t msgGameID; 05652 05654 uint16_t msgOptions; 05655 05657 int8_t msgCols; 05658 05660 int8_t msgRows; 05661 05670 uint8_t* msgLayout; 05671 05673 uint8_t msgNumOfPieces; 05674 05676 uint8_t* msgPieces; 05677 05678 }; 05679 05683 class psMGUpdateMessage : public psMessageCracker 05684 { 05685 05686 public: 05687 psMGUpdateMessage(uint32_t client, uint8_t counter, 05688 uint32_t gameID, uint8_t numUpdates, uint8_t* updates); 05689 05690 psMGUpdateMessage(MsgEntry* me); 05691 05692 PSF_DECLARE_MSG_FACTORY(); 05693 05700 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05701 05703 bool IsNewerThan(uint8_t oldCounter); 05704 05706 uint8_t msgCounter; 05707 05709 uint32_t msgGameID; 05710 05712 uint8_t msgNumUpdates; 05713 05720 uint8_t* msgUpdates; 05721 }; 05722 05726 class psEntranceMessage : public psMessageCracker 05727 { 05728 05729 public: 05735 psEntranceMessage(EID entranceID); 05736 05737 psEntranceMessage(MsgEntry* me); 05738 05739 PSF_DECLARE_MSG_FACTORY(); 05740 05747 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05748 05750 EID entranceID; 05751 }; 05752 05753 //-------------------------------------------------------------------------- 05754 05762 class psGMEventListMessage : public psMessageCracker 05763 { 05764 public: 05765 05766 psGMEventListMessage(); 05767 psGMEventListMessage(MsgEntry* me); 05768 05769 PSF_DECLARE_MSG_FACTORY(); 05770 05771 void Populate(csString &gmeventStr, int clientnum); 05772 05779 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05780 05781 csString gmEventsXML; 05782 }; 05783 05784 //--------------------------------------------------------------------------- 05785 05787 class psGMEventInfoMessage : public psMessageCracker 05788 { 05789 public: 05790 enum 05791 { 05792 CMD_QUERY, 05793 CMD_INFO, 05794 CMD_DISCARD, 05795 CMD_EVAL 05796 }; 05797 psGMEventInfoMessage(int cnum, int cmd, int id, const char* name,const char* info, bool Evaluatable = false); 05798 psGMEventInfoMessage(MsgEntry* message); 05799 05800 PSF_DECLARE_MSG_FACTORY(); 05801 05808 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05809 05810 int command,id; 05811 bool Evaluatable; 05812 csString xml; 05813 }; 05814 05815 05816 05820 class psFactionMessage : public psMessageCracker 05821 { 05822 public: 05823 // Structure to hold faction name/faction value pairs. 05824 struct FactionPair 05825 { 05826 csString faction; // Name of the faction. 05827 int rating; // Rating with that faction. 05828 }; 05829 05831 enum 05832 { 05833 MSG_FULL_LIST, // Data is the full faction list. 05834 MSG_UPDATE // Data is an update faction list. 05835 }; 05836 05841 psFactionMessage(int cnum, int cmd); 05842 05847 void AddFaction(csString factionName, int rating); 05848 05850 void BuildMsg(); 05851 05853 psFactionMessage(MsgEntry* message); 05854 05855 PSF_DECLARE_MSG_FACTORY(); 05856 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05857 05858 int cmd; 05859 int client; 05860 csPDelArray<FactionPair> factionInfo; 05861 }; 05862 05863 //--------------------------------------------------------------------------- 05864 05866 class psSequenceMessage : public psMessageCracker 05867 { 05868 public: 05869 enum // Should use same values as in the NPC client SequenceOperation 05870 { 05871 CMD_START = 1, 05872 CMD_STOP = 2, 05873 CMD_LOOP = 3 05874 }; 05875 psSequenceMessage(int cnum, const char* name, int cmd, int count); 05876 psSequenceMessage(MsgEntry* message); 05877 05878 PSF_DECLARE_MSG_FACTORY(); 05879 05886 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05887 05888 csString name; 05889 int command,count; 05890 }; 05891 05892 05900 class psPlaySoundMessage : public psMessageCracker 05901 { 05902 public: 05903 csString sound; 05905 psPlaySoundMessage(uint32_t clientnum, csString snd); 05906 05908 psPlaySoundMessage(MsgEntry* message); 05909 05910 PSF_DECLARE_MSG_FACTORY(); 05917 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05918 }; 05919 05920 //----------------------------------------------------------------------------- 05921 05925 class psCharCreateCPMessage : public psMessageCracker 05926 { 05927 public: 05928 psCharCreateCPMessage(uint32_t client, int32_t rID, int32_t CPVal); 05929 psCharCreateCPMessage(MsgEntry* message); 05930 05931 PSF_DECLARE_MSG_FACTORY(); 05932 05939 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05940 05941 int32_t raceID; 05942 int32_t CPValue; 05943 }; 05944 05945 //----------------------------------------------------------------------------- 05946 05950 class psCharIntroduction : public psMessageCracker 05951 { 05952 public: 05953 psCharIntroduction(); 05954 psCharIntroduction(MsgEntry* message); 05955 05956 PSF_DECLARE_MSG_FACTORY(); 05957 05964 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05965 }; 05966 05967 05971 class psCachedFileMessage : public psMessageCracker 05972 { 05973 05974 public: 05975 csString hash; 05976 csRef<iDataBuffer> databuf; 05977 05978 psCachedFileMessage(uint32_t client, uint8_t sequence, const char* pathname, iDataBuffer* contents); 05979 psCachedFileMessage(MsgEntry* me); 05980 05981 PSF_DECLARE_MSG_FACTORY(); 05982 05989 virtual csString ToString(NetBase::AccessPointers* accessPointers); 05990 05991 }; 05992 05993 //----------------------------------------------------------------------------- 05994 05998 class psDialogMenuMessage : public psMessageCracker 05999 { 06000 public: 06001 csString xml; 06002 06003 psDialogMenuMessage(); 06004 psDialogMenuMessage(MsgEntry* message); 06005 06006 PSF_DECLARE_MSG_FACTORY(); 06007 06008 06009 void BuildMsg(int clientnum); 06010 06017 virtual csString ToString(NetBase::AccessPointers* accessPointers); 06018 06019 struct DialogResponse 06020 { 06021 uint32_t id; 06022 csString menuText; 06023 csString triggerText; 06024 uint32_t flags; 06025 }; 06026 06027 void AddResponse(uint32_t id, const csString &menuText, const csString &triggerText, uint32_t flags = 0x00); 06028 06029 csArray<DialogResponse> responses; 06030 }; 06031 06035 class psSimpleStringMessage : public psMessageCracker 06036 { 06037 06038 public: 06039 csString str; 06040 06041 psSimpleStringMessage(uint32_t client,MSG_TYPES type, const char* string); 06042 psSimpleStringMessage(MsgEntry* me); 06043 06044 PSF_DECLARE_MSG_FACTORY(); 06045 06052 virtual csString ToString(NetBase::AccessPointers* accessPointers) 06053 { 06054 (void)accessPointers; // NOT USED 06055 return csString("Str: ") + str; 06056 } 06057 06058 }; 06059 06063 class psSimpleRenderMeshMessage : public psMessageCracker 06064 { 06065 06066 public: 06067 iSector* sector; 06068 csString name; 06069 uint16_t index; 06070 uint16_t count; 06071 csSimpleRenderMesh simpleRenderMesh; 06072 06073 psSimpleRenderMeshMessage(uint32_t client, NetBase::AccessPointers* accessPointers, const char* name, uint16_t index, uint16_t count, const iSector* sector, const csSimpleRenderMesh &simpleRenderMesh); 06074 psSimpleRenderMeshMessage(MsgEntry* me, NetBase::AccessPointers* accessPointers); 06075 06076 PSF_DECLARE_MSG_FACTORY(); 06077 06084 virtual csString ToString(NetBase::AccessPointers* accessPointers); 06085 }; 06086 06090 class psMechanismActivateMessage: public psMessageCracker 06091 { 06092 public: 06100 psMechanismActivateMessage(uint32_t client, const char* meshName, 06101 const char* move, const char* rot); 06102 06107 psMechanismActivateMessage(MsgEntry* me); 06108 06109 // From psMessageCracker 06110 PSF_DECLARE_MSG_FACTORY(); 06111 06112 virtual csString ToString(NetBase::AccessPointers* /*accessPointers*/) 06113 { 06114 return csString("not implemented"); 06115 } 06116 06117 csString meshName; 06118 csString move; 06119 csString rot; 06120 }; 06121 06122 06126 class psOrderedMessage : public psMessageCracker 06127 { 06128 06129 public: 06130 int value; 06131 06132 psOrderedMessage(uint32_t client, int valueToSend, int sequenceNumber); 06133 psOrderedMessage(MsgEntry* me); 06134 06135 PSF_DECLARE_MSG_FACTORY(); 06136 06143 virtual csString ToString(NetBase::AccessPointers* accessPointers); 06144 06145 }; 06146 06149 class psHiredNPCScriptMessage : public psMessageCracker 06150 { 06151 06152 public: 06153 // Hired NPC Script Commands 06154 enum 06155 { 06156 CANCEL, 06157 CHECK_WORK_LOCATION, 06158 CHECK_WORK_LOCATION_RESULT, 06159 COMMIT, 06160 COMMIT_REPLY, 06161 REQUEST, 06162 REQUEST_REPLY, 06163 VERIFY, 06164 VERIFY_REPLY, 06165 WORK_LOCATION, 06166 WORK_LOCATION_RESULT, 06167 WORK_LOCATION_UPDATE 06168 }; 06169 06170 uint8_t command; 06171 EID hiredEID; 06172 bool choice; 06173 csString workLocation; 06174 bool workLocationValid; 06175 csString script; 06176 csString locationType; 06177 csString locationName; 06178 csString errorMessage; 06179 06183 psHiredNPCScriptMessage(uint32_t client, uint8_t command, EID hiredEID); 06184 06188 psHiredNPCScriptMessage(uint32_t client, uint8_t command, EID hiredEID, 06189 bool choice, const char* errorMsg); 06190 06195 psHiredNPCScriptMessage(uint32_t client, uint8_t command, EID hiredEID, 06196 const char* script); 06197 06201 psHiredNPCScriptMessage(uint32_t client, uint8_t command, EID hiredEID, 06202 const char* locationType, const char* locationName); 06203 06207 psHiredNPCScriptMessage(uint32_t client, uint8_t command, EID hiredEID, 06208 const char* workLocation, bool workLocationValid, 06209 const char* script); 06210 06214 psHiredNPCScriptMessage(MsgEntry* me); 06215 06216 PSF_DECLARE_MSG_FACTORY(); 06217 06224 virtual csString ToString(NetBase::AccessPointers* accessPointers); 06225 06226 }; 06227 06228 06231 #endif