Advertisement
DayDun

Manyland UnMinify

Oct 8th, 2017
2,884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var minificationMappingClientToServer = [
  2.     ["A", '"vel":{"x":0,"y":0},"acl":{"x":0,"y":0},"ani":"idle","flp":false,"g":'],
  3.     ["B", '"vel":{"x":0,"y":0},"acl":{"x":0,"y":0},"ani":"idle","flp":true,"g":'],
  4.     ["J", '"m":"st","data":{"pos":{"x":'],
  5.     ["C", '"m":"sh","data":{"key":"_c'],
  6.     ["D", '","rotation":0,"flip":0},"'],
  7.     ["&", '"m":"rq","data":null}'],
  8.     ["E", '"m":"rm","data":null}'],
  9.     ["F", ',"def":null,"rId":"'],
  10.     ["G", '"vel":{"x":0,"y":0}'],
  11.     ["H", '"acl":{"x":0,"y":0}'],
  12.     ["K", '"m":"me","data":{'],
  13.     ["~", '"ani":"swimming'],
  14.     ["L", ',"def":{"tid":"'],
  15.     ["M", '"ani":"idle"'],
  16.     ["N", '"ani":"jump"'],
  17.     ["O", '"ani":"fall"'],
  18.     ["P", '"ani":"afk"'],
  19.     ["Q", '"ani":"run"'],
  20.     ["R", '"flp":false'],
  21.     ["W", '"pos":{"x":'],
  22.     ["X", '"acl":{"x":'],
  23.     ["V", '"vel":{"x":'],
  24.     ["S", '"flp":true'],
  25.     ["T", '"m":"hb"}'],
  26.     ["U", ',"data":{'],
  27.     ["!", '"act":'],
  28.     ["@", '"g":'],
  29.     ["Y", '"x":'],
  30.     ["Z", '"y":'],
  31.     ["\\?", '"}}'],
  32.     ["%", "}}"],
  33.     ["\\^", "},"],
  34.     ["\\*", '",'],
  35.     ["=", "1"],
  36.     [";", "2"],
  37.     ["<", "3"],
  38.     [">", "4"],
  39.     ["\\(", "0"],
  40.     ["\\)", "5"]
  41. ];
  42.  
  43. var minificationMappingServerToClient = [
  44.     ["A", '"vel":{"x":0,"y":0},"acl":{"x":0,"y":0},'],
  45.     ["B", '"m":"mu","data":{"loc":{"x":'],
  46.     ["C", '"m":"st","data":{"rid":"'],
  47.     ["\\/", '"m":"sh","data":{"rid":"'],
  48.     ["D", '"m":"np","data":{'],
  49.     ["E", '"flp":false,"g":'],
  50.     ["F", '"flp":true,"g":'],
  51.     ["G", '"ani":"idle"'],
  52.     ["H", '"ani":"jump"'],
  53.     ["J", '"ani":"fall"'],
  54.     ["O", '"flp":false,'],
  55.     ["K", '"ani":"afk"'],
  56.     ["L", '"pos":{"x":'],
  57.     ["M", '"vel":{"x":'],
  58.     ["N", '"acl":{"x":'],
  59.     ["P", '"ani":"run"'],
  60.     ["Q", '"flp":true,'],
  61.     ["R", '"map":{"p":'],
  62.     ["@", '","data":{'],
  63.     ["T", '},"sta":0'],
  64.     ["U", '},"sta":1'],
  65.     ["\\?", '"key":"_'],
  66.     ["V", '"ach":"'],
  67.     ["W", '"rid":"'],
  68.     ["X", '"aid":"'],
  69.     ["Y", '"snm":"'],
  70.     ["S", '"wid":'],
  71.     ["Z", '"r":'],
  72.     ["!", '"x":'],
  73.     ["#", '"y":'],
  74.     [">", '"}}'],
  75.     ["%", "}}"],
  76.     ["\\^", "},"],
  77.     ["\\*", '",'],
  78.     ["=", "1"],
  79.     [";", "2"],
  80.     ["<", "3"],
  81.     ["\\(", "0"],
  82.     ["\\)", "5"]
  83. ];
  84.  
  85. function unMinify(str, side) {
  86.     if ("{" != str.substring(0, 1)) {
  87.         var proto = side ? this.minificationMappingClientToServer : this.minificationMappingServerToClient;
  88.         for (var i = proto.length - 1; 0 <= i; i--) {
  89.             str = str.replace(RegExp(proto[i][0], "g"), proto[i][1]);
  90.         }
  91.         str = "{" + str;
  92.     }
  93.     return JSON.parse(str);
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement