summaryrefslogtreecommitdiff
path: root/game/recruit.rpy
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-22 13:29:39 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-22 13:29:39 -0300
commit156f980e4f7f535f573aa3441f3623ecfe884f23 (patch)
treeb4a4704e2917f87ecd65bd72109fe8490eb41b63 /game/recruit.rpy
parent643ca7d391728f28012e2ccbd57a0b85c09beb2d (diff)
downloadclient-156f980e4f7f535f573aa3441f3623ecfe884f23.tar.gz
client-156f980e4f7f535f573aa3441f3623ecfe884f23.tar.bz2
client-156f980e4f7f535f573aa3441f3623ecfe884f23.tar.xz
client-156f980e4f7f535f573aa3441f3623ecfe884f23.zip
Initial tavern redesign (not fully operational yet)
Diffstat (limited to 'game/recruit.rpy')
-rw-r--r--game/recruit.rpy225
1 files changed, 225 insertions, 0 deletions
diff --git a/game/recruit.rpy b/game/recruit.rpy
new file mode 100644
index 0000000..a12837e
--- /dev/null
+++ b/game/recruit.rpy
@@ -0,0 +1,225 @@
+########################################################################################
+# This file is part of Spheres.
+# Copyright (C) 2019 Jesusalva
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+########################################################################################
+# Recruits
+init python:
+ import json
+ def recruit(t, a):
+ global Player
+ raw=send_packet("recruit", recruitdata(t, a))
+
+ rc=json_decode(raw)
+ try:
+ return int(rc)
+ except:
+ pass
+
+ # Update data
+ try:
+ Player[rc["currency"][0]]=rc["currency"][1]
+ except:
+ renpy.notify("ERROR, Currency is undefined.")
+
+ for unit in rc["units"]:
+ _window_hide(None)
+ if (debug):
+ print str(unit)
+ idx=inventoryplace()
+ unit["unit_id"]=int(unit["unit_id"])
+ if (debug):
+ print "Recruit index: %d" % idx
+ print "Player inventory: %s" % str(Player["inv"])
+ print "Unit ID: %s" % str(unit["unit_id"])
+ print "Unit Name: %s" % str(allunits[int(unit["unit_id"])]["name"])
+ print "Unit Rarity: %d" % allunits[int(unit["unit_id"])]["rare"]
+ Player["inv"][idx]=unit
+ txt=allunits[int(unit["unit_id"])]["name"]
+ rar=allunits[int(unit["unit_id"])]["rare"]
+ star=star_write(rar)
+ sprite=str(unit["unit_id"])
+ show_img("unit_"+sprite, at_list=[truecenter])
+ renpy.pause(0.1)
+ renpy.call_screen("msgbox", "%s\n\nRecruited %d★ %s" % (star, rar, txt))
+ renpy.hide("unit_"+sprite)
+ _window_show(None)
+
+ # Return result
+ if (rc["code"] == ERR_NOGEMS):
+ renpy.notify("You don't have enough gems to complete.")
+ if (rc["code"] == ERR_INVFULL):
+ renpy.notify("You don't have enough space to complete!")
+
+ return rc["code"]
+
+
+label tavern:
+ $ show_img("bg tavern", False, ext=".jpg") # Validate
+ scene bg tavern
+ play music MUSIC_PARTY.id() fadein 0.5
+ window hide
+ #alltaverns
+
+ jump tv_loop
+
+screen tavern():
+ default tavern = 0
+ fixed:
+ #xmargin 50
+ #ymargin 50
+ #xalign 0.5
+ #ypos 0.9
+ #yanchor 1.0
+ xfill True
+ yfill True
+ frame:
+ background "gui/tv_frame.webp"
+ xalign 0.5
+ #yanchor 1.0
+ #ypos 0.9
+ yalign 0.5
+ xmaximum 615
+ xminimum 615
+ ymaximum 1000
+ yminimum 1000
+ vbox:
+ box_wrap True
+ xoffset 50
+ yoffset 50
+
+ if alltaverns[tavern]["banner"] != "":
+ label _("Insert banner")
+ else:
+ label _("No banner")
+
+ label alltaverns[tavern]["details"]
+ null:
+ height 32
+ label _("%d %s the draw!" % (alltaverns[tavern]["price"], alltaverns[tavern]["currency"]))
+
+ vbox:
+ box_wrap True
+ xoffset 50
+ yoffset 50
+ ypos (1312-42)
+ yanchor 1.0
+ xpos 255
+ xanchor 0.0
+ hbox:
+ spacing 24
+ button:
+ xmaximum 250 #350
+ yminimum 60 #111
+ ymaximum 110 #111
+ idle_background Frame("gui/green_btn.png", 60, 30)
+ hover_background Frame("gui/green_btn_hover.png", 60, 30)
+ action Return([tavern, 1])
+ hbox:
+ yoffset 10
+ null width 25
+ text _("Summon %d" % 1):
+ color "#001864"
+ size 24
+ outlines [(1,"#FFF",0,0)]
+ null width 25
+ button:
+ xmaximum 250 #350
+ yminimum 60 #111
+ ymaximum 110 #111
+ idle_background Frame("gui/green_btn.png", 60, 60)
+ hover_background Frame("gui/green_btn_hover.png", 60, 60)
+ action Return([tavern, alltaverns[tavern]["min_draws"]])
+ hbox:
+ yoffset 10
+ null width 25
+ text _("Summon %d" % alltaverns[tavern]["min_draws"]):
+ color "#001864"
+ size 24
+ outlines [(1,"#FFF",0,0)]
+ null width 25
+ null:
+ height 42
+ hbox:
+ showif tavern > 0:
+ button:
+ xmaximum 250 #350
+ yminimum 60 #111
+ ymaximum 110 #111
+ idle_background Frame("gui/purple_btn.png", 60, 30)
+ hover_background Frame("gui/purple_btn_hover.png", 60, 30)
+ action SetScreenVariable("tavern", tavern-1)
+ hbox:
+ yoffset 5
+ null width 25
+ text _("«"):
+ color "#FFF"
+ size 24
+ outlines [(1,"#000",0,0)]
+ null width 25
+ showif len(alltaverns) > tavern+1:
+ button:
+ xmaximum 250 #350
+ yminimum 60 #111
+ ymaximum 110 #111
+ idle_background Frame("gui/purple_btn.png", 60, 30)
+ hover_background Frame("gui/purple_btn_hover.png", 60, 30)
+ action SetScreenVariable("tavern", tavern+1)
+ hbox:
+ yoffset 5
+ null width 25
+ text _("»"):
+ color "#FFF"
+ size 24
+ outlines [(1,"#000",0,0)]
+ null width 25
+
+ button:
+ xmaximum 250 #350
+ yminimum 60 #111
+ ymaximum 110 #111
+ idle_background Frame("gui/green_btn.png", 60, 60)
+ hover_background Frame("gui/green_btn_hover.png", 60, 60)
+ action Return([-1, -1])
+ hbox:
+ yoffset 10
+ null width 25
+ text _("Return"):
+ color "#001864"
+ size 24
+ outlines [(1,"#FFF",0,0)]
+ null width 25
+
+label tv_loop:
+ call screen tavern
+
+ if (_return[0] < 1 or _return[1] < 1):
+ jump restore
+
+ $ message=recruit(_return[0], _return[1])
+ #menu:
+ # "Recruit 10 units for 2000 gems\n{i}One 4★ guaranteed!{/i}":
+ # $message=recruit(1, 10)
+ # "GP Tavern: Recruit 10 units for 10,000 GP\n{i}One Fairy or Mana Egg guaranteed!{/i}":
+ # $message=recruit(2, 10)
+ # "{b}This is a placeholder{/b}" "{i}It is possible to render each unit inidividual chance but we're not doing this (yet){/i}\nPlease be patient."
+
+ if (message == OFFLINEMSG):
+ "Server replies:" "[message]\n\nYou are offline?"
+ return
+
+ jump tv_loop
+