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