mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[0016] Some Clean from last Commits.
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
c7b2b311d8
commit
f8a7533a92
6 changed files with 42 additions and 40 deletions
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `realmd_db_version`;
|
DROP TABLE IF EXISTS `realmd_db_version`;
|
||||||
CREATE TABLE `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';
|
) 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,
|
`gmlevel` tinyint(3) unsigned NOT NULL,
|
||||||
`RealmID` int(11) NOT NULL DEFAULT '-1',
|
`RealmID` int(11) NOT NULL DEFAULT '-1',
|
||||||
PRIMARY KEY (`id`,`RealmID`)
|
PRIMARY KEY (`id`,`RealmID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `account_access`
|
-- Dumping data for table `account_access`
|
||||||
|
|
|
||||||
|
|
@ -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`;
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
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;
|
||||||
|
|
||||||
--
|
ALTER TABLE `account` DROP `gmlevel`;
|
||||||
-- Table Stucture for table `account `account_access`
|
|
||||||
--
|
DROP TABLE IF EXISTS `account_access`;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `account_access`;
|
CREATE TABLE `account_access` (
|
||||||
|
`id` int(10) unsigned NOT NULL,
|
||||||
CREATE TABLE `account_access` (
|
`gmlevel` tinyint(3) unsigned NOT NULL,
|
||||||
`id` int(10) unsigned NOT NULL,
|
`RealmID` int(11) NOT NULL DEFAULT '-1',
|
||||||
`gmlevel` tinyint(3) unsigned NOT NULL,
|
PRIMARY KEY (`id`,`RealmID`)
|
||||||
`RealmID` int(11) NOT NULL DEFAULT '-1',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
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);
|
||||||
|
|
@ -1143,7 +1143,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int32 gm;
|
int32 gm;
|
||||||
uint32 gmRealmID = realmID;
|
uint32 gmRealmID = realmID;
|
||||||
if (!ExtractInt32(&args, gm))
|
if (!ExtractInt32(&args, gm))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1167,13 +1167,13 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check if provided realmID is not current realmID, or isn't -1
|
/// check if provided realmID is not current realmID, or isn't -1
|
||||||
if (gmRealmID != realmID && gmRealmID != -1)
|
if (gmRealmID != realmID && gmRealmID != -1)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_INVALID_REALMID);
|
SendSysMessage(LANG_INVALID_REALMID);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetPlayer)
|
if (targetPlayer)
|
||||||
{
|
{
|
||||||
|
|
@ -1182,19 +1182,20 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
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);
|
//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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "0015"
|
#define REVISION_NR "0016"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
#define __REVISION_SQL_H__
|
#define __REVISION_SQL_H__
|
||||||
#define REVISION_DB_CHARACTERS "required_0001_xxxxx_01_characters"
|
#define REVISION_DB_CHARACTERS "required_0001_xxxxx_01_characters"
|
||||||
#define REVISION_DB_MANGOS "required_0001_xxxxx_01_mangos"
|
#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__
|
#endif // __REVISION_SQL_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue