Skip to content

Commit

Permalink
Add 親密度 value.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiletw committed Dec 27, 2018
1 parent 385544f commit 982557c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 15 deletions.
28 changes: 25 additions & 3 deletions character.py
Expand Up @@ -21,7 +21,8 @@


class KoikatuCharacter:
def __init__(self, data, with_card=True, skip_additional=False):
def __init__(self, data, with_card=True, skip_additional=False,master_version="0.0.0"):
self.master_version = master_version
self.with_card = with_card
if with_card:
# read first PNG
Expand Down Expand Up @@ -74,6 +75,9 @@ def __init__(self, data, with_card=True, skip_additional=False):
self.additional = {}
self.ac = {}
self.ex_data = b''
self.intimacy = 0
self.eventAfterDay = 0
self.isFirstGirlfriend = False
if not with_card:
# additional info
len1 = self._read_byte(data)
Expand Down Expand Up @@ -146,7 +150,7 @@ def __init__(self, data, with_card=True, skip_additional=False):
self.ac['anal_piston'] = b''

self._read_additional(data)


@property
def firstname(self):
Expand Down Expand Up @@ -450,6 +454,9 @@ def _read_additional(self, data):
if start == -1:
self.before_additional = chunk
self.ac['houshi'] = b''
self.eventAfterDay = 0
self.isFirstGirlfriend = 0
self.intimacy = 0
self.after_additional = b''
return

Expand All @@ -474,8 +481,14 @@ def _read_additional(self, data):
self.additional[key] = value

self.ac['houshi'] = stream.read(4)
self.after_additional = stream.read()
if self.master_version >= "0.0.7":
self.eventAfterDay = self._read_int(stream)
self.isFirstGirlfriend = self._read_byte(stream)

if self.master_version >= "1.0.1":
self.intimacy = self._read_int(stream)

self.after_additional = stream.read()

def _pack_additional(self):
data = [self.before_additional]
Expand All @@ -486,6 +499,15 @@ def _pack_additional(self):
data.append(self._pack_int(self.additional[key]))

data.append(self.ac['houshi'])

if self.sex == 1:
if self.master_version >= "0.0.7":
data.append(self._pack_int(int(self.eventAfterDay)))
data.append(self._pack_byte(self.isFirstGirlfriend))

if self.master_version >= "1.0.1":
data.append(self._pack_int(int(self.intimacy)))

data.append(self.after_additional)
return b''.join(data)

Expand Down
1 change: 1 addition & 0 deletions gui.py
Expand Up @@ -275,6 +275,7 @@ def character(self):
chara.koikatu = panel.koikatu
chara.lover = panel.relation
chara.date = panel.date
chara.intimacy = panel.intimacy

ac = [
'mune', 'kokan', 'anal', 'siri', 'tikubi',
Expand Down
3 changes: 2 additions & 1 deletion resources_ja.json
Expand Up @@ -50,13 +50,14 @@
"姉御肌", "ギャル", "不良少女", "野性的", "意識高いクール", "ひねくれ",
"不幸少女", "文学少女", "もじもじ", "正当派ヒロイン", "ミーハー", "オタク女子",
"ヤンデレ", "ものぐさ", "無口", "意地っ張り ", "のじゃ子", "素直クール","気さく","勝気","誠実","艶やか",
"帰国子女","方言娘","Sッ気","無感情"
"帰国子女","方言娘","Sッ気","無感情"
],
"weak_point" : "性感帯",
"weak_points" : ["", "", "股間", "アナル", "", "乳首", "なし"],
"feeling" : "好感度",
"m_love" : "H度",
"h_count" : "回数",
"intimacy" : "親密度",
"club" : "コイカツ部",
"koikatu" : ["未所属", "所属"],
"relation" : "関係",
Expand Down
9 changes: 5 additions & 4 deletions resources_zh.json
Expand Up @@ -2,7 +2,7 @@
"firstname" : "",
"lastname" : "",
"nickname" : "暱稱",
"intellect" : "智力",
"intellect" : "智力",
"physical" : "體力",
"hentai" : "H力",
"sex" : "性別",
Expand Down Expand Up @@ -50,13 +50,14 @@
"大姐頭", "辣妹", "不良少女", "野性的", "高意識", "乖僻",
"不幸少女", "文學少女", "扭扭捏捏", "正統派女主", "時尚", "宅女",
"病嬌", "怠惰", "無口", "固執 ", "古風", "率直冷","爽朗","好勝","誠實","嬌豔",
"歸國子女","方言娘","S屬性","無感情"
"歸國子女","方言娘","S屬性","無感情"
],
"weak_point" : "敏感帶",
"weak_points" : ["", "", "陰部", "肛門", "臂部", "乳頭", ""],
"feeling" : "好感度",
"m_love" : "H度",
"h_count" : "H次數",
"intimacy" : "親密度",
"club" : "戀活部",
"koikatu" : ["非社員", "社員"],
"relation" : "關係",
Expand All @@ -70,7 +71,7 @@
"kokan" : "陰部",
"siri" : "臂部",
"tikubi" : "乳頭",
"kokan_piston" : "性器做愛",
"anal_piston" : "肛門做愛",
"kokan_piston" : "性器性交",
"anal_piston" : "肛門性交",
"houshi" : "奉仕"
}
5 changes: 2 additions & 3 deletions save_data.py
Expand Up @@ -20,11 +20,10 @@ def __init__(self, filename):
def _load(self, file):
self.version_length = file.read(1)
self.b_version = file.read(int.from_bytes(self.version_length, byteorder='big'))

self.version_num = self.b_version.decode("utf-8")
self.school = self._read_utf8_string(file)

self.b_unknown02 = file.read(17)

# split character data
chara_part = file.read()
chara_data = chara_part.split(CHARA_HEADER)
Expand All @@ -33,7 +32,7 @@ def _load(self, file):
count = 0
for data in chara_data:
if data:
chara = KoikatuCharacter(io.BytesIO(CHARA_HEADER + data), False, count == 0)
chara = KoikatuCharacter(io.BytesIO(CHARA_HEADER + data), False, count == 0,self.version_num)
self.characters.append(chara)
count += 1
#print(f'chara: {chara.lastname} {chara.firstname} ({chara.nickname})')
Expand Down
19 changes: 15 additions & 4 deletions status.py
Expand Up @@ -38,6 +38,13 @@ def __init__(self, parent, chara, *args, **kwargs):
entry.grid(row=row, column=3, sticky='W')

row = 2
label = ttk.Label(self, text=RM.res('intimacy'))
self._intimacy = tk.StringVar(value=f'{chara.intimacy}')
entry = ttk.Entry(self, textvariable=self._intimacy)
label.grid(row=row, column=0, sticky='E')
entry.grid(row=row, column=1, sticky='W')

row = 3
values = RM.res('koikatu')
koikatu = self._get_value(values, chara.koikatu)
label = ttk.Label(self, text=RM.res('club'))
Expand All @@ -57,7 +64,7 @@ def __init__(self, parent, chara, *args, **kwargs):
combobox.grid(row=row, column=3, sticky='W')

self._ac = {}
row = 3
row = 4
label, cb = self._make_ac(chara, 'mune')
label.grid(row=row, column=0, sticky='E')
cb.grid(row=row, column=1, sticky='W')
Expand All @@ -66,7 +73,7 @@ def __init__(self, parent, chara, *args, **kwargs):
label.grid(row=row, column=2, sticky='E')
cb.grid(row=row, column=3, sticky='W')

row = 4
row = 5
label, cb = self._make_ac(chara, 'anal')
label.grid(row=row, column=0, sticky='E')
cb.grid(row=row, column=1, sticky='W')
Expand All @@ -75,7 +82,7 @@ def __init__(self, parent, chara, *args, **kwargs):
label.grid(row=row, column=2, sticky='E')
cb.grid(row=row, column=3, sticky='W')

row = 5
row = 6
label, cb = self._make_ac(chara, 'tikubi')
label.grid(row=row, column=0, sticky='E')
cb.grid(row=row, column=1, sticky='W')
Expand All @@ -84,7 +91,7 @@ def __init__(self, parent, chara, *args, **kwargs):
label.grid(row=row, column=2, sticky='E')
cb.grid(row=row, column=3, sticky='W')

row = 6
row = 7
label, cb = self._make_ac(chara, 'anal_piston')
label.grid(row=row, column=0, sticky='E')
cb.grid(row=row, column=1, sticky='W')
Expand Down Expand Up @@ -120,6 +127,10 @@ def m_love(self):
def h_count(self):
return int(self._h_count.get())

@property
def intimacy(self):
return int(self._intimacy.get())

@property
def relation(self):
values = RM.res('relations')
Expand Down

0 comments on commit 982557c

Please sign in to comment.