ReigeKwitt/MC_PocketHackClientFiles
036
1/************2* This Mod is a modification of DragOP by GodSoft029 and peacestorm3* Only FirePro9978, peacestorm and GodSoft029 are allowed to modify this mod.4*This didnt got showed in the first release because it didnt got saved >:(.5*************/6 7var Toast = android.widget.Toast;8var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();9var LinearLayout = android.widget.LinearLayout;10var GUI;11var dialog;12var searchQ = ""; //Current search query13var tick1 = 0;14var search;15var Launcher = {16 isBlockLauncher: function () {17 return(ctx.getPackageName() == "net.zhuoweizhang.mcpelauncher" || ctx.getPackageName() == "net.zhuoweizhang.mcpelauncher.pro");18 },19 isToolbox: function () {20 return ctx.getPackageName() == "io.mrarm.mctoolbox";21 }22};23 24var FlameClient = {25 mods: new Array(),26 commands: new Array(),27 isDev: true,28 inGame: false29};30var CommandManager = {31 cmdModules: new Array(),32 cmdNames: new Array(),33 onCommand: function (cmd) {34 cmd = cmd.split(" ");35 var command = cmd.shift().toLowerCase();36 var args = cmd;37 var module = null;38 var found = false;39 this.cmdNames.forEach(function (entry, index) {40 if(found == false) {41 entry.forEach(function (entry2) {42 if(entry2.toLowerCase() == command) {43 found = true;44 module = CommandManager.cmdModules[index];45 46 }47 });48 }49 });50 if(module != null)51 module.onCall(args);52 else53 FlameClient.cmsg("Command \"" + command + "\" not found");54 },55 registerCommand: function (module) {56 this.cmdModules.push(module);57 this.cmdNames.push(module.alias);58 }59};60 61var FriendManager = {62 all: new org.json.JSONArray(),63 isFriend: function (name) {64 var is = false;65 if(name == null) return false;66 var cname = Utils.Text.clean(name.toString().toLowerCase());67 68 for(var i = 0; i < this.all.length(); i++) {69 if(cname.toString().toLowerCase() == this.all.getString(i).toLowerCase()) is = true;70 }71 return is;72 },73 loadFromFile: function () {74 try {75 var file = new java.io.File(android.os.Environment.getExternalStorageDirectory() + "/FlameClient/", "friends.dat");76 var readed = (new java.io.BufferedReader(new java.io.FileReader(file)));77 var data = new java.lang.StringBuilder();78 var string;79 while((string = readed.readLine()) != null) {80 data.append(string);81 82 }83 try {84 this.all = new org.json.JSONArray(data.toString());85 } catch(e) {86 FlameClient.ctoast("Friend data corrupt. Deleting your friend list(" + e);87 }88 } catch(e) {89 //Seems like theres no file90 }91 },92 saveToFile: function () {93 var dir = new java.io.File(android.os.Environment.getExternalStorageDirectory() + "/FlameClient");94 if(!dir.exists()) dir.mkdir();95 var file = new java.io.File(android.os.Environment.getExternalStorageDirectory() + "/FlameClient/", "friends.dat");96 if(!file.exists()) file.createNewFile();97 var stream = new java.io.FileOutputStream(file);98 try {99 stream.write(this.all.toString().getBytes());100 } finally {101 stream.close();102 }103 },104 addFriend: function (name) {105 this.all.put(name);106 this.saveToFile();107 },108 removeFriend: function (name) {109 var tempall = new org.json.JSONArray();110 for(var i = 0; i < this.all.length(); i++) {111 if(this.all.getString(i).toLowerCase() != name.toString().toLowerCase()) tempall.put(this.all.getString(i));112 }113 this.all = tempall;114 this.saveToFile();115 }116};117FriendManager.loadFromFile();118var lc = {119 en_US: 1,120 de_DE: 2121};122var ModuleType = {123 mod: 1,124 special: 2,125 command: 3,126 cmd: 3,127 toName: function (type) {128 switch(type) {129 case ModuleType.mod:130 return FlameClient.getLString("moduletype.mod");131 break;132 case ModuleType.special:133 return FlameClient.getLString("moduletype.special");134 break;135 case ModuleType.command:136 return FlameClient.getLString("moduletype.command");137 break;138 default:139 return "unknown";140 }141 }142};143var l = new Array();144l.push(new Array()); //Codes145l.push(new Array()); //English146l.push(new Array()); //German147//Multi Language Support148var BypassMode = {149 DEFAULT: 0,150 LBSG: 1,151 MINIBOX: 2152};153var SpeedMode = {154 DEFAULT: 0,155 BHOP: 1,156 LONGJUMP: 2157};158var getStyledBtnBackground = function (state, toggleable) {159 var bg = android.graphics.drawable.GradientDrawable();160 bg.setCornerRadius(1);161 bg.setColor(android.graphics.Color.argb(80, 0, 0, 0));162 if(state) bg.setColor(android.graphics.Color.argb(210, 0, 200, 0));163 if(toggleable == false) bg.setColor(android.graphics.Color.argb(210, 230, 150, 30));164 bg.setShape(android.graphics.drawable.GradientDrawable.RECTANGLE);165 bg.setStroke(dip2px(2), android.graphics.Color.argb(230, 0, 0, 0));166};167var Themes = {168 DEFAULT: {169 font: android.os.Build.VERSION.SDK_INT >= 17 ? android.graphics.Typeface.create("sans-serif-light", android.graphics.Typeface.NORMAL) : android.graphics.Typeface.DEFAULT,170 ModButton: {171 172 Neutral: {173 textColor: android.graphics.Color.BLACK,174 background: getStyledBtnBackground(false, false)175 },176 Activated: {177 textColor: android.graphics.Color.BLACK,178 background: getStyledBtnBackground(true, true)179 },180 Deactivated: {181 textColor: android.graphics.Color.BLACK,182 background: getStyledBtnBackground(false, true)183 }184 }185 186 }187};188var Utils = {189 bypassMode: BypassMode.DEFAULT,190 speedMode: SpeedMode.DEFAULT,191 online: false,192 flyTick: 0,193 modsCount: 0,194 currentSearchCount: 0,195 font: android.os.Build.VERSION.SDK_INT >= 17 ? android.graphics.Typeface.create("sans-serif-light", android.graphics.Typeface.NORMAL) : android.graphics.Typeface.DEFAULT,196 Render: {197 198 getFloatBuffer: function (fArray) {199 var bBuffer = java.nio.ByteBuffer.allocateDirect(fArray.length * 4);200 bBuffer.order(java.nio.ByteOrder.nativeOrder());201 202 var fBuffer = bBuffer.asFloatBuffer();203 fBuffer.put(fArray);204 fBuffer.position(0);205 return fBuffer;206 },207 getShortBuffer: function (sArray) {208 var bBuffer = java.nio.ByteBuffer.allocateDirect(sArray.length * 2);209 bBuffer.order(java.nio.ByteOrder.nativeOrder());210 211 var sBuffer = bBuffer.asShortBuffer();212 sBuffer.put(sArray);213 sBuffer.position(0);214 return sBuffer;215 },216 renderer: null,217 glSurface: null,218 fov: 90,219 initted: false,220 init: function () {221 var options = Utils.File.getTextFromFile(new java.io.File(android.os.Environment.getExternalStorageDirectory() + "/games/com.mojang/minecraftpe/", "options.txt"));222 223 options = options.split("\n");224 options.forEach(function (entry) {225 var suboption = entry.split(":");226 if(suboption[0] == "gfx_field_of_view") {227 Utils.Render.fov = suboption[1];228 229 }230 });231 this.renderer = new android.opengl.GLSurfaceView.Renderer({232 onSurfaceCreated: function (gl, config) {233 var GL10 = javax.microedition.khronos.opengles.GL10;234 gl.glClearColor(0, 0, 0, 0);235 gl.glShadeModel(GL10.GL_SMOOTH);236 gl.glClearDepthf(1.0);237 gl.glEnable(GL10.GL_DEPTH_TEST);238 gl.glDepthFunc(GL10.GL_LEQUAL);239 gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);240 //FlameClient.ctoast("created");241 },242 onSurfaceChanged: function (gl, width, height) {243 //FlameClient.ctoast("Changing...");244 var GL10 = javax.microedition.khronos.opengles.GL10;245 gl.glMatrixMode(GL10.GL_PROJECTION);246 gl.glLoadIdentity();247 android.opengl.GLU.gluPerspective(gl, Utils.Render.fov, width / height, 0.1, 100);248 gl.glMatrixMode(GL10.GL_MODELVIEW);249 gl.glLoadIdentity();250 //FlameClient.ctoast("changed");251 },252 onDrawFrame: function (gl) {253 //FlameClient.ctoast("Drawing...");254 var GL10 = javax.microedition.khronos.opengles.GL10;255 gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);256 gl.glLoadIdentity();257 gl.glDisable(GL10.GL_LIGHTING);258 if(playerESP.state || chesttracers.state || tracers.state) {259 try{260 var yaw = getYaw() % 360;261 var pitch = getPitch() % 360;262 var eyeX = getPlayerX();263 var eyeY = getPlayerY() + 1;264 var eyeZ = getPlayerZ();265 266 var dCenterX = Math.sin(yaw / 180 * Math.PI);267 var dCenterZ = Math.cos(yaw / 180 * Math.PI);268 var dCenterY = Math.sqrt(dCenterX * dCenterX + dCenterZ * dCenterZ) * Math.tan((pitch - 180) / 180 * Math.PI);269 270 var centerX = eyeX - dCenterX;271 var centerZ = eyeZ + dCenterZ;272 var centerY = eyeY - dCenterY;273 274 android.opengl.GLU.gluLookAt(gl, eyeX, eyeY, eyeZ, centerX, centerY, centerZ, 0, 1.0, 0);275 276 FlameClient.mods.forEach(function (entry, index, array) {277 try {278 entry.onRender(gl);279 //gl.glTranslatef(0,0,0);280 } catch(e) {}281 });282 }catch(e){283 FlameClient.ctoast("RenderProblem: "+e);284 }285 286 }287 }288 });289 ctx.runOnUiThread(new java.lang.Runnable( {290 run: function () {291 Utils.Render.glSurface = new android.opengl.GLSurfaceView(ctx);292 Utils.Render.glSurface.setZOrderOnTop(true);293 294 295 Utils.Render.glSurface.setEGLConfigChooser(8, 8, 8, 8, 16, 0);296 Utils.Render.glSurface.getHolder().setFormat(android.graphics.PixelFormat.TRANSLUCENT);297 Utils.Render.glSurface.setRenderer(Utils.Render.renderer);298 Utils.Render.glSurface.setRenderMode(0);299 300 ctx.getWindow().getDecorView().addView(Utils.Render.glSurface);301 302 Utils.Render.initted = true;303 }304 }));305 306 },307 drawBox: function (gl, x, y, z, xsize, ysize, zsize) {308 var GL10 = javax.microedition.khronos.opengles.GL10;309 var size = new Array(xsize, ysize, zsize);310 var vertices = [311 0, 0, 0,312 size[0], 0, 0,313 0, 0, size[2],314 size[0], 0, size[2],315 316 0, size[1], 0,317 size[0], size[1], 0,318 0, size[1], size[2],319 size[0], size[1], size[2]320 ];321 var vertexBuffer = Utils.Render.getFloatBuffer(vertices);322 var indices = [323 0, 1,324 0, 2,325 0, 4,326 327 3, 1,328 3, 2,329 3, 7,330 331 5, 4,332 5, 7,333 5, 1,334 335 6, 4,336 6, 7,337 6, 2338 ];339 var indexBuffer = Utils.Render.getShortBuffer(indices);340 gl.glTranslatef(x, y, z);341 gl.glFrontFace(GL10.GL_CCW);342 //gl.glEnable(GL10.GL_CULL_FACE);343 //gl.glCullFace(GL10.GL_BACK);344 gl.glEnable(GL10.GL_BLEND);345 gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);346 gl.glLineWidth(4);347 gl.glColor4f(0.0, 1.0, 0.0, 0.4);348 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);349 gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);350 gl.glDrawElements(GL10.GL_LINES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);351 gl.glTranslatef(-x, -y, -z);352 },353 drawLine: function (gl, x, y, z, x2, y2, z2) {354 var GL10 = javax.microedition.khronos.opengles.GL10;355 var size = new Array(x2, y2, z2);356 var vertices = [357 0, 0, 0,358 x2-x, y2-y, z2-z359 ];360 var vertexBuffer = Utils.Render.getFloatBuffer(vertices);361 var indices = [362 0, 1363 ];364 var indexBuffer = Utils.Render.getShortBuffer(indices);365 gl.glTranslatef(x, y, z);366 gl.glEnable(GL10.GL_BLEND);367 gl.glDepthMask(false);368 gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);369 gl.glLineWidth(4);370 gl.glColor4f(0.0, 1.0, 0.0, 0.4);371 gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);372 gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);373 gl.glDrawElements(GL10.GL_LINES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer);374 gl.glTranslatef(-x, -y, -z);375 gl.glDepthMask(true);376 }377 },378 Theme: {379 current: Themes.DEFAULT380 },381 Screen: {382 currentScreen: "",383 INGAME: "hud_screen"384 },385 File: {386 flameclientDir: android.os.Environment.getExternalStorageDirectory(),387 getTextFromFile: function (file) {388 389 var readed = (new java.io.BufferedReader(new java.io.FileReader(file)));390 var data = new java.lang.StringBuilder();391 var string;392 while((string = readed.readLine()) != null)393 data.append(string + "\n");394 return data.toString();395 },396 saveTextToFile: function (file, text) {397 if(!file.exists()) file.createNewFile();398 var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, text.length());399 for(var i = 0; i < text.length(); i++) bytes[i] = text.charCodeAt(i);400 var stream = new java.io.FileOutputStream(file);401 try {402 stream.write(bytes);403 } finally {404 stream.close();405 }406 }407 },408 Base64: {409 encode: function (text) {410 411 var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, text.length());412 for(var i = 0; i < text.length(); i++) bytes[i] = new java.lang.Byte(new String(text).charCodeAt(i));413 return android.util.Base64.encodeToString(bytes, 0);414 },415 decode: function (text) {416 return android.util.Base64.decode(text, 0);417 }418 },419 Text: {420 clean: function (text) {421 var allColor = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "k", "l", "m", "n", "o", "r"];422 423 if(text != null) {424 425 allColor.forEach(function (entry) {426 text = text.replace(new RegExp("\u00A7" + entry, 'g'), "");427 });428 return text;429 } else430 return "";431 }432 },433 MobRender: {434 makeInvi: function (renderer) {435 var model = renderer.getModel();436 model.getPart("body").clear();437 model.getPart("rightArm").clear();438 model.getPart("head").clear();439 model.getPart("leftArm").clear();440 model.getPart("rightLeg").clear();441 model.getPart("leftLeg").clear();442 renderer.name = "godsoft.de.Invi";443 }444 },445 ModSettings: {446 getSlider: function () {447 return new android.widget.SeekBar(ctx);448 }449 },450 Block: {451 isLiquid: function (id) {452 if(id >= 8 && id <= 11) return true;453 return false;454 },455 isIce: function (id) {456 if (id = 79 && id = 174) return true;457 return false;458 }459 },460 Player: {461 isInWater: function () {462 if(Utils.Block.isLiquid(getTile(getPlayerX(), getPlayerY() - 1.65, getPlayerZ()))) return true;463 return false;464 },465 onGround: function () {466 var y = getPlayerY();467 while(y > 1) y -= 1;468 469 if((Math.round(y * 100) >= 61 && Math.round(y * 100) <= 63) && getTile(getPlayerX(), getPlayerY() - 1.65, getPlayerZ()) != 0 && !Utils.Block.isLiquid(getTile(getPlayerX(), getPlayerY() - 1.65, getPlayerZ()))) return true;470 if((Math.round(y * 100) >= 11 && Math.round(y * 100) <= 13) && getTile(getPlayerX(), getPlayerY() - 1.65, getPlayerZ()) != 0 && !Utils.Block.isLiquid(getTile(getPlayerX(), getPlayerY() - 1.65, getPlayerZ()))) return true;471 return false;472 },473 isOnIce: function () {474 if(Utils.Block.isIce(getTile(getPlayerX(), getPlayerY() - 0.1, getPlayerZ()))) return true;475 return false;476 },477 478 isCollidedHorizontally: function () {479 var x = getPlayerX();480 var z = getPlayerZ();481 var blockX = Math.round(x - 0.5);482 var blockZ = Math.round(z - 0.5);483 while(x < 1) x += 1;484 while(z < 1) z += 1;485 while(x > 1) x -= 1;486 while(z > 1) z -= 1;487 488 if(Math.round(x * 100) == 31) x -= 0.01;489 if(Math.round(z * 100) == 31) z -= 0.01;490 if(Math.round(x * 100) == 69) x += 0.01;491 if(Math.round(z * 100) == 69) z += 0.01;492 if(Math.round(x * 100) == 30) blockX--;493 if(Math.round(z * 100) == 30) blockZ--;494 if(Math.round(x * 100) == 70) blockX++;495 if(Math.round(z * 100) == 70) blockZ++;496 //clientMessage(blockX+";"+blockZ);497 if(getTile(blockX, getPlayerY(), blockZ) == 0 && getTile(blockX, getPlayerY() - 1, blockZ) == 0) return false;498 499 if(Block.getDestroyTime(getTile(blockX, getPlayerY() - 1, blockZ)) <= 0.1 && Block.getDestroyTime(getTile(blockX, getPlayerY(), blockZ)) <= 0.1) return false;500 501 if(Math.round(x * 100) == 30 || Math.round(x * 100) == 70) return true;502 if(Math.round(z * 100) == 30 || Math.round(z * 100) == 70) return true;503 return false;504 }505 },506 Vel: {507 lastX: 0,508 lastY: 0,509 lastZ: 0,510 calculateSpeed: function () {511 return Math.sqrt(Math.pow(Entity.getVelX(getPlayerEnt()), 2) + Math.pow(Entity.getVelZ(getPlayerEnt()), 2));512 }513 },514 Pos: {515 lastX: 0,516 lastY: 0,517 lastZ: 0518 },519 Entity: {520 getAll: function () {521 if(Launcher.isToolbox()) {522 return Entity.getAll();523 } else {524 return Utils.Entity.allEntitys;525 }526 },527 targetotedMobs: [true, true],528 /*first mobs second players*/529 allEntitys: new Array(),530 charEnts: new Array(),531 crosshairAimAt: function (ent, pos) {532 if(ent != null) {533 var x = Entity.getX(ent) - getPlayerX();534 var y = Entity.getY(ent) - getPlayerY();535 var z = Entity.getZ(ent) - getPlayerZ();536 if(pos != null && pos instanceof Array) {537 538 x = Entity.getX(ent) - pos[0];539 y = Entity.getY(ent) - pos[1];540 z = Entity.getZ(ent) - pos[2];541 }542 if(Entity.getEntityTypeId(ent) != 63)543 y += 0.5;544 var a = 0.5 + Entity.getX(ent);545 var b = Entity.getY(ent);546 var c = 0.5 + Entity.getZ(ent);547 var len = Math.sqrt(x * x + y * y + z * z);548 var y = y / len;549 var pitch = Math.asin(y);550 pitch = pitch * 180.0 / Math.PI;551 pitch = -pitch;552 var yaw = -Math.atan2(a - (Player.getX() + 0.5), c - (Player.getZ() + 0.5)) * (180 / Math.PI);553 if(pitch < 89 && pitch > -89) {554 Entity.setRot(Player.getEntity(), yaw, pitch);555 }556 }557 },558 bowAimAt: function (ent) {559 var velocity = 1;560 var posX = Entity.getX(ent) - Player.getX();561 var posY = Entity.getEntityTypeId(ent) == EntityType.PLAYER ? Entity.getY(ent) - Player.getY() : Entity.getY(ent) + 1 - Player.getY();562 var posZ = Entity.getZ(ent) - Player.getZ();563 var yaw = (Math.atan2(posZ, posX) * 180 / Math.PI) - 90;564 var y2 = Math.sqrt(posX * posX + posZ * posZ);565 var g = 0.007;566 var tmp = (velocity * velocity * velocity * velocity - g * (g * (y2 * y2) + 2 * posY * (velocity * velocity)));567 var pitch = -(180 / Math.PI) * (Math.atan((velocity * velocity - Math.sqrt(tmp)) / (g * y2)));568 if(pitch < 89 && pitch > -89) {569 setRot(Player.getEntity(), yaw, pitch);570 }571 },572 getNearestEntity(maxrange) {573 var mobs = Utils.Entity.getAll();574 //clientMessage(mobs.length);575 var players = Server.getAllPlayers();576 577 var small = maxrange;578 var ent = null;579 /*if(mobs.length > 500)clientMessage("lag found: "+mobs.length);*/580 var much = 0;581 582 mobs.forEach(function (entry) {583 584 var x = Entity.getX(entry) - getPlayerX();585 var y = Entity.getY(entry) - getPlayerY();586 var z = Entity.getZ(entry) - getPlayerZ();587 588 var dist = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));589 590 var allowed = false;591 if(Utils.Entity.targetotedMobs[1] == true && Entity.getEntityTypeId(entry) == 63) allowed = true;592 if(Utils.Entity.targetotedMobs[0] == true && Entity.getEntityTypeId(entry) < 63) allowed = true;593 //clientMessage("Im here2");594 595 //clientMessage("Im here3");596 if(dist < small && dist > 0 && allowed == true && Entity.getHealth(entry) > 0) {597 if(Entity.getNameTag(entry) == "" || FriendManager.isFriend(Entity.getNameTag(entry)) == false) {598 small = dist;599 ent = entry;600 }601 }602 603 });604 605 606 for(var i = 0; i < players.length; i++) {607 var x = Entity.getX(players[i]) - getPlayerX();608 var y = Entity.getY(players[i]) - getPlayerY();609 var z = Entity.getZ(players[i]) - getPlayerZ();610 var allowed = false;611 if(Utils.Entity.targetotedMobs[1] == true && Entity.getEntityTypeId(players[i]) == 63) allowed = true;612 if(Utils.Entity.targetotedMobs[0] == true && Entity.getEntityTypeId(players[i]) < 63) allowed = true;613 var dist = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));614 if(FriendManager.isFriend(Entity.getNameTag(players[i])) == true) allowed = false;615 if(dist < small && dist > 0 && allowed == true && Entity.getHealth(players[i]) >= 1) {616 small = dist;617 ent = players[i];618 }619 }620 621 return ent;622 }623 }624};625 626var Shop = {627 c5932894ash: 0,628 buyed: null,629 cashFile: new java.io.File(Utils.File.flameclientDir, "base64.dat"),630 loadCash: function() {631 if (this.cashFile.exists()) {632 try {633 var text = Utils.File.getTextFromFile(this.cashFile);634 text = text.replace("\n", "");635 text = Utils.Base64.decode(text);636 var newStr = "",637 leng = 0;638 for (var i in text) leng++;639 for (var i = 0; i < leng; i++) {640 newStr += String.fromCharCode(text[i])641 }642 text = newStr;643 text = text.replace("\n", "");644 text = Utils.Base64.decode(text);645 var newStr = "",646 leng = 0;647 for (var i in text) leng++;648 for (var i = 0; i < leng; i++) {649 newStr += String.fromCharCode(text[i])650 }651 text = newStr;652 text = text.replace("\n", "");653 text = new org["json"].JSONObject(text);654 Shop.setCash(parseInt(text.get("defaultt")));655 text = text.getString("base");656 text = Utils.Base64.decode(text);657 var newStr = "",658 leng = 0;659 for (var i in text) leng++;660 for (var i = 0; i < leng; i++) {661 newStr += String.fromCharCode(text[i])662 }663 text = newStr;664 text = text.replace("\n", "");665 text = new org.json.JSONArray(text);666 this.buyed = new Array();667 for (var i = 0; i < text.length(); i++) {668 this.buyed.push(text.get(i))669 }670 } catch (e) {671 FlameClient.ctoast("Shop data corrupt.\nDeleting Shop Data");672 this.cashFile.delete();673 this[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"] = 0;674 this.buyed = new Array()675 }676 } else {677 this[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"] = 0;678 this.buyed = new Array()679 }680 },681 saveCash: function() {682 var text = new org.json.JSONArray();683 for (var i = 0; i < this.buyed.length; i++) {684 text.put(this.buyed[i])685 }686 text = Utils.Base64.encode(text.toString());687 var jsonObj = new org.json.JSONObject();688 jsonObj.put("base", text);689 jsonObj.put("defaultt", parseInt(Shop[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"]));690 text = Utils.Base64.encode(jsonObj.toString());691 text = Utils.Base64.encode(text);692 Utils.File.saveTextToFile(new java.io.File(Utils.File.flameclientDir, "base64.dat"), text)693 },694 startThread: function() {695 var t = new java.lang.Thread(new java.lang.Runnable({696 run: function() {697 while (true) {698 try {699 java["lang"]["Thread"].sleep(60 * 1000);700 Shop[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"] += 0;701 Shop.saveCash()702 } catch (e) {703 print(e);704 clientMessage(e)705 }706 }707 }708 }));709 t.start()710 },711 setCash: function(newCash) {712 this[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"] = newCash713 },714 getCash: function() {715 return this[gmmodule["desc"][0].toLowerCase() + (Boolean.valueOf(true) == false ? (Math.sin(5938) * 492) : (Math.random() * 3 / 6 * 0 + Math.round(5932894.49693))) + speed["desc"][2] + "s" + "h"]716 },717 init: function() {718 this.loadCash();719 this.startThread()720 }721};722 723FlameClient.addCode = function (code) {724 l[0].push(code);725}726FlameClient.setLString = function (code, lang, value) {727 var done = false;728 l[0].forEach(function (entry, index, array) {729 if(entry.toLowerCase() == code.toLowerCase()) {730 l[lang][index] = value;731 done = true;732 }733 });734 if(done) return;735 //FlameClient.addCode(code);736 //l[0].push(code+"".toLowerCase());737 //FlameClient.setLString(code, lang, value);738 }739 //FlameClient.addCode(code);740FlameClient.addCode("special.shop");741FlameClient.addCode("special.disaball");742FlameClient.addCode("special.targeto");743FlameClient.addCode("special.friend_manager");744FlameClient.addCode("special.bypass");745FlameClient.addCode("special.webbrowser");746FlameClient.addCode("modules.gamemode");747FlameClient.addCode("modules.speed");748FlameClient.addCode("modules.fastbreak");749FlameClient.addCode("modules.combatmode");750FlameClient.addCode("modules.jumpspeed");751FlameClient.addCode("modules.autocombatlog");752FlameClient.addCode("modules.autojump");753FlameClient.addCode("modules.jetpack");754FlameClient.addCode("modules.cspeed");755FlameClient.addCode("modules.behindhit");756FlameClient.addCode("modules.grapple");757FlameClient.addCode("modules.aimbowt");758FlameClient.addCode("modules.reach");759FlameClient.addCode("modules.lifecounter");760FlameClient.addCode("modules.antikb");761FlameClient.addCode("modules.airwalk");762FlameClient.addCode("modules.autocombatlog");763FlameClient.addCode("modules.taptower");764FlameClient.addCode("modules.autojump")765FlameClient.addCode("modules.fasteat")766FlameClient.addCode("modules.tracers")767FlameClient.addCode("modules.placetp")768FlameClient.addCode("modules.zoomspeed")769FlameClient.addCode("modules.taptp");770FlameClient.addCode("modules.intangibility");771FlameClient.addCode("modules.antigrief");772FlameClient.addCode("modules.derp");773FlameClient.addCode("modules.twerk");774FlameClient.addCode("modules.bunnyhop");775FlameClient.addCode("modules.flight");776FlameClient.addCode("modules.step");777FlameClient.addCode("modules.climbstep");778FlameClient.addCode("modules.dolphin");779FlameClient.addCode("modules.glide");780FlameClient.addCode("modules.sglide");781FlameClient.addCode("modules.fastice");782FlameClient.addCode("modules.chestTracer");783FlameClient.addCode("modules.criticals");784FlameClient.addCode("modules.underblock");785FlameClient.addCode("modules.texttotoast");786FlameClient.addCode("modules.coords");787FlameClient.addCode("modules.playerESP");788FlameClient.addCode("modules.nuker");789FlameClient.addCode("modules.highjump");790FlameClient.addCode("modules.stealth");791FlameClient.addCode("special.armforceEnchant");792FlameClient.addCode("special.toolforceEnchant");793FlameClient.addCode("special.solidliquid");794FlameClient.addCode("special.nobarrier");795FlameClient.addCode("special.fastsoulsand");796FlameClient.addCode("special.blockweb");797FlameClient.addCode("special.blockfire");798FlameClient.addCode("special.slowmo");799FlameClient.addCode("special.nvision");800FlameClient.addCode("gm.survival");801FlameClient.addCode("gm.creative");802FlameClient.addCode("moduletype.mod");803FlameClient.addCode("moduletype.special");804FlameClient.addCode("moduletype.command");805FlameClient.addCode("moddialog.description");806FlameClient.addCode("moddialog.type");807FlameClient.addCode("state.on");808FlameClient.addCode("state.off");809 810//FlameClient.setLString(code, lc.en_US, value);811FlameClient.setLString("special.shop", lc.en_US, "Shop");812FlameClient.setLString("special.bypass", lc.en_US, "Bypass");813FlameClient.setLString("special.targeto", lc.en_US, "Target-Only");814FlameClient.setLString("special.friend_manager", lc.en_US, "Friend-Manager");815FlameClient.setLString("special.disaball", lc.en_US, "Disab-all")816FlameClient.setLString("special.webbrowser", lc.en_US, "WebBrowser");817FlameClient.setLString("modules.gamemode", lc.en_US, "Gamemode");818FlameClient.setLString("modules.speed", lc.en_US, "Speed");819FlameClient.setLString("modules.fastbreak", lc.en_US, "FastBreak");820FlameClient.setLString("modules.jumpspeed", lc.en_US, "JumpSpeed");821FlameClient.setLString("modules.combatmode", lc.en_US, "CombatMode"); //No good German translation for combat mode822FlameClient.setLString("modules.autojump", lc.en_US, "AutoJump");823FlameClient.setLString("modules.jetpack", lc.en_US, "Jetpack");824FlameClient.setLString("modules.cspeed", lc.en_US, "CrouchSpeed");825FlameClient.setLString("modules.behindhit", lc.en_US, "BehindHit");826FlameClient.setLString("modules.grapple", lc.en_US, "Grapple");827FlameClient.setLString("modules.aimbowt", lc.en_US, "AimBowT");828FlameClient.setLString("modules.reach", lc.en_US, "Reach");829FlameClient.setLString("modules.lifecounter", lc.en_US, "LifeCounter");830FlameClient.setLString("modules.antikb", lc.en_US, "AntiKB");831FlameClient.setLString("modules.airwalk", lc.en_US, "AirWalk");832FlameClient.setLString("modules.autocombatlog", lc.en_US, "AutoCombatLog");833FlameClient.setLString("modules.taptower", lc.en_US, "TapTower");834FlameClient.setLString("modules.autojump", lc.en_US, "AutoSJump")835FlameClient.setLString("modules.fasteat", lc.en_US, "FastEat")836FlameClient.setLString("modules.tracers", lc.en_US, "Tracers")837FlameClient.setLString("modules.placetp", lc.en_US, "PlaceTP");838FlameClient.setLString("modules.zoomspeed", lc.en_US, "ZoomSpeed")839FlameClient.setLString("modules.taptp", lc.en_US, "Tap-TP");840FlameClient.setLString("modules.intangibility", lc.en_US, "Intangibility");841FlameClient.setLString("modules.antigrief", lc.en_US, "AntiGrief");842FlameClient.setLString("modules.derp", lc.en_US, "Derp");843FlameClient.setLString("modules.twerk", lc.en_US, "Twerk");844FlameClient.setLString("modules.bunnyhop", lc.en_US, "BunnyHop");845FlameClient.setLString("modules.flight", lc.en_US, "Flight");846FlameClient.setLString("modules.step", lc.en_US, "Step");847FlameClient.setLString("modules.climbstep", lc.en_US, "ClimbStep");848FlameClient.setLString("modules.dolphin", lc.en_US, "Dolphin");849FlameClient.setLString("modules.glide", lc.en_US, "Glide");850FlameClient.setLString("modules.sglide", lc.en_US, "SpeedGlide");851FlameClient.setLString("modules.fastice", lc.en_US, "FastIce");852FlameClient.setLString("modules.chestTracer", lc.en_US, "ChestTracers");853FlameClient.setLString("modules.criticals", lc.en_US, "Criticals");854FlameClient.setLString("modules.underblock", lc.en_US, "UnderBlock");855FlameClient.setLString("modules.coords", lc.en_US, "Coords");856FlameClient.setLString("modules.texttotoast", lc.en_US, "Text2Toast");857FlameClient.setLString("modules.playerESP", lc.en_US, "PlayerESP");858FlameClient.setLString("modules.nuker", lc.en_US, "Nuker");859FlameClient.setLString("modules.highjump", lc.en_US, "Highjump");860FlameClient.setLString("modules.stealth", lc.en_US, "Stealth");861FlameClient.setLString("special.armforceEnchant", lc.en_US, "Armor\nForceEnchant");862FlameClient.setLString("special.toolforceEnchant", lc.en_US, "Tool\nForceEnchant");863FlameClient.setLString("special.solidliquid", lc.en_US, "Solid-Liquid");864FlameClient.setLString("special.nobarrier", lc.en_US, "NoBarrier");865FlameClient.setLString("special.fastsoulsand", lc.en_US, "FastSoulSand");866FlameClient.setLString("special.blockweb", lc.en_US, "BlockCobweb");867FlameClient.setLString("special.blockfire", lc.en_US, "BlockFire");868FlameClient.setLString("special.nvision", lc.en_US, "NightVision");869FlameClient.setLString("special.slowmo", lc.en_US, "SlowMotion");870FlameClient.setLString("gm.survival", lc.en_US, "Survival");871FlameClient.setLString("gm.creative", lc.en_US, "Creative");872FlameClient.setLString("moduletype.mod", lc.en_US, "Mod");873FlameClient.setLString("moduletype.special", lc.en_US, "Special");874FlameClient.setLString("moduletype.command", lc.en_US, "Command");875FlameClient.setLString("moddialog.description", lc.en_US, "Description");876FlameClient.setLString("moddialog.type", lc.en_US, "Type");877FlameClient.setLString("state.on", lc.en_US, "On");878FlameClient.setLString("state.off", lc.en_US, "Off");879//German880FlameClient.setLString("modules.gamemode", lc.de_DE, "Spielmodus");881/*FlameClient.setLString("modules.speed", lc.de_DE, "Schnelligkeit");Schnelligkeit is bad*/882FlameClient.setLString("modules.jumpspeed", lc.de_DE, "HasenTempo"); //Why not using bunnyspeed? :)883FlameClient.setLString("modules.autojump", lc.de_DE, "Automatisches\nSpringen");884FlameClient.setLString("modules.dolphin", lc.de_DE, "Wasserlauf");885FlameClient.setLString("modules.flight", lc.de_DE, "Fliegen");886FlameClient.setLString("gm.survival", lc.de_DE, "Ã?berleben");887FlameClient.setLString("gm.creative", lc.de_DE, "Kreativ");888FlameClient.setLString("moduletype.mod", lc.de_DE, "Mod");889FlameClient.setLString("moduletype.special", lc.de_DE, "Spezielles");890FlameClient.setLString("moduletype.command", lc.de_DE, "Befehl");891FlameClient.setLString("moddialog.description", lc.de_DE, "Beschreibung");892FlameClient.setLString("moddialog.type", lc.de_DE, "Typ");893 894FlameClient.getL = function () {895 //Todo896 return l[1];897}898 899FlameClient.getLString = function (code) {900 var str = code;901 l[0].forEach(function (entry, index, array) {902 903 if(entry.toLowerCase()904 .indexOf(code.toLowerCase()) > -1) {905 try {906 str = FlameClient.getL()[index];907 } catch(e) {908 try {909 str = l[1][index];910 } catch(e) {911 FlameClient.ctoast(e);912 }913 }914 }915 });916 return str;917}918FlameClient.cmsg = function (text) {919 clientMessage(ChatColor.GREEN + "[" + ChatColor.RED + "Flame" + ChatColor.GOLD + "Client" + ChatColor.GREEN + "]" + ChatColor.GRAY + ": " + ChatColor.YELLOW + text);920}921FlameClient.ctoast = function (text, showPrefix) {922 try {923 var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();924 ctx.runOnUiThread(new java.lang.Runnable({925 run: function () {926 var thetoast = android.widget.Toast.makeText(com.mojang.minecraftpe.MainActivity.currentMainActivity.get(), "" + text, android.widget.Toast.LENGTH_LONG);927 var layout = new android.widget.LinearLayout(ctx);928 var msg = new android.widget.TextView(ctx);929 if(showPrefix || showPrefix == null) text = "FlameClient: " + text;930 msg.setText(text);931 msg.setGravity(android.view.Gravity.CENTER);932 msg.setTextSize(20);933 msg.setPadding(10, 10, 10, 10);934 msg.setTextColor(android.graphics.Color.YELLOW);935 var bg = new android.graphics.drawable.GradientDrawable();936 bg.setColor(android.graphics.Color.argb(150, 50, 50, 50));937 bg.setStroke(dip2px(5), android.graphics.Color.argb(200, 5, 5, 5));938 bg.setCornerRadius(dip2px(20));939 layout.addView(msg);940 layout.setBackground(bg);941 thetoast.setView(layout);942 thetoast.show();943 }944 }));945 } catch(e) {946 print(e);947 }948}949FlameClient.loadModsAnim = function (progress) {950 ctx.runOnUiThread(new java.lang.Runnable({951 run: function () {952 new android.os.Handler()953 .postDelayed(new java.lang.Runnable({954 run: function () {955 ModPE.langEdit("menu.copyright", ChatColor.RED + "Flame" + ChatColor.GOLD + "Client: " + ChatColor.WHITE + progress + " Modules loaded");956 if(progress < Utils.modsCount) FlameClient.loadModsAnim(progress + 1);957 }958 }), 100);959 }960 }));961}962FlameClient.getStyledBackground = function () {963 var bg = new android.graphics.drawable.GradientDrawable();964 bg.setCornerRadius(1);965 bg.setColor(android.graphics.Color.argb(90, 255, 255, 255));966 bg.setShape(android.graphics.drawable.GradientDrawable.RECTANGLE);967 bg.setStroke(dip2px(2), android.graphics.Color.argb(210, 0, 0, 0));968 return bg;969}970FlameClient.getStyledBtnBackground = function (state, toggleable) {971 var bg = android.graphics.drawable.GradientDrawable();972 bg.setCornerRadius(1);973 bg.setColor(android.graphics.Color.argb(80, 0, 0, 0));974 if(state) bg.setColor(android.graphics.Color.argb(210, 255, 255, 0));975 if(toggleable == false) bg.setColor(android.graphics.Color.argb(210, 226, 88, 34));976 bg.setShape(android.graphics.drawable.GradientDrawable.RECTANGLE);977 bg.setStroke(dip2px(2), android.graphics.Color.argb(230, 255, 88, 34));978 return bg;979}980 981FlameClient.showModDialog = function (mod) {982 ctx.runOnUiThread(new java.lang.Runnable( {983 run: function () {984 try {985 var display = new android.util.DisplayMetrics();986 com.mojang.minecraftpe.MainActivity.currentMainActivity.get()987 .getWindowManager()988 .getDefaultDisplay()989 .getMetrics(display);990 var content = new android.widget.RelativeLayout(ctx);991 content.setId(9472729);992 var contentScroll = new android.widget.ScrollView(ctx);993 contentScroll.setId(492628);994 //default content995 var modTitle = new android.widget.TextView(ctx);996 modTitle.setText(android.text.Html.fromHtml("<u>" + mod.name + "</u>"));997 modTitle.setTextSize(dip2px(20));998 modTitle.setGravity(android.view.Gravity.CENTER);999 modTitle.setTextColor(android.graphics.Color.YELLOW);1000 modTitle.setTypeface(Utils.font);1001 modTitle.setId(94771);1002 var modTypeText = new android.widget.TextView(ctx);1003 modTypeText.setText(FlameClient.getLString("moddialog.type") + ": " + ModuleType.toName(mod.type));1004 modTypeText.setGravity(android.view.Gravity.CENTER);1005 modTypeText.setTextColor(android.graphics.Color.YELLOW);1006 modTypeText.setTextSize(dip2px(10));1007 modTypeText.setTypeface(Utils.font);1008 modTypeText.setId(93922);1009 var modDescTitle = new android.widget.TextView(ctx);1010 modDescTitle.setText(FlameClient.getLString("moddialog.description") + ":");1011 modDescTitle.setGravity(android.view.Gravity.CENTER);1012 modDescTitle.setTextColor(android.graphics.Color.YELLOW);1013 modDescTitle.setTextSize(dip2px(11));1014 modDescTitle.setTypeface(Utils.font);1015 modDescTitle.setId(29582);1016 var modDescText = new android.widget.TextView(ctx);1017 modDescText.setText(mod.desc);1018 modDescText.setGravity(android.view.Gravity.CENTER);1019 modDescText.setTextSize(dip2px(10));1020 modDescText.setTypeface(Utils.font);1021 modDescText.setTextColor(android.graphics.Color.YELLOW);1022 modDescText.setId(29285);1023 //settings1024 var modSettings = new android.widget.LinearLayout(ctx);1025 modSettings.setOrientation(1);1026 if(mod.getSettingsLayout) {1027 //modSettings = mod.Layout();1028 var params = new android.widget.LinearLayout.LayoutParams(mwidth, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);1029 var line = new android.widget.TextView(ctx);1030 line.setText("");1031 var gradientLine = new android.graphics.drawable.GradientDrawable();1032 gradientLine.setShape(android.graphics.drawable.GradientDrawable.LINE);1033 gradientLine.setColor(android.graphics.Color.TRANSPARENT);1034 //gradientLine.setCornerRadius(dip2px(100));1035 gradientLine.setStroke(dip2px(1), android.graphics.Color.argb(50, 0, 0, 0));1036 line.setBackground(gradientLine);1037 line.setGravity(android.view.Gravity.CENTER);1038 modSettings.addView(line, params);1039 var settingText = new android.widget.TextView(ctx);1040 settingText.setText("Settings");1041 settingText.setGravity(android.view.Gravity.CENTER);1042 settingText.setTextColor(android.graphics.Color.YELLOW);1043 settingText.setTextSize(dip2px(11));1044 settingText.setTypeface(Utils.font);1045 modSettings.addView(settingText, params);1046 var extraParams = new android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);1047 modSettings.addView(mod.getSettingsLayout(extraParams));1048 //Im thinking about a line (html <hr> tag) and the layout underneath1049 }1050 //footer1051 var closeButton = new styledBtn();1052 closeButton.setText("Close");1053 closeButton.setPadding(0.5, closeButton.getPaddingTop(), 0.5, closeButton.getPaddingBottom());1054 closeButton.setId(10472);1055 closeButton.setTypeface(Utils.font);1056 closeButton.setTextColor(android.graphics.Color.YELLOW);1057 closeButton.setTypeface(Utils.font);1058 //layout alignement....1059 var dialogLayout = new android.widget.RelativeLayout(ctx);1060 dialogLayout.setBackgroundDrawable(FlameClient.getStyledBackground());1061 //dialogLayout.setGravity(android.view.Gravity.CENTER);1062 //dialogLayout.setOrientation(LinearLayout.VERTICAL);1063 var params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1064 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP);1065 dialogLayout.addView(modTitle, params);1066 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1067 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP);1068 content.addView(modTypeText, params);1069 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1070 params.addRule(android.widget.RelativeLayout.BELOW, modTypeText.getId());1071 content.addView(modDescTitle, params);1072 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1073 params.addRule(android.widget.RelativeLayout.BELOW, modDescTitle.getId());1074 content.addView(modDescText, params);1075 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1076 params.addRule(android.widget.RelativeLayout.BELOW, modDescText.getId());1077 content.addView(modSettings, params);1078 contentScroll.addView(content);1079 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1080 params.addRule(android.widget.RelativeLayout.BELOW, modTitle.getId());1081 params.addRule(android.widget.RelativeLayout.ABOVE, closeButton.getId());1082 contentScroll.setFillViewport(true);1083 dialogLayout.addView(contentScroll, params);1084 params = new android.widget.RelativeLayout.LayoutParams(mwidth, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1085 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_BOTTOM);1086 dialogLayout.addView(closeButton, params);1087 //Dialog Stuff1088 dialog = new android.app.Dialog(ctx);1089 dialog.requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);1090 dialog.getWindow()1091 .setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));1092 dialog.setContentView(dialogLayout);1093 dialog.setTitle(mod.name);1094 dialog.setOnDismissListener(new android.content.DialogInterface.OnDismissListener( {1095 onDismiss: function () {1096 showMenu();1097 }1098 }));1099 dialog.show();1100 var window = dialog.getWindow();1101 window.setLayout(mwidth, display.heightPixels);1102 closeButton.setOnClickListener(new android.view.View.OnClickListener( {1103 onClick: function (view) {1104 dialog.dismiss();1105 }1106 }));1107 } catch(e) {1108 FlameClient.ctoast("Error: " + e);1109 }1110 }1111 }));1112}1113 1114FlameClient.registerModule = function (module) {1115 Utils.modsCount += 1;1116 if(module.type == ModuleType.command) {1117 CommandManager.registerCommand(module);1118 } else {1119 FlameClient.mods.push(module);1120 }1121}1122var friendMgr = {1123 name: FlameClient.getLString("special.friend_manager"),1124 desc: "Friends wont be aimed while CombatMode or AimBowt (cant be used if player has Nickname or has VIP+ on his Nametag)",1125 type: ModuleType.special,1126 openFriendManager: function () {1127 ctx.runOnUiThread(new java.lang.Runnable( {1128 run: function () {1129 try {1130 var display = new android.util.DisplayMetrics();1131 com.mojang.minecraftpe.MainActivity.currentMainActivity.get()1132 .getWindowManager()1133 .getDefaultDisplay()1134 .getMetrics(display);1135 var refresh = function () {1136 list.removeAllViews();1137 for(var i = 0; i < FriendManager.all.length(); i++) {1138 var layout = new android.widget.RelativeLayout(ctx);1139 var params = new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1140 1141 var Fname = new android.widget.TextView(ctx);1142 Fname.setText(FriendManager.all.get(i));1143 Fname.setTypeface(Utils.font);1144 Fname.setTextColor(android.graphics.Color.YELLOW);1145 Fname.setTextSize(dip2px(13));1146 Fname.setPadding(10, 0, 10, 0);1147 Fname.setId(395957372);1148 1149 var del = new android.widget.Button(ctx);1150 del.setText("X");1151 del.setTypeface(Utils.font);1152 del.setId(38473727);1153 del.setTextColor(android.graphics.Color.RED);1154 del.setOnClickListener(new android.view.View.OnClickListener( {1155 onClick: function (v) {1156 FlameClient.ctoast("Friend removed!");1157 FriendManager.removeFriend(v.getParent().getChildAt(0).getText().toString());1158 refresh();1159 }1160 }));1161 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP);1162 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_LEFT);1163 params.addRule(android.widget.RelativeLayout.LEFT_OF, del.getId());1164 params.addRule(android.widget.RelativeLayout.ALIGN_BOTTOM, del.getId());1165 layout.addView(Fname, params);1166 params = new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);1167 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_TOP);1168 1169 params.addRule(android.widget.RelativeLayout.ALIGN_PARENT_RIGHT);1170 //params.addRule(android.widget.RelativeLayout.RIGHT_OF, Fname.getId());1171 layout.addView(del, params);1172 list.addView(layout);1173 }1174 };1175 var content = new android.widget.LinearLayout(ctx);1176 content.setId(9472729);1177 content.setOrientation(1);1178 var contentScroll = new android.widget.ScrollView(ctx);1179 contentScroll.setId(492628);1180 1181 FriendManager.loadFromFile();1182 //default content1183 var title = new android.widget.TextView(ctx);1184 //modTitle.setText(android.text.Html.fromHtml("<u>" + mod.name + "</u>"));1185 title.setText(FlameClient.getLString("special.friend_manager"));1186 title.setTextSize(dip2px(20));1187 title.setGravity(android.view.Gravity.CENTER);1188 title.setTextColor(android.graphics.Color.YELLOW);1189 title.setTypeface(Utils.font);1190 title.setId(94771);1191 //content1192 var adder = new android.widget.RelativeLayout(ctx);1193 var name = new android.widget.EditText(ctx);1194 name.setId(29382829);1195 name.setHint("Name of your Friend");1196 name.setTypeface(Utils.font);1197 name.setTextColor(android.graphics.Color.YELLOW);1198 var addBtn = new android.widget.Button(ctx);1199 addBtn.setId(9452111);1200 addBtn.setTypeface(Utils.font);