示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            StationDestination stationDestination = db.StationDestinations.Find(id);

            db.StationDestinations.Remove(stationDestination);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "StationDestinationID,StationLocationID,DestinationID,MidPointID")] StationDestination stationDestination)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stationDestination).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MidPointID        = new SelectList(db.MidPoints, "MidPointID", "MidPointName", stationDestination.MidPointID);
     ViewBag.DestinationID     = new SelectList(db.Destinations, "DestinationID", "DestinationName", stationDestination.DestinationID);
     ViewBag.StationLocationID = new SelectList(db.StationLocations, "StationLocationID", "StationName", stationDestination.StationLocationID);
     return(View(stationDestination));
 }
示例#3
0
        // GET: StationDestinations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StationDestination stationDestination = db.StationDestinations.Find(id);

            if (stationDestination == null)
            {
                return(HttpNotFound());
            }
            return(View(stationDestination));
        }
        public ActionResult Add([Bind(Include = "StationDestinationID,StationLocationID,DestinationID")] StationDestination stationDestination)
        {
            if (ModelState.IsValid)
            {
                db.StationDestinations.Add(stationDestination);
                db.SaveChanges();
                TempData["Success"] = "Successfully Added.";
                return(RedirectToAction("Add"));
            }

            ViewBag.DestinationID     = new SelectList(db.Destinations, "DestinationID", "DestinationName", stationDestination.DestinationID);
            ViewBag.StationLocationID = new SelectList(db.StationLocations, "StationLocationID", "StationName", stationDestination.StationLocationID);
            return(View(stationDestination));
        }
示例#5
0
        // GET: StationDestinations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StationDestination stationDestination = db.StationDestinations.Find(id);

            if (stationDestination == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MidPointID        = new SelectList(db.MidPoints, "MidPointID", "MidPointName", stationDestination.MidPointID);
            ViewBag.DestinationID     = new SelectList(db.Destinations.OrderBy(s => s.DestinationName), "DestinationID", "DestinationName", stationDestination.DestinationID);
            ViewBag.StationLocationID = new SelectList(db.StationLocations.OrderBy(s => s.StationName), "StationLocationID", "StationName", stationDestination.StationLocationID);
            return(View(stationDestination));
        }
示例#6
0
 private void TravelToAgentsStation()
 {
     try
     {
         StationDestination baseDestination = Traveler.Destination as StationDestination;
         if (baseDestination == null || baseDestination.StationId != Cache.Instance.Agent.StationId)
         {
             Traveler.Destination = new StationDestination(Cache.Instance.Agent.SolarSystemId,
                                                           Cache.Instance.Agent.StationId,
                                                           Cache.Instance.DirectEve.GetLocationName(
                                                               Cache.Instance.Agent.StationId));
         }
     }
     catch (Exception ex)
     {
         Logging.Log("DebugHangarsBehavior", "TravelToAgentsStation: Exception caught: [" + ex.Message + "]", Logging.Red);
         return;
     }
     if (Cache.Instance.InSpace)
     {
         if (!Cache.Instance.ActiveShip.Entity.IsCloaked || (Cache.Instance.LastSessionChange.AddSeconds(60) > DateTime.UtcNow))
         {
             Combat.ProcessState();
             Drones.ProcessState(); //do we really want to use drones here?
         }
     }
     if (Cache.Instance.InSpace && !Cache.Instance.TargetedBy.Any(t => t.IsWarpScramblingMe))
     {
         Cache.Instance.IsMissionPocketDone = true; //tells drones.cs that we can pull drones
         //Logging.Log("CombatmissionBehavior","TravelToAgentStation: not pointed",Logging.White);
     }
     Traveler.ProcessState();
     if (Settings.Instance.DebugStates)
     {
         Logging.Log("Traveler.State", "is " + _States.CurrentTravelerState, Logging.White);
     }
 }
示例#7
0
        public void OnFrame(object sender, EventArgs e)
        {
            if (!DirectEve.Instance.Session.IsReady)
            {
                return;
            }

            InitializeTraveler();

            if (lpstoreRe)
            {
                ResfreshLPI();
            }

            if (RequiredCom)
            {
                Required();
            }

            Text = "Questor Manager [" + DirectEve.Instance.Me.Name + "]";


            if (Paused)
            {
                return;
            }

            switch (State)
            {
            case State.Idle:

                if (Start)
                {
                    Logging.Log("Traveler: Start");
                    State = State.NextAction;
                }

                break;

            case State.NextAction:

                if (DateTime.Now.Subtract(_lastAction).TotalSeconds < 3)
                {
                    break;
                }

                if (LstTask.Items.Count <= 0)
                {
                    Logging.Log("Traveler: Finish");
                    LblStatus.Text = "Finish";
                    BttnStart.Text = "Start";
                    State          = State.Idle;
                    Start          = false;
                    break;
                }


                if ("Traveler" == LstTask.Items[0].Text)
                {
                    _destination = LstTask.Items[0].Tag;
                    State        = State.Traveler;
                    break;
                }

                if ("CmdLine" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.CmdLine;
                    break;
                }

                if ("BuyLPI" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.BuyLPI;
                    break;
                }

                if ("ValueDump" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.ValueDump;
                    break;
                }

                if ("MakeShip" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.MakeShip;
                    break;
                }

                if ("Drop" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.Drop;
                    break;
                }

                if ("Grab" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.Grab;
                    break;
                }

                if ("Buy" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.Buy;
                    break;
                }

                if ("Sell" == LstTask.Items[0].Text)
                {
                    LblStatus.Text = LstTask.Items[0].Text + ":-:" + LstTask.Items[0].SubItems[1].Text;
                    State          = State.Sell;
                    break;
                }

                break;


            case State.CmdLine:

                Logging.Log("CmdLine: " + LstTask.Items[0].SubItems[1].Text);
                LavishScript.ExecuteCommand(LstTask.Items[0].SubItems[1].Text);
                LstTask.Items.Remove(LstTask.Items[0]);
                _lastAction = DateTime.Now;
                State       = State.NextAction;

                break;


            case State.BuyLPI:


                if (_buylpi.State == StateBuyLPI.Idle)
                {
                    _buylpi.Item = Convert.ToInt32(LstTask.Items[0].Tag);
                    _buylpi.Unit = Convert.ToInt32(LstTask.Items[0].SubItems[2].Text);
                    Logging.Log("BuyLPI: Begin");
                    _buylpi.State = StateBuyLPI.Begin;
                }


                _buylpi.ProcessState();


                if (_buylpi.State == StateBuyLPI.Done)
                {
                    Logging.Log("BuyLPI: Done");
                    _buylpi.State = StateBuyLPI.Idle;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }

                break;


            case State.ValueDump:


                if (chkUpdateMineral.Checked)
                {
                    chkUpdateMineral.Checked = false;
                    _valuedump.State         = ValueDumpState.CheckMineralPrices;
                }


                if (_valuedump.State == ValueDumpState.Idle)
                {
                    Logging.Log("ValueDump: Begin");
                    _valuedump.State = ValueDumpState.Begin;
                }


                _valuedump.ProcessState();


                if (_valuedump.State == ValueDumpState.Done)
                {
                    Logging.Log("ValueDump: Done");
                    _valuedump.State = ValueDumpState.Idle;
                    ProcessItems();
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }

                break;

            case State.MakeShip:

                var shipHangar = DirectEve.Instance.GetShipHangar();
                if (shipHangar.Window == null)
                {
                    // No, command it to open
                    DirectEve.Instance.ExecuteCommand(DirectCmd.OpenShipHangar);
                    break;
                }

                if (!shipHangar.IsReady)
                {
                    break;
                }

                var ships = DirectEve.Instance.GetShipHangar().Items;
                foreach (var ship in ships.Where(ship => ship.GivenName == txtNameShip.Text))
                {
                    Logging.Log("MakeShip: Making [" + ship.GivenName + "] active");

                    ship.ActivateShip();
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                    break;
                }


                break;


            case State.Buy:


                if (_buy.State == StateBuy.Idle)
                {
                    _buy.Item = Convert.ToInt32(LstTask.Items[0].Tag);
                    _buy.Unit = Convert.ToInt32(LstTask.Items[0].SubItems[2].Text);
                    Logging.Log("Buy: Begin");
                    _buy.State = StateBuy.Begin;
                }


                _buy.ProcessState();


                if (_buy.State == StateBuy.Done)
                {
                    Logging.Log("Buy: Done");
                    _buy.State = StateBuy.Idle;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }

                break;

            case State.Sell:

                _sell.Item = Convert.ToInt32(LstTask.Items[0].Tag);
                _sell.Unit = Convert.ToInt32(LstTask.Items[0].SubItems[2].Text);

                if (_sell.State == StateSell.Idle)
                {
                    Logging.Log("Sell: Begin");
                    _sell.State = StateSell.Begin;
                }

                _sell.ProcessState();


                if (_sell.State == StateSell.Done)
                {
                    Logging.Log("Sell: Done");
                    _sell.State = StateSell.Idle;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }
                break;

            case State.Drop:

                _drop.Item   = Convert.ToInt32(LstTask.Items[0].Tag);
                _drop.Unit   = Convert.ToInt32(LstTask.Items[0].SubItems[2].Text);
                _drop.Hangar = LstTask.Items[0].SubItems[3].Text;

                if (_drop.State == StateDrop.Idle)
                {
                    Logging.Log("Drop: Begin");
                    _drop.State = StateDrop.Begin;
                }

                _drop.ProcessState();


                if (_drop.State == StateDrop.Done)
                {
                    Logging.Log("Drop: Done");
                    _drop.State = StateDrop.Idle;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }


                break;

            case State.Grab:

                _grab.Item   = Convert.ToInt32(LstTask.Items[0].Tag);
                _grab.Unit   = Convert.ToInt32(LstTask.Items[0].SubItems[2].Text);
                _grab.Hangar = LstTask.Items[0].SubItems[3].Text;


                if (_grab.State == StateGrab.Idle)
                {
                    Logging.Log("Grab: Begin");
                    _grab.State = StateGrab.Begin;
                }

                _grab.ProcessState();


                if (_grab.State == StateGrab.Done)
                {
                    Logging.Log("Grab: Done");
                    _grab.State = StateGrab.Idle;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }

                break;

            case State.Traveler:


                // We are warping
                if (DirectEve.Instance.Session.IsInSpace && DirectEve.Instance.ActiveShip.Entity != null && DirectEve.Instance.ActiveShip.Entity.IsWarping)
                {
                    return;
                }

                var travelerDestination = _traveler.Destination;
                if (_destination == null)
                {
                    travelerDestination = null;
                }

                if (_destination is DirectBookmark)
                {
                    if (!(travelerDestination is BookmarkDestination) || (travelerDestination as BookmarkDestination).BookmarkId != (_destination as DirectBookmark).BookmarkId)
                    {
                        travelerDestination = new BookmarkDestination(_destination as DirectBookmark);
                    }
                }

                if (_destination is DirectSolarSystem)
                {
                    if (!(travelerDestination is SolarSystemDestination) || (travelerDestination as SolarSystemDestination).SolarSystemId != (_destination as DirectSolarSystem).Id)
                    {
                        travelerDestination = new SolarSystemDestination((_destination as DirectSolarSystem).Id);
                    }
                }

                if (_destination is DirectStation)
                {
                    if (!(travelerDestination is StationDestination) || (travelerDestination as StationDestination).StationId != (_destination as DirectStation).Id)
                    {
                        travelerDestination = new StationDestination((_destination as DirectStation).Id);
                    }
                }

                // Check to see if destination changed, since changing it will set the traveler to Idle
                if (_traveler.Destination != travelerDestination)
                {
                    _traveler.Destination = travelerDestination;
                }

                _traveler.ProcessState();

                // Record number of jumps
                _jumps = DirectEve.Instance.Navigation.GetDestinationPath().Count;

                // Arrived at destination
                if (_destination != null && _traveler.State == TravelerState.AtDestination)
                {
                    Logging.Log("Arived at destination");

                    _traveler.Destination = null;
                    _destination          = null;
                    LstTask.Items.Remove(LstTask.Items[0]);
                    _lastAction = DateTime.Now;
                    State       = State.NextAction;
                }

                // An error occured, reset traveler
                if (_traveler.State == TravelerState.Error)
                {
                    if (_traveler.Destination != null)
                    {
                        Logging.Log("Stopped traveling, Traveler threw an error...");
                    }

                    _destination          = null;
                    _traveler.Destination = null;
                    Start = false;
                    State = State.Idle;
                }
                break;
            }
        }
示例#8
0
        public void OnFrame(object sender, EventArgs e)
        {
            if (!DirectEve.Instance.Session.IsReady)
            {
                return;
            }

            InitializeTraveler();

            // We are warping
            if (DirectEve.Instance.Session.IsInSpace && DirectEve.Instance.ActiveShip.Entity != null && DirectEve.Instance.ActiveShip.Entity.IsWarping)
            {
                return;
            }

            var travelerDestination = _traveler.Destination;

            if (_destination == null)
            {
                travelerDestination = null;
            }

            if (_destination is DirectBookmark)
            {
                if (!(travelerDestination is BookmarkDestination) || (travelerDestination as BookmarkDestination).BookmarkId != (_destination as DirectBookmark).BookmarkId)
                {
                    travelerDestination = new BookmarkDestination(_destination as DirectBookmark);
                }
            }

            if (_destination is DirectSolarSystem)
            {
                if (!(travelerDestination is SolarSystemDestination) || (travelerDestination as SolarSystemDestination).SolarSystemId != (_destination as DirectSolarSystem).Id)
                {
                    travelerDestination = new SolarSystemDestination((_destination as DirectSolarSystem).Id);
                }
            }

            if (_destination is DirectStation)
            {
                if (!(travelerDestination is StationDestination) || (travelerDestination as StationDestination).StationId != (_destination as DirectStation).Id)
                {
                    travelerDestination = new StationDestination((_destination as DirectStation).Id);
                }
            }

            // Check to see if destination changed, since changing it will set the traveler to Idle
            if (_traveler.Destination != travelerDestination)
            {
                _traveler.Destination = travelerDestination;
            }

            _traveler.ProcessState();

            // Record number of jumps
            _jumps = DirectEve.Instance.Navigation.GetDestinationPath().Count;

            // Arrived at destination
            if (_destination != null && _traveler.State == TravelerState.AtDestination)
            {
                Logging.Log("Arived at destination");

                _traveler.Destination = null;
                _destination          = null;
            }

            // An error occured, reset traveler
            if (_traveler.State == TravelerState.Error)
            {
                if (_traveler.Destination != null)
                {
                    Logging.Log("Stopped traveling, Traveler threw an error...");
                }

                _destination          = null;
                _traveler.Destination = null;
            }
        }
示例#9
0
        private void GotoAgent(StorylineState nextState)
        {
            if (_nextAction > DateTime.UtcNow)
            {
                return;
            }

            DirectAgent storylineagent = Cache.Instance.DirectEve.GetAgentById(Cache.Instance.CurrentStorylineAgentId);

            if (storylineagent == null)
            {
                _States.CurrentStorylineState = StorylineState.Done;
                return;
            }

            StationDestination baseDestination = Traveler.Destination as StationDestination;

            if (baseDestination == null || baseDestination.StationId != storylineagent.StationId)
            {
                Traveler.Destination = new StationDestination(storylineagent.SolarSystemId, storylineagent.StationId, Cache.Instance.DirectEve.GetLocationName(storylineagent.StationId));
                return;
            }

            if (!_highSecChecked && storylineagent.SolarSystemId != Cache.Instance.DirectEve.Session.SolarSystemId)
            {
                // if we haven't already done so, set Eve's autopilot
                if (!_setDestinationStation)
                {
                    if (!Traveler.SetStationDestination(storylineagent.StationId))
                    {
                        Logging.Log("Storyline", "GotoAgent: Unable to find route to storyline agent. Skipping.", Logging.Yellow);
                        _States.CurrentStorylineState = StorylineState.Done;
                        return;
                    }
                    _setDestinationStation = true;
                    _nextAction            = DateTime.UtcNow.AddSeconds(Cache.Instance.RandomNumber(2, 4));
                    return;
                }

                // Make sure we have got a clear path to the agent
                if (!Cache.Instance.CheckifRouteIsAllHighSec())
                {
                    if (_highSecCounter < 5)
                    {
                        _highSecCounter++;
                        return;
                    }
                    Logging.Log("Storyline", "GotoAgent: Unable to determine whether route is all high security status or not. Skipping.", Logging.Yellow);
                    _States.CurrentStorylineState = StorylineState.Done;
                    _highSecCounter = 0;
                    return;
                }

                if (!Cache.Instance.RouteIsAllHighSecBool)
                {
                    Logging.Log("Storyline", "GotoAgent: Route to agent is through low-sec systems. Skipping.", Logging.Yellow);
                    _States.CurrentStorylineState = StorylineState.Done;
                    return;
                }
                _highSecChecked = true;
            }

            if (Cache.Instance.PotentialCombatTargets.Any())
            {
                Combat.ProcessState();
            }

            Traveler.ProcessState();
            if (_States.CurrentTravelerState == TravelerState.AtDestination)
            {
                _States.CurrentStorylineState = nextState;
                Traveler.Destination          = null;
                _setDestinationStation        = false;
            }

            if (Settings.Instance.DebugStates)
            {
                Logging.Log("Traveler.State is", _States.CurrentTravelerState.ToString(), Logging.White);
            }
        }