Skip to content

Commit 3d70f4e

Browse files
authored
Merge pull request #18 from azerothcore/sudlud-pach-42-5
fix codestyle, sql to utf8mb4 and add enabled hook lists for performa…
2 parents dea434a + 6793aa2 commit 3d70f4e

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

data/sql/db-characters/updates/mko_map_exploit.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ CREATE TABLE IF NOT EXISTS `mod_mko_map_exploit` (
22
`accountId` INT UNSIGNED NOT NULL,
33
`count` SMALLINT(6) UNSIGNED DEFAULT 0,
44
PRIMARY KEY (`accountId`)
5-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
5+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

data/sql/db-world/updates/mko_map_lock.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ CREATE TABLE IF NOT EXISTS `mod_mko_map_lock` (
33
`zoneID` smallint(6) UNSIGNED DEFAULT NULL,
44
`comment` varchar(255) DEFAULT '',
55
CONSTRAINT `MKO_Map` UNIQUE (`mapId`, `zoneID`)
6-
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
6+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

src/mod-keepout.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
#include "AccountMgr.h"
2+
#include "Chat.h"
13
#include "Configuration/Config.h"
2-
#include "Player.h"
34
#include "Creature.h"
4-
#include "AccountMgr.h"
5-
#include "ScriptMgr.h"
65
#include "Define.h"
76
#include "GossipDef.h"
8-
#include "Chat.h"
7+
#include "Player.h"
8+
#include "ScriptMgr.h"
99

1010
struct MKO
1111
{
@@ -55,9 +55,7 @@ void checkZoneKeepOut(Player* player)
5555
CharacterDatabase.Execute("INSERT INTO `mod_mko_map_exploit` (`accountId`, `count`) VALUES ({}, {})", accountId, countWarnings);
5656

5757
if (mko.teleportEnabled)
58-
{
5958
teleportPlayer(player);
60-
}
6159
}
6260
else
6361
{
@@ -71,47 +69,42 @@ void checkZoneKeepOut(Player* player)
7169
else
7270
{
7371
if (mko.teleportEnabled && !mko.kickEnabled)
74-
{
7572
teleportPlayer(player);
76-
}
7773
else if (mko.kickEnabled)
78-
{
7974
player->GetSession()->KickPlayer("MKO: Entering a place not allowed.", true);
80-
}
8175
else
82-
{
8376
ChatHandler(player->GetSession()).PSendSysMessage("You have gone to a forbidden place your actions have been logged.");
84-
}
8577
}
8678
}
8779
}
8880

8981
class KeepOutPlayerScript : public PlayerScript
9082
{
9183
public:
92-
KeepOutPlayerScript() : PlayerScript("KeepOutPlayerScript") { }
84+
KeepOutPlayerScript() : PlayerScript("KeepOutPlayerScript", {
85+
PLAYERHOOK_ON_LOGIN,
86+
PLAYERHOOK_ON_UPDATE_ZONE
87+
}) { }
9388

9489
void OnPlayerLogin(Player* player) override
9590
{
9691
if (sConfigMgr->GetOption<bool>("Announcer.Enable", true))
97-
{
9892
ChatHandler(player->GetSession()).PSendSysMessage("This server is running the |cff4CFF00Keep Out |rmodule.");
99-
}
10093
}
10194

10295
void OnPlayerUpdateZone(Player* player, uint32 /*newZone*/, uint32 /*newArea*/) override
10396
{
10497
if (mko.keepOutEnabled)
105-
{
10698
checkZoneKeepOut(player);
107-
}
10899
}
109100
};
110101

111102
class KeepOutWorldScript : public WorldScript
112103
{
113104
public:
114-
KeepOutWorldScript() : WorldScript("KeepOutWorldScript") { }
105+
KeepOutWorldScript() : WorldScript("KeepOutWorldScript", {
106+
WORLDHOOK_ON_BEFORE_CONFIG_LOAD
107+
}) { }
115108

116109
void OnBeforeConfigLoad(bool reload) override
117110
{

0 commit comments

Comments
 (0)