* Added outdoorpvp_template table (currently unused).

* Added DISABLE_TYPE_OUTDOORPVP (5) which can disable outdoorpvp_template entries.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-06 18:03:09 +02:00
parent edc4c3317c
commit b63a31f513
8 changed files with 134 additions and 12 deletions
+24
View File
@@ -3840,6 +3840,30 @@ LOCK TABLES `npc_vendor` WRITE;
/*!40000 ALTER TABLE `npc_vendor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `outdoorpvp_template`
--
DROP TABLE IF EXISTS `outdoorpvp_template`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `outdoorpvp_template` (
`TypeId` tinyint(2) unsigned NOT NULL,
`ScriptName` char(64) NOT NULL DEFAULT '',
`comment` text,
PRIMARY KEY (`TypeId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='OutdoorPvP Templates';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `outdoorpvp_template`
--
LOCK TABLES `outdoorpvp_template` WRITE;
/*!40000 ALTER TABLE `outdoorpvp_template` DISABLE KEYS */;
/*!40000 ALTER TABLE `outdoorpvp_template` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `page_text`
--
@@ -0,0 +1,7 @@
DROP TABLE IF EXISTS `outdoorpvp_template`;
CREATE TABLE `outdoorpvp_template` (
`TypeId` tinyint(2) unsigned NOT NULL,
`ScriptName` char(64) NOT NULL DEFAULT '',
`comment` text,
PRIMARY KEY (`TypeId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='OutdoorPvP Templates';
+16 -1
View File
@@ -22,6 +22,7 @@
#include "SpellMgr.h"
#include "ObjectMgr.h"
#include "DisableMgr.h"
#include "OutdoorPvP.h"
DisableMgr::DisableMgr()
{
@@ -31,6 +32,7 @@ DisableMgr::~DisableMgr()
{
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
itr->second.clear();
m_DisableMap.clear();
}
@@ -39,6 +41,7 @@ void DisableMgr::LoadDisables()
// reload case
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
itr->second.clear();
m_DisableMap.clear();
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT sourceType,entry,flags FROM disables");
@@ -132,6 +135,15 @@ void DisableMgr::LoadDisables()
if (flags)
sLog.outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
break;
case DISABLE_TYPE_OUTDOORPVP:
if (entry > MAX_OUTDOORPVP_TYPES)
{
sLog.outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
continue;
}
if (flags)
sLog.outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
if (!sAchievementCriteriaStore.LookupEntry(entry))
{
@@ -142,9 +154,11 @@ void DisableMgr::LoadDisables()
sLog.outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
break;
}
m_DisableMap[type].insert(DisableTypeMap::value_type(entry, flags));
++total_count;
} while (result->NextRow());
}
while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u disables.", total_count);
@@ -248,6 +262,7 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit
return false;
return true;
case DISABLE_TYPE_BATTLEGROUND:
case DISABLE_TYPE_OUTDOORPVP:
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
return true;
}
+5 -3
View File
@@ -27,10 +27,11 @@ enum DisableType
DISABLE_TYPE_QUEST = 1,
DISABLE_TYPE_MAP = 2,
DISABLE_TYPE_BATTLEGROUND = 3,
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
DISABLE_TYPE_OUTDOORPVP = 5,
};
#define MAX_DISABLE_TYPES 5
#define MAX_DISABLE_TYPES 6
typedef std::map<uint32, uint8> DisableTypeMap; // single disables here with optional data
typedef std::map<DisableType, DisableTypeMap> DisableMap; // global disable map by source
@@ -39,15 +40,16 @@ class DisableMgr
{
friend class ACE_Singleton<DisableMgr, ACE_Null_Mutex>;
DisableMgr();
~DisableMgr();
public:
~DisableMgr();
void LoadDisables();
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* pUnit);
void CheckQuestDisables();
protected:
DisableMap m_DisableMap;
};
+4 -1
View File
@@ -8750,6 +8750,8 @@ void ObjectMgr::LoadScriptNames()
"UNION "
"SELECT DISTINCT(ScriptName) FROM conditions WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(ScriptName) FROM outdoorpvp_template WHERE ScriptName <> '' "
"UNION "
"SELECT DISTINCT(script) FROM instance_template WHERE script <> ''");
if (!result)
@@ -8772,7 +8774,8 @@ void ObjectMgr::LoadScriptNames()
bar.step();
m_scriptNames.push_back((*result)[0].GetString());
++count;
} while (result->NextRow());
}
while (result->NextRow());
std::sort(m_scriptNames.begin(), m_scriptNames.end());
sLog.outString();
+8 -7
View File
@@ -28,15 +28,16 @@ class GameObject;
enum OutdoorPvPTypes
{
OUTDOOR_PVP_HP = 1,
OUTDOOR_PVP_NA,
OUTDOOR_PVP_TF,
OUTDOOR_PVP_ZM,
OUTDOOR_PVP_SI,
OUTDOOR_PVP_EP,
OUTDOOR_PVP_WG,
OUTDOOR_PVP_NR,
OUTDOOR_PVP_NA = 2,
OUTDOOR_PVP_TF = 3,
OUTDOOR_PVP_ZM = 4,
OUTDOOR_PVP_SI = 5,
OUTDOOR_PVP_EP = 6,
OUTDOOR_PVP_NR = 7,
};
#define MAX_OUTDOORPVP_TYPES 8
const uint8 CapturePointArtKit[3] = {2, 1, 21};
enum ObjectiveStates
@@ -25,6 +25,8 @@
#include "OutdoorPvPEP.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ProgressBar.h"
#include "DisableMgr.h"
OutdoorPvPMgr::OutdoorPvPMgr()
{
@@ -37,10 +39,15 @@ OutdoorPvPMgr::~OutdoorPvPMgr()
//sLog.outDebug("Deleting OutdoorPvPMgr");
for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr)
delete *itr;
for (OutdoorPvPDataSet::iterator itr = m_OutdoorPvPDatas.begin(); itr != m_OutdoorPvPDatas.end(); ++itr)
delete *itr;
}
void OutdoorPvPMgr::InitOutdoorPvP()
{
LoadTemplates();
// create new opvp
OutdoorPvP * pOP = new OutdoorPvPHP;
// respawn, init variables
@@ -121,6 +128,56 @@ void OutdoorPvPMgr::InitOutdoorPvP()
}
}
void OutdoorPvPMgr::LoadTemplates()
{
uint32 typeId = 0;
uint32 count = 0;
// 0 1
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT TypeId, ScriptName FROM outdoorpvp_template");
if (!result)
{
barGoLink bar(1);
bar.step();
sLog.outString();
sLog.outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
return;
}
barGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
bar.step();
typeId = fields[0].GetUInt32();
if (sDisableMgr.IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL))
continue;
if (typeId >= MAX_OUTDOORPVP_TYPES)
{
sLog.outError("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);
continue;
}
OutdoorPvPData data;
data.TypeId = OutdoorPvPTypes(typeId);
data.ScriptId = objmgr.GetScriptId(fields[1].GetString());
m_OutdoorPvPDatas.push_back(&data);
++count;
}
while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u outdoor PvP definitions.", count);
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP *handle)
{
m_OutdoorPvPMap[zoneid] = handle;
@@ -30,6 +30,12 @@ class Creature;
class ZoneScript;
struct GossipMenuItems;
struct OutdoorPvPData
{
OutdoorPvPTypes TypeId;
uint32 ScriptId;
};
// class to handle player enter / leave / areatrigger / GO use events
class OutdoorPvPMgr
{
@@ -44,6 +50,9 @@ class OutdoorPvPMgr
// create outdoor pvp events
void InitOutdoorPvP();
// loads outdoorpvp_template
void LoadTemplates();
// called when a player enters an outdoor pvp area
void HandlePlayerEnterZone(Player * plr, uint32 areaflag);
@@ -76,6 +85,7 @@ class OutdoorPvPMgr
typedef std::vector<OutdoorPvP*> OutdoorPvPSet;
typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap;
typedef std::vector<OutdoorPvPData*> OutdoorPvPDataSet;
private:
@@ -87,6 +97,9 @@ class OutdoorPvPMgr
// used in player event handling
OutdoorPvPMap m_OutdoorPvPMap;
// Holds the outdoor PvP templates
OutdoorPvPDataSet m_OutdoorPvPDatas;
// update interval
uint32 m_UpdateTimer;
};