Atrinik Server 2.5
include/player.h
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00030 #ifndef PLAYER_H
00031 #define PLAYER_H
00032 
00034 typedef struct _level_color
00035 {
00037     int green;
00038 
00040     int blue;
00041 
00043     int yellow;
00044 
00046     int orange;
00047 
00049     int red;
00050 
00052     int purple;
00053 }_level_color;
00054 
00055 extern _level_color level_color[201];
00056 
00058 enum
00059 {
00061     FIRE_MODE_NONE = -1,
00063     FIRE_MODE_BOW,
00065     FIRE_MODE_SPELL,
00067     FIRE_MODE_WAND,
00069     FIRE_MODE_SKILL,
00071     FIRE_MODE_THROW,
00073     FIRE_MODE_SUMMON
00074 };
00075 
00077 typedef enum rangetype
00078 {
00080     range_none = 0,
00082     range_bow = 1,
00084     range_magic = 2,
00086     range_wand = 3,
00088     range_rod = 4,
00090     range_scroll = 5,
00092     range_horn = 6,
00094     range_skill = 7
00095 } rangetype;
00096 
00100 enum
00101 {
00103     PLAYER_EQUIP_MAIL,
00105     PLAYER_EQUIP_GAUNTLET,
00107     PLAYER_EQUIP_BRACER,
00109     PLAYER_EQUIP_HELM,
00111     PLAYER_EQUIP_BOOTS,
00113     PLAYER_EQUIP_CLOAK,
00115     PLAYER_EQUIP_GIRDLE,
00117     PLAYER_EQUIP_SHIELD,
00119     PLAYER_EQUIP_RRING,
00121     PLAYER_EQUIP_LRING,
00123     PLAYER_EQUIP_AMULET,
00125     PLAYER_EQUIP_WEAPON,
00127     PLAYER_EQUIP_BOW,
00129     PLAYER_EQUIP_SKILL_ITEM,
00130 
00132     PLAYER_EQUIP_MAX
00133 };
00134 
00139 #define PLAYER_AFLAG_FIGHT      1
00140 
00144 #define PLAYER_AFLAG_ENEMY      2
00145 
00146 #define PLAYER_AFLAG_ADDFRAME   4
00147 
00150 #define MAX_QUICKSLOT 32
00151 
00153 #define PLAYER_PATH_MAX_FAILS 15
00154 
00156 typedef struct player_path
00157 {
00159     struct player_path *next;
00160 
00162     mapstruct *map;
00163 
00165     sint16 x;
00166 
00168     sint16 y;
00169 
00174     uint8 fails;
00175 } player_path;
00176 
00181 enum
00182 {
00183     READY_OBJ_ARROW,
00184     READY_OBJ_THROW,
00185     READY_OBJ_MAX
00186 };
00187 
00189 #define PLAYER_NAME_MIN 2
00190 
00192 #define PLAYER_NAME_MAX 12
00193 
00195 #define PLAYER_PASSWORD_MIN 2
00196 
00198 #define PLAYER_PASSWORD_MAX 30
00199 
00201 typedef struct pl_player
00202 {
00204     struct pl_player *prev;
00205 
00207     struct pl_player *next;
00208 
00210     socket_struct socket;
00211 
00212     /* Everything below will be cleared by memset() in get_player(). */
00213 
00215     char maplevel[MAX_BUF];
00216 
00218     char firemode_name[BIG_NAME * 2];
00219 
00221     char quick_name[BIG_NAME * 3];
00222 
00224     char savebed_map[MAX_BUF];
00225 
00227     char ext_title[MAX_EXT_TITLE];
00228 
00230     char levhp[MAXLEVEL + 1];
00231 
00233     char levsp[MAXLEVEL + 1];
00234 
00236     char levgrace[MAXLEVEL + 1];
00237 
00239     char killer[BIG_NAME];
00240 
00242     char write_buf[MAX_BUF];
00243 
00245     char password[PLAYER_PASSWORD_MAX + 1];
00246 
00248     char followed_player[BIG_NAME];
00249 
00251     char **cmd_permissions;
00252 
00254     shstr **faction_ids;
00255 
00257     char map_info_name[HUGE_BUF];
00258 
00260     char map_info_music[HUGE_BUF];
00261 
00263     char map_info_weather[MAX_BUF];
00264 
00267     struct mapdef *last_update;
00268 
00270     object *ob;
00271 
00273     object *selected_weapon;
00274 
00278     object *skill_weapon;
00279 
00281     object *target_object;
00282 
00284     object *equipment[PLAYER_EQUIP_MAX];
00285 
00287     object *skill_ptr[NROFSKILLS];
00288 
00290     object *last_skill_ob[MAX_EXP_CAT];
00291 
00293     object *exp_ptr[MAX_EXP_CAT];
00294 
00296     object *mark;
00297 
00299     object *map_below;
00300 
00302     object *map_above;
00303 
00305     object *container;
00306 
00308     object *container_above;
00309 
00311     object *container_below;
00312 
00315     object *class_ob;
00316 
00318     object *quest_container;
00319 
00321     object *ready_object[READY_OBJ_MAX];
00322 
00324     tag_t ready_object_tag[READY_OBJ_MAX];
00325 
00327     int target_hp;
00328 
00330     int set_skill_weapon;
00331 
00333     int set_skill_archery;
00334 
00336     int bed_x;
00337 
00339     int bed_y;
00340 
00342     int firemode_type;
00343 
00345     int firemode_tag1;
00346 
00348     int firemode_tag2;
00349 
00353     int blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y];
00354 
00356     int last_skill_index;
00357 
00359     int map_update_cmd;
00360 
00362     int map_update_tile;
00363 
00365     int map_tile_x;
00366 
00368     int map_tile_y;
00369 
00371     int map_off_x;
00372 
00374     int map_off_y;
00375 
00377     int num_cmd_permissions;
00378 
00380     int num_faction_ids;
00381 
00383     sint64 *faction_reputation;
00384 
00386     sint64 fame;
00387 
00389     float action_timer;
00390 
00392     float last_action_timer;
00393 
00395     float last_speed;
00396 
00398     char target_hp_p;
00399 
00401     char weapon_sp;
00402 
00404     char last_weapon_sp;
00405 
00407     char last_skill_level[MAX_EXP_CAT];
00408 
00410     uint8 last_skill_id[MAX_EXP_CAT];
00411 
00413     unsigned char last_level;
00414 
00416     signed char digestion;
00417 
00419     signed char gen_sp_armour;
00420 
00422     signed char gen_hp;
00423 
00425     signed char gen_sp;
00426 
00428     signed char gen_grace;
00429 
00431     unsigned char state;
00432 
00434     unsigned char fire_on;
00435 
00437     unsigned char run_on;
00438 
00439 #ifdef AUTOSAVE
00440 
00441     long last_save_tick;
00442 #endif
00443 
00445     long last_weight;
00446 
00447 #ifdef SAVE_INTERVAL
00448 
00449     time_t last_save_time;
00450 #endif
00451 
00453     uint32 container_count;
00454 
00456     uint32 action_casting;
00457 
00459     uint32 action_range;
00460 
00462     uint32 mark_count;
00463 
00465     sint64 last_skill_exp[MAX_EXP_CAT];
00466 
00468     sint64 skill_exp[NROFSKILLS];
00469 
00471     uint64 stat_deaths;
00472 
00474     uint64 stat_kills_mob;
00475 
00477     uint64 stat_kills_pvp;
00478 
00480     uint64 stat_damage_taken;
00481 
00483     uint64 stat_damage_dealt;
00484 
00486     uint64 stat_hp_regen;
00487 
00489     uint64 stat_sp_regen;
00490 
00492     uint64 stat_grace_regen;
00493 
00495     uint64 stat_food_consumed;
00496 
00498     uint64 stat_food_num_consumed;
00499 
00501     uint64 stat_damage_healed;
00502 
00504     uint64 stat_damage_healed_other;
00505 
00507     uint64 stat_damage_heal_received;
00508 
00510     uint64 stat_steps_taken;
00511 
00513     uint64 stat_spells_cast;
00514 
00516     uint64 stat_prayers_cast;
00517 
00519     uint64 stat_time_played;
00520 
00522     uint64 stat_time_afk;
00523 
00525     time_t last_stat_time_played;
00526 
00528     uint64 stat_arrows_fired;
00529 
00531     uint64 stat_missiles_thrown;
00532 
00534     uint64 stat_books_read;
00535 
00537     uint64 stat_unique_books_read;
00538 
00540     uint64 stat_potions_used;
00541 
00543     uint64 stat_scrolls_used;
00544 
00546     uint64 stat_exp_gained;
00547 
00549     uint64 stat_items_dropped;
00550 
00552     uint64 stat_items_picked;
00553 
00555     uint64 stat_corpses_searched;
00556 
00558     uint64 stat_traps_found;
00559 
00561     uint64 stat_traps_disarmed;
00562 
00564     uint64 stat_traps_sprung;
00565 
00567     uint64 stat_afk_used;
00568 
00570     uint64 stat_formed_party;
00571 
00573     uint64 stat_joined_party;
00574 
00576     uint64 stat_renamed_items;
00577 
00579     uint64 stat_emotes_used;
00580 
00584     uint64 stat_books_inscribed;
00585 
00587     uint32 target_object_count;
00588 
00590     uint32 target_map_pos;
00591 
00593     uint32 last_weight_limit;
00594 
00596     uint32 update_los:1;
00597 
00599     uint32 combat_mode:1;
00600 
00602     uint32 praying:1;
00603 
00605     uint32 was_praying:1;
00606 
00608     uint32 dm_light:1;
00609 
00611     uint32 dm_removed_from_map:1;
00612 
00614     uint32 afk:1;
00615 
00617     uint32 ms_privacy:1;
00618 
00620     uint32 update_skills:1;
00621 
00623     uint32 count;
00624 
00626     sint32 last_ranged_ws;
00627 
00629     sint16 chosen_spell;
00630 
00632     uint16 last_flags;
00633 
00635     uint16 gen_hp_remainder;
00636 
00638     uint16 gen_sp_remainder;
00639 
00641     uint16 gen_grace_remainder;
00642 
00644     uint16 gen_client_hp;
00645 
00647     uint16 gen_client_sp;
00648 
00650     uint16 gen_client_grace;
00651 
00653     uint16 last_gen_hp;
00654 
00656     uint16 last_gen_sp;
00657 
00659     uint16 last_gen_grace;
00660 
00662     sint16 client_dam;
00663 
00665     sint16 skill_level[NROFSKILLS];
00666 
00668     sint16 encumbrance;
00669 
00671     uint16 anim_flags;
00672 
00674     uint16 nrofknownspells;
00675 
00677     sint16 known_spells[NROFREALSPELLS];
00678 
00680     sint16 item_power;
00681 
00683     sint16 spell_quickslots[MAX_QUICKSLOT];
00684 
00686     sint16 last_ranged_dam;
00687 
00689     sint16 last_ranged_wc;
00690 
00692     sint8 last_protection[NROFATTACKS];
00693 
00695     uint8 no_shout;
00696 
00700     uint8 dm_stealth;
00701 
00703     uint8 last_party_hp;
00704 
00706     uint8 last_party_sp;
00707 
00709     uint8 last_party_grace;
00710 
00712     rangetype shoottype;
00713 
00715     living orig_stats;
00716 
00718     living last_stats;
00719 
00721     party_struct *party;
00722 
00724     player_path *move_path;
00725 
00727     player_path *move_path_end;
00728 } player;
00729 
00730 #endif