Clean up the old MapleArrowFetcher
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -9,10 +9,6 @@
|
|||||||
/dist/
|
/dist/
|
||||||
/nbproject/
|
/nbproject/
|
||||||
|
|
||||||
/tools/MapleArrowFetcher/build/
|
|
||||||
/tools/MapleArrowFetcher/dist/
|
|
||||||
/tools/MapleArrowFetcher/nbproject/
|
|
||||||
|
|
||||||
/tools/MapleBossHpBarFetcher/build/
|
/tools/MapleBossHpBarFetcher/build/
|
||||||
/tools/MapleBossHpBarFetcher/dist/
|
/tools/MapleBossHpBarFetcher/dist/
|
||||||
/tools/MapleBossHpBarFetcher/nbproject/
|
/tools/MapleBossHpBarFetcher/nbproject/
|
||||||
|
|||||||
@@ -1,766 +0,0 @@
|
|||||||
# SQL File autogenerated from the MapleArrowFetcher feature by Ronan Lana.
|
|
||||||
# Generated data takes into account mob stats such as level and boss for the raw arrow ranges.
|
|
||||||
# Only current arrows entries on the DB it was compiled are being updated here.
|
|
||||||
|
|
||||||
UPDATE drop_data
|
|
||||||
SET minimum_quantity = CASE
|
|
||||||
WHEN dropperid = 100100 AND itemid = 2060000 THEN 1
|
|
||||||
WHEN dropperid = 100100 AND itemid = 2061000 THEN 1
|
|
||||||
WHEN dropperid = 100101 AND itemid = 2060000 THEN 2
|
|
||||||
WHEN dropperid = 100101 AND itemid = 2061000 THEN 2
|
|
||||||
WHEN dropperid = 100120 AND itemid = 2060000 THEN 1
|
|
||||||
WHEN dropperid = 100120 AND itemid = 2061000 THEN 1
|
|
||||||
WHEN dropperid = 100121 AND itemid = 2060000 THEN 4
|
|
||||||
WHEN dropperid = 100123 AND itemid = 2061000 THEN 9
|
|
||||||
WHEN dropperid = 100124 AND itemid = 2060000 THEN 11
|
|
||||||
WHEN dropperid = 100124 AND itemid = 2061000 THEN 11
|
|
||||||
WHEN dropperid = 120100 AND itemid = 2060000 THEN 2
|
|
||||||
WHEN dropperid = 120100 AND itemid = 2061000 THEN 2
|
|
||||||
WHEN dropperid = 130100 AND itemid = 2060000 THEN 5
|
|
||||||
WHEN dropperid = 130100 AND itemid = 2061000 THEN 5
|
|
||||||
WHEN dropperid = 130101 AND itemid = 2060000 THEN 5
|
|
||||||
WHEN dropperid = 130101 AND itemid = 2061000 THEN 5
|
|
||||||
WHEN dropperid = 210100 AND itemid = 2060000 THEN 7
|
|
||||||
WHEN dropperid = 210100 AND itemid = 2061000 THEN 7
|
|
||||||
WHEN dropperid = 1110100 AND itemid = 2060000 THEN 19
|
|
||||||
WHEN dropperid = 1110100 AND itemid = 2061000 THEN 19
|
|
||||||
WHEN dropperid = 1110101 AND itemid = 2060000 THEN 13
|
|
||||||
WHEN dropperid = 1110101 AND itemid = 2061000 THEN 13
|
|
||||||
WHEN dropperid = 1110130 AND itemid = 2060000 THEN 19
|
|
||||||
WHEN dropperid = 1110130 AND itemid = 2061000 THEN 19
|
|
||||||
WHEN dropperid = 1120100 AND itemid = 2060000 THEN 15
|
|
||||||
WHEN dropperid = 1120100 AND itemid = 2061000 THEN 15
|
|
||||||
WHEN dropperid = 1130100 AND itemid = 2060000 THEN 22
|
|
||||||
WHEN dropperid = 1130100 AND itemid = 2061000 THEN 22
|
|
||||||
WHEN dropperid = 1140100 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 1140100 AND itemid = 2061000 THEN 24
|
|
||||||
WHEN dropperid = 1140130 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 1140130 AND itemid = 2061000 THEN 24
|
|
||||||
WHEN dropperid = 1210100 AND itemid = 2060000 THEN 9
|
|
||||||
WHEN dropperid = 1210100 AND itemid = 2061000 THEN 9
|
|
||||||
WHEN dropperid = 1210101 AND itemid = 2060000 THEN 13
|
|
||||||
WHEN dropperid = 1210101 AND itemid = 2061000 THEN 13
|
|
||||||
WHEN dropperid = 1210102 AND itemid = 2060000 THEN 10
|
|
||||||
WHEN dropperid = 1210102 AND itemid = 2061000 THEN 10
|
|
||||||
WHEN dropperid = 1210103 AND itemid = 2060000 THEN 19
|
|
||||||
WHEN dropperid = 1210103 AND itemid = 2061000 THEN 19
|
|
||||||
WHEN dropperid = 2100100 AND itemid = 2060000 THEN 26
|
|
||||||
WHEN dropperid = 2100100 AND itemid = 2061000 THEN 26
|
|
||||||
WHEN dropperid = 2100101 AND itemid = 2060000 THEN 27
|
|
||||||
WHEN dropperid = 2100101 AND itemid = 2061000 THEN 27
|
|
||||||
WHEN dropperid = 2100102 AND itemid = 2060000 THEN 28
|
|
||||||
WHEN dropperid = 2100102 AND itemid = 2061000 THEN 28
|
|
||||||
WHEN dropperid = 2100103 AND itemid = 2060000 THEN 32
|
|
||||||
WHEN dropperid = 2100103 AND itemid = 2061000 THEN 32
|
|
||||||
WHEN dropperid = 2100104 AND itemid = 2060000 THEN 36
|
|
||||||
WHEN dropperid = 2100104 AND itemid = 2061000 THEN 36
|
|
||||||
WHEN dropperid = 2100105 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 2100105 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 2100106 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2100106 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2100107 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2100107 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2100108 AND itemid = 2060000 THEN 37
|
|
||||||
WHEN dropperid = 2100108 AND itemid = 2061000 THEN 37
|
|
||||||
WHEN dropperid = 2110200 AND itemid = 2060000 THEN 28
|
|
||||||
WHEN dropperid = 2110200 AND itemid = 2061000 THEN 28
|
|
||||||
WHEN dropperid = 2110300 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2110300 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2110301 AND itemid = 2060000 THEN 37
|
|
||||||
WHEN dropperid = 2110301 AND itemid = 2061000 THEN 37
|
|
||||||
WHEN dropperid = 2130100 AND itemid = 2060000 THEN 28
|
|
||||||
WHEN dropperid = 2130100 AND itemid = 2061000 THEN 28
|
|
||||||
WHEN dropperid = 2220000 AND itemid = 2060000 THEN 36
|
|
||||||
WHEN dropperid = 2220000 AND itemid = 2061000 THEN 36
|
|
||||||
WHEN dropperid = 2220100 AND itemid = 2060000 THEN 26
|
|
||||||
WHEN dropperid = 2220100 AND itemid = 2061000 THEN 26
|
|
||||||
WHEN dropperid = 2230100 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2230100 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2230101 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2230101 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2230102 AND itemid = 2060000 THEN 32
|
|
||||||
WHEN dropperid = 2230102 AND itemid = 2061000 THEN 32
|
|
||||||
WHEN dropperid = 2230103 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 2230103 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 2230104 AND itemid = 2060000 THEN 36
|
|
||||||
WHEN dropperid = 2230104 AND itemid = 2061000 THEN 36
|
|
||||||
WHEN dropperid = 2230105 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 2230105 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 2230106 AND itemid = 2060000 THEN 32
|
|
||||||
WHEN dropperid = 2230106 AND itemid = 2061000 THEN 32
|
|
||||||
WHEN dropperid = 2230107 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2230107 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2230108 AND itemid = 2060000 THEN 28
|
|
||||||
WHEN dropperid = 2230108 AND itemid = 2061000 THEN 28
|
|
||||||
WHEN dropperid = 2230109 AND itemid = 2060000 THEN 36
|
|
||||||
WHEN dropperid = 2230109 AND itemid = 2061000 THEN 36
|
|
||||||
WHEN dropperid = 2230110 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 2230110 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 2230111 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2230111 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2230131 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 2230131 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 2230200 AND itemid = 2060000 THEN 37
|
|
||||||
WHEN dropperid = 2230200 AND itemid = 2061000 THEN 37
|
|
||||||
WHEN dropperid = 2300100 AND itemid = 2060000 THEN 26
|
|
||||||
WHEN dropperid = 2300100 AND itemid = 2061000 THEN 26
|
|
||||||
WHEN dropperid = 3000000 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3000000 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3000005 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3000005 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3000006 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3000006 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3100101 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3100101 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3100102 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3100102 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3110101 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3110101 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3110102 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3110102 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3110300 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3110300 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3110301 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3110301 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3110302 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3110302 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3110303 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3110303 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3210100 AND itemid = 2060005 THEN 6
|
|
||||||
WHEN dropperid = 3210203 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 3210203 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 3210204 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 3210204 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 3210205 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 3210205 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 3210206 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 3210206 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2060005 THEN 7
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 3210208 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 3210208 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 3210450 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 3210450 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 3210800 AND itemid = 2060005 THEN 8
|
|
||||||
WHEN dropperid = 3220000 AND itemid = 2060000 THEN 63
|
|
||||||
WHEN dropperid = 3220000 AND itemid = 2061000 THEN 63
|
|
||||||
WHEN dropperid = 3230100 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3230100 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3230103 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3230103 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3230200 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3230200 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3230302 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3230302 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3230303 AND itemid = 2060000 THEN 48
|
|
||||||
WHEN dropperid = 3230303 AND itemid = 2061000 THEN 48
|
|
||||||
WHEN dropperid = 3230304 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3230304 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3230305 AND itemid = 2060000 THEN 51
|
|
||||||
WHEN dropperid = 3230305 AND itemid = 2061000 THEN 51
|
|
||||||
WHEN dropperid = 3230306 AND itemid = 2060000 THEN 48
|
|
||||||
WHEN dropperid = 3230306 AND itemid = 2061000 THEN 48
|
|
||||||
WHEN dropperid = 3230307 AND itemid = 2060000 THEN 40
|
|
||||||
WHEN dropperid = 3230307 AND itemid = 2061000 THEN 40
|
|
||||||
WHEN dropperid = 3230308 AND itemid = 2060000 THEN 51
|
|
||||||
WHEN dropperid = 3230308 AND itemid = 2061000 THEN 51
|
|
||||||
WHEN dropperid = 3230400 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3230400 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3230405 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3230405 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3300000 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3300000 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3300001 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 3300001 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 3300002 AND itemid = 2060000 THEN 40
|
|
||||||
WHEN dropperid = 3300002 AND itemid = 2061000 THEN 40
|
|
||||||
WHEN dropperid = 3300003 AND itemid = 2060000 THEN 41
|
|
||||||
WHEN dropperid = 3300003 AND itemid = 2061000 THEN 41
|
|
||||||
WHEN dropperid = 3300004 AND itemid = 2060000 THEN 43
|
|
||||||
WHEN dropperid = 3300004 AND itemid = 2061000 THEN 43
|
|
||||||
WHEN dropperid = 3300006 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3300006 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3300007 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 3300007 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 3300008 AND itemid = 2060000 THEN 69
|
|
||||||
WHEN dropperid = 3300008 AND itemid = 2061000 THEN 69
|
|
||||||
WHEN dropperid = 4110300 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 4110300 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 4110301 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4110301 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4130103 AND itemid = 2060000 THEN 85
|
|
||||||
WHEN dropperid = 4130103 AND itemid = 2061000 THEN 85
|
|
||||||
WHEN dropperid = 4230103 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 4230103 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 4230106 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230106 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230108 AND itemid = 2060000 THEN 56
|
|
||||||
WHEN dropperid = 4230108 AND itemid = 2061000 THEN 56
|
|
||||||
WHEN dropperid = 4230109 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 4230109 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 4230110 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230110 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230111 AND itemid = 2060000 THEN 53
|
|
||||||
WHEN dropperid = 4230111 AND itemid = 2061000 THEN 53
|
|
||||||
WHEN dropperid = 4230112 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 4230112 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 4230113 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 4230113 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 4230114 AND itemid = 2060000 THEN 53
|
|
||||||
WHEN dropperid = 4230114 AND itemid = 2061000 THEN 53
|
|
||||||
WHEN dropperid = 4230115 AND itemid = 2060000 THEN 60
|
|
||||||
WHEN dropperid = 4230115 AND itemid = 2061000 THEN 60
|
|
||||||
WHEN dropperid = 4230116 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 4230116 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 4230117 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 4230117 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 4230118 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230118 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230119 AND itemid = 2060000 THEN 53
|
|
||||||
WHEN dropperid = 4230119 AND itemid = 2061000 THEN 53
|
|
||||||
WHEN dropperid = 4230120 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 4230120 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 4230121 AND itemid = 2060000 THEN 60
|
|
||||||
WHEN dropperid = 4230121 AND itemid = 2061000 THEN 60
|
|
||||||
WHEN dropperid = 4230123 AND itemid = 2060000 THEN 56
|
|
||||||
WHEN dropperid = 4230123 AND itemid = 2061000 THEN 56
|
|
||||||
WHEN dropperid = 4230124 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 4230124 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 4230125 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 4230125 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 4230126 AND itemid = 2060000 THEN 61
|
|
||||||
WHEN dropperid = 4230126 AND itemid = 2061000 THEN 61
|
|
||||||
WHEN dropperid = 4230201 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 4230201 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 4230300 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230300 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230400 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230400 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230500 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 4230500 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 4230501 AND itemid = 2060000 THEN 53
|
|
||||||
WHEN dropperid = 4230501 AND itemid = 2061000 THEN 53
|
|
||||||
WHEN dropperid = 4230502 AND itemid = 2060000 THEN 56
|
|
||||||
WHEN dropperid = 4230502 AND itemid = 2061000 THEN 56
|
|
||||||
WHEN dropperid = 4230503 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230503 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230504 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 4230504 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 4230600 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 4230600 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 4240000 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 4240000 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 5120100 AND itemid = 2060000 THEN 98
|
|
||||||
WHEN dropperid = 5120100 AND itemid = 2061000 THEN 98
|
|
||||||
WHEN dropperid = 5130104 AND itemid = 2060000 THEN 71
|
|
||||||
WHEN dropperid = 5130104 AND itemid = 2061000 THEN 71
|
|
||||||
WHEN dropperid = 5140000 AND itemid = 2060000 THEN 75
|
|
||||||
WHEN dropperid = 5140000 AND itemid = 2061000 THEN 75
|
|
||||||
WHEN dropperid = 5150000 AND itemid = 2060000 THEN 77
|
|
||||||
WHEN dropperid = 5150000 AND itemid = 2061000 THEN 77
|
|
||||||
WHEN dropperid = 5200000 AND itemid = 2060001 THEN 15
|
|
||||||
WHEN dropperid = 5200000 AND itemid = 2061001 THEN 15
|
|
||||||
WHEN dropperid = 5200001 AND itemid = 2060001 THEN 19
|
|
||||||
WHEN dropperid = 5200001 AND itemid = 2061001 THEN 19
|
|
||||||
WHEN dropperid = 5200002 AND itemid = 2060001 THEN 19
|
|
||||||
WHEN dropperid = 5200002 AND itemid = 2061001 THEN 19
|
|
||||||
WHEN dropperid = 5220000 AND itemid = 2060000 THEN 100
|
|
||||||
WHEN dropperid = 5220000 AND itemid = 2061000 THEN 100
|
|
||||||
WHEN dropperid = 5220002 AND itemid = 2060000 THEN 91
|
|
||||||
WHEN dropperid = 5220002 AND itemid = 2061000 THEN 91
|
|
||||||
WHEN dropperid = 5220003 AND itemid = 2060000 THEN 107
|
|
||||||
WHEN dropperid = 5220003 AND itemid = 2061000 THEN 107
|
|
||||||
WHEN dropperid = 5400000 AND itemid = 2060001 THEN 22
|
|
||||||
WHEN dropperid = 5400000 AND itemid = 2061001 THEN 22
|
|
||||||
WHEN dropperid = 6220000 AND itemid = 2060000 THEN 118
|
|
||||||
WHEN dropperid = 6220000 AND itemid = 2061000 THEN 118
|
|
||||||
WHEN dropperid = 7120103 AND itemid = 2060003 THEN 22
|
|
||||||
WHEN dropperid = 7220000 AND itemid = 2060001 THEN 64
|
|
||||||
WHEN dropperid = 7220000 AND itemid = 2061001 THEN 64
|
|
||||||
WHEN dropperid = 7220001 AND itemid = 2060001 THEN 63
|
|
||||||
WHEN dropperid = 7220001 AND itemid = 2061001 THEN 63
|
|
||||||
WHEN dropperid = 7220002 AND itemid = 2060001 THEN 70
|
|
||||||
WHEN dropperid = 7220002 AND itemid = 2061001 THEN 70
|
|
||||||
WHEN dropperid = 8220000 AND itemid = 2060001 THEN 75
|
|
||||||
WHEN dropperid = 8220000 AND itemid = 2061001 THEN 75
|
|
||||||
WHEN dropperid = 8220001 AND itemid = 2060001 THEN 82
|
|
||||||
WHEN dropperid = 8220001 AND itemid = 2061001 THEN 82
|
|
||||||
WHEN dropperid = 9300011 AND itemid = 2060000 THEN 51
|
|
||||||
WHEN dropperid = 9300011 AND itemid = 2061000 THEN 51
|
|
||||||
WHEN dropperid = 9300060 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 9300060 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 9300131 AND itemid = 2060000 THEN 51
|
|
||||||
WHEN dropperid = 9300131 AND itemid = 2061000 THEN 51
|
|
||||||
WHEN dropperid = 9300132 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 9300132 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9300133 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9300160 AND itemid = 2060000 THEN 82
|
|
||||||
WHEN dropperid = 9300160 AND itemid = 2061000 THEN 82
|
|
||||||
WHEN dropperid = 9300161 AND itemid = 2060000 THEN 82
|
|
||||||
WHEN dropperid = 9300161 AND itemid = 2061000 THEN 82
|
|
||||||
WHEN dropperid = 9300274 AND itemid = 2060000 THEN 10
|
|
||||||
WHEN dropperid = 9300274 AND itemid = 2061000 THEN 10
|
|
||||||
WHEN dropperid = 9300332 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 9300334 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 9300341 AND itemid = 2060000 THEN 7
|
|
||||||
WHEN dropperid = 9300341 AND itemid = 2061000 THEN 7
|
|
||||||
WHEN dropperid = 9300342 AND itemid = 2060000 THEN 10
|
|
||||||
WHEN dropperid = 9300342 AND itemid = 2061000 THEN 10
|
|
||||||
WHEN dropperid = 9300343 AND itemid = 2060000 THEN 9
|
|
||||||
WHEN dropperid = 9300343 AND itemid = 2061000 THEN 9
|
|
||||||
WHEN dropperid = 9303005 AND itemid = 2060001 THEN 17
|
|
||||||
WHEN dropperid = 9303005 AND itemid = 2061001 THEN 17
|
|
||||||
WHEN dropperid = 9303008 AND itemid = 2060001 THEN 17
|
|
||||||
WHEN dropperid = 9303008 AND itemid = 2061001 THEN 17
|
|
||||||
WHEN dropperid = 9303009 AND itemid = 2060001 THEN 33
|
|
||||||
WHEN dropperid = 9303009 AND itemid = 2061001 THEN 33
|
|
||||||
WHEN dropperid = 9400000 AND itemid = 2060001 THEN 16
|
|
||||||
WHEN dropperid = 9400009 AND itemid = 2060001 THEN 130
|
|
||||||
WHEN dropperid = 9400011 AND itemid = 2060002 THEN 17
|
|
||||||
WHEN dropperid = 9400100 AND itemid = 2060003 THEN 14
|
|
||||||
WHEN dropperid = 9400101 AND itemid = 2061003 THEN 15
|
|
||||||
WHEN dropperid = 9400204 AND itemid = 2060003 THEN 17
|
|
||||||
WHEN dropperid = 9400239 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 9400239 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 9400244 AND itemid = 2060000 THEN 77
|
|
||||||
WHEN dropperid = 9400244 AND itemid = 2061000 THEN 77
|
|
||||||
WHEN dropperid = 9400248 AND itemid = 2060000 THEN 31
|
|
||||||
WHEN dropperid = 9400248 AND itemid = 2061000 THEN 31
|
|
||||||
WHEN dropperid = 9400540 AND itemid = 2060004 THEN 6
|
|
||||||
WHEN dropperid = 9400540 AND itemid = 2061004 THEN 6
|
|
||||||
WHEN dropperid = 9400541 AND itemid = 2060004 THEN 6
|
|
||||||
WHEN dropperid = 9400541 AND itemid = 2061004 THEN 6
|
|
||||||
WHEN dropperid = 9400542 AND itemid = 2060004 THEN 9
|
|
||||||
WHEN dropperid = 9400542 AND itemid = 2061004 THEN 9
|
|
||||||
WHEN dropperid = 9400543 AND itemid = 2060004 THEN 10
|
|
||||||
WHEN dropperid = 9400543 AND itemid = 2061004 THEN 10
|
|
||||||
WHEN dropperid = 9400547 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 9400547 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 9400548 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 9400548 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9400550 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 9400550 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 9400558 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 9400558 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9400563 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 9400563 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 9400638 AND itemid = 2060000 THEN 26
|
|
||||||
WHEN dropperid = 9400638 AND itemid = 2061000 THEN 26
|
|
||||||
WHEN dropperid = 9420500 AND itemid = 2060000 THEN 36
|
|
||||||
WHEN dropperid = 9420500 AND itemid = 2061000 THEN 36
|
|
||||||
WHEN dropperid = 9420502 AND itemid = 2060000 THEN 23
|
|
||||||
WHEN dropperid = 9420502 AND itemid = 2061000 THEN 23
|
|
||||||
WHEN dropperid = 9420506 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 9420506 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 9420508 AND itemid = 2060000 THEN 56
|
|
||||||
WHEN dropperid = 9420508 AND itemid = 2061000 THEN 56
|
|
||||||
WHEN dropperid = 9420527 AND itemid = 2060001 THEN 29
|
|
||||||
WHEN dropperid = 9420527 AND itemid = 2061001 THEN 29
|
|
||||||
WHEN dropperid = 9420531 AND itemid = 2060001 THEN 38
|
|
||||||
WHEN dropperid = 9420531 AND itemid = 2061001 THEN 38
|
|
||||||
WHEN dropperid = 9500112 AND itemid = 2060001 THEN 22
|
|
||||||
WHEN dropperid = 9500112 AND itemid = 2061001 THEN 22
|
|
||||||
WHEN dropperid = 9500119 AND itemid = 2060000 THEN 51
|
|
||||||
WHEN dropperid = 9500119 AND itemid = 2061000 THEN 51
|
|
||||||
WHEN dropperid = 9500120 AND itemid = 2060000 THEN 58
|
|
||||||
WHEN dropperid = 9500120 AND itemid = 2061000 THEN 58
|
|
||||||
WHEN dropperid = 9500122 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 9500123 AND itemid = 2060000 THEN 77
|
|
||||||
WHEN dropperid = 9500123 AND itemid = 2061000 THEN 77
|
|
||||||
WHEN dropperid = 9500308 AND itemid = 2060000 THEN 91
|
|
||||||
WHEN dropperid = 9500308 AND itemid = 2061000 THEN 91
|
|
||||||
WHEN dropperid = 9500310 AND itemid = 2060000 THEN 107
|
|
||||||
WHEN dropperid = 9500310 AND itemid = 2061000 THEN 107
|
|
||||||
WHEN dropperid = 9500312 AND itemid = 2060001 THEN 63
|
|
||||||
WHEN dropperid = 9500312 AND itemid = 2061001 THEN 63
|
|
||||||
WHEN dropperid = 9500313 AND itemid = 2060001 THEN 64
|
|
||||||
WHEN dropperid = 9500313 AND itemid = 2061001 THEN 64
|
|
||||||
WHEN dropperid = 9500314 AND itemid = 2060001 THEN 70
|
|
||||||
WHEN dropperid = 9500314 AND itemid = 2061001 THEN 70
|
|
||||||
WHEN dropperid = 9500321 AND itemid = 2060001 THEN 6
|
|
||||||
WHEN dropperid = 9500321 AND itemid = 2061001 THEN 6
|
|
||||||
WHEN dropperid = 9500366 AND itemid = 2060000 THEN 19
|
|
||||||
WHEN dropperid = 9500369 AND itemid = 2060000 THEN 19
|
|
||||||
ELSE minimum_quantity END,
|
|
||||||
maximum_quantity = CASE
|
|
||||||
WHEN dropperid = 100100 AND itemid = 2060000 THEN 2
|
|
||||||
WHEN dropperid = 100100 AND itemid = 2061000 THEN 2
|
|
||||||
WHEN dropperid = 100101 AND itemid = 2060000 THEN 3
|
|
||||||
WHEN dropperid = 100101 AND itemid = 2061000 THEN 3
|
|
||||||
WHEN dropperid = 100120 AND itemid = 2060000 THEN 2
|
|
||||||
WHEN dropperid = 100120 AND itemid = 2061000 THEN 2
|
|
||||||
WHEN dropperid = 100121 AND itemid = 2060000 THEN 5
|
|
||||||
WHEN dropperid = 100123 AND itemid = 2061000 THEN 12
|
|
||||||
WHEN dropperid = 100124 AND itemid = 2060000 THEN 14
|
|
||||||
WHEN dropperid = 100124 AND itemid = 2061000 THEN 14
|
|
||||||
WHEN dropperid = 120100 AND itemid = 2060000 THEN 3
|
|
||||||
WHEN dropperid = 120100 AND itemid = 2061000 THEN 3
|
|
||||||
WHEN dropperid = 130100 AND itemid = 2060000 THEN 7
|
|
||||||
WHEN dropperid = 130100 AND itemid = 2061000 THEN 7
|
|
||||||
WHEN dropperid = 130101 AND itemid = 2060000 THEN 7
|
|
||||||
WHEN dropperid = 130101 AND itemid = 2061000 THEN 7
|
|
||||||
WHEN dropperid = 210100 AND itemid = 2060000 THEN 9
|
|
||||||
WHEN dropperid = 210100 AND itemid = 2061000 THEN 9
|
|
||||||
WHEN dropperid = 1110100 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 1110100 AND itemid = 2061000 THEN 24
|
|
||||||
WHEN dropperid = 1110101 AND itemid = 2060000 THEN 17
|
|
||||||
WHEN dropperid = 1110101 AND itemid = 2061000 THEN 17
|
|
||||||
WHEN dropperid = 1110130 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 1110130 AND itemid = 2061000 THEN 24
|
|
||||||
WHEN dropperid = 1120100 AND itemid = 2060000 THEN 19
|
|
||||||
WHEN dropperid = 1120100 AND itemid = 2061000 THEN 19
|
|
||||||
WHEN dropperid = 1130100 AND itemid = 2060000 THEN 28
|
|
||||||
WHEN dropperid = 1130100 AND itemid = 2061000 THEN 28
|
|
||||||
WHEN dropperid = 1140100 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 1140100 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 1140130 AND itemid = 2060000 THEN 30
|
|
||||||
WHEN dropperid = 1140130 AND itemid = 2061000 THEN 30
|
|
||||||
WHEN dropperid = 1210100 AND itemid = 2060000 THEN 12
|
|
||||||
WHEN dropperid = 1210100 AND itemid = 2061000 THEN 12
|
|
||||||
WHEN dropperid = 1210101 AND itemid = 2060000 THEN 17
|
|
||||||
WHEN dropperid = 1210101 AND itemid = 2061000 THEN 17
|
|
||||||
WHEN dropperid = 1210102 AND itemid = 2060000 THEN 13
|
|
||||||
WHEN dropperid = 1210102 AND itemid = 2061000 THEN 13
|
|
||||||
WHEN dropperid = 1210103 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 1210103 AND itemid = 2061000 THEN 24
|
|
||||||
WHEN dropperid = 2100100 AND itemid = 2060000 THEN 33
|
|
||||||
WHEN dropperid = 2100100 AND itemid = 2061000 THEN 33
|
|
||||||
WHEN dropperid = 2100101 AND itemid = 2060000 THEN 34
|
|
||||||
WHEN dropperid = 2100101 AND itemid = 2061000 THEN 34
|
|
||||||
WHEN dropperid = 2100102 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2100102 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2100103 AND itemid = 2060000 THEN 40
|
|
||||||
WHEN dropperid = 2100103 AND itemid = 2061000 THEN 40
|
|
||||||
WHEN dropperid = 2100104 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 2100104 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 2100105 AND itemid = 2060000 THEN 38
|
|
||||||
WHEN dropperid = 2100105 AND itemid = 2061000 THEN 38
|
|
||||||
WHEN dropperid = 2100106 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2100106 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2100107 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 2100107 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 2100108 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 2100108 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 2110200 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2110200 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2110300 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2110300 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2110301 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 2110301 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 2130100 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2130100 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2220000 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 2220000 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 2220100 AND itemid = 2060000 THEN 33
|
|
||||||
WHEN dropperid = 2220100 AND itemid = 2061000 THEN 33
|
|
||||||
WHEN dropperid = 2230100 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 2230100 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 2230101 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2230101 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2230102 AND itemid = 2060000 THEN 40
|
|
||||||
WHEN dropperid = 2230102 AND itemid = 2061000 THEN 40
|
|
||||||
WHEN dropperid = 2230103 AND itemid = 2060000 THEN 38
|
|
||||||
WHEN dropperid = 2230103 AND itemid = 2061000 THEN 38
|
|
||||||
WHEN dropperid = 2230104 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 2230104 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 2230105 AND itemid = 2060000 THEN 38
|
|
||||||
WHEN dropperid = 2230105 AND itemid = 2061000 THEN 38
|
|
||||||
WHEN dropperid = 2230106 AND itemid = 2060000 THEN 40
|
|
||||||
WHEN dropperid = 2230106 AND itemid = 2061000 THEN 40
|
|
||||||
WHEN dropperid = 2230107 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2230107 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2230108 AND itemid = 2060000 THEN 35
|
|
||||||
WHEN dropperid = 2230108 AND itemid = 2061000 THEN 35
|
|
||||||
WHEN dropperid = 2230109 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 2230109 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 2230110 AND itemid = 2060000 THEN 38
|
|
||||||
WHEN dropperid = 2230110 AND itemid = 2061000 THEN 38
|
|
||||||
WHEN dropperid = 2230111 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2230111 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2230131 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 2230131 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 2230200 AND itemid = 2060000 THEN 47
|
|
||||||
WHEN dropperid = 2230200 AND itemid = 2061000 THEN 47
|
|
||||||
WHEN dropperid = 2300100 AND itemid = 2060000 THEN 33
|
|
||||||
WHEN dropperid = 2300100 AND itemid = 2061000 THEN 33
|
|
||||||
WHEN dropperid = 3000000 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3000000 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3000005 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3000005 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3000006 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3000006 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3100101 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3100101 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3100102 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3100102 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3110101 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3110101 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3110102 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3110102 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3110300 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3110300 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3110301 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3110301 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3110302 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3110302 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3110303 AND itemid = 2060000 THEN 62
|
|
||||||
WHEN dropperid = 3110303 AND itemid = 2061000 THEN 62
|
|
||||||
WHEN dropperid = 3210100 AND itemid = 2060005 THEN 8
|
|
||||||
WHEN dropperid = 3210203 AND itemid = 2060000 THEN 59
|
|
||||||
WHEN dropperid = 3210203 AND itemid = 2061000 THEN 59
|
|
||||||
WHEN dropperid = 3210204 AND itemid = 2060000 THEN 55
|
|
||||||
WHEN dropperid = 3210204 AND itemid = 2061000 THEN 55
|
|
||||||
WHEN dropperid = 3210205 AND itemid = 2060000 THEN 55
|
|
||||||
WHEN dropperid = 3210205 AND itemid = 2061000 THEN 55
|
|
||||||
WHEN dropperid = 3210206 AND itemid = 2060000 THEN 59
|
|
||||||
WHEN dropperid = 3210206 AND itemid = 2061000 THEN 59
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2060000 THEN 55
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2060005 THEN 9
|
|
||||||
WHEN dropperid = 3210207 AND itemid = 2061000 THEN 55
|
|
||||||
WHEN dropperid = 3210208 AND itemid = 2060000 THEN 59
|
|
||||||
WHEN dropperid = 3210208 AND itemid = 2061000 THEN 59
|
|
||||||
WHEN dropperid = 3210450 AND itemid = 2060000 THEN 59
|
|
||||||
WHEN dropperid = 3210450 AND itemid = 2061000 THEN 59
|
|
||||||
WHEN dropperid = 3210800 AND itemid = 2060005 THEN 10
|
|
||||||
WHEN dropperid = 3220000 AND itemid = 2060000 THEN 79
|
|
||||||
WHEN dropperid = 3220000 AND itemid = 2061000 THEN 79
|
|
||||||
WHEN dropperid = 3230100 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3230100 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3230103 AND itemid = 2060000 THEN 62
|
|
||||||
WHEN dropperid = 3230103 AND itemid = 2061000 THEN 62
|
|
||||||
WHEN dropperid = 3230200 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3230200 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3230302 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3230302 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3230303 AND itemid = 2060000 THEN 60
|
|
||||||
WHEN dropperid = 3230303 AND itemid = 2061000 THEN 60
|
|
||||||
WHEN dropperid = 3230304 AND itemid = 2060000 THEN 62
|
|
||||||
WHEN dropperid = 3230304 AND itemid = 2061000 THEN 62
|
|
||||||
WHEN dropperid = 3230305 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 3230305 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 3230306 AND itemid = 2060000 THEN 60
|
|
||||||
WHEN dropperid = 3230306 AND itemid = 2061000 THEN 60
|
|
||||||
WHEN dropperid = 3230307 AND itemid = 2060000 THEN 50
|
|
||||||
WHEN dropperid = 3230307 AND itemid = 2061000 THEN 50
|
|
||||||
WHEN dropperid = 3230308 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 3230308 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 3230400 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3230400 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3230405 AND itemid = 2060000 THEN 62
|
|
||||||
WHEN dropperid = 3230405 AND itemid = 2061000 THEN 62
|
|
||||||
WHEN dropperid = 3300000 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3300000 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3300001 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 3300001 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 3300002 AND itemid = 2060000 THEN 50
|
|
||||||
WHEN dropperid = 3300002 AND itemid = 2061000 THEN 50
|
|
||||||
WHEN dropperid = 3300003 AND itemid = 2060000 THEN 52
|
|
||||||
WHEN dropperid = 3300003 AND itemid = 2061000 THEN 52
|
|
||||||
WHEN dropperid = 3300004 AND itemid = 2060000 THEN 54
|
|
||||||
WHEN dropperid = 3300004 AND itemid = 2061000 THEN 54
|
|
||||||
WHEN dropperid = 3300006 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3300006 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3300007 AND itemid = 2060000 THEN 57
|
|
||||||
WHEN dropperid = 3300007 AND itemid = 2061000 THEN 57
|
|
||||||
WHEN dropperid = 3300008 AND itemid = 2060000 THEN 87
|
|
||||||
WHEN dropperid = 3300008 AND itemid = 2061000 THEN 87
|
|
||||||
WHEN dropperid = 4110300 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 4110300 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 4110301 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4110301 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4130103 AND itemid = 2060000 THEN 107
|
|
||||||
WHEN dropperid = 4130103 AND itemid = 2061000 THEN 107
|
|
||||||
WHEN dropperid = 4230103 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 4230103 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 4230106 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230106 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230108 AND itemid = 2060000 THEN 70
|
|
||||||
WHEN dropperid = 4230108 AND itemid = 2061000 THEN 70
|
|
||||||
WHEN dropperid = 4230109 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 4230109 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 4230110 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230110 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230111 AND itemid = 2060000 THEN 67
|
|
||||||
WHEN dropperid = 4230111 AND itemid = 2061000 THEN 67
|
|
||||||
WHEN dropperid = 4230112 AND itemid = 2060000 THEN 72
|
|
||||||
WHEN dropperid = 4230112 AND itemid = 2061000 THEN 72
|
|
||||||
WHEN dropperid = 4230113 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 4230113 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 4230114 AND itemid = 2060000 THEN 67
|
|
||||||
WHEN dropperid = 4230114 AND itemid = 2061000 THEN 67
|
|
||||||
WHEN dropperid = 4230115 AND itemid = 2060000 THEN 75
|
|
||||||
WHEN dropperid = 4230115 AND itemid = 2061000 THEN 75
|
|
||||||
WHEN dropperid = 4230116 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 4230116 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 4230117 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 4230117 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 4230118 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230118 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230119 AND itemid = 2060000 THEN 67
|
|
||||||
WHEN dropperid = 4230119 AND itemid = 2061000 THEN 67
|
|
||||||
WHEN dropperid = 4230120 AND itemid = 2060000 THEN 72
|
|
||||||
WHEN dropperid = 4230120 AND itemid = 2061000 THEN 72
|
|
||||||
WHEN dropperid = 4230121 AND itemid = 2060000 THEN 75
|
|
||||||
WHEN dropperid = 4230121 AND itemid = 2061000 THEN 75
|
|
||||||
WHEN dropperid = 4230123 AND itemid = 2060000 THEN 70
|
|
||||||
WHEN dropperid = 4230123 AND itemid = 2061000 THEN 70
|
|
||||||
WHEN dropperid = 4230124 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 4230124 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 4230125 AND itemid = 2060000 THEN 72
|
|
||||||
WHEN dropperid = 4230125 AND itemid = 2061000 THEN 72
|
|
||||||
WHEN dropperid = 4230126 AND itemid = 2060000 THEN 77
|
|
||||||
WHEN dropperid = 4230126 AND itemid = 2061000 THEN 77
|
|
||||||
WHEN dropperid = 4230201 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 4230201 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 4230300 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230300 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230400 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230400 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230500 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 4230500 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 4230501 AND itemid = 2060000 THEN 67
|
|
||||||
WHEN dropperid = 4230501 AND itemid = 2061000 THEN 67
|
|
||||||
WHEN dropperid = 4230502 AND itemid = 2060000 THEN 70
|
|
||||||
WHEN dropperid = 4230502 AND itemid = 2061000 THEN 70
|
|
||||||
WHEN dropperid = 4230503 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230503 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230504 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 4230504 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 4230600 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 4230600 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 4240000 AND itemid = 2060000 THEN 80
|
|
||||||
WHEN dropperid = 4240000 AND itemid = 2061000 THEN 80
|
|
||||||
WHEN dropperid = 5120100 AND itemid = 2060000 THEN 123
|
|
||||||
WHEN dropperid = 5120100 AND itemid = 2061000 THEN 123
|
|
||||||
WHEN dropperid = 5130104 AND itemid = 2060000 THEN 89
|
|
||||||
WHEN dropperid = 5130104 AND itemid = 2061000 THEN 89
|
|
||||||
WHEN dropperid = 5140000 AND itemid = 2060000 THEN 94
|
|
||||||
WHEN dropperid = 5140000 AND itemid = 2061000 THEN 94
|
|
||||||
WHEN dropperid = 5150000 AND itemid = 2060000 THEN 97
|
|
||||||
WHEN dropperid = 5150000 AND itemid = 2061000 THEN 97
|
|
||||||
WHEN dropperid = 5200000 AND itemid = 2060001 THEN 19
|
|
||||||
WHEN dropperid = 5200000 AND itemid = 2061001 THEN 19
|
|
||||||
WHEN dropperid = 5200001 AND itemid = 2060001 THEN 24
|
|
||||||
WHEN dropperid = 5200001 AND itemid = 2061001 THEN 24
|
|
||||||
WHEN dropperid = 5200002 AND itemid = 2060001 THEN 24
|
|
||||||
WHEN dropperid = 5200002 AND itemid = 2061001 THEN 24
|
|
||||||
WHEN dropperid = 5220000 AND itemid = 2060000 THEN 125
|
|
||||||
WHEN dropperid = 5220000 AND itemid = 2061000 THEN 125
|
|
||||||
WHEN dropperid = 5220002 AND itemid = 2060000 THEN 114
|
|
||||||
WHEN dropperid = 5220002 AND itemid = 2061000 THEN 114
|
|
||||||
WHEN dropperid = 5220003 AND itemid = 2060000 THEN 134
|
|
||||||
WHEN dropperid = 5220003 AND itemid = 2061000 THEN 134
|
|
||||||
WHEN dropperid = 5400000 AND itemid = 2060001 THEN 28
|
|
||||||
WHEN dropperid = 5400000 AND itemid = 2061001 THEN 28
|
|
||||||
WHEN dropperid = 6220000 AND itemid = 2060000 THEN 148
|
|
||||||
WHEN dropperid = 6220000 AND itemid = 2061000 THEN 148
|
|
||||||
WHEN dropperid = 7120103 AND itemid = 2060003 THEN 28
|
|
||||||
WHEN dropperid = 7220000 AND itemid = 2060001 THEN 81
|
|
||||||
WHEN dropperid = 7220000 AND itemid = 2061001 THEN 81
|
|
||||||
WHEN dropperid = 7220001 AND itemid = 2060001 THEN 79
|
|
||||||
WHEN dropperid = 7220001 AND itemid = 2061001 THEN 79
|
|
||||||
WHEN dropperid = 7220002 AND itemid = 2060001 THEN 87
|
|
||||||
WHEN dropperid = 7220002 AND itemid = 2061001 THEN 87
|
|
||||||
WHEN dropperid = 8220000 AND itemid = 2060001 THEN 94
|
|
||||||
WHEN dropperid = 8220000 AND itemid = 2061001 THEN 94
|
|
||||||
WHEN dropperid = 8220001 AND itemid = 2060001 THEN 102
|
|
||||||
WHEN dropperid = 8220001 AND itemid = 2061001 THEN 102
|
|
||||||
WHEN dropperid = 9300011 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 9300011 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 9300060 AND itemid = 2060000 THEN 68
|
|
||||||
WHEN dropperid = 9300060 AND itemid = 2061000 THEN 68
|
|
||||||
WHEN dropperid = 9300131 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 9300131 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 9300132 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 9300132 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 9300133 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 9300160 AND itemid = 2060000 THEN 103
|
|
||||||
WHEN dropperid = 9300160 AND itemid = 2061000 THEN 103
|
|
||||||
WHEN dropperid = 9300161 AND itemid = 2060000 THEN 103
|
|
||||||
WHEN dropperid = 9300161 AND itemid = 2061000 THEN 103
|
|
||||||
WHEN dropperid = 9300274 AND itemid = 2060000 THEN 13
|
|
||||||
WHEN dropperid = 9300274 AND itemid = 2061000 THEN 13
|
|
||||||
WHEN dropperid = 9300332 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 9300334 AND itemid = 2060000 THEN 80
|
|
||||||
WHEN dropperid = 9300341 AND itemid = 2060000 THEN 9
|
|
||||||
WHEN dropperid = 9300341 AND itemid = 2061000 THEN 9
|
|
||||||
WHEN dropperid = 9300342 AND itemid = 2060000 THEN 13
|
|
||||||
WHEN dropperid = 9300342 AND itemid = 2061000 THEN 13
|
|
||||||
WHEN dropperid = 9300343 AND itemid = 2060000 THEN 12
|
|
||||||
WHEN dropperid = 9300343 AND itemid = 2061000 THEN 12
|
|
||||||
WHEN dropperid = 9303005 AND itemid = 2060001 THEN 21
|
|
||||||
WHEN dropperid = 9303005 AND itemid = 2061001 THEN 21
|
|
||||||
WHEN dropperid = 9303008 AND itemid = 2060001 THEN 21
|
|
||||||
WHEN dropperid = 9303008 AND itemid = 2061001 THEN 21
|
|
||||||
WHEN dropperid = 9303009 AND itemid = 2060001 THEN 41
|
|
||||||
WHEN dropperid = 9303009 AND itemid = 2061001 THEN 41
|
|
||||||
WHEN dropperid = 9400000 AND itemid = 2060001 THEN 20
|
|
||||||
WHEN dropperid = 9400009 AND itemid = 2060001 THEN 163
|
|
||||||
WHEN dropperid = 9400011 AND itemid = 2060002 THEN 21
|
|
||||||
WHEN dropperid = 9400100 AND itemid = 2060003 THEN 18
|
|
||||||
WHEN dropperid = 9400101 AND itemid = 2061003 THEN 19
|
|
||||||
WHEN dropperid = 9400204 AND itemid = 2060003 THEN 22
|
|
||||||
WHEN dropperid = 9400239 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 9400239 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9400244 AND itemid = 2060000 THEN 97
|
|
||||||
WHEN dropperid = 9400244 AND itemid = 2061000 THEN 97
|
|
||||||
WHEN dropperid = 9400248 AND itemid = 2060000 THEN 39
|
|
||||||
WHEN dropperid = 9400248 AND itemid = 2061000 THEN 39
|
|
||||||
WHEN dropperid = 9400540 AND itemid = 2060004 THEN 8
|
|
||||||
WHEN dropperid = 9400540 AND itemid = 2061004 THEN 8
|
|
||||||
WHEN dropperid = 9400541 AND itemid = 2060004 THEN 8
|
|
||||||
WHEN dropperid = 9400541 AND itemid = 2061004 THEN 8
|
|
||||||
WHEN dropperid = 9400542 AND itemid = 2060004 THEN 11
|
|
||||||
WHEN dropperid = 9400542 AND itemid = 2061004 THEN 11
|
|
||||||
WHEN dropperid = 9400543 AND itemid = 2060004 THEN 13
|
|
||||||
WHEN dropperid = 9400543 AND itemid = 2061004 THEN 13
|
|
||||||
WHEN dropperid = 9400547 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 9400547 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 9400548 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 9400548 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 9400550 AND itemid = 2060000 THEN 44
|
|
||||||
WHEN dropperid = 9400550 AND itemid = 2061000 THEN 44
|
|
||||||
WHEN dropperid = 9400558 AND itemid = 2060000 THEN 49
|
|
||||||
WHEN dropperid = 9400558 AND itemid = 2061000 THEN 49
|
|
||||||
WHEN dropperid = 9400563 AND itemid = 2060000 THEN 65
|
|
||||||
WHEN dropperid = 9400563 AND itemid = 2061000 THEN 65
|
|
||||||
WHEN dropperid = 9400638 AND itemid = 2060000 THEN 33
|
|
||||||
WHEN dropperid = 9400638 AND itemid = 2061000 THEN 33
|
|
||||||
WHEN dropperid = 9420500 AND itemid = 2060000 THEN 45
|
|
||||||
WHEN dropperid = 9420500 AND itemid = 2061000 THEN 45
|
|
||||||
WHEN dropperid = 9420502 AND itemid = 2060000 THEN 29
|
|
||||||
WHEN dropperid = 9420502 AND itemid = 2061000 THEN 29
|
|
||||||
WHEN dropperid = 9420506 AND itemid = 2060000 THEN 38
|
|
||||||
WHEN dropperid = 9420506 AND itemid = 2061000 THEN 38
|
|
||||||
WHEN dropperid = 9420508 AND itemid = 2060000 THEN 70
|
|
||||||
WHEN dropperid = 9420508 AND itemid = 2061000 THEN 70
|
|
||||||
WHEN dropperid = 9420527 AND itemid = 2060001 THEN 36
|
|
||||||
WHEN dropperid = 9420527 AND itemid = 2061001 THEN 36
|
|
||||||
WHEN dropperid = 9420531 AND itemid = 2060001 THEN 48
|
|
||||||
WHEN dropperid = 9420531 AND itemid = 2061001 THEN 48
|
|
||||||
WHEN dropperid = 9500112 AND itemid = 2060001 THEN 28
|
|
||||||
WHEN dropperid = 9500112 AND itemid = 2061001 THEN 28
|
|
||||||
WHEN dropperid = 9500119 AND itemid = 2060000 THEN 64
|
|
||||||
WHEN dropperid = 9500119 AND itemid = 2061000 THEN 64
|
|
||||||
WHEN dropperid = 9500120 AND itemid = 2060000 THEN 73
|
|
||||||
WHEN dropperid = 9500120 AND itemid = 2061000 THEN 73
|
|
||||||
WHEN dropperid = 9500122 AND itemid = 2060000 THEN 80
|
|
||||||
WHEN dropperid = 9500123 AND itemid = 2060000 THEN 97
|
|
||||||
WHEN dropperid = 9500123 AND itemid = 2061000 THEN 97
|
|
||||||
WHEN dropperid = 9500308 AND itemid = 2060000 THEN 114
|
|
||||||
WHEN dropperid = 9500308 AND itemid = 2061000 THEN 114
|
|
||||||
WHEN dropperid = 9500310 AND itemid = 2060000 THEN 134
|
|
||||||
WHEN dropperid = 9500310 AND itemid = 2061000 THEN 134
|
|
||||||
WHEN dropperid = 9500312 AND itemid = 2060001 THEN 79
|
|
||||||
WHEN dropperid = 9500312 AND itemid = 2061001 THEN 79
|
|
||||||
WHEN dropperid = 9500313 AND itemid = 2060001 THEN 81
|
|
||||||
WHEN dropperid = 9500313 AND itemid = 2061001 THEN 81
|
|
||||||
WHEN dropperid = 9500314 AND itemid = 2060001 THEN 87
|
|
||||||
WHEN dropperid = 9500314 AND itemid = 2061001 THEN 87
|
|
||||||
WHEN dropperid = 9500321 AND itemid = 2060001 THEN 8
|
|
||||||
WHEN dropperid = 9500321 AND itemid = 2061001 THEN 8
|
|
||||||
WHEN dropperid = 9500366 AND itemid = 2060000 THEN 24
|
|
||||||
WHEN dropperid = 9500369 AND itemid = 2060000 THEN 24
|
|
||||||
ELSE maximum_quantity END
|
|
||||||
;
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package life;
|
|
||||||
|
|
||||||
public enum Element {
|
|
||||||
NEUTRAL, FIRE, ICE, LIGHTING, POISON, HOLY, DARK;
|
|
||||||
|
|
||||||
public static Element getFromChar(char c) {
|
|
||||||
switch (Character.toUpperCase(c)) {
|
|
||||||
case 'F':
|
|
||||||
return FIRE;
|
|
||||||
case 'I':
|
|
||||||
return ICE;
|
|
||||||
case 'L':
|
|
||||||
return LIGHTING;
|
|
||||||
case 'S':
|
|
||||||
return POISON;
|
|
||||||
case 'H':
|
|
||||||
return HOLY;
|
|
||||||
case 'D':
|
|
||||||
return DARK;
|
|
||||||
case 'P':
|
|
||||||
return NEUTRAL;
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("unknown elemnt char " + c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package life;
|
|
||||||
|
|
||||||
public enum ElementalEffectiveness {
|
|
||||||
NORMAL, IMMUNE, STRONG, WEAK, NEUTRAL;
|
|
||||||
|
|
||||||
public static ElementalEffectiveness getByNumber(int num) {
|
|
||||||
switch (num) {
|
|
||||||
case 1:
|
|
||||||
return IMMUNE;
|
|
||||||
case 2:
|
|
||||||
return STRONG;
|
|
||||||
case 3:
|
|
||||||
return WEAK;
|
|
||||||
case 4:
|
|
||||||
return NEUTRAL;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unkown effectiveness: " + num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package life;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataDirectoryEntry;
|
|
||||||
import provider.MapleDataFileEntry;
|
|
||||||
import provider.MapleDataProvider;
|
|
||||||
import provider.MapleDataProviderFactory;
|
|
||||||
import provider.MapleDataTool;
|
|
||||||
import provider.wz.MapleDataType;
|
|
||||||
import tools.Pair;
|
|
||||||
|
|
||||||
public class MapleLifeFactory {
|
|
||||||
private static String wzPath = "../../wz";
|
|
||||||
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(wzPath + "/Mob.wz"));
|
|
||||||
private final static MapleDataProvider stringDataWZ = MapleDataProviderFactory.getDataProvider(new File(wzPath + "/String.wz"));
|
|
||||||
private static MapleData mobStringData = stringDataWZ.getData("Mob.img");
|
|
||||||
private static MapleData npcStringData = stringDataWZ.getData("Npc.img");
|
|
||||||
private static Map<Integer, MapleMonsterStats> monsterStats = new HashMap<>();
|
|
||||||
|
|
||||||
private static int getMonsterId(String fileName) {
|
|
||||||
return Integer.parseInt(fileName.substring(0, 7));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<Integer, MapleMonsterStats> getAllMonsterStats() {
|
|
||||||
MapleDataDirectoryEntry root = data.getRoot();
|
|
||||||
|
|
||||||
System.out.print("Parsing mob stats... ");
|
|
||||||
for (MapleDataFileEntry mFile : root.getFiles()) {
|
|
||||||
try {
|
|
||||||
String fileName = mFile.getName();
|
|
||||||
|
|
||||||
//System.out.println("Parsing '" + fileName + "'");
|
|
||||||
MapleData monsterData = data.getData(fileName);
|
|
||||||
if (monsterData == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer mid = getMonsterId(fileName);
|
|
||||||
|
|
||||||
MapleData monsterInfoData = monsterData.getChildByPath("info");
|
|
||||||
MapleMonsterStats stats = new MapleMonsterStats();
|
|
||||||
stats.setHp(MapleDataTool.getIntConvert("maxHP", monsterInfoData));
|
|
||||||
stats.setFriendly(MapleDataTool.getIntConvert("damagedByMob", monsterInfoData, 0) == 1);
|
|
||||||
stats.setPADamage(MapleDataTool.getIntConvert("PADamage", monsterInfoData));
|
|
||||||
stats.setPDDamage(MapleDataTool.getIntConvert("PDDamage", monsterInfoData));
|
|
||||||
stats.setMADamage(MapleDataTool.getIntConvert("MADamage", monsterInfoData));
|
|
||||||
stats.setMDDamage(MapleDataTool.getIntConvert("MDDamage", monsterInfoData));
|
|
||||||
stats.setMp(MapleDataTool.getIntConvert("maxMP", monsterInfoData, 0));
|
|
||||||
stats.setExp(MapleDataTool.getIntConvert("exp", monsterInfoData, 0));
|
|
||||||
stats.setLevel(MapleDataTool.getIntConvert("level", monsterInfoData));
|
|
||||||
stats.setRemoveAfter(MapleDataTool.getIntConvert("removeAfter", monsterInfoData, 0));
|
|
||||||
stats.setBoss(MapleDataTool.getIntConvert("boss", monsterInfoData, 0) > 0);
|
|
||||||
stats.setExplosiveReward(MapleDataTool.getIntConvert("explosiveReward", monsterInfoData, 0) > 0);
|
|
||||||
stats.setFfaLoot(MapleDataTool.getIntConvert("publicReward", monsterInfoData, 0) > 0);
|
|
||||||
stats.setUndead(MapleDataTool.getIntConvert("undead", monsterInfoData, 0) > 0);
|
|
||||||
stats.setName(MapleDataTool.getString(mid + "/name", mobStringData, "MISSINGNO"));
|
|
||||||
stats.setBuffToGive(MapleDataTool.getIntConvert("buff", monsterInfoData, -1));
|
|
||||||
stats.setCP(MapleDataTool.getIntConvert("getCP", monsterInfoData, 0));
|
|
||||||
stats.setRemoveOnMiss(MapleDataTool.getIntConvert("removeOnMiss", monsterInfoData, 0) > 0);
|
|
||||||
|
|
||||||
MapleData special = monsterInfoData.getChildByPath("coolDamage");
|
|
||||||
if (special != null) {
|
|
||||||
int coolDmg = MapleDataTool.getIntConvert("coolDamage", monsterInfoData);
|
|
||||||
int coolProb = MapleDataTool.getIntConvert("coolDamageProb", monsterInfoData, 0);
|
|
||||||
stats.setCool(new Pair<>(coolDmg, coolProb));
|
|
||||||
}
|
|
||||||
special = monsterInfoData.getChildByPath("loseItem");
|
|
||||||
if (special != null) {
|
|
||||||
for (MapleData liData : special.getChildren()) {
|
|
||||||
stats.addLoseItem(new loseItem(MapleDataTool.getInt(liData.getChildByPath("id")), (byte) MapleDataTool.getInt(liData.getChildByPath("prop")), (byte) MapleDataTool.getInt(liData.getChildByPath("x"))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
special = monsterInfoData.getChildByPath("selfDestruction");
|
|
||||||
if (special != null) {
|
|
||||||
stats.setSelfDestruction(new selfDestruction((byte) MapleDataTool.getInt(special.getChildByPath("action")), MapleDataTool.getIntConvert("removeAfter", special, -1), MapleDataTool.getIntConvert("hp", special, -1)));
|
|
||||||
}
|
|
||||||
MapleData firstAttackData = monsterInfoData.getChildByPath("firstAttack");
|
|
||||||
int firstAttack = 0;
|
|
||||||
if (firstAttackData != null) {
|
|
||||||
if (firstAttackData.getType() == MapleDataType.FLOAT) {
|
|
||||||
firstAttack = Math.round(MapleDataTool.getFloat(firstAttackData));
|
|
||||||
} else {
|
|
||||||
firstAttack = MapleDataTool.getInt(firstAttackData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stats.setFirstAttack(firstAttack > 0);
|
|
||||||
stats.setDropPeriod(MapleDataTool.getIntConvert("dropItemPeriod", monsterInfoData, 0) * 10000);
|
|
||||||
|
|
||||||
stats.setTagColor(MapleDataTool.getIntConvert("hpTagColor", monsterInfoData, 0));
|
|
||||||
stats.setTagBgColor(MapleDataTool.getIntConvert("hpTagBgcolor", monsterInfoData, 0));
|
|
||||||
|
|
||||||
for (MapleData idata : monsterData) {
|
|
||||||
if (!idata.getName().equals("info")) {
|
|
||||||
int delay = 0;
|
|
||||||
for (MapleData pic : idata.getChildren()) {
|
|
||||||
delay += MapleDataTool.getIntConvert("delay", pic, 0);
|
|
||||||
}
|
|
||||||
stats.setAnimationTime(idata.getName(), delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MapleData reviveInfo = monsterInfoData.getChildByPath("revive");
|
|
||||||
if (reviveInfo != null) {
|
|
||||||
List<Integer> revives = new LinkedList<>();
|
|
||||||
for (MapleData data_ : reviveInfo) {
|
|
||||||
revives.add(MapleDataTool.getInt(data_));
|
|
||||||
}
|
|
||||||
stats.setRevives(revives);
|
|
||||||
}
|
|
||||||
decodeElementalString(stats, MapleDataTool.getString("elemAttr", monsterInfoData, ""));
|
|
||||||
MapleData monsterSkillData = monsterInfoData.getChildByPath("skill");
|
|
||||||
if (monsterSkillData != null) {
|
|
||||||
int i = 0;
|
|
||||||
List<Pair<Integer, Integer>> skills = new ArrayList<>();
|
|
||||||
while (monsterSkillData.getChildByPath(Integer.toString(i)) != null) {
|
|
||||||
skills.add(new Pair<>(Integer.valueOf(MapleDataTool.getInt(i + "/skill", monsterSkillData, 0)), Integer.valueOf(MapleDataTool.getInt(i + "/level", monsterSkillData, 0))));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
stats.setSkills(skills);
|
|
||||||
}
|
|
||||||
MapleData banishData = monsterInfoData.getChildByPath("ban");
|
|
||||||
if (banishData != null) {
|
|
||||||
stats.setBanishInfo(new BanishInfo(MapleDataTool.getString("banMsg", banishData), MapleDataTool.getInt("banMap/0/field", banishData, -1), MapleDataTool.getString("banMap/0/portal", banishData, "sp")));
|
|
||||||
}
|
|
||||||
|
|
||||||
monsterStats.put(mid, stats);
|
|
||||||
} catch(NullPointerException npe) {
|
|
||||||
//System.out.println("[SEVERE] " + mFile.getName() + " failed to load. Issue: " + npe.getMessage() + "\n\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("done!");
|
|
||||||
return monsterStats;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void decodeElementalString(MapleMonsterStats stats, String elemAttr) {
|
|
||||||
for (int i = 0; i < elemAttr.length(); i += 2) {
|
|
||||||
stats.setEffectiveness(Element.getFromChar(elemAttr.charAt(i)), ElementalEffectiveness.getByNumber(Integer.valueOf(String.valueOf(elemAttr.charAt(i + 1)))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BanishInfo {
|
|
||||||
|
|
||||||
private int map;
|
|
||||||
private String portal, msg;
|
|
||||||
|
|
||||||
public BanishInfo(String msg, int map, String portal) {
|
|
||||||
this.msg = msg;
|
|
||||||
this.map = map;
|
|
||||||
this.portal = portal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMap() {
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPortal() {
|
|
||||||
return portal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class loseItem {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private byte chance, x;
|
|
||||||
|
|
||||||
private loseItem(int id, byte chance, byte x) {
|
|
||||||
this.id = id;
|
|
||||||
this.chance = chance;
|
|
||||||
this.x = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getChance() {
|
|
||||||
return chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getX() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class selfDestruction {
|
|
||||||
|
|
||||||
private byte action;
|
|
||||||
private int removeAfter;
|
|
||||||
private int hp;
|
|
||||||
|
|
||||||
private selfDestruction(byte action, int removeAfter, int hp) {
|
|
||||||
this.action = action;
|
|
||||||
this.removeAfter = removeAfter;
|
|
||||||
this.hp = hp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHp() {
|
|
||||||
return hp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getAction() {
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int removeAfter() {
|
|
||||||
return removeAfter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,330 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package life;
|
|
||||||
|
|
||||||
import life.MapleLifeFactory.BanishInfo;
|
|
||||||
import life.MapleLifeFactory.loseItem;
|
|
||||||
import life.MapleLifeFactory.selfDestruction;
|
|
||||||
import tools.Pair;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Frz
|
|
||||||
*/
|
|
||||||
public class MapleMonsterStats {
|
|
||||||
private boolean changeable;
|
|
||||||
private int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive, removeAfter;
|
|
||||||
private boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
|
||||||
private String name;
|
|
||||||
private Map<String, Integer> animationTimes = new HashMap<String, Integer>();
|
|
||||||
private Map<Element, ElementalEffectiveness> resistance = new HashMap<Element, ElementalEffectiveness>();
|
|
||||||
private List<Integer> revives = Collections.emptyList();
|
|
||||||
private byte tagColor, tagBgColor;
|
|
||||||
private List<Pair<Integer, Integer>> skills = new ArrayList<Pair<Integer, Integer>>();
|
|
||||||
private Pair<Integer, Integer> cool = null;
|
|
||||||
private BanishInfo banish = null;
|
|
||||||
private List<loseItem> loseItem = null;
|
|
||||||
private selfDestruction selfDestruction = null;
|
|
||||||
private boolean friendly;
|
|
||||||
|
|
||||||
public void setChange(boolean change) {
|
|
||||||
this.changeable = change;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChangeable() {
|
|
||||||
return changeable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getExp() {
|
|
||||||
return exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExp(int exp) {
|
|
||||||
this.exp = exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHp() {
|
|
||||||
return hp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHp(int hp) {
|
|
||||||
this.hp = hp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMp() {
|
|
||||||
return mp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMp(int mp) {
|
|
||||||
this.mp = mp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLevel() {
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLevel(int level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int removeAfter() {
|
|
||||||
return removeAfter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemoveAfter(int removeAfter) {
|
|
||||||
this.removeAfter = removeAfter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDropPeriod() {
|
|
||||||
return dropPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDropPeriod(int dropPeriod) {
|
|
||||||
this.dropPeriod = dropPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBoss(boolean boss) {
|
|
||||||
this.boss = boss;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBoss() {
|
|
||||||
return boss;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFfaLoot(boolean ffaLoot) {
|
|
||||||
this.ffaLoot = ffaLoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFfaLoot() {
|
|
||||||
return ffaLoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAnimationTime(String name, int delay) {
|
|
||||||
animationTimes.put(name, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAnimationTime(String name) {
|
|
||||||
Integer ret = animationTimes.get(name);
|
|
||||||
if (ret == null) {
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
return ret.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMobile() {
|
|
||||||
return animationTimes.containsKey("move") || animationTimes.containsKey("fly");
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getRevives() {
|
|
||||||
return revives;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRevives(List<Integer> revives) {
|
|
||||||
this.revives = revives;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUndead(boolean undead) {
|
|
||||||
this.undead = undead;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getUndead() {
|
|
||||||
return undead;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEffectiveness(Element e, ElementalEffectiveness ee) {
|
|
||||||
resistance.put(e, ee);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ElementalEffectiveness getEffectiveness(Element e) {
|
|
||||||
ElementalEffectiveness elementalEffectiveness = resistance.get(e);
|
|
||||||
if (elementalEffectiveness == null) {
|
|
||||||
return ElementalEffectiveness.NORMAL;
|
|
||||||
} else {
|
|
||||||
return elementalEffectiveness;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getTagColor() {
|
|
||||||
return tagColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagColor(int tagColor) {
|
|
||||||
this.tagColor = (byte) tagColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getTagBgColor() {
|
|
||||||
return tagBgColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagBgColor(int tagBgColor) {
|
|
||||||
this.tagBgColor = (byte) tagBgColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSkills(List<Pair<Integer, Integer>> skills) {
|
|
||||||
this.skills.addAll(skills);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Pair<Integer, Integer>> getSkills() {
|
|
||||||
return Collections.unmodifiableList(this.skills);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNoSkills() {
|
|
||||||
return this.skills.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasSkill(int skillId, int level) {
|
|
||||||
for (Pair<Integer, Integer> skill : skills) {
|
|
||||||
if (skill.getLeft() == skillId && skill.getRight() == level) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstAttack(boolean firstAttack) {
|
|
||||||
this.firstAttack = firstAttack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFirstAttack() {
|
|
||||||
return firstAttack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBuffToGive(int buff) {
|
|
||||||
this.buffToGive = buff;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBuffToGive() {
|
|
||||||
return buffToGive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeEffectiveness(Element e) {
|
|
||||||
resistance.remove(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BanishInfo getBanishInfo() {
|
|
||||||
return banish;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBanishInfo(BanishInfo banish) {
|
|
||||||
this.banish = banish;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPADamage() {
|
|
||||||
return PADamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPADamage(int PADamage) {
|
|
||||||
this.PADamage = PADamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCP() {
|
|
||||||
return cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCP(int cp) {
|
|
||||||
this.cp = cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<loseItem> loseItem() {
|
|
||||||
return loseItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addLoseItem(loseItem li) {
|
|
||||||
if (loseItem == null) {
|
|
||||||
loseItem = new LinkedList<loseItem>();
|
|
||||||
}
|
|
||||||
loseItem.add(li);
|
|
||||||
}
|
|
||||||
|
|
||||||
public selfDestruction selfDestruction() {
|
|
||||||
return selfDestruction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelfDestruction(selfDestruction sd) {
|
|
||||||
this.selfDestruction = sd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExplosiveReward(boolean isExplosiveReward) {
|
|
||||||
this.isExplosiveReward = isExplosiveReward;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isExplosiveReward() {
|
|
||||||
return isExplosiveReward;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemoveOnMiss(boolean removeOnMiss) {
|
|
||||||
this.removeOnMiss = removeOnMiss;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeOnMiss() {
|
|
||||||
return removeOnMiss;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCool(Pair<Integer, Integer> cool) {
|
|
||||||
this.cool = cool;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pair<Integer, Integer> getCool() {
|
|
||||||
return cool;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPDDamage() {
|
|
||||||
return PDDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMADamage() {
|
|
||||||
return MADamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMDDamage() {
|
|
||||||
return MDDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFriendly() {
|
|
||||||
return friendly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFriendly(boolean value) {
|
|
||||||
this.friendly = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPDDamage(int PDDamage) {
|
|
||||||
this.PDDamage = PDDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMADamage(int MADamage) {
|
|
||||||
this.MADamage = MADamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMDDamage(int MDDamage) {
|
|
||||||
this.MDDamage = MDDamage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the HeavenMS MapleStory Server
|
|
||||||
Copyleft (L) 2016 - 2019 RonanLana
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package maplearrowfetcher;
|
|
||||||
|
|
||||||
import life.MapleLifeFactory;
|
|
||||||
import life.MapleMonsterStats;
|
|
||||||
import tools.DatabaseConnection;
|
|
||||||
import tools.Pair;
|
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author RonanLana
|
|
||||||
*
|
|
||||||
* This application traces arrow drop data on the underlying DB (that must be
|
|
||||||
* defined on the DatabaseConnection file of this project) and generates a SQL file
|
|
||||||
* that proposes updated arrow quantitty on drop entries for the drop_data table.
|
|
||||||
*
|
|
||||||
* The arrow quantity range is calculated accordingly with the target mob stats, such
|
|
||||||
* as level and if it's a boss or not.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MapleArrowFetcher {
|
|
||||||
|
|
||||||
private static PrintWriter printWriter;
|
|
||||||
private static String newFile = "lib/arrow_drop_data.sql";
|
|
||||||
|
|
||||||
private static int minArrowId = 2060000;
|
|
||||||
private static int maxArrowId = 2061004;
|
|
||||||
|
|
||||||
private static float correctionFactor = 2.2f;
|
|
||||||
|
|
||||||
private static Map<Integer, MapleMonsterStats> mobStats;
|
|
||||||
private static Map<Integer, Pair<Integer, Integer>> mobRange = new HashMap<>();
|
|
||||||
|
|
||||||
private static Pair<Integer, Integer> calcArrowRange(int level, boolean boss) {
|
|
||||||
int minRange, maxRange;
|
|
||||||
|
|
||||||
// MIN range
|
|
||||||
minRange = (int)Math.ceil(((2.870503597 * level) - 1.870503597) * (boss ? 1.4 : 1.0) / correctionFactor);
|
|
||||||
|
|
||||||
// MAX range
|
|
||||||
maxRange = (int)Math.ceil(1.25 * minRange);
|
|
||||||
|
|
||||||
return new Pair<>(minRange, maxRange);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void calcAllMobsArrowRange() {
|
|
||||||
System.out.print("Calculating range... ");
|
|
||||||
|
|
||||||
for(Entry<Integer, MapleMonsterStats> mobStat : mobStats.entrySet()) {
|
|
||||||
MapleMonsterStats mms = mobStat.getValue();
|
|
||||||
Pair<Integer, Integer> arrowRange;
|
|
||||||
|
|
||||||
arrowRange = calcArrowRange(mms.getLevel(), mms.isBoss());
|
|
||||||
mobRange.put(mobStat.getKey(), arrowRange);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("done!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printSqlHeader() {
|
|
||||||
printWriter.println(" # SQL File autogenerated from the MapleArrowFetcher feature by Ronan Lana.");
|
|
||||||
printWriter.println(" # Generated data takes into account mob stats such as level and boss for the raw arrow ranges.");
|
|
||||||
printWriter.println(" # Only current arrows entries on the DB it was compiled are being updated here.");
|
|
||||||
printWriter.println();
|
|
||||||
|
|
||||||
printWriter.println("UPDATE drop_data");
|
|
||||||
printWriter.println("SET minimum_quantity = CASE");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printSqlMiddle() {
|
|
||||||
printWriter.println(" ELSE minimum_quantity END,");
|
|
||||||
printWriter.println(" maximum_quantity = CASE");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printSqlFooter() {
|
|
||||||
printWriter.println(" ELSE maximum_quantity END");
|
|
||||||
printWriter.println(";");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void updateSqlMobArrowMinEntry(int[] entry) {
|
|
||||||
printWriter.println(" WHEN dropperid = " + entry[0] + " AND itemid = " + entry[1] + " THEN " + entry[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void updateSqlMobArrowMaxEntry(int[] entry) {
|
|
||||||
printWriter.println(" WHEN dropperid = " + entry[0] + " AND itemid = " + entry[1] + " THEN " + entry[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<int[]> getArrowEntryValues(Map<Integer, List<Integer>> existingEntries) {
|
|
||||||
List<int[]> entryValues = new ArrayList<>(200);
|
|
||||||
|
|
||||||
List<Entry<Integer, List<Integer>>> listEntries = new ArrayList<>(existingEntries.entrySet());
|
|
||||||
|
|
||||||
Collections.sort(listEntries, (o1, o2) -> {
|
|
||||||
int val1 = o1.getKey();
|
|
||||||
int val2 = o2.getKey();
|
|
||||||
return (val1 < val2 ? -1 : (val1 == val2 ? 0 : 1));
|
|
||||||
});
|
|
||||||
|
|
||||||
for(Entry<Integer, List<Integer>> ee : listEntries) {
|
|
||||||
int mobid = ee.getKey();
|
|
||||||
Pair<Integer, Integer> mr = mobRange.get(mobid);
|
|
||||||
|
|
||||||
for(Integer itemid : ee.getValue()) {
|
|
||||||
int itemWeight = (itemid % 10) + 1;
|
|
||||||
|
|
||||||
int[] values = new int[4];
|
|
||||||
values[0] = mobid;
|
|
||||||
values[1] = itemid;
|
|
||||||
|
|
||||||
values[2] = (int) Math.ceil(mr.getLeft() / itemWeight); // weighted min quantity
|
|
||||||
values[3] = (int) Math.ceil(mr.getRight() / itemWeight); // weighted max quantity
|
|
||||||
|
|
||||||
entryValues.add(values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return entryValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void updateMobsArrowRange() {
|
|
||||||
System.out.print("Generating updated ranges... ");
|
|
||||||
Connection con = DatabaseConnection.getConnection();
|
|
||||||
Map<Integer, List<Integer>> existingEntries = new HashMap<>(200);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// select all arrow drop entries on the DB, to update their values
|
|
||||||
PreparedStatement ps = con.prepareStatement("SELECT dropperid, itemid FROM drop_data WHERE itemid >= " + minArrowId + " AND itemid <= " + maxArrowId + " ORDER BY itemid;");
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
if (rs.isBeforeFirst()) {
|
|
||||||
while(rs.next()) {
|
|
||||||
int mobid = rs.getInt(1);
|
|
||||||
int itemid = rs.getInt(2);
|
|
||||||
|
|
||||||
if(mobRange.containsKey(mobid)) {
|
|
||||||
List<Integer> em = existingEntries.get(mobid);
|
|
||||||
|
|
||||||
if(em == null) {
|
|
||||||
em = new ArrayList<>(2);
|
|
||||||
existingEntries.put(mobid, em);
|
|
||||||
}
|
|
||||||
|
|
||||||
em.add(itemid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!existingEntries.isEmpty()) {
|
|
||||||
List<int[]> entryValues = getArrowEntryValues(existingEntries);
|
|
||||||
|
|
||||||
printWriter = new PrintWriter(newFile, "UTF-8");
|
|
||||||
printSqlHeader();
|
|
||||||
|
|
||||||
for(int[] arrowEntry : entryValues) {
|
|
||||||
updateSqlMobArrowMinEntry(arrowEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
printSqlMiddle();
|
|
||||||
|
|
||||||
for(int[] arrowEntry : entryValues) {
|
|
||||||
updateSqlMobArrowMaxEntry(arrowEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
printSqlFooter();
|
|
||||||
|
|
||||||
printWriter.close();
|
|
||||||
} else {
|
|
||||||
throw new Exception("NO DATA");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw new Exception("NO DATA");
|
|
||||||
}
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
con.close();
|
|
||||||
|
|
||||||
System.out.println("done!");
|
|
||||||
|
|
||||||
} catch(Exception e) {
|
|
||||||
if(e.getMessage() != null && e.getMessage().equals("NO DATA")) {
|
|
||||||
System.out.println("failed! The DB has no arrow entry to be updated.");
|
|
||||||
} else {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// load mob stats from WZ
|
|
||||||
mobStats = MapleLifeFactory.getAllMonsterStats();
|
|
||||||
|
|
||||||
calcAllMobsArrowRange();
|
|
||||||
updateMobsArrowRange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
public interface MapleCanvas {
|
|
||||||
int getHeight();
|
|
||||||
int getWidth();
|
|
||||||
BufferedImage getImage();
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import provider.wz.MapleDataType;
|
|
||||||
|
|
||||||
public interface MapleData extends MapleDataEntity, Iterable<MapleData> {
|
|
||||||
@Override
|
|
||||||
public String getName();
|
|
||||||
public MapleDataType getType();
|
|
||||||
public List<MapleData> getChildren();
|
|
||||||
public MapleData getChildByPath(String path);
|
|
||||||
public Object getData();
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Matze
|
|
||||||
*/
|
|
||||||
public interface MapleDataDirectoryEntry extends MapleDataEntry {
|
|
||||||
public List<MapleDataDirectoryEntry> getSubdirectories();
|
|
||||||
public List<MapleDataFileEntry> getFiles();
|
|
||||||
public MapleDataEntry getEntry(String name);
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Matze
|
|
||||||
*/
|
|
||||||
public interface MapleDataEntity {
|
|
||||||
public String getName();
|
|
||||||
public MapleDataEntity getParent();
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Matze
|
|
||||||
*/
|
|
||||||
public interface MapleDataEntry extends MapleDataEntity {
|
|
||||||
public String getName();
|
|
||||||
public int getSize();
|
|
||||||
public int getChecksum();
|
|
||||||
public int getOffset();
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Matze
|
|
||||||
*/
|
|
||||||
public interface MapleDataFileEntry extends MapleDataEntry {
|
|
||||||
public void setOffset(int offset);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
public interface MapleDataProvider {
|
|
||||||
MapleData getData(String path);
|
|
||||||
MapleDataDirectoryEntry getRoot();
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import provider.wz.WZFile;
|
|
||||||
import provider.wz.XMLWZFile;
|
|
||||||
|
|
||||||
public class MapleDataProviderFactory {
|
|
||||||
private final static String wzPath = System.getProperty("wzpath");
|
|
||||||
|
|
||||||
private static MapleDataProvider getWZ(File in, boolean provideImages) {
|
|
||||||
if (in.getName().toLowerCase().endsWith("wz") && !in.isDirectory()) {
|
|
||||||
try {
|
|
||||||
return new WZFile(in, provideImages);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("Loading WZ File failed", e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return new XMLWZFile(in);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MapleDataProvider getDataProvider(File in) {
|
|
||||||
return getWZ(in, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MapleDataProvider getImageProvidingDataProvider(File in) {
|
|
||||||
return getWZ(in, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File fileInWZPath(String filename) {
|
|
||||||
return new File(wzPath, filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import provider.wz.MapleDataType;
|
|
||||||
|
|
||||||
public class MapleDataTool {
|
|
||||||
public static String getString(MapleData data) {
|
|
||||||
return ((String) data.getData());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(MapleData data, String def) {
|
|
||||||
if (data == null || data.getData() == null) {
|
|
||||||
return def;
|
|
||||||
} else {
|
|
||||||
return ((String) data.getData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(String path, MapleData data) {
|
|
||||||
return getString(data.getChildByPath(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(String path, MapleData data, String def) {
|
|
||||||
return getString(data.getChildByPath(path), def);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getDouble(MapleData data) {
|
|
||||||
return ((Double) data.getData()).doubleValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getFloat(MapleData data) {
|
|
||||||
return ((Float) data.getData()).floatValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getInt(MapleData data) {
|
|
||||||
if (data == null || data.getData() == null) {
|
|
||||||
return 0;// DEF?
|
|
||||||
}
|
|
||||||
return ((Integer) data.getData()).intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getInt(String path, MapleData data) {
|
|
||||||
return getInt(data.getChildByPath(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getIntConvert(MapleData data) {
|
|
||||||
if (data.getType() == MapleDataType.STRING) {
|
|
||||||
return Integer.parseInt(getString(data));
|
|
||||||
} else {
|
|
||||||
return getInt(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getIntConvert(String path, MapleData data) {
|
|
||||||
MapleData d = data.getChildByPath(path);
|
|
||||||
if (d.getType() == MapleDataType.STRING) {
|
|
||||||
return Integer.parseInt(getString(d));
|
|
||||||
} else {
|
|
||||||
return getInt(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getInt(MapleData data, int def) {
|
|
||||||
if (data == null || data.getData() == null) {
|
|
||||||
return def;
|
|
||||||
} else if (data.getType() == MapleDataType.STRING) {
|
|
||||||
return Integer.parseInt(getString(data));
|
|
||||||
} else {
|
|
||||||
return ((Integer) data.getData()).intValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getInt(String path, MapleData data, int def) {
|
|
||||||
return getInt(data.getChildByPath(path), def);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getIntConvert(String path, MapleData data, int def) {
|
|
||||||
MapleData d = data.getChildByPath(path);
|
|
||||||
if (d == null) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
if (d.getType() == MapleDataType.STRING) {
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(getString(d));
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
nfe.printStackTrace();
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return getInt(d, def);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BufferedImage getImage(MapleData data) {
|
|
||||||
return ((MapleCanvas) data.getData()).getImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Point getPoint(MapleData data) {
|
|
||||||
return ((Point) data.getData());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Point getPoint(String path, MapleData data) {
|
|
||||||
return getPoint(data.getChildByPath(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Point getPoint(String path, MapleData data, Point def) {
|
|
||||||
final MapleData pointData = data.getChildByPath(path);
|
|
||||||
if (pointData == null) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return getPoint(pointData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFullDataPath(MapleData data) {
|
|
||||||
String path = "";
|
|
||||||
MapleDataEntity myData = data;
|
|
||||||
while (myData != null) {
|
|
||||||
path = myData.getName() + "/" + path;
|
|
||||||
myData = myData.getParent();
|
|
||||||
}
|
|
||||||
return path.substring(0, path.length() - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import provider.MapleCanvas;
|
|
||||||
|
|
||||||
public class FileStoredPngMapleCanvas implements MapleCanvas {
|
|
||||||
private File file;
|
|
||||||
private int width;
|
|
||||||
private int height;
|
|
||||||
private BufferedImage image;
|
|
||||||
|
|
||||||
public FileStoredPngMapleCanvas(int width, int height, File fileIn) {
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
this.file = fileIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedImage getImage() {
|
|
||||||
loadImageIfNecessary();
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadImageIfNecessary() {
|
|
||||||
if (image == null) {
|
|
||||||
try {
|
|
||||||
image = ImageIO.read(file);
|
|
||||||
// replace the dimensions loaded from the wz by the REAL dimensions from the image - should be equal tho
|
|
||||||
width = image.getWidth();
|
|
||||||
height = image.getHeight();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
public class ImgMapleSound {
|
|
||||||
private int dataLength, offset;
|
|
||||||
|
|
||||||
public ImgMapleSound(int dataLength, int offset) {
|
|
||||||
this.dataLength = dataLength;
|
|
||||||
this.offset = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDataLength() {
|
|
||||||
return dataLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOffset() {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import provider.MapleDataProviderFactory;
|
|
||||||
import tools.data.input.GenericLittleEndianAccessor;
|
|
||||||
import tools.data.input.InputStreamByteStream;
|
|
||||||
import tools.data.input.LittleEndianAccessor;
|
|
||||||
|
|
||||||
public class ListWZFile {
|
|
||||||
private LittleEndianAccessor lea;
|
|
||||||
private List<String> entries = new ArrayList<String>();
|
|
||||||
private static Collection<String> modernImgs = new HashSet<String>();
|
|
||||||
|
|
||||||
public static byte[] xorBytes(byte[] a, byte[] b) {
|
|
||||||
byte[] wusched = new byte[a.length];
|
|
||||||
for (int i = 0; i < a.length; i++) {
|
|
||||||
wusched[i] = (byte) (a[i] ^ b[i]);
|
|
||||||
}
|
|
||||||
return wusched;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListWZFile(File listwz) throws FileNotFoundException {
|
|
||||||
lea = new GenericLittleEndianAccessor(new InputStreamByteStream(new BufferedInputStream(new FileInputStream(listwz))));
|
|
||||||
while (lea.available() > 0) {
|
|
||||||
int l = lea.readInt() * 2;
|
|
||||||
byte[] chunk = new byte[l];
|
|
||||||
for (int i = 0; i < chunk.length; i++) {
|
|
||||||
chunk[i] = lea.readByte();
|
|
||||||
}
|
|
||||||
lea.readChar();
|
|
||||||
final String value = String.valueOf(WZTool.readListString(chunk));
|
|
||||||
entries.add(value);
|
|
||||||
}
|
|
||||||
entries = Collections.unmodifiableList(entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getEntries() {
|
|
||||||
return entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
final String listWz = System.getProperty("listwz");
|
|
||||||
if (listWz != null) {
|
|
||||||
ListWZFile listwz;
|
|
||||||
try {
|
|
||||||
listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz"));
|
|
||||||
modernImgs = new HashSet<String>(listwz.getEntries());
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isModernImgFile(String path) {
|
|
||||||
return modernImgs.contains(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
public enum MapleDataType {
|
|
||||||
NONE, IMG_0x00, SHORT, INT, FLOAT, DOUBLE, STRING, EXTENDED, PROPERTY, CANVAS, VECTOR, CONVEX, SOUND, UOL, UNKNOWN_TYPE, UNKNOWN_EXTENDED_TYPE;
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.DataBuffer;
|
|
||||||
import java.awt.image.DataBufferByte;
|
|
||||||
import java.awt.image.PixelInterleavedSampleModel;
|
|
||||||
import java.awt.image.Raster;
|
|
||||||
import java.awt.image.SampleModel;
|
|
||||||
import java.awt.image.WritableRaster;
|
|
||||||
import java.util.zip.DataFormatException;
|
|
||||||
import java.util.zip.Inflater;
|
|
||||||
import provider.MapleCanvas;
|
|
||||||
|
|
||||||
public class PNGMapleCanvas implements MapleCanvas {
|
|
||||||
private static final int[] ZAHLEN = new int[]{2, 1, 0, 3};
|
|
||||||
private int height;
|
|
||||||
private int width;
|
|
||||||
private int dataLength;
|
|
||||||
private int format;
|
|
||||||
private byte[] data;
|
|
||||||
|
|
||||||
public PNGMapleCanvas(int width, int height, int dataLength, int format, byte[] data) {
|
|
||||||
super();
|
|
||||||
this.height = height;
|
|
||||||
this.width = width;
|
|
||||||
this.dataLength = dataLength;
|
|
||||||
this.format = format;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFormat() {
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedImage getImage() {
|
|
||||||
int sizeUncompressed = 0;
|
|
||||||
int size8888 = 0;
|
|
||||||
int maxWriteBuf = 2;
|
|
||||||
int maxHeight = 3;
|
|
||||||
byte[] writeBuf = new byte[maxWriteBuf];
|
|
||||||
@SuppressWarnings ("unused")
|
|
||||||
byte[] rowPointers = new byte[maxHeight];
|
|
||||||
switch (getFormat()) {
|
|
||||||
case 1:
|
|
||||||
case 513:
|
|
||||||
sizeUncompressed = getHeight() * getWidth() * 4;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
sizeUncompressed = getHeight() * getWidth() * 8;
|
|
||||||
break;
|
|
||||||
case 517:
|
|
||||||
sizeUncompressed = getHeight() * getWidth() / 128;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
size8888 = getHeight() * getWidth() * 8;
|
|
||||||
if (size8888 > maxWriteBuf) {
|
|
||||||
maxWriteBuf = size8888;
|
|
||||||
writeBuf = new byte[maxWriteBuf];
|
|
||||||
}
|
|
||||||
if (getHeight() > maxHeight) {
|
|
||||||
maxHeight = getHeight();
|
|
||||||
rowPointers = new byte[maxHeight];
|
|
||||||
}
|
|
||||||
Inflater dec = new Inflater();
|
|
||||||
dec.setInput(getData(), 0, dataLength);
|
|
||||||
int declen = 0;
|
|
||||||
byte[] uc = new byte[sizeUncompressed];
|
|
||||||
try {
|
|
||||||
declen = dec.inflate(uc);
|
|
||||||
} catch (DataFormatException ex) {
|
|
||||||
throw new RuntimeException("zlib fucks", ex);
|
|
||||||
}
|
|
||||||
dec.end();
|
|
||||||
if (getFormat() == 1) {
|
|
||||||
for (int i = 0; i < sizeUncompressed; i++) {
|
|
||||||
byte low = (byte) (uc[i] & 0x0F);
|
|
||||||
byte high = (byte) (uc[i] & 0xF0);
|
|
||||||
writeBuf[(i << 1)] = (byte) (((low << 4) | low) & 0xFF);
|
|
||||||
writeBuf[(i << 1) + 1] = (byte) (high | ((high >>> 4) & 0xF));
|
|
||||||
}
|
|
||||||
} else if (getFormat() == 2) {
|
|
||||||
writeBuf = uc;
|
|
||||||
} else if (getFormat() == 513) {
|
|
||||||
for (int i = 0; i < declen; i += 2) {
|
|
||||||
byte bBits = (byte) ((uc[i] & 0x1F) << 3);
|
|
||||||
byte gBits = (byte) (((uc[i + 1] & 0x07) << 5) | ((uc[i] & 0xE0) >> 3));
|
|
||||||
byte rBits = (byte) (uc[i + 1] & 0xF8);
|
|
||||||
writeBuf[(i << 1)] = (byte) (bBits | (bBits >> 5));
|
|
||||||
writeBuf[(i << 1) + 1] = (byte) (gBits | (gBits >> 6));
|
|
||||||
writeBuf[(i << 1) + 2] = (byte) (rBits | (rBits >> 5));
|
|
||||||
writeBuf[(i << 1) + 3] = (byte) 0xFF;
|
|
||||||
}
|
|
||||||
} else if (getFormat() == 517) {
|
|
||||||
byte b = 0x00;
|
|
||||||
int pixelIndex = 0;
|
|
||||||
for (int i = 0; i < declen; i++) {
|
|
||||||
for (int j = 0; j < 8; j++) {
|
|
||||||
b = (byte) (((uc[i] & (0x01 << (7 - j))) >> (7 - j)) * 255);
|
|
||||||
for (int k = 0; k < 16; k++) {
|
|
||||||
pixelIndex = (i << 9) + (j << 6) + k * 2;
|
|
||||||
writeBuf[pixelIndex] = b;
|
|
||||||
writeBuf[pixelIndex + 1] = b;
|
|
||||||
writeBuf[pixelIndex + 2] = b;
|
|
||||||
writeBuf[pixelIndex + 3] = (byte) 0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DataBufferByte imgData = new DataBufferByte(writeBuf, sizeUncompressed);
|
|
||||||
SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, getWidth(), getHeight(), 4, getWidth() * 4, ZAHLEN);
|
|
||||||
WritableRaster imgRaster = Raster.createWritableRaster(sm, imgData, new Point(0, 0));
|
|
||||||
BufferedImage aa = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
|
|
||||||
aa.setData(imgRaster);
|
|
||||||
return aa;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import provider.MapleDataDirectoryEntry;
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
import provider.MapleDataEntry;
|
|
||||||
import provider.MapleDataFileEntry;
|
|
||||||
|
|
||||||
public class WZDirectoryEntry extends WZEntry implements MapleDataDirectoryEntry {
|
|
||||||
private List<MapleDataDirectoryEntry> subdirs = new ArrayList<MapleDataDirectoryEntry>();
|
|
||||||
private List<MapleDataFileEntry> files = new ArrayList<MapleDataFileEntry>();
|
|
||||||
private Map<String, MapleDataEntry> entries = new HashMap<String, MapleDataEntry>();
|
|
||||||
|
|
||||||
public WZDirectoryEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
|
||||||
super(name, size, checksum, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WZDirectoryEntry() {
|
|
||||||
super(null, 0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDirectory(MapleDataDirectoryEntry dir) {
|
|
||||||
subdirs.add(dir);
|
|
||||||
entries.put(dir.getName(), dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addFile(MapleDataFileEntry fileEntry) {
|
|
||||||
files.add(fileEntry);
|
|
||||||
entries.put(fileEntry.getName(), fileEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MapleDataDirectoryEntry> getSubdirectories() {
|
|
||||||
return Collections.unmodifiableList(subdirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MapleDataFileEntry> getFiles() {
|
|
||||||
return Collections.unmodifiableList(files);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapleDataEntry getEntry(String name) {
|
|
||||||
return entries.get(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
import provider.MapleDataEntry;
|
|
||||||
|
|
||||||
public class WZEntry implements MapleDataEntry {
|
|
||||||
private String name;
|
|
||||||
private int size;
|
|
||||||
private int checksum;
|
|
||||||
private int offset;
|
|
||||||
private MapleDataEntity parent;
|
|
||||||
|
|
||||||
public WZEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
|
||||||
super();
|
|
||||||
this.name = name;
|
|
||||||
this.size = size;
|
|
||||||
this.checksum = checksum;
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSize() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getChecksum() {
|
|
||||||
return checksum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOffset() {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapleDataEntity getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataDirectoryEntry;
|
|
||||||
import provider.MapleDataFileEntry;
|
|
||||||
import provider.MapleDataProvider;
|
|
||||||
import tools.data.input.GenericLittleEndianAccessor;
|
|
||||||
import tools.data.input.GenericSeekableLittleEndianAccessor;
|
|
||||||
import tools.data.input.InputStreamByteStream;
|
|
||||||
import tools.data.input.LittleEndianAccessor;
|
|
||||||
import tools.data.input.RandomAccessByteStream;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
|
|
||||||
public class WZFile implements MapleDataProvider {
|
|
||||||
static {
|
|
||||||
ListWZFile.init();
|
|
||||||
}
|
|
||||||
private File wzfile;
|
|
||||||
private LittleEndianAccessor lea;
|
|
||||||
private SeekableLittleEndianAccessor slea;
|
|
||||||
private int headerSize;
|
|
||||||
private WZDirectoryEntry root;
|
|
||||||
private boolean provideImages;
|
|
||||||
private int cOffset;
|
|
||||||
|
|
||||||
public WZFile(File wzfile, boolean provideImages) throws IOException {
|
|
||||||
this.wzfile = wzfile;
|
|
||||||
lea = new GenericLittleEndianAccessor(new InputStreamByteStream(new BufferedInputStream(new FileInputStream(wzfile))));
|
|
||||||
RandomAccessFile raf = new RandomAccessFile(wzfile, "r");
|
|
||||||
slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf));
|
|
||||||
root = new WZDirectoryEntry(wzfile.getName(), 0, 0, null);
|
|
||||||
this.provideImages = provideImages;
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void load() throws IOException {
|
|
||||||
lea.readAsciiString(4);
|
|
||||||
lea.readInt();
|
|
||||||
lea.readInt();
|
|
||||||
headerSize = lea.readInt();
|
|
||||||
lea.readNullTerminatedAsciiString();
|
|
||||||
lea.readShort();
|
|
||||||
parseDirectory(root);
|
|
||||||
cOffset = (int) lea.getBytesRead();
|
|
||||||
getOffsets(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getOffsets(MapleDataDirectoryEntry dir) {
|
|
||||||
for (MapleDataFileEntry file : dir.getFiles()) {
|
|
||||||
file.setOffset(cOffset);
|
|
||||||
cOffset += file.getSize();
|
|
||||||
}
|
|
||||||
for (MapleDataDirectoryEntry sdir : dir.getSubdirectories()) {
|
|
||||||
getOffsets(sdir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseDirectory(WZDirectoryEntry dir) {
|
|
||||||
int entries = WZTool.readValue(lea);
|
|
||||||
for (int i = 0; i < entries; i++) {
|
|
||||||
byte marker = lea.readByte();
|
|
||||||
String name = null;
|
|
||||||
int size, checksum;
|
|
||||||
switch (marker) {
|
|
||||||
case 0x02:
|
|
||||||
name = WZTool.readDecodedStringAtOffsetAndReset(slea, lea.readInt() + this.headerSize + 1);
|
|
||||||
size = WZTool.readValue(lea);
|
|
||||||
checksum = WZTool.readValue(lea);
|
|
||||||
lea.readInt(); //dummy int
|
|
||||||
dir.addFile(new WZFileEntry(name, size, checksum, dir));
|
|
||||||
break;
|
|
||||||
case 0x03:
|
|
||||||
case 0x04:
|
|
||||||
name = WZTool.readDecodedString(lea);
|
|
||||||
size = WZTool.readValue(lea);
|
|
||||||
checksum = WZTool.readValue(lea);
|
|
||||||
lea.readInt(); //dummy int
|
|
||||||
if (marker == 3) {
|
|
||||||
dir.addDirectory(new WZDirectoryEntry(name, size, checksum, dir));
|
|
||||||
} else {
|
|
||||||
dir.addFile(new WZFileEntry(name, size, checksum, dir));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (MapleDataDirectoryEntry idir : dir.getSubdirectories()) {
|
|
||||||
parseDirectory((WZDirectoryEntry) idir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public WZIMGFile getImgFile(String path) throws IOException {
|
|
||||||
String segments[] = path.split("/");
|
|
||||||
WZDirectoryEntry dir = root;
|
|
||||||
for (int x = 0; x < segments.length - 1; x++) {
|
|
||||||
dir = (WZDirectoryEntry) dir.getEntry(segments[x]);
|
|
||||||
if (dir == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WZFileEntry entry = (WZFileEntry) dir.getEntry(segments[segments.length - 1]);
|
|
||||||
if (entry == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
String fullPath = wzfile.getName().substring(0, wzfile.getName().length() - 3).toLowerCase() + "/" + path;
|
|
||||||
return new WZIMGFile(this.wzfile, entry, provideImages, ListWZFile.isModernImgFile(fullPath));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized MapleData getData(String path) {
|
|
||||||
try {
|
|
||||||
WZIMGFile imgFile = getImgFile(path);
|
|
||||||
if (imgFile == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
MapleData ret = imgFile.getRoot();
|
|
||||||
return ret;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleDataDirectoryEntry getRoot() {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
import provider.MapleDataFileEntry;
|
|
||||||
|
|
||||||
public class WZFileEntry extends WZEntry implements MapleDataFileEntry {
|
|
||||||
private int offset;
|
|
||||||
|
|
||||||
public WZFileEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
|
||||||
super(name, size, checksum, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOffset() {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffset(int offset) {
|
|
||||||
this.offset = offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
|
|
||||||
public class WZIMGEntry implements MapleData {
|
|
||||||
private String name;
|
|
||||||
private MapleDataType type;
|
|
||||||
private List<MapleData> children = new ArrayList<MapleData>(10);
|
|
||||||
private Object data;
|
|
||||||
private MapleDataEntity parent;
|
|
||||||
|
|
||||||
public WZIMGEntry(MapleDataEntity parent) {
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleDataType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MapleData> getChildren() {
|
|
||||||
return Collections.unmodifiableList(children);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleData getChildByPath(String path) {
|
|
||||||
String segments[] = path.split("/");
|
|
||||||
if (segments[0].equals("..")) {
|
|
||||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
|
||||||
}
|
|
||||||
MapleData ret = this;
|
|
||||||
for (int x = 0; x < segments.length; x++) {
|
|
||||||
boolean foundChild = false;
|
|
||||||
for (MapleData child : ret.getChildren()) {
|
|
||||||
if (child.getName().equals(segments[x])) {
|
|
||||||
ret = child;
|
|
||||||
foundChild = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundChild) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(MapleDataType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(Object data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addChild(WZIMGEntry entry) {
|
|
||||||
children.add(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<MapleData> iterator() {
|
|
||||||
return getChildren().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getName() + ":" + getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapleDataEntity getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finish() {
|
|
||||||
((ArrayList<MapleData>) children).trimToSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import tools.data.input.GenericSeekableLittleEndianAccessor;
|
|
||||||
import tools.data.input.RandomAccessByteStream;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
|
|
||||||
public class WZIMGFile {
|
|
||||||
private WZFileEntry file;
|
|
||||||
private WZIMGEntry root;
|
|
||||||
private boolean provideImages;
|
|
||||||
@SuppressWarnings ("unused")
|
|
||||||
private boolean modernImg;
|
|
||||||
|
|
||||||
public WZIMGFile(File wzfile, WZFileEntry file, boolean provideImages, boolean modernImg) throws IOException {
|
|
||||||
RandomAccessFile raf = new RandomAccessFile(wzfile, "r");
|
|
||||||
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf));
|
|
||||||
slea.seek(file.getOffset());
|
|
||||||
this.file = file;
|
|
||||||
this.provideImages = provideImages;
|
|
||||||
root = new WZIMGEntry(file.getParent());
|
|
||||||
root.setName(file.getName());
|
|
||||||
root.setType(MapleDataType.EXTENDED);
|
|
||||||
this.modernImg = modernImg;
|
|
||||||
parseExtended(root, slea, 0);
|
|
||||||
root.finish();
|
|
||||||
raf.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void dumpImg(OutputStream out, SeekableLittleEndianAccessor slea) throws IOException {
|
|
||||||
DataOutputStream os = new DataOutputStream(out);
|
|
||||||
long oldPos = slea.getPosition();
|
|
||||||
slea.seek(file.getOffset());
|
|
||||||
for (int x = 0; x < file.getSize(); x++) {
|
|
||||||
os.write(slea.readByte());
|
|
||||||
}
|
|
||||||
slea.seek(oldPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WZIMGEntry getRoot() {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parse(WZIMGEntry entry, SeekableLittleEndianAccessor slea) {
|
|
||||||
byte marker = slea.readByte();
|
|
||||||
switch (marker) {
|
|
||||||
case 0: {
|
|
||||||
String name = WZTool.readDecodedString(slea);
|
|
||||||
entry.setName(name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1: {
|
|
||||||
String name = WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt());
|
|
||||||
entry.setName(name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
System.out.println("Unknown Image identifier: " + marker + " at offset " + (slea.getPosition() - file.getOffset()));
|
|
||||||
}
|
|
||||||
marker = slea.readByte();
|
|
||||||
switch (marker) {
|
|
||||||
case 0:
|
|
||||||
entry.setType(MapleDataType.IMG_0x00);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
case 11: //??? no idea, since 0.49
|
|
||||||
entry.setType(MapleDataType.SHORT);
|
|
||||||
entry.setData(Short.valueOf(slea.readShort()));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
entry.setType(MapleDataType.INT);
|
|
||||||
entry.setData(Integer.valueOf(WZTool.readValue(slea)));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
entry.setType(MapleDataType.FLOAT);
|
|
||||||
entry.setData(Float.valueOf(WZTool.readFloatValue(slea)));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
entry.setType(MapleDataType.DOUBLE);
|
|
||||||
entry.setData(Double.valueOf(slea.readDouble()));
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
entry.setType(MapleDataType.STRING);
|
|
||||||
byte iMarker = slea.readByte();
|
|
||||||
if (iMarker == 0) {
|
|
||||||
entry.setData(WZTool.readDecodedString(slea));
|
|
||||||
} else if (iMarker == 1) {
|
|
||||||
entry.setData(WZTool.readDecodedStringAtOffsetAndReset(slea, slea.readInt() + file.getOffset()));
|
|
||||||
} else {
|
|
||||||
System.out.println("Unknown String type " + iMarker);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
entry.setType(MapleDataType.EXTENDED);
|
|
||||||
long endOfExtendedBlock = slea.readInt();
|
|
||||||
endOfExtendedBlock += slea.getPosition();
|
|
||||||
parseExtended(entry, slea, endOfExtendedBlock);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("Unknown Image type " + marker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseExtended(WZIMGEntry entry, SeekableLittleEndianAccessor slea, long endOfExtendedBlock) {
|
|
||||||
byte marker = slea.readByte();
|
|
||||||
String type;
|
|
||||||
switch (marker) {
|
|
||||||
case 0x73:
|
|
||||||
type = WZTool.readDecodedString(slea);
|
|
||||||
break;
|
|
||||||
case 0x1B:
|
|
||||||
type = WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unknown extended image identifier: " + marker + " at offset " +
|
|
||||||
(slea.getPosition() - file.getOffset()));
|
|
||||||
}
|
|
||||||
if (type.equals("Property")) {
|
|
||||||
entry.setType(MapleDataType.PROPERTY);
|
|
||||||
slea.readByte();
|
|
||||||
slea.readByte();
|
|
||||||
int children = WZTool.readValue(slea);
|
|
||||||
for (int i = 0; i < children; i++) {
|
|
||||||
WZIMGEntry cEntry = new WZIMGEntry(entry);
|
|
||||||
parse(cEntry, slea);
|
|
||||||
cEntry.finish();
|
|
||||||
entry.addChild(cEntry);
|
|
||||||
}
|
|
||||||
} else if (type.equals("Canvas")) {
|
|
||||||
entry.setType(MapleDataType.CANVAS);
|
|
||||||
slea.readByte();
|
|
||||||
marker = slea.readByte();
|
|
||||||
if (marker == 0) {
|
|
||||||
// do nothing
|
|
||||||
} else if (marker == 1) {
|
|
||||||
slea.readByte();
|
|
||||||
slea.readByte();
|
|
||||||
int children = WZTool.readValue(slea);
|
|
||||||
for (int i = 0; i < children; i++) {
|
|
||||||
WZIMGEntry child = new WZIMGEntry(entry);
|
|
||||||
parse(child, slea);
|
|
||||||
child.finish();
|
|
||||||
entry.addChild(child);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.out.println("Canvas marker != 1 (" + marker + ")");
|
|
||||||
}
|
|
||||||
int width = WZTool.readValue(slea);
|
|
||||||
int height = WZTool.readValue(slea);
|
|
||||||
int format = WZTool.readValue(slea);
|
|
||||||
int format2 = slea.readByte();
|
|
||||||
slea.readInt();
|
|
||||||
int dataLength = slea.readInt() - 1;
|
|
||||||
slea.readByte();
|
|
||||||
if (provideImages) {
|
|
||||||
byte[] pngdata = slea.read(dataLength);
|
|
||||||
entry.setData(new PNGMapleCanvas(width, height, dataLength, format + format2, pngdata));
|
|
||||||
} else {
|
|
||||||
entry.setData(new PNGMapleCanvas(width, height, dataLength, format + format2, null));
|
|
||||||
slea.skip(dataLength);
|
|
||||||
}
|
|
||||||
} else if (type.equals("Shape2D#Vector2D")) {
|
|
||||||
entry.setType(MapleDataType.VECTOR);
|
|
||||||
int x = WZTool.readValue(slea);
|
|
||||||
int y = WZTool.readValue(slea);
|
|
||||||
entry.setData(new Point(x, y));
|
|
||||||
} else if (type.equals("Shape2D#Convex2D")) {
|
|
||||||
int children = WZTool.readValue(slea);
|
|
||||||
for (int i = 0; i < children; i++) {
|
|
||||||
WZIMGEntry cEntry = new WZIMGEntry(entry);
|
|
||||||
parseExtended(cEntry, slea, 0);
|
|
||||||
cEntry.finish();
|
|
||||||
entry.addChild(cEntry);
|
|
||||||
}
|
|
||||||
} else if (type.equals("Sound_DX8")) {
|
|
||||||
entry.setType(MapleDataType.SOUND);
|
|
||||||
slea.readByte();
|
|
||||||
int dataLength = WZTool.readValue(slea);
|
|
||||||
WZTool.readValue(slea); // no clue what this is
|
|
||||||
int offset = (int) slea.getPosition();
|
|
||||||
entry.setData(new ImgMapleSound(dataLength, offset - file.getOffset()));
|
|
||||||
slea.seek(endOfExtendedBlock);
|
|
||||||
} else if (type.equals("UOL")) {
|
|
||||||
entry.setType(MapleDataType.UOL);
|
|
||||||
slea.readByte();
|
|
||||||
byte uolmarker = slea.readByte();
|
|
||||||
switch (uolmarker) {
|
|
||||||
case 0:
|
|
||||||
entry.setData(WZTool.readDecodedString(slea));
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
entry.setData(WZTool.readDecodedStringAtOffsetAndReset(slea, file.getOffset() + slea.readInt()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("Unknown UOL marker: " + uolmarker + " " + entry.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("Unhandled extended type: " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import tools.data.input.LittleEndianAccessor;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
|
||||||
import javax.crypto.Cipher;
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
|
||||||
import javax.crypto.NoSuchPaddingException;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ported Code, see WZFile.java for more info
|
|
||||||
*/
|
|
||||||
public class WZTool {
|
|
||||||
private static byte[] encKey;
|
|
||||||
|
|
||||||
static {
|
|
||||||
byte[] iv = new byte[]{(byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b,
|
|
||||||
(byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b,
|
|
||||||
(byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b,
|
|
||||||
(byte) 0x4d, (byte) 0x23, (byte) 0xc7, (byte) 0x2b,};
|
|
||||||
byte[] key = new byte[]{(byte) 0x13, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x08, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x06, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0xB4, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x1B, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x0F, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x33, 0x00, 0x00, 0x00,
|
|
||||||
(byte) 0x52, 0x00, 0x00, 0x00
|
|
||||||
};
|
|
||||||
Cipher cipher = null;
|
|
||||||
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
|
|
||||||
try {
|
|
||||||
cipher = Cipher.getInstance("AES");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NoSuchPaddingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
|
|
||||||
} catch (InvalidKeyException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
encKey = new byte[0xFFFF];
|
|
||||||
for (int i = 0; i < (0xFFFF / 16); i++) {
|
|
||||||
try {
|
|
||||||
iv = cipher.doFinal(iv);
|
|
||||||
} catch (IllegalBlockSizeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (BadPaddingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.arraycopy(iv, 0, encKey, (i * 16), 16);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
iv = cipher.doFinal(iv);
|
|
||||||
} catch (IllegalBlockSizeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (BadPaddingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.arraycopy(iv, 0, encKey, 65520, 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] readListString(byte[] str) {
|
|
||||||
for (int i = 0; i < str.length; i++) {
|
|
||||||
str[i] = (byte) (str[i] ^ encKey[i]);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String readDecodedString(LittleEndianAccessor llea) {
|
|
||||||
int strLength;
|
|
||||||
byte b = llea.readByte();
|
|
||||||
if (b == 0x00) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (b >= 0) {
|
|
||||||
if (b == 0x7F) {
|
|
||||||
strLength = llea.readInt();
|
|
||||||
} else {
|
|
||||||
strLength = b;
|
|
||||||
}
|
|
||||||
if (strLength < 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
byte str[] = new byte[strLength * 2];
|
|
||||||
for (int i = 0; i < strLength * 2; i++) {
|
|
||||||
str[i] = llea.readByte();
|
|
||||||
}
|
|
||||||
return DecryptUnicodeStr(str);
|
|
||||||
} else {
|
|
||||||
if (b == -128) {
|
|
||||||
strLength = llea.readInt();
|
|
||||||
} else {
|
|
||||||
strLength = -b;
|
|
||||||
}
|
|
||||||
if (strLength < 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
byte str[] = new byte[strLength];
|
|
||||||
for (int i = 0; i < strLength; i++) {
|
|
||||||
str[i] = llea.readByte();
|
|
||||||
}
|
|
||||||
return DecryptAsciiStr(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String DecryptAsciiStr(byte[] str) {
|
|
||||||
byte xorByte = (byte) 0xAA;
|
|
||||||
for (int i = 0; i < str.length; i++) {
|
|
||||||
str[i] = (byte) (str[i] ^ xorByte ^ encKey[i]);
|
|
||||||
xorByte++;
|
|
||||||
}
|
|
||||||
return new String(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String DecryptUnicodeStr(byte[] str) {
|
|
||||||
int xorByte = 0xAAAA;
|
|
||||||
char[] charRet = new char[str.length / 2];
|
|
||||||
for (int i = 0; i < str.length; i++) {
|
|
||||||
str[i] = (byte) (str[i] ^ encKey[i]);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < (str.length / 2); i++) {
|
|
||||||
char toXor = (char) ((str[i] << 8) | str[i + 1]);
|
|
||||||
charRet[i] = (char) (toXor ^ xorByte);
|
|
||||||
xorByte++;
|
|
||||||
}
|
|
||||||
return String.valueOf(charRet);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String readDecodedStringAtOffset(SeekableLittleEndianAccessor slea, int offset) {
|
|
||||||
slea.seek(offset);
|
|
||||||
return readDecodedString(slea);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String readDecodedStringAtOffsetAndReset(SeekableLittleEndianAccessor slea, int offset) {
|
|
||||||
long pos = 0;
|
|
||||||
pos = slea.getPosition();
|
|
||||||
slea.seek(offset);
|
|
||||||
String ret = readDecodedString(slea);
|
|
||||||
slea.seek(pos);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int readValue(LittleEndianAccessor lea) {
|
|
||||||
byte b = lea.readByte();
|
|
||||||
if (b == -128) {
|
|
||||||
return lea.readInt();
|
|
||||||
} else {
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float readFloatValue(LittleEndianAccessor lea) {
|
|
||||||
byte b = lea.readByte();
|
|
||||||
if (b == -128) {
|
|
||||||
return lea.readFloat();
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.NamedNodeMap;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
|
|
||||||
public class XMLDomMapleData implements MapleData {
|
|
||||||
private Node node;
|
|
||||||
private File imageDataDir;
|
|
||||||
private NumberFormat nf;
|
|
||||||
|
|
||||||
public XMLDomMapleData(FileInputStream fis, File imageDataDir) {
|
|
||||||
try {
|
|
||||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
|
||||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
|
||||||
Document document = documentBuilder.parse(fis);
|
|
||||||
this.node = document.getFirstChild();
|
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (SAXException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
this.imageDataDir = imageDataDir;
|
|
||||||
this.nf = NumberFormat.getInstance(Locale.FRANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private XMLDomMapleData(Node node) {
|
|
||||||
this.node = node;
|
|
||||||
this.nf = NumberFormat.getInstance(Locale.FRANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleData getChildByPath(String path) {
|
|
||||||
String segments[] = path.split("/");
|
|
||||||
if (segments[0].equals("..")) {
|
|
||||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
Node myNode = node;
|
|
||||||
for (int x = 0; x < segments.length; x++) {
|
|
||||||
NodeList childNodes = myNode.getChildNodes();
|
|
||||||
boolean foundChild = false;
|
|
||||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
|
||||||
Node childNode = childNodes.item(i);
|
|
||||||
if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getAttributes().getNamedItem("name").getNodeValue().equals(segments[x])) {
|
|
||||||
myNode = childNode;
|
|
||||||
foundChild = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundChild) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XMLDomMapleData ret = new XMLDomMapleData(myNode);
|
|
||||||
ret.imageDataDir = new File(imageDataDir, getName() + "/" + path).getParentFile();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MapleData> getChildren() {
|
|
||||||
List<MapleData> ret = new ArrayList<MapleData>();
|
|
||||||
NodeList childNodes = node.getChildNodes();
|
|
||||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
|
||||||
Node childNode = childNodes.item(i);
|
|
||||||
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
|
|
||||||
XMLDomMapleData child = new XMLDomMapleData(childNode);
|
|
||||||
child.imageDataDir = new File(imageDataDir, getName());
|
|
||||||
ret.add(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getData() {
|
|
||||||
NamedNodeMap attributes = node.getAttributes();
|
|
||||||
MapleDataType type = getType();
|
|
||||||
switch (type) {
|
|
||||||
case DOUBLE:
|
|
||||||
case FLOAT:
|
|
||||||
case INT:
|
|
||||||
case SHORT: {
|
|
||||||
String value = attributes.getNamedItem("value").getNodeValue();
|
|
||||||
Number nval;
|
|
||||||
|
|
||||||
try {
|
|
||||||
nval = nf.parse(value);
|
|
||||||
}
|
|
||||||
catch(java.text.ParseException pe) {
|
|
||||||
pe.printStackTrace();
|
|
||||||
nval = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case DOUBLE:
|
|
||||||
return nval.doubleValue();
|
|
||||||
case FLOAT:
|
|
||||||
return nval.floatValue();
|
|
||||||
case INT:
|
|
||||||
return nval.intValue();
|
|
||||||
case SHORT:
|
|
||||||
return nval.shortValue();
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case STRING:
|
|
||||||
case UOL: {
|
|
||||||
String value = attributes.getNamedItem("value").getNodeValue();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
case VECTOR: {
|
|
||||||
String x = attributes.getNamedItem("x").getNodeValue();
|
|
||||||
String y = attributes.getNamedItem("y").getNodeValue();
|
|
||||||
return new Point(Integer.parseInt(x), Integer.parseInt(y));
|
|
||||||
}
|
|
||||||
case CANVAS: {
|
|
||||||
String width = attributes.getNamedItem("width").getNodeValue();
|
|
||||||
String height = attributes.getNamedItem("height").getNodeValue();
|
|
||||||
return new FileStoredPngMapleCanvas(Integer.parseInt(width), Integer.parseInt(height), new File(
|
|
||||||
imageDataDir, getName() + ".png"));
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleDataType getType() {
|
|
||||||
String nodeName = node.getNodeName();
|
|
||||||
if (nodeName.equals("imgdir")) {
|
|
||||||
return MapleDataType.PROPERTY;
|
|
||||||
} else if (nodeName.equals("canvas")) {
|
|
||||||
return MapleDataType.CANVAS;
|
|
||||||
} else if (nodeName.equals("convex")) {
|
|
||||||
return MapleDataType.CONVEX;
|
|
||||||
} else if (nodeName.equals("sound")) {
|
|
||||||
return MapleDataType.SOUND;
|
|
||||||
} else if (nodeName.equals("uol")) {
|
|
||||||
return MapleDataType.UOL;
|
|
||||||
} else if (nodeName.equals("double")) {
|
|
||||||
return MapleDataType.DOUBLE;
|
|
||||||
} else if (nodeName.equals("float")) {
|
|
||||||
return MapleDataType.FLOAT;
|
|
||||||
} else if (nodeName.equals("int")) {
|
|
||||||
return MapleDataType.INT;
|
|
||||||
} else if (nodeName.equals("short")) {
|
|
||||||
return MapleDataType.SHORT;
|
|
||||||
} else if (nodeName.equals("string")) {
|
|
||||||
return MapleDataType.STRING;
|
|
||||||
} else if (nodeName.equals("vector")) {
|
|
||||||
return MapleDataType.VECTOR;
|
|
||||||
} else if (nodeName.equals("null")) {
|
|
||||||
return MapleDataType.IMG_0x00;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleDataEntity getParent() {
|
|
||||||
Node parentNode = node.getParentNode();
|
|
||||||
if (parentNode.getNodeType() == Node.DOCUMENT_NODE) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
XMLDomMapleData parentData = new XMLDomMapleData(parentNode);
|
|
||||||
parentData.imageDataDir = imageDataDir.getParentFile();
|
|
||||||
return parentData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return node.getAttributes().getNamedItem("name").getNodeValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<MapleData> iterator() {
|
|
||||||
return getChildren().iterator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package provider.wz;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataDirectoryEntry;
|
|
||||||
import provider.MapleDataProvider;
|
|
||||||
|
|
||||||
public class XMLWZFile implements MapleDataProvider {
|
|
||||||
private File root;
|
|
||||||
private WZDirectoryEntry rootForNavigation;
|
|
||||||
|
|
||||||
public XMLWZFile(File fileIn) {
|
|
||||||
root = fileIn;
|
|
||||||
rootForNavigation = new WZDirectoryEntry(fileIn.getName(), 0, 0, null);
|
|
||||||
fillMapleDataEntitys(root, rootForNavigation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillMapleDataEntitys(File lroot, WZDirectoryEntry wzdir) {
|
|
||||||
for (File file : lroot.listFiles()) {
|
|
||||||
String fileName = file.getName();
|
|
||||||
if (file.isDirectory() && !fileName.endsWith(".img")) {
|
|
||||||
WZDirectoryEntry newDir = new WZDirectoryEntry(fileName, 0, 0, wzdir);
|
|
||||||
wzdir.addDirectory(newDir);
|
|
||||||
fillMapleDataEntitys(file, newDir);
|
|
||||||
} else if (fileName.endsWith(".xml")) {
|
|
||||||
wzdir.addFile(new WZFileEntry(fileName.substring(0, fileName.length() - 4), 0, 0, wzdir));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleData getData(String path) {
|
|
||||||
File dataFile = new File(root, path + ".xml");
|
|
||||||
File imageDataDir = new File(root, path);
|
|
||||||
if (!dataFile.exists()) {
|
|
||||||
return null;//bitches
|
|
||||||
}
|
|
||||||
FileInputStream fis;
|
|
||||||
try {
|
|
||||||
fis = new FileInputStream(dataFile);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
throw new RuntimeException("Datafile " + path + " does not exist in " + root.getAbsolutePath());
|
|
||||||
}
|
|
||||||
final XMLDomMapleData domMapleData;
|
|
||||||
try {
|
|
||||||
domMapleData = new XMLDomMapleData(fis, imageDataDir.getParentFile());
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
fis.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return domMapleData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapleDataDirectoryEntry getRoot() {
|
|
||||||
return rootForNavigation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package tools;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Frz (Big Daddy)
|
|
||||||
* @author The Real Spookster - some modifications to this beautiful code
|
|
||||||
*/
|
|
||||||
public class DatabaseConnection {
|
|
||||||
private static String DB_URL = "jdbc:mysql://localhost:3306/cosmic";
|
|
||||||
private static String DB_USER = "cosmic_server";
|
|
||||||
private static String DB_PASS = "snailshell";
|
|
||||||
|
|
||||||
public static final int RETURN_GENERATED_KEYS = 1;
|
|
||||||
|
|
||||||
private static ThreadLocal<Connection> con = new ThreadLocalConnection();
|
|
||||||
|
|
||||||
public static Connection getConnection() {
|
|
||||||
Connection c = con.get();
|
|
||||||
try {
|
|
||||||
c.getMetaData();
|
|
||||||
} catch (SQLException e) { // connection is dead, therefore discard old object 5ever
|
|
||||||
con.remove();
|
|
||||||
c = con.get();
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ThreadLocalConnection extends ThreadLocal<Connection> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Connection initialValue() {
|
|
||||||
try {
|
|
||||||
Class.forName("com.mysql.jdbc.Driver"); // touch the mysql driver
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
System.out.println("[SEVERE] SQL Driver Not Found. Consider death by clams.");
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return DriverManager.getConnection(DB_URL, DB_USER, DB_PASS);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
System.out.println("[SEVERE] Unable to make database connection.");
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
|
|
||||||
public class HexTool {
|
|
||||||
private static final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
||||||
|
|
||||||
private static String toString(byte byteValue) {
|
|
||||||
int tmp = byteValue << 8;
|
|
||||||
char[] retstr = new char[]{HEX[(tmp >> 12) & 0x0F], HEX[(tmp >> 8) & 0x0F]};
|
|
||||||
return String.valueOf(retstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toString(byte[] bytes) {
|
|
||||||
StringBuilder hexed = new StringBuilder();
|
|
||||||
for (int i = 0; i < bytes.length; i++) {
|
|
||||||
hexed.append(toString(bytes[i]));
|
|
||||||
hexed.append(' ');
|
|
||||||
}
|
|
||||||
return hexed.substring(0, hexed.length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] getByteArrayFromHexString(String hex) {
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
||||||
int nexti = 0;
|
|
||||||
int nextb = 0;
|
|
||||||
boolean highoc = true;
|
|
||||||
outer:
|
|
||||||
for (;;) {
|
|
||||||
int number = -1;
|
|
||||||
while (number == -1) {
|
|
||||||
if (nexti == hex.length()) {
|
|
||||||
break outer;
|
|
||||||
}
|
|
||||||
char chr = hex.charAt(nexti);
|
|
||||||
if (chr >= '0' && chr <= '9') {
|
|
||||||
number = chr - '0';
|
|
||||||
} else if (chr >= 'a' && chr <= 'f') {
|
|
||||||
number = chr - 'a' + 10;
|
|
||||||
} else if (chr >= 'A' && chr <= 'F') {
|
|
||||||
number = chr - 'A' + 10;
|
|
||||||
} else {
|
|
||||||
number = -1;
|
|
||||||
}
|
|
||||||
nexti++;
|
|
||||||
}
|
|
||||||
if (highoc) {
|
|
||||||
nextb = number << 4;
|
|
||||||
highoc = false;
|
|
||||||
} else {
|
|
||||||
nextb |= number;
|
|
||||||
highoc = true;
|
|
||||||
baos.write(nextb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return baos.toByteArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License version 3
|
|
||||||
as published by the Free Software Foundation. You may not use, modify
|
|
||||||
or distribute this program under any other version of the
|
|
||||||
GNU Affero General Public License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a pair of values.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @since Revision 333
|
|
||||||
* @version 1.0
|
|
||||||
*
|
|
||||||
* @param <E> The type of the left value.
|
|
||||||
* @param <F> The type of the right value.
|
|
||||||
*/
|
|
||||||
public class Pair<E, F> {
|
|
||||||
|
|
||||||
public E left;
|
|
||||||
public F right;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor - pairs two objects together.
|
|
||||||
*
|
|
||||||
* @param left The left object.
|
|
||||||
* @param right The right object.
|
|
||||||
*/
|
|
||||||
public Pair(E left, F right) {
|
|
||||||
this.left = left;
|
|
||||||
this.right = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the left value.
|
|
||||||
*
|
|
||||||
* @return The left value.
|
|
||||||
*/
|
|
||||||
public E getLeft() {
|
|
||||||
return left;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the right value.
|
|
||||||
*
|
|
||||||
* @return The right value.
|
|
||||||
*/
|
|
||||||
public F getRight() {
|
|
||||||
return right;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turns the pair into a string.
|
|
||||||
*
|
|
||||||
* @return Each value of the pair as a string joined with a colon.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return left.toString() + ":" + right.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the hash code of this pair.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((left == null) ? 0 : left.hashCode());
|
|
||||||
result = prime * result + ((right == null) ? 0 : right.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks to see if two pairs are equal.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Pair other = (Pair) obj;
|
|
||||||
if (left == null) {
|
|
||||||
if (other.left != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!left.equals(other.left)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (right == null) {
|
|
||||||
if (other.right != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!right.equals(other.right)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import tools.HexTool;
|
|
||||||
|
|
||||||
public class ByteArrayByteStream implements SeekableInputStreamBytestream {
|
|
||||||
private int pos = 0;
|
|
||||||
private long bytesRead = 0;
|
|
||||||
private byte[] arr;
|
|
||||||
|
|
||||||
public ByteArrayByteStream(byte[] arr) {
|
|
||||||
this.arr = arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPosition() {
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void seek(long offset) throws IOException {
|
|
||||||
pos = (int) offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getBytesRead() {
|
|
||||||
return bytesRead;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int readByte() {
|
|
||||||
bytesRead++;
|
|
||||||
return ((int) arr[pos++]) & 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
String nows = "kevintjuh93 pwns";//I lol'd
|
|
||||||
if (arr.length - pos > 0) {
|
|
||||||
byte[] now = new byte[arr.length - pos];
|
|
||||||
System.arraycopy(arr, pos, now, 0, arr.length - pos);
|
|
||||||
nows = HexTool.toString(now);
|
|
||||||
}
|
|
||||||
return "All: " + HexTool.toString(arr) + "\nNow: " + nows;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long available() {
|
|
||||||
return arr.length - pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an abstract stream of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public interface ByteInputStream {
|
|
||||||
int readByte();
|
|
||||||
long getBytesRead();
|
|
||||||
long available();
|
|
||||||
}
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a generic interface to a Little Endian stream of bytes.
|
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
* @author Frz
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public class GenericLittleEndianAccessor implements LittleEndianAccessor {
|
|
||||||
private ByteInputStream bs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor - Wraps the accessor around a stream of bytes.
|
|
||||||
*
|
|
||||||
* @param bs The byte stream to wrap the accessor around.
|
|
||||||
*/
|
|
||||||
public GenericLittleEndianAccessor(ByteInputStream bs) {
|
|
||||||
this.bs = bs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a single byte from the stream.
|
|
||||||
*
|
|
||||||
* @return The byte read.
|
|
||||||
* @see tools.data.input.ByteInputStream#readByte
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public byte readByte() {
|
|
||||||
return (byte) bs.readByte();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads an integer from the stream.
|
|
||||||
*
|
|
||||||
* @return The integer read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int readInt() {
|
|
||||||
return bs.readByte() + (bs.readByte() << 8) + (bs.readByte() << 16) + (bs.readByte() << 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a short integer from the stream.
|
|
||||||
*
|
|
||||||
* @return The short read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public short readShort() {
|
|
||||||
return (short) (bs.readByte() + (bs.readByte() << 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a single character from the stream.
|
|
||||||
*
|
|
||||||
* @return The character read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public char readChar() {
|
|
||||||
return (char) readShort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a long integer from the stream.
|
|
||||||
*
|
|
||||||
* @return The long integer read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long readLong() {
|
|
||||||
long byte1 = bs.readByte();
|
|
||||||
long byte2 = bs.readByte();
|
|
||||||
long byte3 = bs.readByte();
|
|
||||||
long byte4 = bs.readByte();
|
|
||||||
long byte5 = bs.readByte();
|
|
||||||
long byte6 = bs.readByte();
|
|
||||||
long byte7 = bs.readByte();
|
|
||||||
long byte8 = bs.readByte();
|
|
||||||
return (byte8 << 56) + (byte7 << 48) + (byte6 << 40) + (byte5 << 32) + (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a floating point integer from the stream.
|
|
||||||
*
|
|
||||||
* @return The float-type integer read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public float readFloat() {
|
|
||||||
return Float.intBitsToFloat(readInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a double-precision integer from the stream.
|
|
||||||
*
|
|
||||||
* @return The double-type integer read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public double readDouble() {
|
|
||||||
return Double.longBitsToDouble(readLong());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads an ASCII string from the stream with length <code>n</code>.
|
|
||||||
*
|
|
||||||
* @param n Number of characters to read.
|
|
||||||
* @return The string read.
|
|
||||||
*/
|
|
||||||
public final String readAsciiString(int n) {
|
|
||||||
char ret[] = new char[n];
|
|
||||||
for (int x = 0; x < n; x++) {
|
|
||||||
ret[x] = (char) readByte();
|
|
||||||
}
|
|
||||||
return String.valueOf(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a null-terminated string from the stream.
|
|
||||||
*
|
|
||||||
* @return The string read.
|
|
||||||
*/
|
|
||||||
public final String readNullTerminatedAsciiString() {
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
||||||
byte b;
|
|
||||||
while (true) {
|
|
||||||
b = readByte();
|
|
||||||
if (b == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
baos.write(b);
|
|
||||||
}
|
|
||||||
byte[] buf = baos.toByteArray();
|
|
||||||
char[] chrBuf = new char[buf.length];
|
|
||||||
for (int x = 0; x < buf.length; x++) {
|
|
||||||
chrBuf[x] = (char) buf[x];
|
|
||||||
}
|
|
||||||
return String.valueOf(chrBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the number of bytes read from the stream so far.
|
|
||||||
*
|
|
||||||
* @return A long integer representing the number of bytes read.
|
|
||||||
* @see tools.data.input.ByteInputStream#getBytesRead()
|
|
||||||
*/
|
|
||||||
public long getBytesRead() {
|
|
||||||
return bs.getBytesRead();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a MapleStory convention lengthed ASCII string.
|
|
||||||
* This consists of a short integer telling the length of the string,
|
|
||||||
* then the string itself.
|
|
||||||
*
|
|
||||||
* @return The string read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String readMapleAsciiString() {
|
|
||||||
return readAsciiString(readShort());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads <code>num</code> bytes off the stream.
|
|
||||||
*
|
|
||||||
* @param num The number of bytes to read.
|
|
||||||
* @return An array of bytes with the length of <code>num</code>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public byte[] read(int num) {
|
|
||||||
byte[] ret = new byte[num];
|
|
||||||
for (int x = 0; x < num; x++) {
|
|
||||||
ret[x] = readByte();
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a MapleStory Position information.
|
|
||||||
* This consists of 2 short integer.
|
|
||||||
*
|
|
||||||
* @return The Position read.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public final Point readPos() {
|
|
||||||
final int x = readShort();
|
|
||||||
final int y = readShort();
|
|
||||||
return new Point(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skips the current position of the stream <code>num</code> bytes ahead.
|
|
||||||
*
|
|
||||||
* @param num Number of bytes to skip.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void skip(int num) {
|
|
||||||
for (int x = 0; x < num; x++) {
|
|
||||||
readByte();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see tools.data.input.ByteInputStream#available
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long available() {
|
|
||||||
return bs.available();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see java.lang.Object#toString
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return bs.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an abstract accessor to a generic Little Endian byte stream. This
|
|
||||||
* accessor is seekable.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
* @see tools.data.input.GenericLittleEndianAccessor
|
|
||||||
*/
|
|
||||||
public class GenericSeekableLittleEndianAccessor extends GenericLittleEndianAccessor implements SeekableLittleEndianAccessor {
|
|
||||||
private SeekableInputStreamBytestream bs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor
|
|
||||||
* Provide a seekable input stream to wrap this object around.
|
|
||||||
*
|
|
||||||
* @param bs The byte stream to wrap this around.
|
|
||||||
*/
|
|
||||||
public GenericSeekableLittleEndianAccessor(SeekableInputStreamBytestream bs) {
|
|
||||||
super(bs);
|
|
||||||
this.bs = bs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek the pointer to <code>offset</code>
|
|
||||||
*
|
|
||||||
* @param offset The offset to seek to.
|
|
||||||
* @see tools.data.input.SeekableInputStreamBytestream#seek
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void seek(long offset) {
|
|
||||||
try {
|
|
||||||
bs.seek(offset);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("Seek failed " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current position of the pointer.
|
|
||||||
*
|
|
||||||
* @return The current position of the pointer as a long integer.
|
|
||||||
* @see tools.data.input.SeekableInputStreamBytestream#getPosition
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long getPosition() {
|
|
||||||
try {
|
|
||||||
return bs.getPosition();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("getPosition failed" + e);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skip <code>num</code> number of bytes in the stream.
|
|
||||||
*
|
|
||||||
* @param num The number of bytes to skip.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void skip(int num) {
|
|
||||||
seek(getPosition() + num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an abstract wrapper to a stream of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public class InputStreamByteStream implements ByteInputStream {
|
|
||||||
private InputStream is;
|
|
||||||
private long read = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor.
|
|
||||||
* Provide an input stream to wrap this around.
|
|
||||||
*
|
|
||||||
* @param is The input stream to wrap this object around.
|
|
||||||
*/
|
|
||||||
public InputStreamByteStream(InputStream is) {
|
|
||||||
this.is = is;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the next byte from the stream.
|
|
||||||
*
|
|
||||||
* @return Then next byte in the stream.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int readByte() {
|
|
||||||
int temp;
|
|
||||||
try {
|
|
||||||
temp = is.read();
|
|
||||||
if (temp == -1) {
|
|
||||||
throw new RuntimeException("EOF");
|
|
||||||
}
|
|
||||||
read++;
|
|
||||||
return temp;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the number of bytes read from the stream.
|
|
||||||
*
|
|
||||||
* @return The number of bytes read as a long integer.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long getBytesRead() {
|
|
||||||
return read;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of bytes left in the stream.
|
|
||||||
*
|
|
||||||
* @return The number of bytes available for reading as a long integer.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public long available() {
|
|
||||||
try {
|
|
||||||
return is.available();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("ERROR" + e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Frz
|
|
||||||
*/
|
|
||||||
public interface LittleEndianAccessor {
|
|
||||||
byte readByte();
|
|
||||||
char readChar();
|
|
||||||
short readShort();
|
|
||||||
int readInt();
|
|
||||||
Point readPos();
|
|
||||||
long readLong();
|
|
||||||
void skip(int num);
|
|
||||||
byte[] read(int num);
|
|
||||||
float readFloat();
|
|
||||||
double readDouble();
|
|
||||||
String readAsciiString(int n);
|
|
||||||
String readNullTerminatedAsciiString();
|
|
||||||
String readMapleAsciiString();
|
|
||||||
long getBytesRead();
|
|
||||||
long available();
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an abstract layer to a byte stream. This layer can be accessed
|
|
||||||
* randomly.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public class RandomAccessByteStream implements SeekableInputStreamBytestream {
|
|
||||||
private RandomAccessFile raf;
|
|
||||||
private long read = 0;
|
|
||||||
|
|
||||||
public RandomAccessByteStream(RandomAccessFile raf) {
|
|
||||||
super();
|
|
||||||
this.raf = raf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int readByte() {
|
|
||||||
int temp;
|
|
||||||
try {
|
|
||||||
temp = raf.read();
|
|
||||||
if (temp == -1) {
|
|
||||||
throw new RuntimeException("EOF");
|
|
||||||
}
|
|
||||||
read++;
|
|
||||||
return temp;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void seek(long offset) throws IOException {
|
|
||||||
raf.seek(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getPosition() throws IOException {
|
|
||||||
return raf.getFilePointer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getBytesRead() {
|
|
||||||
return read;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long available() {
|
|
||||||
try {
|
|
||||||
return raf.length() - raf.getFilePointer();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.out.println("ERROR " + e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an abstract interface to a stream of bytes. This stream can be
|
|
||||||
* seeked.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since 299
|
|
||||||
*/
|
|
||||||
public interface SeekableInputStreamBytestream extends ByteInputStream {
|
|
||||||
/**
|
|
||||||
* Seeks the stream by the specified offset.
|
|
||||||
*
|
|
||||||
* @param offset
|
|
||||||
* Number of bytes to seek.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
void seek(long offset) throws IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current position of the stream.
|
|
||||||
*
|
|
||||||
* @return The stream position as a long integer.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
long getPosition() throws IOException;
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.input;
|
|
||||||
|
|
||||||
public interface SeekableLittleEndianAccessor extends LittleEndianAccessor {
|
|
||||||
void seek(long offset);
|
|
||||||
long getPosition();
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.output;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses a byte array to output a stream of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 352
|
|
||||||
*/
|
|
||||||
class BAOSByteOutputStream implements ByteOutputStream {
|
|
||||||
private ByteArrayOutputStream baos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor - Wraps the stream around a Java BAOS.
|
|
||||||
*
|
|
||||||
* @param baos <code>The ByteArrayOutputStream</code> to wrap this around.
|
|
||||||
*/
|
|
||||||
BAOSByteOutputStream(ByteArrayOutputStream baos) {
|
|
||||||
super();
|
|
||||||
this.baos = baos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a byte to the stream.
|
|
||||||
*
|
|
||||||
* @param b The byte to write to the stream.
|
|
||||||
* @see tools.data.output.ByteOutputStream#writeByte(byte)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeByte(byte b) {
|
|
||||||
baos.write(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.output;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an interface to an output stream of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @since Revision 323
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
interface ByteOutputStream {
|
|
||||||
/**
|
|
||||||
* Writes a byte to the stream.
|
|
||||||
*
|
|
||||||
* @param b The byte to write.
|
|
||||||
*/
|
|
||||||
void writeByte(byte b);
|
|
||||||
}
|
|
||||||
@@ -1,183 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.output;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a generic writer of a little-endian sequence of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public class GenericLittleEndianWriter implements LittleEndianWriter {
|
|
||||||
private static Charset ASCII = Charset.forName("US-ASCII");
|
|
||||||
private ByteOutputStream bos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class constructor - Protected to prevent instantiation with no arguments.
|
|
||||||
*/
|
|
||||||
protected GenericLittleEndianWriter() {
|
|
||||||
// Blah!
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the byte-output stream for this instance of the object.
|
|
||||||
*
|
|
||||||
* @param bos The new output stream to set.
|
|
||||||
*/
|
|
||||||
void setByteOutputStream(ByteOutputStream bos) {
|
|
||||||
this.bos = bos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write an array of bytes to the stream.
|
|
||||||
*
|
|
||||||
* @param b The bytes to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void write(byte[] b) {
|
|
||||||
for (int x = 0; x < b.length; x++) {
|
|
||||||
bos.writeByte(b[x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a byte to the stream.
|
|
||||||
*
|
|
||||||
* @param b The byte to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void write(byte b) {
|
|
||||||
bos.writeByte(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a byte in integer form to the stream.
|
|
||||||
*
|
|
||||||
* @param b The byte as an <code>Integer</code> to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void write(int b) {
|
|
||||||
bos.writeByte((byte) b);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void skip(int b) {
|
|
||||||
write(new byte[b]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a short integer to the stream.
|
|
||||||
*
|
|
||||||
* @param i The short integer to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeShort(int i) {
|
|
||||||
bos.writeByte((byte) (i & 0xFF));
|
|
||||||
bos.writeByte((byte) ((i >>> 8) & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes an integer to the stream.
|
|
||||||
*
|
|
||||||
* @param i The integer to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeInt(int i) {
|
|
||||||
bos.writeByte((byte) (i & 0xFF));
|
|
||||||
bos.writeByte((byte) ((i >>> 8) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((i >>> 16) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((i >>> 24) & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes an ASCII string the the stream.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeAsciiString(String s) {
|
|
||||||
write(s.getBytes(ASCII));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a maple-convention ASCII string to the stream.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to use maple-convention to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeMapleAsciiString(String s) {
|
|
||||||
writeShort((short) s.length());
|
|
||||||
writeAsciiString(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a null-terminated ASCII string to the stream.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeNullTerminatedAsciiString(String s) {
|
|
||||||
writeAsciiString(s);
|
|
||||||
write(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a long integer to the stream.
|
|
||||||
* @param l The long integer to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeLong(long l) {
|
|
||||||
bos.writeByte((byte) (l & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 8) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 16) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 24) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 32) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 40) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 48) & 0xFF));
|
|
||||||
bos.writeByte((byte) ((l >>> 56) & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a 2D 4 byte position information
|
|
||||||
*
|
|
||||||
* @param s The Point position to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writePos(Point s) {
|
|
||||||
writeShort(s.x);
|
|
||||||
writeShort(s.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a boolean true ? 1 : 0
|
|
||||||
*
|
|
||||||
* @param b The boolean to write.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void writeBool(final boolean b) {
|
|
||||||
write(b ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.output;
|
|
||||||
|
|
||||||
import java.awt.Point;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an interface to a writer class that writes a little-endian sequence
|
|
||||||
* of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 323
|
|
||||||
*/
|
|
||||||
public interface LittleEndianWriter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write an array of bytes to the sequence.
|
|
||||||
*
|
|
||||||
* @param b The bytes to write.
|
|
||||||
*/
|
|
||||||
public void write(byte b[]);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a byte to the sequence.
|
|
||||||
*
|
|
||||||
* @param b The byte to write.
|
|
||||||
*/
|
|
||||||
public void write(byte b);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a byte in integer form to the sequence.
|
|
||||||
*
|
|
||||||
* @param b The byte as an <code>Integer</code> to write.
|
|
||||||
*/
|
|
||||||
public void write(int b);
|
|
||||||
|
|
||||||
public void skip(int b);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes an integer to the sequence.
|
|
||||||
*
|
|
||||||
* @param i The integer to write.
|
|
||||||
*/
|
|
||||||
public void writeInt(int i);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a short integer to the sequence.
|
|
||||||
*
|
|
||||||
* @param s The short integer to write.
|
|
||||||
*/
|
|
||||||
public void writeShort(int s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a long integer to the sequence.
|
|
||||||
*
|
|
||||||
* @param l The long integer to write.
|
|
||||||
*/
|
|
||||||
public void writeLong(long l);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes an ASCII string the the sequence.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to write.
|
|
||||||
*/
|
|
||||||
void writeAsciiString(String s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a null-terminated ASCII string to the sequence.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to write.
|
|
||||||
*/
|
|
||||||
void writeNullTerminatedAsciiString(String s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a maple-convention ASCII string to the sequence.
|
|
||||||
*
|
|
||||||
* @param s The ASCII string to use maple-convention to write.
|
|
||||||
*/
|
|
||||||
void writeMapleAsciiString(String s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a 2D 4 byte position information
|
|
||||||
*
|
|
||||||
* @param s The Point position to write.
|
|
||||||
*/
|
|
||||||
void writePos(Point s);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a boolean true ? 1 : 0
|
|
||||||
*
|
|
||||||
* @param b The boolean to write.
|
|
||||||
*/
|
|
||||||
void writeBool(final boolean b);
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of the OdinMS Maple Story Server
|
|
||||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
|
||||||
Matthias Butz <matze@odinms.de>
|
|
||||||
Jan Christian Meyer <vimes@odinms.de>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as
|
|
||||||
published by the Free Software Foundation version 3 as published by
|
|
||||||
the Free Software Foundation. You may not use, modify or distribute
|
|
||||||
this program under any other version of the GNU Affero General Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package tools.data.output;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import tools.HexTool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a maplestory-packet little-endian stream of bytes.
|
|
||||||
*
|
|
||||||
* @author Frz
|
|
||||||
* @version 1.0
|
|
||||||
* @since Revision 352
|
|
||||||
*/
|
|
||||||
public class MaplePacketLittleEndianWriter extends GenericLittleEndianWriter {
|
|
||||||
private ByteArrayOutputStream baos;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor - initializes this stream with a default size.
|
|
||||||
*/
|
|
||||||
public MaplePacketLittleEndianWriter() {
|
|
||||||
this(32);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor - initializes this stream with size <code>size</code>.
|
|
||||||
*
|
|
||||||
* @param size The size of the underlying stream.
|
|
||||||
*/
|
|
||||||
public MaplePacketLittleEndianWriter(int size) {
|
|
||||||
this.baos = new ByteArrayOutputStream(size);
|
|
||||||
setByteOutputStream(new BAOSByteOutputStream(baos));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a <code>MaplePacket</code> instance representing this
|
|
||||||
* sequence of bytes.
|
|
||||||
*
|
|
||||||
* @return A <code>MaplePacket</code> with the bytes in this stream.
|
|
||||||
*/
|
|
||||||
public byte[] getPacket() {
|
|
||||||
return baos.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes this packet into a human-readable hexadecimal stream of bytes.
|
|
||||||
*
|
|
||||||
* @return This packet as hex digits.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return HexTool.toString(baos.toByteArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user