/
wowarmory_feed_9611.patch
112 lines (107 loc) · 4.99 KB
/
wowarmory_feed_9611.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 5a61c4e..2da6f40 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1782,6 +1782,8 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
sLog.outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
if(achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID)!=m_completedAchievements.end())
return;
+ /* WoWArmory Feed Log */
+ GetPlayer()->WriteWowArmoryDatabaseLog(1, achievement->ID);
SendAchievementEarned(achievement);
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 235f4a5..d679616 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -946,6 +946,25 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
if ( count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
+ if (pProto->Quality > 2 && pProto->Flags != 2048 && (pProto->Class == ITEM_CLASS_WEAPON || pProto->Class == ITEM_CLASS_ARMOR) && player)
+ {
+ /* WoWArmory Feed Log */
+ std::ostringstream ss;
+ QueryResult *result = CharacterDatabase.PQuery("SELECT counter FROM character_feed_log WHERE guid='%u' AND type=2 AND data='%u' LIMIT 1", player->GetGUIDLow(), item);
+ if(result)
+ {
+ sLog.outDetail("WoWArmory: write feed log (guid: %u, type: 2, data: %u", player->GetGUIDLow(), item);
+ ss << "UPDATE character_feed_log SET counter=counter+1, date=NOW() WHERE guid=" << player->GetGUIDLow() << " AND type=2 AND data=" << item << " LIMIT 1";
+ CharacterDatabase.PExecute( ss.str().c_str() );
+ }
+ else
+ {
+ sLog.outDetail("WoWArmory: write feed log (guid: %u, type: 2, data: %u", player->GetGUIDLow(), item);
+ ss << "INSERT INTO character_feed_log (guid, type, data, counter) VALUES (" << player->GetGUIDLow() << ", 2, " << item << ", 1)";
+ CharacterDatabase.PExecute( ss.str().c_str() );
+ }
+ delete result;
+ }
assert(count !=0 && "pProto->Stackable==0 but checked at loading already");
Item *pItem = NewItemOrBag( pProto );
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index aa65246..1153fe0 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -21722,4 +21722,32 @@ void Player::SetRestType( RestType n_r_type, uint32 areaTriggerId /*= 0*/)
if(sWorld.IsFFAPvPRealm())
SetFFAPvP(false);
}
+}
+
+void Player::WriteWowArmoryDatabaseLog(uint32 type, uint32 data)
+{
+ uint32 pGuid = GetGUIDLow();
+ sLog.outDetail("WoWArmory: write feed log (guid: %u, type: %u, data: %u", pGuid, type, data);
+ if (type <= 0) // Unknown type
+ {
+ sLog.outError("WoWArmory: unknown type id: %d, ignore.", type);
+ return;
+ }
+ if (type == 3) // Do not write same bosses many times - just update counter.
+ {
+ QueryResult *result = CharacterDatabase.PQuery("SELECT counter FROM character_feed_log WHERE guid='%u' AND type=3 AND data='%u' LIMIT 1", pGuid, data);
+ if (result)
+ {
+ CharacterDatabase.PExecute("UPDATE character_feed_log SET counter=counter+1, date=NOW() WHERE guid='%u' AND type=3 AND data='%u' LIMIT 1", pGuid, data);
+ }
+ else
+ {
+ CharacterDatabase.PExecute("INSERT INTO character_feed_log (guid, type, data, counter) VALUES('%u', %d, '%u', 1)", pGuid, type, data);
+ }
+ delete result;
+ }
+ else
+ {
+ CharacterDatabase.PExecute("INSERT IGNORE INTO character_feed_log (guid, type, data, counter) VALUES('%u', %d, '%u', 1)", pGuid, type, data);
+ }
}
\ No newline at end of file
diff --git a/src/game/Player.h b/src/game/Player.h
index e381363..e2acd79 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2162,6 +2162,9 @@ 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);
+
+ // WoWArmory
+ void WriteWowArmoryDatabaseLog(uint32 type, uint32 data);
// currently visible objects at player client
ObjectGuidSet m_clientGUIDs;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b9af5d0..a639cdd 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -833,7 +833,11 @@ 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);
+ {
+ ((InstanceMap *)m)->PermBindAllPlayers(creditedPlayer);
+ /* WoWArmory Feed Log */
+ player->WriteWowArmoryDatabaseLog(3, cVictim->GetCreatureInfo()->Entry);
+ }
}
else
{