[0016] Some Clean from last Commits.

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-08 09:02:10 +02:00 committed by Antz
parent b3d9910009
commit 6818d688a9
6 changed files with 42 additions and 40 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `realmd_db_version`;
CREATE TABLE `realmd_db_version` (
`required_00014_01_realmd_account_access` bit(1) default NULL
`required_0014_xxxxx_01_realmd_account_access` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@ -86,7 +86,7 @@ CREATE TABLE `account_access` (
`gmlevel` tinyint(3) unsigned NOT NULL,
`RealmID` int(11) NOT NULL DEFAULT '-1',
PRIMARY KEY (`id`,`RealmID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `account_access`

View file

@ -1,3 +0,0 @@
ALTER TABLE realmd_db_version CHANGE COLUMN required_00014_01_realmd_account_access required_00014_02_realmd_account BIT;
ALTER TABLE `account` DROP `gmlevel`;

View file

@ -1,8 +1,6 @@
ALTER TABLE realmd_db_version CHANGE COLUMN required_0001_xxxxx_01_realmd required_00014_01_realmd_account_access bit;
ALTER TABLE realmd_db_version CHANGE COLUMN required_0001_xxxxx_01_realmd required_0014_xxxxx_01_realmd_account_access bit;
--
-- Table Stucture for table `account `account_access`
--
ALTER TABLE `account` DROP `gmlevel`;
DROP TABLE IF EXISTS `account_access`;
@ -12,3 +10,9 @@ CREATE TABLE `account_access` (
`RealmID` int(11) NOT NULL DEFAULT '-1',
PRIMARY KEY (`id`,`RealmID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `account_access` VALUES
(1,3,-1),
(2,2,-1),
(3,1,-1),
(4,0,-1);

View file

@ -1143,7 +1143,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
return false;
int32 gm;
uint32 gmRealmID = realmID;
uint32 gmRealmID = realmID;
if (!ExtractInt32(&args, gm))
return false;
@ -1167,13 +1167,13 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
SetSentErrorMessage(true);
return false;
}
// Check if provided realmID is not current realmID, or isn't -1
if (gmRealmID != realmID && gmRealmID != -1)
{
SendSysMessage(LANG_INVALID_REALMID);
SetSentErrorMessage(true);
return false;
}
/// check if provided realmID is not current realmID, or isn't -1
if (gmRealmID != realmID && gmRealmID != -1)
{
SendSysMessage(LANG_INVALID_REALMID);
SetSentErrorMessage(true);
return false;
}
if (targetPlayer)
{
@ -1182,19 +1182,20 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
}
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
if (gmRealmID == -1)
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u'", targetAccountId);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', -1)", targetAccountId, gm);
}
else
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND RealmID = '%d'", targetAccountId, realmID);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u','%d','%d')", targetAccountId, gm, realmID);
}
//LoginDatabase.PExecute("UPDATE account_access SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId);
/// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
if (gmRealmID == -1)
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u'", targetAccountId);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u', '%d', -1)", targetAccountId, gm);
}
else
{
LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND RealmID = '%d'", targetAccountId, realmID);
LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u','%d','%d')", targetAccountId, gm, realmID);
}
return true;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "0015"
#define REVISION_NR "0016"
#endif // __REVISION_NR_H__

View file

@ -2,5 +2,5 @@
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_0001_xxxxx_01_characters"
#define REVISION_DB_MANGOS "required_0001_xxxxx_01_mangos"
#define REVISION_DB_REALMD "required_00014_02_realmd_account"
#define REVISION_DB_REALMD "required_0014_xxxxx_01_realmd_account_access"
#endif // __REVISION_SQL_H__