Package horizons :: Package network :: Package packets :: Module server
[hide private]
[frames] | no frames]

Source Code for Module horizons.network.packets.server

 1  # ################################################### 
 2  # Copyright (C) 2008-2017 The Unknown Horizons Team 
 3  # team@unknown-horizons.org 
 4  # This file is part of Unknown Horizons. 
 5  # 
 6  # Unknown Horizons is free software; you can redistribute it and/or modify 
 7  # it under the terms of the GNU General Public License as published by 
 8  # the Free Software Foundation; either version 2 of the License, or 
 9  # (at your option) any later version. 
10  # 
11  # This program is distributed in the hope that it will be useful, 
12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  # GNU General Public License for more details. 
15  # 
16  # You should have received a copy of the GNU General Public License 
17  # along with this program; if not, write to the 
18  # Free Software Foundation, Inc., 
19  # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
20  # ################################################### 
21   
22  from horizons.network.packets import SafeUnpickler, packet 
23   
24   
25 -class cmd_session(packet):
26 - def __init__(self, sid, capabilities):
27 self.sid = sid 28 self.capabilities = capabilities
29 30 31 SafeUnpickler.add('server', cmd_session) 32 33 34 #-------------------------------------------------------------------------------
35 -class data_gameslist(packet):
36 - def __init__(self):
37 self.games = []
38
39 - def addgame(self, game):
40 newgame = game.make_public_copy() 41 self.games.append(newgame)
42 43 44 SafeUnpickler.add('server', data_gameslist) 45 46 47 #-------------------------------------------------------------------------------
48 -class data_gamestate(packet):
49 - def __init__(self, game):
50 self.game = game
51 52 53 SafeUnpickler.add('server', data_gamestate) 54 55 56 #-------------------------------------------------------------------------------
57 -class cmd_chatmsg(packet):
58 - def __init__(self, playername, msg):
59 self.playername = playername 60 self.chatmsg = msg
61 62 63 SafeUnpickler.add('server', cmd_chatmsg) 64 65 66 #-------------------------------------------------------------------------------
67 -class cmd_preparegame(packet):
68 - def __init__(self):
69 """prepare game packet"""
70 71 72 SafeUnpickler.add('server', cmd_preparegame) 73 74 75 #-------------------------------------------------------------------------------
76 -class cmd_startgame(packet):
77 - def __init__(self):
78 """start game packet"""
79 80 81 SafeUnpickler.add('server', cmd_startgame) 82 83 84 #-------------------------------------------------------------------------------
85 -class cmd_kickplayer(packet):
86 - def __init__(self, player):
87 self.player = player
88 89 90 SafeUnpickler.add('server', cmd_kickplayer) 91