Various external fixes - part 5
Ported commits from cmangos repositories + https://github.com/cmangos/mangos-classic/commit/a3d6d1a + https://github.com/cmangos/mangos-classic/commit/cd32eab
This commit is contained in:
parent
474fa45ebb
commit
59d55845e7
@ -229,6 +229,8 @@ BattleGround::BattleGround()
|
||||
m_MapId = 0;
|
||||
m_Map = NULL;
|
||||
|
||||
m_validStartPositionTimer = 0;
|
||||
|
||||
m_TeamStartLocX[TEAM_INDEX_ALLIANCE] = 0;
|
||||
m_TeamStartLocX[TEAM_INDEX_HORDE] = 0;
|
||||
|
||||
@ -380,6 +382,29 @@ void BattleGround::Update(uint32 diff)
|
||||
|
||||
if (GetStatus() == STATUS_WAIT_JOIN && GetPlayersSize())
|
||||
{
|
||||
float maxDist = GetStartMaxDist();
|
||||
if (maxDist > 0.0f)
|
||||
{
|
||||
if (m_validStartPositionTimer < diff)
|
||||
{
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
float x, y, z, o;
|
||||
GetTeamStartLoc(player->GetTeam(), x, y, z, o);
|
||||
if (!player->IsWithinDist3d(x, y, z, maxDist))
|
||||
{
|
||||
player->TeleportTo(GetMapId(), x, y, z, o);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_validStartPositionTimer = CHECK_PLAYER_POSITION_INVERVAL;
|
||||
}
|
||||
else
|
||||
m_validStartPositionTimer -= diff;
|
||||
}
|
||||
|
||||
ModifyStartDelayTime(diff);
|
||||
|
||||
if (!(m_Events & BG_STARTING_EVENT_1))
|
||||
|
@ -111,6 +111,7 @@ enum BattleGroundMarksCount
|
||||
*/
|
||||
enum BattleGroundTimeIntervals
|
||||
{
|
||||
CHECK_PLAYER_POSITION_INVERVAL = 1000, // ms
|
||||
RESURRECTION_INTERVAL = 30000, // ms
|
||||
INVITATION_REMIND_TIME = 60000, // ms
|
||||
INVITE_ACCEPT_WAIT_TIME = 80000, // ms
|
||||
@ -740,6 +741,9 @@ class BattleGround
|
||||
O = m_TeamStartLocO[idx];
|
||||
}
|
||||
|
||||
void SetStartMaxDist(float startMaxDist) { m_startMaxDist = startMaxDist; }
|
||||
float GetStartMaxDist() const { return m_startMaxDist; }
|
||||
|
||||
/* Packet Transfer */
|
||||
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
|
||||
/**
|
||||
@ -1294,6 +1298,7 @@ class BattleGround
|
||||
BattleGroundStatus m_Status; /**< TODO */
|
||||
uint32 m_ClientInstanceID; /**< the instance-id which is sent to the client and without any other internal use */
|
||||
uint32 m_StartTime; /**< TODO */
|
||||
uint32 m_validStartPositionTimer;
|
||||
int32 m_EndTime; /**< it is set to 120000 when bg is ending and it decreases itself */
|
||||
BattleGroundBracketId m_BracketId; /**< TODO */
|
||||
bool m_InBGFreeSlotQueue; /**< used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque */
|
||||
@ -1334,6 +1339,7 @@ class BattleGround
|
||||
/* Start location */
|
||||
uint32 m_MapId; /**< TODO */
|
||||
BattleGroundMap* m_Map; /**< TODO */
|
||||
float m_startMaxDist;
|
||||
float m_TeamStartLocX[PVP_TEAM_COUNT]; /**< TODO */
|
||||
float m_TeamStartLocY[PVP_TEAM_COUNT]; /**< TODO */
|
||||
float m_TeamStartLocZ[PVP_TEAM_COUNT]; /**< TODO */
|
||||
|
@ -1114,7 +1114,7 @@ BattleGround* BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId
|
||||
}
|
||||
|
||||
// used to create the BG templates
|
||||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO)
|
||||
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, float StartMaxDist)
|
||||
{
|
||||
// Create the BG
|
||||
BattleGround* bg = NULL;
|
||||
@ -1135,6 +1135,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 M
|
||||
bg->SetName(BattleGroundName);
|
||||
bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
|
||||
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
|
||||
bg->SetStartMaxDist(StartMaxDist);
|
||||
bg->SetLevelRange(LevelMin, LevelMax);
|
||||
|
||||
// add bg to update list
|
||||
@ -1152,8 +1153,8 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult* result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult* result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO, StartMaxDist FROM battleground_template");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@ -1229,8 +1230,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
continue;
|
||||
}
|
||||
|
||||
float startMaxDist = fields[9].GetFloat();
|
||||
// sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||
if (!CreateBattleGround(bgTypeID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, name, mapId, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
||||
if (!CreateBattleGround(bgTypeID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, name, mapId, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], startMaxDist))
|
||||
{ continue; }
|
||||
|
||||
++count;
|
||||
|
@ -529,7 +529,7 @@ class BattleGroundMgr
|
||||
* @param Team2StartLocO
|
||||
* @return uint32
|
||||
*/
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
|
||||
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char const* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, float StartMaxDist);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
@ -478,11 +478,13 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo* cinfo, const CreatureData*
|
||||
|
||||
// model selected here may be replaced with other_gender using own function
|
||||
if (!cinfo->ModelId[1])
|
||||
{
|
||||
display_id = cinfo->ModelId[0];
|
||||
}
|
||||
else
|
||||
{ display_id = cinfo->ModelId[0]; }
|
||||
else if (!cinfo->ModelId[2])
|
||||
{ display_id = cinfo->ModelId[urand(0, 1)]; }
|
||||
else if (!cinfo->ModelId[3])
|
||||
{ display_id = cinfo->ModelId[urand(0, 2)]; }
|
||||
else
|
||||
{ display_id = cinfo->ModelId[urand(0, 3)]; }
|
||||
|
||||
// fail safe, we use creature entry 1 and make error
|
||||
if (!display_id)
|
||||
@ -1129,7 +1131,8 @@ void Creature::SaveToDB(uint32 mapid)
|
||||
CreatureInfo const* cinfo = GetCreatureInfo();
|
||||
if (cinfo)
|
||||
{
|
||||
if (displayId != cinfo->ModelId[0] && displayId != cinfo->ModelId[1])
|
||||
if (displayId != cinfo->ModelId[0] && displayId != cinfo->ModelId[1] &&
|
||||
displayId != cinfo->ModelId[2] && displayId != cinfo->ModelId[3])
|
||||
{
|
||||
for (int i = 0; i < MAX_CREATURE_MODEL && displayId; ++i)
|
||||
if (cinfo->ModelId[i])
|
||||
|
@ -74,7 +74,7 @@ enum CreatureFlagsExtra
|
||||
#endif
|
||||
|
||||
#define MAX_KILL_CREDIT 2
|
||||
#define MAX_CREATURE_MODEL 2 // only single send to client in static data
|
||||
#define MAX_CREATURE_MODEL 4 // only single send to client in static data
|
||||
|
||||
// from `creature_template` table
|
||||
struct CreatureInfo
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
#include "SQLStorages.h"
|
||||
|
||||
const char CreatureInfosrcfmt[] = "issiiiiiifiiiiliiiiiffiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
|
||||
const char CreatureInfodstfmt[] = "issiiiiiifiiiiliiiiiffiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
|
||||
const char CreatureInfosrcfmt[] = "issiiiiiiiifiiiiliiiiiffiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
|
||||
const char CreatureInfodstfmt[] = "issiiiiiiiifiiiiliiiiiffiiffffffiiiiffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis";
|
||||
const char CreatureDataAddonInfofmt[] = "iiibbiis";
|
||||
const char CreatureModelfmt[] = "iffbii";
|
||||
const char CreatureInfoAddonInfofmt[] = "iiibbiis";
|
||||
|
@ -1133,7 +1133,8 @@ enum GameObjectDynamicLowFlags
|
||||
{
|
||||
GO_DYNFLAG_LO_ACTIVATE = 0x01, // enables interaction with GO
|
||||
GO_DYNFLAG_LO_ANIMATE = 0x02, // possibly more distinct animation of GO
|
||||
GO_DYNFLAG_LO_NO_INTERACT = 0x04 // appears to disable interaction (not fully verified)
|
||||
GO_DYNFLAG_LO_NO_INTERACT = 0x04, // appears to disable interaction (not fully verified)
|
||||
GO_DYNFLAG_LO_SPARKLE = 0x08 // not fully verified
|
||||
};
|
||||
|
||||
enum TextEmotes
|
||||
|
@ -37,7 +37,7 @@
|
||||
#define CHAR_DB_UPDATE_DESCRIPTION "Fix SoR paladin"
|
||||
|
||||
#define WORLD_DB_VERSION_NR 21
|
||||
#define WORLD_DB_STRUCTURE_NR 4
|
||||
#define WORLD_DB_CONTENT_NR 1
|
||||
#define WORLD_DB_UPDATE_DESCRIPTION "Refactor areatrigger_teleport"
|
||||
#define WORLD_DB_STRUCTURE_NR 5
|
||||
#define WORLD_DB_CONTENT_NR 2
|
||||
#define WORLD_DB_UPDATE_DESCRIPTION "BG template addition"
|
||||
#endif // __REVISION_H__
|
||||
|
Loading…
x
Reference in New Issue
Block a user