[37] | 1 | /* |
---|
[102] | 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
[44] | 4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
[37] | 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify |
---|
| 7 | * it under the terms of the GNU General Public License as published by |
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 9 | * (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
[44] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[37] | 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License |
---|
| 17 | * along with this program; if not, write to the Free Software |
---|
[44] | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[37] | 19 | */ |
---|
| 20 | |
---|
| 21 | #ifndef _PLAYER_H |
---|
| 22 | #define _PLAYER_H |
---|
| 23 | |
---|
| 24 | #include "Common.h" |
---|
| 25 | #include "ItemPrototype.h" |
---|
| 26 | #include "Unit.h" |
---|
| 27 | #include "Item.h" |
---|
| 28 | |
---|
| 29 | #include "Database/DatabaseEnv.h" |
---|
| 30 | #include "NPCHandler.h" |
---|
| 31 | #include "QuestDef.h" |
---|
| 32 | #include "Group.h" |
---|
| 33 | #include "Bag.h" |
---|
| 34 | #include "WorldSession.h" |
---|
| 35 | #include "Pet.h" |
---|
| 36 | #include "Util.h" // for Tokens typedef |
---|
| 37 | |
---|
| 38 | #include<string> |
---|
| 39 | #include<vector> |
---|
| 40 | |
---|
| 41 | struct Mail; |
---|
| 42 | class Channel; |
---|
| 43 | class DynamicObject; |
---|
| 44 | class Creature; |
---|
| 45 | class Pet; |
---|
| 46 | class PlayerMenu; |
---|
| 47 | class Transport; |
---|
| 48 | class UpdateMask; |
---|
| 49 | class PlayerSocial; |
---|
[44] | 50 | class OutdoorPvP; |
---|
[37] | 51 | |
---|
| 52 | typedef std::deque<Mail*> PlayerMails; |
---|
| 53 | |
---|
| 54 | #define PLAYER_MAX_SKILLS 127 |
---|
| 55 | #define PLAYER_MAX_DAILY_QUESTS 25 |
---|
| 56 | |
---|
| 57 | // Note: SPELLMOD_* values is aura types in fact |
---|
| 58 | enum SpellModType |
---|
| 59 | { |
---|
| 60 | SPELLMOD_FLAT = 107, // SPELL_AURA_ADD_FLAT_MODIFIER |
---|
| 61 | SPELLMOD_PCT = 108 // SPELL_AURA_ADD_PCT_MODIFIER |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | enum PlayerSpellState |
---|
| 65 | { |
---|
| 66 | PLAYERSPELL_UNCHANGED = 0, |
---|
| 67 | PLAYERSPELL_CHANGED = 1, |
---|
| 68 | PLAYERSPELL_NEW = 2, |
---|
| 69 | PLAYERSPELL_REMOVED = 3 |
---|
| 70 | }; |
---|
| 71 | |
---|
| 72 | struct PlayerSpell |
---|
| 73 | { |
---|
| 74 | uint16 slotId : 16; |
---|
| 75 | PlayerSpellState state : 8; |
---|
| 76 | bool active : 1; |
---|
| 77 | bool disabled : 1; |
---|
| 78 | }; |
---|
| 79 | |
---|
| 80 | #define SPELL_WITHOUT_SLOT_ID uint16(-1) |
---|
| 81 | |
---|
| 82 | struct SpellModifier |
---|
| 83 | { |
---|
| 84 | SpellModOp op : 8; |
---|
| 85 | SpellModType type : 8; |
---|
| 86 | int16 charges : 16; |
---|
| 87 | int32 value; |
---|
| 88 | uint64 mask; |
---|
| 89 | uint32 spellId; |
---|
| 90 | uint32 effectId; |
---|
| 91 | Spell const* lastAffected; |
---|
| 92 | }; |
---|
| 93 | |
---|
| 94 | typedef HM_NAMESPACE::hash_map<uint16, PlayerSpell*> PlayerSpellMap; |
---|
| 95 | typedef std::list<SpellModifier*> SpellModList; |
---|
| 96 | |
---|
| 97 | struct SpellCooldown |
---|
| 98 | { |
---|
| 99 | time_t end; |
---|
| 100 | uint16 itemid; |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | typedef std::map<uint32, SpellCooldown> SpellCooldowns; |
---|
| 104 | |
---|
| 105 | enum TrainerSpellState |
---|
| 106 | { |
---|
| 107 | TRAINER_SPELL_GREEN = 0, |
---|
| 108 | TRAINER_SPELL_RED = 1, |
---|
| 109 | TRAINER_SPELL_GRAY = 2 |
---|
| 110 | }; |
---|
| 111 | |
---|
| 112 | enum ActionButtonUpdateState |
---|
| 113 | { |
---|
| 114 | ACTIONBUTTON_UNCHANGED = 0, |
---|
| 115 | ACTIONBUTTON_CHANGED = 1, |
---|
| 116 | ACTIONBUTTON_NEW = 2, |
---|
| 117 | ACTIONBUTTON_DELETED = 3 |
---|
| 118 | }; |
---|
| 119 | |
---|
| 120 | struct ActionButton |
---|
| 121 | { |
---|
| 122 | ActionButton() : action(0), type(0), misc(0), uState( ACTIONBUTTON_NEW ) {} |
---|
| 123 | ActionButton(uint16 _action, uint8 _type, uint8 _misc) : action(_action), type(_type), misc(_misc), uState( ACTIONBUTTON_NEW ) {} |
---|
| 124 | |
---|
| 125 | uint16 action; |
---|
| 126 | uint8 type; |
---|
| 127 | uint8 misc; |
---|
| 128 | ActionButtonUpdateState uState; |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | enum ActionButtonType |
---|
| 132 | { |
---|
| 133 | ACTION_BUTTON_SPELL = 0, |
---|
| 134 | ACTION_BUTTON_MACRO = 64, |
---|
| 135 | ACTION_BUTTON_CMACRO= 65, |
---|
| 136 | ACTION_BUTTON_ITEM = 128 |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | #define MAX_ACTION_BUTTONS 132 //checked in 2.3.0 |
---|
| 140 | |
---|
| 141 | typedef std::map<uint8,ActionButton> ActionButtonList; |
---|
| 142 | |
---|
| 143 | typedef std::pair<uint16, uint8> CreateSpellPair; |
---|
| 144 | |
---|
| 145 | struct PlayerCreateInfoItem |
---|
| 146 | { |
---|
| 147 | PlayerCreateInfoItem(uint32 id, uint32 amount) : item_id(id), item_amount(amount) {} |
---|
| 148 | |
---|
| 149 | uint32 item_id; |
---|
| 150 | uint32 item_amount; |
---|
| 151 | }; |
---|
| 152 | |
---|
| 153 | typedef std::list<PlayerCreateInfoItem> PlayerCreateInfoItems; |
---|
| 154 | |
---|
| 155 | struct PlayerClassLevelInfo |
---|
| 156 | { |
---|
| 157 | PlayerClassLevelInfo() : basehealth(0), basemana(0) {} |
---|
| 158 | uint16 basehealth; |
---|
| 159 | uint16 basemana; |
---|
| 160 | }; |
---|
| 161 | |
---|
| 162 | struct PlayerClassInfo |
---|
| 163 | { |
---|
| 164 | PlayerClassInfo() : levelInfo(NULL) { } |
---|
| 165 | |
---|
| 166 | PlayerClassLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 |
---|
| 167 | }; |
---|
| 168 | |
---|
| 169 | struct PlayerLevelInfo |
---|
| 170 | { |
---|
| 171 | PlayerLevelInfo() { for(int i=0; i < MAX_STATS; ++i ) stats[i] = 0; } |
---|
| 172 | |
---|
| 173 | uint8 stats[MAX_STATS]; |
---|
| 174 | }; |
---|
| 175 | |
---|
| 176 | struct PlayerInfo |
---|
| 177 | { |
---|
| 178 | // existence checked by displayId != 0 // existence checked by displayId != 0 |
---|
| 179 | PlayerInfo() : displayId_m(0),displayId_f(0),levelInfo(NULL) |
---|
| 180 | { |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | uint32 mapId; |
---|
| 184 | uint32 zoneId; |
---|
| 185 | float positionX; |
---|
| 186 | float positionY; |
---|
| 187 | float positionZ; |
---|
| 188 | uint16 displayId_m; |
---|
| 189 | uint16 displayId_f; |
---|
| 190 | PlayerCreateInfoItems item; |
---|
| 191 | std::list<CreateSpellPair> spell; |
---|
| 192 | std::list<uint16> action[4]; |
---|
| 193 | |
---|
| 194 | PlayerLevelInfo* levelInfo; //[level-1] 0..MaxPlayerLevel-1 |
---|
| 195 | }; |
---|
| 196 | |
---|
| 197 | struct PvPInfo |
---|
| 198 | { |
---|
| 199 | PvPInfo() : inHostileArea(false), endTimer(0) {} |
---|
| 200 | |
---|
| 201 | bool inHostileArea; |
---|
| 202 | time_t endTimer; |
---|
| 203 | }; |
---|
| 204 | |
---|
| 205 | struct DuelInfo |
---|
| 206 | { |
---|
| 207 | DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0) {} |
---|
| 208 | |
---|
| 209 | Player *initiator; |
---|
| 210 | Player *opponent; |
---|
| 211 | time_t startTimer; |
---|
| 212 | time_t startTime; |
---|
| 213 | time_t outOfBound; |
---|
| 214 | }; |
---|
| 215 | |
---|
| 216 | struct Areas |
---|
| 217 | { |
---|
| 218 | uint32 areaID; |
---|
| 219 | uint32 areaFlag; |
---|
| 220 | float x1; |
---|
| 221 | float x2; |
---|
| 222 | float y1; |
---|
| 223 | float y2; |
---|
| 224 | }; |
---|
| 225 | |
---|
| 226 | enum FactionFlags |
---|
| 227 | { |
---|
| 228 | FACTION_FLAG_VISIBLE = 0x01, // makes visible in client (set or can be set at interaction with target of this faction) |
---|
| 229 | FACTION_FLAG_AT_WAR = 0x02, // enable AtWar-button in client. player controlled (except opposition team always war state), Flag only set on initial creation |
---|
| 230 | FACTION_FLAG_HIDDEN = 0x04, // hidden faction from reputation pane in client (player can gain reputation, but this update not sent to client) |
---|
| 231 | FACTION_FLAG_INVISIBLE_FORCED = 0x08, // always overwrite FACTION_FLAG_VISIBLE and hide faction in rep.list, used for hide opposite team factions |
---|
| 232 | FACTION_FLAG_PEACE_FORCED = 0x10, // always overwrite FACTION_FLAG_AT_WAR, used for prevent war with own team factions |
---|
| 233 | FACTION_FLAG_INACTIVE = 0x20, // player controlled, state stored in characters.data ( CMSG_SET_FACTION_INACTIVE ) |
---|
| 234 | FACTION_FLAG_RIVAL = 0x40 // flag for the two competing outland factions |
---|
| 235 | }; |
---|
| 236 | |
---|
| 237 | typedef uint32 RepListID; |
---|
| 238 | struct FactionState |
---|
| 239 | { |
---|
| 240 | uint32 ID; |
---|
| 241 | RepListID ReputationListID; |
---|
| 242 | uint32 Flags; |
---|
| 243 | int32 Standing; |
---|
| 244 | bool Changed; |
---|
| 245 | }; |
---|
| 246 | |
---|
| 247 | typedef std::map<RepListID,FactionState> FactionStateList; |
---|
| 248 | |
---|
| 249 | typedef std::map<uint32,ReputationRank> ForcedReactions; |
---|
| 250 | |
---|
| 251 | typedef std::set<uint64> GuardianPetList; |
---|
| 252 | |
---|
| 253 | struct EnchantDuration |
---|
| 254 | { |
---|
| 255 | EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {}; |
---|
| 256 | EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { assert(item); }; |
---|
| 257 | |
---|
| 258 | Item * item; |
---|
| 259 | EnchantmentSlot slot; |
---|
| 260 | uint32 leftduration; |
---|
| 261 | }; |
---|
| 262 | |
---|
| 263 | typedef std::list<EnchantDuration> EnchantDurationList; |
---|
| 264 | typedef std::list<Item*> ItemDurationList; |
---|
| 265 | |
---|
| 266 | struct LookingForGroupSlot |
---|
| 267 | { |
---|
| 268 | LookingForGroupSlot() : entry(0), type(0) {} |
---|
| 269 | bool Empty() const { return !entry && !type; } |
---|
| 270 | void Clear() { entry = 0; type = 0; } |
---|
| 271 | void Set(uint32 _entry, uint32 _type ) { entry = _entry; type = _type; } |
---|
| 272 | bool Is(uint32 _entry, uint32 _type) const { return entry==_entry && type==_type; } |
---|
| 273 | bool canAutoJoin() const { return entry && (type == 1 || type == 5); } |
---|
| 274 | |
---|
| 275 | uint32 entry; |
---|
| 276 | uint32 type; |
---|
| 277 | }; |
---|
| 278 | |
---|
| 279 | #define MAX_LOOKING_FOR_GROUP_SLOT 3 |
---|
| 280 | |
---|
| 281 | struct LookingForGroup |
---|
| 282 | { |
---|
| 283 | LookingForGroup() {} |
---|
| 284 | bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry,slot.type); } |
---|
| 285 | bool HaveInSlot(uint32 _entry, uint32 _type) const |
---|
| 286 | { |
---|
| 287 | for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) |
---|
| 288 | if(slots[i].Is(_entry,_type)) |
---|
| 289 | return true; |
---|
| 290 | return false; |
---|
| 291 | } |
---|
| 292 | |
---|
| 293 | bool canAutoJoin() const |
---|
| 294 | { |
---|
| 295 | for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) |
---|
| 296 | if(slots[i].canAutoJoin()) |
---|
| 297 | return true; |
---|
| 298 | return false; |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | bool Empty() const |
---|
| 302 | { |
---|
| 303 | for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) |
---|
| 304 | if(!slots[i].Empty()) |
---|
| 305 | return false; |
---|
| 306 | return more.Empty(); |
---|
| 307 | } |
---|
| 308 | |
---|
| 309 | LookingForGroupSlot slots[MAX_LOOKING_FOR_GROUP_SLOT]; |
---|
| 310 | LookingForGroupSlot more; |
---|
| 311 | std::string comment; |
---|
| 312 | }; |
---|
| 313 | |
---|
| 314 | enum PlayerMovementType |
---|
| 315 | { |
---|
| 316 | MOVE_ROOT = 1, |
---|
| 317 | MOVE_UNROOT = 2, |
---|
| 318 | MOVE_WATER_WALK = 3, |
---|
| 319 | MOVE_LAND_WALK = 4 |
---|
| 320 | }; |
---|
| 321 | |
---|
| 322 | enum DrunkenState |
---|
| 323 | { |
---|
| 324 | DRUNKEN_SOBER = 0, |
---|
| 325 | DRUNKEN_TIPSY = 1, |
---|
| 326 | DRUNKEN_DRUNK = 2, |
---|
| 327 | DRUNKEN_SMASHED = 3 |
---|
| 328 | }; |
---|
| 329 | |
---|
| 330 | enum PlayerStateType |
---|
| 331 | { |
---|
| 332 | /* |
---|
| 333 | PLAYER_STATE_DANCE |
---|
| 334 | PLAYER_STATE_SLEEP |
---|
| 335 | PLAYER_STATE_SIT |
---|
| 336 | PLAYER_STATE_STAND |
---|
| 337 | PLAYER_STATE_READYUNARMED |
---|
| 338 | PLAYER_STATE_WORK |
---|
| 339 | PLAYER_STATE_POINT(DNR) |
---|
| 340 | PLAYER_STATE_NONE // not used or just no state, just standing there? |
---|
| 341 | PLAYER_STATE_STUN |
---|
| 342 | PLAYER_STATE_DEAD |
---|
| 343 | PLAYER_STATE_KNEEL |
---|
| 344 | PLAYER_STATE_USESTANDING |
---|
| 345 | PLAYER_STATE_STUN_NOSHEATHE |
---|
| 346 | PLAYER_STATE_USESTANDING_NOSHEATHE |
---|
| 347 | PLAYER_STATE_WORK_NOSHEATHE |
---|
| 348 | PLAYER_STATE_SPELLPRECAST |
---|
| 349 | PLAYER_STATE_READYRIFLE |
---|
| 350 | PLAYER_STATE_WORK_NOSHEATHE_MINING |
---|
| 351 | PLAYER_STATE_WORK_NOSHEATHE_CHOPWOOD |
---|
| 352 | PLAYER_STATE_AT_EASE |
---|
| 353 | PLAYER_STATE_READY1H |
---|
| 354 | PLAYER_STATE_SPELLKNEELSTART |
---|
| 355 | PLAYER_STATE_SUBMERGED |
---|
| 356 | */ |
---|
| 357 | |
---|
| 358 | PLAYER_STATE_NONE = 0, |
---|
| 359 | PLAYER_STATE_SIT = 1, |
---|
| 360 | PLAYER_STATE_SIT_CHAIR = 2, |
---|
| 361 | PLAYER_STATE_SLEEP = 3, |
---|
| 362 | PLAYER_STATE_SIT_LOW_CHAIR = 4, |
---|
| 363 | PLAYER_STATE_SIT_MEDIUM_CHAIR = 5, |
---|
| 364 | PLAYER_STATE_SIT_HIGH_CHAIR = 6, |
---|
| 365 | PLAYER_STATE_DEAD = 7, |
---|
| 366 | PLAYER_STATE_KNEEL = 8, |
---|
| 367 | |
---|
| 368 | PLAYER_STATE_FORM_ALL = 0x00FF0000, |
---|
| 369 | |
---|
| 370 | PLAYER_STATE_FLAG_ALWAYS_STAND = 0x01, // byte 4 |
---|
| 371 | PLAYER_STATE_FLAG_CREEP = 0x02000000, |
---|
| 372 | PLAYER_STATE_FLAG_UNTRACKABLE = 0x04000000, |
---|
| 373 | PLAYER_STATE_FLAG_ALL = 0xFF000000, |
---|
| 374 | }; |
---|
| 375 | |
---|
| 376 | enum PlayerFlags |
---|
| 377 | { |
---|
| 378 | PLAYER_FLAGS_GROUP_LEADER = 0x00000001, |
---|
| 379 | PLAYER_FLAGS_AFK = 0x00000002, |
---|
| 380 | PLAYER_FLAGS_DND = 0x00000004, |
---|
| 381 | PLAYER_FLAGS_GM = 0x00000008, |
---|
| 382 | PLAYER_FLAGS_GHOST = 0x00000010, |
---|
| 383 | PLAYER_FLAGS_RESTING = 0x00000020, |
---|
| 384 | PLAYER_FLAGS_FFA_PVP = 0x00000080, |
---|
| 385 | PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards |
---|
| 386 | PLAYER_FLAGS_IN_PVP = 0x00000200, |
---|
| 387 | PLAYER_FLAGS_HIDE_HELM = 0x00000400, |
---|
| 388 | PLAYER_FLAGS_HIDE_CLOAK = 0x00000800, |
---|
| 389 | PLAYER_FLAGS_UNK1 = 0x00001000, // played long time |
---|
| 390 | PLAYER_FLAGS_UNK2 = 0x00002000, // played too long time |
---|
| 391 | PLAYER_FLAGS_UNK3 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag |
---|
| 392 | PLAYER_FLAGS_SANCTUARY = 0x00010000, // player entered sanctuary |
---|
| 393 | PLAYER_FLAGS_UNK4 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1) |
---|
| 394 | PLAYER_UNK = 0x00040000, // 2.0.8... |
---|
| 395 | }; |
---|
| 396 | |
---|
| 397 | // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1) |
---|
| 398 | // can't use enum for uint64 values |
---|
| 399 | #define PLAYER_TITLE_DISABLED 0x0000000000000000LL |
---|
| 400 | #define PLAYER_TITLE_NONE 0x0000000000000001LL |
---|
| 401 | #define PLAYER_TITLE_PRIVATE 0x0000000000000002LL // 1 |
---|
| 402 | #define PLAYER_TITLE_CORPORAL 0x0000000000000004LL // 2 |
---|
| 403 | #define PLAYER_TITLE_SERGEANT_A 0x0000000000000008LL // 3 |
---|
| 404 | #define PLAYER_TITLE_MASTER_SERGEANT 0x0000000000000010LL // 4 |
---|
| 405 | #define PLAYER_TITLE_SERGEANT_MAJOR 0x0000000000000020LL // 5 |
---|
| 406 | #define PLAYER_TITLE_KNIGHT 0x0000000000000040LL // 6 |
---|
| 407 | #define PLAYER_TITLE_KNIGHT_LIEUTENANT 0x0000000000000080LL // 7 |
---|
| 408 | #define PLAYER_TITLE_KNIGHT_CAPTAIN 0x0000000000000100LL // 8 |
---|
| 409 | #define PLAYER_TITLE_KNIGHT_CHAMPION 0x0000000000000200LL // 9 |
---|
| 410 | #define PLAYER_TITLE_LIEUTENANT_COMMANDER 0x0000000000000400LL // 10 |
---|
| 411 | #define PLAYER_TITLE_COMMANDER 0x0000000000000800LL // 11 |
---|
| 412 | #define PLAYER_TITLE_MARSHAL 0x0000000000001000LL // 12 |
---|
| 413 | #define PLAYER_TITLE_FIELD_MARSHAL 0x0000000000002000LL // 13 |
---|
| 414 | #define PLAYER_TITLE_GRAND_MARSHAL 0x0000000000004000LL // 14 |
---|
| 415 | #define PLAYER_TITLE_SCOUT 0x0000000000008000LL // 15 |
---|
| 416 | #define PLAYER_TITLE_GRUNT 0x0000000000010000LL // 16 |
---|
| 417 | #define PLAYER_TITLE_SERGEANT_H 0x0000000000020000LL // 17 |
---|
| 418 | #define PLAYER_TITLE_SENIOR_SERGEANT 0x0000000000040000LL // 18 |
---|
| 419 | #define PLAYER_TITLE_FIRST_SERGEANT 0x0000000000080000LL // 19 |
---|
| 420 | #define PLAYER_TITLE_STONE_GUARD 0x0000000000100000LL // 20 |
---|
| 421 | #define PLAYER_TITLE_BLOOD_GUARD 0x0000000000200000LL // 21 |
---|
| 422 | #define PLAYER_TITLE_LEGIONNAIRE 0x0000000000400000LL // 22 |
---|
| 423 | #define PLAYER_TITLE_CENTURION 0x0000000000800000LL // 23 |
---|
| 424 | #define PLAYER_TITLE_CHAMPION 0x0000000001000000LL // 24 |
---|
| 425 | #define PLAYER_TITLE_LIEUTENANT_GENERAL 0x0000000002000000LL // 25 |
---|
| 426 | #define PLAYER_TITLE_GENERAL 0x0000000004000000LL // 26 |
---|
| 427 | #define PLAYER_TITLE_WARLORD 0x0000000008000000LL // 27 |
---|
| 428 | #define PLAYER_TITLE_HIGH_WARLORD 0x0000000010000000LL // 28 |
---|
| 429 | #define PLAYER_TITLE_GLADIATOR 0x0000000020000000LL // 29 |
---|
| 430 | #define PLAYER_TITLE_DUELIST 0x0000000040000000LL // 30 |
---|
| 431 | #define PLAYER_TITLE_RIVAL 0x0000000080000000LL // 31 |
---|
| 432 | #define PLAYER_TITLE_CHALLENGER 0x0000000100000000LL // 32 |
---|
| 433 | #define PLAYER_TITLE_SCARAB_LORD 0x0000000200000000LL // 33 |
---|
| 434 | #define PLAYER_TITLE_CONQUEROR 0x0000000400000000LL // 34 |
---|
| 435 | #define PLAYER_TITLE_JUSTICAR 0x0000000800000000LL // 35 |
---|
| 436 | #define PLAYER_TITLE_CHAMPION_OF_THE_NAARU 0x0000001000000000LL // 36 |
---|
| 437 | #define PLAYER_TITLE_MERCILESS_GLADIATOR 0x0000002000000000LL // 37 |
---|
| 438 | #define PLAYER_TITLE_OF_THE_SHATTERED_SUN 0x0000004000000000LL // 38 |
---|
| 439 | #define PLAYER_TITLE_HAND_OF_ADAL 0x0000008000000000LL // 39 |
---|
| 440 | #define PLAYER_TITLE_VENGEFUL_GLADIATOR 0x0000010000000000LL // 40 |
---|
| 441 | |
---|
| 442 | // used in PLAYER_FIELD_BYTES values |
---|
| 443 | enum PlayerFieldByteFlags |
---|
| 444 | { |
---|
| 445 | PLAYER_FIELD_BYTE_TRACK_STEALTHED = 0x00000002, |
---|
| 446 | PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit |
---|
| 447 | PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x00000010 // Display no "release spirit" window at all |
---|
| 448 | }; |
---|
| 449 | |
---|
| 450 | // used in PLAYER_FIELD_BYTES2 values |
---|
| 451 | enum PlayerFieldByte2Flags |
---|
| 452 | { |
---|
| 453 | PLAYER_FIELD_BYTE2_NONE = 0x0000, |
---|
| 454 | PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x4000 |
---|
| 455 | }; |
---|
| 456 | |
---|
| 457 | enum ActivateTaxiReplies |
---|
| 458 | { |
---|
| 459 | ERR_TAXIOK = 0, |
---|
| 460 | ERR_TAXIUNSPECIFIEDSERVERERROR = 1, |
---|
| 461 | ERR_TAXINOSUCHPATH = 2, |
---|
| 462 | ERR_TAXINOTENOUGHMONEY = 3, |
---|
| 463 | ERR_TAXITOOFARAWAY = 4, |
---|
| 464 | ERR_TAXINOVENDORNEARBY = 5, |
---|
| 465 | ERR_TAXINOTVISITED = 6, |
---|
| 466 | ERR_TAXIPLAYERBUSY = 7, |
---|
| 467 | ERR_TAXIPLAYERALREADYMOUNTED = 8, |
---|
| 468 | ERR_TAXIPLAYERSHAPESHIFTED = 9, |
---|
| 469 | ERR_TAXIPLAYERMOVING = 10, |
---|
| 470 | ERR_TAXISAMENODE = 11, |
---|
| 471 | ERR_TAXINOTSTANDING = 12 |
---|
| 472 | }; |
---|
| 473 | |
---|
| 474 | enum LootType |
---|
| 475 | { |
---|
| 476 | LOOT_CORPSE = 1, |
---|
| 477 | LOOT_SKINNING = 2, |
---|
| 478 | LOOT_FISHING = 3, |
---|
| 479 | LOOT_PICKPOCKETING = 4, // unsupported by client, sending LOOT_SKINNING instead |
---|
| 480 | LOOT_DISENCHANTING = 5, // unsupported by client, sending LOOT_SKINNING instead |
---|
| 481 | LOOT_PROSPECTING = 6, // unsupported by client, sending LOOT_SKINNING instead |
---|
| 482 | LOOT_INSIGNIA = 7, // unsupported by client, sending LOOT_SKINNING instead |
---|
| 483 | LOOT_FISHINGHOLE = 8 // unsupported by client, sending LOOT_FISHING instead |
---|
| 484 | }; |
---|
| 485 | |
---|
| 486 | enum MirrorTimerType |
---|
| 487 | { |
---|
| 488 | FATIGUE_TIMER = 0, |
---|
| 489 | BREATH_TIMER = 1, |
---|
| 490 | FIRE_TIMER = 2 |
---|
| 491 | }; |
---|
| 492 | |
---|
| 493 | // 2^n values |
---|
| 494 | enum PlayerExtraFlags |
---|
| 495 | { |
---|
| 496 | // gm abilities |
---|
| 497 | PLAYER_EXTRA_GM_ON = 0x0001, |
---|
| 498 | PLAYER_EXTRA_GM_ACCEPT_TICKETS = 0x0002, |
---|
| 499 | PLAYER_EXTRA_ACCEPT_WHISPERS = 0x0004, |
---|
| 500 | PLAYER_EXTRA_TAXICHEAT = 0x0008, |
---|
| 501 | PLAYER_EXTRA_GM_INVISIBLE = 0x0010, |
---|
| 502 | PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages |
---|
| 503 | |
---|
| 504 | // other states |
---|
| 505 | PLAYER_EXTRA_PVP_DEATH = 0x0100 // store PvP death status until corpse creating. |
---|
| 506 | }; |
---|
| 507 | |
---|
| 508 | // 2^n values |
---|
| 509 | enum AtLoginFlags |
---|
| 510 | { |
---|
| 511 | AT_LOGIN_NONE = 0, |
---|
| 512 | AT_LOGIN_RENAME = 1, |
---|
| 513 | AT_LOGIN_RESET_SPELLS = 2, |
---|
| 514 | AT_LOGIN_RESET_TALENTS = 4 |
---|
| 515 | }; |
---|
| 516 | |
---|
| 517 | typedef std::map<uint32, QuestStatusData> QuestStatusMap; |
---|
| 518 | |
---|
| 519 | enum QuestSlotOffsets |
---|
| 520 | { |
---|
| 521 | QUEST_ID_OFFSET = 0, |
---|
| 522 | QUEST_STATE_OFFSET = 1, |
---|
| 523 | QUEST_COUNTS_OFFSET = 2, |
---|
| 524 | QUEST_TIME_OFFSET = 3 |
---|
| 525 | }; |
---|
| 526 | |
---|
| 527 | #define MAX_QUEST_OFFSET 4 |
---|
| 528 | |
---|
| 529 | enum QuestSlotStateMask |
---|
| 530 | { |
---|
| 531 | QUEST_STATE_NONE = 0x0000, |
---|
| 532 | QUEST_STATE_COMPLETE = 0x0001, |
---|
| 533 | QUEST_STATE_FAIL = 0x0002 |
---|
| 534 | }; |
---|
| 535 | |
---|
| 536 | class Quest; |
---|
| 537 | class Spell; |
---|
| 538 | class Item; |
---|
| 539 | class WorldSession; |
---|
| 540 | |
---|
| 541 | enum PlayerSlots |
---|
| 542 | { |
---|
| 543 | // first slot for item stored (in any way in player m_items data) |
---|
| 544 | PLAYER_SLOT_START = 0, |
---|
| 545 | // last+1 slot for item stored (in any way in player m_items data) |
---|
| 546 | PLAYER_SLOT_END = 118, |
---|
| 547 | PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START) |
---|
| 548 | }; |
---|
| 549 | |
---|
| 550 | enum EquipmentSlots |
---|
| 551 | { |
---|
| 552 | EQUIPMENT_SLOT_START = 0, |
---|
| 553 | EQUIPMENT_SLOT_HEAD = 0, |
---|
| 554 | EQUIPMENT_SLOT_NECK = 1, |
---|
| 555 | EQUIPMENT_SLOT_SHOULDERS = 2, |
---|
| 556 | EQUIPMENT_SLOT_BODY = 3, |
---|
| 557 | EQUIPMENT_SLOT_CHEST = 4, |
---|
| 558 | EQUIPMENT_SLOT_WAIST = 5, |
---|
| 559 | EQUIPMENT_SLOT_LEGS = 6, |
---|
| 560 | EQUIPMENT_SLOT_FEET = 7, |
---|
| 561 | EQUIPMENT_SLOT_WRISTS = 8, |
---|
| 562 | EQUIPMENT_SLOT_HANDS = 9, |
---|
| 563 | EQUIPMENT_SLOT_FINGER1 = 10, |
---|
| 564 | EQUIPMENT_SLOT_FINGER2 = 11, |
---|
| 565 | EQUIPMENT_SLOT_TRINKET1 = 12, |
---|
| 566 | EQUIPMENT_SLOT_TRINKET2 = 13, |
---|
| 567 | EQUIPMENT_SLOT_BACK = 14, |
---|
| 568 | EQUIPMENT_SLOT_MAINHAND = 15, |
---|
| 569 | EQUIPMENT_SLOT_OFFHAND = 16, |
---|
| 570 | EQUIPMENT_SLOT_RANGED = 17, |
---|
| 571 | EQUIPMENT_SLOT_TABARD = 18, |
---|
| 572 | EQUIPMENT_SLOT_END = 19 |
---|
| 573 | }; |
---|
| 574 | |
---|
| 575 | enum InventorySlots |
---|
| 576 | { |
---|
| 577 | INVENTORY_SLOT_BAG_0 = 255, |
---|
| 578 | INVENTORY_SLOT_BAG_START = 19, |
---|
| 579 | INVENTORY_SLOT_BAG_1 = 19, |
---|
| 580 | INVENTORY_SLOT_BAG_2 = 20, |
---|
| 581 | INVENTORY_SLOT_BAG_3 = 21, |
---|
| 582 | INVENTORY_SLOT_BAG_4 = 22, |
---|
| 583 | INVENTORY_SLOT_BAG_END = 23, |
---|
| 584 | |
---|
| 585 | INVENTORY_SLOT_ITEM_START = 23, |
---|
| 586 | INVENTORY_SLOT_ITEM_1 = 23, |
---|
| 587 | INVENTORY_SLOT_ITEM_2 = 24, |
---|
| 588 | INVENTORY_SLOT_ITEM_3 = 25, |
---|
| 589 | INVENTORY_SLOT_ITEM_4 = 26, |
---|
| 590 | INVENTORY_SLOT_ITEM_5 = 27, |
---|
| 591 | INVENTORY_SLOT_ITEM_6 = 28, |
---|
| 592 | INVENTORY_SLOT_ITEM_7 = 29, |
---|
| 593 | INVENTORY_SLOT_ITEM_8 = 30, |
---|
| 594 | INVENTORY_SLOT_ITEM_9 = 31, |
---|
| 595 | INVENTORY_SLOT_ITEM_10 = 32, |
---|
| 596 | INVENTORY_SLOT_ITEM_11 = 33, |
---|
| 597 | INVENTORY_SLOT_ITEM_12 = 34, |
---|
| 598 | INVENTORY_SLOT_ITEM_13 = 35, |
---|
| 599 | INVENTORY_SLOT_ITEM_14 = 36, |
---|
| 600 | INVENTORY_SLOT_ITEM_15 = 37, |
---|
| 601 | INVENTORY_SLOT_ITEM_16 = 38, |
---|
| 602 | INVENTORY_SLOT_ITEM_END = 39 |
---|
| 603 | }; |
---|
| 604 | |
---|
| 605 | enum BankSlots |
---|
| 606 | { |
---|
| 607 | BANK_SLOT_ITEM_START = 39, |
---|
| 608 | BANK_SLOT_ITEM_1 = 39, |
---|
| 609 | BANK_SLOT_ITEM_2 = 40, |
---|
| 610 | BANK_SLOT_ITEM_3 = 41, |
---|
| 611 | BANK_SLOT_ITEM_4 = 42, |
---|
| 612 | BANK_SLOT_ITEM_5 = 43, |
---|
| 613 | BANK_SLOT_ITEM_6 = 44, |
---|
| 614 | BANK_SLOT_ITEM_7 = 45, |
---|
| 615 | BANK_SLOT_ITEM_8 = 46, |
---|
| 616 | BANK_SLOT_ITEM_9 = 47, |
---|
| 617 | BANK_SLOT_ITEM_10 = 48, |
---|
| 618 | BANK_SLOT_ITEM_11 = 49, |
---|
| 619 | BANK_SLOT_ITEM_12 = 50, |
---|
| 620 | BANK_SLOT_ITEM_13 = 51, |
---|
| 621 | BANK_SLOT_ITEM_14 = 52, |
---|
| 622 | BANK_SLOT_ITEM_15 = 53, |
---|
| 623 | BANK_SLOT_ITEM_16 = 54, |
---|
| 624 | BANK_SLOT_ITEM_17 = 55, |
---|
| 625 | BANK_SLOT_ITEM_18 = 56, |
---|
| 626 | BANK_SLOT_ITEM_19 = 57, |
---|
| 627 | BANK_SLOT_ITEM_20 = 58, |
---|
| 628 | BANK_SLOT_ITEM_21 = 59, |
---|
| 629 | BANK_SLOT_ITEM_22 = 60, |
---|
| 630 | BANK_SLOT_ITEM_23 = 61, |
---|
| 631 | BANK_SLOT_ITEM_24 = 62, |
---|
| 632 | BANK_SLOT_ITEM_25 = 63, |
---|
| 633 | BANK_SLOT_ITEM_26 = 64, |
---|
| 634 | BANK_SLOT_ITEM_27 = 65, |
---|
| 635 | BANK_SLOT_ITEM_28 = 66, |
---|
| 636 | BANK_SLOT_ITEM_END = 67, |
---|
| 637 | |
---|
| 638 | BANK_SLOT_BAG_START = 67, |
---|
| 639 | BANK_SLOT_BAG_1 = 67, |
---|
| 640 | BANK_SLOT_BAG_2 = 68, |
---|
| 641 | BANK_SLOT_BAG_3 = 69, |
---|
| 642 | BANK_SLOT_BAG_4 = 70, |
---|
| 643 | BANK_SLOT_BAG_5 = 71, |
---|
| 644 | BANK_SLOT_BAG_6 = 72, |
---|
| 645 | BANK_SLOT_BAG_7 = 73, |
---|
| 646 | BANK_SLOT_BAG_END = 74 |
---|
| 647 | }; |
---|
| 648 | |
---|
| 649 | enum BuyBackSlots |
---|
| 650 | { |
---|
| 651 | // stored in m_buybackitems |
---|
| 652 | BUYBACK_SLOT_START = 74, |
---|
| 653 | BUYBACK_SLOT_1 = 74, |
---|
| 654 | BUYBACK_SLOT_2 = 75, |
---|
| 655 | BUYBACK_SLOT_3 = 76, |
---|
| 656 | BUYBACK_SLOT_4 = 77, |
---|
| 657 | BUYBACK_SLOT_5 = 78, |
---|
| 658 | BUYBACK_SLOT_6 = 79, |
---|
| 659 | BUYBACK_SLOT_7 = 80, |
---|
| 660 | BUYBACK_SLOT_8 = 81, |
---|
| 661 | BUYBACK_SLOT_9 = 82, |
---|
| 662 | BUYBACK_SLOT_10 = 83, |
---|
| 663 | BUYBACK_SLOT_11 = 84, |
---|
| 664 | BUYBACK_SLOT_12 = 85, |
---|
| 665 | BUYBACK_SLOT_END = 86 |
---|
| 666 | }; |
---|
| 667 | |
---|
| 668 | enum KeyRingSlots |
---|
| 669 | { |
---|
| 670 | KEYRING_SLOT_START = 86, |
---|
| 671 | KEYRING_SLOT_END = 118 |
---|
| 672 | }; |
---|
| 673 | |
---|
| 674 | struct ItemPosCount |
---|
| 675 | { |
---|
| 676 | ItemPosCount(uint16 _pos, uint8 _count) : pos(_pos), count(_count) {} |
---|
| 677 | bool isContainedIn(std::vector<ItemPosCount> const& vec) const; |
---|
| 678 | uint16 pos; |
---|
| 679 | uint8 count; |
---|
| 680 | }; |
---|
| 681 | typedef std::vector<ItemPosCount> ItemPosCountVec; |
---|
| 682 | |
---|
| 683 | enum SwitchWeapon |
---|
| 684 | { |
---|
| 685 | DEFAULT_SWITCH_WEAPON = 1500, //cooldown in ms |
---|
| 686 | ROGUE_SWITCH_WEAPON = 1000 |
---|
| 687 | }; |
---|
| 688 | |
---|
| 689 | enum TradeSlots |
---|
| 690 | { |
---|
| 691 | TRADE_SLOT_COUNT = 7, |
---|
| 692 | TRADE_SLOT_TRADED_COUNT = 6, |
---|
| 693 | TRADE_SLOT_NONTRADED = 6 |
---|
| 694 | }; |
---|
| 695 | |
---|
| 696 | enum TransferAbortReason |
---|
| 697 | { |
---|
| 698 | TRANSFER_ABORT_MAX_PLAYERS = 0x0001, // Transfer Aborted: instance is full |
---|
| 699 | TRANSFER_ABORT_NOT_FOUND = 0x0002, // Transfer Aborted: instance not found |
---|
| 700 | TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x0003, // You have entered too many instances recently. |
---|
| 701 | TRANSFER_ABORT_ZONE_IN_COMBAT = 0x0005, // Unable to zone in while an encounter is in progress. |
---|
| 702 | TRANSFER_ABORT_INSUF_EXPAN_LVL1 = 0x0106, // You must have TBC expansion installed to access this area. |
---|
| 703 | TRANSFER_ABORT_DIFFICULTY1 = 0x0007, // Normal difficulty mode is not available for %s. |
---|
| 704 | TRANSFER_ABORT_DIFFICULTY2 = 0x0107, // Heroic difficulty mode is not available for %s. |
---|
| 705 | TRANSFER_ABORT_DIFFICULTY3 = 0x0207 // Epic difficulty mode is not available for %s. |
---|
| 706 | }; |
---|
| 707 | |
---|
| 708 | enum InstanceResetWarningType |
---|
| 709 | { |
---|
| 710 | RAID_INSTANCE_WARNING_HOURS = 1, // WARNING! %s is scheduled to reset in %d hour(s). |
---|
| 711 | RAID_INSTANCE_WARNING_MIN = 2, // WARNING! %s is scheduled to reset in %d minute(s)! |
---|
| 712 | RAID_INSTANCE_WARNING_MIN_SOON = 3, // WARNING! %s is scheduled to reset in %d minute(s). Please exit the zone or you will be returned to your bind location! |
---|
| 713 | RAID_INSTANCE_WELCOME = 4 // Welcome to %s. This raid instance is scheduled to reset in %s. |
---|
| 714 | }; |
---|
| 715 | |
---|
| 716 | struct MovementInfo |
---|
| 717 | { |
---|
| 718 | // common |
---|
| 719 | //uint32 flags; |
---|
| 720 | uint8 unk1; |
---|
| 721 | uint32 time; |
---|
| 722 | float x, y, z, o; |
---|
| 723 | // transport |
---|
| 724 | uint64 t_guid; |
---|
| 725 | float t_x, t_y, t_z, t_o; |
---|
| 726 | uint32 t_time; |
---|
| 727 | // swimming and unk |
---|
| 728 | float s_pitch; |
---|
| 729 | // last fall time |
---|
| 730 | uint32 fallTime; |
---|
| 731 | // jumping |
---|
| 732 | float j_unk, j_sinAngle, j_cosAngle, j_xyspeed; |
---|
| 733 | // spline |
---|
| 734 | float u_unk1; |
---|
| 735 | |
---|
| 736 | MovementInfo() |
---|
| 737 | { |
---|
| 738 | //flags = |
---|
| 739 | time = t_time = fallTime = 0; |
---|
| 740 | unk1 = 0; |
---|
| 741 | x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_unk = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f; |
---|
| 742 | t_guid = 0; |
---|
| 743 | } |
---|
| 744 | |
---|
| 745 | /*void SetMovementFlags(uint32 _flags) |
---|
| 746 | { |
---|
| 747 | flags = _flags; |
---|
| 748 | }*/ |
---|
| 749 | }; |
---|
| 750 | |
---|
| 751 | // flags that use in movement check for example at spell casting |
---|
| 752 | MovementFlags const movementFlagsMask = MovementFlags( |
---|
| 753 | MOVEMENTFLAG_FORWARD |MOVEMENTFLAG_BACKWARD |MOVEMENTFLAG_STRAFE_LEFT|MOVEMENTFLAG_STRAFE_RIGHT| |
---|
| 754 | MOVEMENTFLAG_PITCH_UP|MOVEMENTFLAG_PITCH_DOWN|MOVEMENTFLAG_FLY_UNK1 | |
---|
| 755 | MOVEMENTFLAG_JUMPING |MOVEMENTFLAG_FALLING |MOVEMENTFLAG_FLY_UP | |
---|
| 756 | MOVEMENTFLAG_FLYING |MOVEMENTFLAG_SPLINE |
---|
| 757 | ); |
---|
| 758 | |
---|
| 759 | MovementFlags const movementOrTurningFlagsMask = MovementFlags( |
---|
| 760 | movementFlagsMask | MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT |
---|
| 761 | ); |
---|
| 762 | class InstanceSave; |
---|
| 763 | |
---|
| 764 | enum RestType |
---|
| 765 | { |
---|
| 766 | REST_TYPE_NO = 0, |
---|
| 767 | REST_TYPE_IN_TAVERN = 1, |
---|
| 768 | REST_TYPE_IN_CITY = 2 |
---|
| 769 | }; |
---|
| 770 | |
---|
| 771 | enum DuelCompleteType |
---|
| 772 | { |
---|
| 773 | DUEL_INTERUPTED = 0, |
---|
| 774 | DUEL_WON = 1, |
---|
| 775 | DUEL_FLED = 2 |
---|
| 776 | }; |
---|
| 777 | |
---|
| 778 | enum TeleportToOptions |
---|
| 779 | { |
---|
| 780 | TELE_TO_GM_MODE = 0x01, |
---|
| 781 | TELE_TO_NOT_LEAVE_TRANSPORT = 0x02, |
---|
| 782 | TELE_TO_NOT_LEAVE_COMBAT = 0x04, |
---|
| 783 | TELE_TO_NOT_UNSUMMON_PET = 0x08, |
---|
| 784 | TELE_TO_SPELL = 0x10, |
---|
| 785 | }; |
---|
| 786 | |
---|
| 787 | /// Type of environmental damages |
---|
| 788 | enum EnviromentalDamage |
---|
| 789 | { |
---|
| 790 | DAMAGE_EXHAUSTED = 0, |
---|
| 791 | DAMAGE_DROWNING = 1, |
---|
| 792 | DAMAGE_FALL = 2, |
---|
| 793 | DAMAGE_LAVA = 3, |
---|
| 794 | DAMAGE_SLIME = 4, |
---|
| 795 | DAMAGE_FIRE = 5, |
---|
| 796 | DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss |
---|
| 797 | }; |
---|
| 798 | |
---|
| 799 | // used at player loading query list preparing, and later result selection |
---|
| 800 | enum PlayerLoginQueryIndex |
---|
| 801 | { |
---|
| 802 | PLAYER_LOGIN_QUERY_LOADFROM = 0, |
---|
| 803 | PLAYER_LOGIN_QUERY_LOADGROUP = 1, |
---|
| 804 | PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES = 2, |
---|
| 805 | PLAYER_LOGIN_QUERY_LOADAURAS = 3, |
---|
| 806 | PLAYER_LOGIN_QUERY_LOADSPELLS = 4, |
---|
| 807 | PLAYER_LOGIN_QUERY_LOADQUESTSTATUS = 5, |
---|
| 808 | PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS = 6, |
---|
| 809 | PLAYER_LOGIN_QUERY_LOADTUTORIALS = 7, // common for all characters for some account at specific realm |
---|
| 810 | PLAYER_LOGIN_QUERY_LOADREPUTATION = 8, |
---|
| 811 | PLAYER_LOGIN_QUERY_LOADINVENTORY = 9, |
---|
| 812 | PLAYER_LOGIN_QUERY_LOADACTIONS = 10, |
---|
| 813 | PLAYER_LOGIN_QUERY_LOADMAILCOUNT = 11, |
---|
| 814 | PLAYER_LOGIN_QUERY_LOADMAILDATE = 12, |
---|
| 815 | PLAYER_LOGIN_QUERY_LOADSOCIALLIST = 13, |
---|
| 816 | PLAYER_LOGIN_QUERY_LOADHOMEBIND = 14, |
---|
| 817 | PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS = 15, |
---|
| 818 | PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 16, |
---|
| 819 | PLAYER_LOGIN_QUERY_LOADGUILD = 17, |
---|
| 820 | }; |
---|
| 821 | |
---|
| 822 | #define MAX_PLAYER_LOGIN_QUERY 18 |
---|
| 823 | |
---|
| 824 | // Player summoning auto-decline time (in secs) |
---|
| 825 | #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) |
---|
| 826 | #define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) |
---|
| 827 | |
---|
| 828 | struct InstancePlayerBind |
---|
| 829 | { |
---|
| 830 | InstanceSave *save; |
---|
| 831 | bool perm; |
---|
| 832 | /* permanent PlayerInstanceBinds are created in Raid/Heroic instances for players |
---|
| 833 | that aren't already permanently bound when they are inside when a boss is killed |
---|
| 834 | or when they enter an instance that the group leader is permanently bound to. */ |
---|
| 835 | InstancePlayerBind() : save(NULL), perm(false) {} |
---|
| 836 | }; |
---|
| 837 | |
---|
[44] | 838 | class TRINITY_DLL_SPEC PlayerTaxi |
---|
[37] | 839 | { |
---|
| 840 | public: |
---|
| 841 | PlayerTaxi(); |
---|
| 842 | ~PlayerTaxi() {} |
---|
| 843 | // Nodes |
---|
| 844 | void InitTaxiNodesForLevel(uint32 race, uint32 level); |
---|
| 845 | void LoadTaxiMask(const char* data); |
---|
| 846 | void SaveTaxiMask(const char* data); |
---|
| 847 | |
---|
| 848 | uint32 GetTaximask( uint8 index ) const { return m_taximask[index]; } |
---|
| 849 | bool IsTaximaskNodeKnown(uint32 nodeidx) const |
---|
| 850 | { |
---|
| 851 | uint8 field = uint8((nodeidx - 1) / 32); |
---|
| 852 | uint32 submask = 1<<((nodeidx-1)%32); |
---|
| 853 | return (m_taximask[field] & submask) == submask; |
---|
| 854 | } |
---|
| 855 | bool SetTaximaskNode(uint32 nodeidx) |
---|
| 856 | { |
---|
| 857 | uint8 field = uint8((nodeidx - 1) / 32); |
---|
| 858 | uint32 submask = 1<<((nodeidx-1)%32); |
---|
| 859 | if ((m_taximask[field] & submask) != submask ) |
---|
| 860 | { |
---|
| 861 | m_taximask[field] |= submask; |
---|
| 862 | return true; |
---|
| 863 | } |
---|
| 864 | else |
---|
| 865 | return false; |
---|
| 866 | } |
---|
| 867 | void AppendTaximaskTo(ByteBuffer& data,bool all); |
---|
| 868 | |
---|
| 869 | // Destinations |
---|
| 870 | bool LoadTaxiDestinationsFromString(std::string values); |
---|
| 871 | std::string SaveTaxiDestinationsToString(); |
---|
| 872 | |
---|
| 873 | void ClearTaxiDestinations() { m_TaxiDestinations.clear(); } |
---|
| 874 | void AddTaxiDestination(uint32 dest) { m_TaxiDestinations.push_back(dest); } |
---|
| 875 | uint32 GetTaxiSource() const { return m_TaxiDestinations.empty() ? 0 : m_TaxiDestinations.front(); } |
---|
| 876 | uint32 GetTaxiDestination() const { return m_TaxiDestinations.size() < 2 ? 0 : m_TaxiDestinations[1]; } |
---|
| 877 | uint32 GetCurrentTaxiPath() const; |
---|
| 878 | uint32 NextTaxiDestination() |
---|
| 879 | { |
---|
| 880 | m_TaxiDestinations.pop_front(); |
---|
| 881 | return GetTaxiDestination(); |
---|
| 882 | } |
---|
| 883 | bool empty() const { return m_TaxiDestinations.empty(); } |
---|
| 884 | private: |
---|
| 885 | TaxiMask m_taximask; |
---|
| 886 | std::deque<uint32> m_TaxiDestinations; |
---|
| 887 | }; |
---|
| 888 | |
---|
[44] | 889 | class TRINITY_DLL_SPEC Player : public Unit |
---|
[37] | 890 | { |
---|
| 891 | friend class WorldSession; |
---|
| 892 | friend void Item::AddToUpdateQueueOf(Player *player); |
---|
| 893 | friend void Item::RemoveFromUpdateQueueOf(Player *player); |
---|
| 894 | public: |
---|
| 895 | explicit Player (WorldSession *session); |
---|
| 896 | ~Player ( ); |
---|
| 897 | |
---|
| 898 | void CleanupsBeforeDelete(); |
---|
| 899 | |
---|
| 900 | static UpdateMask updateVisualBits; |
---|
| 901 | static void InitVisibleBits(); |
---|
| 902 | |
---|
| 903 | void AddToWorld(); |
---|
| 904 | void RemoveFromWorld(); |
---|
[120] | 905 | // always active |
---|
| 906 | void setActive() {} |
---|
[37] | 907 | |
---|
| 908 | bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0); |
---|
| 909 | |
---|
| 910 | bool TeleportTo(WorldLocation const &loc, uint32 options = 0) |
---|
| 911 | { |
---|
| 912 | return TeleportTo(loc.mapid, loc.x, loc.y, loc.z, options); |
---|
| 913 | } |
---|
| 914 | |
---|
| 915 | void SetSummonPoint(uint32 mapid, float x, float y, float z) |
---|
| 916 | { |
---|
| 917 | m_summon_expire = time(NULL) + MAX_PLAYER_SUMMON_DELAY; |
---|
| 918 | m_summon_mapid = mapid; |
---|
| 919 | m_summon_x = x; |
---|
| 920 | m_summon_y = y; |
---|
| 921 | m_summon_z = z; |
---|
| 922 | } |
---|
| 923 | void SummonIfPossible(bool agree); |
---|
| 924 | |
---|
| 925 | bool Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ); |
---|
| 926 | |
---|
| 927 | void Update( uint32 time ); |
---|
| 928 | |
---|
| 929 | void BuildEnumData( QueryResult * result, WorldPacket * p_data ); |
---|
| 930 | |
---|
| 931 | void SetInWater(bool apply); |
---|
| 932 | |
---|
| 933 | bool IsInWater() const { return m_isInWater; } |
---|
| 934 | bool IsUnderWater() const; |
---|
| 935 | |
---|
| 936 | void SendInitialPacketsBeforeAddToMap(); |
---|
| 937 | void SendInitialPacketsAfterAddToMap(); |
---|
| 938 | void SendTransferAborted(uint32 mapid, uint16 reason); |
---|
| 939 | void SendInstanceResetWarning(uint32 mapid, uint32 time); |
---|
| 940 | |
---|
| 941 | bool CanInteractWithNPCs(bool alive = true) const; |
---|
| 942 | |
---|
| 943 | bool ToggleAFK(); |
---|
| 944 | bool ToggleDND(); |
---|
| 945 | bool isAFK() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_AFK); }; |
---|
| 946 | bool isDND() const { return HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_DND); }; |
---|
| 947 | uint8 chatTag() const; |
---|
| 948 | std::string afkMsg; |
---|
| 949 | std::string dndMsg; |
---|
| 950 | |
---|
| 951 | PlayerSocial *GetSocial() { return m_social; } |
---|
| 952 | |
---|
| 953 | PlayerTaxi m_taxi; |
---|
| 954 | void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(),getLevel()); } |
---|
| 955 | bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_id = 0 , Creature* npc = NULL); |
---|
| 956 | // mount_id can be used in scripting calls |
---|
| 957 | bool isAcceptTickets() const { return GetSession()->GetSecurity() >= SEC_GAMEMASTER && (m_ExtraFlags & PLAYER_EXTRA_GM_ACCEPT_TICKETS); } |
---|
| 958 | void SetAcceptTicket(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_GM_ACCEPT_TICKETS; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_ACCEPT_TICKETS; } |
---|
| 959 | bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; } |
---|
| 960 | void SetAcceptWhispers(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } |
---|
| 961 | bool isGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; } |
---|
| 962 | void SetGameMaster(bool on); |
---|
| 963 | bool isGMChat() const { return GetSession()->GetSecurity() >= SEC_MODERATOR && (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT); } |
---|
| 964 | void SetGMChat(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; } |
---|
| 965 | bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; } |
---|
| 966 | void SetTaxiCheater(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } |
---|
| 967 | bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); } |
---|
| 968 | void SetGMVisible(bool on); |
---|
| 969 | void SetPvPDeath(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } |
---|
| 970 | |
---|
| 971 | void GiveXP(uint32 xp, Unit* victim); |
---|
| 972 | void GiveLevel(uint32 level); |
---|
| 973 | void InitStatsForLevel(bool reapplyMods = false); |
---|
| 974 | |
---|
| 975 | // Played Time Stuff |
---|
| 976 | time_t m_logintime; |
---|
| 977 | time_t m_Last_tick; |
---|
| 978 | uint32 m_Played_time[2]; |
---|
| 979 | uint32 GetTotalPlayedTime() { return m_Played_time[0]; }; |
---|
| 980 | uint32 GetLevelPlayedTime() { return m_Played_time[1]; }; |
---|
| 981 | |
---|
| 982 | void setDeathState(DeathState s); // overwrite Unit::setDeathState |
---|
| 983 | |
---|
| 984 | void InnEnter (int time,uint32 mapid, float x,float y,float z) |
---|
| 985 | { |
---|
| 986 | inn_pos_mapid = mapid; |
---|
| 987 | inn_pos_x = x; |
---|
| 988 | inn_pos_y = y; |
---|
| 989 | inn_pos_z = z; |
---|
| 990 | time_inn_enter = time; |
---|
| 991 | }; |
---|
| 992 | |
---|
| 993 | float GetRestBonus() const { return m_rest_bonus; }; |
---|
| 994 | void SetRestBonus(float rest_bonus_new); |
---|
| 995 | |
---|
| 996 | RestType GetRestType() const { return rest_type; }; |
---|
| 997 | void SetRestType(RestType n_r_type) { rest_type = n_r_type; }; |
---|
| 998 | |
---|
| 999 | uint32 GetInnPosMapId() const { return inn_pos_mapid; }; |
---|
| 1000 | float GetInnPosX() const { return inn_pos_x; }; |
---|
| 1001 | float GetInnPosY() const { return inn_pos_y; }; |
---|
| 1002 | float GetInnPosZ() const { return inn_pos_z; }; |
---|
| 1003 | |
---|
| 1004 | int GetTimeInnEnter() const { return time_inn_enter; }; |
---|
| 1005 | void UpdateInnerTime (int time) { time_inn_enter = time; }; |
---|
| 1006 | |
---|
| 1007 | void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); |
---|
| 1008 | void RemoveMiniPet(); |
---|
| 1009 | Pet* GetMiniPet(); |
---|
| 1010 | void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); } |
---|
| 1011 | void RemoveGuardians(); |
---|
| 1012 | bool HasGuardianWithEntry(uint32 entry); |
---|
| 1013 | void AddGuardian(Pet* pet) { m_guardianPets.insert(pet->GetGUID()); } |
---|
| 1014 | GuardianPetList const& GetGuardians() const { return m_guardianPets; } |
---|
| 1015 | void Uncharm(); |
---|
| 1016 | |
---|
| 1017 | void Say(std::string text, const uint32 language); |
---|
| 1018 | void Yell(std::string text, const uint32 language); |
---|
| 1019 | void TextEmote(std::string text); |
---|
| 1020 | void Whisper(std::string text, const uint32 language,uint64 receiver); |
---|
| 1021 | void BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const; |
---|
| 1022 | |
---|
| 1023 | /*********************************************************/ |
---|
| 1024 | /*** STORAGE SYSTEM ***/ |
---|
| 1025 | /*********************************************************/ |
---|
| 1026 | |
---|
| 1027 | void SetVirtualItemSlot( uint8 i, Item* item); |
---|
| 1028 | void SetSheath( uint32 sheathed ); |
---|
| 1029 | uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const; |
---|
| 1030 | uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const; |
---|
| 1031 | Item* GetItemByGuid( uint64 guid ) const; |
---|
| 1032 | Item* GetItemByPos( uint16 pos ) const; |
---|
| 1033 | Item* GetItemByPos( uint8 bag, uint8 slot ) const; |
---|
| 1034 | Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const; |
---|
| 1035 | Item* GetShield(bool useable = false) const; |
---|
| 1036 | static uint32 GetAttackBySlot( uint8 slot ); // MAX_ATTACK if not weapon slot |
---|
| 1037 | std::vector<Item *> &GetItemUpdateQueue() { return m_itemUpdateQueue; } |
---|
| 1038 | static bool IsInventoryPos( uint16 pos ) { return IsInventoryPos(pos >> 8,pos & 255); } |
---|
| 1039 | static bool IsInventoryPos( uint8 bag, uint8 slot ); |
---|
| 1040 | static bool IsEquipmentPos( uint16 pos ) { return IsEquipmentPos(pos >> 8,pos & 255); } |
---|
| 1041 | static bool IsEquipmentPos( uint8 bag, uint8 slot ); |
---|
| 1042 | static bool IsBagPos( uint16 pos ); |
---|
| 1043 | static bool IsBankPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } |
---|
| 1044 | static bool IsBankPos( uint8 bag, uint8 slot ); |
---|
| 1045 | bool HasBankBagSlot( uint8 slot ) const; |
---|
| 1046 | bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const; |
---|
| 1047 | bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL); |
---|
| 1048 | Item* GetItemOrItemWithGemEquipped( uint32 item ) const; |
---|
| 1049 | uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); } |
---|
| 1050 | uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); } |
---|
| 1051 | uint8 CanStoreNewItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL ) const |
---|
| 1052 | { |
---|
| 1053 | return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count ); |
---|
| 1054 | } |
---|
| 1055 | uint8 CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap = false ) const |
---|
| 1056 | { |
---|
| 1057 | if(!pItem) |
---|
| 1058 | return EQUIP_ERR_ITEM_NOT_FOUND; |
---|
| 1059 | uint32 count = pItem->GetCount(); |
---|
| 1060 | return _CanStoreItem( bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL ); |
---|
| 1061 | |
---|
| 1062 | } |
---|
| 1063 | uint8 CanStoreItems( Item **pItem,int count) const; |
---|
| 1064 | uint8 CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, uint32 count, bool swap ) const; |
---|
| 1065 | uint8 CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true ) const; |
---|
| 1066 | uint8 CanUnequipItems( uint32 item, uint32 count ) const; |
---|
| 1067 | uint8 CanUnequipItem( uint16 src, bool swap ) const; |
---|
| 1068 | uint8 CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true ) const; |
---|
| 1069 | uint8 CanUseItem( Item *pItem, bool not_loading = true ) const; |
---|
| 1070 | bool HasItemTotemCategory( uint32 TotemCategory ) const; |
---|
| 1071 | bool CanUseItem( ItemPrototype const *pItem ); |
---|
| 1072 | uint8 CanUseAmmo( uint32 item ) const; |
---|
| 1073 | Item* StoreNewItem( ItemPosCountVec const& pos, uint32 item, bool update,int32 randomPropertyId = 0 ); |
---|
| 1074 | Item* StoreItem( ItemPosCountVec const& pos, Item *pItem, bool update ); |
---|
| 1075 | Item* EquipNewItem( uint16 pos, uint32 item, uint32 count, bool update ); |
---|
| 1076 | Item* EquipItem( uint16 pos, Item *pItem, bool update ); |
---|
| 1077 | void AutoUnequipOffhandIfNeed(); |
---|
| 1078 | |
---|
| 1079 | uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; |
---|
| 1080 | uint8 _CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL ) const; |
---|
| 1081 | |
---|
| 1082 | void ApplyEquipCooldown( Item * pItem ); |
---|
| 1083 | void SetAmmo( uint32 item ); |
---|
| 1084 | void RemoveAmmo(); |
---|
| 1085 | float GetAmmoDPS() const { return m_ammoDPS; } |
---|
| 1086 | bool CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const; |
---|
| 1087 | void QuickEquipItem( uint16 pos, Item *pItem); |
---|
| 1088 | void VisualizeItem( uint8 slot, Item *pItem); |
---|
| 1089 | void SetVisibleItemSlot(uint8 slot, Item *pItem); |
---|
| 1090 | Item* BankItem( ItemPosCountVec const& dest, Item *pItem, bool update ) |
---|
| 1091 | { |
---|
| 1092 | return StoreItem( dest, pItem, update); |
---|
| 1093 | } |
---|
| 1094 | Item* BankItem( uint16 pos, Item *pItem, bool update ); |
---|
| 1095 | void RemoveItem( uint8 bag, uint8 slot, bool update ); |
---|
| 1096 | void MoveItemFromInventory(uint8 bag, uint8 slot, bool update); |
---|
| 1097 | // in trade, auction, guild bank, mail.... |
---|
| 1098 | void MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB = false); |
---|
| 1099 | // in trade, guild bank, mail.... |
---|
| 1100 | void RemoveItemDependentAurasAndCasts( Item * pItem ); |
---|
| 1101 | void DestroyItem( uint8 bag, uint8 slot, bool update ); |
---|
| 1102 | void DestroyItemCount( uint32 item, uint32 count, bool update, bool unequip_check = false); |
---|
| 1103 | void DestroyItemCount( Item* item, uint32& count, bool update ); |
---|
| 1104 | void DestroyConjuredItems( bool update ); |
---|
| 1105 | void DestroyZoneLimitedItem( bool update, uint32 new_zone ); |
---|
| 1106 | void SplitItem( uint16 src, uint16 dst, uint32 count ); |
---|
| 1107 | void SwapItem( uint16 src, uint16 dst ); |
---|
| 1108 | void AddItemToBuyBackSlot( Item *pItem ); |
---|
| 1109 | Item* GetItemFromBuyBackSlot( uint32 slot ); |
---|
| 1110 | void RemoveItemFromBuyBackSlot( uint32 slot, bool del ); |
---|
| 1111 | uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } |
---|
| 1112 | void SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ); |
---|
| 1113 | void SendBuyError( uint8 msg, Creature* pCreature, uint32 item, uint32 param ); |
---|
| 1114 | void SendSellError( uint8 msg, Creature* pCreature, uint64 guid, uint32 param ); |
---|
| 1115 | void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } |
---|
| 1116 | void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; } |
---|
| 1117 | uint32 GetWeaponProficiency() const { return m_WeaponProficiency; } |
---|
| 1118 | uint32 GetArmorProficiency() const { return m_ArmorProficiency; } |
---|
| 1119 | bool IsInFeralForm() const { return m_form == FORM_CAT || m_form == FORM_BEAR || m_form == FORM_DIREBEAR; } |
---|
| 1120 | bool IsUseEquipedWeapon( bool mainhand ) const |
---|
| 1121 | { |
---|
| 1122 | // disarm applied only to mainhand weapon |
---|
| 1123 | return !IsInFeralForm() && (!mainhand || !HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISARMED) ); |
---|
| 1124 | } |
---|
| 1125 | void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false ); |
---|
| 1126 | bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint64 bagguid, uint8 slot); |
---|
| 1127 | |
---|
| 1128 | float GetReputationPriceDiscount( Creature const* pCreature ) const; |
---|
| 1129 | Player* GetTrader() const { return pTrader; } |
---|
| 1130 | void ClearTrade(); |
---|
| 1131 | void TradeCancel(bool sendback); |
---|
| 1132 | uint16 GetItemPosByTradeSlot(uint32 slot) const { return tradeItems[slot]; } |
---|
| 1133 | |
---|
| 1134 | void UpdateEnchantTime(uint32 time); |
---|
| 1135 | void UpdateItemDuration(uint32 time, bool realtimeonly=false); |
---|
| 1136 | void AddEnchantmentDurations(Item *item); |
---|
| 1137 | void RemoveEnchantmentDurations(Item *item); |
---|
| 1138 | void RemoveAllEnchantments(EnchantmentSlot slot); |
---|
| 1139 | void AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 duration); |
---|
| 1140 | void ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool apply_dur = true, bool ignore_condition = false); |
---|
| 1141 | void ApplyEnchantment(Item *item,bool apply); |
---|
| 1142 | void SendEnchantmentDurations(); |
---|
| 1143 | void AddItemDurations(Item *item); |
---|
| 1144 | void RemoveItemDurations(Item *item); |
---|
| 1145 | void SendItemDurations(); |
---|
| 1146 | void LoadCorpse(); |
---|
| 1147 | void LoadPet(); |
---|
| 1148 | |
---|
| 1149 | uint32 m_stableSlots; |
---|
| 1150 | |
---|
| 1151 | /*********************************************************/ |
---|
| 1152 | /*** QUEST SYSTEM ***/ |
---|
| 1153 | /*********************************************************/ |
---|
| 1154 | |
---|
| 1155 | void PrepareQuestMenu( uint64 guid ); |
---|
| 1156 | void SendPreparedQuest( uint64 guid ); |
---|
| 1157 | bool IsActiveQuest( uint32 quest_id ) const; |
---|
| 1158 | Quest const *GetNextQuest( uint64 guid, Quest const *pQuest ); |
---|
| 1159 | bool CanSeeStartQuest( Quest const *pQuest ); |
---|
| 1160 | bool CanTakeQuest( Quest const *pQuest, bool msg ); |
---|
| 1161 | bool CanAddQuest( Quest const *pQuest, bool msg ); |
---|
| 1162 | bool CanCompleteQuest( uint32 quest_id ); |
---|
| 1163 | bool CanCompleteRepeatableQuest(Quest const *pQuest); |
---|
| 1164 | bool CanRewardQuest( Quest const *pQuest, bool msg ); |
---|
| 1165 | bool CanRewardQuest( Quest const *pQuest, uint32 reward, bool msg ); |
---|
| 1166 | void AddQuest( Quest const *pQuest, Object *questGiver ); |
---|
| 1167 | void CompleteQuest( uint32 quest_id ); |
---|
| 1168 | void IncompleteQuest( uint32 quest_id ); |
---|
| 1169 | void RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce = true ); |
---|
| 1170 | void FailQuest( uint32 quest_id ); |
---|
| 1171 | void FailTimedQuest( uint32 quest_id ); |
---|
| 1172 | bool SatisfyQuestSkillOrClass( Quest const* qInfo, bool msg ); |
---|
| 1173 | bool SatisfyQuestLevel( Quest const* qInfo, bool msg ); |
---|
| 1174 | bool SatisfyQuestLog( bool msg ); |
---|
| 1175 | bool SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ); |
---|
| 1176 | bool SatisfyQuestRace( Quest const* qInfo, bool msg ); |
---|
| 1177 | bool SatisfyQuestReputation( Quest const* qInfo, bool msg ); |
---|
| 1178 | bool SatisfyQuestStatus( Quest const* qInfo, bool msg ); |
---|
| 1179 | bool SatisfyQuestTimed( Quest const* qInfo, bool msg ); |
---|
| 1180 | bool SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ); |
---|
| 1181 | bool SatisfyQuestNextChain( Quest const* qInfo, bool msg ); |
---|
| 1182 | bool SatisfyQuestPrevChain( Quest const* qInfo, bool msg ); |
---|
| 1183 | bool SatisfyQuestDay( Quest const* qInfo, bool msg ); |
---|
| 1184 | bool GiveQuestSourceItem( Quest const *pQuest ); |
---|
| 1185 | bool TakeQuestSourceItem( uint32 quest_id, bool msg ); |
---|
| 1186 | bool GetQuestRewardStatus( uint32 quest_id ) const; |
---|
| 1187 | QuestStatus GetQuestStatus( uint32 quest_id ) const; |
---|
| 1188 | void SetQuestStatus( uint32 quest_id, QuestStatus status ); |
---|
| 1189 | |
---|
| 1190 | void SetDailyQuestStatus( uint32 quest_id ); |
---|
| 1191 | void ResetDailyQuestStatus(); |
---|
| 1192 | |
---|
| 1193 | uint16 FindQuestSlot( uint32 quest_id ) const; |
---|
| 1194 | uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } |
---|
| 1195 | uint32 GetQuestSlotState(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET); } |
---|
| 1196 | uint32 GetQuestSlotCounters(uint16 slot)const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET); } |
---|
| 1197 | uint8 GetQuestSlotCounter(uint16 slot,uint8 counter) const { return GetByteValue(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,counter); } |
---|
| 1198 | uint32 GetQuestSlotTime(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET); } |
---|
| 1199 | void SetQuestSlot(uint16 slot,uint32 quest_id, uint32 timer = 0) |
---|
| 1200 | { |
---|
| 1201 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_ID_OFFSET,quest_id); |
---|
| 1202 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,0); |
---|
| 1203 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,0); |
---|
| 1204 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET,timer); |
---|
| 1205 | } |
---|
| 1206 | void SetQuestSlotCounter(uint16 slot,uint8 counter,uint8 count) { SetByteValue(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,counter,count); } |
---|
| 1207 | void SetQuestSlotState(uint16 slot,uint32 state) { SetFlag(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,state); } |
---|
| 1208 | void RemoveQuestSlotState(uint16 slot,uint32 state) { RemoveFlag(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,state); } |
---|
| 1209 | void SetQuestSlotTimer(uint16 slot,uint32 timer) { SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET,timer); } |
---|
| 1210 | void SwapQuestSlot(uint16 slot1,uint16 slot2) |
---|
| 1211 | { |
---|
| 1212 | for (int i = 0; i < MAX_QUEST_OFFSET ; ++i ) |
---|
| 1213 | { |
---|
| 1214 | uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i); |
---|
| 1215 | uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i); |
---|
| 1216 | |
---|
| 1217 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i, temp2); |
---|
| 1218 | SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i, temp1); |
---|
| 1219 | } |
---|
| 1220 | } |
---|
| 1221 | uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry); |
---|
| 1222 | void AdjustQuestReqItemCount( Quest const* pQuest ); |
---|
| 1223 | void AreaExploredOrEventHappens( uint32 questId ); |
---|
| 1224 | void GroupEventHappens( uint32 questId, WorldObject const* pEventObject ); |
---|
| 1225 | void ItemAddedQuestCheck( uint32 entry, uint32 count ); |
---|
| 1226 | void ItemRemovedQuestCheck( uint32 entry, uint32 count ); |
---|
| 1227 | void KilledMonster( uint32 entry, uint64 guid ); |
---|
| 1228 | void CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id ); |
---|
| 1229 | void TalkedToCreature( uint32 entry, uint64 guid ); |
---|
| 1230 | void MoneyChanged( uint32 value ); |
---|
| 1231 | bool HasQuestForItem( uint32 itemid ) const; |
---|
| 1232 | bool HasQuestForGO(int32 GOId); |
---|
| 1233 | void UpdateForQuestsGO(); |
---|
| 1234 | bool CanShareQuest(uint32 quest_id) const; |
---|
| 1235 | |
---|
| 1236 | void SendQuestComplete( uint32 quest_id ); |
---|
| 1237 | void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver ); |
---|
| 1238 | void SendQuestFailed( uint32 quest_id ); |
---|
| 1239 | void SendQuestTimerFailed( uint32 quest_id ); |
---|
| 1240 | void SendCanTakeQuestResponse( uint32 msg ); |
---|
| 1241 | void SendPushToPartyResponse( Player *pPlayer, uint32 msg ); |
---|
| 1242 | void SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint32 count ); |
---|
| 1243 | void SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ); |
---|
| 1244 | |
---|
| 1245 | uint64 GetDivider() { return m_divider; }; |
---|
| 1246 | void SetDivider( uint64 guid ) { m_divider = guid; }; |
---|
| 1247 | |
---|
| 1248 | uint32 GetInGameTime() { return m_ingametime; }; |
---|
| 1249 | |
---|
| 1250 | void SetInGameTime( uint32 time ) { m_ingametime = time; }; |
---|
| 1251 | |
---|
| 1252 | void AddTimedQuest( uint32 quest_id ) { m_timedquests.insert(quest_id); } |
---|
| 1253 | |
---|
| 1254 | /*********************************************************/ |
---|
| 1255 | /*** LOAD SYSTEM ***/ |
---|
| 1256 | /*********************************************************/ |
---|
| 1257 | |
---|
| 1258 | bool LoadFromDB(uint32 guid, SqlQueryHolder *holder); |
---|
| 1259 | bool MinimalLoadFromDB(QueryResult *result, uint32 guid); |
---|
| 1260 | static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid); |
---|
| 1261 | static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index); |
---|
| 1262 | static float GetFloatValueFromArray(Tokens const& data, uint16 index); |
---|
| 1263 | static uint32 GetUInt32ValueFromDB(uint16 index, uint64 guid); |
---|
| 1264 | static float GetFloatValueFromDB(uint16 index, uint64 guid); |
---|
| 1265 | static uint32 GetZoneIdFromDB(uint64 guid); |
---|
| 1266 | static bool LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid); |
---|
| 1267 | |
---|
| 1268 | /*********************************************************/ |
---|
| 1269 | /*** SAVE SYSTEM ***/ |
---|
| 1270 | /*********************************************************/ |
---|
| 1271 | |
---|
| 1272 | void SaveToDB(); |
---|
| 1273 | void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing |
---|
| 1274 | void SaveGoldToDB() { SetUInt32ValueInDB(PLAYER_FIELD_COINAGE,GetMoney(),GetGUID()); } |
---|
| 1275 | static bool SaveValuesArrayInDB(Tokens const& data,uint64 guid); |
---|
| 1276 | static void SetUInt32ValueInArray(Tokens& data,uint16 index, uint32 value); |
---|
| 1277 | static void SetFloatValueInArray(Tokens& data,uint16 index, float value); |
---|
| 1278 | static void SetUInt32ValueInDB(uint16 index, uint32 value, uint64 guid); |
---|
| 1279 | static void SetFloatValueInDB(uint16 index, float value, uint64 guid); |
---|
| 1280 | static void SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid); |
---|
| 1281 | |
---|
| 1282 | bool m_mailsLoaded; |
---|
| 1283 | bool m_mailsUpdated; |
---|
| 1284 | |
---|
| 1285 | void SetBindPoint(uint64 guid); |
---|
| 1286 | void SendTalentWipeConfirm(uint64 guid); |
---|
| 1287 | void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker ); |
---|
| 1288 | void SendPetSkillWipeConfirm(); |
---|
| 1289 | void CalcRage( uint32 damage,bool attacker ); |
---|
| 1290 | void RegenerateAll(); |
---|
| 1291 | void Regenerate(Powers power); |
---|
| 1292 | void RegenerateHealth(); |
---|
| 1293 | void setRegenTimer(uint32 time) {m_regenTimer = time;} |
---|
| 1294 | void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;} |
---|
| 1295 | |
---|
| 1296 | uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); } |
---|
| 1297 | void ModifyMoney( int32 d ) |
---|
| 1298 | { |
---|
| 1299 | if(d < 0) |
---|
| 1300 | SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0); |
---|
| 1301 | else |
---|
| 1302 | SetMoney (GetMoney() < MAX_MONEY_AMOUNT - d ? GetMoney() + d : MAX_MONEY_AMOUNT); |
---|
| 1303 | |
---|
| 1304 | // "At Gold Limit" |
---|
| 1305 | if(GetMoney() >= MAX_MONEY_AMOUNT) |
---|
| 1306 | SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD,NULL,NULL); |
---|
| 1307 | } |
---|
| 1308 | void SetMoney( uint32 value ) |
---|
| 1309 | { |
---|
| 1310 | SetUInt32Value (PLAYER_FIELD_COINAGE, value); |
---|
| 1311 | MoneyChanged( value ); |
---|
| 1312 | } |
---|
| 1313 | |
---|
| 1314 | uint32 GetTutorialInt(uint32 intId ) |
---|
| 1315 | { |
---|
| 1316 | ASSERT( (intId < 8) ); |
---|
| 1317 | return m_Tutorials[intId]; |
---|
| 1318 | } |
---|
| 1319 | |
---|
| 1320 | void SetTutorialInt(uint32 intId, uint32 value) |
---|
| 1321 | { |
---|
| 1322 | ASSERT( (intId < 8) ); |
---|
| 1323 | if(m_Tutorials[intId]!=value) |
---|
| 1324 | { |
---|
| 1325 | m_Tutorials[intId] = value; |
---|
| 1326 | m_TutorialsChanged = true; |
---|
| 1327 | } |
---|
| 1328 | } |
---|
| 1329 | |
---|
| 1330 | QuestStatusMap& getQuestStatusMap() { return mQuestStatus; }; |
---|
| 1331 | |
---|
| 1332 | const uint64& GetSelection( ) const { return m_curSelection; } |
---|
| 1333 | void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } |
---|
| 1334 | |
---|
| 1335 | uint8 GetComboPoints() { return m_comboPoints; } |
---|
| 1336 | uint64 GetComboTarget() { return m_comboTarget; } |
---|
| 1337 | |
---|
| 1338 | void AddComboPoints(Unit* target, int8 count); |
---|
| 1339 | void ClearComboPoints(); |
---|
| 1340 | void SendComboPoints(); |
---|
| 1341 | |
---|
| 1342 | void SendMailResult(uint32 mailId, uint32 mailAction, uint32 mailError, uint32 equipError = 0, uint32 item_guid = 0, uint32 item_count = 0); |
---|
| 1343 | void SendNewMail(); |
---|
| 1344 | void UpdateNextMailTimeAndUnreads(); |
---|
| 1345 | void AddNewMailDeliverTime(time_t deliver_time); |
---|
| 1346 | bool IsMailsLoaded() const { return m_mailsLoaded; } |
---|
| 1347 | |
---|
| 1348 | //void SetMail(Mail *m); |
---|
| 1349 | void RemoveMail(uint32 id); |
---|
| 1350 | |
---|
| 1351 | void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo |
---|
| 1352 | uint32 GetMailSize() { return m_mail.size();}; |
---|
| 1353 | Mail* GetMail(uint32 id); |
---|
| 1354 | |
---|
| 1355 | PlayerMails::iterator GetmailBegin() { return m_mail.begin();}; |
---|
| 1356 | PlayerMails::iterator GetmailEnd() { return m_mail.end();}; |
---|
| 1357 | |
---|
| 1358 | /*********************************************************/ |
---|
| 1359 | /*** MAILED ITEMS SYSTEM ***/ |
---|
| 1360 | /*********************************************************/ |
---|
| 1361 | |
---|
| 1362 | uint8 unReadMails; |
---|
| 1363 | time_t m_nextMailDelivereTime; |
---|
| 1364 | |
---|
| 1365 | typedef HM_NAMESPACE::hash_map<uint32, Item*> ItemMap; |
---|
| 1366 | |
---|
| 1367 | ItemMap mMitems; //template defined in objectmgr.cpp |
---|
| 1368 | |
---|
| 1369 | Item* GetMItem(uint32 id) |
---|
| 1370 | { |
---|
| 1371 | ItemMap::const_iterator itr = mMitems.find(id); |
---|
| 1372 | if (itr != mMitems.end()) |
---|
| 1373 | return itr->second; |
---|
| 1374 | |
---|
| 1375 | return NULL; |
---|
| 1376 | } |
---|
| 1377 | |
---|
| 1378 | void AddMItem(Item* it) |
---|
| 1379 | { |
---|
| 1380 | ASSERT( it ); |
---|
| 1381 | //assert deleted, because items can be added before loading |
---|
| 1382 | mMitems[it->GetGUIDLow()] = it; |
---|
| 1383 | } |
---|
| 1384 | |
---|
| 1385 | bool RemoveMItem(uint32 id) |
---|
| 1386 | { |
---|
| 1387 | ItemMap::iterator i = mMitems.find(id); |
---|
| 1388 | if (i == mMitems.end()) |
---|
| 1389 | return false; |
---|
| 1390 | |
---|
| 1391 | mMitems.erase(i); |
---|
| 1392 | return true; |
---|
| 1393 | } |
---|
| 1394 | |
---|
| 1395 | void PetSpellInitialize(); |
---|
| 1396 | void CharmSpellInitialize(); |
---|
| 1397 | void PossessSpellInitialize(); |
---|
| 1398 | bool HasSpell(uint32 spell) const; |
---|
| 1399 | TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const; |
---|
| 1400 | bool IsSpellFitByClassAndRace( uint32 spell_id ) const; |
---|
| 1401 | |
---|
| 1402 | void SendProficiency(uint8 pr1, uint32 pr2); |
---|
| 1403 | void SendInitialSpells(); |
---|
| 1404 | bool addSpell(uint32 spell_id, bool active, bool learning = true, bool loading = false, uint16 slot_id=SPELL_WITHOUT_SLOT_ID, bool disabled = false); |
---|
| 1405 | void learnSpell(uint32 spell_id); |
---|
| 1406 | void removeSpell(uint32 spell_id, bool disabled = false); |
---|
| 1407 | void resetSpells(); |
---|
| 1408 | void learnDefaultSpells(bool loading = false); |
---|
| 1409 | void learnQuestRewardedSpells(); |
---|
| 1410 | void learnQuestRewardedSpells(Quest const* quest); |
---|
| 1411 | |
---|
| 1412 | uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); } |
---|
| 1413 | void SetFreeTalentPoints(uint32 points) { SetUInt32Value(PLAYER_CHARACTER_POINTS1,points); } |
---|
| 1414 | bool resetTalents(bool no_cost = false); |
---|
| 1415 | uint32 resetTalentsCost() const; |
---|
| 1416 | void InitTalentForLevel(); |
---|
| 1417 | |
---|
| 1418 | uint32 GetFreePrimaryProffesionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); } |
---|
| 1419 | void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2,profs); } |
---|
| 1420 | void InitPrimaryProffesions(); |
---|
| 1421 | |
---|
| 1422 | PlayerSpellMap const& GetSpellMap() const { return m_spells; } |
---|
| 1423 | PlayerSpellMap & GetSpellMap() { return m_spells; } |
---|
| 1424 | |
---|
| 1425 | void AddSpellMod(SpellModifier* mod, bool apply); |
---|
| 1426 | int32 GetTotalFlatMods(uint32 spellId, SpellModOp op); |
---|
| 1427 | int32 GetTotalPctMods(uint32 spellId, SpellModOp op); |
---|
| 1428 | bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell const* spell = NULL); |
---|
| 1429 | template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell = NULL); |
---|
| 1430 | void RemoveSpellMods(Spell const* spell); |
---|
| 1431 | |
---|
| 1432 | bool HasSpellCooldown(uint32 spell_id) const |
---|
| 1433 | { |
---|
| 1434 | SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); |
---|
| 1435 | return itr != m_spellCooldowns.end() && itr->second.end > time(NULL); |
---|
| 1436 | } |
---|
| 1437 | uint32 GetSpellCooldownDelay(uint32 spell_id) const |
---|
| 1438 | { |
---|
| 1439 | SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id); |
---|
| 1440 | time_t t = time(NULL); |
---|
| 1441 | return itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0; |
---|
| 1442 | } |
---|
| 1443 | void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time); |
---|
| 1444 | void SendCooldownEvent(SpellEntry const *spellInfo); |
---|
| 1445 | void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ); |
---|
| 1446 | void RemoveSpellCooldown(uint32 spell_id) { m_spellCooldowns.erase(spell_id); } |
---|
| 1447 | void RemoveArenaSpellCooldowns(); |
---|
| 1448 | void RemoveAllSpellCooldown(); |
---|
| 1449 | void _LoadSpellCooldowns(QueryResult *result); |
---|
| 1450 | void _SaveSpellCooldowns(); |
---|
| 1451 | |
---|
| 1452 | void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) |
---|
| 1453 | { |
---|
| 1454 | m_resurrectGUID = guid; |
---|
| 1455 | m_resurrectMap = mapId; |
---|
| 1456 | m_resurrectX = X; |
---|
| 1457 | m_resurrectY = Y; |
---|
| 1458 | m_resurrectZ = Z; |
---|
| 1459 | m_resurrectHealth = health; |
---|
| 1460 | m_resurrectMana = mana; |
---|
| 1461 | }; |
---|
| 1462 | void clearResurrectRequestData() { setResurrectRequestData(0,0,0.0f,0.0f,0.0f,0,0); } |
---|
| 1463 | bool isRessurectRequestedBy(uint64 guid) const { return m_resurrectGUID == guid; } |
---|
| 1464 | bool isRessurectRequested() const { return m_resurrectGUID != 0; } |
---|
| 1465 | void ResurectUsingRequestData(); |
---|
| 1466 | |
---|
| 1467 | int getCinematic() |
---|
| 1468 | { |
---|
| 1469 | return m_cinematic; |
---|
| 1470 | } |
---|
| 1471 | void setCinematic(int cine) |
---|
| 1472 | { |
---|
| 1473 | m_cinematic = cine; |
---|
| 1474 | } |
---|
| 1475 | |
---|
| 1476 | void addActionButton(uint8 button, uint16 action, uint8 type, uint8 misc); |
---|
| 1477 | void removeActionButton(uint8 button); |
---|
| 1478 | void SendInitialActionButtons(); |
---|
| 1479 | |
---|
| 1480 | PvPInfo pvpInfo; |
---|
| 1481 | void UpdatePvP(bool state, bool ovrride=false); |
---|
| 1482 | void UpdateZone(uint32 newZone); |
---|
| 1483 | void UpdateArea(uint32 newArea); |
---|
| 1484 | |
---|
| 1485 | void UpdateZoneDependentAuras( uint32 zone_id ); // zones |
---|
| 1486 | void UpdateAreaDependentAuras( uint32 area_id ); // subzones |
---|
| 1487 | |
---|
| 1488 | void UpdateAfkReport(time_t currTime); |
---|
| 1489 | void UpdatePvPFlag(time_t currTime); |
---|
| 1490 | void UpdateContestedPvP(uint32 currTime); |
---|
| 1491 | void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;} |
---|
| 1492 | void ResetContestedPvP() |
---|
| 1493 | { |
---|
| 1494 | clearUnitState(UNIT_STAT_ATTACK_PLAYER); |
---|
| 1495 | RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); |
---|
| 1496 | m_contestedPvPTimer = 0; |
---|
| 1497 | } |
---|
| 1498 | |
---|
| 1499 | /** todo: -maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler.. **/ |
---|
| 1500 | DuelInfo *duel; |
---|
| 1501 | void UpdateDuelFlag(time_t currTime); |
---|
| 1502 | void CheckDuelDistance(time_t currTime); |
---|
| 1503 | void DuelComplete(DuelCompleteType type); |
---|
| 1504 | |
---|
| 1505 | bool IsGroupVisibleFor(Player* p) const; |
---|
| 1506 | bool IsInSameGroupWith(Player const* p) const; |
---|
| 1507 | bool IsInSameRaidWith(Player const* p) const { return p==this || (GetGroup() != NULL && GetGroup() == p->GetGroup()); } |
---|
| 1508 | void UninviteFromGroup(); |
---|
| 1509 | static void RemoveFromGroup(Group* group, uint64 guid); |
---|
| 1510 | void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } |
---|
| 1511 | void SendUpdateToOutOfRangeGroupMembers(); |
---|
| 1512 | |
---|
| 1513 | void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, this->GetGUID()); } |
---|
| 1514 | void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, this->GetGUID()); } |
---|
| 1515 | void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } |
---|
| 1516 | uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } |
---|
| 1517 | static uint32 GetGuildIdFromDB(uint64 guid); |
---|
| 1518 | uint32 GetRank(){ return GetUInt32Value(PLAYER_GUILDRANK); } |
---|
| 1519 | static uint32 GetRankFromDB(uint64 guid); |
---|
| 1520 | int GetGuildIdInvited() { return m_GuildIdInvited; } |
---|
| 1521 | static void RemovePetitionsAndSigns(uint64 guid, uint32 type); |
---|
| 1522 | |
---|
| 1523 | // Arena Team |
---|
| 1524 | void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) |
---|
| 1525 | { |
---|
| 1526 | SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId); |
---|
| 1527 | SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, this->GetGUID()); |
---|
| 1528 | } |
---|
| 1529 | uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); } |
---|
| 1530 | static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); |
---|
| 1531 | void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; } |
---|
| 1532 | uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; } |
---|
| 1533 | |
---|
| 1534 | void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; } |
---|
| 1535 | uint8 GetDifficulty() { return m_dungeonDifficulty; } |
---|
| 1536 | |
---|
| 1537 | bool UpdateSkill(uint32 skill_id, uint32 step); |
---|
| 1538 | bool UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step); |
---|
| 1539 | |
---|
| 1540 | bool UpdateCraftSkill(uint32 spellid); |
---|
| 1541 | bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1); |
---|
| 1542 | bool UpdateFishingSkill(); |
---|
| 1543 | |
---|
| 1544 | uint32 GetBaseDefenseSkillValue() const { return GetBaseSkillValue(SKILL_DEFENSE); } |
---|
| 1545 | uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const; |
---|
| 1546 | |
---|
| 1547 | uint32 GetSpellByProto(ItemPrototype *proto); |
---|
| 1548 | |
---|
| 1549 | float GetHealthBonusFromStamina(); |
---|
| 1550 | float GetManaBonusFromIntellect(); |
---|
| 1551 | |
---|
| 1552 | bool UpdateStats(Stats stat); |
---|
| 1553 | bool UpdateAllStats(); |
---|
| 1554 | void UpdateResistances(uint32 school); |
---|
| 1555 | void UpdateArmor(); |
---|
| 1556 | void UpdateMaxHealth(); |
---|
| 1557 | void UpdateMaxPower(Powers power); |
---|
| 1558 | void UpdateAttackPowerAndDamage(bool ranged = false); |
---|
| 1559 | void UpdateShieldBlockValue(); |
---|
| 1560 | void UpdateDamagePhysical(WeaponAttackType attType); |
---|
| 1561 | void UpdateSpellDamageAndHealingBonus(); |
---|
| 1562 | |
---|
| 1563 | void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage); |
---|
| 1564 | |
---|
| 1565 | void UpdateDefenseBonusesMod(); |
---|
| 1566 | void ApplyRatingMod(CombatRating cr, int32 value, bool apply); |
---|
| 1567 | float GetMeleeCritFromAgility(); |
---|
| 1568 | float GetDodgeFromAgility(); |
---|
| 1569 | float GetSpellCritFromIntellect(); |
---|
| 1570 | float OCTRegenHPPerSpirit(); |
---|
| 1571 | float OCTRegenMPPerSpirit(); |
---|
| 1572 | float GetRatingCoefficient(CombatRating cr) const; |
---|
| 1573 | float GetRatingBonusValue(CombatRating cr) const; |
---|
| 1574 | uint32 GetMeleeCritDamageReduction(uint32 damage) const; |
---|
| 1575 | uint32 GetRangedCritDamageReduction(uint32 damage) const; |
---|
| 1576 | uint32 GetSpellCritDamageReduction(uint32 damage) const; |
---|
| 1577 | uint32 GetDotDamageReduction(uint32 damage) const; |
---|
| 1578 | |
---|
| 1579 | float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const; |
---|
| 1580 | void UpdateBlockPercentage(); |
---|
| 1581 | void UpdateCritPercentage(WeaponAttackType attType); |
---|
| 1582 | void UpdateAllCritPercentages(); |
---|
| 1583 | void UpdateParryPercentage(); |
---|
| 1584 | void UpdateDodgePercentage(); |
---|
| 1585 | void UpdateAllSpellCritChances(); |
---|
| 1586 | void UpdateSpellCritChance(uint32 school); |
---|
| 1587 | void UpdateExpertise(WeaponAttackType attType); |
---|
| 1588 | void UpdateManaRegen(); |
---|
| 1589 | |
---|
| 1590 | const uint64& GetLootGUID() const { return m_lootGuid; } |
---|
| 1591 | void SetLootGUID(const uint64 &guid) { m_lootGuid = guid; } |
---|
| 1592 | |
---|
| 1593 | void RemovedInsignia(Player* looterPlr); |
---|
| 1594 | |
---|
| 1595 | WorldSession* GetSession() const { return m_session; } |
---|
| 1596 | void SetSession(WorldSession *s) { m_session = s; } |
---|
| 1597 | |
---|
| 1598 | void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; |
---|
| 1599 | void DestroyForPlayer( Player *target ) const; |
---|
| 1600 | void SendDelayResponse(const uint32); |
---|
| 1601 | void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); |
---|
| 1602 | |
---|
| 1603 | //notifiers |
---|
| 1604 | void SendAttackSwingCantAttack(); |
---|
| 1605 | void SendAttackSwingCancelAttack(); |
---|
| 1606 | void SendAttackSwingDeadTarget(); |
---|
| 1607 | void SendAttackSwingNotStanding(); |
---|
| 1608 | void SendAttackSwingNotInRange(); |
---|
| 1609 | void SendAttackSwingBadFacingAttack(); |
---|
| 1610 | void SendAutoRepeatCancel(); |
---|
| 1611 | void SendExplorationExperience(uint32 Area, uint32 Experience); |
---|
| 1612 | |
---|
| 1613 | void SendDungeonDifficulty(bool IsInGroup); |
---|
| 1614 | void ResetInstances(uint8 method); |
---|
| 1615 | void SendResetInstanceSuccess(uint32 MapId); |
---|
| 1616 | void SendResetInstanceFailed(uint32 reason, uint32 MapId); |
---|
| 1617 | void SendResetFailedNotify(uint32 mapid); |
---|
| 1618 | |
---|
| 1619 | bool SetPosition(float x, float y, float z, float orientation, bool teleport = false); |
---|
| 1620 | void UpdateUnderwaterState( Map * m, float x, float y, float z ); |
---|
| 1621 | |
---|
| 1622 | void SendMessageToSet(WorldPacket *data, bool self);// overwrite Object::SendMessageToSet |
---|
| 1623 | void SendMessageToSetInRange(WorldPacket *data, float fist, bool self); |
---|
| 1624 | // overwrite Object::SendMessageToSetInRange |
---|
| 1625 | void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only); |
---|
| 1626 | |
---|
| 1627 | static void DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars = true); |
---|
| 1628 | |
---|
| 1629 | Corpse *GetCorpse() const; |
---|
| 1630 | void SpawnCorpseBones(); |
---|
| 1631 | void CreateCorpse(); |
---|
| 1632 | void KillPlayer(); |
---|
| 1633 | uint32 GetResurrectionSpellId(); |
---|
| 1634 | void ResurrectPlayer(float restore_percent, bool updateToWorld = true, bool applySickness = false); |
---|
| 1635 | void BuildPlayerRepop(); |
---|
| 1636 | void RepopAtGraveyard(); |
---|
| 1637 | |
---|
| 1638 | void DurabilityLossAll(double percent, bool inventory); |
---|
| 1639 | void DurabilityLoss(Item* item, double percent); |
---|
| 1640 | void DurabilityPointsLossAll(int32 points, bool inventory); |
---|
| 1641 | void DurabilityPointsLoss(Item* item, int32 points); |
---|
| 1642 | void DurabilityPointLossForEquipSlot(EquipmentSlots slot); |
---|
| 1643 | uint32 DurabilityRepairAll(bool cost, float discountMod, bool guildBank); |
---|
| 1644 | uint32 DurabilityRepair(uint16 pos, bool cost, float discountMod, bool guildBank); |
---|
| 1645 | |
---|
| 1646 | void StopMirrorTimers() |
---|
| 1647 | { |
---|
| 1648 | StopMirrorTimer(FATIGUE_TIMER); |
---|
| 1649 | StopMirrorTimer(BREATH_TIMER); |
---|
| 1650 | StopMirrorTimer(FIRE_TIMER); |
---|
| 1651 | } |
---|
| 1652 | |
---|
| 1653 | void SetMovement(PlayerMovementType pType); |
---|
| 1654 | |
---|
| 1655 | void JoinedChannel(Channel *c); |
---|
| 1656 | void LeftChannel(Channel *c); |
---|
| 1657 | void CleanupChannels(); |
---|
| 1658 | void UpdateLocalChannels( uint32 newZone ); |
---|
| 1659 | void LeaveLFGChannel(); |
---|
| 1660 | |
---|
| 1661 | void UpdateDefense(); |
---|
| 1662 | void UpdateWeaponSkill (WeaponAttackType attType); |
---|
| 1663 | void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, MeleeHitOutcome outcome, bool defence); |
---|
| 1664 | |
---|
| 1665 | void SetSkill(uint32 id, uint16 currVal, uint16 maxVal); |
---|
| 1666 | uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus |
---|
| 1667 | uint16 GetPureMaxSkillValue(uint32 skill) const; // max |
---|
| 1668 | uint16 GetSkillValue(uint32 skill) const; // skill value + perm. bonus + temp bonus |
---|
| 1669 | uint16 GetBaseSkillValue(uint32 skill) const; // skill value + perm. bonus |
---|
| 1670 | uint16 GetPureSkillValue(uint32 skill) const; // skill value |
---|
| 1671 | int16 GetSkillTempBonusValue(uint32 skill) const; |
---|
| 1672 | bool HasSkill(uint32 skill) const; |
---|
| 1673 | void learnSkillRewardedSpells( uint32 id ); |
---|
| 1674 | void learnSkillRewardedSpells(); |
---|
| 1675 | |
---|
| 1676 | void SetDontMove(bool dontMove); |
---|
| 1677 | bool GetDontMove() const { return m_dontMove; } |
---|
| 1678 | |
---|
| 1679 | void CheckExploreSystem(void); |
---|
| 1680 | |
---|
| 1681 | static uint32 TeamForRace(uint8 race); |
---|
| 1682 | uint32 GetTeam() const { return m_team; } |
---|
| 1683 | static uint32 getFactionForRace(uint8 race); |
---|
| 1684 | void setFactionForRace(uint8 race); |
---|
| 1685 | |
---|
| 1686 | bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; |
---|
| 1687 | bool RewardPlayerAndGroupAtKill(Unit* pVictim); |
---|
| 1688 | |
---|
| 1689 | FactionStateList m_factions; |
---|
| 1690 | ForcedReactions m_forcedReactions; |
---|
| 1691 | uint32 GetDefaultReputationFlags(const FactionEntry *factionEntry) const; |
---|
| 1692 | int32 GetBaseReputation(const FactionEntry *factionEntry) const; |
---|
| 1693 | int32 GetReputation(uint32 faction_id) const; |
---|
| 1694 | int32 GetReputation(const FactionEntry *factionEntry) const; |
---|
| 1695 | ReputationRank GetReputationRank(uint32 faction) const; |
---|
| 1696 | ReputationRank GetReputationRank(const FactionEntry *factionEntry) const; |
---|
| 1697 | ReputationRank GetBaseReputationRank(const FactionEntry *factionEntry) const; |
---|
| 1698 | ReputationRank ReputationToRank(int32 standing) const; |
---|
| 1699 | const static int32 ReputationRank_Length[MAX_REPUTATION_RANK]; |
---|
| 1700 | const static int32 Reputation_Cap = 42999; |
---|
| 1701 | const static int32 Reputation_Bottom = -42000; |
---|
| 1702 | bool ModifyFactionReputation(uint32 FactionTemplateId, int32 DeltaReputation); |
---|
| 1703 | bool ModifyFactionReputation(FactionEntry const* factionEntry, int32 standing); |
---|
| 1704 | bool ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing); |
---|
| 1705 | bool SetFactionReputation(uint32 FactionTemplateId, int32 standing); |
---|
| 1706 | bool SetFactionReputation(FactionEntry const* factionEntry, int32 standing); |
---|
| 1707 | bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing); |
---|
| 1708 | int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest); |
---|
| 1709 | void RewardReputation(Unit *pVictim, float rate); |
---|
| 1710 | void RewardReputation(Quest const *pQuest); |
---|
| 1711 | void SetInitialFactions(); |
---|
| 1712 | void UpdateReputation() const; |
---|
| 1713 | void SendFactionState(FactionState const* faction) const; |
---|
| 1714 | void SendInitialReputations(); |
---|
| 1715 | FactionState const* GetFactionState( FactionEntry const* factionEntry) const; |
---|
| 1716 | void SetFactionAtWar(FactionState* faction, bool atWar); |
---|
| 1717 | void SetFactionInactive(FactionState* faction, bool inactive); |
---|
| 1718 | void SetFactionVisible(FactionState* faction); |
---|
| 1719 | void SetFactionVisibleForFactionTemplateId(uint32 FactionTemplateId); |
---|
| 1720 | void SetFactionVisibleForFactionId(uint32 FactionId); |
---|
| 1721 | void UpdateMaxSkills(); |
---|
| 1722 | void UpdateSkillsToMaxSkillsForLevel(); // for .levelup |
---|
| 1723 | void ModifySkillBonus(uint32 skillid,int32 val, bool talent); |
---|
| 1724 | |
---|
| 1725 | /*********************************************************/ |
---|
| 1726 | /*** PVP SYSTEM ***/ |
---|
| 1727 | /*********************************************************/ |
---|
| 1728 | void UpdateArenaFields(); |
---|
| 1729 | void UpdateHonorFields(); |
---|
| 1730 | bool RewardHonor(Unit *pVictim, uint32 groupsize, float honor = -1, bool pvptoken = false); |
---|
| 1731 | uint32 GetHonorPoints() { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); } |
---|
| 1732 | uint32 GetArenaPoints() { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); } |
---|
| 1733 | void ModifyHonorPoints( int32 value ); |
---|
| 1734 | void ModifyArenaPoints( int32 value ); |
---|
| 1735 | uint32 GetMaxPersonalArenaRatingRequirement(); |
---|
| 1736 | |
---|
| 1737 | //End of PvP System |
---|
| 1738 | |
---|
| 1739 | void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0); |
---|
| 1740 | uint16 GetDrunkValue() const { return m_drunk; } |
---|
| 1741 | static DrunkenState GetDrunkenstateByValue(uint16 value); |
---|
| 1742 | |
---|
| 1743 | uint32 GetDeathTimer() const { return m_deathTimer; } |
---|
| 1744 | uint32 GetCorpseReclaimDelay(bool pvp) const; |
---|
| 1745 | void UpdateCorpseReclaimDelay(); |
---|
| 1746 | void SendCorpseReclaimDelay(bool load = false); |
---|
| 1747 | |
---|
| 1748 | uint32 GetShieldBlockValue() const; // overwrite Unit version (virtual) |
---|
| 1749 | bool CanParry() const { return m_canParry; } |
---|
| 1750 | void SetCanParry(bool value); |
---|
| 1751 | bool CanBlock() const { return m_canBlock; } |
---|
| 1752 | void SetCanBlock(bool value); |
---|
| 1753 | bool CanDualWield() const { return m_canDualWield; } |
---|
| 1754 | void SetCanDualWield(bool value) { m_canDualWield = value; } |
---|
| 1755 | |
---|
| 1756 | void SetRegularAttackTime(); |
---|
| 1757 | void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; } |
---|
| 1758 | void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply, bool affectStats = true); |
---|
| 1759 | float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const; |
---|
| 1760 | float GetTotalBaseModValue(BaseModGroup modGroup) const; |
---|
| 1761 | float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; } |
---|
| 1762 | void _ApplyAllStatBonuses(); |
---|
| 1763 | void _RemoveAllStatBonuses(); |
---|
| 1764 | |
---|
| 1765 | void _ApplyWeaponDependentAuraMods(Item *item,WeaponAttackType attackType,bool apply); |
---|
| 1766 | void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply); |
---|
| 1767 | void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply); |
---|
| 1768 | |
---|
| 1769 | void _ApplyItemMods(Item *item,uint8 slot,bool apply); |
---|
| 1770 | void _RemoveAllItemMods(); |
---|
| 1771 | void _ApplyAllItemMods(); |
---|
| 1772 | void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply); |
---|
| 1773 | void _ApplyAmmoBonuses(); |
---|
| 1774 | bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot); |
---|
| 1775 | void ToggleMetaGemsActive(uint8 exceptslot, bool apply); |
---|
| 1776 | void CorrectMetaGemEnchants(uint8 slot, bool apply); |
---|
| 1777 | void InitDataForForm(bool reapplyMods = false); |
---|
| 1778 | |
---|
| 1779 | void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false); |
---|
| 1780 | void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false); |
---|
| 1781 | void UpdateEquipSpellsAtFormChange(); |
---|
| 1782 | void CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType); |
---|
| 1783 | |
---|
[44] | 1784 | void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0); |
---|
[37] | 1785 | void SendUpdateWorldState(uint32 Field, uint32 Value); |
---|
| 1786 | void SendDirectMessage(WorldPacket *data); |
---|
| 1787 | |
---|
| 1788 | void SendAuraDurationsForTarget(Unit* target); |
---|
| 1789 | |
---|
| 1790 | PlayerMenu* PlayerTalkClass; |
---|
| 1791 | std::vector<ItemSetEffect *> ItemSetEff; |
---|
| 1792 | |
---|
| 1793 | void SendLoot(uint64 guid, LootType loot_type); |
---|
| 1794 | void SendLootRelease( uint64 guid ); |
---|
| 1795 | void SendNotifyLootItemRemoved(uint8 lootSlot); |
---|
| 1796 | void SendNotifyLootMoneyRemoved(); |
---|
| 1797 | |
---|
| 1798 | /*********************************************************/ |
---|
| 1799 | /*** BATTLEGROUND SYSTEM ***/ |
---|
| 1800 | /*********************************************************/ |
---|
| 1801 | |
---|
| 1802 | bool InBattleGround() const { return m_bgBattleGroundID != 0; } |
---|
| 1803 | uint32 GetBattleGroundId() const { return m_bgBattleGroundID; } |
---|
| 1804 | BattleGround* GetBattleGround() const; |
---|
| 1805 | bool InArena() const; |
---|
| 1806 | |
---|
| 1807 | static uint32 GetMinLevelForBattleGroundQueueId(uint32 queue_id); |
---|
| 1808 | static uint32 GetMaxLevelForBattleGroundQueueId(uint32 queue_id); |
---|
| 1809 | uint32 GetBattleGroundQueueIdFromLevel() const; |
---|
| 1810 | |
---|
[44] | 1811 | bool InBattleGroundQueue() const |
---|
| 1812 | { |
---|
| 1813 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1814 | if (m_bgBattleGroundQueueID[i].bgQueueType != 0) |
---|
| 1815 | return true; |
---|
| 1816 | return false; |
---|
| 1817 | } |
---|
[37] | 1818 | |
---|
| 1819 | uint32 GetBattleGroundQueueId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueType; } |
---|
| 1820 | uint32 GetBattleGroundQueueIndex(uint32 bgQueueType) const |
---|
| 1821 | { |
---|
| 1822 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1823 | if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType) |
---|
| 1824 | return i; |
---|
| 1825 | return PLAYER_MAX_BATTLEGROUND_QUEUES; |
---|
| 1826 | } |
---|
| 1827 | bool IsInvitedForBattleGroundQueueType(uint32 bgQueueType) const |
---|
| 1828 | { |
---|
| 1829 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1830 | if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType) |
---|
| 1831 | return m_bgBattleGroundQueueID[i].invitedToInstance != 0; |
---|
| 1832 | return PLAYER_MAX_BATTLEGROUND_QUEUES; |
---|
| 1833 | } |
---|
| 1834 | bool InBattleGroundQueueForBattleGroundQueueType(uint32 bgQueueType) const |
---|
| 1835 | { |
---|
| 1836 | return GetBattleGroundQueueIndex(bgQueueType) < PLAYER_MAX_BATTLEGROUND_QUEUES; |
---|
| 1837 | } |
---|
| 1838 | |
---|
| 1839 | void SetBattleGroundId(uint32 val) { m_bgBattleGroundID = val; } |
---|
| 1840 | uint32 AddBattleGroundQueueId(uint32 val) |
---|
| 1841 | { |
---|
| 1842 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1843 | { |
---|
| 1844 | if (m_bgBattleGroundQueueID[i].bgQueueType == 0 || m_bgBattleGroundQueueID[i].bgQueueType == val) |
---|
| 1845 | { |
---|
| 1846 | m_bgBattleGroundQueueID[i].bgQueueType = val; |
---|
| 1847 | m_bgBattleGroundQueueID[i].invitedToInstance = 0; |
---|
| 1848 | return i; |
---|
| 1849 | } |
---|
| 1850 | } |
---|
| 1851 | return PLAYER_MAX_BATTLEGROUND_QUEUES; |
---|
| 1852 | } |
---|
| 1853 | bool HasFreeBattleGroundQueueId() |
---|
| 1854 | { |
---|
| 1855 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1856 | if (m_bgBattleGroundQueueID[i].bgQueueType == 0) |
---|
| 1857 | return true; |
---|
| 1858 | return false; |
---|
| 1859 | } |
---|
| 1860 | void RemoveBattleGroundQueueId(uint32 val) |
---|
| 1861 | { |
---|
| 1862 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1863 | { |
---|
| 1864 | if (m_bgBattleGroundQueueID[i].bgQueueType == val) |
---|
| 1865 | { |
---|
| 1866 | m_bgBattleGroundQueueID[i].bgQueueType = 0; |
---|
| 1867 | m_bgBattleGroundQueueID[i].invitedToInstance = 0; |
---|
| 1868 | return; |
---|
| 1869 | } |
---|
| 1870 | } |
---|
| 1871 | } |
---|
| 1872 | void SetInviteForBattleGroundQueueType(uint32 bgQueueType, uint32 instanceId) |
---|
| 1873 | { |
---|
| 1874 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1875 | if (m_bgBattleGroundQueueID[i].bgQueueType == bgQueueType) |
---|
| 1876 | m_bgBattleGroundQueueID[i].invitedToInstance = instanceId; |
---|
| 1877 | } |
---|
| 1878 | bool IsInvitedForBattleGroundInstance(uint32 instanceId) const |
---|
| 1879 | { |
---|
| 1880 | for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) |
---|
| 1881 | if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId) |
---|
| 1882 | return true; |
---|
| 1883 | return false; |
---|
| 1884 | } |
---|
| 1885 | uint32 GetBattleGroundEntryPointMap() const { return m_bgEntryPointMap; } |
---|
| 1886 | float GetBattleGroundEntryPointX() const { return m_bgEntryPointX; } |
---|
| 1887 | float GetBattleGroundEntryPointY() const { return m_bgEntryPointY; } |
---|
| 1888 | float GetBattleGroundEntryPointZ() const { return m_bgEntryPointZ; } |
---|
| 1889 | float GetBattleGroundEntryPointO() const { return m_bgEntryPointO; } |
---|
| 1890 | void SetBattleGroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO ) |
---|
| 1891 | { |
---|
| 1892 | m_bgEntryPointMap = Map; |
---|
| 1893 | m_bgEntryPointX = PosX; |
---|
| 1894 | m_bgEntryPointY = PosY; |
---|
| 1895 | m_bgEntryPointZ = PosZ; |
---|
| 1896 | m_bgEntryPointO = PosO; |
---|
| 1897 | } |
---|
| 1898 | |
---|
| 1899 | void SetBGTeam(uint32 team) { m_bgTeam = team; } |
---|
| 1900 | uint32 GetBGTeam() const { return m_bgTeam ? m_bgTeam : GetTeam(); } |
---|
| 1901 | |
---|
| 1902 | void LeaveBattleground(bool teleportToEntryPoint = true); |
---|
| 1903 | bool CanJoinToBattleground() const; |
---|
| 1904 | bool CanReportAfkDueToLimit(); |
---|
| 1905 | void ReportedAfkBy(Player* reporter); |
---|
| 1906 | void ClearAfkReports() { m_bgAfkReporter.clear(); } |
---|
| 1907 | |
---|
| 1908 | bool GetBGAccessByLevel(uint32 bgTypeId) const; |
---|
| 1909 | bool isAllowUseBattleGroundObject(); |
---|
| 1910 | |
---|
| 1911 | /*********************************************************/ |
---|
[44] | 1912 | /*** OUTDOOR PVP SYSTEM ***/ |
---|
| 1913 | /*********************************************************/ |
---|
| 1914 | |
---|
| 1915 | OutdoorPvP * GetOutdoorPvP() const; |
---|
| 1916 | // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise |
---|
| 1917 | bool IsOutdoorPvPActive(); |
---|
| 1918 | |
---|
| 1919 | /*********************************************************/ |
---|
[37] | 1920 | /*** REST SYSTEM ***/ |
---|
| 1921 | /*********************************************************/ |
---|
| 1922 | |
---|
| 1923 | bool isRested() const { return GetRestTime() >= 10000; } |
---|
| 1924 | uint32 GetXPRestBonus(uint32 xp); |
---|
| 1925 | uint32 GetRestTime() const { return m_restTime;}; |
---|
| 1926 | void SetRestTime(uint32 v) { m_restTime = v;}; |
---|
| 1927 | |
---|
| 1928 | /*********************************************************/ |
---|
| 1929 | /*** ENVIROMENTAL SYSTEM ***/ |
---|
| 1930 | /*********************************************************/ |
---|
| 1931 | |
---|
| 1932 | void EnvironmentalDamage(uint64 guid, EnviromentalDamage type, uint32 damage); |
---|
| 1933 | |
---|
| 1934 | /*********************************************************/ |
---|
| 1935 | /*** FLOOD FILTER SYSTEM ***/ |
---|
| 1936 | /*********************************************************/ |
---|
| 1937 | |
---|
| 1938 | void UpdateSpeakTime(); |
---|
| 1939 | bool CanSpeak() const; |
---|
| 1940 | void ChangeSpeakTime(int utime); |
---|
| 1941 | |
---|
| 1942 | /*********************************************************/ |
---|
| 1943 | /*** VARIOUS SYSTEMS ***/ |
---|
| 1944 | /*********************************************************/ |
---|
| 1945 | MovementInfo m_movementInfo; |
---|
| 1946 | bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); } |
---|
| 1947 | bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); } |
---|
| 1948 | |
---|
| 1949 | bool CanFly() const { return HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); } |
---|
| 1950 | bool IsFlying() const { return HasUnitMovementFlag(MOVEMENTFLAG_FLYING); } |
---|
| 1951 | |
---|
| 1952 | void HandleDrowning(); |
---|
| 1953 | |
---|
| 1954 | void SetClientControl(Unit* target, uint8 allowMove); |
---|
| 1955 | |
---|
| 1956 | // Transports |
---|
| 1957 | Transport * GetTransport() const { return m_transport; } |
---|
| 1958 | void SetTransport(Transport * t) { m_transport = t; } |
---|
| 1959 | |
---|
| 1960 | float GetTransOffsetX() const { return m_movementInfo.t_x; } |
---|
| 1961 | float GetTransOffsetY() const { return m_movementInfo.t_y; } |
---|
| 1962 | float GetTransOffsetZ() const { return m_movementInfo.t_z; } |
---|
| 1963 | float GetTransOffsetO() const { return m_movementInfo.t_o; } |
---|
| 1964 | uint32 GetTransTime() const { return m_movementInfo.t_time; } |
---|
| 1965 | |
---|
| 1966 | uint32 GetSaveTimer() const { return m_nextSave; } |
---|
| 1967 | void SetSaveTimer(uint32 timer) { m_nextSave = timer; } |
---|
| 1968 | |
---|
| 1969 | // Recall position |
---|
| 1970 | uint32 m_recallMap; |
---|
| 1971 | float m_recallX; |
---|
| 1972 | float m_recallY; |
---|
| 1973 | float m_recallZ; |
---|
| 1974 | float m_recallO; |
---|
| 1975 | void SaveRecallPosition(); |
---|
| 1976 | |
---|
| 1977 | // Homebind coordinates |
---|
| 1978 | uint32 m_homebindMapId; |
---|
| 1979 | uint16 m_homebindZoneId; |
---|
| 1980 | float m_homebindX; |
---|
| 1981 | float m_homebindY; |
---|
| 1982 | float m_homebindZ; |
---|
| 1983 | |
---|
| 1984 | // currently visible objects at player client |
---|
| 1985 | typedef std::set<uint64> ClientGUIDs; |
---|
| 1986 | ClientGUIDs m_clientGUIDs; |
---|
| 1987 | |
---|
| 1988 | bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); } |
---|
| 1989 | |
---|
| 1990 | bool IsVisibleInGridForPlayer(Player* pl) const; |
---|
| 1991 | bool IsVisibleGloballyFor(Player* pl) const; |
---|
| 1992 | |
---|
| 1993 | void UpdateVisibilityOf(WorldObject* target); |
---|
| 1994 | |
---|
| 1995 | template<class T> |
---|
| 1996 | void UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); |
---|
| 1997 | |
---|
| 1998 | // Stealth detection system |
---|
| 1999 | uint32 m_DetectInvTimer; |
---|
| 2000 | void HandleStealthedUnitsDetection(); |
---|
| 2001 | |
---|
| 2002 | uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; |
---|
| 2003 | |
---|
| 2004 | bool HasAtLoginFlag(AtLoginFlags f) const { return m_atLoginFlags & f; } |
---|
| 2005 | void SetAtLoginFlag(AtLoginFlags f) { m_atLoginFlags |= f; } |
---|
| 2006 | |
---|
| 2007 | LookingForGroup m_lookingForGroup; |
---|
| 2008 | |
---|
| 2009 | // Temporarily removed pet cache |
---|
| 2010 | uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; } |
---|
| 2011 | void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; } |
---|
| 2012 | uint32 GetOldPetSpell() const { return m_oldpetspell; } |
---|
| 2013 | void SetOldPetSpell(uint32 petspell) { m_oldpetspell = petspell; } |
---|
| 2014 | |
---|
| 2015 | /*********************************************************/ |
---|
| 2016 | /*** INSTANCE SYSTEM ***/ |
---|
| 2017 | /*********************************************************/ |
---|
| 2018 | |
---|
| 2019 | typedef HM_NAMESPACE::hash_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; |
---|
| 2020 | |
---|
| 2021 | void UpdateHomebindTime(uint32 time); |
---|
| 2022 | |
---|
| 2023 | uint32 m_HomebindTimer; |
---|
| 2024 | bool m_InstanceValid; |
---|
| 2025 | // permanent binds and solo binds by difficulty |
---|
| 2026 | BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES]; |
---|
| 2027 | InstancePlayerBind* GetBoundInstance(uint32 mapid, uint8 difficulty); |
---|
| 2028 | BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; } |
---|
| 2029 | void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); |
---|
| 2030 | void UnbindInstance(BoundInstancesMap::iterator &itr, uint8 difficulty, bool unload = false); |
---|
| 2031 | InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); |
---|
| 2032 | void SendRaidInfo(); |
---|
| 2033 | void SendSavedInstances(); |
---|
| 2034 | static void ConvertInstancesToGroup(Player *player, Group *group = NULL, uint64 player_guid = 0); |
---|
| 2035 | |
---|
| 2036 | /*********************************************************/ |
---|
| 2037 | /*** GROUP SYSTEM ***/ |
---|
| 2038 | /*********************************************************/ |
---|
| 2039 | |
---|
| 2040 | Group * GetGroupInvite() { return m_groupInvite; } |
---|
| 2041 | void SetGroupInvite(Group *group) { m_groupInvite = group; } |
---|
| 2042 | Group * GetGroup() { return m_group.getTarget(); } |
---|
| 2043 | const Group * GetGroup() const { return (const Group*)m_group.getTarget(); } |
---|
| 2044 | GroupReference& GetGroupRef() { return m_group; } |
---|
| 2045 | void SetGroup(Group *group, int8 subgroup = -1); |
---|
| 2046 | uint8 GetSubGroup() const { return m_group.getSubGroup(); } |
---|
| 2047 | uint32 GetGroupUpdateFlag() { return m_groupUpdateMask; } |
---|
| 2048 | void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; } |
---|
| 2049 | uint64 GetAuraUpdateMask() { return m_auraUpdateMask; } |
---|
| 2050 | void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); } |
---|
| 2051 | Player* GetNextRandomRaidMember(float radius); |
---|
| 2052 | |
---|
| 2053 | GridReference<Player> &GetGridRef() { return m_gridRef; } |
---|
| 2054 | bool isAllowedToLoot(Creature* creature); |
---|
| 2055 | |
---|
| 2056 | WorldLocation& GetTeleportDest() { return m_teleport_dest; } |
---|
| 2057 | |
---|
| 2058 | DeclinedName const* GetDeclinedNames() const { return m_declinedname; } |
---|
| 2059 | |
---|
| 2060 | protected: |
---|
| 2061 | |
---|
| 2062 | /*********************************************************/ |
---|
| 2063 | /*** BATTLEGROUND SYSTEM ***/ |
---|
| 2064 | /*********************************************************/ |
---|
| 2065 | |
---|
| 2066 | /* this variable is set to bg->m_InstanceID, when player is teleported to BG - (it is battleground's GUID)*/ |
---|
| 2067 | uint32 m_bgBattleGroundID; |
---|
| 2068 | /* |
---|
| 2069 | this is an array of BG queues (BgTypeIDs) in which is player |
---|
| 2070 | */ |
---|
| 2071 | struct BgBattleGroundQueueID_Rec |
---|
| 2072 | { |
---|
| 2073 | uint32 bgQueueType; |
---|
| 2074 | uint32 invitedToInstance; |
---|
| 2075 | }; |
---|
| 2076 | BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES]; |
---|
| 2077 | uint32 m_bgEntryPointMap; |
---|
| 2078 | float m_bgEntryPointX; |
---|
| 2079 | float m_bgEntryPointY; |
---|
| 2080 | float m_bgEntryPointZ; |
---|
| 2081 | float m_bgEntryPointO; |
---|
| 2082 | |
---|
| 2083 | std::set<uint32> m_bgAfkReporter; |
---|
| 2084 | uint8 m_bgAfkReportedCount; |
---|
| 2085 | time_t m_bgAfkReportedTimer; |
---|
| 2086 | uint32 m_contestedPvPTimer; |
---|
| 2087 | |
---|
| 2088 | uint32 m_bgTeam; // what side the player will be added to |
---|
| 2089 | |
---|
| 2090 | /*********************************************************/ |
---|
| 2091 | /*** QUEST SYSTEM ***/ |
---|
| 2092 | /*********************************************************/ |
---|
| 2093 | |
---|
| 2094 | std::set<uint32> m_timedquests; |
---|
| 2095 | |
---|
| 2096 | uint64 m_divider; |
---|
| 2097 | uint32 m_ingametime; |
---|
| 2098 | |
---|
| 2099 | /*********************************************************/ |
---|
| 2100 | /*** LOAD SYSTEM ***/ |
---|
| 2101 | /*********************************************************/ |
---|
| 2102 | |
---|
| 2103 | void _LoadActions(QueryResult *result); |
---|
| 2104 | void _LoadAuras(QueryResult *result, uint32 timediff); |
---|
| 2105 | void _LoadBoundInstances(QueryResult *result); |
---|
| 2106 | void _LoadInventory(QueryResult *result, uint32 timediff); |
---|
| 2107 | void _LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery); |
---|
| 2108 | void _LoadMail(); |
---|
| 2109 | void _LoadMailedItems(Mail *mail); |
---|
| 2110 | void _LoadQuestStatus(QueryResult *result); |
---|
| 2111 | void _LoadDailyQuestStatus(QueryResult *result); |
---|
| 2112 | void _LoadGroup(QueryResult *result); |
---|
| 2113 | void _LoadReputation(QueryResult *result); |
---|
| 2114 | void _LoadSpells(QueryResult *result); |
---|
| 2115 | void _LoadTutorials(QueryResult *result); |
---|
| 2116 | void _LoadFriendList(QueryResult *result); |
---|
| 2117 | bool _LoadHomeBind(QueryResult *result); |
---|
| 2118 | void _LoadDeclinedNames(QueryResult *result); |
---|
| 2119 | |
---|
| 2120 | /*********************************************************/ |
---|
| 2121 | /*** SAVE SYSTEM ***/ |
---|
| 2122 | /*********************************************************/ |
---|
| 2123 | |
---|
| 2124 | void _SaveActions(); |
---|
| 2125 | void _SaveAuras(); |
---|
| 2126 | void _SaveInventory(); |
---|
| 2127 | void _SaveMail(); |
---|
| 2128 | void _SaveQuestStatus(); |
---|
| 2129 | void _SaveDailyQuestStatus(); |
---|
| 2130 | void _SaveReputation(); |
---|
| 2131 | void _SaveSpells(); |
---|
| 2132 | void _SaveTutorials(); |
---|
| 2133 | |
---|
| 2134 | void _SetCreateBits(UpdateMask *updateMask, Player *target) const; |
---|
| 2135 | void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; |
---|
| 2136 | |
---|
| 2137 | /*********************************************************/ |
---|
| 2138 | /*** ENVIRONMENTAL SYSTEM ***/ |
---|
| 2139 | /*********************************************************/ |
---|
| 2140 | void HandleLava(); |
---|
| 2141 | void HandleSobering(); |
---|
| 2142 | void StartMirrorTimer(MirrorTimerType Type, uint32 MaxValue); |
---|
| 2143 | void ModifyMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, uint32 Regen); |
---|
| 2144 | void StopMirrorTimer(MirrorTimerType Type); |
---|
| 2145 | uint8 m_isunderwater; |
---|
| 2146 | bool m_isInWater; |
---|
| 2147 | |
---|
| 2148 | /*********************************************************/ |
---|
| 2149 | /*** HONOR SYSTEM ***/ |
---|
| 2150 | /*********************************************************/ |
---|
| 2151 | time_t m_lastHonorUpdateTime; |
---|
| 2152 | |
---|
| 2153 | void outDebugValues() const; |
---|
| 2154 | bool _removeSpell(uint16 spell_id); |
---|
| 2155 | uint64 m_lootGuid; |
---|
| 2156 | |
---|
| 2157 | uint32 m_race; |
---|
| 2158 | uint32 m_class; |
---|
| 2159 | uint32 m_team; |
---|
| 2160 | uint32 m_nextSave; |
---|
| 2161 | time_t m_speakTime; |
---|
| 2162 | uint32 m_speakCount; |
---|
| 2163 | uint32 m_dungeonDifficulty; |
---|
| 2164 | |
---|
| 2165 | uint32 m_atLoginFlags; |
---|
| 2166 | |
---|
| 2167 | Item* m_items[PLAYER_SLOTS_COUNT]; |
---|
| 2168 | uint32 m_currentBuybackSlot; |
---|
| 2169 | |
---|
| 2170 | std::vector<Item*> m_itemUpdateQueue; |
---|
| 2171 | bool m_itemUpdateQueueBlocked; |
---|
| 2172 | |
---|
| 2173 | uint32 m_ExtraFlags; |
---|
| 2174 | uint64 m_curSelection; |
---|
| 2175 | |
---|
| 2176 | uint64 m_comboTarget; |
---|
| 2177 | int8 m_comboPoints; |
---|
| 2178 | |
---|
| 2179 | QuestStatusMap mQuestStatus; |
---|
| 2180 | |
---|
| 2181 | uint32 m_GuildIdInvited; |
---|
| 2182 | uint32 m_ArenaTeamIdInvited; |
---|
| 2183 | |
---|
| 2184 | PlayerMails m_mail; |
---|
| 2185 | PlayerSpellMap m_spells; |
---|
| 2186 | SpellCooldowns m_spellCooldowns; |
---|
| 2187 | |
---|
| 2188 | ActionButtonList m_actionButtons; |
---|
| 2189 | |
---|
| 2190 | float m_auraBaseMod[BASEMOD_END][MOD_END]; |
---|
| 2191 | |
---|
| 2192 | SpellModList m_spellMods[MAX_SPELLMOD]; |
---|
| 2193 | int32 m_SpellModRemoveCount; |
---|
| 2194 | EnchantDurationList m_enchantDuration; |
---|
| 2195 | ItemDurationList m_itemDuration; |
---|
| 2196 | |
---|
| 2197 | uint64 m_resurrectGUID; |
---|
| 2198 | uint32 m_resurrectMap; |
---|
| 2199 | float m_resurrectX, m_resurrectY, m_resurrectZ; |
---|
| 2200 | uint32 m_resurrectHealth, m_resurrectMana; |
---|
| 2201 | |
---|
| 2202 | WorldSession *m_session; |
---|
| 2203 | |
---|
| 2204 | typedef std::list<Channel*> JoinedChannelsList; |
---|
| 2205 | JoinedChannelsList m_channels; |
---|
| 2206 | |
---|
| 2207 | bool m_dontMove; |
---|
| 2208 | |
---|
| 2209 | int m_cinematic; |
---|
| 2210 | |
---|
| 2211 | Player *pTrader; |
---|
| 2212 | bool acceptTrade; |
---|
| 2213 | uint16 tradeItems[TRADE_SLOT_COUNT]; |
---|
| 2214 | uint32 tradeGold; |
---|
| 2215 | |
---|
| 2216 | time_t m_nextThinkTime; |
---|
| 2217 | |
---|
| 2218 | uint32 m_Tutorials[8]; |
---|
| 2219 | bool m_TutorialsChanged; |
---|
| 2220 | |
---|
| 2221 | bool m_DailyQuestChanged; |
---|
| 2222 | time_t m_lastDailyQuestTime; |
---|
| 2223 | |
---|
| 2224 | uint32 m_regenTimer; |
---|
| 2225 | uint32 m_breathTimer; |
---|
| 2226 | uint32 m_drunkTimer; |
---|
| 2227 | uint16 m_drunk; |
---|
| 2228 | uint32 m_weaponChangeTimer; |
---|
| 2229 | |
---|
| 2230 | uint32 m_zoneUpdateId; |
---|
| 2231 | uint32 m_zoneUpdateTimer; |
---|
| 2232 | uint32 m_areaUpdateId; |
---|
| 2233 | |
---|
| 2234 | uint32 m_deathTimer; |
---|
| 2235 | time_t m_deathExpireTime; |
---|
| 2236 | |
---|
| 2237 | uint32 m_restTime; |
---|
| 2238 | |
---|
| 2239 | uint32 m_WeaponProficiency; |
---|
| 2240 | uint32 m_ArmorProficiency; |
---|
| 2241 | bool m_canParry; |
---|
| 2242 | bool m_canBlock; |
---|
| 2243 | bool m_canDualWield; |
---|
| 2244 | uint8 m_swingErrorMsg; |
---|
| 2245 | float m_ammoDPS; |
---|
| 2246 | ////////////////////Rest System///////////////////// |
---|
| 2247 | int time_inn_enter; |
---|
| 2248 | uint32 inn_pos_mapid; |
---|
| 2249 | float inn_pos_x; |
---|
| 2250 | float inn_pos_y; |
---|
| 2251 | float inn_pos_z; |
---|
| 2252 | float m_rest_bonus; |
---|
| 2253 | RestType rest_type; |
---|
| 2254 | ////////////////////Rest System///////////////////// |
---|
| 2255 | |
---|
| 2256 | // Transports |
---|
| 2257 | Transport * m_transport; |
---|
| 2258 | |
---|
| 2259 | uint32 m_resetTalentsCost; |
---|
| 2260 | time_t m_resetTalentsTime; |
---|
| 2261 | uint32 m_usedTalentCount; |
---|
| 2262 | |
---|
| 2263 | // Social |
---|
| 2264 | PlayerSocial *m_social; |
---|
| 2265 | |
---|
| 2266 | // Groups |
---|
| 2267 | GroupReference m_group; |
---|
| 2268 | Group *m_groupInvite; |
---|
| 2269 | uint32 m_groupUpdateMask; |
---|
| 2270 | uint64 m_auraUpdateMask; |
---|
| 2271 | |
---|
| 2272 | // Temporarily removed pet cache |
---|
| 2273 | uint32 m_temporaryUnsummonedPetNumber; |
---|
| 2274 | uint32 m_oldpetspell; |
---|
| 2275 | |
---|
| 2276 | uint64 m_miniPet; |
---|
| 2277 | GuardianPetList m_guardianPets; |
---|
| 2278 | |
---|
| 2279 | // Player summoning |
---|
| 2280 | time_t m_summon_expire; |
---|
| 2281 | uint32 m_summon_mapid; |
---|
| 2282 | float m_summon_x; |
---|
| 2283 | float m_summon_y; |
---|
| 2284 | float m_summon_z; |
---|
| 2285 | |
---|
| 2286 | // Far Teleport |
---|
| 2287 | WorldLocation m_teleport_dest; |
---|
| 2288 | |
---|
| 2289 | DeclinedName *m_declinedname; |
---|
| 2290 | private: |
---|
| 2291 | // internal common parts for CanStore/StoreItem functions |
---|
| 2292 | uint8 _CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem ) const; |
---|
| 2293 | uint8 _CanStoreItem_InBag( uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; |
---|
| 2294 | uint8 _CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const; |
---|
| 2295 | Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update ); |
---|
| 2296 | |
---|
| 2297 | GridReference<Player> m_gridRef; |
---|
| 2298 | }; |
---|
| 2299 | |
---|
| 2300 | void AddItemsSetItem(Player*player,Item *item); |
---|
| 2301 | void RemoveItemsSetItem(Player*player,ItemPrototype const *proto); |
---|
| 2302 | |
---|
| 2303 | // "the bodies of template functions must be made available in a header file" |
---|
| 2304 | template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell const* spell) |
---|
| 2305 | { |
---|
| 2306 | SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); |
---|
| 2307 | if (!spellInfo) return 0; |
---|
| 2308 | int32 totalpct = 0; |
---|
| 2309 | int32 totalflat = 0; |
---|
| 2310 | for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr) |
---|
| 2311 | { |
---|
| 2312 | SpellModifier *mod = *itr; |
---|
| 2313 | |
---|
| 2314 | if(!IsAffectedBySpellmod(spellInfo,mod,spell)) |
---|
| 2315 | continue; |
---|
| 2316 | if (mod->type == SPELLMOD_FLAT) |
---|
| 2317 | totalflat += mod->value; |
---|
| 2318 | else if (mod->type == SPELLMOD_PCT) |
---|
| 2319 | { |
---|
| 2320 | // skip percent mods for null basevalue (most important for spell mods with charges ) |
---|
| 2321 | if(basevalue == T(0)) |
---|
| 2322 | continue; |
---|
| 2323 | |
---|
| 2324 | // special case (skip >10sec spell casts for instant cast setting) |
---|
| 2325 | if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) |
---|
| 2326 | continue; |
---|
| 2327 | |
---|
| 2328 | totalpct += mod->value; |
---|
| 2329 | } |
---|
| 2330 | |
---|
| 2331 | if (mod->charges > 0 ) |
---|
| 2332 | { |
---|
| 2333 | --mod->charges; |
---|
| 2334 | if (mod->charges == 0) |
---|
| 2335 | { |
---|
| 2336 | mod->charges = -1; |
---|
| 2337 | mod->lastAffected = spell; |
---|
| 2338 | if(!mod->lastAffected) |
---|
| 2339 | mod->lastAffected = FindCurrentSpellBySpellId(spellId); |
---|
| 2340 | ++m_SpellModRemoveCount; |
---|
| 2341 | } |
---|
| 2342 | } |
---|
| 2343 | } |
---|
| 2344 | |
---|
| 2345 | float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat; |
---|
| 2346 | basevalue = T((float)basevalue + diff); |
---|
| 2347 | return T(diff); |
---|
| 2348 | } |
---|
| 2349 | #endif |
---|