forked from SilverStudioGames/WTS
Compare commits
7 Commits
247433b573
...
47421d2a57
Author | SHA1 | Date | |
---|---|---|---|
47421d2a57 | |||
4e8d661165 | |||
dbda53d19a | |||
b6d07aaa99 | |||
18f3ae4219 | |||
20fcacf97b | |||
f179095287 |
@ -1,4 +1,3 @@
|
||||
|
||||
init -999 python:
|
||||
# Remove style overrides
|
||||
adv.who_args.pop("style", None)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
# Preferences
|
||||
# https://www.renpy.org/doc/html/preferences.html
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
label start:
|
||||
python:
|
||||
version = version_float()
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
# Legacy styles (still in use)
|
||||
|
||||
style yesno_button:
|
||||
|
@ -11,6 +11,7 @@ init python early:
|
||||
import re
|
||||
import string
|
||||
import functools
|
||||
import timeit as timeit_module
|
||||
from bisect import bisect
|
||||
from operator import itemgetter
|
||||
from operator import add as _add
|
||||
@ -26,7 +27,7 @@ init python early:
|
||||
tens = ("","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")
|
||||
thousands = ("","thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion")
|
||||
|
||||
output = []
|
||||
output = [] # list of iterables of strings (reminder that strings are iterables of strings)
|
||||
if n == 0:
|
||||
output.append("zero")
|
||||
else:
|
||||
@ -39,10 +40,10 @@ init python early:
|
||||
g = groups-(i//3+1)
|
||||
|
||||
if h > 0:
|
||||
output.append(units[h]+" hundred")
|
||||
output.append((units[h], " hundred"))
|
||||
if t > 1:
|
||||
if u > 0:
|
||||
output.append(tens[t]+"-"+units[u])
|
||||
output.append((tens[t], "-", units[u]))
|
||||
else:
|
||||
output.append(tens[t])
|
||||
elif t == 1:
|
||||
@ -56,25 +57,22 @@ init python early:
|
||||
|
||||
if g > 0 and (h+t+u) > 0:
|
||||
if i == (groups*3)-6:
|
||||
output.append(thousands[g]+" and")
|
||||
output.append((thousands[g], " and"))
|
||||
else:
|
||||
output.append(thousands[g]+",")
|
||||
output.append((thousands[g], ","))
|
||||
|
||||
if readable:
|
||||
output = " ".join(output)
|
||||
output = " ".join("".join(o) for o in output)
|
||||
return output
|
||||
|
||||
def clamp(n, smallest, largest):
|
||||
return max(smallest, min(n, largest))
|
||||
|
||||
def white_tint(image):
|
||||
return Transform( image, matrixcolor=TintMatrix((1.1, 1.1, 1.1)) )
|
||||
white_tint = Transform(image, matrixcolor=TintMatrix((1.1, 1.1, 1.1)))
|
||||
|
||||
def gray_tint(image):
|
||||
return Transform( image, matrixcolor=SaturationMatrix(0.0) )
|
||||
gray_tint = Transform(image, matrixcolor=SaturationMatrix(0.0))
|
||||
|
||||
def yellow_tint(image):
|
||||
return Transform( image, matrixcolor=TintMatrix((1.2, 1.1, 0.7)) )
|
||||
yellow_tint = Transform(image, matrixcolor=TintMatrix((1.2, 1.1, 0.7)))
|
||||
|
||||
def image_hover(image, brightness=0.12):
|
||||
"""Returns slightly brighter image used during hover events"""
|
||||
@ -125,26 +123,28 @@ init python early:
|
||||
if isinstance(obj, _list):
|
||||
return [make_revertable(x) for x in obj]
|
||||
elif isinstance(obj, _dict):
|
||||
return dict([(make_revertable(k), make_revertable(v)) for (k,v) in obj.items()])
|
||||
return dict((make_revertable(k), make_revertable(v)) for (k,v) in obj.items())
|
||||
else:
|
||||
return obj
|
||||
|
||||
def is_integer(s):
|
||||
def zero(s):
|
||||
return (len(s) > 1 and s.startswith("0"))
|
||||
|
||||
s = str(s)
|
||||
|
||||
if s and s[0] in ("-", "+"):
|
||||
return (not zero(s[1:]) and s[1:].isdigit())
|
||||
return (not zero(s) and s.isdigit())
|
||||
if not s:
|
||||
return False
|
||||
if s[0] in ("-", "+"):
|
||||
# calling lstrip("0+-") would be faster but not exactly identical
|
||||
s = s[1:]
|
||||
if s.lstrip("0").isdigit():
|
||||
return True
|
||||
return False
|
||||
|
||||
def timeit(func, loops=10000, args=(), kwargs={}):
|
||||
start = time.time()
|
||||
for i in range(loops):
|
||||
func(*args, **kwargs)
|
||||
end = time.time()
|
||||
print(f"The task has taken {end-start} seconds to finish")
|
||||
rv = timeit_module.timeit("func(*args, **kwargs)", number=loops, globals=dict(func=func, args=args, kwargs=kwargs))
|
||||
print(f"The task has taken {rv} seconds to finish")
|
||||
|
||||
def autorange(func, args=(), kwargs={}):
|
||||
loops, time = timeit_module.Timer("func(*args, **kwargs)", globals=dict(func=func, args=args, kwargs=kwargs)).autorange()
|
||||
print(f"The task has taken {time/loops} seconds to finish ({loops} iterations in {time} seconds)")
|
||||
|
||||
def list_swap_values(l, val1, val2):
|
||||
"""Mutates the original list."""
|
||||
|
@ -1,4 +1,4 @@
|
||||
init -999 python early:
|
||||
python early:
|
||||
if renpy.version_tuple < (7,5,3,22090809):
|
||||
raise RuntimeWarning("Your Ren'Py launcher is outdated, the current minimal requirement is 7.5.3.22090809+\nPlease perform an update and try launching the game again.")
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
# Custom text tags
|
||||
# https://www.renpy.org/doc/html/custom_text_tags.html
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
image fade = "#00000080"
|
||||
image fade_gradient = "interface/bld.webp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user