brunogge 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
brunogge/__init__.py CHANGED
@@ -3,4 +3,4 @@ from .ggs_stuff import ggs_login, keeping
3
3
  from .just_funcs import fakescanning, check_updates
4
4
  from .getconfig import getconfig
5
5
  __all__ = [ "ggs_ws", "ggs_login", "fakescanning", "getconfig", "keeping", "check_updates" ]
6
- __version__ = "0.1.6"
6
+ __version__ = "0.1.8"
brunogge/getconfig.py CHANGED
@@ -29,14 +29,6 @@ def getconfig(type:str ,savename:str ,created: str | None = "y") -> dict:
29
29
  front_tool_ammount1 = config.getint(savename, "front_tool_ammount1") # converted to int
30
30
  front_id_2 = config.get(savename, "front_id_2")
31
31
  front_tool_ammount2 = config.getint(savename, "front_tool_ammount2") # converted to int
32
- if kid == "g":
33
- kid = "0"
34
- elif kid == "s":
35
- kid = "1"
36
- elif kid == "c":
37
- kid = "2"
38
- elif kid == "f":
39
- kid = "3"
40
32
  # Return as a dictionary
41
33
  result = {
42
34
  "nick": nick,
@@ -60,13 +52,15 @@ def getconfig(type:str ,savename:str ,created: str | None = "y") -> dict:
60
52
  # Convert to JSON string and return
61
53
  return json.dumps(result, indent=4) # Return a formatted JSON string
62
54
  if created == "n":
63
- config_maker_barons(savename)
55
+ home_directory = os.path.expanduser("~")
56
+ configname = os.path.join(home_directory, type + "config.ini")
57
+ config_maker_barons(savename, configname)
64
58
  else:
65
59
  print("Invalid str as the created parameter. Use 'y' or 'n' - y if you have created the config already, 'n' if no.")
66
60
  exit()
67
61
 
68
62
 
69
- def config_maker_barons(savename, filename = "baronconfig.ini"):
63
+ def config_maker_barons(savename, filename: str | None = None):
70
64
  config = ConfigParser()
71
65
  unit_options = {
72
66
  "1": ("Distance Samurai", '35'),
@@ -145,14 +139,17 @@ def config_maker_barons(savename, filename = "baronconfig.ini"):
145
139
  else:
146
140
  print("Input cannot be empty.")
147
141
 
148
-
142
+ nick = input("Enter your nickname: ")
143
+ config.set(save_name, "nick", nick)
144
+ passwd = input("Enter your password (stored local): ")
145
+ config.set(save_name, "pwrd", passwd)
149
146
  kid = input("Kingdom Green = g, Kingdom Fire = f, Kingdom Sand = s, Kingdom Cold = c\nKingdom -> <-\b\b\b")
150
147
  config.set(save_name, "kid", kid)
151
148
 
152
149
  excluded_commanders = input_int_list("Enter excluded commanders (comma separated integers, e.g. 2,3,17. -1 if none): ")
153
150
  config.set(save_name, "excluded_commanders", excluded_commanders)
154
151
 
155
- radius_option = input("Attacking in a circle (radius) or a square (square)?\n(c/s) -> <-\b\b\b")
152
+ radius_option = "c"
156
153
  config.set(save_name, "radius_option", radius_option)
157
154
 
158
155
  distance = input_int("Distance for attacks (not preicse): ")
@@ -222,3 +219,4 @@ def config_maker_barons(savename, filename = "baronconfig.ini"):
222
219
  config.write(f)
223
220
 
224
221
  print(f"\nConfiguration saved.")
222
+ exit()
brunogge/ggs_stuff.py CHANGED
@@ -49,13 +49,21 @@ async def ggs_login(ws, nick: str, pwrd: str, server: str, kid: int | None = 0)
49
49
  response = await asyncio.wait_for(ws.recv(), timeout=4)
50
50
  response = response.decode('utf-8')
51
51
  if "%xt%jaa%1%0%" in response:
52
- pattern = rf"\[{kid},(\d+),(\d+),(\d+),1"
53
- match = re.search(pattern, response)
54
- cid = match.group(1)
55
- global sx, sy
56
- sx = match.group(2)
57
- sy = match.group(3)
52
+ sx_list = []
53
+ sy_list = []
54
+ cid_list = []
55
+ for i in range(4):
56
+ pattern = rf"\[{i},(\d+),(\d+),(\d+),1"
57
+ match = re.search(pattern, response)
58
+ cid = match.group(1)
59
+ sx = match.group(2)
60
+ sy = match.group(3)
61
+ sx_list.append(sx)
62
+ sy_list.append(sy)
63
+ cid_list.append(cid)
64
+ print(f"Coord {i} X: {sx}, Coord Y: {sy}")
58
65
  break
66
+
59
67
  except asyncio.TimeoutError:
60
68
  break
61
69
 
@@ -71,9 +79,7 @@ async def ggs_login(ws, nick: str, pwrd: str, server: str, kid: int | None = 0)
71
79
  break
72
80
  else:
73
81
  print("Connection closed, stopping login")
74
- sx = int(sx)
75
- sy = int(sy)
76
- return sx, sy, lids, cid
82
+ return sx_list, sy_list, lids, cid_list
77
83
 
78
84
  async def keeping(ws, server: str) -> None:
79
85
  """Keep the connection alive by sending periodic messages."""
brunogge/just_funcs.py CHANGED
@@ -44,9 +44,9 @@ def getserver(server: str, option: str | None = "full") -> str:
44
44
  elif option == "ws":
45
45
  return wsuri
46
46
 
47
- async def fakescanning(ws, server: str) -> None:
47
+ async def fakescanning(ws, server: str, kid: str | None = "0") -> None:
48
48
  """
49
- Fake scanning the map while doing other things (only on green map)
49
+ Fake scanning the map while doing other things
50
50
 
51
51
  """
52
52
  empireex = getserver(server, "ex")
@@ -54,12 +54,12 @@ async def fakescanning(ws, server: str) -> None:
54
54
  while ws.open:
55
55
  for delay in delays:
56
56
  print("Fake scanned...")
57
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":0,"AY1":0,"AX2":12,"AY2":12}}%""")
58
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":1274,"AY1":0,"AX2":1286,"AY2":12}}%""")
59
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":13,"AY1":0,"AX2":25,"AY2":12}}%""")
60
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":1274,"AY1":13,"AX2":1286,"AY2":25}}%""")
61
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":0,"AY1":13,"AX2":12,"AY2":25}}%""")
62
- await ws.send(f"""%xt%{empireex}%gaa%1%{{"KID":0,"AX1":13,"AY1":13,"AX2":25,"AY2":25}}%""")
57
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":0,"AY1":0,"AX2":12,"AY2":12}}%""")
58
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":1274,"AY1":0,"AX2":1286,"AY2":12}}%""")
59
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":13,"AY1":0,"AX2":25,"AY2":12}}%""")
60
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":1274,"AY1":13,"AX2":1286,"AY2":25}}%""")
61
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":0,"AY1":13,"AX2":12,"AY2":25}}%""")
62
+ await ws.send(f"""%xt%{empireex}%gaa%1%{{"{kid}":0,"AX1":13,"AY1":13,"AX2":25,"AY2":25}}%""")
63
63
  await asyncio.sleep(delay * 60)
64
64
 
65
65
  import subprocess
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brunogge
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: Bilbioteka Python dla Goodgame Empire.
5
5
  Author-email: WojtS & ThunderStorm <wojts8@proton.me>
6
6
  Project-URL: Homepage, https://github.com/wojtsik/brunogge
@@ -0,0 +1,11 @@
1
+ brunogge/__init__.py,sha256=lxhk6fCOWa-8iQQW4UnBHc8d2ZxfrLl9dNj0a7jFxTM,275
2
+ brunogge/barony.py,sha256=6Xm-i5AaXa8oVQ_kzX0_tDZucoBVplF7gYTGuad6djk,14891
3
+ brunogge/get_ws.py,sha256=nPsvNReq4DzflvOItHOd3WgajAV7f3ckeZr8qRADYsI,709
4
+ brunogge/getconfig.py,sha256=5vS0MY694E2wgJCxr3Phrfc5Gakru8u2EIherlkW-2k,9756
5
+ brunogge/ggs_stuff.py,sha256=vfjB5shnOHsOgyuUfRrsKs4gOfXsIGvgf_7Gu_Q6yoQ,5080
6
+ brunogge/just_funcs.py,sha256=H5cuxNYnWrs7hgr4XCM7RZRkcbFUuAiS306vIx_4nWI,3956
7
+ brunogge/server_list.json,sha256=5hZrlPH7tbFY7m1bqMMgsKiyHkGiPTnVMAW2B9WLabc,5084
8
+ brunogge-0.1.8.dist-info/METADATA,sha256=v3q6Ejx1v4jkosZRby0yhEd5xomyT0BOu-Qrf0ke1eU,328
9
+ brunogge-0.1.8.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
10
+ brunogge-0.1.8.dist-info/top_level.txt,sha256=oTTOxi0gm7TPhnipjl1nIXsYLRrnWnDzKKLCfRVhAjw,9
11
+ brunogge-0.1.8.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- brunogge/__init__.py,sha256=oN1NvcC60bbtO24YFFRSbnRmBIgK1LCsSDfx-lwZ2Q8,275
2
- brunogge/barony.py,sha256=6Xm-i5AaXa8oVQ_kzX0_tDZucoBVplF7gYTGuad6djk,14891
3
- brunogge/get_ws.py,sha256=nPsvNReq4DzflvOItHOd3WgajAV7f3ckeZr8qRADYsI,709
4
- brunogge/getconfig.py,sha256=fnFnuAAUdffK2ywjOsDtFCvKbzWSzoKYFw2lSo-zccI,9761
5
- brunogge/ggs_stuff.py,sha256=QCBgVxbzfkr_pz1IFD11SVtGxzbYb-lgYjuJJLZgkwU,4771
6
- brunogge/just_funcs.py,sha256=KDKzWU7zJlF1iGae2Lx3GaXABQRa99VRd2eOKkmbh9s,3941
7
- brunogge/server_list.json,sha256=5hZrlPH7tbFY7m1bqMMgsKiyHkGiPTnVMAW2B9WLabc,5084
8
- brunogge-0.1.6.dist-info/METADATA,sha256=ixxRYxskYkvsjFkS-r6-vbRFhzDer8n90ftfSZbxzyA,328
9
- brunogge-0.1.6.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
10
- brunogge-0.1.6.dist-info/top_level.txt,sha256=oTTOxi0gm7TPhnipjl1nIXsYLRrnWnDzKKLCfRVhAjw,9
11
- brunogge-0.1.6.dist-info/RECORD,,