summaryrefslogtreecommitdiff
path: root/tools/monster-killing-values.py
blob: 9578804ea39be382a60ca3c160f70180cd35c2f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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]