forked from OpenKore/openkore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetwork.pm
More file actions
53 lines (48 loc) · 1.99 KB
/
Network.pm
File metadata and controls
53 lines (48 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#########################################################################
# OpenKore - Networking subsystem
# This module contains functions for sending packets to the server.
#
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#
# $Revision$
# $Id$
#
#########################################################################
package Network;
use strict;
use Modules 'register';
# $conState contains the connection state:
# 1: Not connected to anything (next step -> connect to master server).
# 2: Connected to master server (next step -> connect to login server)
# 3: Connected to login server (next step -> connect to character server)
# 4: Connected to character server (next step -> connect to map server)
# 5: Connected to map server; ready and functional.
#
# Special states:
# 1.2 (set by $config{gameGuard} == 2): Wait for the server response allowing us
# to continue login
# 1.3 (set by parseMsg()): The server allowed us to continue logging in, continue
# where we left off
# 1.5 (set by plugins): There is a special sequence for login servers and we must
# wait the plugins to finalize before continuing
# 2.5 (set by parseMsg()): Just passed character selection; next 4 bytes will be
# the account ID
use constant {
NOT_CONNECTED => 1,
CONNECTED_TO_MASTER_SERVER => 2,
CONNECTED_TO_LOGIN_SERVER => 3,
CONNECTED_TO_CHAR_SERVER => 4,
IN_GAME => 5,
# This can only happen if we're in XKore or XKoreProxy mode.
# It means that the RO client is already logged in the game
# before OpenKore did. Because of this, OpenKore does not have
# enough information (such as the character's name) to be able to
# work properly.
IN_GAME_BUT_UNINITIALIZED => -1
};
1;