Merge branch 'PveStats' of git@gitlab.com:azerothshard/azerothcore.git

# Conflicts:
#	modules/azerothshard/src/server/game/AzthPlayer.cpp
This commit is contained in:
Yehonal
2016-07-19 23:39:28 +02:00
9 changed files with 87 additions and 39 deletions
@@ -1,16 +1,12 @@
#include "AzthInstanceMgr.h"
#include "InstanceSaveMgr.h"
AzthInstanceMgr::AzthInstanceMgr(InstanceSave* is) {
this->levelMax = 0;
this->is = is;
}
/* [TODO] fix and re-enable */
// #include "AzthInstanceMgr.h"
// #include "InstanceSaveMgr.h"
//
// AzthInstanceMgr::AzthInstanceMgr(InstanceSave* is) {
// this->levelMax = 0;
// this->is = is;
// }
//
// void AzthInstanceMgr::saveToDb() {
// CharacterDatabase.PExecute("UPDATE instance SET levelPg = %u WHERE id = %u", this->levelMax, this->is->GetInstanceId());
// }
void AzthInstanceMgr::saveToDb() {
CharacterDatabase.PExecute("UPDATE instance SET levelPg = %u WHERE id = %u", this->levelMax, this->is->GetInstanceId());
}
@@ -1,6 +1,6 @@
#ifndef AZTHINSTANCEMGR_H
#define AZTHINSTANCEMGR_H
/* [TODO] fix and re-enable
#include "InstanceSaveMgr.h"
class AzthInstanceMgr {
@@ -13,5 +13,4 @@ class AzthInstanceMgr {
InstanceSave* is;
uint8 levelMax;
};
*/
#endif
@@ -5,27 +5,26 @@
#include "ObjectAccessor.h"
#include "World.h"
/* [TODO] fix and re-enable */
AzthPlayer::AzthPlayer(Player *origin) {
playerQuestRate = sWorld->getRate(RATE_XP_QUEST);
player = origin;
}
AzthPlayer::AzthPlayer(Player *origin) {
playerQuestRate = sWorld->getRate(RATE_XP_QUEST);
player = origin;
}
void AzthPlayer::SetPlayerQuestRate(float rate) {
playerQuestRate = rate;
}
void AzthPlayer::SetPlayerQuestRate(float rate) {
playerQuestRate = rate;
}
uint32 AzthPlayer::getArena1v1Info(uint8 type) {
return arena1v1Info[type];
}
uint32 AzthPlayer::getArena1v1Info(uint8 type) {
return arena1v1Info[type];
}
void AzthPlayer::setArena1v1Info(uint8 type, uint32 value) {
arena1v1Info[type] = value;
}
void AzthPlayer::setArena1v1Info(uint8 type, uint32 value) {
arena1v1Info[type] = value;
}
float AzthPlayer::GetPlayerQuestRate() {
return playerQuestRate;
}
float AzthPlayer::GetPlayerQuestRate() {
return playerQuestRate;
}
uint32 AzthPlayer::getOriginalTeam() {
return player->TeamIdForRace(player->getRace());
@@ -34,8 +34,7 @@ public:
}
}
/*
void OnLogin(Player* player, bool firstLogin) override {
void OnLogin(Player* player) override {
// do it again for crossfaction system
player->setFactionForRace(player->getRace());
}
@@ -49,8 +48,7 @@ public:
uint16 levelPlayer = player->getLevel();
if (map->IsDungeon()) {
InstanceSave* is=player->GetInstanceSave(map->GetId(),map->IsRaid());
InstanceSave* is = sInstanceSaveMgr->PlayerGetInstanceSave(GUID_LOPART(player->GetGUID()), map->GetId(), player->GetDifficulty((map->IsRaid())));
if (is->azthInstMgr->levelMax == 0) {
instanceID = map->GetInstanceId();
@@ -63,7 +61,7 @@ public:
if (levelPlayer > is->azthInstMgr->levelMax) {
is->azthInstMgr->levelMax = levelPlayer;
is->SaveToDB();
is->InsertToDB();
}
}
}
@@ -75,7 +73,7 @@ public:
Map* map = player->FindMap();
if (map->IsDungeon()) {
InstanceSave* is=player->GetInstanceSave(map->GetId(),map->IsRaid());
InstanceSave* is = sInstanceSaveMgr->PlayerGetInstanceSave(GUID_LOPART(player->GetGUID()), map->GetId(), player->GetDifficulty((map->IsRaid())));
if (is->azthInstMgr->levelMax!=0) {
levelPlayer = is->azthInstMgr->levelMax;
}
@@ -93,7 +91,6 @@ public:
CharacterDatabase.PExecute("UPDATE character_achievement SET levelPg = %u WHERE achievement = %u", it.level, achId);
m_completed_achievement_map.erase(achId);
}
*/
};
void AddSC_azth_player_plg() {
+10
View File
@@ -162,6 +162,16 @@ class Roll : public LootValidatorRef
uint8 rollVoteMask;
};
// [AZTH]
struct InstanceGroupBind {
InstanceSave* save;
bool perm;
/* permanent InstanceGroupBinds exist if the leader has a permanent
PlayerInstanceBind for the same instance. */
InstanceGroupBind() : save(NULL), perm(false) { }
};
// [/AZTH]
/** request member stats checken **/
/** todo: uninvite people that not accepted invite **/
class Group
@@ -34,6 +34,8 @@
#include "Group.h"
#include "InstanceScript.h"
#include "ScriptMgr.h"
// [AZTH]
#include "AzthInstanceMgr.h"
uint16 InstanceSaveManager::ResetTimeDelay[] = {3600, 900, 300, 60, 0};
PlayerBindStorage InstanceSaveManager::playerBindStorage;
@@ -140,6 +142,9 @@ bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(InstanceSave* save, bool sk
InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, time_t extendedResetTime)
: m_resetTime(resetTime), m_extendedResetTime(extendedResetTime), m_instanceid(InstanceId), m_mapid(MapId), m_difficulty(MapId == 631 || MapId == 724 ? Difficulty(difficulty%2) : difficulty), m_canReset(true), m_instanceData(""), m_completedEncounterMask(0)
{
// [AZTH]
azthInstMgr = new AzthInstanceMgr(this);
// [/AZTH]
}
InstanceSave::~InstanceSave()
@@ -175,6 +180,9 @@ void InstanceSave::InsertToDB()
stmt->setUInt32(4, completedEncounters);
stmt->setString(5, data);
CharacterDatabase.Execute(stmt);
// [AZTH]
azthInstMgr->saveToDb();
}
time_t InstanceSave::GetResetTimeForDB()
@@ -30,6 +30,10 @@
#include "DBCEnums.h"
#include "ObjectDefines.h"
//[AZTH]
#include "AzthInstanceMgr.h"
class AzthInstanceMgr;
struct InstanceTemplate;
struct MapEntry;
class Player;
@@ -90,6 +94,10 @@ class InstanceSave
bool RemovePlayer(uint32 guidLow, InstanceSaveManager* ism);
typedef std::list<uint32> PlayerListType;
// [AZTH]
AzthInstanceMgr* azthInstMgr;
// [/AZTH]
private:
PlayerListType m_playerList;
+17
View File
@@ -1183,6 +1183,23 @@ void ScriptMgr::OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newAre
FOREACH_SCRIPT(PlayerScript)->OnUpdateZone(player, newZone, newArea);
}
// [AZTH] all custom PlayerScript functions
void ScriptMgr::OnPlayerRemoveFromBattleground(Player* player, Battleground* bg)
{
FOREACH_SCRIPT(PlayerScript)->OnPlayerRemoveFromBattleground(player, bg);
}
void ScriptMgr::OnAchievementComplete(Player* player, AchievementEntry const* achievement)
{
FOREACH_SCRIPT(PlayerScript)->OnAchiComplete(player, achievement);
}
void ScriptMgr::OnAchievementSave(Player* player, uint16 achId)
{
FOREACH_SCRIPT(PlayerScript)->OnAchiSave(player, achId);
}
//[/AZTH]
// Guild
void ScriptMgr::OnGuildAddMember(Guild* guild, Player* player, uint8& plRank)
{
+14
View File
@@ -709,6 +709,15 @@ class PlayerScript : public ScriptObject
// Called when a player changes to a new map (after moving to new map)
virtual void OnMapChanged(Player* /*player*/) { }
//[AZTH]
// Called when a player is removed from battleground
virtual void OnPlayerRemoveFromBattleground(Player* /*player*/, Battleground* /*bg*/) { }
virtual void OnAchiComplete(Player* /*player*/, AchievementEntry const* /*achievement*/) { }
virtual void OnAchiSave(Player* /*player*/, uint16 /*achId*/) { }
//[/AZTH]
};
class GuildScript : public ScriptObject
@@ -976,6 +985,11 @@ class ScriptMgr
void OnPlayerDelete(uint64 guid);
void OnPlayerBindToInstance(Player* player, Difficulty difficulty, uint32 mapid, bool permanent);
void OnPlayerUpdateZone(Player* player, uint32 newZone, uint32 newArea);
// [AZTH] all custom PlayerScript functions
void OnPlayerRemoveFromBattleground(Player* player, Battleground* bg);
void OnAchievementComplete(Player *player, AchievementEntry const* achievement);
void OnAchievementSave(Player *player, uint16 achId);
// [/AZTH]
public: /* GuildScript */