Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tool-only
Browse files Browse the repository at this point in the history
# Conflicts:
#	.vscode/settings.json
#	README.md
#	game/script.rpy
  • Loading branch information
BlackRam-oss committed Oct 30, 2022
2 parents 3313940 + 8f9e7fc commit 219a41a
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 16 deletions.
Binary file added game/interface/button/close_idle.webp
Binary file not shown.
1 change: 1 addition & 0 deletions game/tool/character_info.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ init python:
self.name = name
self.sname = sname
self.age = age
self.gender = gender
# default values
self.set("name_default", name)
self.set("sname_default", sname)
Expand Down
16 changes: 15 additions & 1 deletion game/tool/character_statistics.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ init 9 python:
notify_increase_dict: Optional[dict[str]] = None,
notify_decrease_dict: Optional[dict[str]] = None,
notify_dict: Optional[dict[str, NotifyEx]] = None,
max_values: int = 100,
):

self.memory = {}
self.memory.update(values if values else {})
self.notify_increase_dict = notify_increase_dict if notify_increase_dict else {}
self.notify_decrease_dict = notify_decrease_dict if notify_decrease_dict else {}
self.notify_dict = notify_dict if notify_dict else {}
self.max_values = max_values

def set(self, name: str, value: int) -> None:
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#set """
Expand All @@ -31,8 +33,12 @@ init 9 python:
del self.memory[name]
return

def improve(self, name: str, amt: int = 1, max=100, min=0, show_notify= True) -> None:
def improve(self, name: str, amt: int = 1, max=None, min=0, show_notify= True) -> None:
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#improvment """
if amt == 0:
return
if max == None:
max = self.max_values
if (self.get(name) != None):
if (amt > 0 and self.memory[name] >= max):
return
Expand Down Expand Up @@ -70,3 +76,11 @@ init 9 python:
elif name in self.notify_dict:
notify(self.notify_dict[name])
return

def getAll(self):
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#getAll """
return self.memory

def getDefaultMaxValue(self):
"""Wiki: https://github.com/DRincs-Productions/DS-toolkit/wiki/Statistic#getDefaultMaxValue """
return self.max_values
4 changes: 3 additions & 1 deletion game/tool/character_statistics_sentimental.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ init 10 python:
bisexual: bool = False,
polyamorous: bool = False,
against=None,
addiction=None
addiction=None,
max_values: int = 100,
):

self.memory = {}
self.max_values = max_values
# Characteristics
if (gender_attracted != None):
self.improve(name="gender_attracted",
Expand Down
15 changes: 9 additions & 6 deletions game/tool/log_system.rpy
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
init -998 python:
# 'define config.log' is in core.rpy
error_notify = __("Where was an ERROR. Please send the developer the logs found in: [config.log]")
warn_notify = _("Where was an WARN. Please send the developer the logs found in: [config.log]")
error_notify = __("Where was an {color=#f00}{b}ERROR{/b}{/color}. Please send the developer the logs found in: {color=#00ccff}[config.log]{/color}")
warn_notify = _("Where was an {color=#f5bc02}{b}WARN{/b}{/color}. Please send the developer the logs found in: {color=#00ccff}[config.log]{/color}")
info_notify = False

def log_error(msg: str, filename_line = None):
renpy.log("Error: " + msg)
log_filename_line(filename_line)
if error_notify:
notifyEx(msg = error_notify)
notifyExPreventsLoops(msg = error_notify)
renpy.log("")
return

def log_warn(msg: str, filename_line = None):
renpy.log("Warn: " + msg)
log_filename_line(filename_line)
if not IsNullOrWhiteSpace(warn_notify):
notifyEx(msg = warn_notify)
notifyExPreventsLoops(msg = warn_notify)
renpy.log("")
return

def log_info(msg: str, filename_line = None):
renpy.log("Info: " + msg)
log_filename_line(filename_line)
if not IsNullOrWhiteSpace(info_notify):
notifyEx(msg = info_notify)
notifyExPreventsLoops(msg = info_notify)
renpy.log("")
return

def log_filename_line(filename_line = None):
if filename_line:
renpy.log("filename_line: [filename_line]")
renpy.log("filename_line: " + str(filename_line))
return
26 changes: 18 additions & 8 deletions game/tool/notify.rpy
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@

# Width of the images.
define gui.notifyEx_width = 64
define gui.notifyEx_width = gui.label_text_size
# Height of the images.
define gui.notifyEx_height = 64
define gui.notifyEx_height = gui.label_text_size

define gui.notifyEx_color = "#000000"
define gui.notifyEx_text_color = "#ffffff"

label enable_notifyEx:
show screen notifyEx
return
label disable_notifyEx:
hide notifyEx
return

init -999 python:
notifications = []
Expand All @@ -28,21 +36,23 @@ init -999 python:
renpy.show_screen("notifyEx")
return

def notifyExPreventsLoops(msg: str = None, img: str = None):
if len(store.notifications) > 1:
notifications[0] = NotifyEx(msg, img)
else:
notifications.append(NotifyEx(msg, img))
return

def notifyExClean(value):
if value in store.notifications:
store.notifications.remove(value)
if len(store.notifications) == 0:
renpy.hide_screen("notifyEx")
return


def notify(notific):
"""View defined notifications.
"""View defined notifications.6
to use: $ notify(...)"""
notifications.append(NotifyEx(notific.msg, notific.img))
if len(store.notifications) == 1:
renpy.show_screen("notifyEx")
return

style notify_text is default:
Expand Down Expand Up @@ -80,6 +90,6 @@ screen notifyExInternal( n ):
null width 5

if not n.msg is None:
text n.msg
text n.msg color gui.notifyEx_text_color

timer 0.05 repeat True action [ SetField( n, "remain", n.remain - 0.05 ), If( n.remain <= 0, Function( notifyExClean, n ), NullAction() ) ]
220 changes: 220 additions & 0 deletions game/tool/screens_ds.rpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# character selected in the menu
default cur_character_id = None
default cur_character_info = None
default cur_character_statistic = None
default cur_character_sentimental = None

define gui.userinfo_textdistance_xsize = 250
define gui.userinfo_lateralframe_ypos = 100
define gui.userinfo_lateralframe_xpos = 700
define gui.userinfo_lateralframe_ysize = 600
define gui.userinfo_lateralframe_xsize = 200 + gui.userinfo_textdistance_xsize

define ds_translations = {
"gender_attracted" : _("Sexuality"),
"friendship" : _("Friendship"),
"favour" : _("Favour"),
"love" : _("Love"),
"corruption" : _("Corruption"),
"virgin" : _("Virgin"),
"bisexual" : _("Bisexual"),
"polyamorous" : _("Polyamorous"),
"against" : _("Against"),
"addiction" : _("Addiction"),
"max_values" : _("Max_values"),
"strength" : _("Strength"),
"intelligence" : _("Intelligence"),
"agility" : _("Agility"),
}

screen menu_userinfo():

tag menu

## Avoid predicting this screen, as it can be very large.
predict False

modal True
style_prefix "game_menu"
add "gui/overlay/game_menu.png"

frame area (150, 70, 350, 50) background None:
text _("{b}Characters{/b}") color gui.accent_color size gui.name_text_size

# button for closure
imagebutton:
align (0.95, 0.05)
idle '/interface/button/close_idle.webp'
action [
Hide('menu_userinfo'),
]
if renpy.variant("pc"):
focus_mask True
at close_zoom
else:
at close_zoom_mobile

frame:
ypos 170
xpos 80
xsize 400
ysize gui.lateralframescroll_ysize
background None
# task title list
viewport mousewheel 'change' draggable True id 'vp1':
has vbox spacing 5
# MC
button:
xpos 30
xsize 390
background None
xpadding 0
ypadding 0
xmargin 0
ymargin 0
textbutton "[mc]":
action [
SetVariable('cur_character_id', "mc"),
SetVariable('cur_character_info', mcI),
SetVariable('cur_character_statistic', mcStatistic),
SetVariable('cur_character_sentimental', None),
]
selected cur_character_id == "mc"
# Girl
button:
xpos 30
xsize 390
background None
xpadding 0
ypadding 0
xmargin 0
ymargin 0
textbutton "[girl]":
action [
SetVariable('cur_character_id', "girl"),
SetVariable('cur_character_info', girlI),
SetVariable('cur_character_statistic', None),
SetVariable('cur_character_sentimental', girlSentimental),
]
selected cur_character_id == "girl"
# Friend
button:
xpos 30
xsize 390
background None
xpadding 0
ypadding 0
xmargin 0
ymargin 0
textbutton "[friend]":
action [
SetVariable('cur_character_id', "friend"),
SetVariable('cur_character_info', friendI),
SetVariable('cur_character_statistic', friendStatistic),
SetVariable('cur_character_sentimental', friendSentimental),
]
selected cur_character_id == "friend"
# scroll bar
vbar value YScrollValue('vp1') style 'menu_vscroll'

# Image
if cur_character_id == "friend":
imagebutton:
align (0.33, 1)
idle 'friend normal'
elif cur_character_id == "girl":
imagebutton:
align (0.33, 1)
idle 'girl normal'

frame:
ypos 100
xpos gui.userinfo_lateralframe_xpos
xsize gui.userinfo_lateralframe_xsize
ysize gui.userinfo_lateralframe_ysize
background None
viewport mousewheel 'change' draggable True id 'vp3':
has vbox spacing 5
if cur_character_info:
# Start Space
frame area (0, 0, 350, 20):
background None

vbox:
xpos 30
hbox xfill True:
frame xsize gui.userinfo_textdistance_xsize background None:
text _("Name:") size gui.label_text_size color gui.accent_color
frame xfill True background None:
text "[cur_character_info.name] [cur_character_info.sname]" size gui.label_text_size

if cur_character_info.age:
hbox xfill True:
frame xsize gui.userinfo_textdistance_xsize background None:
text _("Age:") size gui.label_text_size color gui.accent_color
frame xfill True background None:
text "[cur_character_info.age]" size gui.label_text_size

if cur_character_info.relationships and len(cur_character_info.relationships) > 0:
frame area (0, 0, 350, 25):
background None
frame xsize 300 background None:
text _("Relationships:") size gui.name_text_size
for ch in cur_character_info.relationships.keys():
$ relationship_name = cur_character_info.relationships[ch]
hbox xfill True:
frame xsize gui.userinfo_textdistance_xsize background None:
text "[relationship_name]:" size gui.label_text_size color gui.accent_color
frame xfill True background None:
text "[ch]" size gui.label_text_size

if cur_character_statistic:
$ statistic_memory = cur_character_statistic.getAll()
$ max_value = cur_character_statistic.getDefaultMaxValue()
if len(statistic_memory) > 0:
frame area (0, 0, 350, 25):
background None
frame xsize 300 background None:
text _("Statistic:") size gui.name_text_size
for stat in statistic_memory.keys():
$ value = statistic_memory[stat]
if stat in ds_translations:
$ stat = ds_translations[stat]
hbox xfill True:
frame xsize gui.userinfo_textdistance_xsize background None:
text _("[stat]:") size gui.label_text_size color gui.accent_color
frame xfill True background None:
text "[value]" size gui.label_text_size

if cur_character_sentimental:
$ sentimental_memory = cur_character_sentimental.getAll()
if len(sentimental_memory) > 0:
frame area (0, 0, 350, 25):
background None
frame xsize 300 background None:
text _("Sentimental:") size gui.name_text_size
for sent in sentimental_memory.keys():
$ value = sentimental_memory[sent]
if sent == "gender_attracted" and cur_character_info:
if cur_character_info.gender == "M" and value == "M":
$ value = _("Gay")
elif cur_character_info.gender == "F" and value == "F":
$ value = _("Lesbo")
elif not cur_character_info.gender == value:
$ value = _("Straight")
if sent in ds_translations:
$ sent = ds_translations[sent]
hbox xfill True:
frame xsize gui.userinfo_textdistance_xsize background None:
text _("[sent]:") size gui.label_text_size color gui.accent_color
frame xfill True background None:
text "[value]" size gui.label_text_size

# End Space
frame area (0, 0, 350, 20):
background None

vbar value YScrollValue('vp3') style 'menu_vscroll'

key 'K_ESCAPE' action Hide('menu_userinfo')
key 'mouseup_3' action Hide('menu_userinfo')
Loading

0 comments on commit 219a41a

Please sign in to comment.