Skip to content

Commit

Permalink
[477] Another fix for Characters::HasTalent(). Generate tooltips for …
Browse files Browse the repository at this point in the history
…gems and enchants (character sheet page). Core patches for both servers were updated.
  • Loading branch information
Shadez committed Feb 13, 2011
1 parent 11997db commit 9e8eef5
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 51 deletions.
16 changes: 8 additions & 8 deletions includes/classes/class.characters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand Down
10 changes: 8 additions & 2 deletions includes/classes/class.items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion includes/revision_nr.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
define('ARMORY_REVISION', 476);
define('ARMORY_REVISION', 477);
define('DB_VERSION', 'armory_r471');
define('CONFIG_VERSION', '2001201101');
?>
2 changes: 1 addition & 1 deletion tools/mangos/Revision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11081+
11156+
14 changes: 7 additions & 7 deletions tools/mangos/wowarmory_arena_chart.patch
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
28 changes: 14 additions & 14 deletions tools/mangos/wowarmory_patch.patch
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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)
Expand All @@ -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();
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -97,31 +97,31 @@ 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 **/

// 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 **/
+ }
Expand Down
2 changes: 1 addition & 1 deletion tools/trinity_core/Revision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fd66517473b772c3b2d3adfbdabae47d2088c77d
30916fd9ffaf198f4311cdd6fc0e0c05ddfc2f80
10 changes: 5 additions & 5 deletions tools/trinity_core/wowarmory_arena_chart.patch
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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);
Expand Down
20 changes: 8 additions & 12 deletions tools/trinity_core/wowarmory_patch.patch
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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)
+{
Expand Down Expand Up @@ -106,10 +102,10 @@ index a4f5b42..a830628 100755
// currently visible objects at player client
typedef std::set<uint64> 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)
Expand Down

0 comments on commit 9e8eef5

Please sign in to comment.