1
+ #include " AccountMgr.h"
2
+ #include " Chat.h"
1
3
#include " Configuration/Config.h"
2
- #include " Player.h"
3
4
#include " Creature.h"
4
- #include " AccountMgr.h"
5
- #include " ScriptMgr.h"
6
5
#include " Define.h"
7
6
#include " GossipDef.h"
8
- #include " Chat.h"
7
+ #include " Player.h"
8
+ #include " ScriptMgr.h"
9
9
10
10
struct MKO
11
11
{
@@ -55,9 +55,7 @@ void checkZoneKeepOut(Player* player)
55
55
CharacterDatabase.Execute (" INSERT INTO `mod_mko_map_exploit` (`accountId`, `count`) VALUES ({}, {})" , accountId, countWarnings);
56
56
57
57
if (mko.teleportEnabled )
58
- {
59
58
teleportPlayer (player);
60
- }
61
59
}
62
60
else
63
61
{
@@ -71,47 +69,42 @@ void checkZoneKeepOut(Player* player)
71
69
else
72
70
{
73
71
if (mko.teleportEnabled && !mko.kickEnabled )
74
- {
75
72
teleportPlayer (player);
76
- }
77
73
else if (mko.kickEnabled )
78
- {
79
74
player->GetSession ()->KickPlayer (" MKO: Entering a place not allowed." , true );
80
- }
81
75
else
82
- {
83
76
ChatHandler (player->GetSession ()).PSendSysMessage (" You have gone to a forbidden place your actions have been logged." );
84
- }
85
77
}
86
78
}
87
79
}
88
80
89
81
class KeepOutPlayerScript : public PlayerScript
90
82
{
91
83
public:
92
- KeepOutPlayerScript () : PlayerScript(" KeepOutPlayerScript" ) { }
84
+ KeepOutPlayerScript () : PlayerScript(" KeepOutPlayerScript" , {
85
+ PLAYERHOOK_ON_LOGIN,
86
+ PLAYERHOOK_ON_UPDATE_ZONE
87
+ }) { }
93
88
94
89
void OnPlayerLogin (Player* player) override
95
90
{
96
91
if (sConfigMgr ->GetOption <bool >(" Announcer.Enable" , true ))
97
- {
98
92
ChatHandler (player->GetSession ()).PSendSysMessage (" This server is running the |cff4CFF00Keep Out |rmodule." );
99
- }
100
93
}
101
94
102
95
void OnPlayerUpdateZone (Player* player, uint32 /* newZone*/ , uint32 /* newArea*/ ) override
103
96
{
104
97
if (mko.keepOutEnabled )
105
- {
106
98
checkZoneKeepOut (player);
107
- }
108
99
}
109
100
};
110
101
111
102
class KeepOutWorldScript : public WorldScript
112
103
{
113
104
public:
114
- KeepOutWorldScript () : WorldScript(" KeepOutWorldScript" ) { }
105
+ KeepOutWorldScript () : WorldScript(" KeepOutWorldScript" , {
106
+ WORLDHOOK_ON_BEFORE_CONFIG_LOAD
107
+ }) { }
115
108
116
109
void OnBeforeConfigLoad (bool reload) override
117
110
{
0 commit comments