mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-07-11 03:13:10 +00:00
[AZTH] W.I.P. import PveStas
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -6,78 +6,78 @@
|
||||
#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->TeamForRace(player->getRace());
|
||||
// }
|
||||
//
|
||||
// bool AzthPlayer::setFactionForRace(uint8 race) {
|
||||
//
|
||||
// /* [TODO] implement zone check
|
||||
// * we already notify setFactionForRace on zone change in our AzthPlayerPlg
|
||||
//
|
||||
// if (zone in limited list from custom db table) then
|
||||
// return false;
|
||||
//
|
||||
// */
|
||||
//
|
||||
// if (player->InBattleground()) {
|
||||
// if (Battleground * bg = player->GetBattleground()) {
|
||||
// player->m_team = player->GetBGTeam();
|
||||
//
|
||||
// player->setFaction(player->m_team == ALLIANCE ? 1 : 2);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ObjectGuid leaderGuid = player->GetGroup() ? player->GetGroup()->GetLeaderGUID() : player->GetGUID();
|
||||
// if (leaderGuid != player->GetGUID()) {
|
||||
// Player* leader = ObjectAccessor::FindPlayer(leaderGuid);
|
||||
//
|
||||
// if (leader) {
|
||||
// player->m_team = leader->GetTeam();
|
||||
// player->setFaction(leader->getFaction());
|
||||
// } else {
|
||||
// // Query informations from the DB
|
||||
// PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
|
||||
// stmt->setUInt32(0, leaderGuid.GetCounter());
|
||||
// PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
//
|
||||
// if (!result)
|
||||
// return false;
|
||||
//
|
||||
// Field* fields = result->Fetch();
|
||||
// uint8 raceid = fields[4].GetUInt8();
|
||||
//
|
||||
// player->m_team = Player::TeamForRace(raceid);
|
||||
//
|
||||
// ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(raceid);
|
||||
// player->setFaction(rEntry ? rEntry->FactionID : 0);
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
uint32 AzthPlayer::getOriginalTeam() {
|
||||
return player->TeamIdForRace(player->getRace());
|
||||
}
|
||||
|
||||
bool AzthPlayer::setFactionForRace(uint8 race) {
|
||||
|
||||
/* [TODO] implement zone check
|
||||
* we already notify setFactionForRace on zone change in our AzthPlayerPlg
|
||||
|
||||
if (zone in limited list from custom db table) then
|
||||
return false;
|
||||
|
||||
*/
|
||||
|
||||
if (player->InBattleground()) {
|
||||
if (Battleground * bg = player->GetBattleground()) {
|
||||
player->m_team = player->GetBgTeamId();
|
||||
|
||||
player->setFaction(player->m_team == ALLIANCE ? 1 : 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
uint64 leaderGuid = player->GetGroup() ? player->GetGroup()->GetLeaderGUID() : player->GetGUID();
|
||||
if (leaderGuid != player->GetGUID()) {
|
||||
Player* leader = ObjectAccessor::FindPlayer(leaderGuid);
|
||||
|
||||
if (leader) {
|
||||
player->m_team = leader->GetTeamId();
|
||||
player->setFaction(leader->getFaction());
|
||||
} else {
|
||||
// Query informations from the DB
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
|
||||
stmt->setUInt32(0, GUID_LOPART(leaderGuid));
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
uint8 raceid = fields[4].GetUInt8();
|
||||
|
||||
player->m_team = Player::TeamIdForRace(raceid);
|
||||
|
||||
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(raceid);
|
||||
player->setFaction(rEntry ? rEntry->FactionID : 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user