diff options
Diffstat (limited to 'src/map/map.h')
-rw-r--r-- | src/map/map.h | 196 |
1 files changed, 162 insertions, 34 deletions
diff --git a/src/map/map.h b/src/map/map.h index bf443bf46..01d9fef0e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -10,7 +10,7 @@ #define PC_CLASS_BASE2 (PC_CLASS_BASE + 4001) #define PC_CLASS_BASE3 (PC_CLASS_BASE2 + 22) #define MAX_NPC_PER_MAP 512 -#define BLOCK_SIZE 8 +#define BLOCK_SIZE 8 // Never zero #define AREA_SIZE battle_config.area_size #define LOCAL_REG_NUM 16 #define LIFETIME_FLOORITEM 60 @@ -20,7 +20,7 @@ #define MAX_STATUSCHANGE 210 #define MAX_SKILLUNITGROUP 32 #define MAX_MOBSKILLUNITGROUP 8 -#define MAX_SKILLUNITGROUPTICKSET 128 +#define MAX_SKILLUNITGROUPTICKSET 32 #define MAX_SKILLTIMERSKILL 32 #define MAX_MOBSKILLTIMERSKILL 10 #define MAX_MOBSKILL 32 @@ -32,6 +32,7 @@ #define MAX_WALKPATH 32 #define MAX_DROP_PER_MAP 48 #define MAX_IGNORE_LIST 80 +#define MAX_VENDING 12 #define DEFAULT_AUTOSAVE_INTERVAL 60*1000 @@ -52,6 +53,12 @@ struct walkpath_data { unsigned char path_len,path_pos,path_half; unsigned char path[MAX_WALKPATH]; }; +struct shootpath_data { + int rx,ry,len; + int x[MAX_WALKPATH]; + int y[MAX_WALKPATH]; +}; + struct script_reg { int index; int data; @@ -84,13 +91,13 @@ struct skill_unit_group { int src_id; int party_id; int guild_id; - int map,range; + int map; int target_flag; unsigned int tick; int limit,interval; int skill_id,skill_lv; - int val1,val2; + int val1,val2,val3; char *valstr; int unit_id; int group_id; @@ -99,7 +106,7 @@ struct skill_unit_group { }; struct skill_unit_group_tickset { unsigned int tick; - int group_id; + int id; }; struct skill_timerskill { int timer; @@ -137,6 +144,12 @@ struct map_session_data { unsigned make_arrow_flag : 1; unsigned potionpitcher_flag : 1; unsigned storage_flag : 1; + unsigned snovice_flag : 4; + int gmaster_flag; + // originally by Qamera, adapted by celest + unsigned event_death : 1; + unsigned event_kill : 1; + unsigned event_disconnect : 1; } state; struct { unsigned killer : 1; @@ -149,15 +162,14 @@ struct map_session_data { unsigned no_weapon_damage : 1; unsigned no_gemstone : 1; unsigned infinite_endure : 1; - unsigned unbreakable_weapon : 1; - unsigned unbreakable_armor : 1; - unsigned infinite_autospell : 1; } special_state; int char_id, login_id1, login_id2, sex; int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) struct mmo_charstatus status; struct item_data *inventory_data[MAX_INVENTORY]; short equip_index[11]; + unsigned short unbreakable_equip; + unsigned short unbreakable; // chance to prevent equipment breaking [celest] int weight,max_weight; int cart_weight,cart_max_weight,cart_num,cart_max_num; char mapname[24]; @@ -169,6 +181,7 @@ struct map_session_data { unsigned int client_tick,server_tick; struct walkpath_data walkpath; int walktimer; + int next_walktime; int npc_id,areanpc_id,npc_shopid; int npc_pos; int npc_menu; @@ -178,6 +191,7 @@ struct map_session_data { char *npc_stackbuf; char npc_str[256]; unsigned int chatID; + unsigned long idletime; struct{ char name[24]; @@ -192,6 +206,8 @@ struct map_session_data { int followtimer; // [MouseJstr] int followtarget; + time_t emotionlasttime; // to limit flood with emotion packets + short attackrange,attackrange_; int skilltimer; int skilltarget; @@ -203,17 +219,21 @@ struct map_session_data { struct skill_unit_group skillunit[MAX_SKILLUNITGROUP]; struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; struct skill_timerskill skilltimerskill[MAX_SKILLTIMERSKILL]; - int cloneskill_id,cloneskill_lv; + char blockskill[MAX_SKILL]; // [celest] + //unsigned int skillstatictimer[MAX_SKILL]; + unsigned short timerskill_count; // [celest] + int cloneskill_id; int potion_hp,potion_sp,potion_per_hp,potion_per_sp; int invincible_timer; unsigned int canact_tick; unsigned int canmove_tick; unsigned int canlog_tick; + unsigned int canregen_tick; int hp_sub,sp_sub; int inchealhptick,inchealsptick,inchealspirithptick,inchealspiritsptick; // -- moonsoul (new tick for berserk self-damage) - int berserkdamagetick; +// int berserkdamagetick; int fame; short view_class; @@ -224,12 +244,13 @@ struct map_session_data { int watk,watk2,atkmods[3]; int def,def2,mdef,mdef2,critical,matk1,matk2; int atk_ele,def_ele,star,overrefine; - int castrate,hprate,sprate,dsprate; + int castrate,delayrate,hprate,sprate,dsprate; int addele[10],addrace[12],addsize[3],subele[10],subrace[12]; int addeff[10],addeff2[10],reseff[10]; int watk_,watk_2,atkmods_[3],addele_[10],addrace_[12],addsize_[3]; //二刀流のために追加 int atk_ele_,star_,overrefine_; //二刀流のために追加 int base_atk,atk_rate; + int weapon_atk[16],weapon_atk_rate[16]; int arrow_atk,arrow_ele,arrow_cri,arrow_hit,arrow_range; int arrow_addele[10],arrow_addrace[12],arrow_addsize[3],arrow_addeff[10],arrow_addeff2[10]; int nhealhp,nhealsp,nshealhp,nshealsp,nsshealhp,nsshealsp; @@ -258,18 +279,42 @@ struct map_session_data { short hp_drain_value,sp_drain_value,hp_drain_value_,sp_drain_value_; int short_weapon_damage_return,long_weapon_damage_return; int weapon_coma_ele[10],weapon_coma_race[12]; - short break_weapon_rate,break_armor_rate; + int break_weapon_rate,break_armor_rate; short add_steal_rate; + //--- 02/15's new card effects [celest] + int crit_atk_rate; + int critaddrace[12]; + short no_regen; + int addeff3[10]; + short addeff3_type[10]; + short autospell2_id,autospell2_lv,autospell2_rate,autospell2_type; + int skillatk[2]; + unsigned short unstripable_equip; + short add_damage_classid2[10],add_damage_class_count2; + int add_damage_classrate2[10]; + short sp_gain_value, hp_gain_value; + short sp_drain_type; + short ignore_def_mob, ignore_def_mob_; + int hp_loss_tick, hp_loss_rate; + short hp_loss_value, hp_loss_type; + int addrace2[12],addrace2_[12]; + int subsize[3]; + short unequip_losehp[11]; + short unequip_losesp[11]; + int itemid; + int itemhealrate[7]; + //--- 03/15's new card effects + int expaddrace[12]; + int subrace2[12]; + short sp_gain_race[12]; short spiritball, spiritball_old; int spirit_timer[MAX_SKILL_LEVEL]; int magic_damage_return; // AppleGirl Was Here int random_attack_increase_add,random_attack_increase_per; // [Valaris] int perfect_hiding; // [Valaris] - int unbreakable; int classchange; // [Valaris] - int die_counter; short doridori_counter; @@ -299,7 +344,7 @@ struct map_session_data { int vender_id; int vend_num; char message[80]; - struct vending vending[12]; + struct vending vending[MAX_VENDING]; int catch_target_class; struct s_pet pet; @@ -311,11 +356,15 @@ struct map_session_data { char eventqueue[MAX_EVENTQUEUE][50]; int eventtimer[MAX_EVENTTIMER]; + unsigned short eventcount; // [celest] int last_skillid,last_skilllv; // Added by RoVeRT - short sg_count; unsigned char change_level; // [celest] + int autoloot; //by Upa-Kun + unsigned nodelay :1; + unsigned noexp :1; + unsigned detach :1; #ifndef TXT_ONLY int mail_counter; // mail counter for mail system [Valaris] @@ -336,7 +385,7 @@ struct npc_item_list { struct npc_data { struct block_list bl; short n; - short class,dir; + short class_,dir; short speed; char name[24]; char exname[24]; @@ -360,7 +409,7 @@ struct npc_data { char *script; short xs,ys; int guild_id; - int timer,timerid,timeramount,nexttimer; + int timer,timerid,timeramount,nexttimer,rid; unsigned int timertick; struct npc_timerevent_list *timer_event; int label_list_num; @@ -379,11 +428,13 @@ struct npc_data { char eventqueue[MAX_EVENTQUEUE][50]; int eventtimer[MAX_EVENTTIMER]; short arenaflag; + + void *chatdb; }; struct mob_data { struct block_list bl; short n; - short base_class,class,dir,mode,level; + short base_class,class_,dir,mode,level; short m,x0,y0,xs,ys; char name[24]; int spawndelay1,spawndelay2; @@ -398,9 +449,12 @@ struct mob_data { unsigned change_walk_target : 1; unsigned walk_easy : 1; unsigned special_mob_ai : 3; + unsigned soul_change_flag : 1; // Celest + int provoke_flag; // Celest } state; int timer; short to_x,to_y; + short target_dir; short speed; int hp; int target_id,attacked_id; @@ -422,7 +476,6 @@ struct mob_data { short sc_count; short opt1,opt2,opt3,option; short min_chase; - short sg_count; int guild_id; int deletetimer; @@ -438,18 +491,22 @@ struct mob_data { struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; char npc_event[50]; - short size; + unsigned char size; + short recall_flag; + int recallmob_count; + short recallcount; }; struct pet_data { struct block_list bl; short n; - short class,dir; + short class_,dir; short speed; char name[24]; struct { unsigned state : 8 ; unsigned skillstate : 8 ; unsigned change_walk_target : 1 ; + short skillbonus; } state; int timer; short to_x,to_y; @@ -460,7 +517,8 @@ struct pet_data { int move_fail_count; unsigned int attackabletime,next_walktime,last_thinktime; int skilltype,skillval,skilltimer,skillduration; // [Valaris] - int skillbonustype,skillbonusval,skillbonustimer,skillbonusduration; // [Valaris] + //int skillbonustype,skillbonusval,skillbonustimer,skillbonusduration; // [Valaris] + int skillbonustype,skillbonusval,skillbonustimer; struct item *lootitem; short loot; // [Valaris] short lootmax; // [Valaris] @@ -479,10 +537,18 @@ enum { NONE_ATTACKABLE,ATTACKABLE }; enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // 囲まれペナルティ計算用 +// 装備コード +enum { + EQP_WEAPON = 0x0002, // 右手 + EQP_ARMOR = 0x0010, // 体 + EQP_SHIELD = 0x0020, // 左手 + EQP_HELM = 0x0100, // 頭上段 +}; + struct map_data { char name[24]; - char alias[24]; // [MouseJstr] unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う + char *alias; // [MouseJstr] struct block_list **block; struct block_list **block_mob; int *block_count,*block_mob_count; @@ -535,9 +601,8 @@ struct map_data_other_server { unsigned char *gat; // NULL固定にして判断 unsigned long ip; unsigned int port; + struct map_data* map; }; -#define read_gat(m,x,y) (map[m].gat[(x)+(y)*map[m].xs]) -#define read_gatp(m,x,y) (m->gat[(x)+(y)*m->xs]) struct flooritem_data { struct block_list bl; @@ -556,7 +621,7 @@ enum { SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_26,SP_27, // 32-39 SP_28,SP_ATK1,SP_ATK2,SP_MATK1,SP_MATK2,SP_DEF1,SP_DEF2,SP_MDEF1, // 40-47 SP_MDEF2,SP_HIT,SP_FLEE1,SP_FLEE2,SP_CRITICAL,SP_ASPD,SP_36,SP_JOBLEVEL, // 48-55 - SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-58 + SP_UPPER,SP_PARTNER,SP_CART,SP_FAME,SP_UNBREAKABLE, //56-60 SP_CARTINFO=99, // 99 SP_BASEJOB=119, // 100+19 - celest @@ -584,15 +649,51 @@ enum { SP_MAGIC_DAMAGE_RETURN,SP_RANDOM_ATTACK_INCREASE,SP_ALL_STATS,SP_AGI_VIT,SP_AGI_DEX_STR,SP_PERFECT_HIDE, // 1071-1076 SP_DISGUISE,SP_CLASSCHANGE, // 1077-1078 SP_HP_DRAIN_VALUE,SP_SP_DRAIN_VALUE, // 1079-1080 - + SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082 + SP_DELAYRATE, // 1083 + SP_RESTART_FULL_RECORVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 - SP_NO_CASTCANCEL2,SP_INFINITE_ENDURE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR // 2006-2009 + SP_NO_CASTCANCEL2,SP_INFINITE_ENDURE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 + SP_UNBREAKABLE_SHIELD, SP_LONG_ATK_RATE, // 2011-2012 + + SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 + SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020 + SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 + SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE, SP_LOSESP_WHEN_UNEQUIP, SP_EXP_ADDRACE, // 2026-2030 + SP_SP_GAIN_RACE, SP_SUBRACE2, SP_ADDEFF_WHENHIT_SHORT, // 2031-2033 + SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD // 2034-2037 }; enum { 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 }; +// CELL +#define CELL_MASK 0x0f +#define CELL_NPC 0x80 // NPCセル +#define CELL_BASILICA 0x40 // BASILICAセル +#define CELL_MOONLIT 0x100 +#define CELL_REGEN 0x200 +/* + * map_getcell()で使用されるフラグ + */ +typedef enum { + CELL_CHKWALL=0, // 壁(セルタイプ1) + CELL_CHKWATER, // 水場(セルタイプ3) + CELL_CHKGROUND, // 地面障害物(セルタイプ5) + CELL_CHKPASS, // 通過可能(セルタイプ1,5以外) + CELL_CHKNOPASS, // 通過不可(セルタイプ1,5) + CELL_GETTYPE, // セルタイプを返す + CELL_CHKNPC=0x10, // タッチタイプのNPC(セルタイプ0x80フラグ) + CELL_CHKBASILICA, // バジリカ(セルタイプ0x40フラグ) +} cell_t; +// map_setcell()で使用されるフラグ +enum { + CELL_SETNPC=0x10, // タッチタイプのNPCをセット + CELL_SETBASILICA, // バジリカをセット + CELL_CLRBASILICA, // バジリカをクリア +}; + struct chat_data { struct block_list bl; @@ -614,6 +715,17 @@ extern int autosave_interval; extern int agit_flag; extern int night_flag; // 0=day, 1=night [Yor] +// gat?ヨァ +int map_getcell(int,int,int,cell_t); +int map_getcellp(struct map_data*,int,int,cell_t); +void map_setcell(int,int,int,int); +extern int map_read_flag; // 0: grfォユォ。ォ、ォ 1: ォュォ罩テォキォ 2: ォュォ罩テォキォ(?) +enum { + READ_FROM_GAT, READ_FROM_AFM, + READ_FROM_BITMAP, CREATE_BITMAP, + READ_FROM_BITMAP_COMPRESSED, CREATE_BITMAP_COMPRESSED +}; + extern char motd_txt[]; extern char help_txt[]; @@ -635,9 +747,11 @@ void map_foreachinarea(int (*)(struct block_list*,va_list),int,int,int,int,int,i // -- moonsoul (added map_foreachincell) void map_foreachincell(int (*)(struct block_list*,va_list),int,int,int,int,...); void map_foreachinmovearea(int (*)(struct block_list*,va_list),int,int,int,int,int,int,int,int,...); +void map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y0,int x1,int y1,int range,int type,...); // Celest int map_countnearpc(int,int,int); //block関連に追加 int map_count_oncell(int m,int x,int y); +struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int x,int y,int skill_id,struct skill_unit *); // 一時的object関連 int map_addobject(struct block_list *); int map_delobject(int); @@ -659,6 +773,7 @@ void map_addchariddb(int charid,char *name); void map_delchariddb(int charid); int map_reqchariddb(struct map_session_data * sd,int charid); char * map_charid2nick(int); +struct map_session_data * map_charid2sd(int); struct map_session_data * map_id2sd(int); struct block_list * map_id2bl(int); @@ -666,15 +781,13 @@ int map_mapname2mapid(char*); int map_mapname2ipport(char*,int*,int*); int map_setipport(char *name,unsigned long ip,int port); int map_eraseipport(char *name,unsigned long ip,int port); +int map_eraseallipport(void); void map_addiddb(struct block_list *); void map_deliddb(struct block_list *bl); int map_foreachiddb(int (*)(void*,void*,va_list),...); void map_addnickdb(struct map_session_data *); struct map_session_data * map_nick2sd(char*); - -// gat関連 -int map_getcell(int,int,int); -int map_setcell(int,int,int,int); +int compare_item(struct item *a, struct item *b); // その他 int map_check_dir(int s_dir,int t_dir); @@ -682,18 +795,33 @@ int map_calc_dir( struct block_list *src,int x,int y); // path.cより int path_search(struct walkpath_data*,int,int,int,int,int,int); +int path_search_long(struct shootpath_data *,int,int,int,int,int); int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); int map_who(int fd); +int cleanup_sub(struct block_list *bl, va_list ap); + void map_helpscreen(); // [Valaris] int map_delmap(char *mapname); -extern unsigned long ticks; +extern char *INTER_CONF_NAME; +extern char *LOG_CONF_NAME; +extern char *MAP_CONF_NAME; +extern char *BATTLE_CONF_FILENAME; +extern char *ATCOMMAND_CONF_FILENAME; +extern char *CHARCOMMAND_CONF_FILENAME; +extern char *SCRIPT_CONF_NAME; +extern char *MSG_CONF_NAME; +extern char *GRF_PATH_FILENAME; #ifndef TXT_ONLY // MySQL +#ifdef __WIN32 +#include <my_global.h> +#include <my_sys.h> +#endif #include <mysql.h> void char_online_check(void); // [Valaris] |