[22] | 1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
[1] | 2 | // For more information, see LICENCE in the main folder |
---|
| 3 | |
---|
| 4 | #ifndef _PC_H_ |
---|
| 5 | #define _PC_H_ |
---|
| 6 | |
---|
| 7 | #include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus |
---|
| 8 | #include "../common/timer.h" // INVALID_TIMER |
---|
| 9 | #include "battle.h" // battle_config |
---|
| 10 | #include "itemdb.h" // MAX_ITEMGROUP |
---|
| 11 | #include "map.h" // RC_MAX |
---|
| 12 | #include "pc.h" // struct map_session_data |
---|
| 13 | #include "script.h" // struct script_reg, struct script_regstr |
---|
| 14 | #include "status.h" // OPTION_*, struct weapon_atk |
---|
| 15 | #include "unit.h" // unit_stop_attack(), unit_stop_walking() |
---|
| 16 | #include "vending.h" // struct s_vending |
---|
| 17 | #include "mob.h" |
---|
| 18 | |
---|
| 19 | #define MAX_PC_BONUS 10 |
---|
| 20 | |
---|
| 21 | struct weapon_data { |
---|
| 22 | int atkmods[3]; |
---|
| 23 | // all the variables except atkmods get zero'ed in each call of status_calc_pc |
---|
| 24 | // NOTE: if you want to add a non-zeroed variable, you need to update the memset call |
---|
| 25 | // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex] |
---|
| 26 | int overrefine; |
---|
| 27 | int star; |
---|
| 28 | int ignore_def_ele; |
---|
| 29 | int ignore_def_race; |
---|
| 30 | int def_ratio_atk_ele; |
---|
| 31 | int def_ratio_atk_race; |
---|
| 32 | int addele[ELE_MAX]; |
---|
| 33 | int addrace[RC_MAX]; |
---|
| 34 | int addrace2[RC_MAX]; |
---|
| 35 | int addsize[3]; |
---|
| 36 | |
---|
| 37 | struct drain_data { |
---|
| 38 | short rate; |
---|
| 39 | short per; |
---|
| 40 | short value; |
---|
| 41 | unsigned type:1; |
---|
| 42 | } hp_drain[RC_MAX], sp_drain[RC_MAX]; |
---|
| 43 | |
---|
| 44 | struct { |
---|
| 45 | short class_, rate; |
---|
| 46 | } add_dmg[MAX_PC_BONUS]; |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | struct s_autospell { |
---|
| 50 | short id, lv, rate, card_id, flag; |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | struct s_addeffect { |
---|
| 54 | enum sc_type id; |
---|
| 55 | short rate, arrow_rate; |
---|
| 56 | unsigned char flag; |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | struct s_add_drop { |
---|
| 60 | short id, group; |
---|
| 61 | int race, rate; |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | struct s_autoscript { |
---|
| 65 | unsigned short rate, flag; |
---|
| 66 | struct script_code *script; |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | struct map_session_data { |
---|
| 70 | struct block_list bl; |
---|
| 71 | struct unit_data ud; |
---|
| 72 | struct view_data vd; |
---|
| 73 | struct status_data base_status, battle_status; |
---|
| 74 | struct status_change sc; |
---|
| 75 | struct regen_data regen; |
---|
| 76 | struct regen_data_sub sregen, ssregen; |
---|
| 77 | //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in |
---|
| 78 | //status_calc_pc, while special_state is recalculated in each call. [Skotlex] |
---|
| 79 | struct { |
---|
| 80 | unsigned active : 1; //Marks active player (not active is logging in/out, or changing map servers) |
---|
| 81 | unsigned menu_or_input : 1;// if a script is waiting for feedback from the player |
---|
| 82 | unsigned dead_sit : 2; |
---|
| 83 | unsigned lr_flag : 2; |
---|
| 84 | unsigned connect_new : 1; |
---|
| 85 | unsigned arrow_atk : 1; |
---|
| 86 | unsigned skill_flag : 1; |
---|
| 87 | unsigned gangsterparadise : 1; |
---|
| 88 | unsigned rest : 1; |
---|
| 89 | unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] |
---|
| 90 | unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3) |
---|
| 91 | unsigned snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used. |
---|
| 92 | unsigned abra_flag : 1; // Abracadabra bugfix by Aru |
---|
| 93 | unsigned autotrade : 1; //By Fantik |
---|
| 94 | unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet) |
---|
| 95 | unsigned showdelay :1; |
---|
| 96 | unsigned showexp :1; |
---|
| 97 | unsigned showzeny :1; |
---|
| 98 | unsigned mainchat :1; //[LuzZza] |
---|
| 99 | unsigned noask :1; // [LuzZza] |
---|
| 100 | unsigned trading :1; //[Skotlex] is 1 only after a trade has started. |
---|
| 101 | unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE |
---|
| 102 | unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] |
---|
| 103 | unsigned size :2; // for tiny/large types |
---|
| 104 | unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] |
---|
| 105 | unsigned blockedmove :1; |
---|
| 106 | unsigned using_fake_npc :1; |
---|
| 107 | unsigned rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] |
---|
| 108 | unsigned killer : 1; |
---|
| 109 | unsigned killable : 1; |
---|
| 110 | unsigned doridori : 1; |
---|
| 111 | unsigned ignoreAll : 1; |
---|
| 112 | unsigned debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS] |
---|
| 113 | unsigned short autoloot; |
---|
| 114 | unsigned short autolootid; // [Zephyrus] |
---|
| 115 | unsigned noks : 3; // [Zeph Kill Steal Protection] |
---|
[24] | 116 | //Aside from a Space it's fine, but white space has no effect so it's fine. |
---|
| 117 | //Vanaheim settings [Brainstorm] |
---|
[19] | 118 | unsigned showsummon : 1; //Show summoned monster stats [Brainstorm] |
---|
[24] | 119 | |
---|
[1] | 120 | bool changemap; |
---|
| 121 | struct guild *gmaster_flag; |
---|
| 122 | } state; |
---|
| 123 | struct { |
---|
| 124 | unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; |
---|
| 125 | unsigned restart_full_recover : 1; |
---|
| 126 | unsigned no_castcancel : 1; |
---|
| 127 | unsigned no_castcancel2 : 1; |
---|
| 128 | unsigned no_sizefix : 1; |
---|
| 129 | unsigned no_gemstone : 1; |
---|
| 130 | unsigned intravision : 1; // Maya Purple Card effect [DracoRPG] |
---|
| 131 | unsigned perfect_hiding : 1; // [Valaris] |
---|
| 132 | unsigned no_knockback : 1; |
---|
| 133 | unsigned bonus_coma : 1; |
---|
| 134 | } special_state; |
---|
| 135 | int login_id1, login_id2; |
---|
| 136 | unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] |
---|
| 137 | |
---|
| 138 | int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18 |
---|
| 139 | struct mmo_charstatus status; |
---|
| 140 | struct registry save_reg; |
---|
| 141 | |
---|
| 142 | struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) |
---|
| 143 | short equip_index[11]; |
---|
| 144 | unsigned int weight,max_weight; |
---|
| 145 | int cart_weight,cart_num; |
---|
| 146 | int fd; |
---|
| 147 | unsigned short mapindex; |
---|
| 148 | unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left. |
---|
| 149 | unsigned int client_tick; |
---|
| 150 | int npc_id,areanpc_id,npc_shopid; |
---|
| 151 | int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse) |
---|
| 152 | int npc_menu; // internal variable, used in npc menu handling |
---|
| 153 | int npc_amount; |
---|
| 154 | struct script_state *st; |
---|
| 155 | char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine |
---|
| 156 | int npc_timer_id; //For player attached npc timers. [Skotlex] |
---|
| 157 | unsigned int chatID; |
---|
| 158 | time_t idletime; |
---|
| 159 | |
---|
| 160 | struct{ |
---|
| 161 | char name[NAME_LENGTH]; |
---|
| 162 | } ignore[MAX_IGNORE_LIST]; |
---|
| 163 | |
---|
| 164 | int followtimer; // [MouseJstr] |
---|
| 165 | int followtarget; |
---|
| 166 | |
---|
| 167 | time_t emotionlasttime; // to limit flood with emotion packets |
---|
| 168 | |
---|
| 169 | short skillitem,skillitemlv; |
---|
| 170 | short skillid_old,skilllv_old; |
---|
| 171 | short skillid_dance,skilllv_dance; |
---|
| 172 | char blockskill[MAX_SKILL]; // [celest] |
---|
| 173 | int cloneskill_id; |
---|
| 174 | int menuskill_id, menuskill_val; |
---|
| 175 | |
---|
| 176 | int invincible_timer; |
---|
| 177 | unsigned int canlog_tick; |
---|
| 178 | unsigned int canuseitem_tick; // [Skotlex] |
---|
| 179 | unsigned int cantalk_tick; |
---|
| 180 | unsigned int cansendmail_tick; // [Mail System Flood Protection] |
---|
| 181 | unsigned int ks_floodprotect_tick; // [Kill Steal Protection] |
---|
| 182 | |
---|
| 183 | short weapontype1,weapontype2; |
---|
| 184 | short disguise; // [Valaris] |
---|
| 185 | |
---|
| 186 | struct weapon_data right_weapon, left_weapon; |
---|
| 187 | |
---|
| 188 | // here start arrays to be globally zeroed at the beginning of status_calc_pc() |
---|
| 189 | int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses. |
---|
| 190 | int subele[ELE_MAX]; |
---|
| 191 | int subrace[RC_MAX]; |
---|
| 192 | int subrace2[RC_MAX]; |
---|
| 193 | int subsize[3]; |
---|
| 194 | int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1]; |
---|
| 195 | int weapon_coma_ele[ELE_MAX]; |
---|
| 196 | int weapon_coma_race[RC_MAX]; |
---|
| 197 | int weapon_atk[16]; |
---|
| 198 | int weapon_atk_rate[16]; |
---|
| 199 | int arrow_addele[ELE_MAX]; |
---|
| 200 | int arrow_addrace[RC_MAX]; |
---|
| 201 | int arrow_addsize[3]; |
---|
| 202 | int magic_addele[ELE_MAX]; |
---|
| 203 | int magic_addrace[RC_MAX]; |
---|
| 204 | int magic_addsize[3]; |
---|
| 205 | int critaddrace[RC_MAX]; |
---|
| 206 | int expaddrace[RC_MAX]; |
---|
| 207 | int ignore_mdef[RC_MAX]; |
---|
| 208 | int itemgrouphealrate[MAX_ITEMGROUP]; |
---|
| 209 | short sp_gain_race[RC_MAX]; |
---|
| 210 | // zeroed arrays end here. |
---|
| 211 | // zeroed structures start here |
---|
| 212 | struct s_autospell autospell[15], autospell2[15]; |
---|
| 213 | struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS]; |
---|
| 214 | struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills. |
---|
| 215 | unsigned short id; |
---|
| 216 | short val; |
---|
| 217 | } skillatk[MAX_PC_BONUS], skillheal[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS]; |
---|
| 218 | struct { |
---|
| 219 | short value; |
---|
| 220 | int rate; |
---|
| 221 | int tick; |
---|
| 222 | } hp_loss, sp_loss, hp_regen, sp_regen; |
---|
| 223 | struct { |
---|
| 224 | short class_, rate; |
---|
| 225 | } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS]; |
---|
| 226 | struct s_add_drop add_drop[MAX_PC_BONUS]; |
---|
| 227 | struct { |
---|
| 228 | int nameid; |
---|
| 229 | int rate; |
---|
| 230 | } itemhealrate[MAX_PC_BONUS]; |
---|
| 231 | // zeroed structures end here |
---|
| 232 | // manually zeroed structures start here. |
---|
| 233 | struct s_autoscript autoscript[10], autoscript2[10]; //Auto script on attack, when attacked |
---|
| 234 | // manually zeroed structures end here. |
---|
| 235 | // zeroed vars start here. |
---|
| 236 | int arrow_atk,arrow_ele,arrow_cri,arrow_hit; |
---|
| 237 | int nsshealhp,nsshealsp; |
---|
| 238 | int critical_def,double_rate; |
---|
| 239 | int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex] |
---|
| 240 | int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate; |
---|
| 241 | int ignore_mdef_ele; |
---|
| 242 | int ignore_mdef_race; |
---|
| 243 | int perfect_hit; |
---|
| 244 | int perfect_hit_add; |
---|
| 245 | int get_zeny_rate; |
---|
| 246 | int get_zeny_num; //Added Get Zeny Rate [Skotlex] |
---|
| 247 | int double_add_rate; |
---|
| 248 | int short_weapon_damage_return,long_weapon_damage_return; |
---|
| 249 | int magic_damage_return; // AppleGirl Was Here |
---|
| 250 | int random_attack_increase_add,random_attack_increase_per; // [Valaris] |
---|
| 251 | int break_weapon_rate,break_armor_rate; |
---|
| 252 | int crit_atk_rate; |
---|
| 253 | int classchange; // [Valaris] |
---|
[24] | 254 | int speed_rate, speed_add_rate, aspd_add; |
---|
[1] | 255 | unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex] |
---|
| 256 | |
---|
| 257 | short splash_range, splash_add_range; |
---|
| 258 | short add_steal_rate; |
---|
| 259 | short sp_gain_value, hp_gain_value; |
---|
| 260 | short sp_vanish_rate; |
---|
| 261 | short sp_vanish_per; |
---|
| 262 | unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] |
---|
| 263 | unsigned short unbreakable_equip; //100% break resistance on certain equipment |
---|
| 264 | unsigned short unstripable_equip; |
---|
| 265 | |
---|
| 266 | // zeroed vars end here. |
---|
| 267 | |
---|
| 268 | int castrate,delayrate,hprate,sprate,dsprate; |
---|
| 269 | int atk_rate; |
---|
[24] | 270 | int hprecov_rate,sprecov_rate; |
---|
[1] | 271 | int matk_rate; |
---|
| 272 | int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate; |
---|
| 273 | |
---|
| 274 | int itemid; |
---|
| 275 | short itemindex; //Used item's index in sd->inventory [Skotlex] |
---|
| 276 | |
---|
| 277 | short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo] |
---|
| 278 | |
---|
| 279 | short spiritball, spiritball_old; |
---|
| 280 | int spirit_timer[MAX_SKILL_LEVEL]; |
---|
| 281 | |
---|
| 282 | unsigned char potion_success_counter; //Potion successes in row counter |
---|
| 283 | unsigned char mission_count; //Stores the bounty kill count for TK_MISSION |
---|
| 284 | short mission_mobid; //Stores the target mob_id for TK_MISSION |
---|
| 285 | int die_counter; //Total number of times you've died |
---|
| 286 | int devotion[5]; //Stores the account IDs of chars devoted to. |
---|
| 287 | int reg_num; //Number of registries (type numeric) |
---|
| 288 | int regstr_num; //Number of registries (type string) |
---|
| 289 | |
---|
| 290 | struct script_reg *reg; |
---|
| 291 | struct script_regstr *regstr; |
---|
| 292 | |
---|
| 293 | int trade_partner; |
---|
| 294 | struct { |
---|
| 295 | struct { |
---|
| 296 | short index, amount; |
---|
| 297 | } item[10]; |
---|
| 298 | int zeny, weight; |
---|
| 299 | } deal; |
---|
| 300 | |
---|
| 301 | bool party_creating; // whether the char is requesting party creation |
---|
| 302 | bool party_joining; // whether the char is accepting party invitation |
---|
| 303 | int party_invite, party_invite_account; // for handling party invitation (holds party id and account id) |
---|
| 304 | int adopt_invite; // Adoption |
---|
| 305 | |
---|
| 306 | int guild_invite,guild_invite_account; |
---|
| 307 | int guild_emblem_id,guild_alliance,guild_alliance_account; |
---|
| 308 | short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo] |
---|
| 309 | int guildspy; // [Syrus22] |
---|
| 310 | int partyspy; // [Syrus22] |
---|
| 311 | |
---|
| 312 | int vender_id; |
---|
| 313 | int vend_num; |
---|
| 314 | char message[MESSAGE_SIZE]; |
---|
| 315 | struct s_vending vending[MAX_VENDING]; |
---|
| 316 | |
---|
| 317 | struct pet_data *pd; |
---|
| 318 | struct homun_data *hd; // [blackhole89] |
---|
| 319 | |
---|
| 320 | struct{ |
---|
| 321 | int m; //-1 - none, other: map index corresponding to map name. |
---|
| 322 | unsigned short index; //map index |
---|
| 323 | }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars |
---|
| 324 | short hate_mob[3]; |
---|
| 325 | |
---|
| 326 | int pvp_timer; |
---|
| 327 | short pvp_point; |
---|
| 328 | unsigned short pvp_rank, pvp_lastusers; |
---|
| 329 | unsigned short pvp_won, pvp_lost; |
---|
| 330 | |
---|
| 331 | char eventqueue[MAX_EVENTQUEUE][50]; |
---|
| 332 | int eventtimer[MAX_EVENTTIMER]; |
---|
| 333 | unsigned short eventcount; // [celest] |
---|
| 334 | |
---|
| 335 | unsigned char change_level; // [celest] |
---|
| 336 | |
---|
| 337 | char fakename[NAME_LENGTH]; // fake names [Valaris] |
---|
| 338 | |
---|
| 339 | int duel_group; // duel vars [LuzZza] |
---|
| 340 | int duel_invite; |
---|
| 341 | |
---|
| 342 | char away_message[128]; // [LuzZza] |
---|
| 343 | |
---|
| 344 | int cashPoints, kafraPoints; |
---|
| 345 | |
---|
| 346 | // Auction System [Zephyrus] |
---|
| 347 | struct { |
---|
| 348 | int index, amount; |
---|
| 349 | } auction; |
---|
| 350 | |
---|
| 351 | // Mail System [Zephyrus] |
---|
| 352 | struct { |
---|
| 353 | short nameid; |
---|
| 354 | int index, amount, zeny; |
---|
| 355 | struct mail_data inbox; |
---|
| 356 | } mail; |
---|
| 357 | |
---|
| 358 | //Quest log system [Kevin] |
---|
| 359 | int num_quests; |
---|
| 360 | struct quest quest_log[MAX_QUEST]; |
---|
| 361 | |
---|
| 362 | // temporary debug [flaviojs] |
---|
| 363 | const char* debug_file; |
---|
| 364 | int debug_line; |
---|
| 365 | const char* debug_func; |
---|
| 366 | }; |
---|
| 367 | |
---|
| 368 | |
---|
| 369 | //Update this max as necessary. 54 is the value needed for Super Baby currently |
---|
| 370 | #define MAX_SKILL_TREE 54 |
---|
| 371 | //Total number of classes (for data storage) |
---|
| 372 | #define CLASS_COUNT (JOB_MAX - JOB_NOVICE_HIGH + JOB_MAX_BASIC) |
---|
| 373 | |
---|
| 374 | enum weapon_type { |
---|
| 375 | W_FIST, //Bare hands |
---|
| 376 | W_DAGGER, //1 |
---|
| 377 | W_1HSWORD, //2 |
---|
| 378 | W_2HSWORD, //3 |
---|
| 379 | W_1HSPEAR, //4 |
---|
| 380 | W_2HSPEAR, //5 |
---|
| 381 | W_1HAXE, //6 |
---|
| 382 | W_2HAXE, //7 |
---|
| 383 | W_MACE, //8 |
---|
| 384 | W_2HMACE, //9 (unused) |
---|
| 385 | W_STAFF, //10 |
---|
| 386 | W_BOW, //11 |
---|
| 387 | W_KNUCKLE, //12 |
---|
| 388 | W_MUSICAL, //13 |
---|
| 389 | W_WHIP, //14 |
---|
| 390 | W_BOOK, //15 |
---|
| 391 | W_KATAR, //16 |
---|
| 392 | W_REVOLVER, //17 |
---|
| 393 | W_RIFLE, //18 |
---|
| 394 | W_GATLING, //19 |
---|
| 395 | W_SHOTGUN, //20 |
---|
| 396 | W_GRENADE, //21 |
---|
| 397 | W_HUUMA, //22 |
---|
| 398 | W_2HSTAFF, //23 |
---|
| 399 | MAX_WEAPON_TYPE, |
---|
| 400 | // dual-wield constants |
---|
| 401 | W_DOUBLE_DD, // 2 daggers |
---|
| 402 | W_DOUBLE_SS, // 2 swords |
---|
| 403 | W_DOUBLE_AA, // 2 axes |
---|
| 404 | W_DOUBLE_DS, // dagger + sword |
---|
| 405 | W_DOUBLE_DA, // dagger + axe |
---|
| 406 | W_DOUBLE_SA, // sword + axe |
---|
| 407 | }; |
---|
| 408 | |
---|
| 409 | enum ammo_type { |
---|
| 410 | A_ARROW = 1, |
---|
| 411 | A_DAGGER, //2 |
---|
| 412 | A_BULLET, //3 |
---|
| 413 | A_SHELL, //4 |
---|
| 414 | A_GRENADE, //5 |
---|
| 415 | A_SHURIKEN, //6 |
---|
| 416 | A_KUNAI //7 |
---|
| 417 | }; |
---|
| 418 | |
---|
| 419 | //Equip position constants |
---|
| 420 | enum equip_pos { |
---|
| 421 | EQP_HEAD_LOW = 0x0001, |
---|
| 422 | EQP_HEAD_MID = 0x0200, //512 |
---|
| 423 | EQP_HEAD_TOP = 0x0100, //256 |
---|
| 424 | EQP_HAND_R = 0x0002, |
---|
| 425 | EQP_HAND_L = 0x0020, //32 |
---|
| 426 | EQP_ARMOR = 0x0010, //16 |
---|
| 427 | EQP_SHOES = 0x0040, //64 |
---|
| 428 | EQP_GARMENT = 0x0004, |
---|
| 429 | EQP_ACC_L = 0x0008, |
---|
| 430 | EQP_ACC_R = 0x0080, //128 |
---|
| 431 | EQP_AMMO = 0x8000, //32768 |
---|
| 432 | }; |
---|
| 433 | |
---|
| 434 | #define EQP_WEAPON EQP_HAND_R |
---|
| 435 | #define EQP_SHIELD EQP_HAND_L |
---|
| 436 | #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L) |
---|
| 437 | #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP) |
---|
| 438 | #define EQP_ACC (EQP_ACC_L|EQP_ACC_R) |
---|
| 439 | |
---|
| 440 | //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index |
---|
| 441 | //where the arrows are equipped) |
---|
| 442 | enum equip_index { |
---|
| 443 | EQI_ACC_L = 0, |
---|
| 444 | EQI_ACC_R, |
---|
| 445 | EQI_SHOES, |
---|
| 446 | EQI_GARMENT, |
---|
| 447 | EQI_HEAD_LOW, |
---|
| 448 | EQI_HEAD_MID, |
---|
| 449 | EQI_HEAD_TOP, |
---|
| 450 | EQI_ARMOR, |
---|
| 451 | EQI_HAND_L, |
---|
| 452 | EQI_HAND_R, |
---|
| 453 | EQI_AMMO, |
---|
| 454 | EQI_MAX |
---|
| 455 | }; |
---|
| 456 | |
---|
| 457 | struct duel { |
---|
| 458 | int members_count; |
---|
| 459 | int invites_count; |
---|
| 460 | int max_players_limit; |
---|
| 461 | }; |
---|
| 462 | |
---|
| 463 | #define MAX_DUEL 1024 |
---|
| 464 | extern struct duel duel_list[MAX_DUEL]; |
---|
| 465 | extern int duel_count; |
---|
| 466 | |
---|
| 467 | #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ) |
---|
| 468 | #define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ) |
---|
| 469 | #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 ) |
---|
| 470 | #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 ) |
---|
| 471 | #define pc_isidle(sd) ( (sd)->chatID || (sd)->vender_id || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share ) |
---|
| 472 | #define pc_istrading(sd) ( (sd)->npc_id || (sd)->vender_id || (sd)->state.trading ) |
---|
| 473 | #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->vender_id || (sd)->chatID || (sd)->sc.opt1 || (sd)->state.trading || (sd)->state.storage_flag ) |
---|
| 474 | #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) ) |
---|
| 475 | #define pc_setchatid(sd,n) ( (sd)->chatID = n ) |
---|
| 476 | #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) ) |
---|
| 477 | #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) ) |
---|
| 478 | #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK ) |
---|
| 479 | #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART ) |
---|
| 480 | #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON ) |
---|
| 481 | #define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING ) |
---|
| 482 | #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE ) |
---|
| 483 | #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate ) |
---|
| 484 | #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) |
---|
| 485 | #define pc_maxparameter(sd) ( (sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter ) |
---|
| 486 | |
---|
| 487 | #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type) |
---|
| 488 | #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl) |
---|
| 489 | |
---|
| 490 | //Weapon check considering dual wielding. |
---|
| 491 | #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \ |
---|
| 492 | 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2))) |
---|
| 493 | //Checks if the given class value corresponds to a player class. [Skotlex] |
---|
| 494 | #define pcdb_checkid(class_) (class_ < JOB_MAX_BASIC || (class_ >= JOB_NOVICE_HIGH && class_ < JOB_MAX)) |
---|
| 495 | |
---|
| 496 | int pc_class2idx(int class_); |
---|
| 497 | int pc_isGM(struct map_session_data *sd); |
---|
| 498 | int pc_getrefinebonus(int lv,int type); |
---|
| 499 | bool pc_can_give_items(int level); |
---|
| 500 | |
---|
| 501 | int pc_setrestartvalue(struct map_session_data *sd,int type); |
---|
| 502 | int pc_makesavestatus(struct map_session_data *); |
---|
| 503 | void pc_respawn(struct map_session_data* sd, uint8 clrtype); |
---|
| 504 | int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int); |
---|
| 505 | bool pc_authok(struct map_session_data*, int, time_t, struct mmo_charstatus *); |
---|
| 506 | void pc_authfail(struct map_session_data *); |
---|
| 507 | int pc_reg_received(struct map_session_data *sd); |
---|
| 508 | |
---|
| 509 | int pc_isequip(struct map_session_data *sd,int n); |
---|
| 510 | int pc_equippoint(struct map_session_data *sd,int n); |
---|
| 511 | int pc_setinventorydata(struct map_session_data *sd); |
---|
| 512 | |
---|
| 513 | int pc_checkskill(struct map_session_data *sd,int skill_id); |
---|
| 514 | int pc_checkallowskill(struct map_session_data *sd); |
---|
| 515 | int pc_checkequip(struct map_session_data *sd,int pos); |
---|
| 516 | |
---|
| 517 | int pc_calc_skilltree(struct map_session_data *sd); |
---|
| 518 | int pc_calc_skilltree_normalize_job(struct map_session_data *sd); |
---|
| 519 | int pc_clean_skilltree(struct map_session_data *sd); |
---|
| 520 | |
---|
| 521 | #define pc_checkoverhp(sd) (sd->battle_status.hp == sd->battle_status.max_hp) |
---|
| 522 | #define pc_checkoversp(sd) (sd->battle_status.sp == sd->battle_status.max_sp) |
---|
| 523 | |
---|
| 524 | int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype); |
---|
| 525 | int pc_setsavepoint(struct map_session_data*,short,int,int); |
---|
| 526 | int pc_randomwarp(struct map_session_data *sd,int type); |
---|
| 527 | int pc_memo(struct map_session_data* sd, int pos); |
---|
| 528 | int pc_remove_map(struct map_session_data *sd,int clrtype); |
---|
| 529 | |
---|
| 530 | int pc_checkadditem(struct map_session_data*,int,int); |
---|
| 531 | int pc_inventoryblank(struct map_session_data*); |
---|
| 532 | int pc_search_inventory(struct map_session_data *sd,int item_id); |
---|
| 533 | int pc_payzeny(struct map_session_data*,int); |
---|
| 534 | int pc_additem(struct map_session_data*,struct item*,int); |
---|
| 535 | int pc_getzeny(struct map_session_data*,int); |
---|
| 536 | int pc_delitem(struct map_session_data*,int,int,int); |
---|
| 537 | |
---|
| 538 | // Special Shop System |
---|
| 539 | void pc_paycash(struct map_session_data *sd, int price, int points); |
---|
| 540 | void pc_getcash(struct map_session_data *sd, int cash, int points); |
---|
| 541 | |
---|
| 542 | int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount); |
---|
| 543 | int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type); |
---|
| 544 | int pc_putitemtocart(struct map_session_data *sd,int idx,int amount); |
---|
| 545 | int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount); |
---|
| 546 | int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount); |
---|
| 547 | |
---|
| 548 | int pc_takeitem(struct map_session_data*,struct flooritem_data*); |
---|
| 549 | int pc_dropitem(struct map_session_data*,int,int); |
---|
| 550 | |
---|
| 551 | bool pc_isequipped(struct map_session_data *sd, int nameid); |
---|
| 552 | bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd ); |
---|
| 553 | bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd); |
---|
| 554 | |
---|
| 555 | int pc_updateweightstatus(struct map_session_data *sd); |
---|
| 556 | |
---|
| 557 | int pc_autoscript_add(struct s_autoscript *scripts, int max, short rate, short flag, struct script_code *script); |
---|
| 558 | void pc_autoscript_clear(struct s_autoscript *scripts, int max); |
---|
| 559 | |
---|
| 560 | int pc_bonus(struct map_session_data*,int,int); |
---|
| 561 | int pc_bonus2(struct map_session_data *sd,int,int,int); |
---|
| 562 | int pc_bonus3(struct map_session_data *sd,int,int,int,int); |
---|
| 563 | int pc_bonus4(struct map_session_data *sd,int,int,int,int,int); |
---|
| 564 | int pc_bonus5(struct map_session_data *sd,int,int,int,int,int,int); |
---|
| 565 | int pc_skill(struct map_session_data* sd, int id, int level, int flag); |
---|
| 566 | |
---|
| 567 | int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip); |
---|
| 568 | |
---|
| 569 | int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int skilllv); |
---|
| 570 | int pc_steal_coin(struct map_session_data *sd,struct block_list *bl); |
---|
| 571 | |
---|
| 572 | int pc_modifybuyvalue(struct map_session_data*,int); |
---|
| 573 | int pc_modifysellvalue(struct map_session_data*,int); |
---|
| 574 | |
---|
| 575 | int pc_follow(struct map_session_data*, int); // [MouseJstr] |
---|
| 576 | int pc_stop_following(struct map_session_data*); |
---|
| 577 | |
---|
| 578 | unsigned int pc_maxbaselv(struct map_session_data *sd); |
---|
| 579 | unsigned int pc_maxjoblv(struct map_session_data *sd); |
---|
| 580 | int pc_checkbaselevelup(struct map_session_data *sd); |
---|
| 581 | int pc_checkjoblevelup(struct map_session_data *sd); |
---|
| 582 | int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int); |
---|
| 583 | unsigned int pc_nextbaseexp(struct map_session_data *); |
---|
| 584 | unsigned int pc_thisbaseexp(struct map_session_data *); |
---|
| 585 | unsigned int pc_nextjobexp(struct map_session_data *); |
---|
| 586 | unsigned int pc_thisjobexp(struct map_session_data *); |
---|
| 587 | int pc_need_status_point(struct map_session_data *,int); |
---|
| 588 | int pc_statusup(struct map_session_data*,int); |
---|
| 589 | int pc_statusup2(struct map_session_data*,int,int); |
---|
| 590 | int pc_skillup(struct map_session_data*,int); |
---|
| 591 | int pc_allskillup(struct map_session_data*); |
---|
| 592 | int pc_resetlvl(struct map_session_data*,int type); |
---|
| 593 | int pc_resetstate(struct map_session_data*); |
---|
| 594 | int pc_resetskill(struct map_session_data*, int); |
---|
| 595 | int pc_resetfeel(struct map_session_data*); |
---|
| 596 | int pc_resethate(struct map_session_data*); |
---|
| 597 | int pc_equipitem(struct map_session_data*,int,int); |
---|
| 598 | int pc_unequipitem(struct map_session_data*,int,int); |
---|
| 599 | int pc_checkitem(struct map_session_data*); |
---|
| 600 | int pc_useitem(struct map_session_data*,int); |
---|
| 601 | |
---|
| 602 | int pc_skillatk_bonus(struct map_session_data *sd, int skill_num); |
---|
| 603 | int pc_skillheal_bonus(struct map_session_data *sd, int skill_num); |
---|
| 604 | |
---|
| 605 | void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp); |
---|
| 606 | int pc_dead(struct map_session_data *sd,struct block_list *src); |
---|
| 607 | void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp); |
---|
| 608 | void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type); |
---|
| 609 | int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp); |
---|
| 610 | int pc_percentheal(struct map_session_data *sd,int,int); |
---|
| 611 | int pc_jobchange(struct map_session_data *,int, int); |
---|
| 612 | int pc_setoption(struct map_session_data *,int); |
---|
| 613 | int pc_setcart(struct map_session_data* sd, int type); |
---|
| 614 | int pc_setfalcon(struct map_session_data* sd, int flag); |
---|
| 615 | int pc_setriding(struct map_session_data* sd, int flag); |
---|
| 616 | int pc_changelook(struct map_session_data *,int,int); |
---|
| 617 | int pc_equiplookall(struct map_session_data *sd); |
---|
| 618 | |
---|
| 619 | int pc_readparam(struct map_session_data*,int); |
---|
| 620 | int pc_setparam(struct map_session_data*,int,int); |
---|
| 621 | int pc_readreg(struct map_session_data*,int); |
---|
| 622 | int pc_setreg(struct map_session_data*,int,int); |
---|
| 623 | char *pc_readregstr(struct map_session_data *sd,int reg); |
---|
| 624 | int pc_setregstr(struct map_session_data *sd,int reg,const char *str); |
---|
| 625 | |
---|
| 626 | #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg,3) |
---|
| 627 | #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val,3) |
---|
| 628 | #define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg,3) |
---|
| 629 | #define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val,3) |
---|
| 630 | #define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg,2) |
---|
| 631 | #define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val,2) |
---|
| 632 | #define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg,2) |
---|
| 633 | #define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val,2) |
---|
| 634 | #define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg,1) |
---|
| 635 | #define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val,1) |
---|
| 636 | #define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg,1) |
---|
| 637 | #define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val,1) |
---|
| 638 | int pc_readregistry(struct map_session_data*,const char*,int); |
---|
| 639 | int pc_setregistry(struct map_session_data*,const char*,int,int); |
---|
| 640 | char *pc_readregistry_str(struct map_session_data*,char*,int); |
---|
| 641 | int pc_setregistry_str(struct map_session_data*,char*,const char*,int); |
---|
| 642 | |
---|
| 643 | int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name); |
---|
| 644 | int pc_deleventtimer(struct map_session_data *sd,const char *name); |
---|
| 645 | int pc_cleareventtimer(struct map_session_data *sd); |
---|
| 646 | int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick); |
---|
| 647 | |
---|
| 648 | int pc_calc_pvprank(struct map_session_data *sd); |
---|
| 649 | int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr data); |
---|
| 650 | |
---|
| 651 | int pc_ismarried(struct map_session_data *sd); |
---|
| 652 | int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd); |
---|
| 653 | int pc_divorce(struct map_session_data *sd); |
---|
| 654 | struct map_session_data *pc_get_partner(struct map_session_data *sd); |
---|
| 655 | struct map_session_data *pc_get_father(struct map_session_data *sd); |
---|
| 656 | struct map_session_data *pc_get_mother(struct map_session_data *sd); |
---|
| 657 | struct map_session_data *pc_get_child(struct map_session_data *sd); |
---|
| 658 | |
---|
| 659 | void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick); |
---|
| 660 | void pc_regen (struct map_session_data *sd, unsigned int diff_tick); |
---|
| 661 | |
---|
| 662 | int pc_set_gm_level(int account_id, int level); |
---|
| 663 | void pc_setstand(struct map_session_data *sd); |
---|
| 664 | int pc_candrop(struct map_session_data *sd,struct item *item); |
---|
| 665 | |
---|
| 666 | int pc_jobid2mapid(unsigned short b_class); // Skotlex |
---|
| 667 | int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex |
---|
| 668 | |
---|
| 669 | char * job_name(int class_); |
---|
| 670 | |
---|
| 671 | struct skill_tree_entry { |
---|
| 672 | short id; |
---|
| 673 | unsigned char max; |
---|
| 674 | unsigned char joblv; |
---|
| 675 | struct { |
---|
| 676 | short id; |
---|
| 677 | unsigned char lv; |
---|
| 678 | } need[5]; |
---|
| 679 | }; // Celest |
---|
| 680 | extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE]; |
---|
| 681 | |
---|
| 682 | struct sg_data { |
---|
| 683 | short anger_id; |
---|
| 684 | short bless_id; |
---|
| 685 | short comfort_id; |
---|
| 686 | char feel_var[NAME_LENGTH]; |
---|
| 687 | char hate_var[NAME_LENGTH]; |
---|
| 688 | int (*day_func)(void); |
---|
| 689 | }; |
---|
| 690 | extern const struct sg_data sg_info[3]; |
---|
| 691 | |
---|
| 692 | int pc_read_gm_account(int fd); |
---|
| 693 | void pc_setinvincibletimer(struct map_session_data* sd, int val); |
---|
| 694 | void pc_delinvincibletimer(struct map_session_data* sd); |
---|
| 695 | |
---|
| 696 | int pc_addspiritball(struct map_session_data *sd,int,int); |
---|
| 697 | int pc_delspiritball(struct map_session_data *sd,int,int); |
---|
| 698 | void pc_addfame(struct map_session_data *sd,int count); |
---|
| 699 | unsigned char pc_famerank(int char_id, int job); |
---|
| 700 | int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl); |
---|
| 701 | |
---|
| 702 | extern struct fame_list smith_fame_list[MAX_FAME_LIST]; |
---|
| 703 | extern struct fame_list chemist_fame_list[MAX_FAME_LIST]; |
---|
| 704 | extern struct fame_list taekwon_fame_list[MAX_FAME_LIST]; |
---|
| 705 | |
---|
| 706 | int pc_readdb(void); |
---|
| 707 | int do_init_pc(void); |
---|
| 708 | void do_final_pc(void); |
---|
| 709 | |
---|
| 710 | enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT}; |
---|
| 711 | |
---|
| 712 | // timer for night.day |
---|
| 713 | extern int day_timer_tid; |
---|
| 714 | extern int night_timer_tid; |
---|
| 715 | int map_day_timer(int tid, unsigned int tick, int id, intptr data); // by [yor] |
---|
| 716 | int map_night_timer(int tid, unsigned int tick, int id, intptr data); // by [yor] |
---|
| 717 | |
---|
| 718 | //Duel functions // [LuzZza] |
---|
| 719 | int duel_create(struct map_session_data* sd, const unsigned int maxpl); |
---|
| 720 | int duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd); |
---|
| 721 | int duel_accept(const unsigned int did, struct map_session_data* sd); |
---|
| 722 | int duel_reject(const unsigned int did, struct map_session_data* sd); |
---|
| 723 | int duel_leave(const unsigned int did, struct map_session_data* sd); |
---|
| 724 | int duel_showinfo(const unsigned int did, struct map_session_data* sd); |
---|
| 725 | int duel_checktime(struct map_session_data* sd); |
---|
| 726 | |
---|
| 727 | int pc_read_motd(void); // [Valaris] |
---|
| 728 | int pc_disguise(struct map_session_data *sd, int class_); |
---|
| 729 | |
---|
| 730 | #endif /* _PC_H_ */ |
---|