From 1a9f49f5e9764ac9dba1b39072b7e0bec9b1e351 Mon Sep 17 00:00:00 2001 From: steev Date: Mon, 15 Jan 2024 10:26:14 +0100 Subject: [PATCH] theoretically reworked packet structure for gamestart event + fixed client issue flooding the server with packets --- Game Server/Classes/Game/Player.py | 1 - Game Server/Classes/System/GameManager.py | 28 ++++-- .../Classes/System/Network/NetworkManger.py | 3 + .../__pycache__/NetworkManger.cpython-312.pyc | Bin 10000 -> 10348 bytes .../__pycache__/GameManager.cpython-312.pyc | Bin 4142 -> 4476 bytes Game Server/log/nlwaonqh.log | 83 ++++++++++++++++++ Game Server/log/ylpfvlxp.log | 30 +++++++ Game Server/log/zscmixee.log | 30 +++++++ .../Cards/__pycache__/Card.cpython-311.pyc | Bin 6048 -> 6044 bytes .../__pycache__/MonsterCard.cpython-311.pyc | Bin 5661 -> 5657 bytes .../__pycache__/SpellCard.cpython-311.pyc | Bin 4751 -> 4747 bytes .../__pycache__/TrapCard.cpython-311.pyc | Bin 4727 -> 4723 bytes Game_Client/Classes/Game/Events/GameStart.py | 4 +- Game_Client/Classes/Game/Events/Login.py | 6 +- Game_Client/Classes/Game/Events/PlaceCard.py | 3 +- .../__pycache__/GameStart.cpython-311.pyc | Bin 1181 -> 1181 bytes .../Events/__pycache__/Login.cpython-311.pyc | Bin 1265 -> 1261 bytes .../__pycache__/PlaceCard.cpython-311.pyc | Bin 1953 -> 1947 bytes Game_Client/Classes/Game/Player.py | 3 +- .../__pycache__/BoardField.cpython-311.pyc | Bin 5037 -> 5037 bytes .../Game/__pycache__/Player.cpython-311.pyc | Bin 2761 -> 2761 bytes .../Game/__pycache__/World.cpython-311.pyc | Bin 10505 -> 10501 bytes Game_Client/Classes/System/App.py | 26 +++--- .../__pycache__/InputHandler.cpython-311.pyc | Bin 3305 -> 3269 bytes .../__pycache__/Label.cpython-311.pyc | Bin 3655 -> 3655 bytes .../__pycache__/Window.cpython-311.pyc | Bin 3667 -> 3667 bytes .../Classes/System/Network/EventHandler.py | 22 ++--- .../__pycache__/EventHandler.cpython-311.pyc | Bin 2919 -> 2899 bytes .../__pycache__/TCPClient.cpython-311.pyc | Bin 3475 -> 3475 bytes .../System/__pycache__/App.cpython-311.pyc | Bin 9718 -> 9730 bytes 30 files changed, 205 insertions(+), 34 deletions(-) create mode 100644 Game Server/log/nlwaonqh.log create mode 100644 Game Server/log/ylpfvlxp.log create mode 100644 Game Server/log/zscmixee.log diff --git a/Game Server/Classes/Game/Player.py b/Game Server/Classes/Game/Player.py index 0b39b40..81a6bb2 100644 --- a/Game Server/Classes/Game/Player.py +++ b/Game Server/Classes/Game/Player.py @@ -1,6 +1,5 @@ import random - class Player: __id:int __hp:int diff --git a/Game Server/Classes/System/GameManager.py b/Game Server/Classes/System/GameManager.py index a4927b2..c64961f 100644 --- a/Game Server/Classes/System/GameManager.py +++ b/Game Server/Classes/System/GameManager.py @@ -46,7 +46,10 @@ class GameManager: def startGame(self, tcpSocket:socket): self.__state = "running" + players = list(self.__serverWorld.getPlayers) + print("game starts") + self.logger.info("game manager is starting the game") for userAddr in self.__users.keys(): try: user = self.__serverWorld.getPlayers[userAddr]["player"] @@ -56,12 +59,23 @@ class GameManager: cards = user.getDeck() user.setHand(cards[:5]) + enemy = players[0]["player"] + + if enemy == user: + enemy = players[1]["player"] + payload = { "event":"startgame", - "playermana": user.getMana(), - "playerhp": user.getHP(), - "playername": user.getName(), - "hand": user.getHand() + "player": { + "mana":user.getMana(), + "hp": user.getHP(), + "hand": user.getHand() + }, + "enemy": { + "id": enemy.getID(), + "name": enemy.getName(), + "hp": enemy.getHP(), + }, } tcpSocket.send(json.dumps(payload).encode()) @@ -100,4 +114,8 @@ class GameManager: self.logger.info("2 players have join game starts") self.startGame(socket) - return self.__players \ No newline at end of file + return self.__players + + def removePlayers(self, clientAddr): + self.logger.info(f"removing player with address '{clientAddr}' from players database") + del self.__players[clientAddr] \ No newline at end of file diff --git a/Game Server/Classes/System/Network/NetworkManger.py b/Game Server/Classes/System/Network/NetworkManger.py index ab950bf..f3c480c 100644 --- a/Game Server/Classes/System/Network/NetworkManger.py +++ b/Game Server/Classes/System/Network/NetworkManger.py @@ -102,6 +102,9 @@ class NetworkManager: if e.errno == 10054: self.__gameManager.getLogger().error(f"Connection with {client_address} forcibly closed by remote host.") + players = self.__gameManager.getPlayers() + self.__gameManager.removePlayers(client_address) + self.__gameManager.getLogger().info(f"new player length {len(players)}") break self.__gameManager.getLogger().error(f"Socket error receiving data from {client_address}: {e}") diff --git a/Game Server/Classes/System/Network/__pycache__/NetworkManger.cpython-312.pyc b/Game Server/Classes/System/Network/__pycache__/NetworkManger.cpython-312.pyc index 4845ff9545cdc4ecba8a687f01386bd5ad7f1877..bdfd0fca332ae39b461fb1a40306309116b8c8f3 100644 GIT binary patch delta 831 zcmY+COH30%9L8sMX=!~J=`Kw72X(-pvbtq~S7EzGo`V zALL3$+05ioFiQlhejsFz+OJK zl~H%Dq5h=UHxd+2Nz#bqN`Yl#O~zL8{sm)W^aI)S#Tl`o3(<*R)8 ztDJTI3?z6n7g%p>jT5U=g6|Fw?gNvslHNu#mqO~Jl_2a2B}$RXOHiD96yK5ia>G~|+&}*z zuLKVQ=gh-*q1<`a(?RV{iY|)1D|)Evrbwb7zbKLhDSF|BGcRotD~f(1%ETyqa{5vS rXqHVe1c&nH%)L~)C<+Mvs49j=f)gRpCr!Xwz9*xG!Mb0Fa?+Px-AHH_FER=Gd{LN;WB==bU+`?L^078!~^08Sn;;#u`X}t$W{F{eF^3T zcAwR(gzMr2E{i@(;D5J7E^%p6f{%i!cd?cSO$8Mp845ZQy?quDt^ju2s87tu(U20kO^=i^ado4XI&~9Iow~>|ZMVq1T)ihY=;dBW z5y~yEl{#DdB61J+vWJ&@)l7Q`U>K{OI26?l&u`F<(p$<2T=Rs(3r+#R~V*nq3cykn)X7xGQ}cU9P#&Q zb4=!O$-ft>>YBd<+U&piSfCGPun_RW65b0O4`-NthGCpxXT=0lXBnCp=vNbEhG7zg zpnq2p_}xDUV`CQM!FcmI)^jt=;jQ3`bCSsrLy+Q+K6asyTbRqom3fSGhg%aGX!}VR HcS3&w^Jk}0 diff --git a/Game Server/Classes/System/__pycache__/GameManager.cpython-312.pyc b/Game Server/Classes/System/__pycache__/GameManager.cpython-312.pyc index 963cabf859066f1de879a492cfec478ba7456afc..cbcb0b9f31a33d7d736322958da72f845ba75113 100644 GIT binary patch delta 373 zcmZ3d@JEU7G%qg~0}%9FTar4TeMK#HJ% z6-YA!@#mPy3Cz-y?{Z79&1Ohpn#(*{n^mE{hS8Rxl0lQ%uS%{cH8;O3GcR4CASbah zwMd~nvm`?yF(suawYXS8y-HkNA+0Ds7b;txi$3pBpS9YnAJ2~DOV zJ`mdrNECxyqM%U352SAKf^A3*02^OiCF!1+8ja5UAcyQ(*FOzC1?X z$%g!jj7gJ&`J=f$Gw`v>eO6#%RiC_>-(M#bsEiS0z7&x7z|6?Vc$*3pBO+S*f;?D(_@DK delta 87 zcmeyPv`&HVG%qg~0}yB`ElGXOH<7P`v1(#_HA|&{rr>5C#(liZewzG~xdrkj*9pin n#!j9i5Y769fsa*gGNYhBWANlaK^gu;Mn<_$3?Q;d5NHwr7MvB1 diff --git a/Game Server/log/nlwaonqh.log b/Game Server/log/nlwaonqh.log new file mode 100644 index 0000000..262c4f9 --- /dev/null +++ b/Game Server/log/nlwaonqh.log @@ -0,0 +1,83 @@ +07:54:39,940 root INFO starting up server +07:54:39,941 root INFO starting up game manager +07:54:39,941 root INFO preparing to start server +07:54:39,941 root INFO starting up network manager +07:54:39,941 root INFO starting up network manager +07:54:39,941 root INFO starting up tcp server +07:54:39,943 root INFO starting up thread for client socket accepting +07:54:53,468 root INFO Connected with ('127.0.0.1', 50377) +07:54:53,469 root INFO starting client handler thread for client at address ('127.0.0.1', 50377) +07:54:53,470 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:54:53,471 root INFO user in message None +07:54:53,471 root INFO user logging in +07:54:53,471 root INFO task passed off to gameManager +07:54:53,471 root INFO creating user with id: > +07:54:53,471 root INFO new length of user dictionary: 1 +07:54:53,471 root INFO connected users 1 +07:54:53,472 root INFO confirming login for user +07:54:53,472 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:54:53,472 root INFO Received message from ('127.0.0.1', 50377): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:55:54,122 root ERROR Connection with ('127.0.0.1', 50377) forcibly closed by remote host. +07:55:54,122 root INFO removing player with address '('127.0.0.1', 50377)' from players database +07:55:54,122 root INFO new player length 0 +07:55:57,266 root INFO Connected with ('127.0.0.1', 50382) +07:55:57,266 root INFO starting client handler thread for client at address ('127.0.0.1', 50382) +07:55:57,267 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:55:57,267 root INFO user in message None +07:55:57,267 root INFO user logging in +07:55:57,268 root INFO task passed off to gameManager +07:55:57,269 root INFO creating user with id: > +07:55:57,270 root INFO new length of user dictionary: 1 +07:55:57,270 root INFO connected users 1 +07:55:57,271 root INFO confirming login for user +07:55:57,271 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:55:57,272 root INFO Received message from ('127.0.0.1', 50382): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:56:20,208 root ERROR Connection with ('127.0.0.1', 50382) forcibly closed by remote host. +07:56:20,208 root INFO removing player with address '('127.0.0.1', 50382)' from players database +07:56:20,208 root INFO new player length 0 +07:59:44,914 root INFO Connected with ('127.0.0.1', 50416) +07:59:44,915 root INFO starting client handler thread for client at address ('127.0.0.1', 50416) +07:59:44,921 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:59:44,922 root INFO user in message None +07:59:44,922 root INFO user logging in +07:59:44,922 root INFO task passed off to gameManager +07:59:44,923 root INFO creating user with id: > +07:59:44,923 root INFO new length of user dictionary: 1 +07:59:44,923 root INFO connected users 1 +07:59:44,923 root INFO confirming login for user +07:59:44,924 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:59:44,925 root INFO Received message from ('127.0.0.1', 50416): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:59:47,51 root INFO decoded message {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 422.0, 'y': 540.0} +07:59:47,52 root INFO user in message None +07:59:47,52 root INFO incommingevent {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 422.0, 'y': 540.0} +07:59:47,52 root INFO Received message from ('127.0.0.1', 50416): {"event": "placecard", "card": 1, "type": "MonsterCard", "x": 422.0, "y": 540.0} +07:59:48,65 root INFO decoded message {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 422.0, 'y': 540.0} +07:59:48,65 root INFO user in message None +07:59:48,66 root INFO incommingevent {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 422.0, 'y': 540.0} +07:59:48,66 root INFO Received message from ('127.0.0.1', 50416): {"event": "placecard", "card": 1, "type": "MonsterCard", "x": 422.0, "y": 540.0} +08:08:21,501 root ERROR Connection with ('127.0.0.1', 50416) forcibly closed by remote host. +08:08:21,501 root INFO removing player with address '('127.0.0.1', 50416)' from players database +08:08:21,502 root INFO new player length 0 +08:08:29,119 root INFO Connected with ('127.0.0.1', 50487) +08:08:29,120 root INFO starting client handler thread for client at address ('127.0.0.1', 50487) +08:08:29,129 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +08:08:29,129 root INFO user in message None +08:08:29,129 root INFO user logging in +08:08:29,129 root INFO task passed off to gameManager +08:08:29,130 root INFO creating user with id: > +08:08:29,130 root INFO new length of user dictionary: 1 +08:08:29,130 root INFO connected users 1 +08:08:29,130 root INFO confirming login for user +08:08:29,130 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +08:08:29,131 root INFO Received message from ('127.0.0.1', 50487): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +08:08:39,319 root INFO decoded message {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 411.0, 'y': 595.0} +08:08:39,320 root INFO user in message None +08:08:39,320 root INFO incommingevent {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 411.0, 'y': 595.0} +08:08:39,320 root INFO Received message from ('127.0.0.1', 50487): {"event": "placecard", "card": 1, "type": "MonsterCard", "x": 411.0, "y": 595.0} +08:08:39,697 root INFO decoded message {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 411.0, 'y': 595.0} +08:08:39,698 root INFO user in message None +08:08:39,698 root INFO incommingevent {'event': 'placecard', 'card': 1, 'type': 'MonsterCard', 'x': 411.0, 'y': 595.0} +08:08:39,698 root INFO Received message from ('127.0.0.1', 50487): {"event": "placecard", "card": 1, "type": "MonsterCard", "x": 411.0, "y": 595.0} +08:10:00,576 root ERROR Connection with ('127.0.0.1', 50487) forcibly closed by remote host. +08:10:00,576 root INFO removing player with address '('127.0.0.1', 50487)' from players database +08:10:00,576 root INFO new player length 0 diff --git a/Game Server/log/ylpfvlxp.log b/Game Server/log/ylpfvlxp.log new file mode 100644 index 0000000..4b9dfa8 --- /dev/null +++ b/Game Server/log/ylpfvlxp.log @@ -0,0 +1,30 @@ +07:50:55,550 root INFO starting up server +07:50:55,550 root INFO starting up game manager +07:50:55,551 root INFO preparing to start server +07:50:55,551 root INFO starting up network manager +07:50:55,551 root INFO starting up network manager +07:50:55,551 root INFO starting up tcp server +07:50:55,553 root INFO starting up thread for client socket accepting +07:51:04,118 root INFO Connected with ('127.0.0.1', 50258) +07:51:04,119 root INFO starting client handler thread for client at address ('127.0.0.1', 50258) +07:51:04,120 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:51:04,121 root INFO user in message None +07:51:04,121 root INFO user logging in +07:51:04,121 root INFO task passed off to gameManager +07:51:04,121 root INFO creating user with id: > +07:51:04,121 root INFO new length of user dictionary: 1 +07:51:04,121 root INFO connected users 1 +07:51:04,122 root INFO confirming login for user +07:51:04,122 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:51:04,122 root INFO Received message from ('127.0.0.1', 50258): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:51:05,932 root ERROR Connection with ('127.0.0.1', 50258) forcibly closed by remote host. +07:51:05,933 root INFO new player length 1 +07:51:25,370 root INFO Connected with ('127.0.0.1', 50263) +07:51:25,371 root INFO starting client handler thread for client at address ('127.0.0.1', 50263) +07:51:25,372 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:51:25,372 root INFO user in message None +07:51:25,372 root INFO user logging in +07:51:25,372 root INFO task passed off to gameManager +07:51:25,372 root INFO creating user with id: > +07:51:25,372 root INFO new length of user dictionary: 2 +07:51:25,372 root INFO 2 players have join game starts diff --git a/Game Server/log/zscmixee.log b/Game Server/log/zscmixee.log new file mode 100644 index 0000000..bda7c19 --- /dev/null +++ b/Game Server/log/zscmixee.log @@ -0,0 +1,30 @@ +07:48:23,537 root INFO starting up server +07:48:23,538 root INFO starting up game manager +07:48:23,538 root INFO preparing to start server +07:48:23,538 root INFO starting up network manager +07:48:23,538 root INFO starting up network manager +07:48:23,539 root INFO starting up tcp server +07:48:23,541 root INFO starting up thread for client socket accepting +07:48:36,336 root INFO Connected with ('127.0.0.1', 50229) +07:48:36,337 root INFO starting client handler thread for client at address ('127.0.0.1', 50229) +07:48:36,369 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:48:36,370 root INFO user in message None +07:48:36,371 root INFO user logging in +07:48:36,372 root INFO task passed off to gameManager +07:48:36,372 root INFO creating user with id: > +07:48:36,372 root INFO new length of user dictionary: 1 +07:48:36,372 root INFO connected users 1 +07:48:36,372 root INFO confirming login for user +07:48:36,374 root INFO incommingevent {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:48:36,374 root INFO Received message from ('127.0.0.1', 50229): {"event": "login", "username": "player", "deck": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:48:47,859 root ERROR Connection with ('127.0.0.1', 50229) forcibly closed by remote host. +07:48:47,859 root INFO new player length 1 +07:49:03,206 root INFO Connected with ('127.0.0.1', 50235) +07:49:03,207 root INFO starting client handler thread for client at address ('127.0.0.1', 50235) +07:49:03,207 root INFO decoded message {'event': 'login', 'username': 'player', 'deck': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]} +07:49:03,208 root INFO user in message None +07:49:03,208 root INFO user logging in +07:49:03,208 root INFO task passed off to gameManager +07:49:03,208 root INFO creating user with id: > +07:49:03,208 root INFO new length of user dictionary: 2 +07:49:03,208 root INFO 2 players have join game starts diff --git a/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc index 512380d69be46b648ed4e1e184934f6634e47cc6..db2cd585fffa710609572a5312457f3cb39a1eff 100644 GIT binary patch delta 47 zcmZ3WKS!T?IWI340}!a$&)dkI$H5ppxr!s4e=8#cLj%JNZs7?ep@HEBxA26bF1rr9&3iZ!c>xNS B3`YO} delta 51 zcmbQKGgpUuIWI340}!+-%-P6o!NFKO*@YujIE0abp@HEBxA26bF1rs5jGSJKn|E*| G@&W)xOAROh diff --git a/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc index cbbd764d06d24e7042c39500ef7cf09cfb7b60bd..1832c8a60646d569f2bcc0100dd4544ac8198853 100644 GIT binary patch delta 47 zcmeBI?N;Sp&dbZi00e6G^EPrnXJZVW{FyD0pM#Nsp@HEBxA26bF1rr9&FSnK+yEad B44MD{ delta 51 zcmeBH?N{Yq&dbZi00gZHb2f56XJag${FyCLn1_*pp@HEBxA26bF1rs5jGSJKo0Hi! FxB*^o4SN6p diff --git a/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc index 9c588ed57fa4ac50d6e1f004913b6474a470426c..b7fcf13d97a45be1c0651eb4d78b304e16d0c763 100644 GIT binary patch delta 47 zcmeya@>zv@IWI340}!a$&)dj-i;XdO@-w!0el|u1h6aWk+`??e1>gVx delta 27 hcmbQsIhT`rIWI340}vcgoU@TTgo&|ua{`ks698JT26_Mh diff --git a/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc b/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc index 726c1a4e89f162ce1629e1347de1a91a6119ab79..a50672ee97e3317bab2fbeb6d9226ac19f3d1825 100644 GIT binary patch delta 83 zcmey!`IeJ=IWI340}!a$&)djt#>5!B*@?-E(MS&{)WGn7ov)+f3cJJ%&r9s87uZ$r ea`1NKUF49x!XbMBhCVPeaHs+0HXmZvX9NJIz!!1= delta 87 zcmaFM`H_=*IWI340}vcgoU@VJjES*$vlEjSqnQy7&2er Rl$or@3ZkVqr?A>G0RS975e)zU delta 71 zcmbQuzmT76IWI340}w>pZ{+f0Vl3Vq$<)Inyb>tVz;J_|yQB6JyUYg$4p!dD-&hP; VKQOQYSz4?h785J)<~UYcCID-Z5h?%x diff --git a/Game_Client/Classes/Game/Player.py b/Game_Client/Classes/Game/Player.py index 42478e5..bcc15d8 100644 --- a/Game_Client/Classes/Game/Player.py +++ b/Game_Client/Classes/Game/Player.py @@ -7,10 +7,11 @@ class Player: __name:str __handCards:pygame.sprite.Group - def __init__(self, hp:int, mana:int, name:str): + def __init__(self, hp:int, mana:int, name:str, id:int): self.__hp = hp self.__mana = mana self.__name = name + self.__id = id def setID(self, id:int): self.__id = id diff --git a/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc b/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc index 72f14ce69bc343978edefc4686690df17989a297..17a0ef412ccfa9c493c8e7762e6caf215dcad7f8 100644 GIT binary patch delta 27 hcmZ3hzE+)kIWI340}xa@%-hJV#l{%C*^I567XV**28#dy delta 27 hcmZ3hzE+)kIWI340}w>pFWJbg#l~2?*^I567XV(g29N*% diff --git a/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc b/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc index 52459288af1e3978ac2b678520475a93d30425b2..81c3a644fd50532d6fc7a6864074b10fe649fa97 100644 GIT binary patch delta 27 hcmX>pdQy~oIWI340}!a$&)djd#Kai9xsJ)30{~zV2A}`{ delta 27 hcmX>pdQy~oIWI340}!+-%-P6Y#Kc&9qoU2-;zV6GCo_9cGZ R3;ep1cge|Zc2GFU0RTK8 delta 69 zcmZn->I~vu&dbZi00cq0b2f7SV`VJf%*ECs!5A>PUrvqn0|O(k!DKlFxy{$)^h5D;WR) delta 166 zcmX>q`BIX5IWI340}!+-%-P7jgORa#^AScz4#sPf*|=isKQJ)z%7TecaMl9#72X$> z%n)I#{+)hj*=oChRyr9*qHz? Cpf4u? diff --git a/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc b/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc index 507c28237ba5f19032f3a0755c0d5633a47a7119..f0331e9668411ab81dee80a15d59b2332cf028e6 100644 GIT binary patch delta 27 hcmX>ub6kddIWI340}!a$&)dj-iiI(F^EH-2P5@=%2ZaCt delta 27 hcmX>ub6kddIWI340}!+-%-P6&iiNRw^EH-2P5^2t2jc($ diff --git a/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc b/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc index 1867184feb2f90acf6a4b439ca9cb808da86ecff..ef524635a9acada8f82d08acd03da778d6e731f9 100644 GIT binary patch delta 27 hcmcaCb6JLaIWI340}w3nnzxa=oP{xXb2G~YP5^972j2hy delta 27 hcmcaCb6JLaIWI340}w>pFWJal&cax{xtZkxCje;22eAME diff --git a/Game_Client/Classes/System/Network/EventHandler.py b/Game_Client/Classes/System/Network/EventHandler.py index 6fc941e..cef919b 100644 --- a/Game_Client/Classes/System/Network/EventHandler.py +++ b/Game_Client/Classes/System/Network/EventHandler.py @@ -7,14 +7,16 @@ from Classes.System.Components.InputHandler import InputHandler from Classes.Game.World import World from Classes.Game.Events.GameStart import GameStart from Classes.Game.Player import Player +from Classes.Game.Events.Login import LoginResponse class TCPEventHandler: def __init__(self, socket:socket): self.tcp_socket = socket - def handleEvents(self, message, inputHandler:InputHandler, world:World): - if message["event"] == "login": + def handleEvents(self, message:dict, inputHandler:InputHandler, world:World): + if message["event"] == "loginresponse": # todo: handle login response here + LoginResponse(message, world) pass elif message["event"] == "startgame": print("gamestart") @@ -24,14 +26,14 @@ class TCPEventHandler: CardPlaced(world, message["card"], message["type"], message["owner"], pygame.Vector2(int(message["x"]), int(message["y"]), inputHandler)) pass elif message["event"] == "MoveCard": - CardMoved( - world, - message["card"], - message["type"], - message["owner"], - pygame.Vector2(int(message["old_x"]), int(message["old_y"])), - pygame.Vector2(int(message["new_x"]), int(message["new_y"])), - inputHandler) + # CardMoved( + # world, + # message["card"], + # message["type"], + # message["owner"], + # pygame.Vector2(int(message["old_x"]), int(message["old_y"])), + # pygame.Vector2(int(message["new_x"]), int(message["new_y"])), + # inputHandler, world) pass elif message["event"] == "RemoveCard": pass diff --git a/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc b/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc index 3b0d39544d5e0fdbc45ed37ce3a2df3ad8d408a2..e60a3e62b79655b5756a4c0cc08a974f85d238c7 100644 GIT binary patch delta 185 zcmaDZc3F&jIWI340}!a$&)dk|$H*AGc@|?8tM(U028ITP8{9$@%&%}u&nUmdt#*N1 z?E#NKhszCKkqO~fcx4wzU*grdz^gOancayQM0c@w18MEaQXErsFYxN#Kv67ni5F8) t?h>#51z!Eh4>^R@F7TS7=(wP0c8S;Q0kpE;1TS%K4?2>@qxJUIXW delta 232 zcmcaC_FRm6IWI340}vcgoU@U;kCCx>^DM?HR(%d828ITP8{9$@%&%}u&nUmdt@eRI zmQ(Nnk3fgZ4PKE6;a7NN7f4^?)%n06#VI)1p52M{1A`cl)xzElWC;UVLL5`-KQM4| z3f@4`By)*Z_X7hvy0F|OUi}XYtZ2d)6iqMjntotl#t=8V#B26}fe|YHff>jGbBhFk TzVXxKxWy44pSM|((~1cIcRECm diff --git a/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc b/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc index 62eed0f0a8dbb34f322082533ab301f828e2838f..04c59e8f1d5e872ce4d90e4139d334bea4c480cf 100644 GIT binary patch delta 27 hcmbO%Jz1K2IWI340}!a$&)dj-ftfLQ^Bv~xoB&(z2WtQT delta 27 hcmbO%Jz1K2IWI340}vcgoU@Vp0yAUr<~z*WIRRsR2n7HD diff --git a/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc b/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc index c0c8d20327a425681f31dbab27b786e0ae9cd824..be962d3d2e36d4c8543016f77b88a771af2a7a03 100644 GIT binary patch delta 1583 zcmah}ZD?Cn7(O?-H)+#+*nBq2*UiUlV%n~?O*cQbSd%KUy3w@jV4B+4Tv)R#2{(76 zh7>>8j}EGAdw)2_#40PZL$FeWDf=;*!v0v2EYPe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