mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Merge commit 'origin/master' into 310
This commit is contained in:
commit
bb9e2ab658
46 changed files with 410 additions and 386 deletions
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DROP TABLE IF EXISTS `character_db_version`;
|
||||
CREATE TABLE `character_db_version` (
|
||||
`required_7324_02_characters_character_aura` bit(1) default NULL
|
||||
`required_7546_01_characters_uptime` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||
|
||||
--
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
DROP TABLE IF EXISTS `db_version`;
|
||||
CREATE TABLE `db_version` (
|
||||
`version` varchar(120) default NULL,
|
||||
`required_7536_01_mangos_spell_chain` bit(1) default NULL
|
||||
`required_7544_01_mangos_uptime` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -17851,28 +17851,6 @@ LOCK TABLES `transports` WRITE;
|
|||
/*!40000 ALTER TABLE `transports` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `transports` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `uptime`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
CREATE TABLE `uptime` (
|
||||
`starttime` bigint(20) unsigned NOT NULL default '0',
|
||||
`startstring` varchar(64) NOT NULL default '',
|
||||
`uptime` bigint(20) unsigned NOT NULL default '0',
|
||||
`maxplayers` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`starttime`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
|
||||
|
||||
--
|
||||
-- Dumping data for table `uptime`
|
||||
--
|
||||
|
||||
LOCK TABLES `uptime` WRITE;
|
||||
/*!40000 ALTER TABLE `uptime` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `uptime` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
DROP TABLE IF EXISTS `realmd_db_version`;
|
||||
CREATE TABLE `realmd_db_version` (
|
||||
`required_6976_01_realmd_realmd_db_version` bit(1) default NULL
|
||||
`required_7546_02_realmd_uptime` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
|
||||
|
||||
--
|
||||
|
|
@ -174,6 +174,29 @@ INSERT INTO `realmlist` VALUES
|
|||
(1,'MaNGOS','127.0.0.1',8085,1,0,1,0,0);
|
||||
/*!40000 ALTER TABLE `realmlist` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `uptime`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
CREATE TABLE `uptime` (
|
||||
`realmid` int(11) unsigned NOT NULL,
|
||||
`starttime` bigint(20) unsigned NOT NULL default '0',
|
||||
`startstring` varchar(64) NOT NULL default '',
|
||||
`uptime` bigint(20) unsigned NOT NULL default '0',
|
||||
`maxplayers` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`realmid`,`starttime`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
|
||||
|
||||
--
|
||||
-- Dumping data for table `uptime`
|
||||
--
|
||||
|
||||
LOCK TABLES `uptime` WRITE;
|
||||
/*!40000 ALTER TABLE `uptime` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `uptime` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
|
|
|||
3
sql/updates/7544_01_mangos_uptime.sql
Normal file
3
sql/updates/7544_01_mangos_uptime.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_7536_01_mangos_spell_chain required_7544_01_mangos_uptime bit;
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
14
sql/updates/7544_02_characters_uptime.sql
Normal file
14
sql/updates/7544_02_characters_uptime.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
ALTER TABLE character_db_version CHANGE COLUMN required_7324_02_characters_character_aura required_7544_02_characters_uptime bit;
|
||||
|
||||
--
|
||||
-- Table structure for table `uptime`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
CREATE TABLE `uptime` (
|
||||
`starttime` bigint(20) unsigned NOT NULL default '0',
|
||||
`startstring` varchar(64) NOT NULL default '',
|
||||
`uptime` bigint(20) unsigned NOT NULL default '0',
|
||||
`maxplayers` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`starttime`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
|
||||
3
sql/updates/7546_01_characters_uptime.sql
Normal file
3
sql/updates/7546_01_characters_uptime.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE character_db_version CHANGE COLUMN required_7544_02_characters_uptime required_7546_01_characters_uptime bit;
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
16
sql/updates/7546_02_realmd_uptime.sql
Normal file
16
sql/updates/7546_02_realmd_uptime.sql
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE realmd_db_version CHANGE COLUMN required_6976_01_realmd_realmd_db_version required_7546_02_realmd_uptime bit;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `uptime`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `uptime`;
|
||||
CREATE TABLE `uptime` (
|
||||
`realmid` int(11) unsigned NOT NULL,
|
||||
`starttime` bigint(20) unsigned NOT NULL default '0',
|
||||
`startstring` varchar(64) NOT NULL default '',
|
||||
`uptime` bigint(20) unsigned NOT NULL default '0',
|
||||
`maxplayers` smallint(5) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`realmid`,`starttime`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
|
||||
|
|
@ -202,6 +202,10 @@ pkgdata_DATA = \
|
|||
7495_01_mangos_mangos_string.sql \
|
||||
7503_01_mangos_command.sql \
|
||||
7536_01_mangos_spell_chain.sql \
|
||||
7544_01_mangos_uptime.sql \
|
||||
7544_02_characters_uptime.sql \
|
||||
7546_01_characters_uptime.sql \
|
||||
7546_02_realmd_uptime.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -384,4 +388,8 @@ EXTRA_DIST = \
|
|||
7495_01_mangos_mangos_string.sql \
|
||||
7503_01_mangos_command.sql \
|
||||
7536_01_mangos_spell_chain.sql \
|
||||
7544_01_mangos_uptime.sql \
|
||||
7544_02_characters_uptime.sql \
|
||||
7546_01_characters_uptime.sql \
|
||||
7546_02_realmd_uptime.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "Common.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Database/DBCEnums.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Guild.h"
|
||||
|
|
@ -725,14 +725,24 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
if(!worldOverlayEntry)
|
||||
break;
|
||||
|
||||
int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID);
|
||||
if(exploreFlag < 0)
|
||||
break;
|
||||
bool matchFound = false;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int32 exploreFlag = GetAreaFlagByAreaID(worldOverlayEntry->areatableID[i]);
|
||||
if(exploreFlag < 0)
|
||||
break;
|
||||
|
||||
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
|
||||
uint32 mask = 1<< (uint32(exploreFlag) % 32);
|
||||
uint32 playerIndexOffset = uint32(exploreFlag) / 32;
|
||||
uint32 mask = 1<< (uint32(exploreFlag) % 32);
|
||||
|
||||
if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
|
||||
if(GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask)
|
||||
{
|
||||
matchFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(matchFound)
|
||||
SetCriteriaProgress(achievementCriteria, 1);
|
||||
break;
|
||||
}
|
||||
|
|
@ -752,18 +762,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION:
|
||||
{
|
||||
// skip faction check only at loading
|
||||
if (miscvalue1 && GetPlayer()->GetReputationRank(miscvalue1) < REP_EXALTED)
|
||||
continue;
|
||||
|
||||
uint32 counter = 0;
|
||||
FactionStateList const& factionStateList = GetPlayer()->GetReputationMgr().GetStateList();
|
||||
for (FactionStateList::const_iterator iter = factionStateList.begin(); iter!= factionStateList.end(); ++iter)
|
||||
if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(iter->second.ID))
|
||||
if(ReputationMgr::ReputationToRank(iter->second.Standing + GetPlayer()->GetReputationMgr().GetBaseReputation(factionEntry)) >= REP_EXALTED)
|
||||
++counter;
|
||||
|
||||
SetCriteriaProgress(achievementCriteria, counter);
|
||||
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetExaltedFactionCount());
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP:
|
||||
|
|
@ -856,6 +855,15 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
SetCriteriaProgress(achievementCriteria, spellCount);
|
||||
break;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
|
||||
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetReveredFactionCount());
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
|
||||
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetHonoredFactionCount());
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
|
||||
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetVisibleFactionCount());
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
{
|
||||
if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID)
|
||||
|
|
@ -920,9 +928,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED:
|
||||
|
|
@ -1057,6 +1062,9 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
|
|||
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR:
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "Policies/Singleton.h"
|
||||
#include "Database/DBCEnums.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
#include "AccountMgr.h"
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@
|
|||
*/
|
||||
|
||||
#include "DBCStores.h"
|
||||
//#include "DataStore.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Log.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
#include "DBCfmt.cpp"
|
||||
#include "DBCfmt.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
|
|
@ -157,7 +156,7 @@ template<class T>
|
|||
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
|
||||
{
|
||||
// compatibility format and C++ structure sizes
|
||||
assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
||||
assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
||||
|
||||
std::string dbc_filename = dbc_path + filename;
|
||||
if(storage.Load(dbc_filename.c_str()))
|
||||
|
|
@ -16,12 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef DBCSTORES_H
|
||||
#define DBCSTORES_H
|
||||
#ifndef MANGOS_DBCSTORES_H
|
||||
#define MANGOS_DBCSTORES_H
|
||||
|
||||
#include "Common.h"
|
||||
//#include "DataStore.h"
|
||||
#include "dbcfile.h"
|
||||
#include "Database/DBCStore.h"
|
||||
#include "DBCStructure.h"
|
||||
|
||||
#include <list>
|
||||
|
|
@ -57,77 +56,6 @@ void Map2ZoneCoordinates(float& x,float& y,uint32 zone);
|
|||
|
||||
uint32 const* /*[3]*/ GetTalentTabPages(uint32 cls);
|
||||
|
||||
template<class T>
|
||||
class DBCStorage
|
||||
{
|
||||
typedef std::list<char*> StringPoolList;
|
||||
public:
|
||||
explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { }
|
||||
~DBCStorage() { Clear(); }
|
||||
|
||||
T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; }
|
||||
uint32 GetNumRows() const { return nCount; }
|
||||
char const* GetFormat() const { return fmt; }
|
||||
uint32 GetFieldCount() const { return fieldCount; }
|
||||
|
||||
bool Load(char const* fn)
|
||||
{
|
||||
DBCFile dbc;
|
||||
// Check if load was sucessful, only then continue
|
||||
if(!dbc.Load(fn, fmt))
|
||||
return false;
|
||||
|
||||
fieldCount = dbc.GetCols();
|
||||
m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable);
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
// error in dbc file at loading if NULL
|
||||
return indexTable!=NULL;
|
||||
}
|
||||
|
||||
bool LoadStringsFrom(char const* fn)
|
||||
{
|
||||
// DBC must be already loaded using Load
|
||||
if(!indexTable)
|
||||
return false;
|
||||
|
||||
DBCFile dbc;
|
||||
// Check if load was successful, only then continue
|
||||
if(!dbc.Load(fn, fmt))
|
||||
return false;
|
||||
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
if (!indexTable)
|
||||
return;
|
||||
|
||||
delete[] ((char*)indexTable);
|
||||
indexTable = NULL;
|
||||
delete[] ((char*)m_dataTable);
|
||||
m_dataTable = NULL;
|
||||
|
||||
while(!m_stringPoolList.empty())
|
||||
{
|
||||
delete[] m_stringPoolList.front();
|
||||
m_stringPoolList.pop_front();
|
||||
}
|
||||
nCount = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 nCount;
|
||||
uint32 fieldCount;
|
||||
char const* fmt;
|
||||
T** indexTable;
|
||||
T* m_dataTable;
|
||||
StringPoolList m_stringPoolList;
|
||||
};
|
||||
|
||||
extern DBCStorage <AchievementEntry> sAchievementStore;
|
||||
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
|
||||
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef DBCSTRUCTURE_H
|
||||
#define DBCSTRUCTURE_H
|
||||
#ifndef MANGOS_DBCSTRUCTURE_H
|
||||
#define MANGOS_DBCSTRUCTURE_H
|
||||
|
||||
#include "DBCEnums.h"
|
||||
#include "Platform/Define.h"
|
||||
|
|
@ -1618,7 +1618,7 @@ struct WorldSafeLocsEntry
|
|||
struct WorldMapOverlayEntry
|
||||
{
|
||||
uint32 ID; // 0
|
||||
uint32 areatableID; // 2
|
||||
uint32 areatableID[4]; // 2-5
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
|
|
@ -16,6 +16,9 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef MANGOS_DBCSFRM_H
|
||||
#define MANGOS_DBCSFRM_H
|
||||
|
||||
const char Achievementfmt[]="niixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxxi";
|
||||
const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiixix";
|
||||
const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxixxxxxxx";
|
||||
|
|
@ -96,4 +99,6 @@ const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifixxx";
|
|||
const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
|
||||
const char WorldMapAreaEntryfmt[]="xinxffffix";
|
||||
const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
|
||||
const char WorldMapOverlayEntryfmt[]="nxixxxxxxxxxxxxxx";
|
||||
const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
|
||||
|
||||
#endif
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "HostilRefManager.h"
|
||||
#include "ThreatManager.h"
|
||||
#include "Unit.h"
|
||||
#include "Database/DBCStructure.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
HostilRefManager::~HostilRefManager()
|
||||
|
|
|
|||
|
|
@ -2066,7 +2066,7 @@ bool ChatHandler::HandleModifyMorphCommand(const char* args)
|
|||
//kick player
|
||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
{
|
||||
if (!args)
|
||||
if (!*args)
|
||||
{
|
||||
Player* player = getSelectedPlayer();
|
||||
|
||||
|
|
|
|||
|
|
@ -3556,7 +3556,7 @@ bool ChatHandler::HandleNpcAllowMovementCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleNpcChangeEntryCommand(const char *args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 newEntryNum = atoi(args);
|
||||
|
|
@ -5047,7 +5047,7 @@ bool ChatHandler::HandleBanIPCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleBanHelper(BanMode mode, const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cnameOrIP = strtok ((char*)args, " ");
|
||||
|
|
@ -5135,7 +5135,7 @@ bool ChatHandler::HandleUnBanIPCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleUnBanHelper(BanMode mode, const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cnameOrIP = strtok ((char*)args, " ");
|
||||
|
|
@ -5178,7 +5178,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, const char* args)
|
|||
|
||||
bool ChatHandler::HandleBanInfoAccountCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cname = strtok((char*)args, "");
|
||||
|
|
@ -5205,7 +5205,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandleBanInfoCharacterCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string name = extractPlayerNameFromLink((char*)args);
|
||||
|
|
@ -5264,7 +5264,7 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
|
|||
|
||||
bool ChatHandler::HandleBanInfoIPCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cIP = strtok ((char*)args, "");
|
||||
|
|
@ -5533,7 +5533,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleGMFlyModeCommand(const char* args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *target = getSelectedPlayer();
|
||||
|
|
@ -5559,7 +5559,7 @@ bool ChatHandler::HandleGMFlyModeCommand(const char* args)
|
|||
|
||||
bool ChatHandler::HandlePDumpLoadCommand(const char *args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char * file = strtok((char*)args, " ");
|
||||
|
|
@ -5670,7 +5670,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args)
|
|||
|
||||
bool ChatHandler::HandlePDumpWriteCommand(const char *args)
|
||||
{
|
||||
if(!args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* file = strtok((char*)args, " ");
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "UpdateMask.h"
|
||||
#include "Unit.h"
|
||||
#include "Language.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
void MailItem::deleteItem( bool inDB )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,6 +97,11 @@ libmangosgame_a_SOURCES = \
|
|||
CreatureAISelector.h \
|
||||
Creature.cpp \
|
||||
Creature.h \
|
||||
DBCEnums.h \
|
||||
DBCfmt.h \
|
||||
DBCStores.cpp \
|
||||
DBCStores.h \
|
||||
DBCStructure.h \
|
||||
debugcmds.cpp \
|
||||
DestinationHolder.cpp \
|
||||
DestinationHolder.h \
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "zthread/Lockable.h"
|
||||
#include "zthread/Mutex.h"
|
||||
#include "zthread/FairReadWriteLock.h"
|
||||
#include "Database/DBCStructure.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "GridDefines.h"
|
||||
#include "Cell.h"
|
||||
#include "Object.h"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "Errors.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "Spell.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellMgr.h"
|
||||
|
|
|
|||
|
|
@ -343,8 +343,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
|||
m_DailyQuestChanged = false;
|
||||
m_lastDailyQuestTime = 0;
|
||||
|
||||
m_regenTimer = 0;
|
||||
m_weaponChangeTimer = 0;
|
||||
for (int i=0; i<MAX_TIMERS; i++)
|
||||
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
|
||||
|
||||
|
|
@ -1098,8 +1096,6 @@ void Player::Update( uint32 p_time )
|
|||
|
||||
UpdateAfkReport(now);
|
||||
|
||||
CheckExploreSystem();
|
||||
|
||||
// Update items that have just a limited lifetime
|
||||
if (now>m_Last_tick)
|
||||
UpdateItemDuration(uint32(now- m_Last_tick));
|
||||
|
|
@ -17454,13 +17450,14 @@ void Player::LeaveBattleground(bool teleportToEntryPoint)
|
|||
{
|
||||
if(BattleGround *bg = GetBattleGround())
|
||||
{
|
||||
bool need_debuf = bg->isBattleGround() && (bg->GetStatus() == STATUS_IN_PROGRESS) && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER);
|
||||
|
||||
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
|
||||
|
||||
// call after remove to be sure that player resurrected for correct cast
|
||||
if(need_debuf)
|
||||
CastSpell(this, 26013, true); // Deserter
|
||||
if( bg->isBattleGround() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) )
|
||||
{
|
||||
if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN )
|
||||
CastSpell(this, 26013, true); // Deserter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "ReputationMgr.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
|
|
@ -198,6 +198,10 @@ void ReputationMgr::SendVisible(FactionState const* faction) const
|
|||
void ReputationMgr::Initilize()
|
||||
{
|
||||
m_factions.clear();
|
||||
m_visibleFactionCount = 0;
|
||||
m_honoredFactionCount = 0;
|
||||
m_reveredFactionCount = 0;
|
||||
m_exaltedFactionCount = 0;
|
||||
|
||||
for(unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
|
||||
{
|
||||
|
|
@ -212,12 +216,17 @@ void ReputationMgr::Initilize()
|
|||
newFaction.Flags = GetDefaultStateFlags(factionEntry);
|
||||
newFaction.Changed = true;
|
||||
|
||||
if( newFaction.Flags & FACTION_FLAG_VISIBLE )
|
||||
++m_visibleFactionCount;
|
||||
|
||||
UpdateRankCounters(REP_HOSTILE,GetBaseRank(factionEntry));
|
||||
|
||||
m_factions[newFaction.ReputationListID] = newFaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
{
|
||||
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
|
||||
if (flist)
|
||||
|
|
@ -227,89 +236,50 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||
{
|
||||
FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr);
|
||||
if(factionEntryCalc)
|
||||
res = SetOneFactionReputation(factionEntryCalc, standing);
|
||||
res = SetOneFactionReputation(factionEntryCalc, standing, incremental);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return SetOneFactionReputation(factionEntry, standing);
|
||||
return SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
}
|
||||
|
||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
{
|
||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||
if (itr != m_factions.end())
|
||||
{
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
|
||||
if(incremental)
|
||||
standing += itr->second.Standing + BaseRep;
|
||||
|
||||
if (standing > Reputation_Cap)
|
||||
standing = Reputation_Cap;
|
||||
else
|
||||
if (standing < Reputation_Bottom)
|
||||
standing = Reputation_Bottom;
|
||||
else if (standing < Reputation_Bottom)
|
||||
standing = Reputation_Bottom;
|
||||
|
||||
ReputationRank old_rank = ReputationToRank(itr->second.Standing + BaseRep);
|
||||
ReputationRank new_rank = ReputationToRank(standing);
|
||||
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
itr->second.Standing = standing - BaseRep;
|
||||
itr->second.Changed = true;
|
||||
|
||||
SetVisible(&itr->second);
|
||||
|
||||
if(ReputationToRank(standing) <= REP_HOSTILE)
|
||||
if(new_rank <= REP_HOSTILE)
|
||||
SetAtWar(&itr->second,true);
|
||||
|
||||
SendState(&itr->second);
|
||||
|
||||
m_player->ReputationChanged(factionEntry);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReputationMgr::ModifyReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
{
|
||||
SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID);
|
||||
if (flist)
|
||||
{
|
||||
bool res = false;
|
||||
for (SimpleFactionsList::const_iterator itr = flist->begin();itr != flist->end();++itr)
|
||||
{
|
||||
FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr);
|
||||
if(factionEntryCalc)
|
||||
res = ModifyOneFactionReputation(factionEntryCalc, standing);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return ModifyOneFactionReputation(factionEntry, standing);
|
||||
}
|
||||
|
||||
bool ReputationMgr::ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
{
|
||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||
if (itr != m_factions.end())
|
||||
{
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
int32 new_rep = BaseRep + itr->second.Standing + standing;
|
||||
|
||||
if (new_rep > Reputation_Cap)
|
||||
new_rep = Reputation_Cap;
|
||||
else
|
||||
if (new_rep < Reputation_Bottom)
|
||||
new_rep = Reputation_Bottom;
|
||||
|
||||
if(ReputationToRank(new_rep) <= REP_HOSTILE)
|
||||
SetAtWar(&itr->second,true);
|
||||
|
||||
itr->second.Standing = new_rep - BaseRep;
|
||||
itr->second.Changed = true;
|
||||
|
||||
SetVisible(&itr->second);
|
||||
SendState(&itr->second);
|
||||
UpdateRankCounters(old_rank, new_rank);
|
||||
|
||||
m_player->ReputationChanged(factionEntry);
|
||||
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION,factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION,factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION,factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION,factionEntry->ID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -350,6 +320,8 @@ void ReputationMgr::SetVisible(FactionState* faction)
|
|||
faction->Flags |= FACTION_FLAG_VISIBLE;
|
||||
faction->Changed = true;
|
||||
|
||||
++m_visibleFactionCount;
|
||||
|
||||
SendVisible(faction);
|
||||
}
|
||||
|
||||
|
|
@ -432,6 +404,12 @@ void ReputationMgr::LoadFromDB(QueryResult *result)
|
|||
// update standing to current
|
||||
faction->Standing = int32(fields[1].GetUInt32());
|
||||
|
||||
// update counters
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
ReputationRank old_rank = ReputationToRank(BaseRep);
|
||||
ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
|
||||
UpdateRankCounters(old_rank,new_rank);
|
||||
|
||||
uint32 dbFactionFlags = fields[2].GetUInt32();
|
||||
|
||||
if( dbFactionFlags & FACTION_FLAG_VISIBLE )
|
||||
|
|
@ -478,3 +456,20 @@ void ReputationMgr::SaveToDB()
|
|||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
|
||||
{
|
||||
if(old_rank >= REP_EXALTED)
|
||||
--m_exaltedFactionCount;
|
||||
if(old_rank >= REP_REVERED)
|
||||
--m_reveredFactionCount;
|
||||
if(old_rank >= REP_HONORED)
|
||||
--m_honoredFactionCount;
|
||||
|
||||
if(new_rank >= REP_EXALTED)
|
||||
++m_exaltedFactionCount;
|
||||
if(new_rank >= REP_REVERED)
|
||||
++m_reveredFactionCount;
|
||||
if(new_rank >= REP_HONORED)
|
||||
++m_honoredFactionCount;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Database/DBCStructure.h"
|
||||
#include "DBCStructure.h"
|
||||
#include <map>
|
||||
|
||||
enum FactionFlags
|
||||
|
|
@ -56,7 +56,8 @@ class QueryResult;
|
|||
class ReputationMgr
|
||||
{
|
||||
public: // constructors and global modifiers
|
||||
explicit ReputationMgr(Player* owner) : m_player(owner) {}
|
||||
explicit ReputationMgr(Player* owner) : m_player(owner),
|
||||
m_visibleFactionCount(0), m_honoredFactionCount(0), m_reveredFactionCount(0), m_exaltedFactionCount(0) {}
|
||||
~ReputationMgr() {}
|
||||
|
||||
void SaveToDB();
|
||||
|
|
@ -68,6 +69,11 @@ class ReputationMgr
|
|||
|
||||
static ReputationRank ReputationToRank(int32 standing);
|
||||
public: // accessors
|
||||
uint8 GetVisibleFactionCount() const { return m_visibleFactionCount; }
|
||||
uint8 GetHonoredFactionCount() const { return m_honoredFactionCount; }
|
||||
uint8 GetReveredFactionCount() const { return m_reveredFactionCount; }
|
||||
uint8 GetExaltedFactionCount() const { return m_exaltedFactionCount; }
|
||||
|
||||
FactionStateList const& GetStateList() const { return m_factions; }
|
||||
|
||||
FactionState const* GetState(FactionEntry const* factionEntry) const
|
||||
|
|
@ -95,8 +101,14 @@ class ReputationMgr
|
|||
}
|
||||
|
||||
public: // modifiers
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing);
|
||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing);
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
{
|
||||
return SetReputation(factionEntry, standing, false);
|
||||
}
|
||||
bool ModifyReputation(FactionEntry const* factionEntry, int32 standing)
|
||||
{
|
||||
return SetReputation(factionEntry, standing, true);
|
||||
}
|
||||
|
||||
void SetVisible(FactionTemplateEntry const* factionTemplateEntry);
|
||||
void SetVisible(FactionEntry const* factionEntry);
|
||||
|
|
@ -114,16 +126,21 @@ class ReputationMgr
|
|||
private: // internal helper functions
|
||||
void Initilize();
|
||||
uint32 GetDefaultStateFlags(const FactionEntry *factionEntry) const;
|
||||
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
|
||||
bool ModifyOneFactionReputation(FactionEntry const* factionEntry, int32 standing);
|
||||
bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
||||
bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental);
|
||||
void SetVisible(FactionState* faction);
|
||||
void SetAtWar(FactionState* faction, bool atWar);
|
||||
void SetInactive(FactionState* faction, bool inactive);
|
||||
void SendVisible(FactionState const* faction) const;
|
||||
void UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank );
|
||||
private:
|
||||
Player* m_player;
|
||||
FactionStateList m_factions;
|
||||
ForcedReactions m_forcedReactions;
|
||||
uint8 m_visibleFactionCount :8;
|
||||
uint8 m_honoredFactionCount :8;
|
||||
uint8 m_reveredFactionCount :8;
|
||||
uint8 m_exaltedFactionCount :8;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "SpellAuraDefines.h"
|
||||
#include "ProgressBar.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "World.h"
|
||||
#include "Chat.h"
|
||||
#include "Spell.h"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
// For more high level function for sSpellStore data
|
||||
|
||||
#include "SharedDefines.h"
|
||||
#include "Database/DBCStructure.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "Database/SQLStorage.h"
|
||||
|
||||
#include "Utilities/UnorderedMap.h"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "TotemAI.h"
|
||||
#include "Totem.h"
|
||||
#include "Creature.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "Path.h"
|
||||
|
||||
#include "WorldPacket.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
void MapManager::LoadTransports()
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "FollowerRefManager.h"
|
||||
#include "Utilities/EventProcessor.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "Database/DBCStructure.h"
|
||||
#include "DBCStructure.h"
|
||||
#include <list>
|
||||
|
||||
enum SpellInterruptFlags
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "Database/DBCStores.h"
|
||||
#include "DBCStores.h"
|
||||
#include "LootMgr.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "MapManager.h"
|
||||
|
|
@ -1367,8 +1367,8 @@ void World::SetInitialWorldSettings()
|
|||
sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
|
||||
|
||||
WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)",
|
||||
isoDate, uint64(m_startTime));
|
||||
loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)",
|
||||
realmID, uint64(m_startTime), isoDate);
|
||||
|
||||
m_timers[WUPDATE_OBJECTS].SetInterval(0);
|
||||
m_timers[WUPDATE_SESSIONS].SetInterval(0);
|
||||
|
|
@ -1534,10 +1534,10 @@ void World::Update(uint32 diff)
|
|||
if (m_timers[WUPDATE_UPTIME].Passed())
|
||||
{
|
||||
uint32 tmpDiff = (m_gameTime - m_startTime);
|
||||
uint32 maxClientsNum = sWorld.GetMaxActiveSessionCount();
|
||||
uint32 maxClientsNum = GetMaxActiveSessionCount();
|
||||
|
||||
m_timers[WUPDATE_UPTIME].Reset();
|
||||
WorldDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime));
|
||||
loginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " I64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime));
|
||||
}
|
||||
|
||||
/// <li> Handle all other objects
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dbcfile.h"
|
||||
#include "DBCFileLoader.h"
|
||||
|
||||
DBCFile::DBCFile()
|
||||
DBCFileLoader::DBCFileLoader()
|
||||
{
|
||||
data = NULL;
|
||||
fieldsOffset = NULL;
|
||||
}
|
||||
|
||||
bool DBCFile::Load(const char *filename, const char *fmt)
|
||||
bool DBCFileLoader::Load(const char *filename, const char *fmt)
|
||||
{
|
||||
|
||||
uint32 header;
|
||||
|
|
@ -89,7 +89,7 @@ bool DBCFile::Load(const char *filename, const char *fmt)
|
|||
return true;
|
||||
}
|
||||
|
||||
DBCFile::~DBCFile()
|
||||
DBCFileLoader::~DBCFileLoader()
|
||||
{
|
||||
if(data)
|
||||
delete [] data;
|
||||
|
|
@ -97,13 +97,13 @@ DBCFile::~DBCFile()
|
|||
delete [] fieldsOffset;
|
||||
}
|
||||
|
||||
DBCFile::Record DBCFile::getRecord(size_t id)
|
||||
DBCFileLoader::Record DBCFileLoader::getRecord(size_t id)
|
||||
{
|
||||
assert(data);
|
||||
return Record(*this, data + id*recordSize);
|
||||
}
|
||||
|
||||
uint32 DBCFile::GetFormatRecordSize(const char * format,int32* index_pos)
|
||||
uint32 DBCFileLoader::GetFormatRecordSize(const char * format,int32* index_pos)
|
||||
{
|
||||
uint32 recordsize = 0;
|
||||
int32 i = -1;
|
||||
|
|
@ -135,7 +135,7 @@ uint32 DBCFile::GetFormatRecordSize(const char * format,int32* index_pos)
|
|||
return recordsize;
|
||||
}
|
||||
|
||||
char* DBCFile::AutoProduceData(const char* format, uint32& records, char**& indexTable)
|
||||
char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**& indexTable)
|
||||
{
|
||||
/*
|
||||
format STRING, NA, FLOAT,NA,INT <=>
|
||||
|
|
@ -218,7 +218,7 @@ char* DBCFile::AutoProduceData(const char* format, uint32& records, char**& inde
|
|||
return dataTable;
|
||||
}
|
||||
|
||||
char* DBCFile::AutoProduceStrings(const char* format, char* dataTable)
|
||||
char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
|
||||
{
|
||||
if(strlen(format)!=fieldCount)
|
||||
return NULL;
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef DBCFILE_H
|
||||
#define DBCFILE_H
|
||||
#ifndef DBC_FILE_LOADER_H
|
||||
#define DBC_FILE_LOADER_H
|
||||
#include "Platform/Define.h"
|
||||
#include "Utilities/ByteConverter.h"
|
||||
#include <cassert>
|
||||
|
|
@ -35,11 +35,11 @@ enum
|
|||
FT_LOGIC='l' //Logical (boolean)
|
||||
};
|
||||
|
||||
class DBCFile
|
||||
class DBCFileLoader
|
||||
{
|
||||
public:
|
||||
DBCFile();
|
||||
~DBCFile();
|
||||
DBCFileLoader();
|
||||
~DBCFileLoader();
|
||||
|
||||
bool Load(const char *filename, const char *fmt);
|
||||
|
||||
|
|
@ -75,11 +75,11 @@ class DBCFile
|
|||
}
|
||||
|
||||
private:
|
||||
Record(DBCFile &file_, unsigned char *offset_): offset(offset_), file(file_) {}
|
||||
Record(DBCFileLoader &file_, unsigned char *offset_): offset(offset_), file(file_) {}
|
||||
unsigned char *offset;
|
||||
DBCFile &file;
|
||||
DBCFileLoader &file;
|
||||
|
||||
friend class DBCFile;
|
||||
friend class DBCFileLoader;
|
||||
|
||||
};
|
||||
|
||||
94
src/shared/Database/DBCStore.h
Normal file
94
src/shared/Database/DBCStore.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef DBCSTORE_H
|
||||
#define DBCSTORE_H
|
||||
|
||||
#include "DBCFileLoader.h"
|
||||
|
||||
template<class T>
|
||||
class DBCStorage
|
||||
{
|
||||
typedef std::list<char*> StringPoolList;
|
||||
public:
|
||||
explicit DBCStorage(const char *f) : nCount(0), fieldCount(0), fmt(f), indexTable(NULL), m_dataTable(NULL) { }
|
||||
~DBCStorage() { Clear(); }
|
||||
|
||||
T const* LookupEntry(uint32 id) const { return (id>=nCount)?NULL:indexTable[id]; }
|
||||
uint32 GetNumRows() const { return nCount; }
|
||||
char const* GetFormat() const { return fmt; }
|
||||
uint32 GetFieldCount() const { return fieldCount; }
|
||||
|
||||
bool Load(char const* fn)
|
||||
{
|
||||
DBCFileLoader dbc;
|
||||
// Check if load was sucessful, only then continue
|
||||
if(!dbc.Load(fn, fmt))
|
||||
return false;
|
||||
|
||||
fieldCount = dbc.GetCols();
|
||||
m_dataTable = (T*)dbc.AutoProduceData(fmt,nCount,(char**&)indexTable);
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
// error in dbc file at loading if NULL
|
||||
return indexTable!=NULL;
|
||||
}
|
||||
|
||||
bool LoadStringsFrom(char const* fn)
|
||||
{
|
||||
// DBC must be already loaded using Load
|
||||
if(!indexTable)
|
||||
return false;
|
||||
|
||||
DBCFileLoader dbc;
|
||||
// Check if load was successful, only then continue
|
||||
if(!dbc.Load(fn, fmt))
|
||||
return false;
|
||||
|
||||
m_stringPoolList.push_back(dbc.AutoProduceStrings(fmt,(char*)m_dataTable));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
if (!indexTable)
|
||||
return;
|
||||
|
||||
delete[] ((char*)indexTable);
|
||||
indexTable = NULL;
|
||||
delete[] ((char*)m_dataTable);
|
||||
m_dataTable = NULL;
|
||||
|
||||
while(!m_stringPoolList.empty())
|
||||
{
|
||||
delete[] m_stringPoolList.front();
|
||||
m_stringPoolList.pop_front();
|
||||
}
|
||||
nCount = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 nCount;
|
||||
uint32 fieldCount;
|
||||
char const* fmt;
|
||||
T** indexTable;
|
||||
T* m_dataTable;
|
||||
StringPoolList m_stringPoolList;
|
||||
};
|
||||
#endif
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
#include "Log.h"
|
||||
#include "Errors.h"
|
||||
|
||||
#include "Database/DBCStores.h"
|
||||
#include "Database/Field.h"
|
||||
#include "Database/QueryResult.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,9 @@ AM_CPPFLAGS = $(MANGOS_INCLUDES) -I$(top_builddir)/src/shared -I$(srcdir) -I$(sr
|
|||
noinst_LIBRARIES = libmangosdatabase.a
|
||||
|
||||
libmangosdatabase_a_SOURCES = \
|
||||
DBCStores.cpp \
|
||||
DBCStores.h \
|
||||
DBCStructure.h \
|
||||
DBCfmt.cpp \
|
||||
DBCFileLoader.cpp \
|
||||
DBCFileLoader.h \
|
||||
DBCStore.h \
|
||||
Database.cpp \
|
||||
Database.h \
|
||||
DatabaseEnv.h \
|
||||
|
|
@ -59,6 +58,4 @@ libmangosdatabase_a_SOURCES = \
|
|||
SqlDelayThread.cpp \
|
||||
SqlDelayThread.h \
|
||||
SqlOperations.cpp \
|
||||
SqlOperations.h \
|
||||
dbcfile.cpp \
|
||||
dbcfile.h
|
||||
SqlOperations.h
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "ProgressBar.h"
|
||||
#include "Log.h"
|
||||
#include "dbcfile.h"
|
||||
#include "DBCFileLoader.h"
|
||||
|
||||
template<class T>
|
||||
template<class S, class D>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7542"
|
||||
#define REVISION_NR "7552"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -798,6 +798,21 @@
|
|||
</Filter>
|
||||
<Filter
|
||||
Name="Server">
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCEnums.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCfmt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStructure.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GlobalEvents.cpp">
|
||||
</File>
|
||||
|
|
|
|||
|
|
@ -198,37 +198,13 @@
|
|||
<Filter
|
||||
Name="DataStores">
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCEnums.h">
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp">
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStructure.h">
|
||||
RelativePath="..\..\src\shared\Database\DBCStore.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
|
|
|
|||
|
|
@ -1238,6 +1238,26 @@
|
|||
<Filter
|
||||
Name="Server"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCEnums.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCfmt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStructure.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -440,63 +440,15 @@
|
|||
Name="DataStores"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCEnums.h"
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp"
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStructure.h"
|
||||
RelativePath="..\..\src\shared\Database\DBCStore.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
|
|
|||
|
|
@ -1240,6 +1240,26 @@
|
|||
<Filter
|
||||
Name="Server"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCEnums.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCfmt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStores.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\DBCStructure.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\GlobalEvents.cpp"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -444,63 +444,15 @@
|
|||
Name="DataStores"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCEnums.h"
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.cpp"
|
||||
RelativePath="..\..\src\shared\Database\DBCFileLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\dbcfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCfmt.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStores.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\shared\Database\DBCStructure.h"
|
||||
RelativePath="..\..\src\shared\Database\DBCStore.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue