summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-05 02:45:21 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-05 02:45:21 -0300
commit94e9adf8e8f4461ab2306c5ab3970bcc9d3d65da (patch)
tree12fd72cf2c07fa6a4d003d4ef66682d8698569a9
parent11cff74cb758c08c0baba15f6eb501dd640d1f02 (diff)
downloadclient-94e9adf8e8f4461ab2306c5ab3970bcc9d3d65da.tar.gz
client-94e9adf8e8f4461ab2306c5ab3970bcc9d3d65da.tar.bz2
client-94e9adf8e8f4461ab2306c5ab3970bcc9d3d65da.tar.xz
client-94e9adf8e8f4461ab2306c5ab3970bcc9d3d65da.zip
Bring IRC Bot back to life. If anyone still cares with it, that is!
-rw-r--r--game/03_init.rpy3
-rw-r--r--game/irc.rpy57
-rw-r--r--game/misc.rpy3
-rw-r--r--game/screens.rpy1
-rw-r--r--game/script.rpy1
5 files changed, 42 insertions, 23 deletions
diff --git a/game/03_init.rpy b/game/03_init.rpy
index 0126dea..90639c4 100644
--- a/game/03_init.rpy
+++ b/game/03_init.rpy
@@ -258,6 +258,9 @@ init python:
continue
continue
+ # TODO: Maybe load images on persistent.allfiles now?
+ # I suspect declaring images at runtime might have a memleak
+ # Needs investigation
def star_write(am):
diff --git a/game/irc.rpy b/game/irc.rpy
index 870bc1c..35e05e3 100644
--- a/game/irc.rpy
+++ b/game/irc.rpy
@@ -34,8 +34,8 @@ init python:
sys.setdefaultencoding('utf8')
irc_online=False
- server = "irc.freenode.org"
- irc_channel = "#tmw2-spheres"
+ server = "irc.libera.chat"
+ irc_channel = "#mana-spheres"
# TODO: Replace this with some uuid4()?
irc_nick = "GS_" + get_token()[:3] + str(random.randint(1, 10000))
irc_auth=IRC_AUTH_NONE
@@ -45,28 +45,31 @@ init python:
irc.connect((server, 6667))
return
- def irc_receive(raw):
+ def irc_receive(raw, irc_sender=""):
global irc_buffer
- sender="IRC"
+ if irc_sender == "":
+ sender="IRC"
- # Control buffer length
- if (len(irc_buffer) >= MAX_IRC_BUFFER):
- nil=irc_buffer.pop(0)
- del nil
+ # Control buffer length
+ if (len(irc_buffer) >= MAX_IRC_BUFFER):
+ nil=irc_buffer.pop(0)
+ del nil
- # Find sender if not supplied
- try:
- p1=raw.find('<')+1
- p2=raw.find('>')
- if p2 <= p1:
- raise Exception("Invalid sender")
- sender=raw[p1:p2]
- except:
+ # Find sender if not supplied
try:
- p1=raw.find("!")
- sender="IRC."+raw[1:p1]
+ p1=raw.find('<')+1
+ p2=raw.find('>')
+ if p2 <= p1:
+ raise Exception("Invalid sender")
+ sender=raw[p1:p2]
except:
- sender="IRC"
+ try:
+ p1=raw.find("!")
+ sender="IRC."+raw[1:p1]
+ except:
+ sender="IRC"
+ else:
+ sender = irc_sender
# Extract message
try:
@@ -150,6 +153,13 @@ init python:
stdout("[IRC] Erroneous Authentication on 376 message")
irc_online=True
+ # Would be nice to show MOTD
+ if text.find("372 " + irc_nick) != -1:
+ for line in text.split("\n"):
+ if "372" in line:
+ print("[372] %s" % line)
+ irc_receive(line, "MOTD")
+
if irc_auth == IRC_AUTH_CHAN:
# IRC Syntax
# :nick!hostname PRIVMSG #tmw2-spheres :<nickname> msg
@@ -181,10 +191,11 @@ screen pub():
frame:
background Frame("gui/frame.png", 0, 0)
xalign 0.5
- yalign 0.5
+ yalign 1.0
ymargin 15
ypadding 10
xmargin 10
+ ymaximum 0.8 # FIXME - Breaks the viewport
vbox:
spacing 30
textbutton _("Exit") action Return("")
@@ -196,10 +207,12 @@ screen pub():
draggable True
arrowkeys True
xfill False
+ ymaximum 0.7
scrollbars "vertical"
vbox:
xalign 0.5
+ ymaximum 0.7
spacing 5
label _("%s" % persistent.nickname)
null height 40
@@ -223,7 +236,7 @@ screen pub():
else:
label _("IRC Integration is not active.")
# FIXME inform if IRC is disabled
- # Ask user to comply with Freenode TOS etc.
+ # Ask user to comply with Libera Chat TOS etc.
- timer 1.0 action Function(renpy.restart_interaction) repeat True
+ timer 0.5 action Function(renpy.restart_interaction) repeat True
diff --git a/game/misc.rpy b/game/misc.rpy
index 290ca55..eb1c47a 100644
--- a/game/misc.rpy
+++ b/game/misc.rpy
@@ -506,7 +506,7 @@ label download_all:
print("Integrity check passed: %s" % md4)
## We downloaded, but we need to extract it
- # FIXME: Must be done in thread, or Ren'Py will be blocked
+ # Must be done in thread, or Ren'Py will be blocked
renpy.invoke_in_thread(dall_save)
while not status:
sdelay()
@@ -519,6 +519,7 @@ label download_all:
statusmsg = "Complete.\nClick anywhere to continue."
renpy.pause()
+ ## TODO: Maybe delete `allinone.zip`? Waste of space...
renpy.full_restart()
jump start
diff --git a/game/screens.rpy b/game/screens.rpy
index d4e89a6..3eb145b 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -858,6 +858,7 @@ screen preferences():
textbutton _("Ignore"):
action SetVariable("persistent.ssl_enabled", "IGNORE")
+ showif config.developer or debug or persistent.irc_enable:
vbox:
style_prefix "check"
null height 60
diff --git a/game/script.rpy b/game/script.rpy
index 9cc721c..62361b0 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -170,6 +170,7 @@ label loop:
res=irc_send(persistent.nickname, _return)
else:
break
+ jump restore
else:
"ERROR" "You are not authorized to complete this operation.\n\nERR_NICK" # ??? I thought you choose one at prologue???