diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index 0a63a8874..1f428c4b4 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -56,16 +56,18 @@ enum AchievementFactionFlags enum AchievementFlags { - ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete) - ACHIEVEMENT_FLAG_UNK2 = 0x00000002, // not used - ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // Store only max value? used only in "Reach level xx" - ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all reqirements (and calculate max value) - ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max value ??) - ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max value) - ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // Show as average value (value / time_in_days) depend from other flag (by def use last criteria value) - ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value) - ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, // - ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, // + ACHIEVEMENT_FLAG_NONE = 0x00000000, + ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // ACHIEVEMENT_FLAG_STATISTIC Just count statistic (never stop and complete) + ACHIEVEMENT_FLAG_UNK2 = 0x00000002, // ACHIEVEMENT_FLAG_HIDDEN not used + ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // ACHIEVEMENT_FLAG_HIDDEN_TILL_AWARDED Store only max value? used only in "Reach level xx" + ACHIEVEMENT_FLAG_SUMM = 0x00000008, // ACHIEVEMENT_FLAG_CUMULATIVE Use summ criteria value from all requirements (and calculate max value) + ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // ACHIEVEMENT_FLAG_DISPLAY_HIGHEST Show max criteria (and calculate max value ??) + ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // ACHIEVEMENT_FLAG_CRITERIA_COUNT Use not zero req count (and calculate max value) + ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // ACHIEVEMENT_FLAG_AVG_PER_DAY Show as average value (value / time_in_days) depend from other flag (by def use last criteria value) + ACHIEVEMENT_FLAG_BAR = 0x00000080, // ACHIEVEMENT_FLAG_HAS_PROGRESS_BAR Show as progress bar (value / max vale) depend from other flag (by def use last criteria value) + ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, // ACHIEVEMENT_FLAG_SERVER_FIRST + ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, // + }; enum AchievementCriteriaCondition @@ -81,12 +83,13 @@ enum AchievementCriteriaCondition enum AchievementCriteriaCompletionFlags { - ACHIEVEMENT_CRITERIA_FLAG_SHOW_PROGRESS_BAR = 0x00000001, // Show progress as bar - ACHIEVEMENT_CRITERIA_FLAG_HIDE_CRITERIA = 0x00000002, // Not show criteria in client - ACHIEVEMENT_CRITERIA_FLAG_UNK3 = 0x00000004, // BG related?? - ACHIEVEMENT_CRITERIA_FLAG_UNK4 = 0x00000008, // - ACHIEVEMENT_CRITERIA_FLAG_UNK5 = 0x00000010, // not used - ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020, // Displays counter as money + ACHIEVEMENT_CRITERIA_FLAG_PROGRESS_BAR = 0x00000001, // Show progress as bar + ACHIEVEMENT_CRITERIA_FLAG_HIDDEN = 0x00000002, // Not show criteria in client + ACHIEVEMENT_CRITERIA_FLAG_FAIL_ACHIEVEMENT = 0x00000004, // BG related?? + ACHIEVEMENT_CRITERIA_FLAG_RESET_ON_START = 0x00000008, // + ACHIEVEMENT_CRITERIA_FLAG_IS_DATE = 0x00000010, // not used + ACHIEVEMENT_CRITERIA_FLAG_IS_MONEY = 0x00000020, // Displays counter as money + ACHIEVEMENT_CRITERIA_FLAG_IS_ACHIEVEMENT_ID = 0x00000040, }; enum AchievementCriteriaTypes @@ -201,10 +204,10 @@ enum AchievementCriteriaTypes ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114, ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115, ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS = 119, - // 120 - // 121 - // 122 - // 123 + // 120 unused + // 121 unused + // 122 unused + // 123 unused // 0..123 => 124 criteria types total }; diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 05f0cd5f6..e0e7263b0 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -153,7 +153,7 @@ DBCStorage sSpellFocusObjectStore(SpellFocusObjectfmt); DBCStorage sSpellRadiusStore(SpellRadiusfmt); DBCStorage sSpellRangeStore(SpellRangefmt); DBCStorage sSpellRuneCostStore(SpellRuneCostfmt); -DBCStorage sSpellShapeshiftStore(SpellShapeshiftfmt); +DBCStorage sSpellShapeshiftFormStore(SpellShapeshiftFormfmt); DBCStorage sStableSlotPricesStore(StableSlotPricesfmt); DBCStorage sSummonPropertiesStore(SummonPropertiesfmt); DBCStorage sTalentStore(TalentEntryfmt); @@ -520,7 +520,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore, dbcPath,"SpellRadius.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRangeStore, dbcPath,"SpellRange.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc"); - LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftFormStore, dbcPath,"SpellShapeshiftForm.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc"); @@ -927,7 +927,7 @@ bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, flo // rotate the players position instead of rotating the whole cube, that way we can make a simplified // is-in-cube check and we have to calculate only one point instead of 4 - // 2PI = 360, keep in mind that ingame orientation is counter-clockwise + // 2PI = 360, keep in mind that ingame orientation is counter-clockwise double rotation = 2*M_PI-atEntry->box_orientation; double sinVal = sin(rotation); double cosVal = cos(rotation); diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 6d94f853c..e460ca234 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -148,7 +148,7 @@ extern PetFamilySpellsStore sPetFamilySpellsStore; extern DBCStorage sSpellRadiusStore; extern DBCStorage sSpellRangeStore; extern DBCStorage sSpellRuneCostStore; -extern DBCStorage sSpellShapeshiftStore; +extern DBCStorage sSpellShapeshiftFormStore; extern DBCStorage sSpellStore; extern DBCStorage sStableSlotPricesStore; extern DBCStorage sSummonPropertiesStore; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 223099769..2ac228f18 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1561,7 +1561,7 @@ struct SpellRuneCostEntry bool NoRunicPowerGain() const { return runePowerGain == 0; } }; -struct SpellShapeshiftEntry +struct SpellShapeshiftFormEntry { uint32 ID; // 0 //uint32 buttonPosition; // 1 unused diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 47225489b..a071e66d1 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -95,7 +95,7 @@ const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; const char SpellRadiusfmt[]="nfxf"; const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellRuneCostfmt[]="niiii"; -const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii"; +const char SpellShapeshiftFormfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii"; const char StableSlotPricesfmt[] = "ni"; const char SummonPropertiesfmt[] = "niiiii"; const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx"; diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index b2d88f95e..f4e7b7c27 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -168,7 +168,7 @@ void DynamicObject::Delay(int32 delaytime) break; } } - + if (foundAura) { ++iter; @@ -210,4 +210,4 @@ bool DynamicObject::IsFriendlyTo( Unit const* unit ) const return owner->IsFriendlyTo(unit); else return true; -} \ No newline at end of file +} diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index d4fe69794..65ce1613d 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -709,6 +709,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << ObjectiveText[iI]; GetMenuSession()->SendPacket( &data ); + DEBUG_LOG( "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", pQuest->GetQuestId() ); } diff --git a/src/game/Group.h b/src/game/Group.h index be8fb3d4f..c1a87cf79 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -80,17 +80,17 @@ enum RollVoteMask }; -enum GroupMemberOnlineStatus +enum GroupMemberFlags { MEMBER_STATUS_OFFLINE = 0x0000, - MEMBER_STATUS_ONLINE = 0x0001, - MEMBER_STATUS_PVP = 0x0002, - MEMBER_STATUS_UNK0 = 0x0004, // dead? (health=0) - MEMBER_STATUS_UNK1 = 0x0008, // ghost? (health=1) - MEMBER_STATUS_UNK2 = 0x0010, // never seen - MEMBER_STATUS_UNK3 = 0x0020, // never seen - MEMBER_STATUS_UNK4 = 0x0040, // appears with dead and ghost flags - MEMBER_STATUS_UNK5 = 0x0080, // never seen + MEMBER_STATUS_ONLINE = 0x0001, // Lua_UnitIsConnected + MEMBER_STATUS_PVP = 0x0002, // Lua_UnitIsPVP + MEMBER_STATUS_DEAD = 0x0004, // Lua_UnitIsDead + MEMBER_STATUS_GHOST = 0x0008, // Lua_UnitIsGhost + MEMBER_STATUS_PVP_FFA = 0x0010, // Lua_UnitIsPVPFreeForAll + MEMBER_STATUS_UNK3 = 0x0020, // used in calls from Lua_GetPlayerMapPosition/Lua_GetBattlefieldFlagPosition + MEMBER_STATUS_AFK = 0x0040, // Lua_UnitIsAFK + MEMBER_STATUS_DND = 0x0080, // Lua_UnitIsDND }; enum GroupType // group type flags? diff --git a/src/game/Item.cpp b/src/game/Item.cpp index d3e5b7142..63e8c3684 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -999,12 +999,13 @@ bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) con // time. void Item::SendTimeUpdate(Player* owner) { - if (!GetUInt32Value(ITEM_FIELD_DURATION)) + uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION); + if (!duration) return; WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4)); - data << (uint64)GetGUID(); - data << (uint32)GetUInt32Value(ITEM_FIELD_DURATION); + data << uint64(GetGUID()); + data << uint32(duration); owner->GetSession()->SendPacket(&data); } @@ -1200,4 +1201,4 @@ void Item::SetLootState( ItemLootUpdateState state ) if (m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_UNCHANGED && m_lootState != ITEM_LOOT_TEMPORARY) SetState(ITEM_CHANGED); -} \ No newline at end of file +} diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 9ee0d389c..4a7046be4 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -149,6 +149,7 @@ enum ItemPrototypeFlags2 ITEM_FLAG2_UNK7 = 0x00000040, ITEM_FLAG2_UNK8 = 0x00000080, ITEM_FLAG2_NEED_ROLL_DISABLED = 0x00000100, // need roll during looting is not allowed for this item + ITEM_FLAG2_CASTER_WEAPON = 0x00000200, // uses caster specific dbc file for DPS calculations }; enum BagFamilyMask diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index e3807153f..81f94866f 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -746,20 +746,22 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) if(!GetPlayer()->isGameMaster()) { - uint32 missingLevel = 0; + bool missingItem = false; + bool missingLevel = false; + bool missingQuest = false; + if(GetPlayer()->getLevel() < at->requiredLevel && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_LEVEL)) - missingLevel = at->requiredLevel; + missingLevel = true; // must have one or the other, report the first one that's missing - uint32 missingItem = 0; if(at->requiredItem) { if(!GetPlayer()->HasItemCount(at->requiredItem, 1) && (!at->requiredItem2 || !GetPlayer()->HasItemCount(at->requiredItem2, 1))) - missingItem = at->requiredItem; + missingItem = true; } else if(at->requiredItem2 && !GetPlayer()->HasItemCount(at->requiredItem2, 1)) - missingItem = at->requiredItem2; + missingItem = true; MapEntry const* mapEntry = sMapStore.LookupEntry(at->target_mapId); if(!mapEntry) @@ -767,42 +769,39 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) bool isRegularTargetMap = GetPlayer()->GetDifficulty(mapEntry->IsRaid()) == REGULAR_DIFFICULTY; - uint32 missingKey = 0; if (!isRegularTargetMap) { if(at->heroicKey) { if(!GetPlayer()->HasItemCount(at->heroicKey, 1) && (!at->heroicKey2 || !GetPlayer()->HasItemCount(at->heroicKey2, 1))) - missingKey = at->heroicKey; + missingItem = true; } else if(at->heroicKey2 && !GetPlayer()->HasItemCount(at->heroicKey2, 1)) - missingKey = at->heroicKey2; + missingItem = true; } - uint32 missingQuest = 0; if (!isRegularTargetMap && mapEntry->IsDungeon()) { if (at->requiredQuestHeroic && !GetPlayer()->GetQuestRewardStatus(at->requiredQuestHeroic)) - missingQuest = at->requiredQuestHeroic; + missingQuest = true; } else { if (at->requiredQuest && !GetPlayer()->GetQuestRewardStatus(at->requiredQuest)) - missingQuest = at->requiredQuest; + missingQuest = true; } - if(missingLevel || missingItem || missingKey || missingQuest) + if(missingItem || missingLevel || missingQuest) { - // TODO: all this is probably wrong - if(missingItem) - SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED_AND_ITEM), at->requiredLevel, ObjectMgr::GetItemPrototype(missingItem)->Name1); - else if(missingKey) - GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC); - else if(missingQuest) + // hack for "Opening of the Dark Portal" + if(missingQuest && at->target_mapId == 269) SendAreaTriggerMessage("%s", at->requiredFailedText.c_str()); - else if(missingLevel) - SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), missingLevel); + // hack for TBC heroics + else if(missingLevel && !mapEntry->IsRaid() && GetPlayer()->GetDifficulty(false) == DUNGEON_DIFFICULTY_HEROIC && mapEntry->addon == 1) + SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), at->requiredLevel); + else + GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, GetPlayer()->GetDifficulty(mapEntry->IsRaid())); return; } } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index f23821887..18f27ec60 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -368,11 +368,12 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const *data << uint32(traveltime); // full move time? *data << uint32(0); // sequenceId - *data << float(0); // added in 3.1 *data << float(0); // added in 3.1 *data << float(0); // added in 3.1 - *data << uint32(0); // added in 3.1 + // data as in SMSG_MONSTER_MOVE with flag SPLINEFLAG_TRAJECTORY + *data << float(0); // parabolic speed, added in 3.1 + *data << uint32(0); // parabolic time, added in 3.1 uint32 poscount = uint32(path.size()); *data << uint32(poscount); // points count diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 0fa87afc8..d2e37cd11 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -402,7 +402,7 @@ enum Opcodes CMSG_DUEL_CANCELLED = 0x16D, SMSG_MOUNTRESULT = 0x16E, SMSG_DISMOUNTRESULT = 0x16F, - SMSG_PUREMOUNT_CANCELLED_OBSOLETE = 0x170, // ERR_REMOVE_FROM_PVP_QUEUE_* events + SMSG_REMOVE_FROM_PVP_QUEUE_RESULT = 0x170, // ERR_REMOVE_FROM_PVP_QUEUE_* events CMSG_MOUNTSPECIAL_ANIM = 0x171, SMSG_MOUNTSPECIAL_ANIM = 0x172, SMSG_PET_TAME_FAILURE = 0x173, @@ -697,7 +697,7 @@ enum Opcodes CMSG_MEETINGSTONE_CHEAT = 0x294, // not found 3.3 SMSG_MEETINGSTONE_SETQUEUE = 0x295, // string, showed in console CMSG_MEETINGSTONE_INFO = 0x296, // EVENT_LFG_UPDATE - SMSG_MEETINGSTONE_COMPLETE = 0x297, // mail open from gossip?, EVENT_MAIL_SHOW + SMSG_MAIL_SHOW_FROM_GOSSIP = 0x297, // mail open from gossip?, EVENT_MAIL_SHOW SMSG_MEETINGSTONE_IN_PROGRESS = 0x298, // uint32, some UPDATE_COOLDOWN events SMSG_MEETINGSTONE_MEMBER_ADDED = 0x299, // uint32, errors: ERR_NOT_IN_GROUP (2,51) and ERR_NOT_IN_RAID (3,39,40) CMSG_GMTICKETSYSTEM_TOGGLE = 0x29A, @@ -1264,13 +1264,13 @@ enum Opcodes UMSG_UNKNOWN_1227 = 0x4CB, // not found 3.2 UMSG_UNKNOWN_1228 = 0x4CC, // not found 3.2 SMSG_MULTIPLE_PACKETS = 0x4CD, // SMSG, handles any opcode - SMSG_FORCE_UNK1_SPEED_CHANGE = 0x4CE, // SMSG, movement related - CMSG_FORCE_UNK1_SPEED_CHANGE_ACK = 0x4CF, // movement related - SMSG_FORCE_UNK2_SPEED_CHANGE = 0x4D0, // SMSG, movement related - CMSG_FORCE_UNK2_SPEED_CHANGE_ACK = 0x4D1, // movement related - MSG_MOVE_UNKNOWN_1234 = 0x4D2, // SMSG, movement related - SMSG_SPLINE_MOVE_UNKNOWN_1235 = 0x4D3, // SMSG, movement related - SMSG_SPLINE_MOVE_UNKNOWN_1236 = 0x4D4, // SMSG, movement related + SMSG_MOVE_SET_LEVITATING = 0x4CE, // SMSG, movement related + CMSG_MOVE_SET_LEVITATING_ACK = 0x4CF, // movement related + SMSG_MOVE_UNSET_LEVITATING = 0x4D0, // SMSG, movement related + CMSG_MOVE_UNSET_LEVITATING_ACK = 0x4D1, // movement related + SMSG_MOVE_LEVITATING_ = 0x4D2, // SMSG, movement related (movement flags 0x400 and 0x8000) + SMSG_SPLINE_MOVE_SET_LEVITATING = 0x4D3, // SMSG, movement related + SMSG_SPLINE_MOVE_UNSET_LEVITATING = 0x4D4, // SMSG, movement related CMSG_EQUIPMENT_SET_USE = 0x4D5, // CMSG, lua: UseEquipmentSet SMSG_EQUIPMENT_SET_USE_RESULT = 0x4D6, // SMSG, UseEquipmentSetResult? UMSG_UNKNOWN_1239 = 0x4D7, // not found 3.2 diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 586bf176d..bece0c1b5 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1180,10 +1180,11 @@ void Pet::_LoadAuras(uint32 timediff) continue; // prevent wrong values of remaincharges - if(spellproto->procCharges) + uint32 procCharges = spellproto->procCharges; + if(procCharges) { - if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges) - remaincharges = spellproto->procCharges; + if(remaincharges <= 0 || remaincharges > (int32)procCharges) + remaincharges = procCharges; } else remaincharges = 0; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 783d6df5a..6b4dcdab5 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -741,18 +741,17 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods() UpdateMaxHealth(); // Update max Health (for add bonus from stamina) SetHealth(GetMaxHealth()); - if (getPowerType()==POWER_MANA) + + if (getPowerType() == POWER_MANA) { UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect) - SetPower(POWER_MANA,GetMaxPower(POWER_MANA)); + SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); } - if(getPowerType() == POWER_RUNIC_POWER) + if(getPowerType() != POWER_MANA) // hide additional mana bar if we have no mana { - SetPower(POWER_RUNE, 8); - SetMaxPower(POWER_RUNE, 8); - SetPower(POWER_RUNIC_POWER, 0); - SetMaxPower(POWER_RUNIC_POWER, 1000); + SetPower(POWER_MANA, 0); + SetMaxPower(POWER_MANA, 0); } // original spells @@ -3354,7 +3353,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))) || (m_form == 0 && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT))); - //Check CasterAuraStates + // Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); } @@ -7242,7 +7241,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue)) ApplyFeralAPBonus(feral_bonus, apply); } - // Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue) + // Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue) if(getClass() == CLASS_DRUID) { int32 feral_bonus = proto->getFeralBonus(extraDPS); @@ -14149,7 +14148,7 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) const if (!have_slot) { if (msg) - SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING); + SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_TOO_MANY_DAILY_QUESTS); return false; } @@ -14815,13 +14814,13 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this); } -void Player::SendQuestFailed( uint32 quest_id ) +void Player::SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason) { if( quest_id ) { WorldPacket data( SMSG_QUESTGIVER_QUEST_FAILED, 4+4 ); data << uint32(quest_id); - data << uint32(0); // failed reason (4 for inventory is full) + data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message) GetSession()->SendPacket( &data ); DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); } @@ -18636,7 +18635,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) void Player::InitDataForForm(bool reapplyMods) { - SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(m_form); if(ssEntry && ssEntry->attackSpeed) { SetAttackTime(BASE_ATTACK,ssEntry->attackSpeed); diff --git a/src/game/Player.h b/src/game/Player.h index 4e75e3bf7..cfa3eff3c 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -500,7 +500,7 @@ enum PlayerFlags PLAYER_FLAGS_GM = 0x00000008, PLAYER_FLAGS_GHOST = 0x00000010, PLAYER_FLAGS_RESTING = 0x00000020, - PLAYER_FLAGS_UNK7 = 0x00000040, + PLAYER_FLAGS_UNK7 = 0x00000040, // admin? PLAYER_FLAGS_UNK8 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards PLAYER_FLAGS_IN_PVP = 0x00000200, @@ -509,7 +509,7 @@ enum PlayerFlags PLAYER_FLAGS_PARTIAL_PLAY_TIME = 0x00001000, // played long time PLAYER_FLAGS_NO_PLAY_TIME = 0x00002000, // played too long time PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, // Lua_IsOutOfBounds - PLAYER_FLAGS_DEVELOPER = 0x00008000, // prefix for something? + PLAYER_FLAGS_DEVELOPER = 0x00008000, // chat tag, name prefix PLAYER_FLAGS_UNK17 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1) PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually) @@ -802,22 +802,22 @@ enum TradeSlots enum TransferAbortReason { - TRANSFER_ABORT_NONE = 0x00, - TRANSFER_ABORT_ERROR = 0x01, - TRANSFER_ABORT_MAX_PLAYERS = 0x02, // Transfer Aborted: instance is full - TRANSFER_ABORT_NOT_FOUND = 0x03, // Transfer Aborted: instance not found - TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x04, // You have entered too many instances recently. - TRANSFER_ABORT_ZONE_IN_COMBAT = 0x06, // Unable to zone in while an encounter is in progress. - TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x07, // You must have expansion installed to access this area. - TRANSFER_ABORT_DIFFICULTY = 0x08, // difficulty mode is not available for %s. - TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place! - TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later. - TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1 - TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 - TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 - TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2 - TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm. - TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time. + TRANSFER_ABORT_NONE = 0x00, + TRANSFER_ABORT_ERROR = 0x01, + TRANSFER_ABORT_MAX_PLAYERS = 0x02, // Transfer Aborted: instance is full + TRANSFER_ABORT_NOT_FOUND = 0x03, // Transfer Aborted: instance not found + TRANSFER_ABORT_TOO_MANY_INSTANCES = 0x04, // You have entered too many instances recently. + TRANSFER_ABORT_ZONE_IN_COMBAT = 0x06, // Unable to zone in while an encounter is in progress. + TRANSFER_ABORT_INSUF_EXPAN_LVL = 0x07, // You must have expansion installed to access this area. + TRANSFER_ABORT_DIFFICULTY = 0x08, // difficulty mode is not available for %s. + TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place! + TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later. + TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1 + TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1 + TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1 + TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2 + TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm. + TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time. }; enum InstanceResetWarningType @@ -1505,7 +1505,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendQuestCompleteEvent(uint32 quest_id); void SendQuestReward( Quest const *pQuest, uint32 XP, Object* questGiver ); - void SendQuestFailed( uint32 quest_id ); + void SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason = EQUIP_ERR_OK); void SendQuestTimerFailed( uint32 quest_id ); void SendCanTakeQuestResponse( uint32 msg ) const; void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver); diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 9a67cbbd1..2deb142c8 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -42,19 +42,19 @@ class ObjectMgr; enum QuestFailedReasons { - INVALIDREASON_DONT_HAVE_REQ = 0, - INVALIDREASON_QUEST_FAILED_LOW_LEVEL = 1, // You are not high enough level for that quest. - INVALIDREASON_QUEST_FAILED_WRONG_RACE = 6, // That quest is not available to your race. - INVALIDREASON_QUEST_ALREADY_DONE = 7, // You have completed that quest. - INVALIDREASON_QUEST_ONLY_ONE_TIMED = 12, // You can only be on one timed quest at a time. - INVALIDREASON_QUEST_ALREADY_ON = 13, // You are already on that quest. - INVALIDREASON_QUEST_FAILED_EXPANSION = 16, // This quest requires an expansion enabled account. - INVALIDREASON_QUEST_ALREADY_ON2 = 18, // You are already on that quest. - INVALIDREASON_QUEST_FAILED_MISSING_ITEMS = 21, // You don't have the required items with you. Check storage. - INVALIDREASON_QUEST_FAILED_NOT_ENOUGH_MONEY = 23, // You don't have enough money for that quest. - INVALIDREASON_DAILY_QUESTS_REMAINING = 26, // You have already completed 25 daily quests today. - INVALIDREASON_QUEST_FAILED_CAIS = 27, // You cannot complete quests once you have reached tired time. - INVALIDREASON_DAILY_QUEST_COMPLETED_TODAY = 29 // You have completed that daily quest today. + INVALIDREASON_DONT_HAVE_REQ = 0, // this is default case + INVALIDREASON_QUEST_FAILED_LOW_LEVEL = 1, // You are not high enough level for that quest. + INVALIDREASON_QUEST_FAILED_WRONG_RACE = 6, // That quest is not available to your race. + INVALIDREASON_QUEST_ALREADY_DONE = 7, // You have completed that quest. + INVALIDREASON_QUEST_ONLY_ONE_TIMED = 12, // You can only be on one timed quest at a time. + INVALIDREASON_QUEST_ALREADY_ON = 13, // You are already on that quest. + INVALIDREASON_QUEST_FAILED_EXPANSION = 16, // This quest requires an expansion enabled account. + INVALIDREASON_QUEST_ALREADY_ON2 = 18, // You are already on that quest. + INVALIDREASON_QUEST_FAILED_MISSING_ITEMS = 21, // You don't have the required items with you. Check storage. + INVALIDREASON_QUEST_FAILED_NOT_ENOUGH_MONEY = 23, // You don't have enough money for that quest. + INVALIDREASON_QUEST_FAILED_TOO_MANY_DAILY_QUESTS = 26, // You have already completed 25 daily quests today. + INVALIDREASON_QUEST_FAILED_CAIS = 27, // You cannot complete quests once you have reached tired time. + INVALIDREASON_DAILY_QUEST_DONE_TODAY = 29 // You have completed that daily quest today. }; enum QuestShareMessages diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index b803c0804..e390eed72 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -533,6 +533,7 @@ enum Team enum SpellEffects { + SPELL_EFFECT_NONE = 0, SPELL_EFFECT_INSTAKILL = 1, SPELL_EFFECT_SCHOOL_DAMAGE = 2, SPELL_EFFECT_DUMMY = 3, @@ -1036,6 +1037,7 @@ enum WeaponAttackType enum Targets { + TARGET_NONE = 0, TARGET_SELF = 1, TARGET_RANDOM_ENEMY_CHAIN_IN_AREA = 2, // only one spell has that, but regardless, it's a target type after all TARGET_RANDOM_FRIEND_CHAIN_IN_AREA = 3, @@ -1952,6 +1954,9 @@ enum CreatureTypeFlags CREATURE_TYPEFLAGS_UNK27 = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance CREATURE_TYPEFLAGS_UNK28 = 0x08000000, // used in Lua_ForceGossip CREATURE_TYPEFLAGS_UNK29 = 0x10000000, // no idea, but it used by client + CREATURE_TYPEFLAGS_UNK30 = 0x20000000, + CREATURE_TYPEFLAGS_UNK31 = 0x40000000, + CREATURE_TYPEFLAGS_QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss }; enum CreatureEliteType diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f44fe49e4..c936d9771 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -6401,7 +6401,6 @@ bool Spell::IsNeedSendToClient() const m_spellInfo->speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell); } - bool Spell::IsTriggeredSpellWithRedundentData() const { return m_IsTriggeredSpell && (m_spellInfo->manaCost || m_spellInfo->ManaCostPercentage); @@ -6810,7 +6809,7 @@ void Spell::TriggerGlobalCooldown() // global cooldown can't leave range 1..1.5 secs (if it it) // exist some spells (mostly not player directly casted) that have < 1 sec and > 1.5 sec global cooldowns // but its as test show not affected any spell mods. - if (m_spellInfo->StartRecoveryTime >= 1000 && m_spellInfo->StartRecoveryTime <= 1500) + if (gcd >= 1000 && gcd <= 1500) { // gcd modifier auras applied only to self spells and only player have mods for this if (m_caster->GetTypeId() == TYPEID_PLAYER) diff --git a/src/game/Spell.h b/src/game/Spell.h index c628dd589..cd2e8111e 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -466,7 +466,7 @@ class Spell // caster types: // formal spell caster, in game source of spell affects cast Unit* GetCaster() const { return m_caster; } - // real source of cast affects, explcit caster, or DoT/HoT applier, or GO owner, or wild GO itself. Can be NULL + // real source of cast affects, explicit caster, or DoT/HoT applier, or GO owner, or wild GO itself. Can be NULL WorldObject* GetAffectiveCasterObject() const; // limited version returning NULL in cases not Unit* caster object, need for Aura (auras currently not support non-Unit caster) Unit* GetAffectiveCaster() const { return !m_originalCasterGUID.IsEmpty() ? m_originalCaster : m_caster; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 81bc6ffdc..4acb5d515 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -482,7 +482,7 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, m_areaAuraType = AREA_AURA_RAID; if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsTotem()) m_modifier.m_auraname = SPELL_AURA_NONE; - // Light's Beacon not applied to caster itself (TODO: more generic check for another simialr spell if any?) + // Light's Beacon not applied to caster itself (TODO: more generic check for another similar spell if any?) else if (target == caster_ptr && spellproto->Id == 53651) m_modifier.m_auraname = SPELL_AURA_NONE; break; @@ -2481,7 +2481,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { // NOTE: for avoid use additional field damage stored in dummy value (replace unused 100% if (apply) - m_modifier.m_amount = 0; // use value as damage counter instead redundent 100% percent + m_modifier.m_amount = 0; // use value as damage counter instead redundant 100% percent else { int32 bp0 = m_modifier.m_amount; @@ -2834,7 +2834,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) Unit *target = GetTarget(); - SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form); if (!ssEntry) { sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId()); @@ -6433,7 +6433,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) break; } - //cooldwon aura + //cooldown aura caster->CastSpell(caster, 63853, true); break; } @@ -6521,7 +6521,6 @@ void Aura::PeriodicTick() else pdamage = uint32(target->GetMaxHealth()*amount/100); - // SpellDamageBonus for magic spells if(spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) pdamage = target->SpellDamageBonusTaken(pCaster, spellProto, pdamage, DOT, GetStackAmount()); @@ -6693,7 +6692,6 @@ void Aura::PeriodicTick() if (spell->m_spellInfo->Id == GetId()) spell->cancel(); - if(Player *modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, multiplier); @@ -7951,7 +7949,6 @@ void SpellAuraHolder::_AddSpellAuraHolder() // Enrage aura state if(m_spellProto->Dispel == DISPEL_ENRAGE) m_target->ModifyAuraState(AURA_STATE_ENRAGE, true); - } } @@ -8107,14 +8104,16 @@ void SpellAuraHolder::CleanupTriggeredSpells() bool SpellAuraHolder::ModStackAmount(int32 num) { + uint32 protoStackAmount = m_spellProto->StackAmount; + // Can`t mod - if (!m_spellProto->StackAmount) + if (!protoStackAmount) return true; // Modify stack but limit it int32 stackAmount = m_stackAmount + num; - if (stackAmount > (int32)m_spellProto->StackAmount) - stackAmount = m_spellProto->StackAmount; + if (stackAmount > (int32)protoStackAmount) + stackAmount = protoStackAmount; else if (stackAmount <=0) // Last aura from stack removed { m_stackAmount = 0; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 69b12798f..8500c3dc7 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4261,7 +4261,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) if (!unitTarget) return; - // Fill possible dispell list + // Fill possible dispel list std::list > dispel_list; // Create dispel mask by dispel type @@ -4304,7 +4304,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) if(!damage) damage = 1; - // Dispell N = damage buffs (or while exist buffs for dispel) + // Dispel N = damage buffs (or while exist buffs for dispel) for (int32 count=0; count < damage && !dispel_list.empty(); ++count) { // Random select buff for dispel @@ -4362,7 +4362,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) { SpellAuraHolder* dispelledHolder = j->first; data << uint32(dispelledHolder->GetId()); // Spell Id - data << uint8(0); // 0 - dispeled !=0 cleansed + data << uint8(0); // 0 - dispelled !=0 cleansed unitTarget->RemoveAuraHolderDueToSpellByDispel(dispelledHolder->GetId(), j->second, dispelledHolder->GetCasterGUID(), m_caster); } m_caster->SendMessageToSet(&data, true); @@ -4378,11 +4378,11 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) // Send fail log to client if (!fail_list.empty()) { - // Failed to dispell + // Failed to dispel WorldPacket data(SMSG_DISPEL_FAILED, 8+8+4+4*fail_list.size()); data << m_caster->GetObjectGuid(); // Caster GUID data << unitTarget->GetObjectGuid(); // Victim GUID - data << uint32(m_spellInfo->Id); // Dispell spell id + data << uint32(m_spellInfo->Id); // Dispel spell id for (std::list< uint32 >::iterator j = fail_list.begin(); j != fail_list.end(); ++j) data << uint32(*j); // Spell Id m_caster->SendMessageToSet(&data, true); @@ -5199,6 +5199,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) bool normalized = false; int32 spell_bonus = 0; // bonus specific for spell + switch(m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index f07c353b6..97c0acb9a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -491,7 +491,6 @@ SpellSpecific GetSpellSpecific(uint32 spellId) return SPELL_NORMAL; } - // target not allow have more one spell specific from same caster bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2) { @@ -627,7 +626,8 @@ bool IsExplicitNegativeTarget(uint32 targetA) bool IsPositiveEffect(uint32 spellId, SpellEffectIndex effIndex) { SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); - if (!spellproto) return false; + if (!spellproto) + return false; switch(spellproto->Effect[effIndex]) { @@ -849,7 +849,7 @@ bool IsPositiveSpell(uint32 spellId) if (!spellproto) return false; - // spells with atleast one negative effect are considered negative + // spells with at least one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. for (int i = 0; i < MAX_EFFECT_INDEX; ++i) if (!IsPositiveEffect(spellId, SpellEffectIndex(i))) @@ -925,7 +925,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 bool actAsShifted = false; if (form > 0) { - SpellShapeshiftEntry const *shapeInfo = sSpellShapeshiftStore.LookupEntry(form); + SpellShapeshiftFormEntry const *shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); if (!shapeInfo) { sLog.outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); @@ -961,7 +961,6 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult *result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - barGoLink bar( 1 ); bar.step(); @@ -2868,7 +2867,7 @@ void SpellMgr::LoadSpellLearnSpells() dbc_node.spell = entry->EffectTriggerSpell[i]; dbc_node.active = true; // all dbc based learned spells is active (show in spell book or hide by client itself) - // ignore learning nonexistent spells (broken/outdated/or generic learnig spell 483 + // ignore learning nonexistent spells (broken/outdated/or generic learning spell 483 if (!sSpellStore.LookupEntry(dbc_node.spell)) continue; @@ -3602,10 +3601,11 @@ void SpellMgr::LoadSpellAreas() SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) { // normal case - if (spellInfo->AreaGroupId > 0) + int32 areaGroupId = spellInfo->AreaGroupId; + if (areaGroupId > 0) { bool found = false; - AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId); + AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(areaGroupId); while (groupEntry) { for (uint32 i=0; i<6; ++i) @@ -3969,7 +3969,7 @@ void SpellMgr::CheckUsedSpells(char const* table) if (effectType >=0 && spellEntry->Effect[effectIdx] != uint32(effectType)) continue; - if (auraType >=0 && spellEntry->EffectApplyAuraName[effectIdx] !=uint32(auraType)) + if (auraType >=0 && spellEntry->EffectApplyAuraName[effectIdx] != uint32(auraType)) continue; } else diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a5ccb70da..8e6f78ace 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -1022,7 +1022,7 @@ class SpellMgr return mSpellScriptTarget.equal_range(spell_id); } - // Spell correctess for client using + // Spell correctness for client using static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true); SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const @@ -1137,4 +1137,4 @@ class SpellMgr }; #define sSpellMgr SpellMgr::Instance() -#endif \ No newline at end of file +#endif diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 20371880a..1435a5eea 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -135,7 +135,6 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (!trader) return; - for(int i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i) { ItemPosCountVec traderDst; @@ -268,7 +267,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) Item *hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; bool myCanCompleteTrade=true,hisCanCompleteTrade=true; - // set before checks for propertly undo at problems (it already set in to client) + // set before checks to properly undo at problems (it already set in to client) my_trade->SetAccepted(true); // not accept case incorrect money amount @@ -523,7 +522,7 @@ void WorldSession::SendCancelTrade() void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/) { - // sended also after LOGOUT COMPLETE + // sent also after LOGOUT COMPLETE if (_player) // needed because STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT _player->TradeCancel(true); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index a596be96a..aeba536de 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1967,8 +1967,10 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM existExpired = true; continue; } + // Handle custom absorb auras // TODO: try find better way + switch(spellProto->SpellFamilyName) { case SPELLFAMILY_GENERIC: @@ -2248,7 +2250,6 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM if (itr_spellProto->SpellFamilyName == SPELLFAMILY_GENERIC && itr_spellProto->SpellIconID == 2941) { - int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100); // apply normalized part of already accumulated amount in aura @@ -2752,14 +2753,15 @@ uint32 Unit::CalculateDamage (WeaponAttackType attType, bool normalized) float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const { - if(spellProto->spellLevel <= 0) + uint32 spellLevel = spellProto->spellLevel; + if(spellLevel <= 0) return 1.0f; float LvlPenalty = 0.0f; - if(spellProto->spellLevel < 20) - LvlPenalty = 20.0f - spellProto->spellLevel * 3.75f; - float LvlFactor = (float(spellProto->spellLevel) + 6.0f) / float(getLevel()); + if(spellLevel < 20) + LvlPenalty = 20.0f - spellLevel * 3.75f; + float LvlFactor = (float(spellLevel) + 6.0f) / float(getLevel()); if(LvlFactor > 1.0f) LvlFactor = 1.0f; @@ -4030,7 +4032,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) } } - // passive auras not stacable with other ranks + // passive auras not stackable with other ranks if (!IsPassiveSpellStackableWithRanks(aurSpellInfo)) { if (!RemoveNoStackAurasDueToAuraHolder(holder)) @@ -5956,8 +5958,6 @@ void Unit::_RemoveTotem(Totem* totem) } } - - void Unit::UnsummonAllTotems() { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) @@ -6597,6 +6597,7 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM break; } } + // Custom crit by class switch(spellProto->SpellFamilyName) { @@ -6995,7 +6996,7 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo) if (!spellInfo) return false; - //TODO add spellEffect immunity checks!, player with flag in bg is imune to imunity buffs from other friendly players! + //TODO add spellEffect immunity checks!, player with flag in bg is immune to immunity buffs from other friendly players! //SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_EFFECT]; SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL]; @@ -7106,13 +7107,12 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000)) mechanicMask |= (1 << (MECHANIC_BLEED-1)); - // FLAT damage bonus auras // ======================= int32 DoneFlat = 0; int32 APbonus = 0; - // ..done flat, already included in wepon damage based spells + // ..done flat, already included in weapon damage based spells if (!isWeaponDamageBasedSpell) { AuraList const& mModDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE); @@ -7173,7 +7173,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType // ..done pct (by creature type mask) DonePercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, creatureTypeMask); - // special dummys/class sripts and other effects + // special dummys/class scripts and other effects // ============================================= Unit *owner = GetOwner(); if (!owner) @@ -7297,7 +7297,6 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType } } - // final calculation // ================= @@ -7351,7 +7350,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType */ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackType attType, SpellEntry const *spellProto, DamageEffectType damagetype, uint32 stack) { - if (!pCaster) + if (!pCaster) return pdamage; if (pdamage == 0) @@ -7366,7 +7365,6 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000)) mechanicMask |= (1 << (MECHANIC_BLEED-1)); - // FLAT damage bonus auras // ======================= int32 TakenFlat = 0; @@ -7475,7 +7473,6 @@ void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply) } } } - } void Unit::ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply) @@ -8691,7 +8688,7 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectInde int32 mechanic = GetEffectMechanic(spellProto, effect_index); // Find total mod value (negative bonus) int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic); - // Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negatve effects (stack always ?) + // Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negative effects (stack always ?) if (!IsPositiveEffect(spellProto->Id, effect_index)) durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel); // Find max mod (negative bonus) @@ -8835,7 +8832,7 @@ uint32 Unit::GetCreatureType() const { if(GetTypeId() == TYPEID_PLAYER) { - SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form); + SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(m_form); if(ssEntry && ssEntry->creatureType > 0) return ssEntry->creatureType; else @@ -9243,17 +9240,16 @@ void Unit::ApplyAuraProcTriggerDamage( Aura* aura, bool apply ) uint32 Unit::GetCreatePowers( Powers power ) const { - // POWER_FOCUS and POWER_HAPPINESS only have hunter pet switch(power) { - case POWER_HEALTH: return 0; + case POWER_HEALTH: return 0; // is it really should be here? case POWER_MANA: return GetCreateMana(); case POWER_RAGE: return 1000; - case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100); + case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100); case POWER_ENERGY: return 100; - case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000); - case POWER_RUNIC_POWER: return 1000; - case POWER_RUNE: return 0; + case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000); + case POWER_RUNE: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 8 : 0); + case POWER_RUNIC_POWER: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 1000 : 0); } return 0; @@ -9386,13 +9382,13 @@ void CharmInfo::InitCharmCreateSpells() SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if(!spellInfo) onlyselfcast = false; - for(uint32 i = 0;i<3 && onlyselfcast;++i) //nonexistent spell will not make any problems as onlyselfcast would be false -> break right away + for(uint32 i = 0; i < 3 && onlyselfcast; ++i) //nonexistent spell will not make any problems as onlyselfcast would be false -> break right away { if(spellInfo->EffectImplicitTargetA[i] != TARGET_SELF && spellInfo->EffectImplicitTargetA[i] != 0) onlyselfcast = false; } - if(onlyselfcast || !IsPositiveSpell(spellId)) //only self cast and spells versus enemies are autocastable + if(onlyselfcast || !IsPositiveSpell(spellId)) // only self cast and spells versus enemies are autocastable newstate = ACT_DISABLED; else newstate = ACT_PASSIVE; @@ -9729,7 +9725,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if (!removedSpells.empty()) { - // Sort spells and remove dublicates + // Sort spells and remove duplicates removedSpells.sort(); removedSpells.unique(); // Remove auras from removedAuras @@ -10496,7 +10492,7 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee float vsin = sin(angle); float vcos = cos(angle); - // Effect propertly implemented only for players + // Effect properly implemented only for players if(GetTypeId()==TYPEID_PLAYER) { WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4); diff --git a/src/game/Unit.h b/src/game/Unit.h index 28089ad9d..9c36a8325 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -677,7 +677,7 @@ enum MovementFlags2 MOVEFLAG2_ALLOW_PITCHING = 0x0020, MOVEFLAG2_UNK4 = 0x0040, MOVEFLAG2_UNK5 = 0x0080, - MOVEFLAG2_UNK6 = 0x0100, + MOVEFLAG2_UNK6 = 0x0100, // transport related MOVEFLAG2_UNK7 = 0x0200, MOVEFLAG2_INTERP_MOVEMENT = 0x0400, MOVEFLAG2_INTERP_TURNING = 0x0800, diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 66066d54c..de7f8bd8b 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -383,7 +383,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S if (!allow) return false; } - // Aura added by spell can`t trogger from self (prevent drop charges/do triggers) + // Aura added by spell can`t trigger from self (prevent drop charges/do triggers) // But except periodic triggers (can triggered from self) if(procSpell && procSpell->Id == spellProto->Id && !(spellProto->procFlags & PROC_FLAG_ON_TAKE_PERIODIC)) return false; @@ -423,7 +423,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S uint32 WeaponSpeed = GetAttackTime(attType); chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate); } - // Apply chance modifer aura + // Apply chance modifier aura if(Player* modOwner = GetSpellModOwner()) { modOwner->ApplySpellMod(spellProto->Id,SPELLMOD_CHANCE_OF_SUCCESS,chance); @@ -1045,7 +1045,7 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura mod->m_amount *=2; if (mod->m_amount < 100) // not enough return SPELL_AURA_PROC_OK; - // Crititcal counted -> roll chance + // Critical counted -> roll chance if (roll_chance_i(triggerAmount)) CastSpell(this, 48108, true, castItem, triggeredByAura); } @@ -2884,7 +2884,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d } break; case SPELLFAMILY_WARRIOR: - // Deep Wounds (replace triggered spells to directly apply DoT), dot spell have finilyflags + // Deep Wounds (replace triggered spells to directly apply DoT), dot spell have familyflags if (auraSpellInfo->SpellFamilyFlags == UI64LIT(0x0) && auraSpellInfo->SpellIconID == 243) { float weaponDamage; diff --git a/src/game/World.cpp b/src/game/World.cpp index 559b97252..8dc40472f 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -882,7 +882,7 @@ void World::SetInitialWorldSettings() ///- Initialize config settings LoadConfigSettings(); - ///- Check the existence of the map files for all races' startup areas. + ///- Check the existence of the map files for all races start areas. if (!MapManager::ExistMapAndVMap(0,-6240.32f, 331.033f) || !MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) || !MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) || @@ -1858,8 +1858,7 @@ void World::SendServerMessage(ServerMessageType type, const char *text, Player* { WorldPacket data(SMSG_SERVER_MESSAGE, 50); // guess size data << uint32(type); - if(type <= SERVER_MSG_STRING) - data << text; + data << text; if(player) player->GetSession()->SendPacket(&data); diff --git a/src/game/World.h b/src/game/World.h index 099ad5961..b32f2dbed 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -47,11 +47,15 @@ class WorldSocket; // ServerMessages.dbc enum ServerMessageType { - SERVER_MSG_SHUTDOWN_TIME = 1, - SERVER_MSG_RESTART_TIME = 2, - SERVER_MSG_STRING = 3, - SERVER_MSG_SHUTDOWN_CANCELLED = 4, - SERVER_MSG_RESTART_CANCELLED = 5 + SERVER_MSG_SHUTDOWN_TIME = 1, + SERVER_MSG_RESTART_TIME = 2, + SERVER_MSG_CUSTOM = 3, + SERVER_MSG_SHUTDOWN_CANCELLED = 4, + SERVER_MSG_RESTART_CANCELLED = 5, + SERVER_MSG_BG_SHUTDOWN_TIME = 6, + SERVER_MSG_BG_RESTART_TIME = 7, + SERVER_MSG_INSTANCE_SHUTDOWN_TIME = 8, + SERVER_MSG_INSTANCE_RESTART_TIME = 9, }; enum ShutdownMask diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 57dea422a..413bd4c72 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -244,7 +244,7 @@ int WorldSocket::open (void *a) m_Address = remote_addr.get_host_addr (); // Send startup packet. - WorldPacket packet (SMSG_AUTH_CHALLENGE, 24); + WorldPacket packet (SMSG_AUTH_CHALLENGE, 40); packet << uint32(1); // 1...31 packet << m_Seed; @@ -742,35 +742,30 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) { // NOTE: ATM the socket is singlethread, have this in mind ... uint8 digest[20]; - uint32 clientSeed; - uint32 unk2, unk3, unk5, unk6, unk7; - uint64 unk4; + uint32 clientSeed, id, security; uint32 ClientBuild; - uint32 id, security; uint8 expansion = 0; LocaleConstant locale; std::string account; Sha1Hash sha1; - BigNumber v, s, g, N; - WorldPacket packet, SendAddonPacked; - - BigNumber K; + BigNumber v, s, g, N, K; + WorldPacket packet; // Read the content of the packet recvPacket >> ClientBuild; - recvPacket >> unk2; + recvPacket.read_skip(); recvPacket >> account; - recvPacket >> unk3; + recvPacket.read_skip(); recvPacket >> clientSeed; - recvPacket >> unk5 >> unk6 >> unk7; - recvPacket >> unk4; + recvPacket.read_skip(); + recvPacket.read_skip(); + recvPacket.read_skip(); + recvPacket.read_skip(); recvPacket.read (digest, 20); - DEBUG_LOG ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", + DEBUG_LOG ("WorldSocket::HandleAuthSession: client build %u, account %s, clientseed %X", ClientBuild, - unk2, - account.c_str (), - unk3, + account.c_str(), clientSeed); // Check the version of client trying to connect diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 35db17066..db8a06118 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -76,6 +76,16 @@ enum AuthResult WOW_FAIL_LOCKED_ENFORCED = 0x10, ///< You have applied a lock to your account. You can change your locked status by calling your account lock phone number. WOW_FAIL_TRIAL_ENDED = 0x11, ///< Your trial subscription has expired. Please visit to upgrade your account. WOW_FAIL_USE_BATTLENET = 0x12, ///< WOW_FAIL_OTHER This account is now attached to a Battle.net account. Please login with your Battle.net account email address and password. + //WOW_FAIL_OVERMIND_CONVERTED + //WOW_FAIL_ANTI_INDULGENCE + //WOW_FAIL_EXPIRED + //WOW_FAIL_NO_GAME_ACCOUNT + //WOW_FAIL_BILLING_LOCK + //WOW_FAIL_IGR_WITHOUT_BNET + //WOW_FAIL_AA_LOCK + //WOW_FAIL_UNLOCKABLE_LOCK + //WOW_FAIL_MUST_USE_BNET + //WOW_FAIL_OTHER }; #endif