Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

map.h

Go to the documentation of this file.
00001 
00016 #ifndef OA_MAP_H
00017 #define OA_MAP_H
00018 
00019 #include <stdarg.h>
00020 #include <config.h>
00021 #include <mmo.h>
00022 #include "common/timer.h"
00023 
00024 #define MAX_PC_CLASS 4050
00025 #define PC_CLASS_BASE 0
00026 #define PC_CLASS_BASE2 (PC_CLASS_BASE + 4001)
00027 #define PC_CLASS_BASE3 (PC_CLASS_BASE2 + 22)
00028 #define MAX_NPC_PER_MAP 512
00029 #define BLOCK_SIZE 8
00030 #define AREA_SIZE battle_config.area_size
00031 #define LOCAL_REG_NUM 16
00032 #define LIFETIME_FLOORITEM 60
00033 #define DAMAGELOG_SIZE 30
00034 #define LOOTITEM_SIZE 10
00035 #define MAX_SKILL_LEVEL 100
00036 #define MAX_STATUSCHANGE 250
00037 #define MAX_SKILLUNITGROUP 32
00038 #define MAX_MOBSKILLUNITGROUP 8
00039 #define MAX_SKILLUNITGROUPTICKSET 32
00040 #define MAX_SKILLTIMERSKILL 32
00041 #define MAX_MOBSKILLTIMERSKILL 10
00042 #define MAX_MOBSKILL 50
00043 #define MAX_EVENTQUEUE 2
00044 #define MAX_EVENTTIMER 32
00045 #define NATURAL_HEAL_INTERVAL 500
00046 #define MAX_FLOORITEM 500000
00047 #define MAX_LEVEL 255
00048 
00052 #define MAX_WALKPATH 32
00053 
00054 //#define MAX_DROP_PER_MAP 48 // -> now, dynamic
00055 
00060 #define MAX_IGNORE_LIST 1000
00061 #define MAX_VENDING 12
00062 #define MAX_MOB_DB 2000
00063 
00064 // MAX_PC_BONUS -- how many autospells may be used at once
00065 #define MAX_PC_BONUS 10
00066 
00067 #define DEFAULT_AUTOSAVE_INTERVAL 120*1000
00068 
00069 #define OPTION_HIDE 0x40
00070 
00071 char messages_filename[1024];
00072 
00076 enum {
00077         JOB_NOVICE,
00078         JOB_SWORDMAN,
00079         JOB_MAGE,
00080         JOB_ARCHER,
00081         JOB_ACOLYTE,
00082         JOB_MERCHANT,
00083         JOB_THIEF,
00084         JOB_KNIGHT,
00085         JOB_PRIEST,
00086         JOB_WIZARD,
00087         JOB_BLACKSMITH,
00088         JOB_HUNTER,
00089         JOB_ASSASSIN,
00090         JOB_KNIGHT2,
00091         JOB_CRUSADER,
00092         JOB_MONK,
00093         JOB_SAGE,
00094         JOB_ROGUE,
00095         JOB_ALCHEMIST,
00096         JOB_BARD,
00097         JOB_DANCER,
00098         JOB_CRUSADER2,
00099         JOB_WEDDING,
00100         JOB_SUPER_NOVICE,
00101 
00102         JOB_NOVICE_HIGH = 4001,
00103         JOB_SWORDMAN_HIGH,
00104         JOB_MAGE_HIGH,
00105         JOB_ARCHER_HIGH,
00106         JOB_ACOLYTE_HIGH,
00107         JOB_MERCHANT_HIGH,
00108         JOB_THIEF_HIGH,
00109         JOB_LORD_KNIGHT,
00110         JOB_HIGH_PRIEST,
00111         JOB_HIGH_WIZARD,
00112         JOB_WHITESMITH,
00113         JOB_SNIPER,
00114         JOB_ASSASSIN_CROSS,
00115         JOB_LORD_KNIGHT2,
00116         JOB_PALADIN,
00117         JOB_CHAMPION,
00118         JOB_PROFESSOR,
00119         JOB_STALKER,
00120         JOB_CREATOR,
00121         JOB_CLOWN,
00122         JOB_GYPSY,
00123         JOB_PALADIN2,
00124 
00125         JOB_BABY,
00126         JOB_BABY_SWORDMAN,
00127         JOB_BABY_MAGE,
00128         JOB_BABY_ARCHER,
00129         JOB_BABY_ACOLYTE,
00130         JOB_BABY_MERCHANT,
00131         JOB_BABY_THIEF,
00132         JOB_BABY_KNIGHT,
00133         JOB_BABY_PRIEST,
00134         JOB_BABY_WIZARD,
00135         JOB_BABY_BLACKSMITH,
00136         JOB_BABY_HUNTER,
00137         JOB_BABY_ASSASSIN,
00138         JOB_BABY_KNIGHT2,
00139         JOB_BABY_CRUSADER,
00140         JOB_BABY_MONK,
00141         JOB_BABY_SAGE,
00142         JOB_BABY_ROGUE,
00143         JOB_BABY_ALCHEMIST,
00144         JOB_BABY_BARD,
00145         JOB_BABY_DANCER,
00146         JOB_BABY_CRUSADER2,
00147         JOB_SUPER_BABY,
00148 };
00149 
00150 enum { BL_NUL, BL_PC, BL_NPC, BL_MOB, BL_ITEM, BL_CHAT, BL_SKILL , BL_PET };
00151 enum { WARP, SHOP, SCRIPT, MONS };
00152 
00153 struct block_list {
00154         struct block_list *next, *prev;
00155         int id;
00156         short m, x, y;
00157         unsigned char type;
00158         unsigned char subtype;
00159 };
00160 
00161 struct walkpath_data {
00162         unsigned char path_len,path_pos,path_half;
00163         unsigned char path[MAX_WALKPATH];
00164 };
00165 
00166 struct script_reg {
00167         int index;
00168         int data;
00169 };
00170 
00171 struct script_regstr {
00172         int index;
00173         char data[256];
00174 };
00175 
00176 struct status_change {
00177         int timer;
00178         intptr_t val1, val2, val3, val4;
00179 };
00180 
00181 struct vending {
00182         short index;
00183         unsigned short amount;
00184         unsigned int value;
00185 };
00186 
00187 struct skill_unit_group;
00188 
00189 struct skill_unit {
00190         struct block_list bl;
00191 
00192         struct skill_unit_group *group;
00193 
00194         int limit;
00195         int val1, val2;
00196         short alive, range;
00197 };
00198 
00199 struct skill_unit_group {
00200         int src_id;
00201         int party_id;
00202         int guild_id;
00203         int map;
00204         int target_flag;
00205         unsigned int tick;
00206         int limit, interval;
00207 
00208         int skill_id, skill_lv;
00209         int val1, val2, val3;
00210         char *valstr;
00211         int unit_id;
00212         int group_id;
00213         int unit_count, alive_count;
00214         struct skill_unit *unit;
00215 };
00216 
00217 struct skill_unit_group_tickset {
00218         unsigned int tick;
00219         int id;
00220 };
00221 
00222 struct skill_timerskill {
00223         int timer;
00224         int src_id;
00225         int target_id;
00226         int map;
00227         short x, y;
00228         short skill_id, skill_lv;
00229         int type;
00230         int flag;
00231 };
00232 
00238 struct map_session_data {
00239         struct block_list bl;
00240         struct {
00241                 unsigned auth : 1;
00242 
00252                 unsigned bot_flag : 3; 
00253                 unsigned change_walk_target : 1;
00254                 unsigned attack_continue : 1;
00255                 unsigned menu_or_input : 1;
00256                 unsigned dead_sit : 2; 
00263                 unsigned previously_sit_hp : 1;
00264 
00270                 unsigned previously_sit_sp : 1;
00271                 unsigned skillcastcancel : 1;
00272                 unsigned waitingdisconnect : 1;
00273                 unsigned lr_flag : 2;
00274                 unsigned connect_new : 1;
00275                 unsigned arrow_atk : 1;
00276                 
00280                 unsigned attack_type : 3;
00281                 unsigned skill_flag : 1;
00282                 unsigned gangsterparadise : 1;
00283                 unsigned produce_flag : 1;
00284                 unsigned make_arrow_flag : 1;
00285                 unsigned potionpitcher_flag : 1;
00286                 unsigned storage_flag : 1;
00291                 unsigned modified_storage_flag : 2;
00292                 unsigned snovice_flag : 2; // (0 to 3)
00293                 struct guild * gmaster_flag;
00294                 // originally by Qamera, adapted by celest
00295                 unsigned event_death : 1;
00296                 unsigned event_kill : 1;
00297                 unsigned event_disconnect : 1;
00298 
00303                 unsigned autoloot_rate : 14;
00307                 unsigned autolootloot_flag : 1;
00311                 unsigned displayexp_flag : 1;
00315                 unsigned displaydrop_rate : 14;
00320                 unsigned displaylootdrop : 1;
00324                 unsigned display_player_hp : 1;
00325                 unsigned main_flag : 1;
00326                 unsigned refuse_request_flag : 1;
00327                 unsigned night : 1;
00331                 unsigned autovend: 1;
00332         } state;
00333         struct {
00334                 unsigned killer : 1;
00335                 unsigned killable : 1;
00336                 unsigned restart_full_recover : 1;
00337                 unsigned no_castcancel : 1;
00338                 unsigned no_castcancel2 : 1;
00339                 unsigned no_sizefix : 1;
00340                 unsigned no_magic_damage : 1;
00341                 unsigned no_weapon_damage : 1;
00342                 unsigned no_gemstone : 1;
00343                 unsigned infinite_endure : 1;
00344         } special_state;
00345         int char_id, login_id1, login_id2;
00346         unsigned char sex, GM_level;
00355         unsigned char packet_ver;
00356         struct mmo_charstatus status;
00360         struct item_data *inventory_data[MAX_INVENTORY];
00361         short equip_index[11];
00362         unsigned short unbreakable_equip;
00366         unsigned short unbreakable; 
00367         int weight, max_weight;
00368         int cart_weight, cart_max_weight;
00372         short cart_num;
00373         char mapname[17]; // 16 + NULL
00374         int fd;
00375         short to_x, to_y;
00376         short speed, prev_speed;
00377         short opt1, opt2, opt3;
00378         char dir, head_dir;
00379         unsigned int client_tick;
00380         unsigned int first_client_tick;         
00381         unsigned int tick_at_start;             
00386         char first_check_done;
00387         struct walkpath_data walkpath;
00388         int walktimer;
00389         int next_walktime;
00390         int npc_id, areanpc_id, npc_shopid;
00391         int npc_pos;
00392         int npc_menu;
00393         int npc_amount;
00394         int npc_stack, npc_stackmax;
00395         unsigned char *npc_script, *npc_scriptroot; // just pointers on scripts
00396         struct script_data *npc_stackbuf;
00397         char npc_str[256]; // npc_str = 255 + NULL
00398         unsigned int chatID;
00399         unsigned int idletime; // for party experience
00400         time_t lastpackettime; // for disconnection if player is inactive
00401 
00402         struct ignore {
00403                 char name[25]; // 24 + NULL
00404         } *ignore; // dynamic system
00405         unsigned ignore_num : 15; // (0-32767) number of ignored people (real max: 10000, agains hackers)
00406         unsigned ignoreAll : 1; // ignore (yes/no)
00407 
00408         unsigned global_reg_num : 15; // 0-700 (GLOBAL_REG_NUM)
00409         unsigned global_reg_dirty : 1; // must be saved or not
00410         struct global_reg *global_reg;
00411         unsigned account_reg_num : 15; // 0-700 (ACCOUNT_REG_NUM)
00412         unsigned account_reg_dirty : 1; // must be saved or not
00413         struct global_reg *account_reg;
00414         unsigned account_reg2_num : 15; // 0-700 (ACCOUNT_REG2_NUM)
00415         unsigned account_reg2_dirty : 1; // must be saved or not
00416         struct global_reg *account_reg2;
00417         unsigned char friend_num; // 0-40 (MAX_FRIENDS)
00418         struct friend *friends;
00419 
00420         int attacktimer;
00421         int attacktarget;
00422         short attacktarget_lv;
00423         unsigned int attackabletime;
00424 
00425         int followtimer; // [MouseJstr]
00426         int followtarget;
00427 
00428         unsigned int emotionlasttime; // to limit flood with emotion packets
00429         unsigned int last_saving; // to limit successive savings with auto-save
00430 
00431         short attackrange, attackrange_;
00432         int skilltimer;
00433         int skilltarget;
00434         short skillx, skilly;
00435         short skillid, skilllv;
00436         short skillitem, skillitemlv;
00437         short skillid_old, skilllv_old;
00438         short skillid_dance, skilllv_dance;
00439         struct skill_unit_group skillunit[MAX_SKILLUNITGROUP];
00440         struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
00441         struct skill_timerskill skilltimerskill[MAX_SKILLTIMERSKILL];
00442         char blockskill[MAX_SKILL];     // [celest]
00443         short cloneskill_id;
00444         int potion_hp, potion_sp, potion_per_hp, potion_per_sp;
00445 
00446         int invincible_timer;
00447         unsigned int canact_tick;
00448         unsigned int canmove_tick;
00449         unsigned int canlog_tick;
00450         unsigned int canregen_tick;
00451         unsigned int canuseitem_tick; // [Skotlex]
00452         int hp_sub, sp_sub;
00453         int inchealhptick, inchealsptick, inchealspirithptick, inchealspiritsptick;
00454 // -- moonsoul (new tick for berserk self-damage)
00455 //      int berserkdamagetick;
00456         int fame;
00457 
00458         short view_class;
00459         short weapontype1, weapontype2;
00460         short disguiseflag, disguise; // [Valaris]
00461         int paramb[6], paramc[6], parame[6], paramcard[6];
00462         int hit,flee, flee2, aspd, amotion, dmotion;
00463         int watk, watk2, atkmods[3];
00464         int def, def2, mdef, mdef2, critical, matk1, matk2;
00465         int atk_ele, def_ele, star, overrefine;
00466         int castrate, delayrate, hprate, sprate, dsprate;
00467         int addele[10], addrace[12], addsize[3], subele[10], subrace[12];
00468         int addeff[10], addeff2[10], reseff[10];
00469         int watk_,watk_2, atkmods_[3], addele_[10], addrace_[12], addsize_[3]; //二刀流のために追加
00470         int atk_ele_, star_,overrefine_; //二刀流のために追加
00471         int base_atk, atk_rate;
00472         int weapon_atk[16], weapon_atk_rate[16];
00473         int arrow_atk, arrow_ele, arrow_cri, arrow_hit, arrow_range;
00474         int arrow_addele[10], arrow_addrace[12], arrow_addsize[3], arrow_addeff[10], arrow_addeff2[10];
00475         int nhealhp, nhealsp, nshealhp, nshealsp, nsshealhp, nsshealsp;
00476         int aspd_rate, speed_rate, hprecov_rate, sprecov_rate, critical_def, double_rate;
00477         int near_attack_def_rate, long_attack_def_rate, magic_def_rate, misc_def_rate;
00478         int matk_rate, ignore_def_ele, ignore_def_race, ignore_def_ele_, ignore_def_race_;
00479         int ignore_mdef_ele, ignore_mdef_race;
00480         int magic_addele[10], magic_addrace[12], magic_subrace[12];
00481         int perfect_hit, get_zeny_num;
00482         int critical_rate, hit_rate, flee_rate, flee2_rate, def_rate, def2_rate, mdef_rate, mdef2_rate;
00483         int def_ratio_atk_ele, def_ratio_atk_ele_, def_ratio_atk_race, def_ratio_atk_race_;
00484         int add_damage_class_count, add_damage_class_count_, add_magic_damage_class_count;
00485         short add_damage_classid[10], add_damage_classid_[10], add_magic_damage_classid[10];
00486         int add_damage_classrate[10], add_damage_classrate_[10], add_magic_damage_classrate[10];
00487         short add_def_class_count, add_mdef_class_count;
00488         short add_def_classid[10], add_mdef_classid[10];
00489         int add_def_classrate[10], add_mdef_classrate[10];
00490         short monster_drop_item_count;
00491         short monster_drop_itemid[10];
00492         int monster_drop_race[10], monster_drop_itemrate[10];
00493         int double_add_rate, speed_add_rate, aspd_add_rate, perfect_hit_add, get_zeny_add_num;
00494         short splash_range, splash_add_range;
00495         short hp_drain_rate, hp_drain_per, sp_drain_rate, sp_drain_per;
00496         short hp_drain_rate_, hp_drain_per_, sp_drain_rate_, sp_drain_per_;
00497         short hp_drain_value, sp_drain_value, hp_drain_value_, sp_drain_value_;
00498         int short_weapon_damage_return, long_weapon_damage_return;
00499         int weapon_coma_ele[10], weapon_coma_race[12];
00500         int break_weapon_rate, break_armor_rate;
00501         short add_steal_rate;
00502         //--- 02/15's new card effects [celest]
00503         int crit_atk_rate;
00504         int critaddrace[12];
00505         short no_regen;
00506         int addeff3[10];
00507         struct {
00508                 short id, lv, rate, type;
00509         } autospell[MAX_PC_BONUS], autospell2[MAX_PC_BONUS];
00510         int skillatk[2];
00511         unsigned short unstripable_equip;
00512         short add_damage_classid2[10], add_damage_class_count2;
00513         int add_damage_classrate2[10];
00514         short sp_gain_value, hp_gain_value;
00515         short sp_drain_type;
00516         short ignore_def_mob, ignore_def_mob_;
00517         int hp_loss_tick, hp_loss_rate;
00518         short hp_loss_value, hp_loss_type;
00519         int addrace2[6], addrace2_[6];
00520         int exp_addrace[12];
00521         short sp_gain_race[12];
00522         int subsize[3];
00523         short unequip_damage;
00524         short unequip_damage_sp;
00525         int itemid;
00526         int itemhealrate[7];
00527 
00528         short spiritball, spiritball_old;
00529         int spirit_timer[MAX_SKILL_LEVEL];
00530         int magic_damage_return;
00531         int random_attack_increase_add, random_attack_increase_per; // [Valaris]
00532         int perfect_hiding; // [Valaris]
00533         int classchange; // [Valaris]
00534 
00535         int die_counter;
00536         short doridori_counter;
00537 
00538         int jailtimer; // timer to finish jail
00539 
00540         int reg_num;
00541         struct script_reg *reg;
00542         int regstr_num;
00543         struct script_regstr *regstr;
00544 
00545         struct status_change sc_data[MAX_STATUSCHANGE];
00546         short sc_count;
00547         struct square dev;
00548 
00549         int trade_partner;
00550         int deal_item_index[10];
00551         int deal_item_amount[10];
00552         int deal_zeny;
00553         char deal_locked; // 0: no trade, 1: trade accepted, 2: trade valided (button 'Ok' pressed)
00554 
00555         int party_sended, party_invite, party_invite_account;
00556         int party_hp, party_x, party_y;
00557 
00558         int guild_sended, guild_invite, guild_invite_account;
00559         int guild_emblem_id, guild_alliance, guild_alliance_account;
00560 
00561         int friend_invite; // char_id of player that invite the player
00562 
00563         int guildspy; // [Syrus22]
00564         int partyspy; // [Syrus22]
00565 
00566         int vender_id;
00567         int vend_num;
00568         char message[81]; // 80 + NULL (shop title)
00569         struct vending vending[MAX_VENDING];
00570 
00571         int catch_target_class;
00572         struct s_pet pet;
00573         struct pet_db *petDB; // just pointer on the pet
00574         struct pet_data *pd;
00575         int pet_hungry_timer;
00576 
00577         int pvp_point, pvp_rank, pvp_timer, pvp_lastusers;
00578 
00579         char eventqueue[MAX_EVENTQUEUE][50]; // 49 + NULL
00580         int eventtimer[MAX_EVENTTIMER];
00581 
00582         int last_skillid, last_skilllv; // Added by RoVeRT
00583 
00584         unsigned char change_level; // [celest]
00585 
00586 #ifdef USE_SQL
00587         char mail_counter; // mail counter for mail system [Valaris] (from 0 to 5)
00588         char new_message_flag; // to avoid to send twice: you have new messages [Yor]
00589 #endif /* USE_SQL */
00590 };
00591 
00592 struct npc_timerevent_list {
00593         int timer, pos;
00594 };
00595 struct npc_label_list {
00596         char name[25]; // 24 + NULL
00597         int pos;
00598 };
00599 struct npc_item_list {
00600         int nameid,value;
00601 };
00602 struct npc_data {
00603         struct block_list bl;
00604         short n;
00605         short class, dir;
00606         short speed;
00607         char name[25]; // 24 + NULL
00608         char exname[25]; // 24 + NULL
00609         int chat_id;
00610         short opt1, opt2, opt3, option;
00611         short flag;
00612         int walktimer; // [Valaris]
00613         short to_x, to_y; // [Valaris]
00614         struct walkpath_data walkpath;
00615         unsigned int next_walktime;
00616         unsigned int canmove_tick;
00617 
00618         struct { // [Valaris]
00619                 unsigned state : 8;
00620                 unsigned change_walk_target : 1;
00621                 unsigned walk_easy : 1;
00622         } state;
00623 
00624         union {
00625                 struct {
00626                         unsigned char *script;
00627                         short xs, ys;
00628                         int guild_id;
00629                         int timer, timerid, timeramount, nexttimer, rid;
00630                         unsigned int timertick;
00631                         struct npc_timerevent_list *timer_event;
00632                         short label_list_num; // more than 32767... not in actual configuration
00633                         struct npc_label_list *label_list;
00634                         int src_id;
00635                 } scr;
00636                 struct npc_item_list *shop_item;
00637                 struct {
00638                         short xs, ys;
00639                         short x, y;
00640                         char name[17]; // 16 + NULL
00641                 } warp;
00642         } u;
00643         // ここにメンバを追加してはならない(shop_itemが可変長の為)
00644 
00645         char eventqueue[MAX_EVENTQUEUE][50]; // 49 + NULL
00646         int eventtimer[MAX_EVENTTIMER];
00647         short arenaflag;
00648 };
00649 struct mob_data {
00650         struct block_list bl;
00651         short n;
00652         short base_class, class, dir, mode, level;
00653         short m, x0, y0, xs, ys;
00654         char name[25]; // 24 + NULL
00655         int spawndelay1, spawndelay2;
00656         struct {
00657                 unsigned state : 8;
00658                 unsigned skillstate : 8;
00659                 unsigned aggressive : 1;
00660                 unsigned targettype : 1;
00661                 unsigned steal_flag : 1;
00662                 unsigned steal_coin_flag : 1;
00663                 unsigned skillcastcancel : 1;
00664                 unsigned master_check : 1;
00665                 unsigned change_walk_target : 1;
00666                 unsigned walk_easy : 1;
00667                 unsigned special_mob_ai : 3; // 0: nothing, 1: cannibalize, 2-3: spheremine
00668                 unsigned soul_change_flag : 1; // Celest
00669                 int provoke_flag; // Celest
00670                 unsigned alchemist: 1;
00671         } state;
00672         int timer;
00673         short to_x, to_y;
00674         short target_dir;
00675         short speed;
00676         short attacked_count;
00677         int hp;
00678         int target_id, attacked_id;
00679         short target_lv;
00680         struct walkpath_data walkpath;
00681         unsigned int next_walktime;
00682         unsigned int attackabletime;
00683         unsigned int last_deadtime, last_spawntime, last_thinktime;
00684         unsigned int canmove_tick;
00685         short move_fail_count;
00686         struct {
00687                 int id; // char_id
00688                 int dmg;
00689         } dmglog[DAMAGELOG_SIZE];
00690         struct item *lootitem;
00691         short lootitem_count;
00692 
00693         struct status_change sc_data[MAX_STATUSCHANGE];
00694         short sc_count;
00695         short opt1, opt2, opt3, option;
00696         short min_chase;
00697 
00698         int guild_id; // Guilds' gardians & emperiums, otherwize = 0
00699 
00700         int deletetimer;
00701 
00702         int skilltimer;
00703         int skilltarget;
00704         short skillx, skilly;
00705         short skillid, skilllv, skillidx;
00706         unsigned int skilldelay[MAX_MOBSKILL];
00707         int def_ele;
00708         int master_id, master_dist;
00709         int exclusion_src, exclusion_party, exclusion_guild;
00710         struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL];
00711         struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP];
00712         struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
00713         char npc_event[50];
00714         unsigned char size;
00715         int owner;
00716 };
00717 
00718 struct pet_data {
00719         struct block_list bl;
00720         short n;
00721         short class, dir;
00722         short speed;
00723         char name[25]; // 24 + NULL
00724         struct {
00725                 unsigned state : 8;
00726                 unsigned skillstate : 8;
00727                 unsigned change_walk_target : 1;
00728                 short skillbonus;
00729         } state;
00730         int timer;
00731         short to_x, to_y;
00732         short equip;
00733         struct walkpath_data walkpath;
00734         int target_id;
00735         short target_lv;
00736         int move_fail_count;
00737         unsigned int attackabletime, next_walktime, last_thinktime;
00738         int skilltype, skillval, skilltimer, skillduration; // [Valaris]
00739         int skillbonustype, skillbonusval; // [Valaris]
00740         int skillbonustimer, recoverytimer, healtimer, magtimer, skillattacktimer; // timers
00741         struct item *lootitem;
00742         short loot; // [Valaris]
00743         short lootmax; // [Valaris]
00744         short lootitem_count;
00745         short lootitem_weight;
00746         unsigned int lootitem_timer;
00747         struct skill_timerskill skilltimerskill[MAX_MOBSKILLTIMERSKILL]; // [Valaris]
00748         struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; // [Valaris]
00749         struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; // [Valaris]
00750         struct map_session_data *msd;
00751 };
00752 
00753 enum { MS_IDLE, MS_WALK, MS_ATTACK, MS_DEAD, MS_DELAY };
00754 
00755 enum { NONE_ATTACKABLE, ATTACKABLE };
00756 
00757 enum { ATK_LUCKY = 1, ATK_FLEE, ATK_DEF}; // 囲まれペナルティ計算用
00758 
00759 // For equipment breaking/stripping effects
00760 enum {
00761         EQP_WEAPON = 1, // Both weapons
00762         EQP_ARMOR  = 2, // Armor
00763         EQP_SHIELD = 4, // Shield
00764         EQP_HELM   = 8  // Top-head headgear
00765 };
00766 
00767 struct map_data {
00768         char name[17]; // 16 + NULL
00769         char *gat; // NULLなら下のmap_data_other_serverとして扱う
00770         char *alias; // [MouseJstr]
00771         struct block_list **block;
00772         struct block_list **block_mob;
00773         short m;
00774         short xs, ys;
00775         short bxs, bys;
00776         int npc_num;
00777         int users;
00778         struct {
00779                 unsigned alias : 1; // for alias name at load, not a map flag
00780                 unsigned nomemo : 1; // 0
00781                 unsigned noteleport : 1; // 1
00782                 unsigned nosave : 1; // 2
00783                 unsigned nobranch : 1; // 3 // forbid usage of Dead Branch (604), Bloody Branch (12103) and Poring Box (12109)
00784                 unsigned nopenalty : 1; // 4
00785                 unsigned nozenypenalty : 1; // 5
00786                 unsigned pvp : 1; // 6
00787                 unsigned pvp_noparty : 1; // 7
00788                 unsigned pvp_noguild : 1; // 8
00789                 unsigned gvg : 1; // 9
00790                 unsigned gvg_noparty : 1; // 10
00791                 unsigned notrade : 1; // 11
00792                 unsigned noskill : 1; // 12
00793                 unsigned nowarp : 1; // 13
00794         //      unsigned nopvp : 1; // 14 (reverse of pvp) - not a real map flag
00795                 unsigned noicewall : 1; // 15
00796                 unsigned snow : 1; // 16
00797                 unsigned fog : 1; // 17
00798                 unsigned sakura : 1; // 18
00799                 unsigned leaves : 1; // 19
00800                 unsigned rain : 1; // 20
00801                 unsigned indoors : 1; // 21
00802                 unsigned nogo : 1; // 22
00803                 unsigned nospell : 1; // 23
00804                 unsigned nowarpto : 1; // 24
00805                 unsigned noreturn : 1; // 25
00806                 unsigned monster_noteleport : 1; // 26
00807                 unsigned pvp_nocalcrank : 1; // 27
00808                 unsigned nobaseexp : 1; // 28/29
00809                 unsigned nojobexp : 1; // 28/30
00810                 unsigned nomobdrop : 1; // 31/32
00811                 unsigned nomvpdrop : 1; // 31/33
00812                 unsigned pvp_nightmaredrop :1; // 34
00813                 unsigned nogmcmd :7; // (0-100) 35 // when you use this mapflag (nogmcmd, you forbid GM commands upper than the mentionned level, included @ban, @kick, etc...)
00814                 unsigned mingmlvl :7; // (0-100) 36
00815                 unsigned guild_dungeon : 1; // 37
00816         } flag;
00817         struct point save;
00818         struct npc_data *npc[MAX_NPC_PER_MAP];
00819         struct drop_list {
00820                 int drop_id;
00821                 char drop_type; // 1-3
00822                 int drop_per;
00823         } *drop_list; // MAX_DROP_PER_MAP -> now, dynamic
00824         unsigned short drop_list_num;
00825 };
00826 
00827 struct map_data_other_server {
00828         char name[25]; // 24 + NULL
00829         char *gat; // NULL固定にして判断
00830         unsigned long ip;
00831         unsigned int port;
00832         struct map_data *map;
00833 };
00834 struct flooritem_data {
00835         struct block_list bl;
00836         short subx, suby;
00837         int cleartimer;
00838         int first_get_id, second_get_id, third_get_id;
00839         unsigned int first_get_tick, second_get_tick, third_get_tick;
00840         int owner; // who drop the item (to authorize to get item at any moment)
00841         struct item item_data;
00842 };
00843 
00844 enum {
00845         SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP,  // 0-7
00846         SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT,  // 8-15
00847         SP_INT,SP_DEX,SP_LUK,SP_CLASS,SP_ZENY,SP_SEX,SP_NEXTBASEEXP,SP_NEXTJOBEXP,      // 16-23
00848         SP_WEIGHT,SP_MAXWEIGHT,SP_1a,SP_1b,SP_1c,SP_1d,SP_1e,SP_1f,     // 24-31
00849         SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27,    // 32-39
00850         SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1,       // 40-47
00851         SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL,        // 48-55
00852         SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE,     //56-60
00853         SP_CARTINFO=99, // 99
00854 
00855         SP_BASEJOB=119, // 100+19 - celest
00856         SP_BASECLASS=120,
00857 
00858         // original 1000-
00859         SP_ATTACKRANGE=1000,    SP_ATKELE,SP_DEFELE,    // 1000-1002
00860         SP_CASTRATE, SP_MAXHPRATE, SP_MAXSPRATE, SP_SPRATE, // 1003-1006
00861         SP_ADDELE, SP_ADDRACE, SP_ADDSIZE, SP_SUBELE, SP_SUBRACE, // 1007-1011
00862         SP_ADDEFF, SP_RESEFF,   // 1012-1013
00863         SP_BASE_ATK,SP_ASPD_RATE,SP_HP_RECOV_RATE,SP_SP_RECOV_RATE,SP_SPEED_RATE, // 1014-1018
00864         SP_CRITICAL_DEF,SP_NEAR_ATK_DEF,SP_LONG_ATK_DEF, // 1019-1021
00865         SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_MATK, SP_MATK_RATE, // 1022-1025
00866         SP_IGNORE_DEF_ELE,SP_IGNORE_DEF_RACE, // 1026-1027
00867         SP_ATK_RATE,SP_SPEED_ADDRATE,SP_ASPD_ADDRATE, // 1028-1030
00868         SP_MAGIC_ATK_DEF,SP_MISC_ATK_DEF, // 1031-1032
00869         SP_IGNORE_MDEF_ELE,SP_IGNORE_MDEF_RACE, // 1033-1034
00870         SP_MAGIC_ADDELE,SP_MAGIC_ADDRACE,SP_MAGIC_SUBRACE, // 1035-1037
00871         SP_PERFECT_HIT_RATE,SP_PERFECT_HIT_ADD_RATE,SP_CRITICAL_RATE,SP_GET_ZENY_NUM,SP_ADD_GET_ZENY_NUM, // 1038-1042
00872         SP_ADD_DAMAGE_CLASS, SP_ADD_MAGIC_DAMAGE_CLASS, SP_ADD_DEF_CLASS, SP_ADD_MDEF_CLASS, // 1043-1046
00873         SP_ADD_MONSTER_DROP_ITEM, SP_DEF_RATIO_ATK_ELE, SP_DEF_RATIO_ATK_RACE, SP_ADD_SPEED, // 1047-1050
00874         SP_HIT_RATE, SP_FLEE_RATE, SP_FLEE2_RATE, SP_DEF_RATE, SP_DEF2_RATE, SP_MDEF_RATE, SP_MDEF2_RATE, // 1051-1057
00875         SP_SPLASH_RANGE, SP_SPLASH_ADD_RANGE, SP_AUTOSPELL, SP_HP_DRAIN_RATE, SP_SP_DRAIN_RATE, // 1058-1062
00876         SP_SHORT_WEAPON_DAMAGE_RETURN, SP_LONG_WEAPON_DAMAGE_RETURN, SP_WEAPON_COMA_ELE, SP_WEAPON_COMA_RACE, // 1063-1066
00877         SP_ADDEFF2, SP_BREAK_WEAPON_RATE, SP_BREAK_ARMOR_RATE, SP_ADD_STEAL_RATE, // 1067-1070
00878         SP_MAGIC_DAMAGE_RETURN, SP_RANDOM_ATTACK_INCREASE, SP_ALL_STATS, SP_AGI_VIT, SP_AGI_DEX_STR, SP_PERFECT_HIDE, // 1071-1076
00879         SP_DISGUISE, SP_CLASSCHANGE, // 1077-1078
00880         SP_HP_DRAIN_VALUE, SP_SP_DRAIN_VALUE, // 1079-1080
00881         SP_WEAPON_ATK, SP_WEAPON_ATK_RATE, // 1081-1082
00882         SP_DELAYRATE, // 1083
00883 
00884         SP_RESTART_FULL_RECORVER=2000, SP_NO_CASTCANCEL, SP_NO_SIZEFIX, SP_NO_MAGIC_DAMAGE, SP_NO_WEAPON_DAMAGE, SP_NO_GEMSTONE, // 2000-2005
00885         SP_NO_CASTCANCEL2, SP_INFINITE_ENDURE, SP_UNBREAKABLE_WEAPON, SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010
00886         SP_UNBREAKABLE_SHIELD, SP_LONG_ATK_RATE, // 2011-2012
00887 
00888         SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017
00889         SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020
00890         SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025
00891         SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE, SP_LOSESP_WHEN_UNEQUIP, SP_EXP_ADDRACE,      // 2026-2030
00892         SP_SP_GAIN_RACE // 2031
00893 };
00894 
00895 enum {
00896         LOOK_BASE,LOOK_HAIR,LOOK_WEAPON,LOOK_HEAD_BOTTOM,LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HAIR_COLOR,LOOK_CLOTHES_COLOR,LOOK_SHIELD,LOOK_SHOES
00897 };
00898 
00899 // CELL
00900 #define CELL_MASK               0x0f
00901 #define CELL_NPC                0x80    // NPCセル
00902 #define CELL_BASILICA   0x40    // BASILICAセル
00903 #define CELL_MOONLIT    0x100
00904 #define CELL_REGEN              0x200
00905 /*
00906  * map_getcell()で使用されるフラグ
00907  */
00908 typedef enum {
00909         CELL_CHKWALL = 0,   // 壁(セルタイプ1)
00910         CELL_CHKWATER,      // 水場(セルタイプ3)
00911         CELL_CHKGROUND,     // 地面障害物(セルタイプ5)
00912         CELL_CHKPASS,       // 通過可能(セルタイプ1,5以外)
00913         CELL_CHKNOPASS,     // 通過不可(セルタイプ1,5)
00914         CELL_GETTYPE,       // セルタイプを返す
00915         CELL_CHKNOPASS_NPC, // check if it is NOPASS or NPC
00916         CELL_CHKNPC=0x10,   // タッチタイプのNPC(セルタイプ0x80フラグ)
00917         CELL_CHKBASILICA    // バジリカ(セルタイプ0x40フラグ)
00918 } cell_t;
00919 // map_setcell()で使用されるフラグ
00920 enum {
00921         CELL_SETNPC=0x10,       // タッチタイプのNPCをセット
00922         CELL_SETBASILICA,       // バジリカをセット
00923         CELL_CLRBASILICA        // バジリカをクリア
00924 };
00925 
00926 struct chat_data {
00927         struct block_list bl;
00928 
00929         char pass[8];   /* password */
00930         char title[61]; /* room title MAX 60 */
00931         unsigned char limit;     /* join limit */
00932         unsigned char trigger;
00933         unsigned char users;     /* current users */
00934         unsigned char pub;       /* room attribute */
00935         struct map_session_data *usersd[20];
00936         struct block_list *owner_;
00937         struct block_list **owner;
00938         char npc_event[50];
00939 };
00940 
00941 extern struct map_data *map;
00942 extern int map_num;
00943 extern int autosave_interval;
00944 extern unsigned char agit_flag; // 0: WoE not starting, Woe is running
00945 extern unsigned char night_flag; // 0=day, 1=night [Yor]
00946 
00947 // gat関連
00948 int map_getcell(int, int, int, cell_t);
00949 int map_getcellp(struct map_data*, int, int, cell_t);
00950 void map_setcell(int, int, int, int);
00951 //extern int map_read_flag; //セル情報のソース判定フラグ、0ならgrfファイル、1ならビットマップファイル
00952 enum {
00953         READ_FROM_GAT, READ_FROM_AFM,
00954         READ_FROM_BITMAP, CREATE_BITMAP,
00955         READ_FROM_BITMAP_COMPRESSED, CREATE_BITMAP_COMPRESSED
00956 };
00957 
00958 extern char motd_txt[];
00959 extern char help_txt[];
00960 
00961 extern char talkie_mes[];
00962 
00963 extern char wisp_server_name[25]; // 24 + NULL
00964 extern int server_char_id; // char id used by server
00965 extern int server_fake_mob_id; // mob id of a invisible mod to check bots
00966 extern char npc_language[6]; // Language used by the server (for GetText and manner)
00967 extern unsigned char map_is_alone; // define communication usage of map-server if it is alone
00968 
00969 // 鯖全体情報
00970 void map_setusers(int);
00971 int map_getusers(void);
00972 // block削除関連
00973 int map_freeblock(void *bl);
00974 void map_freeblock_lock(void);
00975 void map_freeblock_unlock(void);
00976 // block関連
00977 int map_addblock(struct block_list *);
00978 int map_delblock(struct block_list *);
00979 void map_foreachinarea(int (*)(struct block_list*, va_list), int, int, int, int, int, int, ...);
00980 // -- moonsoul (added map_foreachincell)
00981 //void map_foreachincell(int (*)(struct block_list*, va_list), int, int, int, int, ...);
00982 void map_foreachinmovearea(int (*)(struct block_list*, va_list), int, int, int, int, int, int, int, int, ...);
00983 void map_foreachinpath(int (*)(struct block_list*, va_list), int, int, int, int, int, int, int, ...); // Celest
00984 /*int map_countnearpc(int, int, int);*/
00985 //block関連に追加
00986 int map_count_oncell(int m, int x, int y);
00987 struct skill_unit *map_find_skill_unit_oncell(struct block_list *, int x, int y, int skill_id, struct skill_unit *);
00988 // 一時的object関連
00989 int map_addobject(struct block_list *);
00990 int map_delobject(intptr_t);
00991 int map_delobjectnofree(intptr_t id);
00992 void map_foreachobject(int (*)(struct block_list*, va_list), int, ...);
00993 //
00994 void map_quit(struct map_session_data *);
00995 void map_quit2(struct map_session_data *); // to free memory of dynamic allocation in session (even if player is auth or not)
00996 // npc
00997 int map_addnpc(int,struct npc_data *);
00998 
00999 // 床アイテム関連
01000 TIMER_FUNC(map_clearflooritem_timer);
01001 #define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1)
01002 int map_addflooritem(struct item *,int,int,int,int,struct map_session_data *,struct map_session_data *,struct map_session_data *, int owner_id, int);
01003 int map_searchrandfreecell(int,int,int,int);
01004 
01005 // キャラid=>キャラ名 変換関連
01006 void map_addchariddb(intptr_t charid, char *name);
01007 void map_delchariddb(intptr_t charid);
01008 int map_reqchariddb(struct map_session_data * sd,intptr_t charid);
01009 char * map_charid2nick(intptr_t);
01010 
01011 struct map_session_data * map_charid2sd(int);
01012 struct map_session_data * map_id2sd(int);
01013 struct block_list * map_id2bl(intptr_t);
01014 int map_mapname2mapid(const char*); // map id on this server (m == -1 if not in actual map-server)
01015 int map_mapname2ipport(const char*, int*, int*);
01016 short map_checkmapname(const char *mapname);
01017 int map_setipport(char *name, unsigned long ip, int port);
01018 int map_eraseipport(char *name, unsigned long ip, int port);
01019 int map_eraseallipport(void);
01020 void map_addiddb(struct block_list *);
01021 void map_deliddb(struct block_list *bl);
01022 void map_foreachiddb(int (*)(void*, void*, va_list), ...);
01023 //void map_addnickdb(struct map_session_data *);
01024 struct map_session_data * map_nick2sd(char*);
01025 
01026 // その他
01027 int map_check_dir(int s_dir, int t_dir);
01028 int map_calc_dir(struct block_list *src, int x, int y);
01029 
01030 // path.cより
01031 int path_search(struct walkpath_data*, int, int, int, int, int, int);
01032 int path_search_long(int m, int x0, int y_0, int x1, int y_1);
01033 int path_blownpos(int m, int x0, int y_0, int dx, int dy, int count);
01034 
01035 int map_who(int fd);
01036 
01037 void map_helpscreen(); // [Valaris]
01038 
01039 extern char item_db_db[32]; // need in TXT too to generate SQL DB script (not change the default name in this case)
01040 extern char mob_db_db[32]; // need in TXT too to generate SQL DB script (not change the default name in this case)
01041 
01042 extern char create_item_db_script; // generate a script file to create SQL item_db (0: no, 1: yes)
01043 extern char create_mob_db_script; // generate a script file to create SQL mob_db (0: no, 1: yes)
01044 
01045 #ifdef USE_SQL
01046 
01047 // MySQL
01048 #include "nezumi_sql.h"
01049 
01050 extern int db_use_sqldbs;
01051 
01052 extern char char_db[32]; // need for mail.c
01053 
01054 extern unsigned char optimize_table; // optimize mob/item SQL db
01055 
01056 #endif /* USE_MYSQL */
01057 
01062 #endif // OA_MAP_H
01063 

Generated on Fri Apr 28 10:20:05 2006 for OpenAthena by  doxygen 1.4.4