add patch help me

Hi all
Add patch that I do, but this error
C:TrinityCore-master>git apply Armory.patch
warning: src/server/game/Achievements/AchievementMgr.cpp has type 100644, expect
ed 100755
warning: src/server/game/Battlegrounds/Battleground.cpp has type 100644, expecte
d 100755
error: patch failed: src/server/game/Battlegrounds/Battleground.cpp:746
error: src/server/game/Battlegrounds/Battleground.cpp: patch does not apply
warning: src/server/game/Battlegrounds/Battleground.h has type 100644, expected
100755
error: patch failed: src/server/game/Battlegrounds/Battleground.h:210
error: src/server/game/Battlegrounds/Battleground.h: patch does not apply
warning: src/server/game/Entities/Item/Item.cpp has type 100644, expected 100755

error: patch failed: src/server/game/Entities/Item/Item.cpp:276
error: src/server/game/Entities/Item/Item.cpp: patch does not apply
warning: src/server/game/Entities/Player/Player.cpp has type 100644, expected 10
0755
error: patch failed: src/server/game/Entities/Player/Player.cpp:16801
error: src/server/game/Entities/Player/Player.cpp: patch does not apply
warning: src/server/game/Entities/Player/Player.h has type 100644, expected 1007
55
warning: src/server/game/Entities/Unit/Unit.cpp has type 100644, expected 100755

error: patch failed: src/server/game/Entities/Unit/Unit.cpp:10103
error: src/server/game/Entities/Unit/Unit.cpp: patch does not apply
warning: src/server/game/World/World.cpp has type 100644, expected 100755
error: patch failed: src/server/game/World/World.cpp:1193
error: src/server/game/World/World.cpp: patch does not apply
warning: src/server/game/World/World.h has type 100644, expected 100755

This Patch

From e1e162eafe122eda49b31b93e91596550ec139db Mon Sep 17 00:00:00 2001
From: unknown <Poison@NTI-dator.(none)>
Date: Mon, 9 Apr 2012 20:53:04 +0200
Subject: [PATCH] Armory Patch

---
 src/server/game/Achievements/AchievementMgr.cpp |    6 ++
 src/server/game/Battlegrounds/Battleground.cpp  |   52 +++++++++++++++
 src/server/game/Battlegrounds/Battleground.h    |    8 +++
 src/server/game/Entities/Item/Item.cpp          |   11 +++
 src/server/game/Entities/Player/Player.cpp      |   76 +++++++++++++++++++++++
 src/server/game/Entities/Player/Player.h        |   21 ++++++
 src/server/game/Entities/Unit/Unit.cpp          |   20 ++++++
 src/server/game/World/World.cpp                 |    4 +
 src/server/game/World/World.h                   |    1 +
 src/server/worldserver/worldserver.conf.dist    |    7 ++
 10 files changed, 206 insertions(+), 0 deletions(-)

diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 2a9f421..9837cf3 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -2039,6 +2039,12 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
         return;
 
     SendAchievementEarned(achievement);
+
+	/** World of Warcraft Armory **/
+    if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+        GetPlayer()->CreateWowarmoryFeed(1, achievement->ID, 0, 0);
+    /** World of Warcraft Armory **/
+
     CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
     ca.date = time(NULL);
     ca.changed = true;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index f3c393e..6b1d680 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -746,6 +746,50 @@ void Battleground::EndBattleground(uint32 winner)
                 SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
                 SetArenaTeamRatingChangeForTeam(winner, winner_change);
                 SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
+				                /** World of Warcraft Armory **/
+                if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+                {
+                    uint32 maxChartID;
+                    QueryResult result = CharacterDatabase.PQuery("SELECT MAX(gameid) FROM armory_game_chart");
+                    if(!result)
+                        maxChartID = 0;
+                    else
+                    {
+                        maxChartID = (*result)[0].GetUInt32();
+                        //result.release();
+                    }
+                    uint32 gameID = maxChartID+1;
+                    for(BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr)
+                    {
+                        Player* player = ObjectAccessor::FindPlayer(itr->first);
+                        if (!player)
+                            continue;
+                        uint32 plTeamID = player->GetArenaTeamId(winner_arena_team->GetSlot());
+                        int changeType;
+                        uint32 resultRating;
+                        uint32 resultTeamID;
+                        int32 ratingChange;
+                        if (plTeamID == winner_arena_team->GetId())
+                        {
+                            changeType = 1; //win
+                            resultRating = winner_team_rating;
+                            resultTeamID = plTeamID;
+                            ratingChange = winner_change;
+                        }
+                        else
+                        {
+                            changeType = 2; //lose
+                            resultRating = loser_team_rating;
+                            resultTeamID = loser_arena_team->GetId();
+                            ratingChange = loser_change;
+                        }
+                        std::ostringstream sql_query;
+                        //                                                        gameid,              teamid,                     guid,                    changeType,             ratingChange,               teamRating,                  damageDone,                          deaths,                          healingDone,                           damageTaken,,                           healingTaken,                         killingBlows,                      mapId,                 start,                   end
+                        sql_query << "INSERT INTO armory_game_chart VALUES ('" << gameID << "', '" << resultTeamID << "', '" << player->GetGUID() << "', '" << changeType << "', '" << ratingChange  << "', '" << resultRating << "', '" << itr->second->DamageDone << "', '" << itr->second->Deaths << "', '" << itr->second->HealingDone << "', '" << itr->second->DamageTaken << "', '" << itr->second->HealingTaken << "', '" << itr->second->KillingBlows << "', '" << m_MapId << "', '" << m_StartTime << "', '" << m_EndTime << "')";
+                        CharacterDatabase.Execute(sql_query.str().c_str());
+                    }
+                }
+                /** World of Warcraft Armory **/
                 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)
@@ -1361,6 +1405,14 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value,
         case SCORE_HEALING_DONE:                            // Healing Done
             itr->second->HealingDone += value;
             break;
+			        /** World of Warcraft Armory **/
+        case SCORE_DAMAGE_TAKEN:
+            itr->second->DamageTaken += value;              // Damage Taken
+            break;
+        case SCORE_HEALING_TAKEN:
+            itr->second->HealingTaken += value;             // Healing Taken
+            break;
+        /** World of Warcraft Armory **/
         default:
             sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
                 type, m_MapId, m_InstanceID);
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 32f6ebc..107617e 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -210,6 +210,10 @@ enum ScoreType
     //SOTA
     SCORE_DESTROYED_DEMOLISHER  = 18,
     SCORE_DESTROYED_WALL        = 19,
+	    /** World of Warcraft Armory **/
+    SCORE_DAMAGE_TAKEN          = 20,
+    SCORE_HEALING_TAKEN         = 21
+    /** World of Warcraft Armory **/
 };
 
 enum ArenaType
@@ -292,6 +296,10 @@ class BattlegroundScore
         uint32 BonusHonor;
         uint32 DamageDone;
         uint32 HealingDone;
+		/** World of Warcraft Armory **/
+        uint32 DamageTaken;
+        uint32 HealingTaken;
+        /** World of Warcraft Armory **/
 };
 
 enum BGHonorMode
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index f2b8938..8d3f66f 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -276,6 +276,17 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
 
     SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration));
     SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
+	/** World of Warcraft Armory **/
+    if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+    {
+        if (itemProto->Quality > 2 && itemProto->Flags != 2048 && (itemProto->Class == ITEM_CLASS_WEAPON || itemProto->Class == ITEM_CLASS_ARMOR))
+        {
+            if (!GetOwner())
+                return true;
+            GetOwner()->CreateWowarmoryFeed(2, itemid, guidlow, itemProto->Quality);
+        }
+    }
+    /** World of Warcraft Armory **/
     return true;
 }
 
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1fa88ce..78b6e63 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -5064,6 +5064,12 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
             stmt->setUInt32(0, guid);
             trans->Append(stmt);
 
+			/* World of Warcraft Armory */
+            trans->PAppend("DELETE FROM armory_character_stats WHERE guid = '%u'",guid);
+            trans->PAppend("DELETE FROM character_feed_log WHERE guid = '%u'",guid);
+            /* World of Warcraft Armory */
+
+
             CharacterDatabase.CommitTransaction(trans);
             break;
         }
@@ -16801,6 +16807,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
 
         return false;
     }
+	// Cleanup old Wowarmory feeds
+    InitWowarmoryFeeds();
 
     // overwrite possible wrong/corrupted guid
     SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
@@ -18918,6 +18926,33 @@ void Player::SaveToDB(bool create /*=false*/)
 
     CharacterDatabase.CommitTransaction(trans);
 
+	    /* World of Warcraft Armory */
+    // Place this code AFTER CharacterDatabase.CommitTransaction(); to avoid some character saving errors.
+    // Wowarmory feeds
+    if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+    {
+        std::ostringstream sWowarmory;
+        for (WowarmoryFeeds::iterator iter = m_wowarmory_feeds.begin(); iter < m_wowarmory_feeds.end(); ++iter) {
+            sWowarmory << "INSERT IGNORE INTO character_feed_log (guid,type,data,date,counter,difficulty,item_guid,item_quality) VALUES ";
+            //                      guid                    type                        data                    date                            counter                   difficulty                        item_guid                      item_quality
+            sWowarmory << "(" << (*iter).guid << ", " << (*iter).type << ", " << (*iter).data << ", " << uint64((*iter).date) << ", " << (*iter).counter << ", " << uint32((*iter).difficulty) << ", " << (*iter).item_guid << ", " << (*iter).item_quality <<  ");";
+            CharacterDatabase.PExecute(sWowarmory.str().c_str());
+            sWowarmory.str("");
+        }
+        // Clear old saved feeds from storage - they are not required for server core.
+        InitWowarmoryFeeds();
+        // Character stats
+        std::ostringstream ps;
+        time_t t = time(NULL);
+        CharacterDatabase.PExecute("DELETE FROM armory_character_stats WHERE guid = %u", GetGUIDLow());
+        ps << "INSERT INTO armory_character_stats (guid, data, save_date) VALUES (" << GetGUIDLow() << ", '";
+        for (uint16 i = 0; i < m_valuesCount; ++i)
+            ps << GetUInt32Value(i) << " ";
+        ps << "', " << uint64(t) << ");";
+        CharacterDatabase.PExecute(ps.str().c_str());
+    }
+    /* World of Warcraft Armory */
+
     // save pet (hunter pet level and experience and all type pets health/mana).
     if (Pet* pet = GetPet())
         pet->SavePetToDB(PET_SAVE_AS_CURRENT);
@@ -25515,6 +25550,47 @@ void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans)
     }
 }
 
+/** World of Warcraft Armory **/
+void Player::InitWowarmoryFeeds() {
+    // Clear feeds
+    m_wowarmory_feeds.clear();
+}
+
+void Player::CreateWowarmoryFeed(uint32 type, uint32 data, uint32 item_guid, uint32 item_quality) {
+    /*
+        1 - TYPE_ACHIEVEMENT_FEED
+        2 - TYPE_ITEM_FEED
+        3 - TYPE_BOSS_FEED
+    */
+    if (GetGUIDLow() == 0)
+    {
+        sLog->outError("[Wowarmory]: player is not initialized, unable to create log entry!");
+        return;
+    }
+    if (type <= 0 || type > 3)
+    {
+        sLog->outError("[Wowarmory]: unknown feed type: %d, ignore.", type);
+        return;
+    }
+    if (data == 0)
+    {
+        sLog->outError("[Wowarmory]: empty data (GUID: %u), ignore.", GetGUIDLow());
+        return;
+    }
+    WowarmoryFeedEntry feed;
+    feed.guid = GetGUIDLow();
+    feed.type = type;
+    feed.data = data;
+    feed.difficulty = type == 3 ? GetMap()->GetDifficulty() : 0;
+    feed.item_guid  = item_guid;
+    feed.item_quality = item_quality;
+    feed.counter = 0;
+    feed.date = time(NULL);
+    sLog->outDebug(LOG_FILTER_UNITS, "[Wowarmory]: create wowarmory feed (GUID: %u, type: %d, data: %u).", feed.guid, feed.type, feed.data);
+    m_wowarmory_feeds.push_back(feed);
+}
+/** World of Warcraft Armory **/
+
 bool Player::IsInWhisperWhiteList(uint64 guid)
 {
     for (WhisperListContainer::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 1b80b68..7be0d58 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1057,6 +1057,21 @@ private:
     bool _isPvP;
 };
 
+/* World of Warcraft Armory */
+struct WowarmoryFeedEntry {
+    uint32 guid;         // Player GUID
+    time_t date;         // Log date
+    uint32 type;         // TYPE_ACHIEVEMENT_FEED, TYPE_ITEM_FEED, TYPE_BOSS_FEED
+    uint32 data;         // TYPE_ITEM_FEED: item_entry, TYPE_BOSS_FEED: creature_entry
+    uint32 item_guid;    // Can be 0
+    uint32 item_quality; // Can be 0
+    uint8  difficulty;   // Can be 0
+    int    counter;      // Can be 0
+};
+
+typedef std::vector<WowarmoryFeedEntry> WowarmoryFeeds;
+/* World of Warcraft Armory */
+
 class Player : public Unit, public GridObject<Player>
 {
     friend class WorldSession;
@@ -2357,6 +2372,10 @@ class Player : public Unit, public GridObject<Player>
         void SendCinematicStart(uint32 CinematicSequenceId);
         void SendMovieStart(uint32 MovieId);
 
+	    /* World of Warcraft Armory */
+        void CreateWowarmoryFeed(uint32 type, uint32 data, uint32 item_guid, uint32 item_quality);
+        void InitWowarmoryFeeds();
+        /* World of Warcraft Armory */
         /*********************************************************/
         /***                 INSTANCE SYSTEM                   ***/
         /*********************************************************/
@@ -2856,6 +2875,8 @@ class Player : public Unit, public GridObject<Player>
         uint32 m_timeSyncTimer;
         uint32 m_timeSyncClient;
         uint32 m_timeSyncServer;
+		// World of Warcraft Armory Feeds
+        WowarmoryFeeds m_wowarmory_feeds;
 
         InstanceTimeMap _instanceResetTimes;
         uint32 _pendingBindId;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 5226919..5ac1770 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -699,8 +699,17 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
 
         // in bg, count dmg if victim is also a player
         if (victim->GetTypeId() == TYPEID_PLAYER)
+		{
             if (Battleground* bg = killer->GetBattleground())
+			{
                 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
+		/** World of Warcraft Armory **/
+                if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+                    if (Battleground *bgV = ((Player*)victim)->GetBattleground())
+                        bgV->UpdatePlayerScore(((Player*)victim), SCORE_DAMAGE_TAKEN, damage);
+                /** World of Warcraft Armory **/
+            }
+        }
 
         killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim);
         killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
@@ -10103,6 +10112,11 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
     {
         player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
         player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);
+		/** World of Warcraft Armory **/
+        if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+            if (Battleground *bgV = victim->ToPlayer()->GetBattleground())
+                bgV->UpdatePlayerScore((Player*)victim, SCORE_HEALING_TAKEN, gain);
+        /** World of Warcraft Armory **/
     }
 
     return gain;
@@ -15646,7 +15660,13 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
                 if (instanceMap->IsRaidOrHeroicDungeon())
                 {
                     if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
+					{
                         ((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
+					/** World of Warcraft Armory **/
+                        if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
+                            creditedPlayer->CreateWowarmoryFeed(3, creature->GetCreatureTemplate()->Entry, 0, 0);
+                        /** World of Warcraft Armory **/
+                    }
                 }
                 else
                 {
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 6e32d33..a3ed8e9 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1193,6 +1193,10 @@ void World::LoadConfigSettings(bool reload)
     m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = ConfigMgr::GetIntDefault("AutoBroadcast.Center", 0);
     m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = ConfigMgr::GetIntDefault("AutoBroadcast.Timer", 60000);
 
+	/** World of Warcraft Armory **/
+    m_bool_configs[CONFIG_ARMORY_ENABLE] = ConfigMgr::GetBoolDefault("Armory.Enable", true);
+    /** World of Warcraft Armory **/
+
     // MySQL ping time interval
     m_int_configs[CONFIG_DB_PING_INTERVAL] = ConfigMgr::GetIntDefault("MaxPingTime", 30);
 
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 95e9fbd..5896839 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -159,6 +159,7 @@ enum WorldBoolConfigs
     CONFIG_ALLOW_TICKETS,
     CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
     CONFIG_PRESERVE_CUSTOM_CHANNELS,
+	CONFIG_ARMORY_ENABLE,
     CONFIG_PDUMP_NO_PATHS,
     CONFIG_PDUMP_NO_OVERWRITE,
     CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 5d83710..d858118 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -2878,5 +2878,12 @@ PlayerDump.DisallowPaths = 1
 
 PlayerDump.DisallowOverwrite = 1
 
+#    Armory.Enable
+#        Description: Activates the WowArmory.
+#        Default:     0 - (Disable)
+#                     1 - (Enable)
+
+Armory.Enable = 1
+
 #
 ###################################################################################################
-- 
1.7.8.msysgit.0

up

Add manually

When I do not have time to manually Add the folder Release worldserver.exe not
Anyone can edit the patch to the current version does trinitycore
Or a patch, wow armory, which is the current version introduced me to trinitycore

Try this command line combination: git apply --reject --whitespace=fix Your_File.diff or look here.

Won’t help. I added manually, and build threw out errors. I knew it would, but for shits, giggles, and maybe an error log with some shedding of light, I did it anyway.

The core code has changed drastically since this patch was last worked on. I’m no C++ expert, but there are several instances of things like “pName” in the patch, yet the code uses simply “name”. Many other similar modifications, and some more drastic too. The build will just fail on you unless this patch’s code is updated to whatever Trinity Core’s current structure is.

In the patch, (I guess this is how these things work) the new code lines are sandwiched between existing code, for reference I assume. Compare that reference code to what’s in the CURRENT code, and you’ll quickly see there have been some major changes. Hell even the line numbers referenced in the patch are way off. The wowarmory project hasn’t been touched in like a year I think…

However it would be AWESOME if some C++ wiz could maybe (if possible?) update this patch’s code to be useable in the current build…a full-blown armory to go with your private server, just collecting dust, seems like such a waste…

Try

[CODE]
From e6349cc18c7dfdb048259fcd1f8b959ee9385921 Mon Sep 17 00:00:00 2001
From: LordPsyan [email protected]
Date: Sat, 1 Sep 2012 23:44:22 -0500
Subject: [PATCH] 2012_09_01-WoW-Armory


WoWArmoryReadme | 11 +++
src/server/game/Achievements/AchievementMgr.cpp | 6 ++
src/server/game/Battlegrounds/Battleground.cpp | 8 +++
src/server/game/Battlegrounds/Battleground.h | 8 +++
src/server/game/Entities/Item/Item.cpp | 11 +++
src/server/game/Entities/Player/Player.cpp | 76 +++++++++++++++++++++++
src/server/game/Entities/Player/Player.h | 21 ++++++
src/server/game/Entities/Unit/Unit.cpp | 20 ++++++
src/server/game/World/World.cpp | 4 +
src/server/game/World/World.h | 1 +
src/server/worldserver/worldserver.conf.dist | 7 ++
11 files changed, 173 insertions(+), 0 deletions(-)
create mode 100644 WoWArmoryReadme

diff --git a/WoWArmoryReadme b/WoWArmoryReadme
new file mode 100644
index 0000000…3640467
— /dev/null
+++ b/WoWArmoryReadme
@@ -0,0 +1,11 @@
+Thanks to Darki73 from trinitycore.org
+
+This patch allows for web armory scripts to work with trinitycore. I have not looked at the script, so not sure
+exactly what it does. There are 2 known scripts that work with this patch:
+
+1. Shadez Armory (3D Viewer Included) - https://github.com/Shadez/wowarmory/
+2. Seejayz Armory (Never used this, but patch works with this armory) - https://github.com/S...fwarcraftArmory
+
±- LordPsyan
+
+Yes, I am back! Prepare to be amazed… at how many things I can break in 1 day!
No newline at end of file
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 5064954…3a899e5 100755
— a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -2039,6 +2039,12 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;

 SendAchievementEarned(achievement);
  •   /** World of Warcraft Armory **/
    
  • if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
  •    GetPlayer()->CreateWowarmoryFeed(1, achievement->ID, 0, 0);
    
  • /** World of Warcraft Armory **/
  • CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
    ca.date = time(NULL);
    ca.changed = true;
    diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
    index eb5f345…38b2ccd 100755
    — a/src/server/game/Battlegrounds/Battleground.cpp
    +++ b/src/server/game/Battlegrounds/Battleground.cpp
    @@ -1391,6 +1391,14 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value,
    case SCORE_HEALING_DONE: // Healing Done
    itr->second->HealingDone += value;
    break;
  •                           /** World of Warcraft Armory **/
    
  •    case SCORE_DAMAGE_TAKEN:
    
  •        itr->second->DamageTaken += value;              // Damage Taken
    
  •        break;
    
  •    case SCORE_HEALING_TAKEN:
    
  •        itr->second->HealingTaken += value;             // Healing Taken
    
  •        break;
    
  •    /** World of Warcraft Armory **/
       default:
           sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
               type, m_MapId, m_InstanceID);
    

diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 01dfbb2…c7bb160 100755
— a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -210,6 +210,10 @@ enum ScoreType
//SOTA
SCORE_DESTROYED_DEMOLISHER = 18,
SCORE_DESTROYED_WALL = 19,

  •       /** World of Warcraft Armory **/
    
  • SCORE_DAMAGE_TAKEN = 20,
  • SCORE_HEALING_TAKEN = 21
  • /** World of Warcraft Armory **/
    };

enum ArenaType
@@ -292,6 +296,10 @@ class BattlegroundScore
uint32 BonusHonor;
uint32 DamageDone;
uint32 HealingDone;

  •           /** World of Warcraft Armory **/
    
  •    uint32 DamageTaken;
    
  •    uint32 HealingTaken;
    
  •    /** World of Warcraft Armory **/
    

};

enum BGHonorMode
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 58cc1d0…3ec304e 100755
— a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -276,6 +276,17 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)

 SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
 SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, 0);
  •   /** World of Warcraft Armory **/
    
  • if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
  • {
  •    if (itemProto->Quality > 2 && itemProto->Flags != 2048 && (itemProto->Class == ITEM_CLASS_WEAPON || itemProto->Class == ITEM_CLASS_ARMOR))
    
  •    {
    
  •        if (!GetOwner())
    
  •            return true;
    
  •        GetOwner()->CreateWowarmoryFeed(2, itemid, guidlow, itemProto->Quality);
    
  •    }
    
  • }
  • /** World of Warcraft Armory **/
    return true;
    }

diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 65f6588…38f0cd3 100755
— a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4955,6 +4955,12 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
stmt->setUInt32(0, guid);
trans->Append(stmt);

  •                   /* World of Warcraft Armory */
    
  •        trans->PAppend("DELETE FROM armory_character_stats WHERE guid = '%u'",guid);
    
  •        trans->PAppend("DELETE FROM character_feed_log WHERE guid = '%u'",guid);
    
  •        /* World of Warcraft Armory */
    
  •        CharacterDatabase.CommitTransaction(trans);
           break;
       }
    

@@ -16721,6 +16727,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)

     return false;
 }
  •   // Cleanup old Wowarmory feeds
    
  • InitWowarmoryFeeds();

    // overwrite possible wrong/corrupted guid
    SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
    @@ -18860,6 +18868,33 @@ void Player::SaveToDB(bool create /=false/)

    CharacterDatabase.CommitTransaction(trans);

  •       /* World of Warcraft Armory */
    
  • // Place this code AFTER CharacterDatabase.CommitTransaction(); to avoid some character saving errors.

  • // Wowarmory feeds

  • if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))

  • {

  •    std::ostringstream sWowarmory;
    
  •    for (WowarmoryFeeds::iterator iter = m_wowarmory_feeds.begin(); iter < m_wowarmory_feeds.end(); ++iter) {
    
  •        sWowarmory << "INSERT IGNORE INTO character_feed_log (guid,type,data,date,counter,difficulty,item_guid,item_quality) VALUES ";
    
  •        //                      guid                    type                        data                    date                            counter                   difficulty                        item_guid                      item_quality
    
  •        sWowarmory << "(" << (*iter).guid << ", " << (*iter).type << ", " << (*iter).data << ", " << uint64((*iter).date) << ", " << (*iter).counter << ", " << uint32((*iter).difficulty) << ", " << (*iter).item_guid << ", " << (*iter).item_quality <<  ");";
    
  •        CharacterDatabase.PExecute(sWowarmory.str().c_str());
    
  •        sWowarmory.str("");
    
  •    }
    
  •    // Clear old saved feeds from storage - they are not required for server core.
    
  •    InitWowarmoryFeeds();
    
  •    // Character stats
    
  •    std::ostringstream ps;
    
  •    time_t t = time(NULL);
    
  •    CharacterDatabase.PExecute("DELETE FROM armory_character_stats WHERE guid = %u", GetGUIDLow());
    
  •    ps << "INSERT INTO armory_character_stats (guid, data, save_date) VALUES (" << GetGUIDLow() << ", '";
    
  •    for (uint16 i = 0; i < m_valuesCount; ++i)
    
  •        ps << GetUInt32Value(i) << " ";
    
  •    ps << "', " << uint64(t) << ");";
    
  •    CharacterDatabase.PExecute(ps.str().c_str());
    
  • }

  • /* World of Warcraft Armory */

  • // save pet (hunter pet level and experience and all type pets health/mana).
    if (Pet* pet = GetPet())
    pet->SavePetToDB(PET_SAVE_AS_CURRENT);
    @@ -25491,6 +25526,47 @@ void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans)
    }
    }

+/** World of Warcraft Armory **/
+void Player::InitWowarmoryFeeds() {

  • // Clear feeds
  • m_wowarmory_feeds.clear();
    +}

+void Player::CreateWowarmoryFeed(uint32 type, uint32 data, uint32 item_guid, uint32 item_quality) {

  • /*
  •    1 - TYPE_ACHIEVEMENT_FEED
    
  •    2 - TYPE_ITEM_FEED
    
  •    3 - TYPE_BOSS_FEED
    
  • */
  • if (GetGUIDLow() == 0)
  • {
  •    sLog->outError(LOG_FILTER_SQL, "[Wowarmory]: player is not initialized, unable to create log entry!");
    
  •    return;
    
  • }
  • if (type <= 0 || type > 3)
  • {
  •    sLog->outError(LOG_FILTER_SQL, "[Wowarmory]: unknown feed type: %d, ignore.", type);
    
  •    return;
    
  • }
  • if (data == 0)
  • {
  •    sLog->outError(LOG_FILTER_SQL, "[Wowarmory]: empty data (GUID: %u), ignore.", GetGUIDLow());
    
  •    return;
    
  • }
  • WowarmoryFeedEntry feed;
  • feed.guid = GetGUIDLow();
  • feed.type = type;
  • feed.data = data;
  • feed.difficulty = type == 3 ? GetMap()->GetDifficulty() : 0;
  • feed.item_guid = item_guid;
  • feed.item_quality = item_quality;
  • feed.counter = 0;
  • feed.date = time(NULL);
  • sLog->outDebug(LOG_FILTER_UNITS, “[Wowarmory]: create wowarmory feed (GUID: %u, type: %d, data: %u).”, feed.guid, feed.type, feed.data);
  • m_wowarmory_feeds.push_back(feed);
    +}
    +/** World of Warcraft Armory **/

bool Player::IsInWhisperWhiteList(uint64 guid)
{
for (WhisperListContainer::const_iterator itr = WhisperList.begin(); itr != WhisperList.end(); ++itr)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 71915f4…f1fec97 100755
— a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1068,6 +1068,21 @@ private:
bool _isPvP;
};

+/* World of Warcraft Armory */
+struct WowarmoryFeedEntry {

  • uint32 guid; // Player GUID
  • time_t date; // Log date
  • uint32 type; // TYPE_ACHIEVEMENT_FEED, TYPE_ITEM_FEED, TYPE_BOSS_FEED
  • uint32 data; // TYPE_ITEM_FEED: item_entry, TYPE_BOSS_FEED: creature_entry
  • uint32 item_guid; // Can be 0
  • uint32 item_quality; // Can be 0
  • uint8 difficulty; // Can be 0
  • int counter; // Can be 0
    +};

+typedef std::vector WowarmoryFeeds;
+/* World of Warcraft Armory */
+
class Player : public Unit, public GridObject
{
friend class WorldSession;
@@ -2371,6 +2386,10 @@ class Player : public Unit, public GridObject
void SendCinematicStart(uint32 CinematicSequenceId);
void SendMovieStart(uint32 MovieId);

  •       /* World of Warcraft Armory */
    
  •    void CreateWowarmoryFeed(uint32 type, uint32 data, uint32 item_guid, uint32 item_quality);
    
  •    void InitWowarmoryFeeds();
    
  •    /* World of Warcraft Armory */
       /*********************************************************/
       /***                 INSTANCE SYSTEM                   ***/
       /*********************************************************/
    

@@ -2865,6 +2884,8 @@ class Player : public Unit, public GridObject
uint32 m_timeSyncTimer;
uint32 m_timeSyncClient;
uint32 m_timeSyncServer;

  •           // World of Warcraft Armory Feeds
    
  •    WowarmoryFeeds m_wowarmory_feeds;
    
       InstanceTimeMap _instanceResetTimes;
       uint32 _pendingBindId;
    

diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 5118b58…2c35b49 100755
— a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -672,8 +672,17 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam

     // in bg, count dmg if victim is also a player
     if (victim->GetTypeId() == TYPEID_PLAYER)
  •           {
           if (Battleground* bg = killer->GetBattleground())
    
  •                   {
               bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
    
  •           /** World of Warcraft Armory **/
    
  •            if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
    
  •                if (Battleground *bgV = ((Player*)victim)->GetBattleground())
    
  •                    bgV->UpdatePlayerScore(((Player*)victim), SCORE_DAMAGE_TAKEN, damage);
    
  •            /** World of Warcraft Armory **/
    
  •        }
    
  •    }
    
       killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim);
       killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage);
    

@@ -10057,6 +10066,11 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
{
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);

  •           /** World of Warcraft Armory **/
    
  •    if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
    
  •        if (Battleground *bgV = victim->ToPlayer()->GetBattleground())
    
  •            bgV->UpdatePlayerScore((Player*)victim, SCORE_HEALING_TAKEN, gain);
    
  •    /** World of Warcraft Armory **/
    

    }

    return gain;
    @@ -15665,7 +15679,13 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
    if (instanceMap->IsRaidOrHeroicDungeon())
    {
    if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)

  •                                   {
                       ((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
    
  •                                   /** World of Warcraft Armory **/
    
  •                    if (sWorld->getBoolConfig(CONFIG_ARMORY_ENABLE))
    
  •                        creditedPlayer->CreateWowarmoryFeed(3, creature->GetCreatureTemplate()->Entry, 0, 0);
    
  •                    /** World of Warcraft Armory **/
    
  •                }
               }
               else
               {
    

diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index ea74b6d…b98bc5e 100755
— a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1194,6 +1194,10 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = ConfigMgr::GetIntDefault(“AutoBroadcast.Center”, 0);
m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = ConfigMgr::GetIntDefault(“AutoBroadcast.Timer”, 60000);

  •   /** World of Warcraft Armory **/
    
  • m_bool_configs[CONFIG_ARMORY_ENABLE] = ConfigMgr::GetBoolDefault(“Armory.Enable”, true);
  • /** World of Warcraft Armory **/
  • // MySQL ping time interval
    m_int_configs[CONFIG_DB_PING_INTERVAL] = ConfigMgr::GetIntDefault(“MaxPingTime”, 30);

diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index a6cdd47…91c2971 100755
— a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -159,6 +159,7 @@ enum WorldBoolConfigs
CONFIG_ALLOW_TICKETS,
CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
CONFIG_PRESERVE_CUSTOM_CHANNELS,

  •   CONFIG_ARMORY_ENABLE,
    
    CONFIG_PDUMP_NO_PATHS,
    CONFIG_PDUMP_NO_OVERWRITE,
    CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
    diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
    index 9eab3c4…9d1f1dc 100644
    — a/src/server/worldserver/worldserver.conf.dist
    +++ b/src/server/worldserver/worldserver.conf.dist
    @@ -2640,6 +2640,13 @@ PlayerDump.DisallowPaths = 1

PlayerDump.DisallowOverwrite = 1

+# Armory.Enable
+# Description: Activates the WowArmory.
+# Default: 0 - (Disable)
+# 1 - (Enable)
+
+Armory.Enable = 1
+

###################################################################################################


1.7.2.5[/CODE]

Holy crap this looks like it could work…I’ll report back soon /emoticons/default_smile.png

Dunno if it makes a difference, but in your post,

@@ -292,6 +296,10 @@ class BattlegroundScore
maybe should say

@@ -292,6 +296,10 @@ struct BattlegroundScore
I’m adding it all manually, so it makes no diff (lol) to me, but I don’t know how that would affect a patch file?

Think you can work that magic with this patch too? It’s the 2nd of 2 patches that go into the wowarmory…I’m building right now, but from looking at what was in that last post, everything looks pretty straight /emoticons/default_smile.png

Nevermind…googled “2012_09_01-WoW-Armory” and found where it came from, and it’s supposed to be all-in-one /emoticons/default_smile.png

Aaaaaaannd:

========== Build: 17 succeeded, 0 failed, 1 up-to-date, 1 skipped ==========

/emoticons/default_biggrin.png

Sorry for necroing this thread, there’s already multiple threads for the Armory and I didn’t want to make yet another one…

Having some issues with an empty loop in this patch. I’ve narrowed down the possibilities of where the problem might be and I think I have an answer. But a solution…I do not. Crash happens when a boss is downed which triggers the “boss” feed entry, caused by an empty query. All other entries work (entries in feed log made for item, achievement feeds and no crash)

Using Rev. aad8c12

EDIT: had some code here, but after commenting it out, the crash is still occurring. So I’m going to determine where the failure is before I suggest faulty code.

Tried debug/GDB and have something for us?

Working on it

http://pastebin.com/hrJEZxLe

#3 0x0000000000e58828 in MySQLConnection::Execute (this=0x7ffff4830200,
sql=0x7fffcd3c8160 "INSERT IGNORE INTO character_feed_log (guid,type,data,date,counter,difficulty,item_guid,item_quality) VALUES ") Is the empty query i was referring to that causes the crash.

I can see why.

sWowarmory << "INSERT IGNORE INTO character_feed_log (guid,type,data,date,counter,difficulty,item_guid,item_quality) VALUES ";

@@ -16801,6 +16807,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)

Eh?

Nevermind, I didn’t see that it works as ostrstream.