parent
a62f60195e
commit
9bad89b0af
@ -0,0 +1,74 @@
|
||||
[
|
||||
{
|
||||
"carves": {
|
||||
"Body Carve": 4,
|
||||
"Tail Carve": 2
|
||||
},
|
||||
"monsters": [
|
||||
"Gravios", "Apex Gravios", "Black Gravios",
|
||||
"Deviljho", "Apex Deviljho", "Savage Deviljho",
|
||||
"Akantor", "Ukanlos",
|
||||
"Monoblos", "White Monoblos"
|
||||
]
|
||||
},
|
||||
{
|
||||
"carves": {
|
||||
"Body Carve": 4,
|
||||
"Tail Carve": 1
|
||||
},
|
||||
"monsters": [
|
||||
"Teostra", "Chameleos", "Raging Brachydios",
|
||||
"Kushala Daora", "Rusted Kushala Daora"
|
||||
]
|
||||
},
|
||||
{
|
||||
"monsters": ["Dah'ren Mohran"],
|
||||
"carves": {
|
||||
"Body Carve": 8,
|
||||
"Mouth Carve": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"monsters": ["Dalamadur", "Shah Dalamadur"],
|
||||
"carves": {
|
||||
"Upper Body Carve": 4,
|
||||
"Lower Body Carve": 4,
|
||||
"Head Carve": 2,
|
||||
"Tail Carve": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"monsters": ["Gogmazios"],
|
||||
"carves": {
|
||||
"Body Carve": 6,
|
||||
"Tail Carve": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"monsters": ["Fatalis", "Crimson Fatalis", "White Fatalis"],
|
||||
"carves": {
|
||||
"Body Carve": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"carves": {
|
||||
"Body Carve": 2
|
||||
},
|
||||
"monsters": ["Aptonoth", "Apceros", "Popo", "Rhenoplos", "Slagtoth",
|
||||
"Jaggia"]
|
||||
},
|
||||
{
|
||||
"monsters": ["Kelbi"],
|
||||
"carves": {
|
||||
"Body Carve": 1,
|
||||
"Body Carve (KO)": 1,
|
||||
"Body Carve (KO Large Kelbi)": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"monsters": ["Gypceros", "Purple Gypceros"],
|
||||
"carves": {
|
||||
"Body Carve (Apparent Death)": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
Binary file not shown.
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os.path
|
||||
import codecs
|
||||
import json
|
||||
|
||||
import _pathfix
|
||||
from _pathfix import db_path
|
||||
|
||||
from mhapi.db import MHDB
|
||||
|
||||
|
||||
def get_utf8_writer(writer):
|
||||
return codecs.getwriter("utf8")(writer)
|
||||
|
||||
|
||||
def set_carve_counts(db, monster_carves):
|
||||
monsters = db.get_monsters()
|
||||
for m in monsters:
|
||||
rewards = db.get_monster_rewards(m.id)
|
||||
mc = monster_carves.get(m.name)
|
||||
print "===", m.name
|
||||
for r in rewards:
|
||||
condition = r["condition"]
|
||||
if "Carve" not in condition:
|
||||
continue
|
||||
if mc and condition in mc:
|
||||
stack_size = mc[condition]
|
||||
elif m["class"] == "Minion":
|
||||
stack_size = 1
|
||||
elif m["class"] == "Boss":
|
||||
if condition == "Body Carve":
|
||||
stack_size = 3
|
||||
elif condition == "Tail Carve":
|
||||
stack_size = 1
|
||||
else:
|
||||
print "WARN: unknown condition %s.%s" \
|
||||
% (m.name, condition)
|
||||
else:
|
||||
assert False, "Unknown monster class: %s" % m["class"]
|
||||
if r["stack_size"] == stack_size:
|
||||
continue
|
||||
print " ", condition, r["stack_size"], "=>", stack_size
|
||||
cur = db.cursor()
|
||||
cur.execute("""UPDATE hunting_rewards
|
||||
SET stack_size=? WHERE _id=?""",
|
||||
(stack_size, r["_id"]))
|
||||
|
||||
|
||||
def load_carves_json():
|
||||
carves_json_path = os.path.join(db_path, "carves.json")
|
||||
with open(carves_json_path) as f:
|
||||
carves_list = json.load(f)
|
||||
monster_carves = {}
|
||||
for carves in carves_list:
|
||||
for monster_name in carves["monsters"]:
|
||||
monster_carves[monster_name] = carves["carves"]
|
||||
return monster_carves
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
db_file = os.path.join(db_path, "mh4u.db")
|
||||
db = MHDB(db_file)
|
||||
|
||||
import sys
|
||||
sys.stdout = get_utf8_writer(sys.stdout)
|
||||
sys.stderr = get_utf8_writer(sys.stderr)
|
||||
monster_carves = load_carves_json()
|
||||
set_carve_counts(db, monster_carves)
|
||||
db.commit()
|
||||
db.close()
|
||||
Loading…
Reference in new issue