public static void checkNPCMovement() { IEnumerator enumerator; IEnumerator enumerator2; ArrayList list = new ArrayList(); try { enumerator = Module1.displayNPCs.GetEnumerator(); while (enumerator.MoveNext()) { NPCShip current = (NPCShip)enumerator.Current; if (current.getMoving()) { if ((DateTime.Now.Millisecond - current.getTime().Millisecond) >= current.getMoveTime()) { current.setMoving(false); list.Add(current); } } else { list.Add(current); } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } try { enumerator2 = list.GetEnumerator(); while (enumerator2.MoveNext()) { NPCShip ship2 = (NPCShip)enumerator2.Current; int num2 = (int)Math.Round((double)(ship2.getPosX() + rnd.Next(-100, 100))); int num3 = (int)Math.Round((double)(ship2.getPosY() + rnd.Next(-100, 100))); int num = (int)Math.Round(Math.Sqrt(((num2 - Module1.mainHero.getPosX()) * (num2 - Module1.mainHero.getPosX())) + ((num3 - Module1.mainHero.getPosY()) * (num3 - Module1.mainHero.getPosY())))); int time = (int)Math.Round((double)(((double)num) / (((double)ship2.getSpeed()) / 1000.0))); sendNPCMove(ship2.getUserID(), (double)num2, (double)num3, time); ship2.setPosX((double)num2); ship2.setPosY((double)num3); ship2.setMoving(true); ship2.setTime(DateTime.Now); ship2.setMoveTime(time); NPCShip ship3 = mainFunctions.getNPCByID(ship2.getUserID()); } } finally { if (enumerator2 is IDisposable) { (enumerator2 as IDisposable).Dispose(); } } }
public static void checkOutRange(double heroX, double heroY) { if (Module1.displayNPCs.Count != 0) { ArrayList list = new ArrayList(); int num7 = Module1.displayNPCs.Count - 1; for (int i = 0; i <= num7; i++) { NPCShip ship = mainFunctions.getNPCByID(Conversions.ToInteger(Module1.displayNPCs[i])); double num3 = ship.getPosX(); double num4 = ship.getPosY(); double num = heroX - num3; if ((num < -1500.0) | (num > 1500.0)) { list.Add(ship); } else { double num5 = heroY - num4; if ((num5 < -1500.0) | (num5 > 1500.0)) { list.Add(ship); } } } int num8 = list.Count - 1; for (int j = 0; j <= num8; j++) { initConnection.removeNPCClient((NPCShip)list[j]); Module1.displayNPCs.Remove(((NPCShip)list[j]).getUserID()); } } }
public static void NPCAttackHero() { NPCShip ship = mainFunctions.getNPCByID(npcAttackID); double num13 = ship.getPosX(); double num14 = ship.getPosY(); double num6 = Module1.mainHero.getPosX(); double num7 = Module1.mainHero.getPosY(); double num = num6 - num13; double num2 = num7 - num14; if ((!((num > 500.0) | (num < -500.0)) && !((num2 > 500.0) | (num2 < -500.0))) && !initConnection.heroEMP) { double num8; int num9; int num10; if (initConnection.heroInsta) { num10 = 0; num9 = 0; } else { num10 = ship.getMinDMG(); num9 = ship.getMaxDMG(); } if (Module1.mainHero.getShield() <= 0) { Module1.mainHero.setShield(0, Module1.mainHero.getMaxHP()); num8 = 1.0; } else { num8 = 0.1; } double num15 = 1.0 - num8; int dmgDone = rnd.Next(num10, num9); int num4 = (int)Math.Round((double)(dmgDone * num8)); int num5 = (int)Math.Round((double)(dmgDone * num15)); int attackedHP = Module1.mainHero.getHP() - num4; int attackedSHD = Module1.mainHero.getShield() - num5; initConnection.sendHeroAttack(npcAttackID, 0, 1, 0); initConnection.updateHeroAttackLasers(npcAttackID, attackedHP, attackedSHD, dmgDone); Module1.mainHero.setHP(attackedHP, Module1.mainHero.getMaxHP()); Module1.mainHero.setShield(attackedSHD, Module1.mainHero.getMaxShield()); } }
public static void checkNPCInRange(int heroX, int heroY) { ArrayList list = new ArrayList(); int num6 = mainFunctions.getNPCCount() - 1; for (int i = 0; i <= num6; i++) { NPCShip ship = mainFunctions.getNPC(i); double num3 = ship.getPosX(); double num4 = ship.getPosY(); double num = heroX - num3; if ((num > -1500.0) & (num < 1500.0)) { double num5 = heroY - num4; if ((num5 > -1500.0) & (num5 < 1500.0)) { list.Add(ship); } } } if (list.Count != 0) { IEnumerator enumerator; try { enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { NPCShip current = (NPCShip)enumerator.Current; if (!checkForDoubleNPC(current.getUserID())) { initConnection.createNPC(current.getUserID(), current.getPosX(), current.getPosY(), current.getShipType(), current.getUsername()); Module1.displayNPCs.Add(current.getUserID()); } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } } }
public static void NPCMove1(int speed) { NPCShip ship = mainFunctions.getNPCByID(npcAttackID); if (!(npcUpdatePosX == -1.0)) { ship.setPosX(npcUpdatePosX); ship.setPosY(npcUpdatePosY); } double num = ship.getPosX(); double num2 = ship.getPosY(); double num5 = Module1.mainHero.getPosX(); double num6 = Module1.mainHero.getPosY(); double num7 = num; double num8 = num2; bool flag = false; double num3 = num5 - num; if (num3 < 0.0) { if (num3 < -100.0) { flag = true; } else { flag = false; num3 = 0.0; } } else if (num3 > 100.0) { flag = true; } else { flag = false; num3 = 0.0; } double num4 = num6 - num2; if (num4 < 0.0) { if (num4 < -100.0) { flag = true; } else { flag = false; num4 = 0.0; } } else if (num4 > 100.0) { flag = true; } else { flag = false; num4 = 0.0; } if (flag) { double num9 = Math.Abs(num3); double num10 = Math.Abs(num4); if (num9 > num10) { if (num3 < 0.0) { num7 = num - speed; num8 = num2; initConnection.sendPacket("0|1|" + Conversions.ToString(npcAttackID) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } else { num7 = num + speed; num8 = num2; initConnection.sendPacket("0|1|" + Conversions.ToString(npcAttackID) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } } else if (num4 < 0.0) { num7 = num; num8 = num2 - speed; initConnection.sendPacket("0|1|" + Conversions.ToString(npcAttackID) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } else { num7 = num; num8 = num2 + speed; initConnection.sendPacket("0|1|" + Conversions.ToString(npcAttackID) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } } npcUpdatePosX = num7; npcUpdatePosY = num8; }
public static bool heroAttackNPC() { NPCShip ship = mainFunctions.getNPCByID(npcAttackID); double num15 = ship.getPosX(); double num16 = ship.getPosY(); double num7 = Module1.mainHero.getPosX(); double num8 = Module1.mainHero.getPosY(); double num2 = num7 - num15; double num3 = num8 - num16; if (!((num2 > 800.0) | (num2 < -800.0))) { double num9; if ((num3 > 800.0) | (num3 < -800.0)) { return(false); } int num17 = Module1.mainHero.getAmmoType(); switch (num17) { case 1: if (Module1.mainHero.getLaserAmmo1() <= 0) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; case 2: if (Module1.mainHero.getLaserAmmo2() <= 0) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; case 3: if (Module1.mainHero.getLaserAmmo3() <= 0) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; case 4: if (Module1.mainHero.getLaserAmmo4() <= 0) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; case 5: if (Module1.mainHero.getLaserAmmo5() <= 0) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; default: if ((num17 == 6) && (Module1.mainHero.getLaserAmmo1() <= 0)) { mainFunctions.log("Not enough ammo to carry out attack..."); return(false); } break; } int amount = Module1.mainHero.getLF3s(); int num = Module1.mainHero.getBO2s(); int maxValue = amount * 150; int minValue = amount * 0x7d; if (ship.getSHD() <= 0) { ship.setSHD(0); num9 = 1.0; } else { num9 = 0.4; } double num18 = 1.0 - num9; int dmgDone = rnd.Next(minValue, maxValue); if (Module1.mainHero.getAmmoType() == 2) { dmgDone *= 2; } else if (Module1.mainHero.getAmmoType() == 3) { dmgDone *= 3; } else if (Module1.mainHero.getAmmoType() == 4) { dmgDone *= 4; } int num5 = (int)Math.Round((double)(dmgDone * num9)); int num6 = (int)Math.Round((double)(dmgDone * num18)); int attackedHP = ship.getHP() - num5; int attackedSHD = ship.getSHD() - num6; if (dmgDone > (ship.getHP() + ship.getSHD())) { initConnection.sendAttack(npcAttackID, Module1.mainHero.getAmmoType() - 1, 0, 1); initConnection.updateAttackLasers(npcAttackID, 0, 0, dmgDone); ammoHandler(Module1.mainHero.getAmmoType(), amount, false); ship.setHP(0); ship.setSHD(0); return(true); } initConnection.sendAttack(npcAttackID, Module1.mainHero.getAmmoType() - 1, 0, 1); initConnection.updateAttackLasers(npcAttackID, attackedHP, attackedSHD, dmgDone); ammoHandler(Module1.mainHero.getAmmoType(), amount, false); ship.setHP(attackedHP); ship.setSHD(attackedSHD); } return(false); }
public static void heroSbombd(double heroX, double heroY) { IEnumerator enumerator; try { enumerator = Module1.displayNPCs.GetEnumerator(); while (enumerator.MoveNext()) { int userID = Conversions.ToInteger(enumerator.Current); NPCShip ship = mainFunctions.getNPCByID(userID); double num13 = ship.getPosX(); double num14 = ship.getPosY(); double num11 = heroX - num13; double num12 = heroY - num14; num11 = Math.Abs(num11); num12 = Math.Abs(num12); if ((num11 < 1000.0) && (num12 < 1000.0)) { int num17 = ship.getMaxHP(); int num16 = ship.getHP(); int dmgDone = (int)Math.Round((double)(num17 * 0.2)); if (dmgDone > num16) { initConnection.updateAttackLasers(userID, 0, 0, dmgDone); ship.setHP(0); ship.setSHD(0); if (Module1.accessingNPCs) { while (true) { if (!Module1.accessingNPCs) { Module1.accessingNPCs = true; string str = ""; string str4 = ""; string str2 = ""; string str3 = ""; Attack_Module.getRewards(ship.getShipType(), ref str, ref str4, ref str2, ref str3); initConnection.destroyNPC(userID); mainFunctions.removeNPCByID(userID); Module1.displayNPCs.Remove(userID); Attack_Module.NPCDead(Conversions.ToInteger(str), Conversions.ToInteger(str4), Conversions.ToInteger(str2), Conversions.ToInteger(str3)); mainFunctions.log("NPC dead..."); Module1.accessingNPCs = false; continue; } } } Module1.accessingNPCs = true; string credits = ""; string uridium = ""; string ep = ""; string honor = ""; Attack_Module.getRewards(userID, ref credits, ref uridium, ref ep, ref honor); initConnection.destroyNPC(userID); mainFunctions.removeNPCByID(userID); Module1.displayNPCs.Remove(userID); Attack_Module.NPCDead(Conversions.ToInteger(credits), Conversions.ToInteger(uridium), Conversions.ToInteger(ep), Conversions.ToInteger(honor)); mainFunctions.log("NPC dead..."); Module1.accessingNPCs = false; } else { int attackedHP = num16 - dmgDone; initConnection.updateAttackLasers(userID, attackedHP, ship.getSHD(), dmgDone); ship.setHP(attackedHP); } } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } int num2 = Module1.mainHero.getRocketAmmo1(); int num3 = Module1.mainHero.getRocketAmmo2(); int num4 = Module1.mainHero.getRocketAmmo3(); int num5 = Module1.mainHero.getRocketAmmo4(); int num6 = Module1.mainHero.getRocketAmmo5(); int num7 = Module1.mainHero.getRocketAmmo6(); int num8 = Module1.mainHero.getRocketAmmo7(); int num9 = Module1.mainHero.getRocketAmmo8(); int num10 = Module1.mainHero.getRocketAmmo9(); num8--; initConnection.sendPacket("0|3|" + Conversions.ToString(num2) + "|" + Conversions.ToString(num3) + "|" + Conversions.ToString(num4) + "|" + Conversions.ToString(num5) + "|" + Conversions.ToString(num6) + "|0|0|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|" + Conversions.ToString(num9) + "|" + Conversions.ToString(num10) + "|0|0|0"); Module1.mainHero.setRocketAmmo(num2, num3, num4, num5, num6, num7, num8, num9, num10); new Thread(new ThreadStart(Mine_Module.heroSbombCooldown)).Start(); }
public static void NPCMove1() { IEnumerator enumerator; try { enumerator = Module1.displayNPCs.GetEnumerator(); while (enumerator.MoveNext()) { NPCShip ship = mainFunctions.getNPCByID(Conversions.ToInteger(enumerator.Current)); double num = ship.getPosX(); double num2 = ship.getPosY(); double num5 = Module1.mainHero.getPosX(); double num6 = Module1.mainHero.getPosY(); double num7 = num; double num8 = num2; bool flag = false; double num3 = num5 - num; if (num3 < 0.0) { if (num3 < -100.0) { flag = true; } else { flag = false; num3 = 0.0; } } else if (num3 > 100.0) { flag = true; } else { flag = false; num3 = 0.0; } double num4 = num6 - num2; if (num4 < 0.0) { if (num4 < -100.0) { flag = true; } else { flag = false; num4 = 0.0; } } else if (num4 > 100.0) { flag = true; } else { flag = false; num4 = 0.0; } if (flag) { double num10 = Math.Abs(num3); double num11 = Math.Abs(num4); if (num10 > num11) { if (num3 < 0.0) { num7 = num - ship.getSpeed(); num8 = num2; initConnection.sendPacket("0|1|" + Conversions.ToString(ship.getUserID()) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } else { num7 = num + ship.getSpeed(); num8 = num2; initConnection.sendPacket("0|1|" + Conversions.ToString(ship.getUserID()) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } } else if (num4 < 0.0) { num7 = num; num8 = num2 - ship.getSpeed(); initConnection.sendPacket("0|1|" + Conversions.ToString(ship.getUserID()) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } else { num7 = num; num8 = num2 + ship.getSpeed(); initConnection.sendPacket("0|1|" + Conversions.ToString(ship.getUserID()) + "|" + Conversions.ToString(num7) + "|" + Conversions.ToString(num8) + "|1000"); } } ship.setPosX(num7); ship.setPosY(num8); } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } }