diff options
author | megamage <none@none> | 2009-03-21 14:53:38 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-21 14:53:38 -0600 |
commit | de849cc5087e9a11ddff2f4e9ec42b1ec293cf2a (patch) | |
tree | 209f7f4bb8e6b4fde7dbd57305a1e797cc5010af | |
parent | 3b09489f880f13116ac285085982721ef60920cd (diff) |
Small code cleanup and partial merge with dev branch Author: tomrus88
--HG--
branch : trunk
-rw-r--r-- | src/game/CharacterHandler.cpp | 27 | ||||
-rw-r--r-- | src/game/Chat.cpp | 1 | ||||
-rw-r--r-- | src/game/Chat.h | 1 | ||||
-rw-r--r-- | src/game/Debugcmds.cpp | 24 | ||||
-rw-r--r-- | src/game/ItemPrototype.h | 1 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/PetHandler.cpp | 115 | ||||
-rw-r--r-- | src/game/Player.cpp | 373 | ||||
-rw-r--r-- | src/game/Player.h | 105 | ||||
-rw-r--r-- | src/game/QueryHandler.cpp | 53 | ||||
-rw-r--r-- | src/game/QuestDef.h | 2 | ||||
-rw-r--r-- | src/game/SharedDefines.h | 2 | ||||
-rw-r--r-- | src/game/SkillHandler.cpp | 98 | ||||
-rw-r--r-- | src/game/Spell.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 4 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 22 | ||||
-rw-r--r-- | src/game/WorldSocket.cpp | 9 | ||||
-rw-r--r-- | src/shared/Database/DBCfmt.cpp | 1 |
18 files changed, 374 insertions, 470 deletions
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 4e3dd92e3d4..f119909a31e 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -647,6 +647,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) DEBUG_LOG( "WORLD: Sent server info" ); } + data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); + data << uint32(0); + data << uint32(0); + SendPacket(&data); + //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow()); QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD); @@ -770,7 +775,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if(uint32 sourceNode = pCurrChar->m_taxi.GetTaxiSource()) { - sLog.outDebug( "WORLD: Restart character %u taxi flight", pCurrChar->GetGUIDLow() ); uint32 MountId = objmgr.GetTaxiMount(sourceNode, pCurrChar->GetTeam()); @@ -1222,20 +1226,21 @@ void WorldSession::HandleRemoveGlyph( WorldPacket & recv_data ) uint32 slot; recv_data >> slot; - if(slot > MAX_GLYPH_SLOT_INDEX) - { - sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); - return; - } - - if(uint32 glyph = _player->GetGlyph(slot)) + if(slot < MAX_GLYPH_SLOT_INDEX) { - if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if(uint32 glyph = _player->GetGlyph(slot)) { - _player->RemoveAurasDueToSpell(gp->SpellId); - _player->SetGlyph(slot, 0); + if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + { + _player->RemoveAurasDueToSpell(gp->SpellId); + _player->SetGlyph(slot, 0); + } } + + return; } + + sLog.outDebug("Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); } void WorldSession::HandleCharCustomize(WorldPacket& recv_data) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 0ed7971f802..5b194373f91 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -137,6 +137,7 @@ ChatCommand * ChatHandler::getCommandTable() { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, { "sendlargepacket",SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL }, + { "setitemflag", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemFlagCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; diff --git a/src/game/Chat.h b/src/game/Chat.h index 44ca1d10dac..ee95f78a396 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -512,6 +512,7 @@ class ChatHandler bool HandleDebugSpawnVehicle(const char * args); bool HandleDebugSendLargePacketCommand(const char * args); bool HandleDebugSendSetPhaseShiftCommand(const char * args); + bool HandleDebugSetItemFlagCommand(const char * args); Player* getSelectedPlayer(); Creature* getSelectedCreature(); diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index 30eb3b6704c..73aff0dbb09 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -667,3 +667,27 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) m_session->SendSetPhaseShift(PhaseShift); return true; } + +bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args) +{ + if(!args) + return false; + + char* e = strtok((char*)args, " "); + char* f = strtok(NULL, " "); + + if (!e || !f) + return false; + + uint32 guid = (uint32)atoi(e); + uint32 flag = (uint32)atoi(f); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if(!i) + return false; + + i->SetUInt32Value(ITEM_FIELD_FLAGS, flag); + + return true; +} diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index b8150b48c52..caf878da7e1 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -107,6 +107,7 @@ enum ITEM_FLAGS ITEM_FLAGS_CONJURED = 0x00000002, ITEM_FLAGS_OPENABLE = 0x00000004, ITEM_FLAGS_WRAPPED = 0x00000008, + ITEM_FLAGS_BROKEN = 0x00000010, // appears red icon (like when item durability==0) ITEM_FLAGS_WRAPPER = 0x00000200, // used or not used wrapper ITEM_FLAGS_PARTY_LOOT = 0x00000800, // determines if item is party loot or not ITEM_FLAGS_CHARTER = 0x00002000, // arena/guild charter diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 446a7331615..b284db806d7 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -878,7 +878,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) if(decompressedSize == 0) // erase { - SetAccountData(type, timestamp, ""); + SetAccountData(type, 0, ""); WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4+4); data << uint32(type); @@ -978,7 +978,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) } else if(type==ACTION_BUTTON_SPELL) { - sLog.outDetail( "MISC: Added Action %u into button %u", action, button ); + sLog.outDetail( "MISC: Added Spell %u into button %u", action, button ); GetPlayer()->addActionButton(button,action,type,misc); } else if(type==ACTION_BUTTON_ITEM) diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index ed07f169e69..088f0ff2c58 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -693,7 +693,6 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data ) { sLog.outDebug("WORLD: CMSG_PET_LEARN_TALENT"); - recv_data.hexlike(); CHECK_PACKET_SIZE(recv_data, 8+4+4); @@ -701,117 +700,5 @@ void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data ) uint32 talent_id, requested_rank; recv_data >> guid >> talent_id >> requested_rank; - Pet *pet = _player->GetPet(); - - if(!pet) - return; - - if(guid != pet->GetGUID()) - return; - - uint32 CurTalentPoints = pet->GetFreeTalentPoints(); - - if(CurTalentPoints == 0) - return; - - if (requested_rank > 4) - return; - - TalentEntry const *talentInfo = sTalentStore.LookupEntry(talent_id); - - if(!talentInfo) - return; - - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); - - if(!talentTabInfo) - return; - - CreatureInfo const *ci = pet->GetCreatureInfo(); - - if(!ci) - return; - - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); - - if(!pet_family) - return; - - if(pet_family->petTalentType < 0) // not hunter pet - return; - - // prevent learn talent for different family (cheating) - if(!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)) - return; - - // prevent skip talent ranks (cheating) - if(requested_rank > 0 && !pet->HasSpell(talentInfo->RankID[requested_rank-1])) - return; - - // Check if it requires another talent - if (talentInfo->DependsOn > 0) - { - if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) - { - bool hasEnoughRank = false; - for (int i = talentInfo->DependsOnRank; i <= 4; i++) - { - if (depTalentInfo->RankID[i] != 0) - if (pet->HasSpell(depTalentInfo->RankID[i])) - hasEnoughRank = true; - } - if (!hasEnoughRank) - return; - } - } - - // Find out how many points we have in this field - uint32 spentPoints = 0; - - uint32 tTab = talentInfo->TalentTab; - if (talentInfo->Row > 0) - { - unsigned int numRows = sTalentStore.GetNumRows(); - for (unsigned int i = 0; i < numRows; i++) // Loop through all talents. - { - // Someday, someone needs to revamp - const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); - if (tmpTalent) // the way talents are tracked - { - if (tmpTalent->TalentTab == tTab) - { - for (int j = 0; j <= 4; j++) - { - if (tmpTalent->RankID[j] != 0) - { - if (pet->HasSpell(tmpTalent->RankID[j])) - { - spentPoints += j + 1; - } - } - } - } - } - } - } - - // not have required min points spent in talent tree - if(spentPoints < (talentInfo->Row * 3)) - return; - - // spell not set in talent.dbc - uint32 spellid = talentInfo->RankID[requested_rank]; - if( spellid == 0 ) - { - sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talent_id, requested_rank); - return; - } - - // already known - if(pet->HasSpell(spellid)) - return; - - // learn! (other talent ranks will unlearned at learning) - pet->learnSpell(spellid); - sLog.outDetail("TalentID: %u Rank: %u Spell: %u", talent_id, requested_rank, spellid); + _player->LearnPetTalent(guid, talent_id, requested_rank); } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5683c55e04d..db7f0ad1ae9 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3277,7 +3277,7 @@ void Player::RemoveArenaSpellCooldowns() // notify player WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); data << uint32(itr->first); - data << GetGUID(); + data << uint64(GetGUID()); GetSession()->SendPacket(&data); // remove cooldown m_spellCooldowns.erase(itr); @@ -6111,12 +6111,9 @@ bool Player::SetOneFactionReputation(FactionEntry const* factionEntry, int32 sta //Calculate total reputation percent player gain with quest/creature level int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest) { - // always 100% (3.0.8) - int32 percent = 100; - int32 repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN); - percent += rep > 0 ? repMod : -repMod; + int32 percent = rep > 0 ? repMod : -repMod; if(percent <=0) return 0; @@ -8628,10 +8625,10 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap slots[0] = EQUIPMENT_SLOT_RANGED; break; case INVTYPE_BAG: - slots[0] = INVENTORY_SLOT_BAG_1; - slots[1] = INVENTORY_SLOT_BAG_2; - slots[2] = INVENTORY_SLOT_BAG_3; - slots[3] = INVENTORY_SLOT_BAG_4; + slots[0] = INVENTORY_SLOT_BAG_START + 0; + slots[1] = INVENTORY_SLOT_BAG_START + 1; + slots[2] = INVENTORY_SLOT_BAG_START + 2; + slots[3] = INVENTORY_SLOT_BAG_START + 3; break; case INVTYPE_RELIC: { @@ -9632,8 +9629,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - // Vanity pet case skipped as not used - /* until proper implementation else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9656,28 +9651,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } */ - /* until proper implementation - else if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; - - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9826,8 +9799,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - // Vanity pet case skipped as not used - /* until proper implementation else if(false pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -9850,28 +9821,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } */ - /* until proper implementation - else if(false pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) - { - if(no_space_count) - *no_space_count = count + no_similar_count; - return res; - } - - if(count==0) - { - if(no_similar_count==0) - return EQUIP_ERR_OK; - - if(no_space_count) - *no_space_count = count + no_similar_count; - return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; - } - } - */ for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { @@ -9943,13 +9892,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const int inv_bags[INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; int inv_keys[KEYRING_SLOT_END-KEYRING_SLOT_START]; int inv_tokens[CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START]; - int inv_quests[QUESTBAG_SLOT_END-QUESTBAG_SLOT_START]; memset(inv_slot_items,0,sizeof(int)*(INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START)); memset(inv_bags,0,sizeof(int)*(INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START)*MAX_BAG_SIZE); memset(inv_keys,0,sizeof(int)*(KEYRING_SLOT_END-KEYRING_SLOT_START)); memset(inv_tokens,0,sizeof(int)*(CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START)); - memset(inv_quests,0,sizeof(int)*(QUESTBAG_SLOT_END-QUESTBAG_SLOT_START)); for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { @@ -9971,8 +9918,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - // Vanity pet case skipped as not used - for(int i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9983,16 +9928,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = QUESTBAG_SLOT_START; i < QUESTBAG_SLOT_END; i++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); - - if (pItem2 && !pItem2->IsInTrade()) - { - inv_quests[i-QUESTBAG_SLOT_START] = pItem2->GetCount(); - } - } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) @@ -10052,8 +9987,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - // Vanity pet case skipped as not used - for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; t++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); @@ -10066,18 +9999,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; t++) - { - pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); - if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_quests[t-QUESTBAG_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) - { - inv_quests[t-QUESTBAG_SLOT_START] += pItem->GetCount(); - b_found = true; - break; - } - } - if (b_found) continue; - for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; t++) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); @@ -10130,8 +10051,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; - // Vanity pet case skipped as not used - /* until proper implementation if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) { @@ -10148,22 +10067,6 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; */ - /* until proper implementation - if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS) - { - for(uint32 t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; ++t) - { - if( inv_quests[t-QUESTBAG_SLOT_START] == 0 ) - { - inv_quests[t-QUESTBAG_SLOT_START] = 1; - b_found = true; - break; - } - } - } - - if (b_found) continue; - */ for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; t++) { @@ -11279,6 +11182,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq } } } + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) { if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) @@ -15225,7 +15129,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) void Player::_LoadGlyphAuras() { - for (uint8 i = 0; i <= MAX_GLYPH_SLOT_INDEX; ++i) + for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) { if (uint32 glyph = GetGlyph(i)) { @@ -17076,7 +16980,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if(pet->isControlled()) { - WorldPacket data(SMSG_PET_SPELLS, 8); + WorldPacket data(SMSG_PET_SPELLS, 8+4); data << uint64(0); data << uint32(0); GetSession()->SendPacket(&data); @@ -17283,9 +17187,9 @@ void Player::PossessSpellInitialize() //basic info 20 data << uint64(charm->GetGUID()); - data << uint32(0); //family - data << uint32(0); //0 - data << uint8(0) << uint8(0) << uint16(0); //reactstate, commandstate, 0 + data << uint32(0x00000000); + data << uint32(0); + data << uint32(0); //action bar 40 for(uint32 i = 0; i < 10; i++) @@ -18933,10 +18837,6 @@ void Player::SendInitialPacketsBeforeAddToMap() data << (float)0.01666667f; // game speed GetSession()->SendPacket( &data ); - data.Initialize(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement - data << uint32(0x00000000); // on blizz it increments periodically - GetSession()->SendPacket(&data); - // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); @@ -20719,3 +20619,252 @@ void Player::UpdateAchievementCriteria( AchievementCriteriaTypes type, uint32 mi { GetAchievementMgr().UpdateAchievementCriteria(type, miscvalue1,miscvalue2,unit,time); } + +void Player::LearnTalent(uint32 talentId, uint32 talentRank) +{ + uint32 CurTalentPoints = GetFreeTalentPoints(); + + if(CurTalentPoints == 0) + return; + + if (talentRank > 4) + return; + + TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId ); + + if(!talentInfo) + return; + + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); + + if(!talentTabInfo) + return; + + // prevent learn talent for different class (cheating) + if( (getClassMask() & talentTabInfo->ClassMask) == 0 ) + return; + + // find current max talent rank + int32 curtalent_maxrank = 0; + for(int32 k = 4; k > -1; --k) + { + if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k])) + { + curtalent_maxrank = k + 1; + break; + } + } + + // we already have same or higher talent rank learned + if(curtalent_maxrank >= (talentRank + 1)) + return; + + // check if we have enough talent points + if(CurTalentPoints < (talentRank - curtalent_maxrank + 1)) + return; + + // Check if it requires another talent + if (talentInfo->DependsOn > 0) + { + if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + { + bool hasEnoughRank = false; + for (int i = talentInfo->DependsOnRank; i <= 4; i++) + { + if (depTalentInfo->RankID[i] != 0) + if (HasSpell(depTalentInfo->RankID[i])) + hasEnoughRank = true; + } + if (!hasEnoughRank) + return; + } + } + + // Find out how many points we have in this field + uint32 spentPoints = 0; + + uint32 tTab = talentInfo->TalentTab; + if (talentInfo->Row > 0) + { + unsigned int numRows = sTalentStore.GetNumRows(); + for (unsigned int i = 0; i < numRows; i++) // Loop through all talents. + { + // Someday, someone needs to revamp + const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); + if (tmpTalent) // the way talents are tracked + { + if (tmpTalent->TalentTab == tTab) + { + for (int j = 0; j <= 4; j++) + { + if (tmpTalent->RankID[j] != 0) + { + if (HasSpell(tmpTalent->RankID[j])) + { + spentPoints += j + 1; + } + } + } + } + } + } + } + + // not have required min points spent in talent tree + if(spentPoints < (talentInfo->Row * 5)) + return; + + // spell not set in talent.dbc + uint32 spellid = talentInfo->RankID[talentRank]; + if( spellid == 0 ) + { + sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + return; + } + + // already known + if(HasSpell(spellid)) + return; + + // learn! (other talent ranks will unlearned at learning) + learnSpell(spellid, false); + sLog.outDetail("TalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); + + // update free talent points + SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); +} + +void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) +{ + Pet *pet = GetPet(); + + if(!pet) + return; + + if(petGuid != pet->GetGUID()) + return; + + uint32 CurTalentPoints = pet->GetFreeTalentPoints(); + + if(CurTalentPoints == 0) + return; + + if (talentRank > 2) + return; + + TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId); + + if(!talentInfo) + return; + + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + + if(!talentTabInfo) + return; + + CreatureInfo const *ci = pet->GetCreatureInfo(); + + if(!ci) + return; + + CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + + if(!pet_family) + return; + + if(pet_family->petTalentType < 0) // not hunter pet + return; + + // prevent learn talent for different family (cheating) + if(!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask)) + return; + + // find current max talent rank + int32 curtalent_maxrank = 0; + for(int32 k = 4; k > -1; --k) + { + if(talentInfo->RankID[k] && pet->HasSpell(talentInfo->RankID[k])) + { + curtalent_maxrank = k + 1; + break; + } + } + + // we already have same or higher talent rank learned + if(curtalent_maxrank >= (talentRank + 1)) + return; + + // check if we have enough talent points + if(CurTalentPoints < (talentRank - curtalent_maxrank + 1)) + return; + + // Check if it requires another talent + if (talentInfo->DependsOn > 0) + { + if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + { + bool hasEnoughRank = false; + for (int i = talentInfo->DependsOnRank; i <= 4; i++) + { + if (depTalentInfo->RankID[i] != 0) + if (pet->HasSpell(depTalentInfo->RankID[i])) + hasEnoughRank = true; + } + if (!hasEnoughRank) + return; + } + } + + // Find out how many points we have in this field + uint32 spentPoints = 0; + + uint32 tTab = talentInfo->TalentTab; + if (talentInfo->Row > 0) + { + unsigned int numRows = sTalentStore.GetNumRows(); + for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. + { + // Someday, someone needs to revamp + const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); + if (tmpTalent) // the way talents are tracked + { + if (tmpTalent->TalentTab == tTab) + { + for (int j = 0; j <= 4; j++) + { + if (tmpTalent->RankID[j] != 0) + { + if (pet->HasSpell(tmpTalent->RankID[j])) + { + spentPoints += j + 1; + } + } + } + } + } + } + } + + // not have required min points spent in talent tree + if(spentPoints < (talentInfo->Row * 3)) + return; + + // spell not set in talent.dbc + uint32 spellid = talentInfo->RankID[talentRank]; + if( spellid == 0 ) + { + sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + return; + } + + // already known + if(pet->HasSpell(spellid)) + return; + + // learn! (other talent ranks will unlearned at learning) + pet->learnSpell(spellid); + sLog.outDetail("TalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); + + // update free talent points + pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); +} diff --git a/src/game/Player.h b/src/game/Player.h index 3649b04d4ca..3019babd7ba 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -560,7 +560,9 @@ enum PlayerSlots PLAYER_SLOTS_COUNT = (PLAYER_SLOT_END - PLAYER_SLOT_START) }; -enum EquipmentSlots +#define INVENTORY_SLOT_BAG_0 255 + +enum EquipmentSlots // 19 slots { EQUIPMENT_SLOT_START = 0, EQUIPMENT_SLOT_HEAD = 0, @@ -585,118 +587,56 @@ enum EquipmentSlots EQUIPMENT_SLOT_END = 19 }; -enum InventorySlots +enum InventorySlots // 4 slots { - INVENTORY_SLOT_BAG_0 = 255, INVENTORY_SLOT_BAG_START = 19, - INVENTORY_SLOT_BAG_1 = 19, - INVENTORY_SLOT_BAG_2 = 20, - INVENTORY_SLOT_BAG_3 = 21, - INVENTORY_SLOT_BAG_4 = 22, - INVENTORY_SLOT_BAG_END = 23, + INVENTORY_SLOT_BAG_END = 23 +}; +enum InventoryPackSlots // 16 slots +{ INVENTORY_SLOT_ITEM_START = 23, - INVENTORY_SLOT_ITEM_1 = 23, - INVENTORY_SLOT_ITEM_2 = 24, - INVENTORY_SLOT_ITEM_3 = 25, - INVENTORY_SLOT_ITEM_4 = 26, - INVENTORY_SLOT_ITEM_5 = 27, - INVENTORY_SLOT_ITEM_6 = 28, - INVENTORY_SLOT_ITEM_7 = 29, - INVENTORY_SLOT_ITEM_8 = 30, - INVENTORY_SLOT_ITEM_9 = 31, - INVENTORY_SLOT_ITEM_10 = 32, - INVENTORY_SLOT_ITEM_11 = 33, - INVENTORY_SLOT_ITEM_12 = 34, - INVENTORY_SLOT_ITEM_13 = 35, - INVENTORY_SLOT_ITEM_14 = 36, - INVENTORY_SLOT_ITEM_15 = 37, - INVENTORY_SLOT_ITEM_16 = 38, INVENTORY_SLOT_ITEM_END = 39 }; -enum BankSlots +enum BankItemSlots // 28 slots { BANK_SLOT_ITEM_START = 39, - BANK_SLOT_ITEM_1 = 39, - BANK_SLOT_ITEM_2 = 40, - BANK_SLOT_ITEM_3 = 41, - BANK_SLOT_ITEM_4 = 42, - BANK_SLOT_ITEM_5 = 43, - BANK_SLOT_ITEM_6 = 44, - BANK_SLOT_ITEM_7 = 45, - BANK_SLOT_ITEM_8 = 46, - BANK_SLOT_ITEM_9 = 47, - BANK_SLOT_ITEM_10 = 48, - BANK_SLOT_ITEM_11 = 49, - BANK_SLOT_ITEM_12 = 50, - BANK_SLOT_ITEM_13 = 51, - BANK_SLOT_ITEM_14 = 52, - BANK_SLOT_ITEM_15 = 53, - BANK_SLOT_ITEM_16 = 54, - BANK_SLOT_ITEM_17 = 55, - BANK_SLOT_ITEM_18 = 56, - BANK_SLOT_ITEM_19 = 57, - BANK_SLOT_ITEM_20 = 58, - BANK_SLOT_ITEM_21 = 59, - BANK_SLOT_ITEM_22 = 60, - BANK_SLOT_ITEM_23 = 61, - BANK_SLOT_ITEM_24 = 62, - BANK_SLOT_ITEM_25 = 63, - BANK_SLOT_ITEM_26 = 64, - BANK_SLOT_ITEM_27 = 65, - BANK_SLOT_ITEM_28 = 66, - BANK_SLOT_ITEM_END = 67, + BANK_SLOT_ITEM_END = 67 +}; +enum BankBagSlots // 7 slots +{ BANK_SLOT_BAG_START = 67, - BANK_SLOT_BAG_1 = 67, - BANK_SLOT_BAG_2 = 68, - BANK_SLOT_BAG_3 = 69, - BANK_SLOT_BAG_4 = 70, - BANK_SLOT_BAG_5 = 71, - BANK_SLOT_BAG_6 = 72, - BANK_SLOT_BAG_7 = 73, BANK_SLOT_BAG_END = 74 }; -enum BuyBackSlots +enum BuyBackSlots // 12 slots { // stored in m_buybackitems BUYBACK_SLOT_START = 74, - BUYBACK_SLOT_1 = 74, - BUYBACK_SLOT_2 = 75, - BUYBACK_SLOT_3 = 76, - BUYBACK_SLOT_4 = 77, - BUYBACK_SLOT_5 = 78, - BUYBACK_SLOT_6 = 79, - BUYBACK_SLOT_7 = 80, - BUYBACK_SLOT_8 = 81, - BUYBACK_SLOT_9 = 82, - BUYBACK_SLOT_10 = 83, - BUYBACK_SLOT_11 = 84, - BUYBACK_SLOT_12 = 85, BUYBACK_SLOT_END = 86 }; -enum KeyRingSlots +enum KeyRingSlots // 32 slots { KEYRING_SLOT_START = 86, KEYRING_SLOT_END = 118 }; -enum VanityPetSlots +enum VanityPetSlots // 18 slots { VANITYPET_SLOT_START = 118, // not use, vanity pets stored as spells VANITYPET_SLOT_END = 136 // not alloed any content in. }; -enum CurrencyTokenSlots +enum CurrencyTokenSlots // 32 slots { CURRENCYTOKEN_SLOT_START = 136, CURRENCYTOKEN_SLOT_END = 168 }; -enum QuestBagSlots +enum QuestBagSlots // 32 slots { QUESTBAG_SLOT_START = 168, QUESTBAG_SLOT_END = 200 @@ -768,11 +708,6 @@ struct MovementInfo 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; t_guid = 0; } - - void SetMovementFlags(uint32 _flags) - { - flags = _flags; - } }; // flags that use in movement check for example at spell casting @@ -850,7 +785,6 @@ enum PlayerLoginQueryIndex MAX_PLAYER_LOGIN_QUERY = 21 }; - // Player summoning auto-decline time (in secs) #define MAX_PLAYER_SUMMON_DELAY (2*MINUTE) #define MAX_MONEY_AMOUNT (0x7FFFFFFF-1) @@ -1472,6 +1406,9 @@ class TRINITY_DLL_SPEC Player : public Unit uint32 resetTalentsCost() const; void InitTalentForLevel(); + void LearnTalent(uint32 talentId, uint32 talentRank); + void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank); + uint32 CalculateTalentsPoints() const; void InitGlyphsForLevel(); diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 1c23e8dc3a0..09d8f2f838d 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -102,20 +102,20 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+4+4+4+10) ); data << MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER); data << name; - data << (uint8)0; - data << (uint32)(field & 0xFF); - data << (uint32)((field >> 16) & 0xFF); - data << (uint32)((field >> 8) & 0xFF); + data << uint8(0); + data << uint32(field & 0xFF); + data << uint32((field >> 16) & 0xFF); + data << uint32((field >> 8) & 0xFF); // if the first declined name field (3) is empty, the rest must be too if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[3].GetCppString() != "") { - data << (uint8)1; // is declined + data << uint8(1); // is declined for(int i = 3; i < MAX_DECLINED_NAME_CASES+3; ++i) data << fields[i].GetCppString(); } else - data << (uint8)0; // is declined + data << uint8(0); // is declined session->SendPacket( &data ); delete result; @@ -123,7 +123,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; @@ -176,23 +176,23 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) sLog.outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name, entry); // guess size WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 100 ); - data << (uint32)entry; // creature entry + data << uint32(entry); // creature entry data << Name; data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty data << SubName; data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0 - data << (uint32)ci->type_flags; // flags wdbFeild7=wad flags1 - data << (uint32)ci->type; - data << (uint32)ci->family; // family wdbFeild9 - data << (uint32)ci->rank; // rank wdbFeild10 - data << (uint32)ci->PetSpellDataId; // Id from CreatureSpellData.dbc wdbField12 - data << (uint32)ci->Modelid1; // Modelid1 - data << (uint32)ci->Modelid2; // Modelid2 - data << (uint32)ci->Modelid3; // Modelid3 - data << (uint32)ci->Modelid4; // Modelid4 - data << (float)ci->unk16; // unk - data << (float)ci->unk17; // unk - data << (uint8)ci->RacialLeader; + data << uint32(ci->type_flags); // flags wdbFeild7=wad flags1 + data << uint32(ci->type); + data << uint32(ci->family); // family wdbFeild9 + data << uint32(ci->rank); // rank wdbFeild10 + data << uint32(ci->PetSpellDataId); // Id from CreatureSpellData.dbc wdbField12 + data << uint32(ci->Modelid1); // modelid_male1 + data << uint32(ci->Modelid2); // modelid_female1 ? + data << uint32(ci->Modelid3); // modelid_male2 ? + data << uint32(ci->Modelid4); // modelid_femmale2 ? + data << float(ci->unk16); // unk + data << float(ci->unk17); // unk + data << uint8(ci->RacialLeader); SendPacket( &data ); sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); } @@ -206,7 +206,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); data << uint32(entry | 0x80000000); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); } } @@ -242,15 +242,16 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) } sLog.outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID); WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 150 ); - data << entryID; - data << (uint32)info->type; - data << (uint32)info->displayId; + data << uint32(entryID); + data << uint32(info->type); + data << uint32(info->displayId); data << Name; data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4 data << uint8(0); // 2.0.3, string data << CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting") - data << uint8(0); // 2.0.3, probably string - data.append(info->raw.data,24); + data << uint8(0); // 2.0.3, string + data.append(info->raw.data, 24); + data << float(info->size); // go size SendPacket( &data ); sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); } diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 3afeaa0aa54..242c10bf48f 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -125,7 +125,7 @@ enum __QuestFlags //QUEST_FLAGS_NONE2 = 0x00000010, // Not used currently QUEST_FLAGS_EPIC = 0x00000020, // Not used currently: Unsure of content QUEST_FLAGS_RAID = 0x00000040, // Not used currently - QUEST_FLAGS_TBC = 0x00000080, // Not used currently: Available if TBC expension enabled only + QUEST_FLAGS_TBC = 0x00000080, // Not used currently: Available if TBC expansion enabled only QUEST_FLAGS_UNK2 = 0x00000100, // Not used currently: _DELIVER_MORE Quest needs more than normal _q-item_ drops from mobs QUEST_FLAGS_HIDDEN_REWARDS = 0x00000200, // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE)) QUEST_FLAGS_AUTO_REWARDED = 0x00000400, // These quests are automatically rewarded on quest complete and they will never appear in quest log client side. diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 86920b1bb27..be289df52ba 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -451,7 +451,7 @@ enum SpellCategory #define SPELL_ATTR_EX6_UNK30 0x40000000 // 30 not set in 3.0.3 #define SPELL_ATTR_EX6_UNK31 0x80000000 // 31 not set in 3.0.3 -#define MAX_GLYPH_SLOT_INDEX 5 +#define MAX_GLYPH_SLOT_INDEX 6 enum SheathTypes { diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp index a6d854d25ce..ccc2eea8297 100644 --- a/src/game/SkillHandler.cpp +++ b/src/game/SkillHandler.cpp @@ -35,103 +35,7 @@ void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data ) uint32 talent_id, requested_rank; recv_data >> talent_id >> requested_rank; - uint32 CurTalentPoints = GetPlayer()->GetFreeTalentPoints(); - - if(CurTalentPoints == 0) - return; - - if (requested_rank > 4) - return; - - TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id ); - - if(!talentInfo) - return; - - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab ); - - if(!talentTabInfo) - return; - - Player * player = GetPlayer(); - - // prevent learn talent for different class (cheating) - if( (player->getClassMask() & talentTabInfo->ClassMask) == 0 ) - return; - - // prevent skip talent ranks (cheating) - if(requested_rank > 0 && !player->HasSpell(talentInfo->RankID[requested_rank-1])) - return; - - // Check if it requires another talent - if (talentInfo->DependsOn > 0) - { - if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) - { - bool hasEnoughRank = false; - for (int i = talentInfo->DependsOnRank; i <= 4; i++) - { - if (depTalentInfo->RankID[i] != 0) - if (player->HasSpell(depTalentInfo->RankID[i])) - hasEnoughRank = true; - } - if (!hasEnoughRank) - return; - } - } - - // Find out how many points we have in this field - uint32 spentPoints = 0; - - uint32 tTab = talentInfo->TalentTab; - if (talentInfo->Row > 0) - { - unsigned int numRows = sTalentStore.GetNumRows(); - for (unsigned int i = 0; i < numRows; i++) // Loop through all talents. - { - // Someday, someone needs to revamp - const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); - if (tmpTalent) // the way talents are tracked - { - if (tmpTalent->TalentTab == tTab) - { - for (int j = 0; j <= 4; j++) - { - if (tmpTalent->RankID[j] != 0) - { - if (player->HasSpell(tmpTalent->RankID[j])) - { - spentPoints += j + 1; - } - } - } - } - } - } - } - - // not have required min points spent in talent tree - if(spentPoints < (talentInfo->Row * 5)) - return; - - // spell not set in talent.dbc - uint32 spellid = talentInfo->RankID[requested_rank]; - if( spellid == 0 ) - { - sLog.outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talent_id, requested_rank); - return; - } - - // already known - if(GetPlayer( )->HasSpell(spellid)) - return; - - // learn! (other talent ranks will unlearned at learning) - GetPlayer( )->learnSpell(spellid,false); - sLog.outDetail("TalentID: %u Rank: %u Spell: %u", talent_id, requested_rank, spellid); - - // update free talent points - GetPlayer()->SetFreeTalentPoints(CurTalentPoints - 1); + _player->LearnTalent(talent_id, requested_rank); } void WorldSession::HandleTalentWipeOpcode( WorldPacket & recv_data ) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0a2dbe53485..1788240fddf 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4867,7 +4867,7 @@ SpellCastResult Spell::CheckItems() ItemPrototype const *proto = m_CastItem->GetProto(); if(!proto) return SPELL_FAILED_ITEM_NOT_READY; - for(int s=0;s < MAX_ITEM_PROTO_SPELLS; ++s) + for(int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 9e56b7e2bdb..f01195b2b23 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3057,7 +3057,7 @@ void Aura::HandleAuraModScale(bool apply, bool Real) if(caster->GetTypeId() == TYPEID_PLAYER) { - WorldPacket data(SMSG_PET_SPELLS, 8); + WorldPacket data(SMSG_PET_SPELLS, 8+4); data << uint64(0); data << uint32(0); ((Player*)caster)->GetSession()->SendPacket(&data); @@ -3213,7 +3213,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real) if(caster->GetTypeId() == TYPEID_PLAYER) { - WorldPacket data(SMSG_PET_SPELLS, 8); + WorldPacket data(SMSG_PET_SPELLS, 8+4); data << uint64(0); data << uint32(0); ((Player*)caster)->GetSession()->SendPacket(&data); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2cb5b1db08d..742fc30fd69 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5409,16 +5409,6 @@ void Spell::EffectApplyGlyph(uint32 i) Player *player = (Player*)m_caster; - // remove old glyph - if(uint32 oldglyph = player->GetGlyph(m_glyphIndex)) - { - if(GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) - { - player->RemoveAurasDueToSpell(old_gp->SpellId); - player->SetGlyph(m_glyphIndex, 0); - } - } - // apply new one if(uint32 glyph = m_spellInfo->EffectMiscValue[i]) { @@ -5429,7 +5419,17 @@ void Spell::EffectApplyGlyph(uint32 i) if(gp->TypeFlags != gs->TypeFlags) { SendCastResult(SPELL_FAILED_INVALID_GLYPH); - return; // glyph slot missmatch + return; // glyph slot mismatch + } + } + + // remove old glyph + if(uint32 oldglyph = player->GetGlyph(m_glyphIndex)) + { + if(GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) + { + player->RemoveAurasDueToSpell(old_gp->SpellId); + player->SetGlyph(m_glyphIndex, 0); } } diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index c32dcee78a9..ca5a233bc64 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -37,7 +37,6 @@ #include "WorldPacket.h" #include "SharedDefines.h" #include "ByteBuffer.h" -#include "AddonHandler.h" #include "Opcodes.h" #include "Database/DatabaseEnv.h" #include "Auth/Sha1.h" @@ -187,7 +186,7 @@ int WorldSocket::SendPacket (const WorldPacket& pct) } ServerPktHeader header(pct.size()+2, pct.GetOpcode()); - m_Crypt.EncryptSend ( header.header, header.getHeaderLength()); + m_Crypt.EncryptSend ((uint8*)header.header, header.getHeaderLength()); if (m_OutBuffer->space () >= pct.size () + header.getHeaderLength() && msg_queue()->is_empty()) { @@ -480,7 +479,7 @@ int WorldSocket::handle_input_header (void) ACE_ASSERT (m_Header.length () == sizeof (ClientPktHeader)); - m_Crypt.DecryptRecv ((ACE_UINT8*) m_Header.rd_ptr (), sizeof (ClientPktHeader)); + m_Crypt.DecryptRecv ((uint8*) m_Header.rd_ptr (), sizeof (ClientPktHeader)); ClientPktHeader& header = *((ClientPktHeader*) m_Header.rd_ptr ()); @@ -1007,10 +1006,6 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) sWorld.AddSession (m_Session); - // Create and send the Addon packet - if (sAddOnHandler.BuildAddonPacket (&recvPacket, &SendAddonPacked)) - SendPacket (SendAddonPacked); - return 0; } diff --git a/src/shared/Database/DBCfmt.cpp b/src/shared/Database/DBCfmt.cpp index dc6fec3b7b3..b958742ffc7 100644 --- a/src/shared/Database/DBCfmt.cpp +++ b/src/shared/Database/DBCfmt.cpp @@ -97,4 +97,3 @@ const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiii const char WorldMapAreaEntryfmt[]="xinxffffix"; const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx"; const char WorldMapOverlayEntryfmt[]="nxixxxxxxxxxxxxxx"; - |