Exemplo n.º 1
0
        public Ship getClosestNPC(ref Hero hero, ref SpaceStation ss, ref Portals portals, ArrayList NPCsToExclude, bool[] clb, string[] NPCsNames, double maxdistance)
        {
            ArrayList list = new ArrayList();
            int       num8 = clb.Count <bool>() - 1;

            for (int i = 0; i <= num8; i++)
            {
                if (clb[i])
                {
                    list.Add(NPCsNames[i]);
                }
            }
            if (list.Count > 0)
            {
                ArrayList list2 = new ArrayList();
                int       num9  = list.Count - 1;
                for (int j = 0; j <= num9; j++)
                {
                    int num10 = this.ships.Count - 1;
                    for (int k = 0; k <= num10; k++)
                    {
                        Ship ship2 = (Ship)this.ships[k];
                        if (((ship2.getIsNPC() && !ship2.getTaken()) && ship2.getUsername().Equals(Conversions.ToString(list[j]))) && !this.isExcludedID(ship2.getID(), NPCsToExclude))
                        {
                            list2.Add(ship2);
                        }
                    }
                }
                if (list2.Count > 0)
                {
                    Ship ship3;
                    if (list2.Count == 1)
                    {
                        ship3 = (Ship)list2[0];
                    }
                    else
                    {
                        ship3 = (Ship)list2[0];
                        double num4  = this._getDistance(hero.getPosX(), hero.getPosY(), ship3.getPosX(), ship3.getPosY());
                        int    num11 = list2.Count - 1;
                        for (int m = 0; m <= num11; m++)
                        {
                            Ship   ship4 = (Ship)list2[m];
                            double num6  = this._getDistance(hero.getPosX(), hero.getPosY(), ship4.getPosX(), ship4.getPosY());
                            if (!(Math.Min(num4, num6) == num4))
                            {
                                ship3 = ship4;
                                num4  = num6;
                            }
                        }
                    }
                    if ((!this.isExcludedID(ship3.getID(), NPCsToExclude) && (Math.Sqrt(this._getDistance(hero.getPosX(), hero.getPosY(), ship3.getPosX(), ship3.getPosY())) < maxdistance)) && (Conversions.ToBoolean(Operators.NotObject(this.isCloseToSpaceStation(ship3, ss))) && !this.isCloseToPortal(ship3, portals)))
                    {
                        return(ship3);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
 public Ship getClosestNPC(ref Hero hero, ref SpaceStation ss, ref Portals portals, ArrayList NPCsToExclude, bool[] clb, string[] NPCsNames, double maxdistance)
 {
     ArrayList list = new ArrayList();
     int num8 = clb.Count<bool>() - 1;
     for (int i = 0; i <= num8; i++)
     {
         if (clb[i])
         {
             list.Add(NPCsNames[i]);
         }
     }
     if (list.Count > 0)
     {
         ArrayList list2 = new ArrayList();
         int num9 = list.Count - 1;
         for (int j = 0; j <= num9; j++)
         {
             int num10 = this.ships.Count - 1;
             for (int k = 0; k <= num10; k++)
             {
                 Ship ship2 = (Ship) this.ships[k];
                 if (((ship2.getIsNPC() && !ship2.getTaken()) && ship2.getUsername().Equals(Conversions.ToString(list[j]))) && !this.isExcludedID(ship2.getID(), NPCsToExclude))
                 {
                     list2.Add(ship2);
                 }
             }
         }
         if (list2.Count > 0)
         {
             Ship ship3;
             if (list2.Count == 1)
             {
                 ship3 = (Ship) list2[0];
             }
             else
             {
                 ship3 = (Ship) list2[0];
                 double num4 = this._getDistance(hero.getPosX(), hero.getPosY(), ship3.getPosX(), ship3.getPosY());
                 int num11 = list2.Count - 1;
                 for (int m = 0; m <= num11; m++)
                 {
                     Ship ship4 = (Ship) list2[m];
                     double num6 = this._getDistance(hero.getPosX(), hero.getPosY(), ship4.getPosX(), ship4.getPosY());
                     if (!(Math.Min(num4, num6) == num4))
                     {
                         ship3 = ship4;
                         num4 = num6;
                     }
                 }
             }
             if ((!this.isExcludedID(ship3.getID(), NPCsToExclude) && (Math.Sqrt(this._getDistance(hero.getPosX(), hero.getPosY(), ship3.getPosX(), ship3.getPosY())) < maxdistance)) && (Conversions.ToBoolean(Operators.NotObject(this.isCloseToSpaceStation(ship3, ss))) && !this.isCloseToPortal(ship3, portals)))
             {
                 return ship3;
             }
         }
     }
     return null;
 }
Exemplo n.º 3
0
 public object isCloseToSpaceStation(Ship s, SpaceStation ss)
 {
     return ((ss.getID() != -1) && (Math.Sqrt(this._getDistance(s.getPosX(), s.getPosY(), (double) ss.getPosX(), (double) ss.getPosY())) < 1500.0));
 }
Exemplo n.º 4
0
 public object isCloseToSpaceStation(Ship s, SpaceStation ss)
 {
     return((ss.getID() != -1) && (Math.Sqrt(this._getDistance(s.getPosX(), s.getPosY(), (double)ss.getPosX(), (double)ss.getPosY())) < 1500.0));
 }