Planeshift
|
00001 #ifndef PS_CHAR_MESSAGES_H 00002 #define PS_CHAR_MESSAGES_H 00003 00004 #include <csutil/parray.h> 00005 #include "net/messages.h" 00006 00011 00012 // GENDER VALUES FOR CHARACTERS 00014 enum PSCHARACTER_GENDER { 00015 PSCHARACTER_GENDER_NONE = 0, 00016 PSCHARACTER_GENDER_FEMALE = 1, 00017 PSCHARACTER_GENDER_MALE = 2, 00018 PSCHARACTER_GENDER_COUNT = 3 00019 }; 00021 00024 enum PSTRAIT_LOCATION { 00025 PSTRAIT_LOCATION_NONE = 0, 00026 PSTRAIT_LOCATION_FACE, 00027 PSTRAIT_LOCATION_HAIR_STYLE, 00028 PSTRAIT_LOCATION_BEARD_STYLE, 00029 PSTRAIT_LOCATION_HAIR_COLOR, 00030 PSTRAIT_LOCATION_SKIN_TONE, 00031 PSTRAIT_LOCATION_ITEM, 00032 PSTRAIT_LOCATION_EYE_COLOR, 00033 PSTRAIT_LOCATION_COUNT 00034 }; 00035 //NOTE: Remember to update the locationString in pstrait.cpp each time something is changed here 00036 00038 00039 00040 00042 00045 class psCharApprovedMessage : public psMessageCracker 00046 { 00047 public: 00049 psCharApprovedMessage( uint32_t clientnum ); 00050 00052 psCharApprovedMessage ( MsgEntry* msg ); 00053 00054 PSF_DECLARE_MSG_FACTORY(); 00055 00062 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00063 }; 00064 00065 00066 //-------------------------------------------------------------------------- 00067 00068 00069 00073 class psCharRejectedMessage : public psMessageCracker 00074 { 00075 public: 00077 enum ErrorTypes 00078 { 00079 UNKNOWN, 00080 NON_LEGAL_NAME, 00081 NON_UNIQUE_NAME, 00082 RESERVED_NAME, 00083 INVALID_CREATION, 00084 FAILED_ACCOUNT 00085 }; 00086 00088 psCharRejectedMessage ( uint32_t clientnum, int type=UNKNOWN, const char *msg="Unknown error" ); 00089 00091 psCharRejectedMessage( MsgEntry* msg ); 00092 00093 PSF_DECLARE_MSG_FACTORY(); 00094 00101 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00102 00104 int errorType; 00105 00107 csString errorMesg; 00108 }; 00109 00110 00111 //-------------------------------------------------------------------------- 00112 00116 class psCharVerificationMesg : public psMessageCracker 00117 { 00118 public: 00119 struct Attribute 00120 { 00121 csString name; 00122 int value; 00123 }; 00124 00125 psCharVerificationMesg( uint32_t client ); 00126 psCharVerificationMesg( MsgEntry* me ); 00127 00128 PSF_DECLARE_MSG_FACTORY(); 00129 00136 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00137 00142 void AddStat( int value, const char* attributeName ); 00143 void AddSkill( int value, const char* attributeName ); 00144 00145 // Build the message 00146 void Construct(); 00147 00148 csArray<psCharVerificationMesg::Attribute> stats; 00149 csArray<psCharVerificationMesg::Attribute> skills; 00150 00151 // Used in the creation of message. 00152 size_t runningSize; 00153 00154 // target of message 00155 uint32_t clientnum; 00156 }; 00157 00158 //-------------------------------------------------------------------------- 00159 00160 class psCharUploadMessage : public psMessageCracker 00161 { 00162 public: 00163 psCharUploadMessage( bool verify, const char* name, const char* lastname, int race, int gender, 00164 csArray<uint32_t> choices, int motherMod, int fatherMod, csArray<uint32_t> lifeEvents, 00165 int selectedFace, int selectedHairStyle, int selectedBeardStyle, 00166 int selectedHairColour, int selectedSkinColour, const char* bio, const char* path ); 00167 00168 psCharUploadMessage( MsgEntry* me ); 00169 00170 PSF_DECLARE_MSG_FACTORY(); 00171 00178 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00179 00180 00181 public: 00182 bool verify; 00183 csString name; 00184 csString lastname; 00185 int race; 00186 int gender; 00187 00188 csArray<uint32_t> choices; 00189 csArray<uint32_t> lifeEvents; 00190 00191 int selectedFace; 00192 int selectedHairStyle; 00193 int selectedBeardStyle; 00194 int selectedHairColour; 00195 int selectedSkinColour; 00196 00197 int fatherMod; 00198 int motherMod; 00199 00200 csString bio; 00201 csString path; 00202 }; 00203 00204 //-------------------------------------------------------------------------- 00205 00211 enum CreationAreas 00212 { 00213 ZODIAC, 00214 FATHER_JOB, 00215 MOTHER_JOB, 00216 RELIGION, 00217 BIRTH_EVENT, 00218 CHILD_ACTIVITY, 00219 CHILD_HOUSE, 00220 CHILD_SIBLINGS 00221 }; 00222 00225 struct CreationChoice 00226 { 00227 int id; 00228 csString name; 00229 csString description; 00230 int choiceArea; 00231 int cpCost; 00232 }; 00233 00241 class psCreationChoiceMsg : public psMessageCracker 00242 { 00243 public: 00244 00248 psCreationChoiceMsg( int listener ); 00249 00252 psCreationChoiceMsg( MsgEntry* me ); 00253 00261 psCreationChoiceMsg( int clientTo, int totalChoices, int listener ); 00262 00263 PSF_DECLARE_MSG_FACTORY(); 00264 00271 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00272 00282 void AddChoice( int id, const char* name, const char* description, int area, int cost ); 00283 00285 void ConstructMessage(); 00286 00288 csArray<CreationChoice> choices; 00289 }; 00290 00291 00292 //------------------------------------------------------------------------------ 00293 00296 class LifeEventChoice 00297 { 00298 public: 00299 int id; 00300 csString name; 00301 csString description; 00302 csArray<int> adds; 00303 csArray<int> removes; 00304 int common; 00305 int cpCost; 00306 }; 00307 00308 00313 class psLifeEventMsg : public psMessageCracker 00314 { 00315 public: 00318 psLifeEventMsg(); 00319 00320 psLifeEventMsg( uint32_t client ); 00321 00322 psLifeEventMsg( MsgEntry* me ); 00323 00324 PSF_DECLARE_MSG_FACTORY(); 00325 00332 virtual csString ToString(NetBase::AccessPointers* accessPointers); 00333 00334 void AddEvent( LifeEventChoice *choice ); 00335 00336 void ConstructMessage(); 00337 00338 csPDelArray<LifeEventChoice> choices; 00339 00340 uint32_t toclient; 00341 size_t runningSize; 00342 }; 00343 00346 #endif 00347 00348 00349