Fimbulwinter Project  Pre-Alpha
An Ragnarok Online Emulator
Common/ragnarok.hpp
00001 /*==================================================================*
00002 *     ___ _           _           _          _       _                          *
00003 *    / __(_)_ __ ___ | |__  _   _| |_      _(_)_ __ | |_ ___ _ __       *
00004 *   / _\ | | '_ ` _ \| '_ \| | | | \ \ /\ / / | '_ \| __/ _ \ '__|      *
00005 *  / /   | | | | | | | |_) | |_| | |\ V  V /| | | | | ||  __/ |         *
00006 *  \/    |_|_| |_| |_|_.__/ \__,_|_| \_/\_/ |_|_| |_|\__\___|_|         *
00007 *                                                                                                                                       *
00008 * ------------------------------------------------------------------*
00009 *                                                        Emulator                                       *
00010 * ------------------------------------------------------------------*
00011 *                     Licenced under GNU GPL v3                     *
00012 * ----------------------------------------------------------------- *
00013 *                        General Char Data                              *
00014 * ==================================================================*/
00015 
00016 #pragma once
00017 
00018 #include <time.h>
00019 #include <string>
00020 
00021 #define PACKETVER 20110111
00022 #define CLIENTVER 26
00023 
00024 #define NAME_LENGTH (23 + 1)
00025 #define MESSAGE_SIZE (79 + 1)
00026 
00027 #define MAX_CHARS_SLOTS 9
00028 
00029 #define MAX_CHARS MAX_CHARS_SLOTS
00030 
00031 #define DEFAULT_WALK_SPEED 150
00032 #define MIN_WALK_SPEED 0
00033 #define MAX_WALK_SPEED 1000
00034 
00035 #define MAP_NAME_LENGTH (11 + 1)
00036 #define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4)
00037 
00038 #define MAP_PRONTERA "prontera"
00039 
00040 #define GLOBAL_REG_NUM 256
00041 #define ACCOUNT_REG_NUM 64
00042 #define ACCOUNT_REG2_NUM 16
00043 #define MAX_REG_NUM 256
00044 
00045 using namespace std;
00046 
00048 struct Point 
00049 {
00050         unsigned short map;
00051         short x,y;
00052 };
00053 
00062 struct CharData
00063 {
00064         int char_id;
00065         int account_id;
00066         int partner_id;
00067         int father;
00068         int mother;
00069         int child;
00070 
00071         unsigned int base_exp,job_exp;
00072         int zeny;
00073 
00074         short class_;
00075         unsigned int status_point,skill_point;
00076         int hp,max_hp,sp,max_sp;
00077         unsigned int option;
00078         short manner;
00079         unsigned char karma;
00080         short hair,hair_color,clothes_color;
00081         int party_id,guild_id,pet_id,hom_id,mer_id,ele_id;
00082         int fame;
00083 
00084         // Mercenary Guilds Rank
00085         int arch_faith, arch_calls;
00086         int spear_faith, spear_calls;
00087         int sword_faith, sword_calls;
00088 
00089         short weapon; // enum weapon_type
00090         short shield; // view-id
00091         short head_top,head_mid,head_bottom;
00092         short robe;
00093 
00094         char name[NAME_LENGTH];
00095         unsigned int base_level,job_level;
00096         short str,agi,vit,int_,dex,luk;
00097         unsigned char slot,sex;
00098 
00099         unsigned int mapip;
00100         unsigned short mapport;
00101 
00102         struct Point last_point, save_point;/*,memo_point[MAX_MEMOPOINTS];
00103         struct item inventory[MAX_INVENTORY],cart[MAX_CART];
00104         struct storage_data storage;
00105         struct s_skill skill[MAX_SKILL];
00106 
00107         struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
00108 #ifdef HOTKEY_SAVING
00109         struct hotkey hotkeys[MAX_HOTKEYS];
00110 #endif*/
00111         bool show_equip;
00112         short rename;
00113 
00114         time_t delete_date;
00115 };
00116 
00118 struct GlobalReg
00119 {
00120         char str[32];
00121         char value[256];
00122 };
00123 
00125 struct AccountReg
00126 {
00127         int account_id, char_id;
00128         int reg_num;
00129         struct GlobalReg reg[MAX_REG_NUM];
00130 };
00131 
00133 struct Registry 
00134 {
00135         int global_num;
00136         struct GlobalReg global[GLOBAL_REG_NUM];
00137         int account_num;
00138         struct GlobalReg account[ACCOUNT_REG_NUM];
00139         int account2_num;
00140         struct GlobalReg account2[ACCOUNT_REG2_NUM];
00141 };
00142 
00144 enum {
00145         SEX_FEMALE = 0,
00146         SEX_MALE,
00147         SEX_SERVER
00148 };
00149 
00150 enum
00151 {
00152         INTER_CA_LOGIN = 0x3000,
00153         INTER_AC_LOGIN_REPLY,
00154 
00155         INTER_AC_KICK,
00156 
00157         INTER_CA_AUTH,
00158         INTER_AC_AUTH_REPLY,
00159 
00160         INTER_CA_REQ_ACC_DATA,
00161         INTER_AC_REQ_ACC_DATA_REPLY,
00162 
00163         INTER_CA_SET_ACC_OFF,
00164 
00165         INTER_ZC_LOGIN,
00166         INTER_CZ_LOGIN_REPLY,
00167 
00168         INTER_ZC_MAPS,
00169 
00170         INTER_ZC_AUTH,
00171         INTER_CZ_AUTH_OK,
00172         INTER_CZ_AUTH_FAIL,
00173 
00174         INTER_ZC_REQ_REGS,
00175         INTER_ZC_REQ_REGS_REPLY,
00176 };
00177 
00178 #define sex_num2str(num) ( (num ==  SEX_FEMALE  ) ? 'F' : (num ==  SEX_MALE  ) ? 'M' : 'S' )
00179 #define sex_str2num(str) ( (str == 'F' ) ?  SEX_FEMALE  : (str == 'M' ) ?  SEX_MALE  :  SEX_SERVER  )
 All Classes Functions