diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-24 21:20:48 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-24 21:20:48 +0000 |
commit | 3731a2ee949a424941f46a653525fcd4bfca0e3f (patch) | |
tree | ac45f75a34541d2cd66f785881b9259f82e77fcf /src/map | |
parent | 947c9789ff8c6dd1c7c5c615f102fbd761dcbaf9 (diff) | |
download | hercules-3731a2ee949a424941f46a653525fcd4bfca0e3f.tar.gz hercules-3731a2ee949a424941f46a653525fcd4bfca0e3f.tar.bz2 hercules-3731a2ee949a424941f46a653525fcd4bfca0e3f.tar.xz hercules-3731a2ee949a424941f46a653525fcd4bfca0e3f.zip |
* Reorganized the contents of the mapserver's header files.
- map.h is no longer a generic dumping spot of all the shared structs, and instead, each such structure now resides in its logical component
- map.h now only holds mostly map-related things (needs more cleaning)
- there's still a lot of room for improvement (reorganization within individual header files, etc...)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12429 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 1 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/chat.h | 17 | ||||
-rw-r--r-- | src/map/chrif.c | 1 | ||||
-rw-r--r-- | src/map/guild.h | 12 | ||||
-rw-r--r-- | src/map/irc.c | 1 | ||||
-rw-r--r-- | src/map/log.c | 6 | ||||
-rw-r--r-- | src/map/map.h | 784 | ||||
-rw-r--r-- | src/map/mercenary.h | 21 | ||||
-rw-r--r-- | src/map/mob.c | 1 | ||||
-rw-r--r-- | src/map/mob.h | 66 | ||||
-rw-r--r-- | src/map/npc.h | 57 | ||||
-rw-r--r-- | src/map/npc_chat.c | 4 | ||||
-rw-r--r-- | src/map/party.h | 22 | ||||
-rw-r--r-- | src/map/path.h | 15 | ||||
-rw-r--r-- | src/map/pc.h | 336 | ||||
-rw-r--r-- | src/map/pet.h | 61 | ||||
-rw-r--r-- | src/map/script.h | 10 | ||||
-rw-r--r-- | src/map/skill.h | 73 | ||||
-rw-r--r-- | src/map/status.h | 102 | ||||
-rw-r--r-- | src/map/unit.h | 50 | ||||
-rw-r--r-- | src/map/vending.h | 6 |
22 files changed, 845 insertions, 802 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 73b0a2feb..233376655 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -14,6 +14,7 @@ #include "atcommand.h" #include "battle.h" +#include "chat.h" #include "clif.h" #include "chrif.h" #include "intif.h" diff --git a/src/map/battle.c b/src/map/battle.c index c43b9be96..6a60ea0a9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -15,6 +15,7 @@ #include "pc.h" #include "status.h" #include "skill.h" +#include "mercenary.h" #include "mob.h" #include "itemdb.h" #include "clif.h" diff --git a/src/map/chat.h b/src/map/chat.h index d7bfb3f50..569e6cbe8 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -4,10 +4,25 @@ #ifndef _CHAT_H_ #define _CHAT_H_ -//#include "map.h" +#include "map.h" // struct block_list, CHATROOM_TITLE_SIZE struct map_session_data; struct chat_data; + +struct chat_data { + struct block_list bl; // data for this map object + char title[CHATROOM_TITLE_SIZE]; // room title + char pass[CHATROOM_PASS_SIZE]; // password + bool pub; // private/public flag + uint8 users; // current user count + uint8 limit; // join limit + uint8 trigger; // number of users needed to trigger event + struct map_session_data* usersd[20]; + struct block_list* owner; + char npc_event[50]; +}; + + int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub); int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass); int chat_leavechat(struct map_session_data* sd, bool kicked); diff --git a/src/map/chrif.c b/src/map/chrif.c index b923b427e..7194819cf 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -16,6 +16,7 @@ #include "intif.h" #include "npc.h" #include "pc.h" +#include "pet.h" #include "status.h" #include "mercenary.h" #include "chrif.h" diff --git a/src/map/guild.h b/src/map/guild.h index 1035818d9..e6383a3e3 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -9,10 +9,20 @@ struct guild; struct guild_member; struct guild_position; struct guild_castle; -//#include "map.h" +#include "map.h" // NAME_LENGTH struct map_session_data; struct mob_data; +//For quick linking to a guardian's info. [Skotlex] +struct guardian_data { + int number; //0-MAX_GUARDIANS-1 = Guardians. MAX_GUARDIANS = Emperium. + int guild_id; + int emblem_id; + int guardup_lv; //Level of GD_GUARDUP skill. + char guild_name[NAME_LENGTH]; + struct guild_castle* castle; +}; + int guild_skill_get_max(int id); int guild_checkskill(struct guild *g,int id); diff --git a/src/map/irc.c b/src/map/irc.c index 00afe8353..8973dd61f 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -13,6 +13,7 @@ #include "../common/nullpo.h" #include "map.h" +#include "mob.h" #include "pc.h" #include "intif.h" //For GM Broadcast #include "irc.h" diff --git a/src/map/log.c b/src/map/log.c index bd5079a40..0483b6387 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -4,10 +4,12 @@ #include "../common/strlib.h" #include "../common/nullpo.h" #include "../common/showmsg.h" +#include "battle.h" #include "itemdb.h" -#include "map.h" #include "log.h" -#include "battle.h" +#include "map.h" +#include "mob.h" +#include "pc.h" #include <stdlib.h> #include <stdio.h> diff --git a/src/map/map.h b/src/map/map.h index 11e7a3731..bf168b20c 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -11,11 +11,11 @@ #include "../common/mapindex.h" #include "../common/db.h" -#include "itemdb.h" // MAX_ITEMGROUP -#include "status.h" // SC_MAX - #include <stdarg.h> +struct npc_data; +struct item_data; + //Uncomment to enable the Cell Stack Limit mod. //It's only config is the battle_config cell_stack_limit. //Only chars affected are those defined in BL_CHAR (mobs and players currently) @@ -33,10 +33,6 @@ #define AREA_SIZE battle_config.area_size #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 -#define MAX_SKILL_LEVEL 100 -#define MAX_SKILLUNITGROUP 25 -#define MAX_SKILLUNITGROUPTICKSET 25 -#define MAX_SKILLTIMERSKILL 15 #define MAX_MOBSKILL 40 #define MAX_MOB_LIST_PER_MAP 128 #define MAX_EVENTQUEUE 2 @@ -44,7 +40,6 @@ #define NATURAL_HEAL_INTERVAL 500 #define MAX_FLOORITEM 500000 #define MAX_LEVEL 99 -#define MAX_WALKPATH 32 #define MAX_DROP_PER_MAP 48 #define MAX_IGNORE_LIST 20 // official is 14 #define MAX_VENDING 12 @@ -52,9 +47,6 @@ #define MOBID_BARRICADEB 1905 #define MOBID_BARRICADEA 1906 // Undestruble -#define MAX_PC_BONUS 10 -#define MAX_DUEL 1024 - //The following system marks a different job ID system used by the map server, //which makes a lot more sense than the normal one. [Skotlex] // @@ -236,630 +228,6 @@ struct block_list { enum bl_type type; }; -struct walkpath_data { - unsigned char path_len,path_pos; - unsigned char path[MAX_WALKPATH]; -}; -struct shootpath_data { - int rx,ry,len; - int x[MAX_WALKPATH]; - int y[MAX_WALKPATH]; -}; - -struct skill_timerskill { - int timer; - int src_id; - int target_id; - int map; - short x,y; - short skill_id,skill_lv; - int type; // a BF_ type (NOTE: some places use this as general-purpose storage...) - int flag; -}; - -struct skill_unit_group; -struct skill_unit { - struct block_list bl; - - struct skill_unit_group *group; - - int limit; - int val1,val2; - short alive,range; -}; - -struct skill_unit_group { - int src_id; - int party_id; - int guild_id; - int map; - int target_flag; //Holds BCT_* flag for battle_check_target - int bl_flag; //Holds BL_* flag for map_foreachin* functions - unsigned int tick; - int limit,interval; - - short skill_id,skill_lv; - int val1,val2,val3; - char *valstr; - int unit_id; - int group_id; - int unit_count,alive_count; - struct skill_unit *unit; - struct { - unsigned ammo_consume : 1; - unsigned magic_power : 1; - unsigned song_dance : 2; //0x1 Song/Dance, 0x2 Ensemble - } state; -}; -struct skill_unit_group_tickset { - unsigned int tick; - int id; -}; - -struct unit_data { - struct block_list *bl; - struct walkpath_data walkpath; - struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL]; - struct skill_unit_group *skillunit[MAX_SKILLUNITGROUP]; - struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; - short attacktarget_lv; - short to_x,to_y; - short skillx,skilly; - short skillid,skilllv; - int skilltarget; - int skilltimer; - int target; - int attacktimer; - int walktimer; - int chaserange; - unsigned int attackabletime; - unsigned int canact_tick; - unsigned int canmove_tick; - uint8 dir; - unsigned char walk_count; - struct { - unsigned change_walk_target : 1 ; - unsigned skillcastcancel : 1 ; - unsigned attack_continue : 1 ; - unsigned walk_easy : 1 ; - unsigned running : 1; - unsigned speed_changed : 1; - } state; -}; - -//Basic damage info of a weapon -//Required because players have two of these, one in status_data and another -//for their left hand weapon. -struct weapon_atk { - unsigned short atk, atk2; - unsigned short range; - unsigned char ele; -}; - -//For holding basic status (which can be modified by status changes) -struct status_data { - unsigned int - hp, sp, - max_hp, max_sp; - unsigned short - str, agi, vit, int_, dex, luk, - batk, - matk_min, matk_max, - speed, - amotion, adelay, dmotion, - mode; - short - hit, flee, cri, flee2, - def2, mdef2, - aspd_rate; - unsigned char - def_ele, ele_lv, - size, race; - signed char - def, mdef; - struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon. -}; - -struct script_reg { - int index; - int data; -}; -struct script_regstr { - int index; - char* data; -}; - -struct status_change_entry { - int timer; - int val1,val2,val3,val4; -}; - -struct status_change { - unsigned int option;// effect state (bitfield) - unsigned int opt3;// skill state (bitfield) - unsigned short opt1;// body state - unsigned short opt2;// health state (bitfield) - unsigned char count; - //TODO: See if it is possible to implement the following SC's without requiring extra parameters while the SC is inactive. - unsigned char jb_flag; //Joint Beat type flag - unsigned short mp_matk_min, mp_matk_max; //Previous matk min/max for ground spells (Amplify magic power) - int sg_id; //ID of the previous Storm gust that hit you - unsigned char sg_counter; //Storm gust counter (previous hits from storm gust) - struct status_change_entry *data[SC_MAX]; -}; - -struct s_vending { - short index; - short amount; - unsigned int value; -}; - -struct weapon_data { - int atkmods[3]; - // all the variables except atkmods get zero'ed in each call of status_calc_pc - // NOTE: if you want to add a non-zeroed variable, you need to update the memset call - // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex] - int overrefine; - int star; - int ignore_def_ele; - int ignore_def_race; - int def_ratio_atk_ele; - int def_ratio_atk_race; - int addele[ELE_MAX]; - int addrace[RC_MAX]; - int addrace2[RC_MAX]; - int addsize[3]; - - struct drain_data { - short rate; - short per; - short value; - unsigned type:1; - } hp_drain[RC_MAX], sp_drain[RC_MAX]; - - struct { - short class_, rate; - } add_dmg[MAX_PC_BONUS]; -}; - -struct view_data { - unsigned short - class_, - weapon, - shield, //Or left-hand weapon. - head_top, - head_mid, - head_bottom, - hair_style, - hair_color, - cloth_color; - char sex; - unsigned dead_sit : 2; -}; - -//Additional regen data that only players have. -struct regen_data_sub { - unsigned short - hp,sp; - - //tick accumulation before healing. - struct { - unsigned int hp,sp; - } tick; - - //Regen rates (where every 1 means +100% regen) - struct { - unsigned char hp,sp; - } rate; -}; - -struct regen_data { - - unsigned short flag; //Marks what stuff you may heal or not. - unsigned short - hp,sp,shp,ssp; - - //tick accumulation before healing. - struct { - unsigned int hp,sp,shp,ssp; - } tick; - - //Regen rates (where every 1 means +100% regen) - struct { - unsigned char - hp,sp,shp,ssp; - } rate; - - struct { - unsigned walk:1; //Can you regen even when walking? - unsigned gc:1; //Tags when you should have double regen due to GVG castle - unsigned overweight :2; //overweight state (1: 50%, 2: 90%) - unsigned block :2; //Block regen flag (1: Hp, 2: Sp) - } state; - - //skill-regen, sitting-skill-regen (since not all chars with regen need it) - struct regen_data_sub *sregen, *ssregen; -}; - -struct party_member_data { - struct map_session_data *sd; - unsigned int hp; //For HP,x,y refreshing. - unsigned short x, y; -}; - -struct party_data { - struct party party; - struct party_member_data data[MAX_PARTY]; - uint8 itemc; //For item distribution, position of last picker in party - struct { - unsigned monk : 1; //There's at least one monk in party? - unsigned sg : 1; //There's at least one Star Gladiator in party? - unsigned snovice :1; //There's a Super Novice - unsigned tk : 1; //There's a taekwon - } state; -}; - -struct npc_data; -struct pet_db; -struct homunculus_db; //[orn] -struct item_data; -struct square; - -struct map_session_data { - struct block_list bl; - struct unit_data ud; - struct view_data vd; - struct status_data base_status, battle_status; - struct status_change sc; - struct regen_data regen; - struct regen_data_sub sregen, ssregen; - //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in - //status_calc_pc, while special_state is recalculated in each call. [Skotlex] - struct { - unsigned active : 1; //Marks active player (not active is logging in/out, or changing map servers) - unsigned menu_or_input : 1;// if a script is waiting for feedback from the player - unsigned dead_sit : 2; - unsigned lr_flag : 2; - unsigned connect_new : 1; - unsigned arrow_atk : 1; - unsigned skill_flag : 1; - unsigned gangsterparadise : 1; - unsigned rest : 1; - unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] - unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3) - unsigned snovice_dead_flag : 2; //Explosion spirits on death: 0 off, 1 active, 2 used. - unsigned abra_flag : 1; // Abracadabra bugfix by Aru - unsigned autotrade : 1; //By Fantik - unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet) - unsigned showdelay :1; - unsigned showexp :1; - unsigned showzeny :1; - unsigned mainchat :1; //[LuzZza] - unsigned noask :1; // [LuzZza] - unsigned trading :1; //[Skotlex] is 1 only after a trade has started. - unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE - unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] - unsigned size :2; // for tiny/large types - unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] - unsigned blockedmove :1; - unsigned using_fake_npc :1; - unsigned rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] - unsigned killer : 1; - unsigned killable : 1; - unsigned doridori : 1; - unsigned ignoreAll : 1; - unsigned short autoloot; - unsigned short autolootid; // [Zephyrus] - unsigned noks : 3; // [Zeph Kill Steal Protection] - bool changemap; - struct guild *gmaster_flag; - } state; - struct { - unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; - unsigned restart_full_recover : 1; - unsigned no_castcancel : 1; - unsigned no_castcancel2 : 1; - unsigned no_sizefix : 1; - unsigned no_gemstone : 1; - unsigned intravision : 1; // Maya Purple Card effect [DracoRPG] - unsigned perfect_hiding : 1; // [Valaris] - unsigned no_knockback : 1; - unsigned bonus_coma : 1; - } special_state; - int login_id1, login_id2; - unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] - - int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18 - struct mmo_charstatus status; - struct registry save_reg; - - struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) - short equip_index[11]; - unsigned int weight,max_weight; - int cart_weight,cart_num; - int fd; - unsigned short mapindex; - unsigned short prev_speed,prev_adelay; - unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left. - unsigned int client_tick; - int npc_id,areanpc_id,npc_shopid; - int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse) - int npc_menu; - int npc_amount; - struct script_state *st; - char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine - int npc_timer_id; //For player attached npc timers. [Skotlex] - unsigned int chatID; - time_t idletime; - - struct{ - char name[NAME_LENGTH]; - } ignore[MAX_IGNORE_LIST]; - - int followtimer; // [MouseJstr] - int followtarget; - - time_t emotionlasttime; // to limit flood with emotion packets - - short skillitem,skillitemlv; - short skillid_old,skilllv_old; - short skillid_dance,skilllv_dance; - char blockskill[MAX_SKILL]; // [celest] - int cloneskill_id; - int menuskill_id, menuskill_val; - - int invincible_timer; - unsigned int canlog_tick; - unsigned int canuseitem_tick; // [Skotlex] - unsigned int cantalk_tick; - unsigned int cansendmail_tick; // [Mail System Flood Protection] - unsigned int ks_floodprotect_tick; // [Kill Steal Protection] - - short weapontype1,weapontype2; - short disguise; // [Valaris] - - struct weapon_data right_weapon, left_weapon; - - // here start arrays to be globally zeroed at the beginning of status_calc_pc() - int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses. - int subele[ELE_MAX]; - int subrace[RC_MAX]; - int subrace2[RC_MAX]; - int subsize[3]; - int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1]; - int weapon_coma_ele[ELE_MAX]; - int weapon_coma_race[RC_MAX]; - int weapon_atk[16]; - int weapon_atk_rate[16]; - int arrow_addele[ELE_MAX]; - int arrow_addrace[RC_MAX]; - int arrow_addsize[3]; - int magic_addele[ELE_MAX]; - int magic_addrace[RC_MAX]; - int magic_addsize[3]; - int critaddrace[RC_MAX]; - int expaddrace[RC_MAX]; - int ignore_mdef[RC_MAX]; - int itemgrouphealrate[MAX_ITEMGROUP]; - short sp_gain_race[RC_MAX]; - // zeroed arrays end here. - // zeroed structures start here - struct s_autospell{ - short id, lv, rate, card_id, flag; - } autospell[15], autospell2[15]; - struct s_addeffect{ - short id, rate, arrow_rate; - unsigned char flag; - } addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS]; - struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills. - unsigned short id; - short val; - } skillatk[MAX_PC_BONUS], skillheal[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS]; - struct { - short value; - int rate; - int tick; - } hp_loss, sp_loss, hp_regen, sp_regen; - struct { - short class_, rate; - } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], - add_mdmg[MAX_PC_BONUS]; - struct s_add_drop { - short id, group; - int race, rate; - } add_drop[MAX_PC_BONUS]; - struct { - int nameid; - int rate; - } itemhealrate[MAX_PC_BONUS]; - // zeroed structures end here - // manually zeroed structures start here. - struct s_autoscript { - unsigned short rate, flag; - struct script_code *script; - } autoscript[10], autoscript2[10]; //Auto script on attack, when attacked - // manually zeroed structures end here. - // zeroed vars start here. - int arrow_atk,arrow_ele,arrow_cri,arrow_hit; - int nsshealhp,nsshealsp; - int critical_def,double_rate; - int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex] - int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate; - int ignore_mdef_ele; - int ignore_mdef_race; - int perfect_hit; - int perfect_hit_add; - int get_zeny_rate; - int get_zeny_num; //Added Get Zeny Rate [Skotlex] - int double_add_rate; - int short_weapon_damage_return,long_weapon_damage_return; - int magic_damage_return; // AppleGirl Was Here - int random_attack_increase_add,random_attack_increase_per; // [Valaris] - int break_weapon_rate,break_armor_rate; - int crit_atk_rate; - int classchange; // [Valaris] - int speed_add_rate, aspd_add; - unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex] - - short splash_range, splash_add_range; - short add_steal_rate; - short sp_gain_value, hp_gain_value; - short sp_vanish_rate; - short sp_vanish_per; - unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] - unsigned short unbreakable_equip; //100% break resistance on certain equipment - unsigned short unstripable_equip; - - // zeroed vars end here. - - int castrate,delayrate,hprate,sprate,dsprate; - int atk_rate; - int speed_rate,hprecov_rate,sprecov_rate; - int matk_rate; - int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate; - - int itemid; - short itemindex; //Used item's index in sd->inventory [Skotlex] - - short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo] - - short spiritball, spiritball_old; - int spirit_timer[MAX_SKILL_LEVEL]; - - unsigned char potion_success_counter; //Potion successes in row counter - unsigned char mission_count; //Stores the bounty kill count for TK_MISSION - short mission_mobid; //Stores the target mob_id for TK_MISSION - int die_counter; //Total number of times you've died - int devotion[5]; //Stores the account IDs of chars devoted to. - int reg_num; //Number of registries (type numeric) - int regstr_num; //Number of registries (type string) - - struct script_reg *reg; - struct script_regstr *regstr; - - int trade_partner; - struct { - struct { - short index, amount; - } item[10]; - int zeny, weight; - } deal; - - int party_invite,party_invite_account; - int adopt_invite; // Adoption - - int guild_invite,guild_invite_account; - int guild_emblem_id,guild_alliance,guild_alliance_account; - short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo] - int guildspy; // [Syrus22] - int partyspy; // [Syrus22] - - int vender_id; - int vend_num; - char message[MESSAGE_SIZE]; - struct s_vending vending[MAX_VENDING]; - - struct pet_data *pd; - struct homun_data *hd; // [blackhole89] - - struct{ - int m; //-1 - none, other: map index corresponding to map name. - unsigned short index; //map index - }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars - short hate_mob[3]; - - int pvp_timer; - short pvp_point; - unsigned short pvp_rank, pvp_lastusers; - unsigned short pvp_won, pvp_lost; - - char eventqueue[MAX_EVENTQUEUE][50]; - int eventtimer[MAX_EVENTTIMER]; - unsigned short eventcount; // [celest] - - unsigned char change_level; // [celest] - - char fakename[NAME_LENGTH]; // fake names [Valaris] - - int duel_group; // duel vars [LuzZza] - int duel_invite; - - char away_message[128]; // [LuzZza] - - int cashPoints, kafraPoints; - - // Auction System [Zephyrus] - struct { - int index, amount; - } auction; - - // Mail System [Zephyrus] - struct { - short nameid; - int index, amount, zeny; - struct mail_data inbox; - } mail; -}; - -struct npc_timerevent_list { - int timer,pos; -}; -struct npc_label_list { - char name[NAME_LENGTH]; - int pos; -}; -struct npc_item_list { - unsigned int nameid,value; -}; -struct npc_data { - struct block_list bl; - struct unit_data ud; //Because they need to be able to move.... - struct view_data *vd; - struct status_change sc; //They can't have status changes, but.. they want the visual opt values. - struct npc_data *master_nd; - short class_; - short speed; - char name[NAME_LENGTH+1];// display name - char exname[NAME_LENGTH+1];// unique npc name - int chat_id; - unsigned int next_walktime; - - void* chatdb; // pointer to a npc_parse struct (see npc_chat.c) - enum npc_subtype subtype; - union { - struct { - struct script_code *script; - short xs,ys; // OnTouch area radius - int guild_id; - int timer,timerid,timeramount,rid; - unsigned int timertick; - struct npc_timerevent_list *timer_event; - int label_list_num; - struct npc_label_list *label_list; - int src_id; - } scr; - struct { - struct npc_item_list* shop_item; - int count; - } shop; - struct { - short xs,ys; // OnTouch area radius - short x,y; // destination coords - unsigned short mapindex; // destination map - } warp; - } u; -}; - -//For quick linking to a guardian's info. [Skotlex] -struct guardian_data { - int number; //0-MAX_GUARDIANS-1 = Guardians. MAX_GUARDIANS = Emperium. - int guild_id; - int emblem_id; - int guardup_lv; //Level of GD_GUARDUP skill. - char guild_name[NAME_LENGTH]; - struct guild_castle* castle; -}; - // Mob List Held in memory for Dynamic Mobs [Wizputer] // Expanded to specify all mob-related spawn data by [Skotlex] struct spawn_data { @@ -879,139 +247,6 @@ struct spawn_data { }; -struct mob_data { - struct block_list bl; - struct unit_data ud; - struct view_data *vd; - struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs. - struct status_change sc; - struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex] - struct barricade_data *barricade; - char name[NAME_LENGTH]; - struct { - unsigned size : 2; //Small/Big monsters. - unsigned ai : 2; //Special ai for summoned monsters. - //0: Normal mob. - //1: Standard summon, attacks mobs. - //2: Alchemist Marine Sphere - //3: Alchemist Summon Flora - } special_state; //Special mob information that does not needs to be zero'ed on mob respawn. - struct { - unsigned skillstate : 8; - unsigned aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex] - unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus] - unsigned steal_coin_flag : 1; - unsigned soul_change_flag : 1; // Celest - unsigned alchemist: 1; - unsigned no_random_walk: 1; - unsigned killer: 1; - unsigned spotted: 1; - unsigned char attacked_count; //For rude attacked. - int provoke_flag; // Celest - } state; - struct guardian_data* guardian_data; - struct { - int id; - unsigned int dmg; - unsigned flag : 1; //0: Normal. 1: Homunc exp - } dmglog[DAMAGELOG_SIZE]; - struct spawn_data *spawn; //Spawn data. - struct item *lootitem; - short class_; - unsigned int tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex] - int level; - int target_id,attacked_id; - - unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime; - short move_fail_count; - short lootitem_count; - short min_chase; - - int deletetimer; - int master_id,master_dist; - - struct npc_data *nd; - unsigned short callback_flag; - - short skillidx; - unsigned int skilldelay[MAX_MOBSKILL]; - char npc_event[50]; -}; - -/* [blackhole89] */ -struct homun_data { - struct block_list bl; - struct unit_data ud; - struct view_data *vd; - struct status_data base_status, battle_status; - struct status_change sc; - struct regen_data regen; - struct s_homunculus_db *homunculusDB; //[orn] - struct s_homunculus homunculus ; //[orn] - - struct map_session_data *master; //pointer back to its master - int hungry_timer; //[orn] - unsigned int exp_next; - char blockskill[MAX_SKILL]; // [orn] -}; - -struct pet_data { - struct block_list bl; - struct unit_data ud; - struct view_data vd; - struct s_pet pet; - struct status_data status; - struct mob_db *db; - struct s_pet_db *petDB; - int pet_hungry_timer; - int target_id; - struct { - unsigned skillbonus : 1; - } state; - int move_fail_count; - unsigned int next_walktime,last_thinktime; - short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] - - struct pet_recovery { //Stat recovery - unsigned short type; //Status Change id - unsigned short delay; //How long before curing (secs). - int timer; - } *recovery; //[Valaris] / Reimplemented by [Skotlex] - - struct pet_bonus { - unsigned short type; //bStr, bVit? - unsigned short val; //Qty - unsigned short duration; //in secs - unsigned short delay; //Time before recasting (secs) - int timer; - } *bonus; //[Valaris] / Reimplemented by [Skotlex] - - struct pet_skill_attack { //Attack Skill - unsigned short id; - unsigned short lv; - unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_. - unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks) - unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10% - } *a_skill; //[Skotlex] - - struct pet_skill_support { //Support Skill - unsigned short id; - unsigned short lv; - unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat) - unsigned short sp; //Max SP% for skill to trigger (100 = no check) - unsigned short delay; //Time (secs) between being able to recast. - int timer; - } *s_skill; //[Skotlex] - - struct pet_loot { - struct item *item; - unsigned short count; - unsigned short weight; - unsigned short max; - } *loot; //[Valaris] / Rewritten by [Skotlex] - - struct map_session_data *msd; -}; struct flooritem_data { struct block_list bl; @@ -1022,19 +257,6 @@ struct flooritem_data { struct item item_data; }; -struct chat_data { - struct block_list bl; // data for this map object - char title[CHATROOM_TITLE_SIZE]; // room title - char pass[CHATROOM_PASS_SIZE]; // password - bool pub; // private/public flag - uint8 users; // current user count - uint8 limit; // join limit - uint8 trigger; // number of users needed to trigger event - struct map_session_data* usersd[20]; - struct block_list* owner; - char npc_event[50]; -}; - enum _sp { SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7 SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15 diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 95193df0a..2e90786cd 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -4,6 +4,9 @@ #ifndef _MERCENARY_H_ #define _MERCENARY_H_ +#include "status.h" // struct status_data, struct status_change +#include "unit.h" // struct unit_data + struct s_homunculus_db { int base_class, evo_class; char name[NAME_LENGTH]; @@ -24,6 +27,24 @@ enum { SP_HUNGRY = 0x200 }; + +struct homun_data { + struct block_list bl; + struct unit_data ud; + struct view_data *vd; + struct status_data base_status, battle_status; + struct status_change sc; + struct regen_data regen; + struct s_homunculus_db *homunculusDB; //[orn] + struct s_homunculus homunculus ; //[orn] + + struct map_session_data *master; //pointer back to its master + int hungry_timer; //[orn] + unsigned int exp_next; + char blockskill[MAX_SKILL]; // [orn] +}; + + #define homdb_checkid(id) (id >= HM_CLASS_BASE && id <= HM_CLASS_MAX) // merc_is_hom_alive(struct homun_data *) diff --git a/src/map/mob.c b/src/map/mob.c index f03b9ac9d..bd9ed5d43 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -17,6 +17,7 @@ #include "clif.h" #include "intif.h" #include "pc.h" +#include "pet.h" #include "status.h" #include "mob.h" #include "mercenary.h" //[orn] diff --git a/src/map/mob.h b/src/map/mob.h index fb4d06db4..b8a8a2394 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -5,8 +5,11 @@ #define _MOB_H_ #include "../common/mmo.h" // struct item -#include "unit.h" // unit_stop_walking(), unit_stop_attack() +#include "guild.h" // struct guardian_data #include "map.h" // struct status_data, struct view_data, struct mob_skill +#include "status.h" // struct status data, struct status_change +#include "unit.h" // unit_stop_walking(), unit_stop_attack() + #define MAX_RANDOMMONSTER 4 #define MAX_MOB_RACE_DB 6 @@ -80,6 +83,67 @@ struct mob_db { struct spawn_info spawn[10]; }; +struct mob_data { + struct block_list bl; + struct unit_data ud; + struct view_data *vd; + struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs. + struct status_change sc; + struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex] + struct barricade_data *barricade; + char name[NAME_LENGTH]; + struct { + unsigned size : 2; //Small/Big monsters. + unsigned ai : 2; //Special ai for summoned monsters. + //0: Normal mob. + //1: Standard summon, attacks mobs. + //2: Alchemist Marine Sphere + //3: Alchemist Summon Flora + } special_state; //Special mob information that does not needs to be zero'ed on mob respawn. + struct { + unsigned skillstate : 8; + unsigned aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex] + unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus] + unsigned steal_coin_flag : 1; + unsigned soul_change_flag : 1; // Celest + unsigned alchemist: 1; + unsigned no_random_walk: 1; + unsigned killer: 1; + unsigned spotted: 1; + unsigned char attacked_count; //For rude attacked. + int provoke_flag; // Celest + } state; + struct guardian_data* guardian_data; + struct { + int id; + unsigned int dmg; + unsigned flag : 1; //0: Normal. 1: Homunc exp + } dmglog[DAMAGELOG_SIZE]; + struct spawn_data *spawn; //Spawn data. + struct item *lootitem; + short class_; + unsigned int tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex] + int level; + int target_id,attacked_id; + + unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime; + short move_fail_count; + short lootitem_count; + short min_chase; + + int deletetimer; + int master_id,master_dist; + + struct npc_data *nd; + unsigned short callback_flag; + + short skillidx; + unsigned int skilldelay[MAX_MOBSKILL]; + char npc_event[50]; +}; + + + enum { MST_TARGET = 0, MST_RANDOM, //Random Target! diff --git a/src/map/npc.h b/src/map/npc.h index d2e87df5d..f75ede9c5 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -4,11 +4,66 @@ #ifndef _NPC_H_ #define _NPC_H_ -//#include "map.h" +#include "map.h" // struct block_list +#include "status.h" // struct status_change +#include "unit.h" // struct unit_data struct block_list; struct npc_data; struct view_data; + +struct npc_timerevent_list { + int timer,pos; +}; +struct npc_label_list { + char name[NAME_LENGTH]; + int pos; +}; +struct npc_item_list { + unsigned int nameid,value; +}; + +struct npc_data { + struct block_list bl; + struct unit_data ud; //Because they need to be able to move.... + struct view_data *vd; + struct status_change sc; //They can't have status changes, but.. they want the visual opt values. + struct npc_data *master_nd; + short class_; + short speed; + char name[NAME_LENGTH+1];// display name + char exname[NAME_LENGTH+1];// unique npc name + int chat_id; + unsigned int next_walktime; + + void* chatdb; // pointer to a npc_parse struct (see npc_chat.c) + enum npc_subtype subtype; + union { + struct { + struct script_code *script; + short xs,ys; // OnTouch area radius + int guild_id; + int timer,timerid,timeramount,rid; + unsigned int timertick; + struct npc_timerevent_list *timer_event; + int label_list_num; + struct npc_label_list *label_list; + int src_id; + } scr; + struct { + struct npc_item_list* shop_item; + int count; + } shop; + struct { + short xs,ys; // OnTouch area radius + short x,y; // destination coords + unsigned short mapindex; // destination map + } warp; + } u; +}; + + + #define START_NPC_NUM 110000000 #define WARP_CLASS 45 diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 5094a1d90..44c9ce82e 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -9,7 +9,9 @@ #include "../common/showmsg.h" #include "../common/strlib.h" -#include "map.h" // struct mob_data, struct npc_data +#include "mob.h" // struct mob_data +#include "npc.h" // struct npc_data +#include "pc.h" // struct map_session_data #include "script.h" // set_var() #include "pcre.h" diff --git a/src/map/party.h b/src/map/party.h index 54f55a6c2..e45b62c1e 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -4,15 +4,33 @@ #ifndef _PARTY_H_ #define _PARTY_H_ -//#include "map.h" +#include "../common/mmo.h" // struct party struct block_list; struct map_session_data; struct party; -struct party_data; struct item; #include <stdarg.h> +struct party_member_data { + struct map_session_data *sd; + unsigned int hp; //For HP,x,y refreshing. + unsigned short x, y; +}; + +struct party_data { + struct party party; + struct party_member_data data[MAX_PARTY]; + uint8 itemc; //For item distribution, position of last picker in party + struct { + unsigned monk : 1; //There's at least one monk in party? + unsigned sg : 1; //There's at least one Star Gladiator in party? + unsigned snovice :1; //There's a Super Novice + unsigned tk : 1; //There's a taekwon + } state; +}; + + extern int party_share_level; void do_init_party(void); diff --git a/src/map/path.h b/src/map/path.h index 761d9de26..1dc024655 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -4,6 +4,21 @@ #ifndef _PATH_H_ #define _PATH_H_ +#include "map.h" // enum cell_chk + +#define MAX_WALKPATH 32 + +struct walkpath_data { + unsigned char path_len,path_pos; + unsigned char path[MAX_WALKPATH]; +}; + +struct shootpath_data { + int rx,ry,len; + int x[MAX_WALKPATH]; + int y[MAX_WALKPATH]; +}; + // calculates destination cell for knockback int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); diff --git a/src/map/pc.h b/src/map/pc.h index 7942aab9d..c55e7f2cc 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -7,9 +7,340 @@ #include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus #include "../common/timer.h" // INVALID_TIMER #include "battle.h" // battle_config -#include "map.h" // JOB_*, struct map_session_data -#include "status.h" // OPTION_* +#include "itemdb.h" // MAX_ITEMGROUP +#include "map.h" // RC_MAX +#include "pc.h" // struct map_session_data +#include "script.h" // struct script_reg, struct script_regstr +#include "status.h" // OPTION_*, struct weapon_atk #include "unit.h" // unit_stop_attack(), unit_stop_walking() +#include "vending.h" // struct s_vending + +#define MAX_PC_BONUS 10 + +struct weapon_data { + int atkmods[3]; + // all the variables except atkmods get zero'ed in each call of status_calc_pc + // NOTE: if you want to add a non-zeroed variable, you need to update the memset call + // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex] + int overrefine; + int star; + int ignore_def_ele; + int ignore_def_race; + int def_ratio_atk_ele; + int def_ratio_atk_race; + int addele[ELE_MAX]; + int addrace[RC_MAX]; + int addrace2[RC_MAX]; + int addsize[3]; + + struct drain_data { + short rate; + short per; + short value; + unsigned type:1; + } hp_drain[RC_MAX], sp_drain[RC_MAX]; + + struct { + short class_, rate; + } add_dmg[MAX_PC_BONUS]; +}; + +struct map_session_data { + struct block_list bl; + struct unit_data ud; + struct view_data vd; + struct status_data base_status, battle_status; + struct status_change sc; + struct regen_data regen; + struct regen_data_sub sregen, ssregen; + //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in + //status_calc_pc, while special_state is recalculated in each call. [Skotlex] + struct { + unsigned active : 1; //Marks active player (not active is logging in/out, or changing map servers) + unsigned menu_or_input : 1;// if a script is waiting for feedback from the player + unsigned dead_sit : 2; + unsigned lr_flag : 2; + unsigned connect_new : 1; + unsigned arrow_atk : 1; + unsigned skill_flag : 1; + unsigned gangsterparadise : 1; + unsigned rest : 1; + unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] + unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3) + unsigned snovice_dead_flag : 2; //Explosion spirits on death: 0 off, 1 active, 2 used. + unsigned abra_flag : 1; // Abracadabra bugfix by Aru + unsigned autotrade : 1; //By Fantik + unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet) + unsigned showdelay :1; + unsigned showexp :1; + unsigned showzeny :1; + unsigned mainchat :1; //[LuzZza] + unsigned noask :1; // [LuzZza] + unsigned trading :1; //[Skotlex] is 1 only after a trade has started. + unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE + unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] + unsigned size :2; // for tiny/large types + unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] + unsigned blockedmove :1; + unsigned using_fake_npc :1; + unsigned rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] + unsigned killer : 1; + unsigned killable : 1; + unsigned doridori : 1; + unsigned ignoreAll : 1; + unsigned short autoloot; + unsigned short autolootid; // [Zephyrus] + unsigned noks : 3; // [Zeph Kill Steal Protection] + bool changemap; + struct guild *gmaster_flag; + } state; + struct { + unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; + unsigned restart_full_recover : 1; + unsigned no_castcancel : 1; + unsigned no_castcancel2 : 1; + unsigned no_sizefix : 1; + unsigned no_gemstone : 1; + unsigned intravision : 1; // Maya Purple Card effect [DracoRPG] + unsigned perfect_hiding : 1; // [Valaris] + unsigned no_knockback : 1; + unsigned bonus_coma : 1; + } special_state; + int login_id1, login_id2; + unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] + + int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18 + struct mmo_charstatus status; + struct registry save_reg; + + struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) + short equip_index[11]; + unsigned int weight,max_weight; + int cart_weight,cart_num; + int fd; + unsigned short mapindex; + unsigned short prev_speed,prev_adelay; + unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left. + unsigned int client_tick; + int npc_id,areanpc_id,npc_shopid; + int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse) + int npc_menu; + int npc_amount; + struct script_state *st; + char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine + int npc_timer_id; //For player attached npc timers. [Skotlex] + unsigned int chatID; + time_t idletime; + + struct{ + char name[NAME_LENGTH]; + } ignore[MAX_IGNORE_LIST]; + + int followtimer; // [MouseJstr] + int followtarget; + + time_t emotionlasttime; // to limit flood with emotion packets + + short skillitem,skillitemlv; + short skillid_old,skilllv_old; + short skillid_dance,skilllv_dance; + char blockskill[MAX_SKILL]; // [celest] + int cloneskill_id; + int menuskill_id, menuskill_val; + + int invincible_timer; + unsigned int canlog_tick; + unsigned int canuseitem_tick; // [Skotlex] + unsigned int cantalk_tick; + unsigned int cansendmail_tick; // [Mail System Flood Protection] + unsigned int ks_floodprotect_tick; // [Kill Steal Protection] + + short weapontype1,weapontype2; + short disguise; // [Valaris] + + struct weapon_data right_weapon, left_weapon; + + // here start arrays to be globally zeroed at the beginning of status_calc_pc() + int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses. + int subele[ELE_MAX]; + int subrace[RC_MAX]; + int subrace2[RC_MAX]; + int subsize[3]; + int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1]; + int weapon_coma_ele[ELE_MAX]; + int weapon_coma_race[RC_MAX]; + int weapon_atk[16]; + int weapon_atk_rate[16]; + int arrow_addele[ELE_MAX]; + int arrow_addrace[RC_MAX]; + int arrow_addsize[3]; + int magic_addele[ELE_MAX]; + int magic_addrace[RC_MAX]; + int magic_addsize[3]; + int critaddrace[RC_MAX]; + int expaddrace[RC_MAX]; + int ignore_mdef[RC_MAX]; + int itemgrouphealrate[MAX_ITEMGROUP]; + short sp_gain_race[RC_MAX]; + // zeroed arrays end here. + // zeroed structures start here + struct s_autospell{ + short id, lv, rate, card_id, flag; + } autospell[15], autospell2[15]; + struct s_addeffect{ + short id, rate, arrow_rate; + unsigned char flag; + } addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS]; + struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills. + unsigned short id; + short val; + } skillatk[MAX_PC_BONUS], skillheal[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS]; + struct { + short value; + int rate; + int tick; + } hp_loss, sp_loss, hp_regen, sp_regen; + struct { + short class_, rate; + } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], + add_mdmg[MAX_PC_BONUS]; + struct s_add_drop { + short id, group; + int race, rate; + } add_drop[MAX_PC_BONUS]; + struct { + int nameid; + int rate; + } itemhealrate[MAX_PC_BONUS]; + // zeroed structures end here + // manually zeroed structures start here. + struct s_autoscript { + unsigned short rate, flag; + struct script_code *script; + } autoscript[10], autoscript2[10]; //Auto script on attack, when attacked + // manually zeroed structures end here. + // zeroed vars start here. + int arrow_atk,arrow_ele,arrow_cri,arrow_hit; + int nsshealhp,nsshealsp; + int critical_def,double_rate; + int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex] + int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate; + int ignore_mdef_ele; + int ignore_mdef_race; + int perfect_hit; + int perfect_hit_add; + int get_zeny_rate; + int get_zeny_num; //Added Get Zeny Rate [Skotlex] + int double_add_rate; + int short_weapon_damage_return,long_weapon_damage_return; + int magic_damage_return; // AppleGirl Was Here + int random_attack_increase_add,random_attack_increase_per; // [Valaris] + int break_weapon_rate,break_armor_rate; + int crit_atk_rate; + int classchange; // [Valaris] + int speed_add_rate, aspd_add; + unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex] + + short splash_range, splash_add_range; + short add_steal_rate; + short sp_gain_value, hp_gain_value; + short sp_vanish_rate; + short sp_vanish_per; + unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] + unsigned short unbreakable_equip; //100% break resistance on certain equipment + unsigned short unstripable_equip; + + // zeroed vars end here. + + int castrate,delayrate,hprate,sprate,dsprate; + int atk_rate; + int speed_rate,hprecov_rate,sprecov_rate; + int matk_rate; + int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate; + + int itemid; + short itemindex; //Used item's index in sd->inventory [Skotlex] + + short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo] + + short spiritball, spiritball_old; + int spirit_timer[MAX_SKILL_LEVEL]; + + unsigned char potion_success_counter; //Potion successes in row counter + unsigned char mission_count; //Stores the bounty kill count for TK_MISSION + short mission_mobid; //Stores the target mob_id for TK_MISSION + int die_counter; //Total number of times you've died + int devotion[5]; //Stores the account IDs of chars devoted to. + int reg_num; //Number of registries (type numeric) + int regstr_num; //Number of registries (type string) + + struct script_reg *reg; + struct script_regstr *regstr; + + int trade_partner; + struct { + struct { + short index, amount; + } item[10]; + int zeny, weight; + } deal; + + int party_invite,party_invite_account; + int adopt_invite; // Adoption + + int guild_invite,guild_invite_account; + int guild_emblem_id,guild_alliance,guild_alliance_account; + short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo] + int guildspy; // [Syrus22] + int partyspy; // [Syrus22] + + int vender_id; + int vend_num; + char message[MESSAGE_SIZE]; + struct s_vending vending[MAX_VENDING]; + + struct pet_data *pd; + struct homun_data *hd; // [blackhole89] + + struct{ + int m; //-1 - none, other: map index corresponding to map name. + unsigned short index; //map index + }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars + short hate_mob[3]; + + int pvp_timer; + short pvp_point; + unsigned short pvp_rank, pvp_lastusers; + unsigned short pvp_won, pvp_lost; + + char eventqueue[MAX_EVENTQUEUE][50]; + int eventtimer[MAX_EVENTTIMER]; + unsigned short eventcount; // [celest] + + unsigned char change_level; // [celest] + + char fakename[NAME_LENGTH]; // fake names [Valaris] + + int duel_group; // duel vars [LuzZza] + int duel_invite; + + char away_message[128]; // [LuzZza] + + int cashPoints, kafraPoints; + + // Auction System [Zephyrus] + struct { + int index, amount; + } auction; + + // Mail System [Zephyrus] + struct { + short nameid; + int index, amount, zeny; + struct mail_data inbox; + } mail; +}; + //Update this max as necessary. 54 is the value needed for Super Baby currently #define MAX_SKILL_TREE 54 @@ -104,6 +435,7 @@ struct duel { int max_players_limit; }; +#define MAX_DUEL 1024 extern struct duel duel_list[MAX_DUEL]; extern int duel_count; diff --git a/src/map/pet.h b/src/map/pet.h index b5dda0944..eeb48f018 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -33,6 +33,67 @@ extern struct s_pet_db pet_db[MAX_PET_DB]; enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD }; + +struct pet_data { + struct block_list bl; + struct unit_data ud; + struct view_data vd; + struct s_pet pet; + struct status_data status; + struct mob_db *db; + struct s_pet_db *petDB; + int pet_hungry_timer; + int target_id; + struct { + unsigned skillbonus : 1; + } state; + int move_fail_count; + unsigned int next_walktime,last_thinktime; + short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex] + + struct pet_recovery { //Stat recovery + unsigned short type; //Status Change id + unsigned short delay; //How long before curing (secs). + int timer; + } *recovery; //[Valaris] / Reimplemented by [Skotlex] + + struct pet_bonus { + unsigned short type; //bStr, bVit? + unsigned short val; //Qty + unsigned short duration; //in secs + unsigned short delay; //Time before recasting (secs) + int timer; + } *bonus; //[Valaris] / Reimplemented by [Skotlex] + + struct pet_skill_attack { //Attack Skill + unsigned short id; + unsigned short lv; + unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_. + unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks) + unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10% + } *a_skill; //[Skotlex] + + struct pet_skill_support { //Support Skill + unsigned short id; + unsigned short lv; + unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat) + unsigned short sp; //Max SP% for skill to trigger (100 = no check) + unsigned short delay; //Time (secs) between being able to recast. + int timer; + } *s_skill; //[Skotlex] + + struct pet_loot { + struct item *item; + unsigned short count; + unsigned short weight; + unsigned short max; + } *loot; //[Valaris] / Rewritten by [Skotlex] + + struct map_session_data *msd; +}; + + + int pet_create_egg(struct map_session_data *sd, int item_id); int pet_hungry_val(struct pet_data *pd); int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type); diff --git a/src/map/script.h b/src/map/script.h index 036036ccc..b9e5fdb01 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -101,6 +101,16 @@ struct script_state { } sleep; }; +struct script_reg { + int index; + int data; +}; + +struct script_regstr { + int index; + char* data; +}; + enum script_parse_options { SCRIPT_USE_LABEL_DB = 0x1,// records labels in scriptlabel_db SCRIPT_IGNORE_EXTERNAL_BRACKETS = 0x2,// ignores the check for {} brackets around the script diff --git a/src/map/skill.h b/src/map/skill.h index 73e1daf4f..2a1dd6a70 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -4,8 +4,13 @@ #ifndef _SKILL_H_ #define _SKILL_H_ -#include "../common/mmo.h" // MAX_SKILL -#include "map.h" // MAX_SKILL_LEVEL, ... +#include "../common/mmo.h" // MAX_SKILL, struct square +#include "map.h" // struct block_list +struct map_session_data; +struct homun_data; +struct skill_unit; +struct skill_unit_group; +struct status_change_entry; #define MAX_SKILL_DB MAX_SKILL #define MAX_SKILL_PRODUCE_DB 150 @@ -13,6 +18,8 @@ #define MAX_SKILL_ARROW_DB 150 #define MAX_SKILL_ABRA_DB 350 +#define MAX_SKILL_LEVEL 100 + //Constants to identify the skill's inf value: #define INF_ATTACK_SKILL 1 #define INF_GROUND_SKILL 2 @@ -99,6 +106,60 @@ struct s_skill_unit_layout { int dy[MAX_SKILL_UNIT_COUNT]; }; +#define MAX_SKILLTIMERSKILL 15 +struct skill_timerskill { + int timer; + int src_id; + int target_id; + int map; + short x,y; + short skill_id,skill_lv; + int type; // a BF_ type (NOTE: some places use this as general-purpose storage...) + int flag; +}; + +#define MAX_SKILLUNITGROUP 25 +struct skill_unit_group { + int src_id; + int party_id; + int guild_id; + int map; + int target_flag; //Holds BCT_* flag for battle_check_target + int bl_flag; //Holds BL_* flag for map_foreachin* functions + unsigned int tick; + int limit,interval; + + short skill_id,skill_lv; + int val1,val2,val3; + char *valstr; + int unit_id; + int group_id; + int unit_count,alive_count; + struct skill_unit *unit; + struct { + unsigned ammo_consume : 1; + unsigned magic_power : 1; + unsigned song_dance : 2; //0x1 Song/Dance, 0x2 Ensemble + } state; +}; + +struct skill_unit { + struct block_list bl; + + struct skill_unit_group *group; + + int limit; + int val1,val2; + short alive,range; +}; + +#define MAX_SKILLUNITGROUPTICKSET 25 +struct skill_unit_group_tickset { + unsigned int tick; + int id; +}; + + enum { UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend' UF_NOREITERATION = 0x0002, // Spell cannot be stacked @@ -140,11 +201,6 @@ extern struct s_skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB]; extern int enchant_eff[5]; extern int deluge_eff[5]; -struct block_list; -struct map_session_data; -struct skill_unit; -struct skill_unit_group; - int do_init_skill(void); int do_final_skill(void); @@ -213,8 +269,7 @@ int skill_delunitgroup(struct block_list *src, struct skill_unit_group *group); int skill_clear_unitgroup(struct block_list *src); int skill_clear_group(struct block_list *bl, int flag); -int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl, - int damage,unsigned int tick); +int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl,int damage,unsigned int tick); int skill_castfix( struct block_list *bl, int skill_id, int skill_lv); int skill_castfix_sc( struct block_list *bl, int time); diff --git a/src/map/status.h b/src/map/status.h index 75b558d79..8ec4fb01e 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -4,7 +4,6 @@ #ifndef _STATUS_H_ #define _STATUS_H_ -//#include "map.h" struct block_list; struct mob_data; struct pet_data; @@ -17,6 +16,7 @@ struct status_change; extern unsigned long StatusChangeFlagTable[]; + // Status changes listing. These code are for use by the server. enum sc_type { //First we enumerate common status ailments which are often used around. @@ -583,6 +583,106 @@ enum { //Define to determine who has regen #define BL_REGEN (BL_PC|BL_HOM) + +//Basic damage info of a weapon +//Required because players have two of these, one in status_data +//and another for their left hand weapon. +struct weapon_atk { + unsigned short atk, atk2; + unsigned short range; + unsigned char ele; +}; + + +//For holding basic status (which can be modified by status changes) +struct status_data { + unsigned int + hp, sp, + max_hp, max_sp; + unsigned short + str, agi, vit, int_, dex, luk, + batk, + matk_min, matk_max, + speed, + amotion, adelay, dmotion, + mode; + short + hit, flee, cri, flee2, + def2, mdef2, + aspd_rate; + unsigned char + def_ele, ele_lv, + size, race; + signed char + def, mdef; + struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon. +}; + +//Additional regen data that only players have. +struct regen_data_sub { + unsigned short + hp,sp; + + //tick accumulation before healing. + struct { + unsigned int hp,sp; + } tick; + + //Regen rates (where every 1 means +100% regen) + struct { + unsigned char hp,sp; + } rate; +}; + +struct regen_data { + + unsigned short flag; //Marks what stuff you may heal or not. + unsigned short + hp,sp,shp,ssp; + + //tick accumulation before healing. + struct { + unsigned int hp,sp,shp,ssp; + } tick; + + //Regen rates (where every 1 means +100% regen) + struct { + unsigned char + hp,sp,shp,ssp; + } rate; + + struct { + unsigned walk:1; //Can you regen even when walking? + unsigned gc:1; //Tags when you should have double regen due to GVG castle + unsigned overweight :2; //overweight state (1: 50%, 2: 90%) + unsigned block :2; //Block regen flag (1: Hp, 2: Sp) + } state; + + //skill-regen, sitting-skill-regen (since not all chars with regen need it) + struct regen_data_sub *sregen, *ssregen; +}; + +struct status_change_entry { + int timer; + int val1,val2,val3,val4; +}; + +struct status_change { + unsigned int option;// effect state (bitfield) + unsigned int opt3;// skill state (bitfield) + unsigned short opt1;// body state + unsigned short opt2;// health state (bitfield) + unsigned char count; + //TODO: See if it is possible to implement the following SC's without requiring extra parameters while the SC is inactive. + unsigned char jb_flag; //Joint Beat type flag + unsigned short mp_matk_min, mp_matk_max; //Previous matk min/max for ground spells (Amplify magic power) + int sg_id; //ID of the previous Storm gust that hit you + unsigned char sg_counter; //Storm gust counter (previous hits from storm gust) + struct status_change_entry *data[SC_MAX]; +}; + + + int status_damage(struct block_list *src,struct block_list *target,int hp,int sp, int walkdelay, int flag); //Define for standard HP damage attacks. #define status_fix_damage(src, target, hp, walkdelay) status_damage(src, target, hp, 0, walkdelay, 0) diff --git a/src/map/unit.h b/src/map/unit.h index 7575d3f5e..192f1c7e8 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -9,6 +9,56 @@ struct block_list; struct unit_data; struct map_session_data; +#include "map.h" // struct block_list +#include "path.h" // struct walkpath_data +#include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset + +struct unit_data { + struct block_list *bl; + struct walkpath_data walkpath; + struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL]; + struct skill_unit_group *skillunit[MAX_SKILLUNITGROUP]; + struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; + short attacktarget_lv; + short to_x,to_y; + short skillx,skilly; + short skillid,skilllv; + int skilltarget; + int skilltimer; + int target; + int attacktimer; + int walktimer; + int chaserange; + unsigned int attackabletime; + unsigned int canact_tick; + unsigned int canmove_tick; + uint8 dir; + unsigned char walk_count; + struct { + unsigned change_walk_target : 1 ; + unsigned skillcastcancel : 1 ; + unsigned attack_continue : 1 ; + unsigned walk_easy : 1 ; + unsigned running : 1; + unsigned speed_changed : 1; + } state; +}; + +struct view_data { + unsigned short + class_, + weapon, + shield, //Or left-hand weapon. + head_top, + head_mid, + head_bottom, + hair_style, + hair_color, + cloth_color; + char sex; + unsigned dead_sit : 2; +}; + // PC, MOB, PET に共通する処理を1つにまとめる計画 // 歩行開始 diff --git a/src/map/vending.h b/src/map/vending.h index e65f55e93..a95d6abf5 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -8,6 +8,12 @@ //#include "map.h" struct map_session_data; +struct s_vending { + short index; + short amount; + unsigned int value; +}; + void vending_closevending(struct map_session_data* sd); void vending_openvending(struct map_session_data* sd, const char* message, bool flag, const uint8* data, int count); void vending_vendinglistreq(struct map_session_data* sd, int id); |