PHP 217
Untitled Guest on 10th January 2020 04:37:37 PM
  1. <?php
  2. ini_set('max_execution_time', 0);
  3. ini_set("memory_limit","999M");
  4. $ids = [7023,7025,7173,8150,8152,8156,13001,18001,18119,18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,18276,18280,18281,18282,18283,18284,18285,18286,18342,18344,18345,18346,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20013,20014,20015,20016,20017,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030,20031,20032,20033,20034,20035,20036,20038,20039,20040,20041,20042,20043,20044,20045,20046,20048,20049,20050,20051,20052,20054,20055,20057,20058,20059,20060,20061,20062,20063,20064,20066,20067,20068,20070,20072,20074,20075,20076,20077,20078,20079,20080,20081,20082,20083,20084,20085,20086,20087,20088,20089,20090,20093,20096,20098,20101,20103,20105,20106,20108,20120,20121,20130,20131,20132,20134,20135,20136,20137,20143,20144,20145,20146,20147,20153,20154,20155,20156,20157,20158,20160,20161,20168,20171,20176,20190,20191,20192,20193,20197,20198,20199,20200,20201,20202,20203,20204,20205,20206,20207,20208,20209,20210,20211,20213,20214,20215,20216,20217,20218,20219,20220,20221,20222,20223,20224,20225,20226,20227,20228,20229,20230,20231,20232,20233,20234,20235,20236,20237,20238,20239,20240,20241,20242,20243,20244,20245,20246,20248,20249,20250,20251,20252,20253,20254,20265,20266,20267,20268,20269,20270,20271,20291,20292,20307,20308,20310,20311,20312,20313,20314,20316,20317,20318,20319,20320,20321,20322,20323,20324,20325,20326,20327,20328,20329,20330,20331,20333,20335,20336,20338,20340,20341,20342,20343,20346,20348,20349,20350,20356,20357,20358,20359,20360,20363,20364,20365,20368,20369,20370,20374,20375,20379,20380,20381,20382,20385,20386,20387,20388,20389,20390,20392,20393,20400,20401,20402,20403,20410,20411,20415,20416,20418,20420,20421,20422,20423,20424,20425,20426,20427,20428,20429,20432,20433,20435,20436,20437,20438,20439,20442,20446,20447,20448,20449,20455,20456,20457,20458,20460,20466,20468,20469,20470,20471,20472,20473,20474,20475,20476,20477,20478,20479,20480,20481,20483,20487,20488,20489,20491,20494,20495,20496,20497,20498,20499,20500,20501,20502,20505,20506,20507,20508,20509,20510,20511,20514,20515,20517,20518,20521,20525,20526,20528,20529,20530,20531,20532,20533,20534,20535,20536,20537,20538,20539,20540,20541,20542,20543,20544,20545,20546,20547,20548,20549,20550,20551,20552,20553,20554,20555,20556,20557,20558,20559,20560,20561,20562,20563,20564,20565,20566,20567,20568,20569,20570,20571,20572,20573,20574,20575,20576,20577,20578,20579,20580,20581,20582,20583,20584,20585,20586,20587,20588,20589,20590,20591,20592,20593,20594,20595,20596,20597,20598,20599,20600,20601,20602,20603,20604,20605,20606,20607,20608,20609,20610,20611,20612,20613,20614,20615,20616,20617,20618,20619,20620,20621,20622,20623,20624,20625,20626,20627,20628,20629,20630,20631,20632,20633,20634,20635,20636,20637,20638,20639,20640,20641,20642,20643,20644,20645,20659,20660,20661,20662,20663,20664,20665,20666,20667,20668,20669,20670,20671,20672,20673,20674,20675,20676,20677,20678,20679,20680,20681,20682,20683,20684,20685,20686,20745,20747,20749,20751,20753,20755,20758,20761,20763,20767,20773,20775,20776,20777,20778,20779,20780,20781,20782,20783,20784,20785,20786,20787,20788,20789,20790,20791,20792,20793,20794,20795,20796,20797,20798,20799,20800,20801,20802,20803,20804,20805,20806,20807,20808,20809,20810,20811,20812,20813,20814,20815,20816,20817,20818,20819,20820,20821,20822,20823,20824,20825,20826,20827,20828,20829,20830,20832,20833,20835,20836,20839,20840,20841,20842,20843,20844,20845,20846,20847,20848,20849,20919,20920,20921,20922,20923,20924,20925,20926,20927,20930,20933,20935,20941,20944,20947,20950,20953,20956,20959,20963,20973,20974,20977,20980,20983,20986,20989,20991,20994,20996,20997,20998,20999,21000,21001,21002,21003,21004,21005,21006,21007,21008,21009,21010,21011,21012,21013,21014,21015,21016,21017,21018,21019,21020,21021,21022,21023,21024,21025,21026,21034,21035,21036,21037,21038,21061,21062,21063,21064,21065,21066,21067,21068,21069,21070,21072,21075,21078,21081,21084,21085,21086,21087,21088,21089,21090,21093,21094,21095,21096,21097,21098,21099,21100,21101,21102,21103,21104,21105,21106,21107,21108,21109,21110,21111,21112,21113,21114,21115,21116,21124,21125,21126,21127,21128,21129,21130,21132,21133,21134,21135,21136,21137,21138,21139,21140,21141,21142,21143,21144,21145,21146,21147,21148,21149,21150,21151,21152,21153,21154,21155,21156,21157,21158,21159,21160,21166,21167,21168,21169,21170,21171,21172,21173,21174,21175,21176,21177,21178,21179,21180,21181,21182,21187,21188,21189,21190,21191,21192,21193,21194,21195,21196,21197,21198,21199,21200,21201,21202,21203,21208,21209,21210,21211,21213,21214,21215,21217,21218,21219,21221,21222,21223,21224,21225,21226,21227,21236,21237,21238,21239,21240,21241,21242,21243,21244,21245,21246,21247,21248,21249,21250,21251,21252,21256,21261,21265,21266,21267,21268,21274,21275,21276,21277,21278,21279,21280,21281,21282,21283,21284,21285,21286,21287,21288,21289,21290,21291,21292,21293,21294,21295,21296,21297,21298,21299,21300,21301,21302,21303,21304,21305,21306,21307,21308,21309,21310,21311,21312,21314,21315,21316,21317,21318,21319,21320,21321,21322,21323,21324,21325,21326,21327,21328,21329,21330,21331,21332,21333,21334,21335,21336,21337,21338,21339,21340,21341,21342,21343,21345,21347,21350,21351,21352,21353,21354,21355,21356,21357,21358,21359,21360,21361,21362,21363,21364,21365,21366,21367,21368,21369,21371,21373,21376,21377,21378,21379,21380,21381,21382,21383,21384,21385,21386,21387,21388,21389,21390,21391,21392,21393,21394,21395,21396,21397,21398,21399,21400,21401,21402,21403,21404,21405,21406,21407,21408,21410,21411,21412,21413,21414,21415,21416,21417,21418,21420,21421,21424,21425,21426,21427,21428,21429,21430,21431,21432,21434,21438,21439,21440,21441,21442,21443,21444,21445,21446,21447,21448,21449,21450,21451,21470,21489,21508,21509,21510,21511,21512,21513,21514,21515,21516,21517,21520,21521,21522,21523,21524,21525,21526,21527,21529,21530,21531,21532,21533,21535,21536,21537,21539,21540,21541,21542,21543,21544,21547,21548,21549,21550,21551,21552,21553,21555,21556,21557,21559,21560,21561,21562,21563,21564,21565,21566,21567,21568,21569,21570,21571,21572,21573,21574,21576,21577,21578,21579,21580,21581,21582,21583,21585,21586,21587,21588,21589,21590,21591,21593,21594,21595,21596,21599,21604,21607,21610,21613,21616,21619,21622,21625,21628,21631,21634,21637,21638,21639,21640,21641,21642,21643,21644,21645,21646,21647,21648,21649,21650,21651,21652,21653,21654,21655,21656,21657,21797,21798,21799,21800,22001,22002,22003,22004,22005,22006,22007,22008,22009,22010,22011,22017,22018,22019,22020,22021,22022,22023,22024,22025,22026,22028,22029,22030,22031,22032,22033,22034,22035,22038,22039,22040,22041,22045,22046,22047,22048,22049,22050,22051,22052,22053,22054,22055,22056,22057,22058,22059,22060,22062,22063,22064,22065,22072,22074,22075,22076,22077,22079,22080,22081,22082,22083,22084,22085,22086,22087,22088,22089,22090,22092,22093,22094,22096,22097,22098,22105,22106,22107,22108,22109,22110,22111,22112,22113,22114,22115,22116,22117,22118,22119,22120,22121,22123,22124,22125,22126,22127,22128,22129,22132,22133,22134,22135,22136,22137,22138,22139,22140,22141,22142,22143,22144,22145,22146,22147,22149,22151,22152,22153,22154,22155,22156,22157,22158,22159,22160,22161,22162,22163,22164,22165,22166,22167,22168,22169,22170,22171,22172,22173,22174,22175,22176,22188,22189,22190,22194,22196,22199,22200,22203,22215,22216,22217,27003,27004,27005,27017,27022,27024,27030,27031,27036,27041,27054,27059,27060,27061,27062,27064,27065,27067,27068,27070,27077,27079,27093,27095,27096,27097,27098,27099,27100,27102,27103,27104,27105,27106,27107,27108,27110,27112,27113,27114,27116,27118,27139,27166,27185,27186,27187,27188,27199,27200,27214,27215,27216,27317,27321,27322,29004,29009,29010,29011,29012,29013,29015,29017,29018,29029,30001,30002,30003,30004,30005,30008,30009,30010,30014,30017,30019,30022,30026,30027,30028,30029,30030,30031,30032,30033,30034,30035,30036,30037,30039,30040,30041,30042,30043,30044,30045,30046,30047,30049,30051,30054,30055,30057,30058,30060,30061,30062,30063,30064,30065,30066,30067,30068,30069,30070,30071,30072,30073,30074,30075,30076,30078,30079,30081,30082,30083,30084,30085,30086,30087,30088,30090,30091,30092,30095,30097,30098,30103,30104,30105,30106,30107,30108,30109,30110,30111,30112,30113,30114,30115,30116,30117,30118,30119,30120,30121,30122,30123,30124,30125,30126,30128,30129,30130,30131,30132,30133,30135,30136,30137,30138,30139,30140,30141,30143,30144,30145,30147,30148,30149,30150,30151,30152,30153,30154,30155,30156,30157,30158,30171,30174,30175,30176,30178,30179,30180,30181,30182,30183,30184,30185,30186,30187,30188,30189,30190,30191,30192,30194,30195,30196,30197,30198,30199,30200,30201,30207,30208,30209,30210,30216,30217,30218,30219,30220,30221,30224,30230,30231,30232,30253,30254,30255,30256,30283,30288,30289,30290,30291,30293,30294,30297,30298,30300,30301,30305,30307,30311,30312,30313,30314,30315,30316,30317,30321,30322,30325,30326,30327,30328,30329,30330,30331,30332,30333,30334,30335,30336,30337,30338,30344,30345,30346,30347,30348,30349,30350,30354,30355,30356,30357,30358,30359,30360,30363,30368,30369,30370,30371,30373,30374,30375,30376,30377,30378,30379,30380,30381,30382,30383,30384,30385,30386,30387,30391,30400,30405,30406,30407,30408,30409,30410,30411,30412,30413,30414,30415,30417,30418,30419,30420,30421,30422,30423,30424,30426,30427,30428,30429,30430,30431,30432,30433,30434,30436,30437,30452,30458,30459,30460,30461,30462,30463,30464,30465,30466,30469,30471,30472,30473,30474,30475,30476,30477,30478,30483,30484,30485,30486,30487,30497,30498,30499,30500,30501,30502,30503,30504,30505,30506,30507,30508,30509,30510,30511,30512,30513,30514,30515,30518,30519,30523,30528,30529,30530,30531,30532,30533,30534,30535,30536,30541,30542,30543,30544,30545,30546,30547,30548,30554,30555,30557,30558,30559,30560,30561,30562,30563,30564,30565,30566,30567,30568,30569,30570,30571,30572,30573,30575,30577,30578,30579,30580,30581,30582,30583,30584,30590,30591,30592,30593,30594,30595,30596,30597,30600,30608,30609,30610,30611,30612,30614,30615,30616,30617,30618,30619,30621,30622,30623,30624,30625,30626,30627,30629,30630,30631,30632,30633,30634,30635,30636,30637,30638,30639,30640,30641,30642,30644,30645,30648,30649,30652,30653,30654,30657,30658,30659,30660,30661,30662,30663,30664,30665,30666,30667,30668,30669,30670,30672,30673,30674,30675,30676,30677,30678,30679,30680,30681,30682,30683,30684,30685,30686,30687,30688,30689,30690,30691,30692,30693,30694,30695,30696,30697,30698,30699,30700,30701,30702,30703,30704,30705,30706,30707,30708,30709,30710,30711,30712,30713,30714,30715,30716,30717,30718,30719,30720,30721,30722,30723,30724,30725,30726,30727,30728,30729,30730,30733,30736,30738,30746,30747,30748,30749,30750,30751,30752,30753,30754,30755,30756,30757,30758,30759,30761,30762,30763,30766,30829,30832,30833,30835,30836,30837,30838,30839,30840,30841,30842,30843,30844,30845,30846,30847,30849,30850,30851,30852,30853,30854,30855,30856,30857,30858,30859,30860,30861,30862,30863,30864,30865,30866,30867,30869,30870,30871,30872,30873,30874,30875,30876,30877,30879,30884,30885,30890,30891,30892,30893,30894,30895,30896,30897,30898,30900,30901,30902,30903,30904,30905,30906,30907,30908,30909,30910,30911,30912,30913,30914,30915,30916,30917,30918,30919,30920,30921,30922,30923,30924,30925,30926,30927,30929,30934,30935,30949,30950,30951,30952,30953,30954,30956,30958,30960,30961,30969,30970,30971,30973,30977,30978,30979,30980,30981,30995,31001,31002,31031,31032,31033,31034,31035,31036,31042,31043,31044,31045,31074,31095,31096,31097,31098,31099,31100,31102,31103,31104,31105,31106,31107,31108,31110,31111,31114,31115,31116,31117,31119,31120,31121,31122,31123,31125,31127,31128,31129,31130,31131,31137,31138,31139,31140,31141,31147,31148,31205,31208,31210,31225,31226,31256,31257,31258,31259,31260,31261,31262,31263,31266,31267,31268,31269,31270,31271,31272,31273,31274,31276,31277,31278,31279,31280,31281,31282,31283,31285,31286,31287,31288,31289,31290,31291,31292,31293,31294,31295,31296,31297,31298,31299,31300,31301,31302,31303,31304,31305,31306,31307,31309,31311,31312,31313,31314,31315,31316,31317,31318,31319,31321,31322,31323,31324,31325,31326,31327,31328,31329,31330,31331,31332,31333,31334,31335,31336,31337,31338,31339,31340,31341,31342,31343,31344,31345,31346,31347,31348,31349,31350,31351,31356,31357,31358,31359,31360,31361,31364,31365,31366,31367,31368,31369,31370,31371,31372,31373,31374,31375,31376,31377,31378,31379,31380,31381,31382,31383,31384,31385,31386,31387,31388,31389,31413,31414,31415,31416,31417,31418,31419,31420,31421,31422,31423,31424,31425,31426,31427,31428,31429,31430,31431,31432,31433,31434,31435,31436,31437,31438,31439,31440,31441,31442,31443,31444,31445,31453,31454,31488,31489,31490,31491,31492,31493,31494,31495,31496,31497,31498,31499,31500,31501,31502,31503,31504,31505,31506,31507,31508,31509,31510,31511,31512,31513,31514,31515,31516,31517,31518,31519,31521,31522,31523,31526,31527,31529,31530,31531,31532,31533,31534,31535,31537,31539,31540,31541,31542,31543,31544,31545,31546,31547,31548,31549,31550,31551,31552,31553,31554,31555,31556,31557,31558,31559,31560,31561,31562,31563,31564,31565,31566,31567,31568,31569,31570,31571,31572,31573,31574,31575,31576,31577,31578,31579,31580,31581,31582,31583,31584,31587,31589,31592,31594,31597,31600,31602,31603,31604,31605,31606,31608,31613,31614,31615,31616,31622,31623,31624,31626,31627,31628,31640,31641,31646,31647,31648,31649,31650,31651,31652,31653,31654,31655,31656,31657,31658,31659,31661,31662,31663,31664,31665,31666,31667,31668,31669,31670,31673,31674,31675,31676,31677,31678,31679,31680,31681,31682,31683,31686,31687,31688,31690,31691,31694,31696,31697,31698,31699,31705,31706,31707,31708,31709,31710,31711,31712,31742,31743,31744,31745,31746,31748,31751,31752,31755,31773,31843,31845,31848,31850,31851,31852,31853,31862,31865,31866,31867,31868,31869,31870,31871,31872,31873,31874,31875,31876,31877,31878,31879,31880,31881,31882,31883,31884,31885,31886,31887,31888,31889,31890,31891,31892,31893,31894,31895,31896,31897,31898,31899,31900,31901,31902,31903,31904,31905,31906,31907,31908,31909,31910,31911,31912,31913,31914,31915,31916,31917,31918,31919,31920,31921,31923,31924,31925,31926,31927,31928,31929,31930,31931,31932,31933,31934,31935,31936,31937,31938,31939,31940,31941,31942,31943,31944,31945,31946,31947,31948,31949,31950,31951,31952,31954,31955,31956,31957,31958,31959,31960,31961,31962,31963,31965,31966,31967,31968,31969,31970,31971,31972,31973,31974,31975,31976,31977,31978,31979,31980,31981,31982,31983,31984,31985,31986,31987,31988,31989,31990,31996,31997,32007,32009,32010,32015,32016,32017,32020,32023,32025,32026,32030,32032,32034,32035,32036,32037,32039,32040,32041,32042,32043,32044,32046,32047,32050,32052,32053,32054,32055,32057,32068,32069,32070,32072,32076,32090,32092,32093,32094,32095,32096,32097,32098,32106,32111,32112,32114,32115,32116,32117,32118,32122,35063,35095,35096,35097,35098,35099,35100,35101,35102,35104,35105,35137,35138,35139,35140,35141,35142,35143,35144,35146,35147,35179,35180,35181,35182,35183,35184,35185,35186,35188,35189,35221,35222,35223,35224,35225,35226,35227,35228,35232,35233,35266,35267,35268,35269,35270,35271,35272,35273,35274,35275,35276,35278,35279,35311,35312,35313,35314,35315,35316,35317,35318,35320,35322,35323,35355,35356,35357,35358,35359,35360,35361,35362,35363,35364,35365,35367,35382,35383,35384,35385,35386,35387,35388,35389,35390,35391,35392,35393,35394,35395,35396,35397,35398,35399,35400,35401,35402,35403,35404,35405,35406,35407,35417,35418,35419,35420,35421,35433,35434,35435,35436,35437,35438,35439,35441,35442,35443,35444,35445,35446,35447,35448,35449,35450,35451,35452,35453,35454,35455,35456,35457,35458,35459,35460,35461,35462,35463,35464,35465,35466,35467,35468,35469,35502,35503,35504,35505,35507,35508,35509,35510,35511,35513,35514,35515,35544,35545,35547,35548,35549,35550,35553,35554,35555,35556,35557,35559,35566,35567,35568,35569,35570,35571,35572,35573,35574,35575,35576,35577,35578,35579,35580,35581,35582,35583,35584,35585,35586,35587,35601,35602,35603,35604,35605,35638,35639,35640,35641,35642,35648,35649,35650,35651,35652,35653,35654,35655,35656,35800,35801,35802,35804,35805,35806,35809,35810,35811,35813,35818,35822,35823,35850,35851,35852,35853,35854,35855,35856,35857,35858,35859,35860,35861,35862];
  5. $contents = file_get_contents('gold/npcs.xml');
  6. $xml = simplexml_load_string($contents);
  7. $json = json_encode($xml);
  8. $array = json_decode($json,TRUE);
  9. $fw = "";
  10. //print_r($array["npc"][0]['@attributes']['id']); // npc id
  11. $drops = array();
  12. foreach($array["npc"] as $key => $item){
  13.         //&& in_array($array["npc"][$key]['@attributes']['id'],$ids)
  14.         if(isset($item['drops']) && in_array($array["npc"][$key]['@attributes']['id'],$ids)){
  15.                
  16.                 //$fw = file_get_contents("saved.txt");
  17.                 $fw=$fw."\n \n";
  18.                 $fw=$fw."Npc id: ".$array["npc"][$key]['@attributes']['id'];
  19.                 $fw=$fw."\n";
  20.                 $fw=$fw.template($item['drops']['category']);
  21.                 $drops[$array["npc"][$key]['@attributes']['id']] = template($item['drops']['category']);
  22.                 //file_put_contents("saved.txt",$fw);
  23.         }
  24.  
  25. }
  26. // bla bla bla
  27. function one($string,$one,$two){
  28.         $s = explode($one,$string);
  29.         $s = explode($two,$s[1]);
  30.         return $s[0];
  31. }
  32. $surasta = 0;
  33. $files = glob("h5/*xml");
  34. if (is_array($files)) {
  35.      foreach($files as $filename) {
  36.                  $final_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
  37. <list xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"../../xsd/npcs.xsd\">\n";
  38.      $xml_file = file_get_contents($filename, FILE_TEXT);
  39.          $explode = explode("<npc",$xml_file);
  40.          unset($explode[0]);
  41.          unset($explode[sizeof($explode)]);
  42.          
  43.          foreach($explode as $npc) {
  44.                  $npc = "<npc".$npc;
  45.                  $npc_id = one($npc,'id="','"');
  46.                 if(isset($drops[$npc_id])){
  47.                 $npc = str_replace("</npc>","\n".$drops[$npc_id]."\n</npc>",$npc);
  48.                 }
  49.                 $final_file .= $npc;
  50.                
  51.          }
  52.          //break;
  53.          $final_file .= "\n</list>\n";
  54.          file_put_contents(str_replace("h5","h6",$filename),$final_file);
  55.          }
  56. }
  57. // bla bla bla
  58. function template($groupsDeath){
  59.         if(!isset($groupsDeath['@attributes'])){
  60.        
  61.         $string = "";
  62.         $string = '<dropLists>'."\n";
  63.                         foreach($groupsDeath as $group){
  64.                                 if($group['@attributes']['id'] == -1){
  65.                         $string=$string.'<corpse>'."\n";
  66.         }else{
  67.                 $string=$string.'<death>'."\n";
  68.         }
  69.                         $string=$string.'<group chance="100">'."\n";
  70.                        
  71.                         foreach($group['drop'] as $item){
  72.                                 if(!isset($item['@attributes'])){
  73.                                 $chance = formatChances($item['chance']);
  74.                                 $string=$string.'<item id="'.$item['itemid'].'" min="'.$item['min'].'" max="'.$item['max'].'" chance="'.$chance.'" />'."\n";}
  75.                                 else{
  76.                                         $chance = formatChances($item['@attributes']['chance']);
  77.                                 $string=$string.'<item id="'.$item['@attributes']['itemid'].'" min="'.$item['@attributes']['min'].'" max="'.$item['@attributes']['max'].'" chance="'.$chance.'" />'."\n";
  78.                                        
  79.                                 }
  80.                         }
  81.                                         $string=$string.'</group>'."\n";
  82.                                         if($group['@attributes']['id'] == -1){
  83.                                 $string=$string.'</corpse>'."\n";
  84.                                 }else{
  85.                                         $string=$string.'</death>'."\n";
  86.                                 }
  87.                                         }
  88.                 $string=$string.'</dropLists>'."\n";
  89.                 }else{
  90.                         $string = "";
  91.                         $string = '<dropLists>'."\n";
  92.                         if($groupsDeath['@attributes']['id'] == -1){
  93.                         $string=$string.'<corpse>'."\n";
  94.                         }else{
  95.                                 $string=$string.'<death>'."\n";
  96.                         }
  97.                         $string=$string.'<group chance="100">'."\n";
  98.                         $chance = formatChances($groupsDeath['drop']['@attributes']['chance']);
  99.                         $string=$string.'<item id="'.$groupsDeath['drop']['@attributes']['itemid'].'" min="'.$groupsDeath['drop']['@attributes']['min'].'" max="'.$groupsDeath['drop']['@attributes']['max'].'" chance="'.$chance.'" />'."\n";
  100.                        
  101.                         $string=$string.'</group>'."\n";
  102.                         if($groupsDeath['@attributes']['id'] == -1){
  103.                                 $string=$string.'</corpse>'."\n";
  104.                                 }else{
  105.                                         $string=$string.'</death>'."\n";
  106.                                 }
  107.                         $string=$string.'</dropLists>'."\n";
  108.                        
  109.                 }
  110.                 return $string;
  111. }
  112.  
  113. function formatChances($chance){
  114.         if($chance<10){
  115.                 return "0.000".$chance;
  116.         }
  117.         elseif($chance<100){
  118.                 return "0.00".$chance;
  119.         }elseif($chance<1000){
  120.                 return "0.0".$chance;
  121.         }elseif($chance<10000){
  122.                 return "0.".$chance;
  123.         }elseif($chance<100000){
  124.                 $output[1] = substr($chance, 0, 1);
  125.                 $output[2] = substr($chance, 1);
  126.                 return $output[1].'.'.$output[2];
  127.         }elseif($chance<1000000){
  128.                 $output[1] = substr($chance, 0, 2);
  129.                 $output[2] = substr($chance, 2);
  130.                 return $output[1].'.'.$output[2];
  131.         }elseif($chance<10000000){
  132.                 $output[1] = substr($chance, 0, 3);
  133.                 $output[2] = substr($chance, 3);
  134.                 return $output[1].'.'.$output[2];
  135.         }
  136. }
  137. ?>
Raw Paste

Login or Register to edit or fork this paste. It's free.