diff options
author | Stefan Beller <stefanbeller@googlemail.com> | 2010-09-29 08:17:17 +0200 |
---|---|---|
committer | Stefan Beller <stefanbeller@googlemail.com> | 2010-11-07 14:50:27 +0100 |
commit | 351213d8f4f0b922b238689ae6d004d3b797dd61 (patch) | |
tree | a0b129b110cf6c0d918bb0f46b928d79b2836828 | |
parent | 0689ee64ac4ecc427aa7f9fdf163c50088a5282d (diff) | |
download | tools-351213d8f4f0b922b238689ae6d004d3b797dd61.tar.gz tools-351213d8f4f0b922b238689ae6d004d3b797dd61.tar.bz2 tools-351213d8f4f0b922b238689ae6d004d3b797dd61.tar.xz tools-351213d8f4f0b922b238689ae6d004d3b797dd61.zip |
a script for average monster drop values
in the folder tools there is now a script which calulates the
average npc selling prize of all dropss by a specific monster.
This tool can be used for balancing purposes.
-rw-r--r-- | monster-killing-values.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/monster-killing-values.py b/monster-killing-values.py new file mode 100644 index 0000000..a2d7ec2 --- /dev/null +++ b/monster-killing-values.py @@ -0,0 +1,61 @@ +#!/usr/bin/python +#has to be executed in place, this folder + + +def make_items(): + items_file=open("../db/item_db.txt","r") + lines=items_file.readlines() + items_file.close(); + + items=[] + for line in lines: + array=line.split(",") + if len(array)>6 and not line.startswith("#") and not line.startswith("//"): + id=array[0] + sellprize=array[5] + try: + int(sellprize) + items+=[(int(id),int(sellprize))] + except: + print line + return items; + +def getvalueof(id): + for x in global_items: + if x[0]==id: + return int(x[1]) + return 0 + +def make_mobs(): + mobfile=open("../db/mob_db.txt","r") + lines=mobfile.readlines() + mobfile.close(); + + mobs=[] + for line in lines: + array=line.split(",") + if len(array)>6 and not line.startswith("#"): + id=array[0] + name=array[1] + #print name + #print array[29:44] + sellprize = 0 + #hardcoded -.- fix it ! + sellprize += getvalueof(int(array[29]))*int(array[30]) + sellprize += getvalueof(int(array[31]))*int(array[32]) + sellprize += getvalueof(int(array[33]))*int(array[34]) + sellprize += getvalueof(int(array[35]))*int(array[36]) + sellprize += getvalueof(int(array[37]))*int(array[38]) + sellprize += getvalueof(int(array[39]))*int(array[40]) + sellprize += getvalueof(int(array[41]))*int(array[32]) + sellprize += getvalueof(int(array[43]))*int(array[44]) + mobs+=[(name,sellprize/1000.0)] + return mobs + +global_items=[] +global_items=make_items(); + +mobs=make_mobs(); + +for mob in mobs: + print mob[1],mob[0] |