From 71c25ddabe056aeb1c52f881164e83daf80a276c Mon Sep 17 00:00:00 2001 From: Bryce Allen Date: Wed, 18 Nov 2015 18:22:06 -0600 Subject: [PATCH] add jp translation page generation script * also adds name_jp to models and db queries * example using jquery ui and skilltrees --- bin/mkmobilelist.py | 28 +++++++ mhapi/db.py | 11 +-- mhapi/model.py | 12 ++- web/skilltrees.jp.html | 178 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 220 insertions(+), 9 deletions(-) create mode 100755 bin/mkmobilelist.py create mode 100644 web/skilltrees.jp.html diff --git a/bin/mkmobilelist.py b/bin/mkmobilelist.py new file mode 100755 index 0000000..12d8e53 --- /dev/null +++ b/bin/mkmobilelist.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import sys +import json + +import _pathfix + +from mhapi.util import get_utf8_writer + + +def mk_html_list(dict_list, keys, sort_key): + print """ +
+ +
+""" + print '' + + +if __name__ == '__main__': + with open(sys.argv[1]) as f: + data = json.load(f) + + sys.stdout = get_utf8_writer(sys.stdout) + mk_html_list(data, ("name", "name_jp"), "name") diff --git a/mhapi/db.py b/mhapi/db.py index b555a21..12233fb 100644 --- a/mhapi/db.py +++ b/mhapi/db.py @@ -45,15 +45,16 @@ class MHDB(object): # sell has the a value, but not used at the moment _decoration_select = """ - SELECT items._id, items.type, items.name, items.rarity, decorations.* + SELECT items._id, items.type, items.name, items.name_jp, + items.rarity, decorations.* FROM decorations LEFT JOIN items ON decorations._id = items._id """ # buy has the armor cost, sell is empty _armor_select = """ - SELECT items._id, items.type, items.name, items.rarity, items.buy, - armor.* + SELECT items._id, items.type, items.name, items.name_jp, + items.rarity, items.buy, armor.* FROM armor LEFT JOIN items ON armor._id = items._id """ @@ -401,7 +402,7 @@ class MHDB(object): def get_skill_trees(self): return self._query_all("skill_trees", """ - SELECT _id, name FROM skill_trees + SELECT _id, name, name_jp FROM skill_trees """, model_cls=model.SkillTree) def get_skill_tree_id(self, skill_tree_name): @@ -416,7 +417,7 @@ class MHDB(object): def get_skills(self): return self._query_all("skills", """ SELECT _id, skill_tree_id, required_skill_tree_points, - name, description + name, name_jp, description FROM skills """, model_cls=model.Skill) diff --git a/mhapi/model.py b/mhapi/model.py index 4038c22..f41d995 100644 --- a/mhapi/model.py +++ b/mhapi/model.py @@ -197,6 +197,8 @@ class WeaponSharpness(ModelBase): class ItemCraftable(RowModel): + _list_fields = ["id", "name", "name_jp"] + def __init__(self, item_row): super(ItemCraftable, self).__init__(item_row) self.create_components = None @@ -302,6 +304,8 @@ class ItemSkill(RowModel): class SkillTree(RowModel): + _list_fields = ["id", "name", "name_jp"] + def __init__(self, skill_tree_row): super(SkillTree, self).__init__(skill_tree_row) self.decoration_values = None @@ -323,13 +327,13 @@ class SkillTree(RowModel): class Skill(RowModel): - _list_fields = ["id", "name"] + _list_fields = ["id", "name", "name_jp"] _indexes = { "skill_tree_id": ["id", "required_skill_tree_points", "name", "description"] } class Weapon(ItemCraftable): - _list_fields = ["id", "wtype", "name"] + _list_fields = ["id", "wtype", "name", "name_jp"] _indexes = { "name": "id", "wtype": ["id", "name"], # subset of all data that can be used for searching and @@ -362,11 +366,11 @@ class Weapon(ItemCraftable): class Monster(RowModel): - _list_fields = ["id", "class", "name"] + _list_fields = ["id", "class", "name", "name_jp"] class Item(RowModel): - _list_fields = ["id", "type", "name"] + _list_fields = ["id", "type", "name", "name_jp"] _indexes = { "name": ["id"], "type": ["id", "name"] } diff --git a/web/skilltrees.jp.html b/web/skilltrees.jp.html new file mode 100644 index 0000000..4b06b05 --- /dev/null +++ b/web/skilltrees.jp.html @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + +
+
+ +

Skill Trees

+ +
    +
  • Amplify 増幅
  • +
  • Anti-Theft 盗み無効
  • +
  • Arcana 秘伝
  • +
  • Artillery 砲術
  • +
  • Attack 攻撃
  • +
  • Auto-Guard 自動防御
  • +
  • Avarice 強欲
  • +
  • Biology 細菌学
  • +
  • Blast C+ 爆破瓶追加
  • +
  • Blast S+ 爆破弾追加
  • +
  • Bleeding 裂傷
  • +
  • Blight Res 属性耐性
  • +
  • Bomb Boost 爆弾強化
  • +
  • Brawn 剛腕
  • +
  • Brutality 剛撃
  • +
  • C.Range C+ 接撃瓶追加
  • +
  • Carnivore 肉食
  • +
  • Carving 剥ぎ取り
  • +
  • Charmer 護石王
  • +
  • Clust S+ 拡散弾追加
  • +
  • Cold Res 耐寒
  • +
  • Combo Plus 調合数
  • +
  • Combo Rate 調合成功率
  • +
  • Commander 指揮
  • +
  • Constitutn 体術
  • +
  • Covert 裏稼業
  • +
  • Crag S+ 榴弾追加
  • +
  • Crit Draw 抜刀会心
  • +
  • CritElemnt 属性会心
  • +
  • CritStatus 特殊会心
  • +
  • D. Fencing 北辰納豆流
  • +
  • Dead Eye 射法
  • +
  • Def Lock 対防御DOWN
  • +
  • Defense 防御
  • +
  • Destroyer 重撃
  • +
  • Dragon Atk 龍属性攻撃
  • +
  • Dragon Res 龍耐性
  • +
  • Eating 食事
  • +
  • Edge Lore 斬術
  • +
  • Edgemaster 刀匠
  • +
  • Elemental 属性攻撃
  • +
  • Evade Dist 回避距離
  • +
  • Evasion 回避性能
  • +
  • Exhaust C+ 減気瓶追加
  • +
  • Expert 達人
  • +
  • FastCharge 溜め短縮
  • +
  • Fate 運気
  • +
  • Fencing 剣術
  • +
  • Ferocity 一心
  • +
  • Fire Atk 火属性攻撃
  • +
  • Fire Res 火耐性
  • +
  • Flame Aura 燃鱗
  • +
  • FreeElemnt 属性解放
  • +
  • Frenzy Res 狂撃耐性
  • +
  • Fury 怒
  • +
  • Gathering 採取
  • +
  • Gloves Off 本気
  • +
  • Gluttony 食いしん坊
  • +
  • Guard ガード性能
  • +
  • Guard Up ガード強化
  • +
  • Guts 根性
  • +
  • Handicraft 匠
  • +
  • Health 体力
  • +
  • Hearing 聴覚保護
  • +
  • Heat Res 耐暑
  • +
  • Hoarding 護石収集
  • +
  • Honey ハチミツ
  • +
  • Hunger 腹減り
  • +
  • Ice Atk 氷属性攻撃
  • +
  • Ice Res 氷耐性
  • +
  • KO KO
  • +
  • LastingPwr 効果持続
  • +
  • LightEater 節食
  • +
  • Loading 装填数
  • +
  • Maestro 笛
  • +
  • Mechanic 職工
  • +
  • Mounting 乗り
  • +
  • Mud/Snow 耐泥耐雪
  • +
  • Mycology 茸食
  • +
  • Nimbleness 回避術
  • +
  • Normal S+ 通常弾追加
  • +
  • Normal Up 通常弾強化
  • +
  • Para C+ 麻痺瓶追加
  • +
  • Paralysis 麻痺
  • +
  • Pellet S+ 散弾追加
  • +
  • Pellet Up 散弾強化
  • +
  • Perception 観察眼
  • +
  • Pierce S+ 貫通弾追加
  • +
  • Pierce Up 貫通弾強化
  • +
  • Poison 毒
  • +
  • Poison C+ 毒瓶追加
  • +
  • Potential 底力
  • +
  • Power C+ 強撃瓶追加
  • +
  • PowerEater 食欲
  • +
  • Prayer 祈願
  • +
  • Precision 精密射撃
  • +
  • Protection 加護
  • +
  • Prudence 潔癖
  • +
  • Psychic 千里眼
  • +
  • PunishDraw 抜刀減気
  • +
  • Ranger 狩人
  • +
  • Rapid Fire 速射
  • +
  • Readiness 居合
  • +
  • Rec Level 回復量
  • +
  • Rec Speed 回復速度
  • +
  • Recoil 反動
  • +
  • Reload Spd 装填速度
  • +
  • Resilience 頑強
  • +
  • Sense 気配
  • +
  • Sharpener 研ぎ師
  • +
  • Sharpness 斬れ味
  • +
  • Sheathing 納刀
  • +
  • Sleep 睡眠
  • +
  • Sleep C+ 睡眠瓶追加
  • +
  • Slicing S+ 斬裂弾追加
  • +
  • Spd Gather 高速収集
  • +
  • SpeedSetup 高速設置
  • +
  • Spirit 闘魂
  • +
  • Stalwart 盾持
  • +
  • Stam Drain 減気攻撃
  • +
  • Stam Recov 気力回復
  • +
  • Stamina スタミナ
  • +
  • Status 特殊攻撃
  • +
  • Status Res 状態耐性
  • +
  • SteadyHand 射手
  • +
  • Sticky Res 耐粘
  • +
  • Stun 気絶
  • +
  • Survivor 逆境
  • +
  • TeamLeader 号令
  • +
  • TeamPlayer 采配
  • +
  • Tenderizer 痛撃
  • +
  • ThunderAtk 雷属性攻撃
  • +
  • ThunderRes 雷耐性
  • +
  • Torso Up 胴系統倍加
  • +
  • Tranquilzr 捕獲
  • +
  • Transportr 運搬
  • +
  • Tremor Res 耐震
  • +
  • Unscathed 無傷
  • +
  • Unshakable 不動
  • +
  • Water Atk 水属性攻撃
  • +
  • Water Res 水耐性
  • +
  • Whim 気まぐれ
  • +
  • Wide-Range 広域
  • +
  • Wind Res 風圧
  • +
+ +
+
+ + + + +