From 9e8eef5d017bf59af320a85ec643294f199019af Mon Sep 17 00:00:00 2001 From: Shadez Date: Sun, 13 Feb 2011 22:43:48 +0800 Subject: [PATCH] [477] Another fix for Characters::HasTalent(). Generate tooltips for gems and enchants (character sheet page). Core patches for both servers were updated. --- includes/classes/class.characters.php | 16 +++++------ includes/classes/class.items.php | 10 +++++-- includes/revision_nr.php | 2 +- tools/mangos/Revision.txt | 2 +- tools/mangos/wowarmory_arena_chart.patch | 14 +++++----- tools/mangos/wowarmory_patch.patch | 28 +++++++++---------- tools/trinity_core/Revision.txt | 2 +- .../trinity_core/wowarmory_arena_chart.patch | 10 +++---- tools/trinity_core/wowarmory_patch.patch | 20 ++++++------- 9 files changed, 53 insertions(+), 51 deletions(-) diff --git a/includes/classes/class.characters.php b/includes/classes/class.characters.php index 451d458f0..79c0356bb 100644 --- a/includes/classes/class.characters.php +++ b/includes/classes/class.characters.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release 4.50 - * @revision 476 + * @revision 477 * @copyright (c) 2009-2011 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -1579,7 +1579,7 @@ public function GetMaxEnergy() { if($this->class == CLASS_DK) { // Check for 50147, 49455 spells (Runic power mastery) in current talent spec $tRank = $this->HasTalent(2020); - if($tRank == 0) { + if($tRank === 0) { // Runic power mastery (Rank 1) $maxPower = 115; } @@ -3066,12 +3066,12 @@ public function HasTalent($talent_id, $active_spec = true, $rank = -1) { } $sql_data = array( 'activeSpec' => array( - sprintf('SELECT `spell` FROM `character_talent` WHERE `spell` IN (%s) AND `guid`=%%d AND `spec`=%%d', $talent_spells['Rank_1'] . ', ' . $talent_spells['Rank_2'] . ', ' . $talent_spells['Rank_3'] . ', ' . $talent_spells['Rank_4'] . ', ' . $talent_spells['Rank_5']), - sprintf('SELECT 1 FROM `character_talent` WHERE `spell`=%d AND `guid`=%%d AND `spec`=%%d', $talent_spells['Rank_' . $rank + 1]) + sprintf('SELECT `spell` FROM `character_talent` WHERE `spell` IN (%s) AND `guid`=%%d AND `spec`=%%d LIMIT 1', $talent_spells['Rank_1'] . ', ' . $talent_spells['Rank_2'] . ', ' . $talent_spells['Rank_3'] . ', ' . $talent_spells['Rank_4'] . ', ' . $talent_spells['Rank_5']), + sprintf('SELECT 1 FROM `character_talent` WHERE `spell`=%d AND `guid`=%%d AND `spec`=%%d', $rank == -1 ? $talent_spells['Rank_1'] : $talent_spells['Rank_' . ($rank + 1)]) ), 'spec' => array( - sprintf('SELECT `spell` FROM `character_talent` WHERE `spell` IN (%s) AND `guid`=%%d', $talent_spells['Rank_1'] . ', ' . $talent_spells['Rank_2'] . ', ' . $talent_spells['Rank_3'] . ', ' . $talent_spells['Rank_4'] . ', ' . $talent_spells['Rank_5']), - sprintf('SELECT 1 FROM `character_talent` WHERE `spell`=%d AND `guid`=%%d', $talent_spells['Rank_' . $rank + 1]) + sprintf('SELECT `spell` FROM `character_talent` WHERE `spell` IN (%s) AND `guid`=%%d LIMIT 1', $talent_spells['Rank_1'] . ', ' . $talent_spells['Rank_2'] . ', ' . $talent_spells['Rank_3'] . ', ' . $talent_spells['Rank_4'] . ', ' . $talent_spells['Rank_5']), + sprintf('SELECT 1 FROM `character_talent` WHERE `spell`=%d AND `guid`=%%d', $rank == -1 ? $talent_spells['Rank_1'] : $talent_spells['Rank_' . ($rank + 1)]) ) ); break; @@ -3097,9 +3097,9 @@ public function HasTalent($talent_id, $active_spec = true, $rank = -1) { $has = $this->db->selectCell($sql_data['spec'][1], $this->guid); } } - if($this->GetServerType() == SERVER_TRINITY && $rank == -1 && $has) { + if($this->GetServerType() == SERVER_TRINITY && $rank == -1 && $has != false) { for($i = 0; $i < 5; $i++) { - if($talent_spells['Rank_' . $i + 1] == $has) { + if(isset($talent_spells['Rank_' . ($i + 1)]) && $talent_spells['Rank_' . ($i + 1)] == $has) { return $i; } } diff --git a/includes/classes/class.items.php b/includes/classes/class.items.php index 81aad5953..e3f7a4f01 100644 --- a/includes/classes/class.items.php +++ b/includes/classes/class.items.php @@ -3,7 +3,7 @@ /** * @package World of Warcraft Armory * @version Release 4.50 - * @revision 460 + * @revision 477 * @copyright (c) 2009-2011 Shadez * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -715,6 +715,9 @@ public function GetItemInfo($itemID, $type) { case 'durability': $info = Armory::$wDB->selectCell("SELECT `MaxDurability` FROM `item_template` WHERE `entry`=%d LIMIT 1", $itemID); break; + case 'class': + $info = Armory::$wDB->selectCell("SELECT `class` FROM `item_template` WHERE `entry`=%d LIMIT 1", $itemID); + break; default: $info = false; break; @@ -1685,7 +1688,7 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character } $proto = null; $isCharacter = $characters->CheckPlayer(); - if($isCharacter) { + if($isCharacter && in_array(self::GetItemInfo($itemID, 'class'), array(ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON))) { $item = $characters->GetItemByEntry($itemID); if($item) { $proto = $item->GetProto(); @@ -1696,6 +1699,9 @@ private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Character return false; } } + else { + $isCharacter = false; + } if(!$proto) { // Maybe we haven't any character? Let's find itemproto by entry. $proto = new ItemPrototype(); diff --git a/includes/revision_nr.php b/includes/revision_nr.php index dc8c00c0d..c89eb994c 100644 --- a/includes/revision_nr.php +++ b/includes/revision_nr.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/tools/mangos/Revision.txt b/tools/mangos/Revision.txt index 6daed684f..f1c437b9a 100644 --- a/tools/mangos/Revision.txt +++ b/tools/mangos/Revision.txt @@ -1 +1 @@ -11081+ \ No newline at end of file +11156+ \ No newline at end of file diff --git a/tools/mangos/wowarmory_arena_chart.patch b/tools/mangos/wowarmory_arena_chart.patch index 4d8567c30..98fa445d6 100644 --- a/tools/mangos/wowarmory_arena_chart.patch +++ b/tools/mangos/wowarmory_arena_chart.patch @@ -1,8 +1,8 @@ diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp -index 1b3cf08..1ee6327 100644 +index e0b57d7..2941500 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp -@@ -727,6 +727,47 @@ void BattleGround::EndBattleGround(Team winner) +@@ -717,6 +717,47 @@ void BattleGround::EndBattleGround(Team winner) DEBUG_LOG("--- Winner rating: %u, Loser rating: %u, Winner change: %i, Loser change: %i ---", winner_rating, loser_rating, winner_change, loser_change); SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); @@ -50,7 +50,7 @@ index 1b3cf08..1ee6327 100644 } else { -@@ -1384,6 +1425,14 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) +@@ -1374,6 +1415,14 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) case SCORE_HEALING_DONE: // Healing Done itr->second->HealingDone += value; break; @@ -66,7 +66,7 @@ index 1b3cf08..1ee6327 100644 sLog.outError("BattleGround: Unknown player score type %u", type); break; diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h -index 73c2093..8ea413e 100644 +index e90b919..cfd7329 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -191,7 +191,11 @@ enum ScoreType @@ -94,10 +94,10 @@ index 73c2093..8ea413e 100644 /* diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp -index 032e98e..bbe8a22 100644 +index 19daa47..785c450 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp -@@ -661,6 +661,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa +@@ -672,6 +672,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { // FIXME: kept by compatibility. don't know in BG if the restriction apply. bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage); @@ -108,7 +108,7 @@ index 032e98e..bbe8a22 100644 } } -@@ -6076,6 +6080,10 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro +@@ -6087,6 +6091,10 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro { ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); ((Player*)pVictim)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); diff --git a/tools/mangos/wowarmory_patch.patch b/tools/mangos/wowarmory_patch.patch index 34d17411f..bf333d970 100644 --- a/tools/mangos/wowarmory_patch.patch +++ b/tools/mangos/wowarmory_patch.patch @@ -1,8 +1,8 @@ diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp -index 1fba470..d1fd7bc 100644 +index 7b4cdfa..6149d50 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp -@@ -2076,6 +2076,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) +@@ -2066,6 +2066,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID)!=m_completedAchievements.end()) return; @@ -13,12 +13,12 @@ index 1fba470..d1fd7bc 100644 CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; ca.date = time(NULL); diff --git a/src/game/Item.cpp b/src/game/Item.cpp -index b62eda2..e68332d 100644 +index 77faf13..b07382e 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp -@@ -1033,6 +1033,15 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) +@@ -1032,6 +1032,15 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) Item *pItem = NewItemOrBag( pProto ); - if( pItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) ) + if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player) ) { + /** World of Warcraft Armory **/ + if (pProto->Quality > 2 && pProto->Flags != 2048 && (pProto->Class == ITEM_CLASS_WEAPON || pProto->Class == ITEM_CLASS_ARMOR) && player) @@ -33,10 +33,10 @@ index b62eda2..e68332d 100644 return pItem; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp -index 90e21b7..1fdc3b3 100644 +index 39c9432..8e73bcd 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp -@@ -16968,6 +16968,17 @@ void Player::SaveToDB() +@@ -17005,6 +17005,17 @@ void Player::SaveToDB() DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_STATS, "The value of player %s at save: ", m_name.c_str()); outDebugStatsValues(); @@ -54,7 +54,7 @@ index 90e21b7..1fdc3b3 100644 CharacterDatabase.BeginTransaction(); -@@ -22563,3 +22574,40 @@ void Player::SetRestType( RestType n_r_type, uint32 areaTriggerId /*= 0*/) +@@ -22600,3 +22611,40 @@ void Player::SetRestType( RestType n_r_type, uint32 areaTriggerId /*= 0*/) SetFFAPvP(false); } } @@ -97,13 +97,14 @@ index 90e21b7..1fdc3b3 100644 +/** World of Warcraft Armory **/ \ No newline at end of file diff --git a/src/game/Player.h b/src/game/Player.h -index bc4c0b5..793dd90 100644 +index 50136dd..14a5454 100644 --- a/src/game/Player.h +++ b/src/game/Player.h -@@ -2277,6 +2277,9 @@ class MANGOS_DLL_SPEC Player : public Unit +@@ -2277,6 +2277,10 @@ class MANGOS_DLL_SPEC Player : public Unit bool TeleportToHomebind(uint32 options = 0) { return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation(), options); } Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask); ++ + /** World of Warcraft Armory **/ + void WriteWowArmoryDatabaseLog(uint32 type, uint32 data); + /** World of Warcraft Armory **/ @@ -111,17 +112,16 @@ index bc4c0b5..793dd90 100644 // currently visible objects at player client ObjectGuidSet m_clientGUIDs; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp -index 032e98e..35ac1b2 100644 +index 19daa47..e382281 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp -@@ -865,7 +865,13 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa +@@ -876,7 +876,12 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (m->IsRaidOrHeroicDungeon()) { if(cVictim->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) + { -+ ((InstanceMap *)m)->PermBindAllPlayers(creditedPlayer); + /** World of Warcraft Armory **/ - ((InstanceMap *)m)->PermBindAllPlayers(creditedPlayer); + ((DungeonMap *)m)->PermBindAllPlayers(creditedPlayer); + creditedPlayer->WriteWowArmoryDatabaseLog(3, cVictim->GetCreatureInfo()->Entry); // Difficulty will be defined in Player::WriteWowArmoryDatabaseLog(); + /** World of Warcraft Armory **/ + } diff --git a/tools/trinity_core/Revision.txt b/tools/trinity_core/Revision.txt index d5ec00ab0..916004e9d 100644 --- a/tools/trinity_core/Revision.txt +++ b/tools/trinity_core/Revision.txt @@ -1 +1 @@ -fd66517473b772c3b2d3adfbdabae47d2088c77d \ No newline at end of file +30916fd9ffaf198f4311cdd6fc0e0c05ddfc2f80 \ No newline at end of file diff --git a/tools/trinity_core/wowarmory_arena_chart.patch b/tools/trinity_core/wowarmory_arena_chart.patch index 21640aa09..49e6e0912 100644 --- a/tools/trinity_core/wowarmory_arena_chart.patch +++ b/tools/trinity_core/wowarmory_arena_chart.patch @@ -1,5 +1,5 @@ diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp -index a372f08..abbc9f4 100755 +index 39f1291..cead3ae 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -772,6 +772,47 @@ void Battleground::EndBattleground(uint32 winner) @@ -50,7 +50,7 @@ index a372f08..abbc9f4 100755 sLog->outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); itr++) -@@ -1386,6 +1427,14 @@ void Battleground::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, +@@ -1387,6 +1428,14 @@ void Battleground::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, case SCORE_HEALING_DONE: // Healing Done itr->second->HealingDone += value; break; @@ -66,7 +66,7 @@ index a372f08..abbc9f4 100755 sLog->outError("Battleground: Unknown player score type %u", type); break; diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h -index 2e2a452..67000cb 100755 +index a1337c2..dcad57d 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -209,6 +209,10 @@ enum ScoreType @@ -92,7 +92,7 @@ index 2e2a452..67000cb 100755 enum BGHonorMode diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp -index b1fab1b..6c8041f 100755 +index 6709044..5163a8b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -647,9 +647,16 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa @@ -113,7 +113,7 @@ index b1fab1b..6c8041f 100755 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, pVictim); killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); } -@@ -9727,6 +9734,10 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth) +@@ -9754,6 +9761,10 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth) { pVictim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); pVictim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); diff --git a/tools/trinity_core/wowarmory_patch.patch b/tools/trinity_core/wowarmory_patch.patch index 01b8030e5..7ea5e871d 100644 --- a/tools/trinity_core/wowarmory_patch.patch +++ b/tools/trinity_core/wowarmory_patch.patch @@ -1,8 +1,8 @@ diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp -index 327b436..00f749e 100755 +index 228af58..3d79c69 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp -@@ -1972,6 +1972,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement, b +@@ -1968,6 +1968,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement, b return; SendAchievementEarned(achievement); @@ -33,10 +33,10 @@ index f1366a4..eb8b56a 100755 return pItem; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp -index c95e363..eb63ffe 100755 +index 4072d85..d753123 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp -@@ -18002,6 +18002,17 @@ void Player::SaveToDB() +@@ -17959,6 +17959,17 @@ void Player::SaveToDB() std::string sql_name = m_name; CharacterDatabase.escape_string(sql_name); @@ -54,14 +54,10 @@ index c95e363..eb63ffe 100755 std::ostringstream ss; ss << "REPLACE INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags," -@@ -24545,4 +24556,34 @@ void Player::SendClearFocus(Unit* target) - WorldPacket data(SMSG_BREAK_TARGET, target->GetPackGUID().size()); +@@ -24510,3 +24521,32 @@ void Player::SendClearFocus(Unit* target) data.append(target->GetPackGUID()); GetSession()->SendPacket(&data); --} -\ No newline at end of file -+} -+ + } +/** World of Warcraft Armory **/ +void Player::WriteWowArmoryDatabaseLog(uint32 type, uint32 data) +{ @@ -106,10 +102,10 @@ index a4f5b42..a830628 100755 // currently visible objects at player client typedef std::set ClientGUIDs; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp -index b1fab1b..e24fd7a 100755 +index 6709044..554b63b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp -@@ -15054,7 +15054,12 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) +@@ -15096,7 +15096,12 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) if (m->IsRaidOrHeroicDungeon()) { if (creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)