mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
Merge branch 'PveStats' of git@gitlab.com:azerothshard/azerothcore.git
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE `groups` ADD COLUMN `MaxlevelGroup` INT(10) UNSIGNED DEFAULT 0 NOT NULL AFTER `masterLooterGuid`;
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS azth_achievement_stats (
|
||||
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
playerGuid INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
achievement INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
type INT(8) UNSIGNED NOT NULL DEFAULT 0,
|
||||
level INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
levelParty INT(10) UNSIGNED DEFAULT 0,
|
||||
date DATETIME NOT NULL DEFAULT NOW(),
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "AzthGroupMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
AzthGroupMgr::AzthGroupMgr(Group* group) {
|
||||
this->group = group;
|
||||
this->levelMaxGroup;
|
||||
}
|
||||
|
||||
void AzthGroupMgr::saveToDb() {
|
||||
CharacterDatabase.PExecute("UPDATE groups SET maxLevelGroup = %u WHERE leaderGuid = %u", this->levelMaxGroup, this->group->GetLeaderGUID());
|
||||
}
|
||||
|
||||
AzthGroupMgr::~AzthGroupMgr() {}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef AZTHGROUPMGR_H
|
||||
#define AZTHGROUPMGR_H
|
||||
|
||||
#include "Group.h"
|
||||
|
||||
class AzthGroupMgr {
|
||||
public:
|
||||
explicit AzthGroupMgr(Group* group);
|
||||
~AzthGroupMgr();
|
||||
|
||||
void saveToDb();
|
||||
|
||||
uint8 levelMaxGroup;
|
||||
Group* group;
|
||||
};
|
||||
#endif
|
||||
@@ -25,3 +25,5 @@ void AzthPlayer::setArena1v1Info(uint8 type, uint32 value) {
|
||||
float AzthPlayer::GetPlayerQuestRate() {
|
||||
return playerQuestRate;
|
||||
}
|
||||
|
||||
AzthPlayer::~AzthPlayer() {}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
class CrossFaction;
|
||||
|
||||
/* [TODO] fix and re-enable */
|
||||
class AzthPlayer {
|
||||
public:
|
||||
explicit AzthPlayer(Player *origin);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
This plugin can be used for common group customizations
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Map.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
class AzthGroupPlg : public GroupScript {
|
||||
public:
|
||||
|
||||
AzthGroupPlg() : GroupScript("AzthGroupPlg") { }
|
||||
|
||||
void OnAddMember(Group* group, uint64 guid) override {
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (group->azthGroupMgr->levelMaxGroup < player->getLevel()) {
|
||||
group->azthGroupMgr->levelMaxGroup = player->getLevel();
|
||||
group->azthGroupMgr->saveToDb();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_azth_group_plg() {
|
||||
new AzthGroupPlg();
|
||||
}
|
||||
@@ -8,24 +8,34 @@
|
||||
#include "Player.h"
|
||||
#include "Map.h"
|
||||
#include "WorldSession.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "AzthGroupMgr.h"
|
||||
|
||||
class AzthPlayerPlg : public PlayerScript {
|
||||
class AzthPlayerPlg : public PlayerScript{
|
||||
public:
|
||||
|
||||
AzthPlayerPlg() : PlayerScript("AzthPlayerPlg") { }
|
||||
|
||||
uint16 levelPlayer;
|
||||
uint16 tmpLevelPg;
|
||||
|
||||
uint8 groupLevel;
|
||||
|
||||
struct CompletedAchievementData
|
||||
{
|
||||
uint8 level;
|
||||
uint8 levelParty;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint16 /*achiId*/, CompletedAchievementData /*data*/> CompletedAchievementMap;
|
||||
CompletedAchievementMap m_completed_achievement_map;
|
||||
uint32 instanceID;
|
||||
|
||||
// Fixa sta pircheria
|
||||
void GetPartyLevel(Group* group, Player* player, AchievementMgr* achievement ) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void OnLevelChanged(Player* player, uint8 oldLevel) override
|
||||
{
|
||||
if (oldLevel == 9)
|
||||
@@ -41,12 +51,11 @@ public:
|
||||
|
||||
void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) override {
|
||||
player->setFactionForRace(player->getRace());
|
||||
|
||||
return; // disable following
|
||||
|
||||
|
||||
Map* map = player->FindMap();
|
||||
uint16 levelPlayer = player->getLevel();
|
||||
|
||||
|
||||
if (map->IsDungeon()) {
|
||||
InstanceSave* is = sInstanceSaveMgr->PlayerGetInstanceSave(GUID_LOPART(player->GetGUID()), map->GetId(), player->GetDifficulty(map->IsRaid()));
|
||||
if (is->azthInstMgr->levelMax == 0) {
|
||||
@@ -67,8 +76,9 @@ public:
|
||||
}
|
||||
|
||||
void OnAchiComplete(Player *player, AchievementEntry const* achievement) override {
|
||||
return; // disable following
|
||||
|
||||
Group* group = NULL;
|
||||
uint64 leaderGUID = 0;
|
||||
uint16 levelPlayer = player->getLevel();
|
||||
|
||||
Map* map = player->FindMap();
|
||||
@@ -81,10 +91,23 @@ public:
|
||||
|
||||
CompletedAchievementData& it = m_completed_achievement_map[achievement->ID];
|
||||
it.level = levelPlayer;
|
||||
if(player->GetGroup()->isRaidGroup())
|
||||
it.levelParty = group->azthGroupMgr->levelMaxGroup;
|
||||
|
||||
|
||||
// Da spostare nella SaveToDb
|
||||
/* PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVESTATS);
|
||||
// playerGuid, achievement, type, level, levelParty, date
|
||||
stmt->setUInt32(0, player->GetGUID());
|
||||
stmt->setUInt32(1, achievement->ID);
|
||||
stmt->setUInt32(2, 0);
|
||||
stmt->setUInt32(3, levelPlayer);
|
||||
stmt->setUInt32(4, );
|
||||
stmt->setUInt32(5, );
|
||||
CharacterDatabase.Execute(stmt);*/
|
||||
}
|
||||
|
||||
void OnAchiSave(Player *player, uint16 achId) override {
|
||||
return; // disable following
|
||||
|
||||
CompletedAchievementData& it = m_completed_achievement_map[achId];
|
||||
|
||||
@@ -93,6 +116,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void AddSC_azth_player_plg() {
|
||||
new AzthPlayerPlg();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ void AddSC_guildhouse_npcs();
|
||||
void AddSC_npc_transmogrifier();
|
||||
void AddSC_npc_transmogrifier();
|
||||
void AddSC_hearthstone();
|
||||
void AddSC_azth_group_plg();
|
||||
|
||||
|
||||
void AddAzthScripts()
|
||||
@@ -36,6 +37,7 @@ void AddAzthScripts()
|
||||
AddSC_npc_transmogrifier();
|
||||
//sAnticheatMgr->StartScripts(); //[AZTH] Anticheat
|
||||
AddSC_hearthstone();
|
||||
AddSC_azth_group_plg();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -248,6 +248,9 @@ struct CompletedAchievementData
|
||||
{
|
||||
time_t date;
|
||||
bool changed;
|
||||
//[AZTH]
|
||||
uint16 levelPlayer;
|
||||
uint8 groupLevel;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, CriteriaProgress> CriteriaProgressMap;
|
||||
@@ -279,6 +282,7 @@ class AchievementMgr
|
||||
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
|
||||
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
|
||||
|
||||
|
||||
void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry);
|
||||
private:
|
||||
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST, PROGRESS_RESET };
|
||||
|
||||
@@ -968,6 +968,8 @@ Player::~Player()
|
||||
delete m_runes;
|
||||
delete m_achievementMgr;
|
||||
delete m_reputationMgr;
|
||||
// [AZTH]
|
||||
delete azthPlayer;
|
||||
|
||||
sWorld->DecreasePlayerCount();
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "MapManager.h"
|
||||
#include "UpdateFieldFlags.h"
|
||||
// [AZTH]
|
||||
#include "AzthGroupMgr.h"
|
||||
|
||||
Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
|
||||
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||
@@ -71,6 +73,10 @@ _difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE)
|
||||
{
|
||||
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i] = 0;
|
||||
|
||||
// [AZTH]
|
||||
azthGroupMgr = new AzthGroupMgr(this);
|
||||
// [/AZTH]
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
@@ -93,6 +99,8 @@ Group::~Group()
|
||||
|
||||
// Sub group counters clean up
|
||||
delete[] m_subGroupsCounts;
|
||||
//[AZTH]
|
||||
delete azthGroupMgr;
|
||||
}
|
||||
|
||||
bool Group::Create(Player* leader)
|
||||
@@ -148,6 +156,10 @@ bool Group::Create(Player* leader)
|
||||
stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
|
||||
stmt->setUInt32(index++, uint8(m_raidDifficulty));
|
||||
stmt->setUInt32(index++, GUID_LOPART(m_masterLooterGuid));
|
||||
//[/AZTH]
|
||||
stmt->setUInt32(index++, uint8(leader->getLevel()));
|
||||
azthGroupMgr->levelMaxGroup = 0;
|
||||
// [/AZTH]
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
#include "QueryResult.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
//[AZTH]
|
||||
#include "AzthGroupMgr.h"
|
||||
class AzthGroupMgr;
|
||||
// [/AZTH]
|
||||
|
||||
class Battlefield;
|
||||
class Battleground;
|
||||
class Creature;
|
||||
@@ -329,6 +334,10 @@ class Group
|
||||
_difficultyChangePreventionType = type;
|
||||
}
|
||||
|
||||
// [AZTH]
|
||||
AzthGroupMgr* azthGroupMgr;
|
||||
// [/AZTH]
|
||||
|
||||
protected:
|
||||
void _homebindIfInstance(Player* player);
|
||||
void _cancelHomebindIfInstance(Player* player);
|
||||
|
||||
@@ -107,8 +107,8 @@ void GroupMgr::LoadGroups()
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult result = CharacterDatabase.Query("SELECT g.leaderGuid, g.lootMethod, g.looterGuid, g.lootThreshold, g.icon1, g.icon2, g.icon3, g.icon4, g.icon5, g.icon6"
|
||||
// 10 11 12 13 14 15 16 17 18
|
||||
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.masterLooterGuid, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
|
||||
// 10 11 12 13 14 15 16 17 18 19
|
||||
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.masterLooterGuid, g.guid, lfg.dungeon, lfg.state, g.MaxlevelGroup FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -131,6 +131,10 @@ void GroupMgr::LoadGroups()
|
||||
|
||||
RegisterGroupId(group->GetLowGUID());
|
||||
|
||||
//[AZTH]
|
||||
group->azthGroupMgr->levelMaxGroup = fields[19].GetUInt32();
|
||||
//[/AZTH]
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
@@ -340,7 +340,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_UPD_PETITION_NAME, "UPDATE petition SET name = ? WHERE petitionguid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_PETITION_SIGNATURE, "INSERT INTO petition_sign (ownerguid, petitionguid, playerguid, player_account) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_ACCOUNT_ONLINE, "UPDATE characters SET online = 0 WHERE account = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_GROUP, "INSERT INTO groups (guid, leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, masterLooterGuid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
//[AZTH]
|
||||
PrepareStatement(CHAR_INS_GROUP, "INSERT INTO groups (guid, leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, masterLooterGuid, MaxLevelGroup) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
//[/AZTH]
|
||||
PrepareStatement(CHAR_REP_GROUP_MEMBER, "REPLACE INTO group_member (guid, memberGuid, memberFlags, subgroup, roles) VALUES(?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_GROUP_MEMBER, "DELETE FROM group_member WHERE memberGuid = ? AND guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_GROUP_LEADER, "UPDATE groups SET leaderGuid = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
@@ -563,6 +565,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_INS_PVPSTATS_PLAYER, "INSERT INTO pvpstats_players (battleground_id, character_guid, winner, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done, attr_1, attr_2, attr_3, attr_4, attr_5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_PVPSTATS_FACTIONS_OVERALL, "SELECT winner_faction, COUNT(*) AS count FROM pvpstats_battlegrounds WHERE DATEDIFF(NOW(), date) < 7 GROUP BY winner_faction ORDER BY winner_faction ASC", CONNECTION_SYNCH);
|
||||
|
||||
// PvEStats
|
||||
PrepareStatement(CHAR_INS_PVESTATS, "INSERT INTO azth_achievement_stats (playerGuid, achievement, type, level, levelParty, date) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
// Deserter tracker
|
||||
PrepareStatement(CHAR_INS_DESERTER_TRACK, "INSERT INTO battleground_deserters (guid, type, datetime) VALUES (?, ?, NOW())", CONNECTION_ASYNC);
|
||||
|
||||
|
||||
@@ -284,6 +284,9 @@ enum CharacterDatabaseStatements
|
||||
CHAR_INS_PETITION_SIGNATURE,
|
||||
CHAR_UPD_ACCOUNT_ONLINE,
|
||||
CHAR_INS_GROUP,
|
||||
//[AZTH]
|
||||
CHAR_INS_PVESTATS,
|
||||
//[/AZTH]
|
||||
CHAR_REP_GROUP_MEMBER,
|
||||
CHAR_DEL_GROUP_MEMBER,
|
||||
CHAR_UPD_GROUP_LEADER,
|
||||
|
||||
Reference in New Issue
Block a user