internal DirectMarketActionWindow(DirectEve directEve, PyObject pyWindow) : base(directEve, pyWindow)
        {
            IsReady      = (bool)pyWindow.Attribute("ready");
            IsBuyAction  = Name == "marketbuyaction";
            IsSellAction = Name == "marketsellaction";

            Item        = new DirectItem(directEve);
            Item.PyItem = pyWindow.Attribute("sr").Attribute("sellItem");

            var order = pyWindow.Attribute("sr").Attribute("currentOrder");

            Price           = (double?)order.Attribute("price");
            RemainingVolume = (double?)order.Attribute("volRemaining");
            Range           = (int?)order.Attribute("range");
            OrderId         = (long?)order.Attribute("orderID");
            EnteredVolume   = (int?)order.Attribute("volEntered");
            MinimumVolume   = (int?)order.Attribute("minVolume");
            IsBid           = (bool?)order.Attribute("bid");
            Issued          = (DateTime?)order.Attribute("issued");
            Duration        = (int?)order.Attribute("duration");
            StationId       = (long?)order.Attribute("stationID");
            RegionId        = (long?)order.Attribute("regionID");
            SolarSystemId   = (long?)order.Attribute("solarSystemID");
            Jumps           = (int?)order.Attribute("jumps");
        }
        internal DirectMarketActionWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            IsReady = (bool) pyWindow.Attribute("ready");
            IsBuyAction = Name == "marketbuyaction";
            IsSellAction = Name == "marketsellaction";

            Item = new DirectItem(directEve);
            Item.PyItem = pyWindow.Attribute("sr").Attribute("sellItem");

            var order = pyWindow.Attribute("sr").Attribute("currentOrder");
            Price = (double?) order.Attribute("price");
            RemainingVolume = (double?) order.Attribute("volRemaining");
            Range = (int?) order.Attribute("range");
            OrderId = (long?) order.Attribute("orderID");
            EnteredVolume = (int?) order.Attribute("volEntered");
            MinimumVolume = (int?) order.Attribute("minVolume");
            IsBid = (bool?) order.Attribute("bid");
            Issued = (DateTime?) order.Attribute("issued");
            Duration = (int?) order.Attribute("duration");
            StationId = (long?) order.Attribute("stationID");
            RegionId = (long?) order.Attribute("regionID");
            SolarSystemId = (long?) order.Attribute("solarSystemID");
            Jumps = (int?) order.Attribute("jumps");
        }
Beispiel #3
0
        internal DirectWindow(DirectEve directEve, PyObject pyWindow) : base(directEve)
        {
            PyWindow = pyWindow;

            Id         = (int?)pyWindow.Attribute("windowID");
            Type       = (string)pyWindow.Attribute("__guid__");
            Name       = (string)pyWindow.Attribute("name");
            IsKillable = (bool)pyWindow.Attribute("_killable");
            IsDialog   = (bool)pyWindow.Attribute("isDialog");
            IsModal    = (bool)pyWindow.Attribute("isModal");
            Caption    = (string)pyWindow.Call("GetCaption");

            var paragraphs = pyWindow.Attribute("edit").Attribute("sr").Attribute("paragraphs").ToList();
            var html       = paragraphs.Aggregate("", (current, paragraph) => current + (string)paragraph.Attribute("text"));

            if (String.IsNullOrEmpty(html))
            {
                html = (string)pyWindow.Attribute("edit").Attribute("sr").Attribute("currentTXT");
            }
            if (String.IsNullOrEmpty(html))
            {
                html = (string)pyWindow.Attribute("sr").Attribute("messageArea").Attribute("sr").Attribute("currentTXT");
            }

            Html = html;

            ViewMode = (string)pyWindow.Attribute("viewMode");
        }
        internal DirectSystemScanResult(DirectEve directEve, PyObject pyResult)
            : base(directEve)
        {
            PyResult       = pyResult;
            Id             = (string)pyResult.Attribute("id");
            ScanGroupName  = (string)pyResult.Attribute("scanGroupName").ToUnicodeString();
            GroupName      = (string)pyResult.Attribute("groupName").ToUnicodeString();
            TypeName       = (string)pyResult.Attribute("typeName").ToUnicodeString();
            SignalStrength = (double)pyResult.Attribute("certainty");
            Deviation      = (double)pyResult.Attribute("deviation");
            IsPointResult  = (string)PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "Vector3";
            IsSpereResult  = (string)PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "float";
            IsCircleResult = (!IsPointResult && !IsSpereResult);
            if (IsPointResult)
            {
                X = (double?)pyResult.Attribute("data").Attribute("x");
                Y = (double?)pyResult.Attribute("data").Attribute("y");
                Z = (double?)pyResult.Attribute("data").Attribute("z");
            }
            else if (IsCircleResult)
            {
                X = (double?)pyResult.Attribute("data").Attribute("point").Attribute("x");
                Y = (double?)pyResult.Attribute("data").Attribute("point").Attribute("y");
                Z = (double?)pyResult.Attribute("data").Attribute("point").Attribute("z");
            }

            // If SphereResult: X,Y,Z is probe location

            if (X.HasValue && Y.HasValue && Z.HasValue)
            {
                var myship = directEve.ActiveShip.Entity;
                Distance = Math.Sqrt((X.Value - myship.X) * (X.Value - myship.X) + (Y.Value - myship.Y) * (Y.Value - myship.Y) + (Z.Value - myship.Z) * (Z.Value - myship.Z));
            }
        }
        internal DirectSystemScanResult(DirectEve directEve, PyObject pyResult)
            : base(directEve)
        {
            PyResult = pyResult;
            Id = (string) pyResult.Attribute("id");
            ScanGroupName = (string) pyResult.Attribute("scanGroupName").ToUnicodeString();
            GroupName = (string) pyResult.Attribute("groupName").ToUnicodeString();
            TypeName = (string) pyResult.Attribute("typeName").ToUnicodeString();
            SignalStrength = (double) pyResult.Attribute("certainty");
            Deviation = (double) pyResult.Attribute("deviation");
            IsPointResult = (string) PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "Vector3";
            IsSpereResult = (string) PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "float";
            IsCircleResult = (!IsPointResult && !IsSpereResult);
            if (IsPointResult)
            {
                X = (double?) pyResult.Attribute("data").Attribute("x");
                Y = (double?) pyResult.Attribute("data").Attribute("y");
                Z = (double?) pyResult.Attribute("data").Attribute("z");
            }
            else if (IsCircleResult)
            {
                X = (double?) pyResult.Attribute("data").Attribute("point").Attribute("x");
                Y = (double?) pyResult.Attribute("data").Attribute("point").Attribute("y");
                Z = (double?) pyResult.Attribute("data").Attribute("point").Attribute("z");
            }

            // If SphereResult: X,Y,Z is probe location

            if (X.HasValue && Y.HasValue && Z.HasValue)
            {
                var myship = directEve.ActiveShip.Entity;
                Distance = Math.Sqrt((X.Value - myship.X)*(X.Value - myship.X) + (Y.Value - myship.Y)*(Y.Value - myship.Y) + (Z.Value - myship.Z)*(Z.Value - myship.Z));
            }
        }
 internal DirectBookmarkFolder(DirectEve directEve, PyObject pyFolder)
     : base(directEve)
 {
     Id = (long) pyFolder.Attribute("folderID");
     Name = (string) pyFolder.Attribute("folderName");
     OwnerId = (long) pyFolder.Attribute("ownerID");
     CreatorId = (long?) pyFolder.Attribute("creatorID");
 }
 internal DirectConstellation(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id = (long) pyo.Attribute("constellationID");
     Name = (string) DirectEve.PySharp.Import("__builtin__").Attribute("cfg").Attribute("evelocations").Call("Get", Id).Attribute("name");
     RegionId = (long) pyo.Attribute("regionID");
     FactionId = (long?) pyo.Attribute("factionID");
 }
Beispiel #8
0
 internal DirectBookmarkFolder(DirectEve directEve, PyObject pyFolder)
     : base(directEve)
 {
     Id        = (long)pyFolder.Attribute("folderID");
     Name      = (string)pyFolder.Attribute("folderName");
     OwnerId   = (long)pyFolder.Attribute("ownerID");
     CreatorId = (long?)pyFolder.Attribute("creatorID");
 }
Beispiel #9
0
 internal DirectConstellation(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id        = (long)pyo.Attribute("constellationID");
     Name      = (string)DirectEve.PySharp.Import("__builtin__").Attribute("cfg").Attribute("evelocations").Call("Get", Id).Attribute("name");
     RegionId  = (long)pyo.Attribute("regionID");
     FactionId = (long?)pyo.Attribute("factionID");
 }
Beispiel #10
0
 internal DirectSolarSystem(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id               = (int)pyo.Attribute("solarSystemID");
     Name             = (string)DirectEve.PySharp.Import("__builtin__").Attribute("cfg").Attribute("evelocations").Call("Get", Id).Attribute("name");
     ConstellationId  = (long)pyo.Attribute("constellationID");
     FactionId        = (long?)pyo.Attribute("factionID");
     Security         = (double)pyo.Attribute("securityStatus");
     IsWormholeSystem = ((long)directEve.Const.MapWormholeSystemMin < Id && Id < (long)directEve.Const.MapWormholeSystemMax);
 }
Beispiel #11
0
        /// <summary>
        ///     Stack all the items in the container
        /// </summary>
        /// <returns></returns>
        public bool StackAll()
        {
            // You can't stack modules
            if (_shipModules)
            {
                return(false);
            }

            return(_pyFlag.IsValid ? DirectEve.ThreadedCall(_pyInventory.Attribute("StackAll"), _pyFlag) : DirectEve.ThreadedCall(_pyInventory.Attribute("StackAll")));
        }
Beispiel #12
0
 internal DirectSolarSystem(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id = (int) pyo.Attribute("solarSystemID");
     Name = (string) DirectEve.PySharp.Import("__builtin__").Attribute("cfg").Attribute("evelocations").Call("Get", Id).Attribute("name");
     ConstellationId = (long) pyo.Attribute("constellationID");
     FactionId = (long?) pyo.Attribute("factionID");
     Security = (double) pyo.Attribute("securityStatus");
     IsWormholeSystem = ((long) directEve.Const.MapWormholeSystemMin < Id && Id < (long) directEve.Const.MapWormholeSystemMax);
 }
Beispiel #13
0
        internal DirectContainer(DirectEve directEve, PyObject pyInventory, PyObject pyFlag)
            : base(directEve)
        {
            _pyInventory = pyInventory;
            _pyFlag = pyFlag;

            TypeId = (int) pyInventory.Attribute("typeID");

            if (!pyInventory.Attribute("listed").IsValid || pyInventory.Attribute("listed").IsNull || pyInventory.Attribute("listed").IsNone)
                DirectItem.RefreshItems(directEve, pyInventory, pyFlag);
        }
Beispiel #14
0
        //private DirectEve DirectEve;

        internal DirectContainerWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            //IsReady = (bool) pyWindow.Attribute("startedUp");
            IsOneWay      = (bool)pyWindow.Attribute("oneWay");
            ItemId        = (long)pyWindow.Attribute("itemID");
            LocationFlag  = (int)pyWindow.Attribute("locationFlag");
            HasCapacity   = (bool)pyWindow.Attribute("hasCapacity");
            currInvIdName = (string)PyWindow.Attribute("currInvID").ToList().First();
            currInvIdItem = (long)PyWindow.Attribute("currInvID").ToList().Last();
        }
 //private DirectEve DirectEve;
 internal DirectContainerWindow(DirectEve directEve, PyObject pyWindow)
     : base(directEve, pyWindow)
 {
     //IsReady = (bool) pyWindow.Attribute("startedUp");
     IsOneWay = (bool) pyWindow.Attribute("oneWay");
     ItemId = (long) pyWindow.Attribute("itemID");
     LocationFlag = (int) pyWindow.Attribute("locationFlag");
     HasCapacity = (bool) pyWindow.Attribute("hasCapacity");
     currInvIdName = (string) PyWindow.Attribute("currInvID").ToList().First();
     currInvIdItem = (long) PyWindow.Attribute("currInvID").ToList().Last();
 }
        internal DirectReprocessingQuote(DirectEve directEve, long itemId, PyObject quote)
            : base(directEve)
        {
            ItemId = itemId;
            QuantityToProcess = (long) quote.Attribute("quantityToProcess");
            LeftOvers = (long) quote.Attribute("leftOvers");
            PlayerStanding = (float) quote.Attribute("olayerStanding");

            Recoverables = new List<DirectReprocessingQuoteRecoverable>();
            foreach (var recoverable in quote.Attribute("recoverables").Attribute("lines").ToList())
                Recoverables.Add(new DirectReprocessingQuoteRecoverable(DirectEve, recoverable));
        }
Beispiel #17
0
        internal DirectContainer(DirectEve directEve, PyObject pyInventory, PyObject pyFlag)
            : base(directEve)
        {
            _pyInventory = pyInventory;
            _pyFlag      = pyFlag;

            TypeId = (int)pyInventory.Attribute("typeID");

            if (!pyInventory.Attribute("listed").IsValid || pyInventory.Attribute("listed").IsNull || pyInventory.Attribute("listed").IsNone)
            {
                DirectItem.RefreshItems(directEve, pyInventory, pyFlag);
            }
        }
        internal DirectReprocessingQuote(DirectEve directEve, long itemId, PyObject quote) : base(directEve)
        {
            ItemId            = itemId;
            QuantityToProcess = (long)quote.Attribute("quantityToProcess");
            LeftOvers         = (long)quote.Attribute("leftOvers");
            PlayerStanding    = (float)quote.Attribute("olayerStanding");

            Recoverables = new List <DirectReprocessingQuoteRecoverable>();
            foreach (var recoverable in quote.Attribute("recoverables").Attribute("lines").ToList())
            {
                Recoverables.Add(new DirectReprocessingQuoteRecoverable(DirectEve, recoverable));
            }
        }
Beispiel #19
0
        private string GetPyValue(PyObject attr)
        {
            switch (attr.GetPyType())
            {
            case PyType.FloatType:
            case PyType.DerivedFloatType:
                return(((double)attr).ToString());

            case PyType.IntType:
            case PyType.LongType:
            case PyType.DerivedIntType:
            case PyType.DerivedLongType:
                return(((long)attr).ToString());

            case PyType.BoolType:
            case PyType.DerivedBoolType:
                return(((bool)attr).ToString());

            case PyType.StringType:
            case PyType.UnicodeType:
            case PyType.DerivedStringType:
            case PyType.DerivedUnicodeType:
                return((string)attr);

            case PyType.MethodType:
                var x        = attr.Attribute("im_func").Attribute("func_code");
                var name     = (string)x.Attribute("co_name");
                var argCount = (int)x.Attribute("co_argcount");
                var args     = string.Join(",", x.Attribute("co_varnames").ToList <string>().Take(argCount).ToArray());
                return(name + "(" + args + ")");

            default:
                return(attr.ToString());
            }
        }
Beispiel #20
0
        internal DirectFitting(DirectEve directEve, long ownerId, int fittingId, PyObject pyFitting) : base(directEve)
        {
            _pyFitting = pyFitting;

            OwnerId    = ownerId;
            FittingId  = fittingId;
            Name       = (string)pyFitting.Attribute("name");
            ShipTypeId = (int)pyFitting.Attribute("shipTypeID");
            Modules    = new List <DirectItem>();
            foreach (var module in pyFitting.Attribute("fitData").ToList())
            {
                var item = new DirectItem(directEve);
                item.TypeId   = (int)module.Item(0);
                item.FlagId   = (int)module.Item(1);
                item.Quantity = (int)module.Item(2);
                item.OwnerId  = (int)OwnerId;
                Modules.Add(item);
            }
        }
 internal DirectScannerWindow(DirectEve directEve, PyObject pyWindow)
     : base(directEve, pyWindow)
 {
     var charId = DirectEve.Session.CharacterId;
     var obj = PyWindow.Attribute("busy");
     var analyseBtnEnabled = (bool)pyWindow.Attribute("sr").Attribute("analyzeBtn").Attribute("enabled");
     //Log("obj type = " + obj.GetPyType().ToString());
     //Log("obj value = " + ((bool) obj).ToString());
     IsReady = charId != null && obj.IsValid && (bool)obj == false && analyseBtnEnabled;
 }
Beispiel #22
0
        internal DirectScannerWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            var charId            = DirectEve.Session.CharacterId;
            var obj               = PyWindow.Attribute("busy");
            var analyseBtnEnabled = (bool)pyWindow.Attribute("sr").Attribute("analyzeBtn").Attribute("enabled");

            //Log("obj type = " + obj.GetPyType().ToString());
            //Log("obj value = " + ((bool) obj).ToString());
            IsReady = charId != null && obj.IsValid && (bool)obj == false && analyseBtnEnabled;
        }
Beispiel #23
0
        internal DirectFitting(DirectEve directEve, long ownerId, int fittingId, PyObject pyFitting)
            : base(directEve)
        {
            _pyFitting = pyFitting;

            OwnerId = ownerId;
            FittingId = fittingId;
            Name = (string) pyFitting.Attribute("name");
            ShipTypeId = (int) pyFitting.Attribute("shipTypeID");
            Modules = new List<DirectItem>();
            foreach (var module in pyFitting.Attribute("fitData").ToList())
            {
                var item = new DirectItem(directEve);
                item.TypeId = (int) module.Item(0);
                item.FlagId = (int) module.Item(1);
                item.Quantity = (int) module.Item(2);
                item.OwnerId = (int) OwnerId;
                Modules.Add(item);
            }
        }
Beispiel #24
0
 internal DirectStation(DirectEve directEve, PyObject pyo) : base(directEve)
 {
     Id            = (int)pyo.Attribute("stationID");
     Name          = (string)pyo.Attribute("stationName");
     X             = (double)pyo.Attribute("x");
     Y             = (double)pyo.Attribute("y");
     Z             = (double)pyo.Attribute("z");
     TypeId        = (int)pyo.Attribute("stationTypeID");
     SolarSystemId = (int)pyo.Attribute("solarSystemID");
 }
 internal DirectAgentMissionBookmark(DirectEve directEve, PyObject pyBookmark) : base(directEve, pyBookmark)
 {
     AgentId        = (long?)pyBookmark.Attribute("agentID");
     IsDeadspace    = (bool?)pyBookmark.Attribute("deadspace");
     Flag           = (int?)pyBookmark.Attribute("flag");
     LocationNumber = (int?)pyBookmark.Attribute("locationNumber");
     LocationType   = (string)pyBookmark.Attribute("locationType");
     Title          = (string)pyBookmark.Attribute("hint");
     SolarSystemId  = (long?)pyBookmark.Attribute("solarsystemID");
 }
Beispiel #26
0
 internal DirectStation(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id = (int) pyo.Attribute("stationID");
     Name = (string) pyo.Attribute("stationName");
     X = (double) pyo.Attribute("x");
     Y = (double) pyo.Attribute("y");
     Z = (double) pyo.Attribute("z");
     TypeId = (int) pyo.Attribute("stationTypeID");
     SolarSystemId = (int) pyo.Attribute("solarSystemID");
 }
Beispiel #27
0
        internal DirectEntity(DirectEve directEve, PyObject ballpark, PyObject ball, PyObject slimItem, long id)
            : base(directEve)
        {
            _ballpark = ballpark;
            _ball     = ball;
            _slimItem = slimItem;

            Id     = id;
            TypeId = (int)slimItem.Attribute("typeID");

            Attacks           = new List <string>();
            ElectronicWarfare = new List <string>();
        }
 internal DirectAgentMissionBookmark(DirectEve directEve, PyObject pyBookmark)
     : base(directEve, pyBookmark)
 {
     AgentId = (long?) pyBookmark.Attribute("agentID");
     IsDeadspace = (bool?) pyBookmark.Attribute("deadspace");
     Flag = (int?) pyBookmark.Attribute("flag");
     LocationNumber = (int?) pyBookmark.Attribute("locationNumber");
     LocationType = (string) pyBookmark.Attribute("locationType");
     Title = (string) pyBookmark.Attribute("hint");
     SolarSystemId = (long?) pyBookmark.Attribute("solarsystemID");
 }
Beispiel #29
0
        internal DirectEntity(DirectEve directEve, PyObject ballpark, PyObject ball, PyObject slimItem, long id)
            : base(directEve)
        {
            _ballpark = ballpark;
            _ball = ball;
            _slimItem = slimItem;

            Id = id;
            TypeId = (int) slimItem.Attribute("typeID");

            Attacks = new List<string>();
            ElectronicWarfare = new List<string>();
        }
Beispiel #30
0
 internal DirectScannerProbe(DirectEve directEve, PyObject pyProbe)
     : base(directEve)
 {
     PyProbe     = pyProbe;
     TypeId      = (int)pyProbe.Attribute("typeID");
     ProbeId     = (long)pyProbe.Attribute("probeID");
     X           = (double)pyProbe.Attribute("pos").Attribute("x");
     Y           = (double)pyProbe.Attribute("pos").Attribute("y");
     Z           = (double)pyProbe.Attribute("pos").Attribute("z");
     Expiry      = new TimeSpan((long)pyProbe.Attribute("expire"));
     RangeAu     = (double)pyProbe.Attribute("scanRange") / (double)directEve.Const.AU;
     AllRangesAu = DirectEve.GetLocalSvc("scanSvc").Call("GetScanRangeStepsByTypeID", TypeId).ToList <double>().Select(i => i / (double)directEve.Const.AU).ToList();
 }
Beispiel #31
0
 internal DirectScannerProbe(DirectEve directEve, PyObject pyProbe)
     : base(directEve)
 {
     PyProbe = pyProbe;
     TypeId = (int) pyProbe.Attribute("typeID");
     ProbeId = (long) pyProbe.Attribute("probeID");
     X = (double) pyProbe.Attribute("pos").Attribute("x");
     Y = (double) pyProbe.Attribute("pos").Attribute("y");
     Z = (double) pyProbe.Attribute("pos").Attribute("z");
     Expiry = new TimeSpan((long) pyProbe.Attribute("expire"));
     RangeAu = (double) pyProbe.Attribute("scanRange")/(double) directEve.Const.AU;
     AllRangesAu = DirectEve.GetLocalSvc("scanSvc").Call("GetScanRangeStepsByTypeID", TypeId).ToList<double>().Select(i => i/(double) directEve.Const.AU).ToList();
 }
Beispiel #32
0
        internal DirectWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve)
        {
            PyWindow = pyWindow;

            Id = (int?) pyWindow.Attribute("windowID");
            Type = (string) pyWindow.Attribute("__guid__");
            Name = (string) pyWindow.Attribute("name");
            IsKillable = (bool) pyWindow.Attribute("_killable");
            IsDialog = (bool) pyWindow.Attribute("isDialog");
            IsModal = (bool) pyWindow.Attribute("isModal");
            Caption = (string) pyWindow.Call("GetCaption");

            var paragraphs = pyWindow.Attribute("edit").Attribute("sr").Attribute("paragraphs").ToList();
            var html = paragraphs.Aggregate("", (current, paragraph) => current + (string) paragraph.Attribute("text"));
            if (String.IsNullOrEmpty(html))
                html = (string) pyWindow.Attribute("edit").Attribute("sr").Attribute("currentTXT");
            if (String.IsNullOrEmpty(html))
                html = (string) pyWindow.Attribute("sr").Attribute("messageArea").Attribute("sr").Attribute("currentTXT");

            Html = html;

            ViewMode = (string) pyWindow.Attribute("viewMode");
        }
        internal DirectDirectionalScanResult(DirectEve directEve, PyObject slimItem, PyObject ball, PyObject celestialRec)
            : base(directEve)
        {
            _slimItem = slimItem;
            _ball = ball;
            _celestialRec = celestialRec;

            if (_slimItem.IsValid)
            {
                TypeId = (int) _slimItem.Attribute("typeID");
            }
            else if (_celestialRec.IsValid)
            {
                TypeId = (int) _celestialRec.Attribute("typeID");
            }
        }
        internal DirectDirectionalScanResult(DirectEve directEve, PyObject slimItem, PyObject ball, PyObject celestialRec)
            : base(directEve)
        {
            _slimItem     = slimItem;
            _ball         = ball;
            _celestialRec = celestialRec;

            if (_slimItem.IsValid)
            {
                TypeId = (int)_slimItem.Attribute("typeID");
            }
            else if (_celestialRec.IsValid)
            {
                TypeId = (int)_celestialRec.Attribute("typeID");
            }
        }
Beispiel #35
0
        internal DirectAgentWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            var loading = pyWindow.Attribute("sr").Attribute("briefingBrowser").Attribute("_loading");

            IsReady = loading.IsValid && !(bool)loading;

            if (pyWindow.Attribute("sr").Attribute("briefingBrowser").IsValid)
            {
                loading  = pyWindow.Attribute("sr").Attribute("objectiveBrowser").Attribute("_loading");
                IsReady &= loading.IsValid && !(bool)loading;
            }

            AgentId   = (int)pyWindow.Attribute("sr").Attribute("agentID");
            AgentSays = (string)pyWindow.Attribute("sr").Attribute("agentSays");

            AgentResponses = new List <DirectAgentResponse>();

            var buttonPathRight = new[] { "__maincontainer", "main", "rightPane", "rightPaneBottom" };
            var buttonPathLeft  = new[] { "__maincontainer", "main", "rightPaneBottom" };

            var viewMode   = (string)pyWindow.Attribute("viewMode");
            var isRight    = viewMode != "SinglePaneView";
            var buttonPath = isRight ? buttonPathRight : buttonPathLeft;
            var buttons    = FindChildWithPath(pyWindow, buttonPath).Attribute("children").Attribute("_childrenObjects").ToList();

            foreach (var response in buttons)
            {
                var directResponse = new DirectAgentResponse(directEve, pyWindow);
                directResponse.AgentId = AgentId;
                directResponse.Text    = (string)response.Attribute("text");
                directResponse.Button  = (string)response.Attribute("name");
                directResponse.Right   = isRight;
                AgentResponses.Add(directResponse);
            }

            Briefing  = (string)pyWindow.Attribute("sr").Attribute("briefingBrowser").Attribute("sr").Attribute("currentTXT");
            Objective = (string)pyWindow.Attribute("sr").Attribute("objectiveBrowser").Attribute("sr").Attribute("currentTXT");
        }
        internal DirectLoyaltyPointOffer(DirectEve directEve, PyObject offer)
            : base(directEve)
        {
            TypeId = (int) offer.Attribute("typeID");
            IskCost = (long) offer.Attribute("iskCost");
            LoyaltyPointCost = (long) offer.Attribute("lpCost");
            Quantity = (long) offer.Attribute("qty");
            _pyOfferId = offer.Attribute("offerID");
            OfferId = (int) _pyOfferId;
            _offer = offer;

            RequiredItems = new List<DirectLoyaltyPointOfferRequiredItem>();
            foreach (var item in offer.Attribute("reqItems").ToList())
                RequiredItems.Add(new DirectLoyaltyPointOfferRequiredItem(directEve, item));
        }
Beispiel #37
0
        internal DirectLoyaltyPointOffer(DirectEve directEve, PyObject offer) : base(directEve)
        {
            TypeId           = (int)offer.Attribute("typeID");
            IskCost          = (long)offer.Attribute("iskCost");
            LoyaltyPointCost = (long)offer.Attribute("lpCost");
            Quantity         = (long)offer.Attribute("qty");
            _pyOfferId       = offer.Attribute("offerID");
            OfferId          = (int)_pyOfferId;
            _offer           = offer;

            RequiredItems = new List <DirectLoyaltyPointOfferRequiredItem>();
            foreach (var item in offer.Attribute("reqItems").ToList())
            {
                RequiredItems.Add(new DirectLoyaltyPointOfferRequiredItem(directEve, item));
            }
        }
Beispiel #38
0
        internal DirectAgentWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            var loading = pyWindow.Attribute("sr").Attribute("briefingBrowser").Attribute("_loading");
            IsReady = loading.IsValid && !(bool) loading;

            if (pyWindow.Attribute("sr").Attribute("briefingBrowser").IsValid)
            {
                loading = pyWindow.Attribute("sr").Attribute("objectiveBrowser").Attribute("_loading");
                IsReady &= loading.IsValid && !(bool) loading;
            }

            AgentId = (int) pyWindow.Attribute("sr").Attribute("agentID");
            AgentSays = (string) pyWindow.Attribute("sr").Attribute("agentSays");

            AgentResponses = new List<DirectAgentResponse>();

            var buttonPathRight = new[] {"__maincontainer", "main", "rightPane", "rightPaneBottom"};
            var buttonPathLeft = new[] {"__maincontainer", "main", "rightPaneBottom"};

            var viewMode = (string) pyWindow.Attribute("viewMode");
            var isRight = viewMode != "SinglePaneView";
            var buttonPath = isRight ? buttonPathRight : buttonPathLeft;
            var buttons = FindChildWithPath(pyWindow, buttonPath).Attribute("children").Attribute("_childrenObjects").ToList();
            foreach (var response in buttons)
            {
                var directResponse = new DirectAgentResponse(directEve, pyWindow);
                directResponse.AgentId = AgentId;
                directResponse.Text = (string) response.Attribute("text");
                directResponse.Button = (string) response.Attribute("name");
                directResponse.Right = isRight;
                AgentResponses.Add(directResponse);
            }

            Briefing = (string) pyWindow.Attribute("sr").Attribute("briefingBrowser").Attribute("sr").Attribute("currentTXT");
            Objective = (string) pyWindow.Attribute("sr").Attribute("objectiveBrowser").Attribute("sr").Attribute("currentTXT");
        }
Beispiel #39
0
        internal static List <DirectItem> GetItems(DirectEve directEve, PyObject inventory, PyObject flag)
        {
            var items       = new List <DirectItem>();
            var cachedItems = inventory.Attribute("cachedItems").ToDictionary();
            var pyItems     = cachedItems.Values;

            foreach (var pyItem in pyItems)
            {
                var item = new DirectItem(directEve);
                item.PyItem = pyItem;

                // Do not add the item if the flags do not coincide
                if (flag.IsValid && (int)flag != item.FlagId)
                {
                    continue;
                }

                items.Add(item);
            }

            return(items);
        }
Beispiel #40
0
        internal DirectChatWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            var id = pyWindow.Attribute("channelID");
            if (id.GetPyType() == PyType.TupleType)
                ChannelId = (string) id.Item(0).Item(0);
            if (id.GetPyType() == PyType.StringType)
                ChannelId = (string) id;
            if (id.GetPyType() == PyType.IntType)
                ChannelId = ((long) id).ToString();

            MemberCount = (int) pyWindow.Attribute("memberCount"); // deprecated by CCP
            Usermode = (int) pyWindow.Attribute("usermode"); // deprecated by CCP
            EveMemberCount = (int) pyWindow.Attribute("eveMemberCount");
            DustMemberCount = (int) pyWindow.Attribute("dustMemberCount");
            ShowUserList = (bool) pyWindow.Attribute("showUserList");
        }
Beispiel #41
0
        internal DirectChatWindow(DirectEve directEve, PyObject pyWindow) : base(directEve, pyWindow)
        {
            var id = pyWindow.Attribute("channelID");

            if (id.GetPyType() == PyType.TupleType)
            {
                ChannelId = (string)id.Item(0).Item(0);
            }
            if (id.GetPyType() == PyType.StringType)
            {
                ChannelId = (string)id;
            }
            if (id.GetPyType() == PyType.IntType)
            {
                ChannelId = ((long)id).ToString();
            }

            MemberCount     = (int)pyWindow.Attribute("memberCount"); // deprecated by CCP
            Usermode        = (int)pyWindow.Attribute("usermode");    // deprecated by CCP
            EveMemberCount  = (int)pyWindow.Attribute("eveMemberCount");
            DustMemberCount = (int)pyWindow.Attribute("dustMemberCount");
            ShowUserList    = (bool)pyWindow.Attribute("showUserList");
        }
Beispiel #42
0
 internal DirectMarketWindow(DirectEve directEve, PyObject pyWindow)
     : base(directEve, pyWindow)
 {
     IsReady = !(bool) pyWindow.Attribute("sr").Attribute("market").Attribute("loadingType");
     DetailTypeId = (int?) pyWindow.Attribute("sr").Attribute("market").Attribute("sr").Attribute("detailTypeID");
 }
Beispiel #43
0
        internal DirectFleetMember(DirectEve directEve, PyObject memberObject)
            : base(directEve)
        {
            CharacterId = (int) memberObject.Attribute("charID");
            SquadID = (long) memberObject.Attribute("squadID");
            WingID = (long) memberObject.Attribute("wingID");
            Skills = new List<int>
            {
                (int) memberObject.Attribute("skills").ToList()[0],
                (int) memberObject.Attribute("skills").ToList()[1],
                (int) memberObject.Attribute("skills").ToList()[2]
            };

            if ((int) memberObject.Attribute("job") == (int) directEve.Const.FleetJobCreator)
                Job = JobRole.Boss;
            else
                Job = JobRole.RegularMember;

            if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleLeader)
                Role = FleetRole.FleetCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleWingCmdr)
                Role = FleetRole.WingCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleSquadCmdr)
                Role = FleetRole.SquadCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleMember)
                Role = FleetRole.Member;

            ShipTypeID = (int?) memberObject.Attribute("shipTypeID");
            SolarSystemID = (int) memberObject.Attribute("solarSystemID");
        }
Beispiel #44
0
        private PyObject Evaluate(PySharp.PySharp pySharp, PyObject pyObject)
        {
            // TODO: Better part splitting (e.g. bla('bla', const.bla)
            var parts = _evaluate.Split('.');
            if (parts.Length == 0)
            {
                // TODO: List imports
                return null;
            }

            if (pyObject == null)
                pyObject = pySharp.Import(parts[0]);

            for (var i = 1; i < parts.Length; i++)
            {
                if (parts[i].Contains("("))
                {
                    // TODO: Call
                }
                else if (parts[i].Contains("["))
                {
                    var attr = parts[i].Substring(0, parts[i].IndexOf('['));

                    var key = parts[i].Substring(parts[i].IndexOf('[') + 1, parts[i].IndexOf(']') - parts[i].IndexOf('[') - 1);
                    if (key.StartsWith("'") || key.StartsWith("\""))
                        key = key.Substring(1, key.Length - 2);

                    if (!string.IsNullOrEmpty(attr))
                        pyObject = pyObject.Attribute(attr);

                    if (pyObject.GetPyType() == PyType.DictType ||
                        pyObject.GetPyType() == PyType.DerivedDictType ||
                        pyObject.GetPyType() == PyType.DictProxyType ||
                        pyObject.GetPyType() == PyType.DerivedDictProxyType)
                    {
                        var dict = pyObject.ToDictionary();

                        pyObject = PySharp.PySharp.PyZero;
                        foreach (var dictItem in dict)
                        {
                            if (GetPyValue(dictItem.Key) == key)
                                pyObject = dictItem.Value;
                        }
                    }
                    else
                    {
                        int index;
                        pyObject = int.TryParse(key, out index) ? pyObject.Item(index) : PySharp.PySharp.PyZero;
                    }
                }
                else
                {
                    pyObject = pyObject.Attribute(parts[i]);
                }
            }

            return pyObject;
        }
Beispiel #45
0
 /// <summary>
 ///     Find a child object (usually button)
 /// </summary>
 /// <param name="container"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 internal static PyObject FindChild(PyObject container, string name)
 {
     var childs = container.Attribute("children").Attribute("_childrenObjects").ToList();
     return childs.Find(c => String.Compare((string) c.Attribute("_name"), name) == 0) ?? global::DirectEve.PySharp.PySharp.PyZero;
 }
 internal DirectReprocessingWindow(DirectEve directEve, PyObject pyWindow)
     : base(directEve, pyWindow)
 {
     NeedsQuote = !(bool) pyWindow.Attribute("sr").Attribute("quotesBtn").Attribute("disabled");
 }
Beispiel #47
0
        private string GetPyValue(PyObject attr)
        {
            switch (attr.GetPyType())
            {
                case PyType.FloatType:
                case PyType.DerivedFloatType:
                    return ((double) attr).ToString();

                case PyType.IntType:
                case PyType.LongType:
                case PyType.DerivedIntType:
                case PyType.DerivedLongType:
                    return ((long) attr).ToString();

                case PyType.BoolType:
                case PyType.DerivedBoolType:
                    return ((bool) attr).ToString();

                case PyType.StringType:
                case PyType.UnicodeType:
                case PyType.DerivedStringType:
                case PyType.DerivedUnicodeType:
                    return (string) attr;

                case PyType.MethodType:
                    var x = attr.Attribute("im_func").Attribute("func_code");
                    var name = (string) x.Attribute("co_name");
                    var argCount = (int) x.Attribute("co_argcount");
                    var args = string.Join(",", x.Attribute("co_varnames").ToList<string>().Take(argCount).ToArray());
                    return name + "(" + args + ")";

                default:
                    return attr.ToString();
            }
        }
Beispiel #48
0
 internal DirectBookmark(DirectEve directEve, PyObject pyBookmark)
     : base(directEve)
 {
     PyBookmark = pyBookmark;
     BookmarkId = (long?) pyBookmark.Attribute("bookmarkID");
     CreatedOn = (DateTime?) pyBookmark.Attribute("created");
     ItemId = (long?) pyBookmark.Attribute("itemID");
     LocationId = (long?) pyBookmark.Attribute("locationID");
     FolderId = (long?) pyBookmark.Attribute("folderID");
     Title = (string) pyBookmark.Attribute("memo");
     if (!String.IsNullOrEmpty(Title) && Title.Contains("\t"))
     {
         Memo = Title.Substring(Title.IndexOf("\t") + 1);
         Title = Title.Substring(0, Title.IndexOf("\t"));
     }
     Note = (string) pyBookmark.Attribute("note");
     OwnerId = (int?) pyBookmark.Attribute("ownerID");
     TypeId = (int) pyBookmark.Attribute("typeID");
     X = (double?) pyBookmark.Attribute("x");
     Y = (double?) pyBookmark.Attribute("y");
     Z = (double?) pyBookmark.Attribute("z");
 }
Beispiel #49
0
 internal DirectMarketWindow(DirectEve directEve, PyObject pyWindow) : base(directEve, pyWindow)
 {
     IsReady      = !(bool)pyWindow.Attribute("sr").Attribute("market").Attribute("loadingType");
     DetailTypeId = (int?)pyWindow.Attribute("sr").Attribute("market").Attribute("sr").Attribute("detailTypeID");
 }
Beispiel #50
0
 public void SetLocation(double x, double y, double z)
 {
     PyProbe.Attribute("destination").SetAttribute("x", x);
     PyProbe.Attribute("destination").SetAttribute("y", y);
     PyProbe.Attribute("destination").SetAttribute("z", z);
 }
Beispiel #51
0
        internal static List<DirectItem> GetItems(DirectEve directEve, PyObject inventory, PyObject flag)
        {
            var items = new List<DirectItem>();
            var cachedItems = inventory.Attribute("cachedItems").ToDictionary();
            var pyItems = cachedItems.Values;

            foreach (var pyItem in pyItems)
            {
                var item = new DirectItem(directEve);
                item.PyItem = pyItem;

                // Do not add the item if the flags do not coincide
                if (flag.IsValid && (int) flag != item.FlagId)
                    continue;

                items.Add(item);
            }

            return items;
        }
Beispiel #52
0
 internal DirectBookmark(DirectEve directEve, PyObject pyBookmark)
     : base(directEve)
 {
     PyBookmark = pyBookmark;
     BookmarkId = (long?)pyBookmark.Attribute("bookmarkID");
     CreatedOn  = (DateTime?)pyBookmark.Attribute("created");
     ItemId     = (long?)pyBookmark.Attribute("itemID");
     LocationId = (long?)pyBookmark.Attribute("locationID");
     FolderId   = (long?)pyBookmark.Attribute("folderID");
     Title      = (string)pyBookmark.Attribute("memo");
     if (!String.IsNullOrEmpty(Title) && Title.Contains("\t"))
     {
         Memo  = Title.Substring(Title.IndexOf("\t") + 1);
         Title = Title.Substring(0, Title.IndexOf("\t"));
     }
     Note    = (string)pyBookmark.Attribute("note");
     OwnerId = (int?)pyBookmark.Attribute("ownerID");
     TypeId  = (int)pyBookmark.Attribute("typeID");
     X       = (double?)pyBookmark.Attribute("x");
     Y       = (double?)pyBookmark.Attribute("y");
     Z       = (double?)pyBookmark.Attribute("z");
 }
Beispiel #53
0
 public bool Click()
 {
     return(DirectEve.ThreadedCall(_pyModule.Attribute("Click")));
 }
Beispiel #54
0
 internal DirectReprocessingWindow(DirectEve directEve, PyObject pyWindow) : base(directEve, pyWindow)
 {
     NeedsQuote = !(bool)pyWindow.Attribute("sr").Attribute("quotesBtn").Attribute("disabled");
 }
Beispiel #55
0
        internal DirectOrder(DirectEve directEve, PyObject pyOrder)
            : base(directEve)
        {
            PyOrder = pyOrder;
            OrderId = -1;
            Price = (double) pyOrder.Attribute("price");
            VolumeRemaining = (int) pyOrder.Attribute("volRemaining");
            TypeId = (int) pyOrder.Attribute("typeID");
            if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeSolarSystem)
                Range = DirectOrderRange.SolarSystem;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeConstellation)
                Range = DirectOrderRange.Constellation;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeRegion)
                Range = DirectOrderRange.Region;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeStation)
                Range = DirectOrderRange.Station;
            else
                RangeAbsolute = (int) pyOrder.Attribute("range");

            OrderId = (long) pyOrder.Attribute("orderID");
            VolumeEntered = (int) pyOrder.Attribute("volEntered");
            MinimumVolume = (int) pyOrder.Attribute("minVolume");
            IsBid = (bool) pyOrder.Attribute("bid");
            IssuedOn = (DateTime) pyOrder.Attribute("issued");
            Duration = (int) pyOrder.Attribute("duration");
            StationId = (int) pyOrder.Attribute("stationID");
            RegionId = (int) pyOrder.Attribute("regionID");
            SolarSystemId = (int) pyOrder.Attribute("solarSystemID");
            Jumps = (int) pyOrder.Attribute("jumps");
        }
Beispiel #56
0
        /// <summary>
        ///     Find a child object (usually button)
        /// </summary>
        /// <param name="container"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        internal new static PyObject FindChild(PyObject container, string name)
        {
            var childs = container.Attribute("children").Attribute("_childrenObjects").ToList();

            return(childs.Find(c => String.Compare((string)c.Attribute("name"), name) == 0) ?? global::DirectEve.PySharp.PySharp.PyZero);
        }
Beispiel #57
0
        internal DirectFleetMember(DirectEve directEve, PyObject memberObject)
            : base(directEve)
        {
            CharacterId = (int)memberObject.Attribute("charID");
            SquadID     = (long)memberObject.Attribute("squadID");
            WingID      = (long)memberObject.Attribute("wingID");
            Skills      = new List <int>
            {
                (int)memberObject.Attribute("skills").ToList()[0],
                (int)memberObject.Attribute("skills").ToList()[1],
                (int)memberObject.Attribute("skills").ToList()[2]
            };

            if ((int)memberObject.Attribute("job") == (int)directEve.Const.FleetJobCreator)
            {
                Job = JobRole.Boss;
            }
            else
            {
                Job = JobRole.RegularMember;
            }

            if ((int)memberObject.Attribute("role") == (int)directEve.Const.FleetRoleLeader)
            {
                Role = FleetRole.FleetCommander;
            }
            else if ((int)memberObject.Attribute("role") == (int)directEve.Const.FleetRoleWingCmdr)
            {
                Role = FleetRole.WingCommander;
            }
            else if ((int)memberObject.Attribute("role") == (int)directEve.Const.FleetRoleSquadCmdr)
            {
                Role = FleetRole.SquadCommander;
            }
            else if ((int)memberObject.Attribute("role") == (int)directEve.Const.FleetRoleMember)
            {
                Role = FleetRole.Member;
            }

            ShipTypeID    = (int?)memberObject.Attribute("shipTypeID");
            SolarSystemID = (int)memberObject.Attribute("solarSystemID");
        }
Beispiel #58
0
        private PyObject Evaluate(PySharp.PySharp pySharp, PyObject pyObject)
        {
            // TODO: Better part splitting (e.g. bla('bla', const.bla)
            var parts = _evaluate.Split('.');

            if (parts.Length == 0)
            {
                // TODO: List imports
                return(null);
            }

            if (pyObject == null)
            {
                pyObject = pySharp.Import(parts[0]);
            }

            for (var i = 1; i < parts.Length; i++)
            {
                if (parts[i].Contains("("))
                {
                    // TODO: Call
                }
                else if (parts[i].Contains("["))
                {
                    var attr = parts[i].Substring(0, parts[i].IndexOf('['));

                    var key = parts[i].Substring(parts[i].IndexOf('[') + 1, parts[i].IndexOf(']') - parts[i].IndexOf('[') - 1);
                    if (key.StartsWith("'") || key.StartsWith("\""))
                    {
                        key = key.Substring(1, key.Length - 2);
                    }

                    if (!string.IsNullOrEmpty(attr))
                    {
                        pyObject = pyObject.Attribute(attr);
                    }

                    if (pyObject.GetPyType() == PyType.DictType ||
                        pyObject.GetPyType() == PyType.DerivedDictType ||
                        pyObject.GetPyType() == PyType.DictProxyType ||
                        pyObject.GetPyType() == PyType.DerivedDictProxyType)
                    {
                        var dict = pyObject.ToDictionary();

                        pyObject = PySharp.PySharp.PyZero;
                        foreach (var dictItem in dict)
                        {
                            if (GetPyValue(dictItem.Key) == key)
                            {
                                pyObject = dictItem.Value;
                            }
                        }
                    }
                    else
                    {
                        int index;
                        pyObject = int.TryParse(key, out index) ? pyObject.Item(index) : PySharp.PySharp.PyZero;
                    }
                }
                else
                {
                    pyObject = pyObject.Attribute(parts[i]);
                }
            }

            return(pyObject);
        }
Beispiel #59
0
 internal static bool RefreshItems(DirectEve directEve, PyObject inventory, PyObject flag)
 {
     return directEve.ThreadedCall(inventory.Attribute("InvalidateCache"));
 }