[9748] Fixed startup problems after recent realmd DB.

This commit is contained in:
VladimirMangos 2010-04-14 16:11:23 +04:00
parent dbfb1fc8ef
commit 92b11459b1
10 changed files with 39 additions and 26 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `realmd_db_version`;
CREATE TABLE `realmd_db_version` (
`required_9746_01_realmd_realmlist` bit(1) default NULL
`required_9748_01_realmd_realmlist` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@ -157,7 +157,7 @@ CREATE TABLE `realmlist` (
`address` varchar(32) NOT NULL default '127.0.0.1',
`port` int(11) NOT NULL default '8085',
`icon` tinyint(3) unsigned NOT NULL default '0',
`realmflags` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Supported masks: 0x1 (invalid, not show in realm list), 0x4 (show version and build), 0x20 (new players), 0x40 (recommended)',
`realmflags` tinyint(3) unsigned NOT NULL default '2' COMMENT 'Supported masks: 0x1 (invalid, not show in realm list), 0x2 (offline, set by mangosd), 0x4 (show version and build), 0x20 (new players), 0x40 (recommended)',
`timezone` tinyint(3) unsigned NOT NULL default '0',
`allowedSecurityLevel` tinyint(3) unsigned NOT NULL default '0',
`population` float unsigned NOT NULL default '0',

View file

@ -0,0 +1,12 @@
ALTER TABLE realmd_db_version CHANGE COLUMN required_9746_01_realmd_realmlist required_9748_01_realmd_realmlist bit;
ALTER TABLE realmlist
CHANGE COLUMN realmflags realmflags tinyint(3) unsigned NOT NULL default '2'
COMMENT 'Supported masks: 0x1 (invalid, not show in realm list), 0x2 (offline, set by mangosd), 0x4 (show version and build), 0x20 (new players), 0x40 (recommended)';
UPDATE realmlist
SET realmflags = realmflags & ~(0x01 | 0x04 | 0x20 | 0x40) ;
UPDATE realmlist
SET realmflags = realmflags | 0x02;

View file

@ -120,6 +120,7 @@ pkgdata_DATA = \
9735_02_mangos_spell_chain.sql \
9746_01_realmd_realmlist.sql \
9747_01_mangos_battleground_template.sql \
9748_01_realmd_realmlist.sql \
README
## Additional files to include when running 'make dist'
@ -220,4 +221,5 @@ EXTRA_DIST = \
9735_02_mangos_spell_chain.sql \
9746_01_realmd_realmlist.sql \
9747_01_mangos_battleground_template.sql \
9748_01_realmd_realmlist.sql \
README

View file

@ -1985,7 +1985,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
spellProto->Id == 60218) // Essence of Gossamer
{
// Max absorb stored in 1 dummy effect
uint32 max_absorb = spellProto->CalculateSimpleValue(EFFECT_INDEX_1);
int32 max_absorb = spellProto->CalculateSimpleValue(EFFECT_INDEX_1);
if (max_absorb < currentAbsorb)
currentAbsorb = max_absorb;
break;

View file

@ -218,7 +218,7 @@ int Master::Run()
{
std::string builds = AcceptableClientBuildsListStr();
loginDatabase.escape_string(builds);
loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0, realmbuilds = '%s' WHERE id = '%d'", builds.c_str(), realmID);
loginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
}
ACE_Based::Thread* cliThread = NULL;
@ -337,7 +337,7 @@ int Master::Run()
}
///- Set server offline in realmlist
loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
loginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
///- Remove signal handling before leaving
_UnhookSignals();

View file

@ -82,8 +82,6 @@ void RealmList::Initialize(uint32 updateInterval)
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const char* builds)
{
realmflags = RealmFlags(realmflags | REALM_FLAG_SPECIFYBUILD);
///- Create new if not exist or update existed
Realm& realm = m_realms[name];
@ -155,10 +153,10 @@ void RealmList::UpdateRealms(bool init)
uint8 realmflags = fields[5].GetUInt8();
if (realmflags & ~(REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD))
if (realmflags & ~(REALM_FLAG_OFFLINE|REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD))
{
sLog.outError("Realm allowed have only NEWPLAYERS (mask 0x20), or RECOMENDED (mask 0x40), or SPECIFICBUILD (mask 0x04) flags in DB");
realmflags &= (REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD);
sLog.outError("Realm allowed have only OFFLINE Mask 0x2), or NEWPLAYERS (mask 0x20), or RECOMENDED (mask 0x40), or SPECIFICBUILD (mask 0x04) flags in DB");
realmflags &= (REALM_FLAG_OFFLINE|REALM_FLAG_NEW_PLAYERS|REALM_FLAG_RECOMMENDED|REALM_FLAG_SPECIFYBUILD);
}
UpdateRealm(

View file

@ -25,19 +25,6 @@
#include "Common.h"
enum RealmFlags
{
REALM_FLAG_NONE = 0x00,
REALM_FLAG_INVALID = 0x01,
REALM_FLAG_OFFLINE = 0x02,
REALM_FLAG_SPECIFYBUILD = 0x04, // client will show realm version in RealmList screen in form "RealmName (major.minor.revision.build)"
REALM_FLAG_UNK1 = 0x08,
REALM_FLAG_UNK2 = 0x10,
REALM_FLAG_NEW_PLAYERS = 0x20,
REALM_FLAG_RECOMMENDED = 0x40,
REALM_FLAG_FULL = 0x80
};
struct RealmBuildInfo
{
int build;

View file

@ -179,6 +179,20 @@ enum AccountTypes
SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also
};
// Used in mangosd/realmd
enum RealmFlags
{
REALM_FLAG_NONE = 0x00,
REALM_FLAG_INVALID = 0x01,
REALM_FLAG_OFFLINE = 0x02,
REALM_FLAG_SPECIFYBUILD = 0x04, // client will show realm version in RealmList screen in form "RealmName (major.minor.revision.build)"
REALM_FLAG_UNK1 = 0x08,
REALM_FLAG_UNK2 = 0x10,
REALM_FLAG_NEW_PLAYERS = 0x20,
REALM_FLAG_RECOMMENDED = 0x40,
REALM_FLAG_FULL = 0x80
};
enum LocaleConstant
{
LOCALE_enUS = 0, // also enGB

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9747"
#define REVISION_NR "9748"
#endif // __REVISION_NR_H__

View file

@ -2,5 +2,5 @@
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9702_01_characters_item"
#define REVISION_DB_MANGOS "required_9747_01_mangos_battleground_template"
#define REVISION_DB_REALMD "required_9746_01_realmd_realmlist"
#define REVISION_DB_REALMD "required_9748_01_realmd_realmlist"
#endif // __REVISION_SQL_H__