From e2a0558a0a6effca933090b9c78138ceeaeb3701 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 18 May 2015 00:11:24 +0200 Subject: [PATCH] - also generate static data file 'item-scaling' from dbc-data - updated some hardcoded item mods to build 12340 (needs to be fetched on setup) --- datasets/item-scaling | 176 ------------------ includes/types/item.class.php | 2 +- includes/utilities.php | 26 +-- setup/tools/clisetup/build.func.php | 28 ++- setup/tools/dbc.class.php | 8 +- setup/tools/fileGen.class.php | 2 +- setup/tools/filegen/itemScaling.func.php | 108 +++++++++++ setup/tools/filegen/templates/item-scaling.in | 18 +- setup/tools/sqlGen.class.php | 4 +- 9 files changed, 154 insertions(+), 218 deletions(-) delete mode 100644 datasets/item-scaling create mode 100644 setup/tools/filegen/itemScaling.func.php diff --git a/datasets/item-scaling b/datasets/item-scaling deleted file mode 100644 index 7ed756b8..00000000 --- a/datasets/item-scaling +++ /dev/null @@ -1,176 +0,0 @@ -$WH.g_convertRatingToPercent.RB = { - 12: 1.5, - 13: 12, - 14: 15, - 15: 5, - 16: 10, - 17: 10, - 18: 8, - 19: 14, - 20: 14, - 21: 14, - 22: 10, - 23: 10, - 24: 0, - 25: 0, - 26: 0, - 27: 0, - 28: 10, - 29: 10, - 30: 10, - 31: 10, - 32: 14, - 33: 0, - 34: 0, - 35: 25 * 1.15, - 36: 10, - 37: 2.5, - 44: 4.69512176513672 / 1.1 -}; - -$WH.g_convertScalingFactor.SV = { - 1: [ 2, 2, 1, 3, 1, 10, 32, 32, 64, 6, 8, 6, 8, 6, 8, 1, 0, 0, 1, 7, 13, 43, 43, 85], - 2: [ 3, 3, 1, 3, 1, 12, 35, 35, 70, 6, 9, 6, 9, 7, 9, 2, 0, 0, 2, 8, 16, 47, 47, 93], - 3: [ 3, 3, 1, 4, 1, 13, 39, 39, 76, 7, 9, 7, 9, 7, 10, 3, 0, 0, 2, 9, 17, 52, 52, 101], - 4: [ 3, 3, 1, 4, 1, 14, 42, 42, 83, 7, 10, 7, 10, 8, 11, 3, 0, 0, 2, 9, 19, 56, 56, 111], - 5: [ 4, 4, 2, 5, 2, 16, 45, 45, 89, 8, 10, 8, 10, 8, 12, 4, 0, 0, 3, 11, 21, 60, 60, 119], - 6: [ 4, 4, 2, 5, 2, 17, 48, 48, 95, 8, 11, 8, 11, 9, 12, 5, 0, 0, 3, 11, 23, 64, 64, 127], - 7: [ 4, 4, 3, 6, 2, 19, 51, 51, 101, 9, 11, 9, 11, 9, 13, 6, 0, 0, 3, 13, 25, 68, 68, 135], - 8: [ 5, 5, 3, 7, 2, 20, 54, 54, 107, 9, 12, 9, 12, 9, 14, 7, 0, 0, 4, 13, 27, 72, 72, 143], - 9: [ 5, 5, 3, 7, 2, 22, 56, 56, 113, 10, 13, 10, 13, 10, 15, 7, 0, 0, 4, 15, 29, 75, 75, 151], - 10: [ 6, 6, 3, 8, 2, 23, 57, 57, 119, 10, 13, 10, 13, 10, 16, 8, 0, 0, 4, 15, 31, 76, 76, 159], - 11: [ 6, 6, 4, 8, 3, 24, 59, 59, 125, 11, 14, 11, 14, 11, 16, 9, 0, 0, 5, 16, 32, 79, 79, 167], - 12: [ 7, 7, 4, 9, 3, 25, 60, 60, 131, 11, 15, 11, 15, 12, 17, 10, 0, 0, 5, 17, 33, 80, 80, 175], - 13: [ 7, 7, 4, 9, 3, 26, 61, 61, 133, 12, 16, 12, 16, 12, 18, 10, 0, 0, 5, 17, 35, 81, 81, 177], - 14: [ 8, 8, 4, 10, 3, 27, 63, 63, 136, 12, 16, 12, 16, 13, 19, 11, 0, 0, 6, 18, 36, 84, 84, 181], - 15: [ 8, 8, 5, 11, 3, 28, 64, 64, 138, 13, 17, 13, 17, 13, 20, 12, 0, 0, 6, 19, 37, 85, 85, 184], - 16: [ 8, 8, 5, 11, 4, 29, 65, 65, 141, 14, 18, 14, 18, 14, 21, 13, 0, 0, 6, 19, 39, 87, 87, 188], - 17: [ 9, 9, 5, 12, 4, 30, 67, 67, 143, 14, 19, 14, 19, 14, 22, 14, 0, 0, 7, 20, 40, 89, 89, 191], - 18: [ 9, 9, 5, 12, 4, 30, 68, 68, 146, 15, 19, 15, 19, 15, 23, 14, 0, 0, 7, 20, 40, 91, 91, 195], - 19: [10, 10, 6, 13, 4, 31, 69, 69, 148, 15, 20, 15, 20, 15, 24, 15, 0, 0, 7, 21, 41, 92, 92, 197], - 20: [10, 10, 6, 14, 4, 32, 71, 71, 151, 16, 21, 16, 21, 16, 25, 16, 0, 0, 8, 21, 43, 95, 95, 201], - 21: [11, 11, 6, 14, 5, 33, 72, 72, 153, 16, 21, 16, 21, 16, 26, 17, 0, 0, 8, 22, 44, 96, 96, 204], - 22: [11, 11, 6, 15, 5, 34, 73, 73, 156, 17, 22, 17, 22, 17, 27, 18, 0, 0, 8, 23, 45, 97, 97, 208], - 23: [12, 12, 7, 15, 5, 34, 75, 75, 158, 17, 23, 17, 23, 17, 28, 18, 0, 0, 9, 23, 45, 100, 100, 211], - 24: [12, 12, 7, 16, 5, 35, 76, 76, 161, 18, 23, 18, 23, 18, 29, 19, 0, 0, 9, 23, 47, 101, 101, 215], - 25: [12, 12, 7, 17, 5, 35, 77, 77, 163, 19, 24, 19, 24, 19, 29, 20, 0, 0, 9, 23, 47, 103, 103, 217], - 26: [13, 13, 7, 17, 5, 36, 78, 78, 166, 19, 25, 19, 25, 19, 30, 21, 0, 0, 10, 24, 48, 104, 104, 221], - 27: [13, 13, 8, 18, 6, 37, 80, 80, 168, 20, 26, 20, 26, 20, 31, 22, 0, 0, 10, 25, 49, 107, 107, 224], - 28: [14, 14, 8, 18, 6, 37, 81, 81, 171, 21, 27, 21, 27, 21, 32, 22, 0, 0, 10, 25, 49, 108, 108, 228], - 29: [14, 14, 8, 19, 6, 38, 82, 82, 173, 22, 29, 22, 29, 22, 32, 23, 0, 0, 11, 25, 51, 109, 109, 231], - 30: [15, 15, 8, 20, 6, 38, 84, 84, 176, 23, 30, 23, 30, 22, 33, 24, 0, 0, 11, 25, 51, 112, 112, 235], - 31: [15, 15, 9, 20, 6, 39, 85, 85, 178, 24, 31, 24, 31, 23, 34, 25, 0, 0, 11, 26, 52, 113, 113, 237], - 32: [16, 16, 9, 21, 7, 40, 86, 86, 181, 25, 32, 25, 32, 24, 34, 25, 0, 0, 12, 27, 53, 115, 115, 241], - 33: [16, 16, 9, 21, 7, 41, 88, 88, 184, 25, 33, 25, 33, 25, 35, 26, 0, 0, 12, 27, 55, 117, 117, 245], - 34: [16, 16, 9, 22, 7, 43, 90, 90, 187, 26, 34, 26, 34, 26, 36, 27, 0, 0, 12, 29, 57, 120, 120, 249], - 35: [17, 17, 10, 23, 7, 44, 91, 91, 190, 27, 35, 27, 35, 26, 37, 28, 0, 0, 13, 29, 59, 121, 121, 253], - 36: [17, 17, 10, 23, 7, 44, 93, 93, 193, 28, 36, 28, 36, 27, 38, 29, 0, 0, 13, 29, 59, 124, 124, 257], - 37: [18, 18, 10, 24, 8, 46, 95, 95, 196, 28, 37, 28, 37, 28, 39, 29, 0, 0, 13, 31, 61, 127, 127, 261], - 38: [18, 18, 10, 24, 8, 47, 97, 97, 199, 29, 38, 29, 38, 28, 40, 30, 0, 0, 14, 31, 63, 129, 129, 265], - 39: [19, 19, 11, 25, 8, 48, 99, 99, 202, 29, 38, 29, 38, 29, 41, 31, 0, 0, 14, 32, 64, 132, 132, 269], - 40: [19, 19, 11, 26, 8, 49, 100, 205, 360, 30, 39, 30, 39, 30, 42, 32, 0, 0, 14, 33, 65, 133, 273, 480], - 41: [20, 20, 11, 26, 8, 50, 102, 209, 368, 31, 40, 31, 40, 30, 43, 33, 0, 0, 15, 33, 67, 136, 279, 491], - 42: [20, 20, 11, 27, 8, 51, 104, 213, 375, 31, 41, 31, 41, 31, 44, 33, 0, 0, 15, 34, 68, 139, 284, 500], - 43: [20, 20, 12, 27, 9, 52, 106, 217, 382, 32, 41, 32, 41, 31, 45, 34, 0, 0, 15, 35, 69, 141, 289, 509], - 44: [21, 21, 12, 28, 9, 53, 108, 221, 389, 32, 42, 32, 42, 32, 47, 35, 0, 0, 16, 35, 71, 144, 295, 519], - 45: [21, 21, 12, 28, 9, 54, 109, 225, 396, 33, 43, 33, 43, 33, 48, 36, 0, 0, 16, 36, 72, 145, 300, 528], - 46: [22, 22, 12, 29, 9, 55, 111, 229, 403, 34, 44, 34, 44, 33, 50, 37, 0, 0, 16, 37, 73, 148, 305, 537], - 47: [22, 22, 13, 30, 9, 56, 113, 233, 410, 34, 45, 34, 45, 34, 51, 37, 0, 0, 17, 37, 75, 151, 311, 547], - 48: [23, 23, 13, 30, 10, 57, 115, 238, 418, 35, 45, 35, 45, 34, 52, 38, 0, 0, 17, 38, 76, 153, 317, 557], - 49: [23, 23, 13, 31, 10, 58, 117, 242, 425, 35, 46, 35, 46, 35, 53, 39, 0, 0, 17, 39, 77, 156, 323, 567], - 50: [24, 24, 13, 31, 10, 59, 118, 246, 433, 36, 47, 36, 47, 36, 54, 40, 0, 0, 18, 39, 79, 157, 328, 577], - 51: [24, 24, 14, 32, 10, 60, 120, 250, 440, 37, 48, 37, 48, 36, 54, 40, 0, 0, 18, 40, 80, 160, 333, 587], - 52: [24, 24, 14, 33, 10, 61, 122, 254, 448, 37, 49, 37, 49, 37, 55, 41, 0, 0, 18, 41, 81, 163, 339, 597], - 53: [25, 25, 14, 33, 11, 62, 124, 258, 455, 38, 49, 38, 49, 38, 57, 42, 0, 0, 19, 41, 83, 165, 344, 607], - 54: [25, 25, 14, 34, 11, 63, 126, 262, 463, 38, 50, 38, 50, 38, 58, 43, 0, 0, 19, 42, 84, 168, 349, 617], - 55: [26, 26, 15, 34, 11, 64, 127, 266, 470, 39, 51, 39, 51, 39, 59, 44, 0, 0, 19, 43, 85, 169, 355, 627], - 56: [26, 26, 15, 35, 11, 65, 129, 270, 478, 40, 52, 40, 52, 39, 61, 44, 0, 0, 20, 43, 87, 172, 360, 637], - 57: [27, 27, 15, 36, 11, 66, 131, 274, 485, 40, 53, 40, 53, 40, 62, 45, 0, 0, 20, 44, 88, 175, 365, 647], - 58: [34, 34, 19, 46, 14, 83, 159, 344, 611, 50, 65, 46, 60, 48, 85, 46, 0, 0, 25, 55, 111, 212, 459, 815], - 59: [36, 36, 20, 47, 15, 86, 164, 356, 633, 51, 67, 47, 61, 50, 88, 52, 0, 0, 27, 57, 115, 219, 475, 844], - 60: [37, 37, 21, 49, 16, 88, 169, 368, 655, 53, 68, 47, 62, 51, 91, 57, 0, 0, 28, 59, 117, 225, 491, 873], - 61: [39, 39, 22, 51, 16, 91, 174, 380, 677, 54, 70, 48, 63, 52, 94, 63, 0, 0, 29, 61, 121, 232, 507, 903], - 62: [40, 40, 22, 53, 17, 94, 178, 392, 699, 55, 72, 49, 64, 53, 97, 68, 0, 0, 30, 63, 125, 237, 523, 932], - 63: [41, 41, 23, 54, 17, 97, 183, 404, 721, 56, 73, 50, 65, 54, 100, 73, 0, 0, 31, 65, 129, 244, 539, 961], - 64: [42, 42, 24, 55, 18, 100, 187, 416, 742, 58, 75, 50, 66, 55, 104, 80, 0, 0, 31, 67, 133, 249, 555, 989], - 65: [43, 43, 24, 57, 18, 102, 192, 428, 764, 60, 78, 52, 67, 57, 109, 89, 0, 0, 32, 68, 136, 256, 571, 1019], - 66: [44, 44, 25, 58, 18, 105, 197, 440, 786, 62, 81, 53, 69, 59, 113, 98, 0, 0, 33, 70, 140, 263, 587, 1048], - 67: [45, 45, 25, 59, 19, 108, 203, 452, 808, 65, 84, 54, 71, 61, 117, 107, 0, 0, 34, 72, 144, 271, 603, 1077], - 68: [62, 62, 36, 84, 26, 157, 294, 654, 1169, 91, 119, 70, 91, 82, 168, 220, 0, 0, 47, 105, 209, 392, 872, 1559], - 69: [64, 64, 37, 87, 27, 161, 303, 675, 1206, 93, 121, 71, 92, 84, 172, 228, 0, 0, 48, 107, 215, 404, 900, 1608], - 70: [67, 67, 39, 90, 28, 166, 312, 695, 1242, 95, 124, 72, 94, 86, 175, 238, 0, 0, 50, 111, 221, 416, 927, 1656], - 71: [69, 69, 40, 93, 29, 171, 321, 715, 1278, 97, 127, 73, 95, 88, 179, 246, 0, 0, 52, 114, 228, 428, 953, 1704], - 72: [72, 72, 42, 97, 30, 176, 331, 736, 1315, 99, 129, 75, 97, 90, 183, 255, 0, 0, 54, 117, 235, 441, 981, 1753], - 73: [75, 75, 43, 101, 32, 181, 340, 756, 1351, 102, 132, 76, 99, 92, 187, 265, 0, 0, 56, 121, 241, 453, 1008, 1801], - 74: [78, 78, 45, 104, 33, 186, 349, 776, 1387, 104, 135, 77, 100, 94, 191, 275, 0, 0, 58, 124, 248, 465, 1035, 1849], - 75: [81, 81, 46, 108, 34, 191, 358, 797, 1423, 106, 138, 79, 102, 96, 196, 285, 0, 0, 60, 127, 255, 477, 1063, 1897], - 76: [84, 84, 48, 113, 35, 196, 367, 817, 1460, 109, 141, 80, 104, 98, 200, 296, 0, 0, 63, 131, 261, 489, 1089, 1947], - 77: [87, 87, 50, 117, 37, 200, 376, 837, 1496, 111, 145, 81, 106, 101, 205, 307, 0, 0, 65, 133, 267, 501, 1116, 1995], - 78: [90, 90, 52, 121, 38, 205, 386, 858, 1532, 114, 148, 83, 108, 103, 210, 319, 0, 0, 68, 137, 273, 515, 1144, 2043], - 79: [94, 94, 54, 126, 40, 208, 390, 868, 1551, 117, 152, 85, 110, 105, 215, 331, 0, 0, 71, 139, 277, 520, 1157, 2068], - 80: [97, 97, 56, 131, 41, 210, 395, 878, 1570, 120, 156, 86, 112, 108, 220, 343, 0, 0, 73, 140, 280, 527, 1171, 2093] -}; - -$WH.g_convertScalingFactor.SD = { - 1: [ 4, 7, 32, -1, -1, -1, -1, -1, -1, -1, 5259, 7888, 5259, 0, 0, 0, 0, 0, 0, 0, 80], - 2: [38, 3, 31, -1, -1, -1, -1, -1, -1, -1, 14532, 4106, 3193, 0, 0, 0, 0, 0, 0, 0, 80], - 3: [38, 7, 32, -1, -1, -1, -1, -1, -1, -1, 5068, 5065, 6666, 0, 0, 0, 0, 0, 0, 0, 80], - 4: [38, 32, 31, -1, -1, -1, -1, -1, -1, -1, 13332, 4767, 3900, 0, 0, 0, 0, 0, 0, 0, 80], - 5: [ 7, 5, 32, -1, -1, -1, -1, -1, -1, -1, 7150, 5850, 4766, 0, 0, 0, 0, 0, 0, 0, 80], - 6: [ 7, 5, 43, -1, -1, -1, -1, -1, -1, -1, 5067, 7601, 1350, 0, 0, 0, 0, 0, 0, 0, 80], - 7: [ 4, 7, 32, -1, -1, -1, -1, -1, -1, -1, 6666, 6666, 4445, 0, 0, 0, 0, 0, 0, 0, 80], - 8: [38, 3, 7, 5, -1, -1, -1, -1, -1, -1, 10518, 5258, 5641, 3076, 0, 0, 0, 0, 0, 0, 80], - 9: [45, 7, 5, 43, -1, -1, -1, -1, -1, -1, 5201, 6666, 4444, 1778, 0, 0, 0, 0, 0, 0, 80], - 10: [38, 31, 7, -1, -1, -1, -1, -1, -1, -1, 14532, 4106, 4789, 0, 0, 0, 0, 0, 0, 0, 80], - 11: [45, 7, 5, 6, -1, -1, -1, -1, -1, -1, 6153, 3996, 3997, 5258, 0, 0, 0, 0, 0, 0, 80], - 12: [ 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 5000, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 10], - 13: [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], - 14: [38, 39, 40, 41, 42, 43, 0, 0, 0, 0, 6500, 6500, 10000, 10000, 10000, 10000, 0, 0, 0, 0, 15], - 15: [40, 41, 42, 0, 0, 0, 0, 0, 0, 0, 4200, 5200, 6200, 0, 0, 0, 0, 0, 0, 0, 10], - 16: [45, 7, 5, 6, -1, -1, -1, -1, -1, -1, 6153, 3996, 3997, 5258, 0, 0, 0, 0, 0, 0, 80], - 21: [12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 5000, 6000, 7000, 8000, 9000, 0, 0, 0, 0, 0, 10], - 41: [ 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10], - 42: [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10], - 43: [27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10], - 102: [44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15], - 103: [ 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - 104: [32, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 105: [13, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - 221: [ 4, 7, 32, 36, -1, -1, -1, -1, -1, -1, 4844, 7266, 4106, 3193, 0, 0, 0, 0, 0, 0, 80], - 222: [ 3, 44, 7, -1, -1, -1, -1, -1, -1, -1, 5259, 3506, 5259, 0, 0, 0, 0, 0, 0, 0, 80], - 223: [ 7, 5, 32, -1, -1, -1, -1, -1, -1, -1, 4859, 5732, 2519, 0, 0, 0, 0, 0, 0, 0, 80], - 224: [38, 3, 31, 7, -1, -1, -1, -1, -1, -1, 9688, 4844, 3193, 6159, 0, 0, 0, 0, 0, 0, 80], - 241: [45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 251: [36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 271: [45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 291: [38, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - 292: [38, 7, 35, -1, -1, -1, -1, -1, -1, -1, 10518, 7888, 5258, 0, 0, 0, 0, 0, 0, 0, 80], - 293: [ 4, 7, 35, -1, -1, -1, -1, -1, -1, -1, 7266, 4789, 4106, 0, 0, 0, 0, 0, 0, 0, 80], - 294: [38, 32, 35, -1, -1, -1, -1, -1, -1, -1, 8212, 7266, 3193, 0, 0, 0, 0, 0, 0, 0, 80], - 295: [ 7, 35, 43, -1, -1, -1, -1, -1, -1, -1, 6666, 6666, 1777, 0, 0, 0, 0, 0, 0, 0, 80], - 296: [ 7, 31, 35, -1, -1, -1, -1, -1, -1, -1, 7888, 5259, 5258, 0, 0, 0, 0, 0, 0, 0, 80], - 297: [35, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 298: [35, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 299: [35, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80], - 300: [ 4, 7, 35, -1, -1, -1, -1, -1, -1, -1, 5259, 7888, 5258, 0, 0, 0, 0, 0, 0, 0, 80], - 301: [45, 7, 43, 35, -1, -1, -1, -1, -1, -1, 5200, 6666, 1776, 4444, 0, 0, 0, 0, 0, 0, 80], - 302: [38, 3, 7, 35, -1, -1, -1, -1, -1, -1, 8888, 4444, 6668, 4444, 0, 0, 0, 0, 0, 0, 80], - 303: [45, 7, 5, 35, -1, -1, -1, -1, -1, -1, 6153, 5259, 3506, 5258, 0, 0, 0, 0, 0, 0, 80], - 304: [38, 3, 7, 35, -1, -1, -1, -1, -1, -1, 8888, 3899, 6666, 4767, 0, 0, 0, 0, 0, 0, 80], - 305: [45, 7, 6, 35, -1, -1, -1, -1, -1, -1, 6153, 5259, 3506, 5258, 0, 0, 0, 0, 0, 0, 80], - 306: [45, 7, 32, 35, -1, -1, -1, -1, -1, -1, 6153, 5259, 3506, 5258, 0, 0, 0, 0, 0, 0, 80], - 311: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - 331: [38, 3, 7, 5, -1, -1, -1, -1, -1, -1, 10518, 5258, 5259, 3506, 0, 0, 0, 0, 0, 0, 80], - 332: [45, 7, 5, 43, -1, -1, -1, -1, -1, -1, 6153, 3997, 3997, 2629, 0, 0, 0, 0, 0, 0, 80], - 333: [ 4, 7, 32, -1, -1, -1, -1, -1, -1, -1, 5996, 5996, 5258, 0, 0, 0, 0, 0, 0, 0, 80], - 334: [45, 7, 5, 6, -1, -1, -1, -1, -1, -1, 6153, 3997, 3997, 5259, 0, 0, 0, 0, 0, 0, 80], - 335: [38, 7, 31, -1, -1, -1, -1, -1, -1, -1, 10518, 7888, 5259, 0, 0, 0, 0, 0, 0, 0, 80], - 336: [45, 7, 5, 6, -1, -1, -1, -1, -1, -1, 6153, 3997, 3997, 5259, 0, 0, 0, 0, 0, 0, 80], - 351: [ 3, 38, 7, 32, -1, -1, -1, -1, -1, -1, 5259, 7012, 7889, 3506, 0, 0, 0, 0, 0, 0, 80], - 352: [ 3, 44, 7, 38, -1, -1, -1, -1, -1, -1, 5259, 3506, 7889, 7012, 0, 0, 0, 0, 0, 0, 80], - 371: [32, 31, 7, -1, -1, -1, -1, -1, -1, -1, 7266, 4106, 4789, 0, 0, 0, 0, 0, 0, 0, 80] -}; - -if ($WH.isset('$WowheadPower')) { - $WowheadPower.loadScales(3); -} diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 2f35f74b..5a89add7 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -1321,7 +1321,7 @@ class ItemList extends BaseType if ($mask & (1 << $i)) $field = Util::$ssdMaskFields[$i]; - return $field ? DB::Aowow()->selectCell("SELECT ?# FROM ?_scalingstatvalues WHERE charLevel = ?", $field, $this->ssd[$this->id]['maxLevel']) : 0; + return $field ? DB::Aowow()->selectCell("SELECT ?# FROM ?_scalingstatvalues WHERE id = ?", $field, $this->ssd[$this->id]['maxLevel']) : 0; } private function initScalingStats() diff --git a/includes/utilities.php b/includes/utilities.php index 17897e30..0ac95697 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -48,17 +48,14 @@ class Util public static $combatRatingToItemMod = array( // zero-indexed idx:CR; val:Mod null, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, null, null, null, null, null, null, 28, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, null, null, null, 37, 44 ); - /* manual corrections - idx:35 => 25*1.15 => 28.75 strange, this was not mentioned anywhere - idx:44 => 4,69512176513672/1.1 => 4,268292513760655 see: gtOCTclasscombatRatingScalar.dbc (also reflects changes to haste (+30% for sham, drui, ect)) - */ + # todo (high): find a sensible way to write data here on setup public static $gtCombatRatings = array( - 12 => 1.5, 13 => 12, 14 => 15, 15 => 5, 16 => 10, 17 => 10, 18 => 8, 19 => 14, 20 => 14, - 21 => 14, 22 => 10, 23 => 10, 24 => 0, 25 => 0, 26 => 0, 27 => 0, 28 => 10, 29 => 10, + 12 => 1.5, 13 => 13.8, 14 => 13.8, 15 => 5, 16 => 10, 17 => 10, 18 => 8, 19 => 14, 20 => 14, + 21 => 14, 22 => 10, 23 => 10, 24 => 8, 25 => 0, 26 => 0, 27 => 0, 28 => 10, 29 => 10, 30 => 10, 31 => 10, 32 => 14, 33 => 0, 34 => 0, 35 => 28.75, 36 => 10, 37 => 2.5, 44 => 4.268292513760655 ); @@ -1020,26 +1017,17 @@ class Util )); } + // default back to enUS if localization unavailable public static function localizedString($data, $field, $silent = false) { - // default back to enUS if localization unavailable - // default case: selected locale available if (!empty($data[$field.'_loc'.User::$localeId])) return $data[$field.'_loc'.User::$localeId]; // locale not enUS; aowow-type localization available; add brackets if not silent - else if (User::$localeId != LOCALE_EN && isset($data[$field.'_loc0']) && !empty($data[$field.'_loc0'])) + else if (User::$localeId != LOCALE_EN && !empty($data[$field.'_loc0'])) return $silent ? $data[$field.'_loc0'] : '['.$data[$field.'_loc0'].']'; - // OBSOLETE - locale not enUS; TC localization; add brackets if not silent - else if (User::$localeId != LOCALE_EN && isset($data[$field]) && !empty($data[$field])) - return $silent ? $data[$field] : '['.$data[$field].']'; - - // OBSOLETE - locale enUS; TC localization; return normal - else if (User::$localeId == LOCALE_EN && isset($data[$field]) && !empty($data[$field])) - return $data[$field]; - // nothing to find; be empty else return ''; @@ -1048,7 +1036,7 @@ class Util // for item and spells public static function setRatingLevel($level, $type, $val) { - if (in_array($type, [ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_PARRY_RATING, ITEM_MOD_BLOCK_RATING]) && $level < 34) + if (in_array($type, [ITEM_MOD_DEFENSE_SKILL_RATING, ITEM_MOD_DODGE_RATING, ITEM_MOD_PARRY_RATING, ITEM_MOD_BLOCK_RATING, ITEM_MOD_RESILIENCE_RATING]) && $level < 34) $level = 34; if (!isset(Util::$gtCombatRatings[$type])) diff --git a/setup/tools/clisetup/build.func.php b/setup/tools/clisetup/build.func.php index 941c6553..f4a0f2b2 100644 --- a/setup/tools/clisetup/build.func.php +++ b/setup/tools/clisetup/build.func.php @@ -28,6 +28,8 @@ function build() // files with template foreach (FileGen::$tplFiles as $name => list($file, $destPath, $deps)) { + $reqDBC = []; + if (!in_array($name, FileGen::$subScripts)) continue; @@ -38,6 +40,15 @@ function build() continue; } + if (file_exists('setup/tools/filegen/'.$name.'.func.php')) + require_once 'setup/tools/filegen/'.$name.'.func.php'; + else + { + CLISetup::log(sprintf(ERR_MISSING_INCL, $name, 'setup/tools/filegen/'.$name.'.func.php'), CLISetup::LOG_ERROR); + $allOk = false; + continue; + } + if (!CLISetup::writeDir($destPath)) continue; @@ -49,21 +60,22 @@ function build() // replace constants $content = strtr($content, FileGen::$txtConstants); + // check for required auxiliary DBC files + foreach ($reqDBC as $req) + if (!CLISetup::loadDBC($req)) + continue 2; + // must generate content // PH format: /*setup:*/ - if (preg_match('/\/\*setup:([\w\d_-]+)\*\//i', $content, $m)) + if (preg_match_all('/\/\*setup:([\w\-_]+)\*\//i', $content, $m)) { - $content = ''; - if (file_exists('setup/tools/filegen/'.$m[1].'.func.php')) + foreach ($m[1] as $func) { - require_once 'setup/tools/filegen/'.$m[1].'.func.php'; - if (function_exists($m[1])) - $content = str_replace('/*setup:'.$m[1].'*/', $m[1](), $content); + if (function_exists($func)) + $content = str_replace('/*setup:'.$func.'*/', $func(), $content); else CLISetup::log('Placeholder in template file does not match any known function name.', CLISetup::LOG_ERROR); } - else - CLISetup::log(sprintf(ERR_MISSING_INCL, $m[1], 'setup/tools/filegen/'.$m[1].'.func.php'), CLISetup::LOG_ERROR); } if (fWrite($dest, $content)) diff --git a/setup/tools/dbc.class.php b/setup/tools/dbc.class.php index ad4170c1..ba2274a1 100644 --- a/setup/tools/dbc.class.php +++ b/setup/tools/dbc.class.php @@ -66,6 +66,8 @@ class DBC 'gtchancetomeleecritbase' => 'f', 'gtchancetospellcrit' => 'f', 'gtchancetospellcritbase' => 'f', + 'gtcombatratings' => 'f', + 'gtoctclasscombatratingscalar' => 'nf', 'gtoctregenhp' => 'f', 'gtregenmpperspt' => 'f', 'gtregenhpperspt' => 'f', @@ -88,7 +90,7 @@ class DBC 'questxp' => 'niiiiiiiiii', 'randproppoints' => 'niiiiiiiiiiiiiii', 'scalingstatdistribution' => 'niiiiiiiiiiiiiiiiiiiii', - 'scalingstatvalues' => 'niiiiiiiiiiiiiiiiiiiiiii', + 'scalingstatvalues' => 'xniiiiiiiiiiiiiiiiiiiiii', 'skillline' => 'nixsxssxxsxsxxxxxxxxsxssxxsxsxxxxxxxxixxxxxxxxxxxxxxxxxx', 'skilllineability' => 'niiiixxixiiixx', 'skillraceclassinfo' => 'niiiiixx', @@ -143,6 +145,8 @@ class DBC 'gtchancetomeleecritbase' => 'chance', 'gtchancetospellcrit' => 'chance', 'gtchancetospellcritbase' => 'chance', + 'gtcombatratings' => 'ratio', + 'gtoctclasscombatratingscalar' => 'idx,ratio', 'gtoctregenhp' => 'ratio', 'gtregenmpperspt' => 'ratio', 'gtregenhpperspt' => 'ratio', @@ -165,7 +169,7 @@ class DBC 'questxp' => 'Id,field1,field2,field3,field4,field5,field6,field7,field8,field9,field10', 'randproppoints' => 'Id,epic1,epic2,epic3,epic4,epic5,rare1,rare2,rare3,rare4,rare5,uncommon1,uncommon2,uncommon3,uncommon4,uncommon5', 'scalingstatdistribution' => 'Id,statMod1,statMod2,statMod3,statMod4,statMod5,statMod6,statMod7,statMod8,statMod9,statMod10,modifier1,modifier2,modifier3,modifier4,modifier5,modifier6,modifier7,modifier8,modifier9,modifier10,maxLevel', - 'scalingstatvalues' => 'Id,charLevel,shoulderMultiplier,trinketMultiplier,weaponMultiplier,rangedMultiplier,clothShoulderArmor,leatherShoulderArmor,mailShoulderArmor,plateShoulderArmor,weaponDPS1H,weaponDPS2H,casterDPS1H,casterDPS2H,rangedDPS,wandDPS,spellPower,primBudged,tertBudged,clothCloakArmor,clothChestArmor,leatherChestArmor,mailChestArmor,plateChestArmor', + 'scalingstatvalues' => 'Id,shoulderMultiplier,trinketMultiplier,weaponMultiplier,rangedMultiplier,clothShoulderArmor,leatherShoulderArmor,mailShoulderArmor,plateShoulderArmor,weaponDPS1H,weaponDPS2H,casterDPS1H,casterDPS2H,rangedDPS,wandDPS,spellPower,primBudged,tertBudged,clothCloakArmor,clothChestArmor,leatherChestArmor,mailChestArmor,plateChestArmor', 'skillline' => 'Id,categoryId,name_loc0,name_loc2,name_loc3,name_loc6,name_loc8,description_loc0,description_loc2,description_loc3,description_loc6,description_loc8,iconId', 'skilllineability' => 'Id,skillLineId,spellId,reqRaceMask,reqClassMask,reqSkillLevel,acquireMethod,skillLevelGrey,skillLevelYellow', 'skillraceclassinfo' => 'Id,skillLine,raceMask,classMask,flags,reqLevel', diff --git a/setup/tools/fileGen.class.php b/setup/tools/fileGen.class.php index 88c93a16..236d410c 100644 --- a/setup/tools/fileGen.class.php +++ b/setup/tools/fileGen.class.php @@ -29,7 +29,7 @@ class FileGen 'searchboxBody' => ['searchbox.html', 'static/widgets/searchbox/', []], 'realmMenu' => ['profile_all.js', 'static/js/', ['realmlist']], 'locales' => ['locale.js', 'static/js/', []], - // 'itemScaling => ['item-scaling', 'datasets/', []], # provided 'as is', as dbc-content doesn't usualy change + 'itemScaling' => ['item-scaling', 'datasets/', []] ); public static $datasets = array( // name => [AowowDeps, TCDeps] 'realms' => [null, ['realmlist']], diff --git a/setup/tools/filegen/itemScaling.func.php b/setup/tools/filegen/itemScaling.func.php new file mode 100644 index 00000000..8ba3fbd2 --- /dev/null +++ b/setup/tools/filegen/itemScaling.func.php @@ -0,0 +1,108 @@ + $row) + { + foreach ($row as &$r) + $r = str_pad($r, 5, " ", STR_PAD_LEFT); + + $buff[] = str_pad($id, 7, " ", STR_PAD_LEFT).": [".implode(', ', $row)."]"; + } + + return "{\r\n".implode(",\r\n", $buff)."\r\n}"; + } + + function itemScalingRB() + { + $ratings = array( + 12 => 1, // ITEM_MOD_DEFENSE_SKILL_RATING => CR_DEFENSE_SKILL + 13 => 2, // ITEM_MOD_DODGE_RATING => CR_DODGE + 14 => 3, // ITEM_MOD_PARRY_RATING => CR_PARRY + 15 => 4, // ITEM_MOD_BLOCK_RATING => CR_BLOCK + 16 => 5, // ITEM_MOD_HIT_MELEE_RATING => CR_HIT_MELEE + 17 => 6, // ITEM_MOD_HIT_RANGED_RATING => CR_HIT_RANGED + 18 => 7, // ITEM_MOD_HIT_SPELL_RATING => CR_HIT_SPELL + 19 => 8, // ITEM_MOD_CRIT_MELEE_RATING => CR_CRIT_MELEE + 20 => 9, // ITEM_MOD_CRIT_RANGED_RATING => CR_CRIT_RANGED + 21 => 10, // ITEM_MOD_CRIT_SPELL_RATING => CR_CRIT_SPELL + 22 => 11, // ITEM_MOD_HIT_TAKEN_MELEE_RATING => CR_HIT_TAKEN_MELEE + 23 => 12, // ITEM_MOD_HIT_TAKEN_RANGED_RATING => CR_HIT_TAKEN_RANGED + 24 => 13, // ITEM_MOD_HIT_TAKEN_SPELL_RATING => CR_HIT_TAKEN_SPELL + 25 => 14, // ITEM_MOD_CRIT_TAKEN_MELEE_RATING => CR_CRIT_TAKEN_MELEE [may be forced 0] + 26 => 15, // ITEM_MOD_CRIT_TAKEN_RANGED_RATING => CR_CRIT_TAKEN_RANGED [may be forced 0] + 27 => 16, // ITEM_MOD_CRIT_TAKEN_SPELL_RATING => CR_CRIT_TAKEN_SPELL [may be forced 0] + 28 => 17, // ITEM_MOD_HASTE_MELEE_RATING => CR_HASTE_MELEE + 29 => 18, // ITEM_MOD_HASTE_RANGED_RATING => CR_HASTE_RANGED + 30 => 19, // ITEM_MOD_HASTE_SPELL_RATING => CR_HASTE_SPELL + 31 => 5, // ITEM_MOD_HIT_RATING => [backRef] + 32 => 8, // ITEM_MOD_CRIT_RATING => [backRef] + 33 => 11, // ITEM_MOD_HIT_TAKEN_RATING => [backRef] [may be forced 0] + 34 => 14, // ITEM_MOD_CRIT_TAKEN_RATING => [backRef] [may be forced 0] + 35 => 14, // ITEM_MOD_RESILIENCE_RATING => [backRef] + 36 => 17, // ITEM_MOD_HASTE_RATING => [backRef] + 37 => 23, // ITEM_MOD_EXPERTISE_RATING => CR_EXPERTISE + 44 => 24 // ITEM_MOD_ARMOR_PENETRATION_RATING => CR_ARMOR_PENETRATION + ); + + $data = $ratings; + + $offsets = array_map(function ($v) { // LookupEntry(cr*GT_MAX_LEVEL+level-1) + return abs($v) * 100 + 60 - 1; + }, $ratings); + $base = DB::Aowow()->selectCol('SELECT CAST((idx + 1 - 60) / 100 AS UNSIGNED) AS ARRAY_KEY, ratio FROM dbc_gtcombatratings WHERE idx IN (?a)', $offsets); + + $offsets = array_map(function ($v) { // LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1) + return (CLASS_WARRIOR - 1) * 32 + abs($v) + 1; + }, $ratings); + $mods = DB::Aowow()->selectCol('SELECT idx - 1 AS ARRAY_KEY, ratio FROM dbc_gtoctclasscombatratingscalar WHERE idx IN (?a)', $offsets); + + foreach ($data as $itemMod => &$val) + $val = CFG_DEBUG ? $base[$val].' / '.$mods[$val] : $base[$val] / $mods[$val]; + + if (!CFG_DEBUG) + return Util::toJSON($data); + + $buff = []; + foreach ($data as $k => $v) + $buff[] = $k.': '.$v; + + return "{\r\n ".implode(",\r\n ", $buff)."\r\n}"; + } + + function itemScalingSV() + { + $data = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_scalingstatvalues'); + foreach ($data as &$row) + { + $row = array_values($row); + array_splice($row, 0, 1); + } + + return CFG_DEBUG ? debugify($data) : Util::toJSON($data); + } + + function itemScalingSD() + { + $data = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_scalingstatdistribution'); + foreach ($data as &$row) + { + $row = array_values($row); + array_splice($row, 0, 1); + } + + return CFG_DEBUG ? debugify($data) : Util::toJSON($data); + } + +?> diff --git a/setup/tools/filegen/templates/item-scaling.in b/setup/tools/filegen/templates/item-scaling.in index 25ab3991..2a8591c0 100644 --- a/setup/tools/filegen/templates/item-scaling.in +++ b/setup/tools/filegen/templates/item-scaling.in @@ -1,9 +1,9 @@ -$WH.g_convertRatingToPercent.RB = {/*setup:gtCombatRatings*/}; - -$WH.g_convertScalingFactor.SV = {/*setup:scalingStatValues*/}; - -$WH.g_convertScalingFactor.SD = {/*setup:scalingStatDistribution*/}; - -if ($WH.isset('$WowheadPower')) { - $WowheadPower.loadScales(3); -} +$WH.g_convertRatingToPercent.RB = /*setup:itemScalingRB*/; + +$WH.g_convertScalingFactor.SV = /*setup:itemScalingSV*/; + +$WH.g_convertScalingFactor.SD = /*setup:itemScalingSD*/; + +if ($WH.isset('$WowheadPower')) { + $WowheadPower.loadScales(3); +} diff --git a/setup/tools/sqlGen.class.php b/setup/tools/sqlGen.class.php index 62668d11..30dcfeae 100644 --- a/setup/tools/sqlGen.class.php +++ b/setup/tools/sqlGen.class.php @@ -30,8 +30,8 @@ class SqlGen 'itemrandomproppoints' => ['randproppoints', false, null, null], 'lock' => ['lock', true, null, null], 'mailtemplate' => ['mailtemplate', false, null, null], - 'scalingstatdistribution' => ['scalingstatdistribution', false, null, null], - 'scalingstatvalues' => ['scalingstatvalues', false, null, null], + 'scalingstatdistribution' => ['scalingstatdistribution', true, null, null], + 'scalingstatvalues' => ['scalingstatvalues', true, null, null], 'spellfocusobject' => ['spellfocusobject', false, null, null], 'spellrange' => ['spellrange', false, null, null], 'spellvariables' => ['spelldescriptionvariables', false, null, null],