Esempio n. 1
0
 public override void Transfer(ref PointerItem otherpitem, string Button)
 {
     if (otherpitem.Item == AcceptedItem.Item || otherpitem.Item == null)
     {
         QuickSwap(ref otherpitem);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Loads the results for the current page.
        /// </summary>
        private void LoadScanResults()
        {
            Snapshot           snapshot     = SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshot, this.ActiveType);
            IList <ScanResult> newAddresses = new List <ScanResult>();

            if (snapshot != null)
            {
                UInt64 startIndex = Math.Min(ScanResultsViewModel.PageSize * this.CurrentPage, snapshot.ElementCount);
                UInt64 endIndex   = Math.Min((ScanResultsViewModel.PageSize * this.CurrentPage) + ScanResultsViewModel.PageSize, snapshot.ElementCount);

                for (UInt64 index = startIndex; index < endIndex; index++)
                {
                    SnapshotElementIndexer element = snapshot[index];

                    String label = element.GetElementLabel() != null?element.GetElementLabel().ToString() : String.Empty;

                    Object currentValue  = element.HasCurrentValue() ? element.LoadCurrentValue() : null;
                    Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null;

                    String moduleName = String.Empty;
                    UInt64 address    = Query.Default.AddressToModule(element.BaseAddress, out moduleName);

                    PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: this.ActiveType, moduleName: moduleName, value: currentValue);
                    newAddresses.Add(new ScanResult(new PointerItemView(pointerItem), previousValue, label));
                }
            }

            this.Addresses = new FullyObservableCollection <ScanResult>(newAddresses);

            // Ensure results are visible
            this.IsVisible  = true;
            this.IsSelected = true;
            this.IsActive   = true;
        }
Esempio n. 3
0
        /// <summary>
        /// Loads the results for the current page.
        /// </summary>
        private void LoadPointerScanResults()
        {
            IList <PointerItem> newAddresses = new List <PointerItem>();

            UInt64 count      = this.DiscoveredPointers.Count;
            UInt64 startIndex = Math.Min(PointerScanResultsViewModel.PageSize * this.CurrentPage, count);
            UInt64 endIndex   = Math.Min((PointerScanResultsViewModel.PageSize * this.CurrentPage) + PointerScanResultsViewModel.PageSize, count);

            for (UInt64 index = startIndex; index < endIndex; index++)
            {
                PointerItem pointerItem = this.DiscoveredPointers[index];

                if (pointerItem != null)
                {
                    newAddresses.Add(pointerItem);
                }
            }

            this.Addresses = new ObservableCollection <PointerItem>(newAddresses);

            // Ensure results are visible
            this.IsVisible  = true;
            this.IsSelected = true;
            this.IsActive   = true;
        }
Esempio n. 4
0
 public virtual bool AddItem(PointerItem ToBeAdded)
 {
     if (ToBeAdded.Item != null)
     {
         if (!CheckIfIsFull())
         {
             for (int i = 0; i < Slots.Length; i++)
             {
                 if (Slots[i].Pitem.Item == ToBeAdded.Item)
                 {
                     if (Slots[i].Pitem.Amount + ToBeAdded.Amount < Slots[i].Pitem.Item.MaxStackAmount)
                     {
                         Slots[i].SetSlotItem(new PointerItem(ToBeAdded.Item, Slots[i].Pitem.Amount + ToBeAdded.Amount));
                         return(true);
                     }
                 }
                 else if (Slots[i].Pitem.IsEmpty())
                 {
                     Slots[i].SetSlotItem(ToBeAdded);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 5
0
 public void Initialize()
 {
     if (StartingItemList != null)
     {
         PointerItem[] PItems = new PointerItem[Size];
         for (int i = 0; i < Size; i++)
         {
             if (i < StartingItemList.List.Length)
             {
                 PItems[i] = StartingItemList.List[i];
             }
             else
             {
                 PItems[i] = new PointerItem();
             }
         }
         MainInventory = new Inventory(PItems);
         for (int i = 0; i < Size; i++)
         {
             GameObject G = Instantiate(UISlot, gameObject.transform);
             G.GetComponent <UISlot>().Initialize(MainInventory.Slots[i]);
         }
     }
     else
     {
         Debug.LogError("set the list of starting items for this level on the InventoryUIManager!");
     }
 }
        private void StartScan(int index, Int64 searchAddress, bool validatingProcess = false)
        {
            if (index > 0)
            {
                SnapshotManager.ClearSnapshots();
            }

            ConstraintNode scanConstraints = new ScanConstraint(ScanConstraint.ConstraintType.Equal, searchAddress, dataType);

            TrackableTask <Snapshot> valueCollectorTask = ValueCollector.CollectValues(
                SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter, dataType),
                TrackableTask.UniversalIdentifier);

            valueCollectorTask.OnCompletedEvent += ((completedValueCollectionTask) =>
            {
                Snapshot snapshot = valueCollectorTask.Result;

                TrackableTask <Snapshot> scanTask = ManualScanner.Scan(
                    snapshot,
                    scanConstraints,
                    TrackableTask.UniversalIdentifier);

                SnapshotManager.SaveSnapshot(scanTask.Result);

                snapshot = scanTask.Result;

                scannedAddresses.Add(new List <Int64>());

                if (snapshot != null)
                {
                    for (UInt64 i = 0; i < snapshot.ElementCount; ++i)
                    {
                        SnapshotElementIndexer element = snapshot[i];

                        Object currentValue = element.HasCurrentValue() ? element.LoadCurrentValue() : null;
                        Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null;

                        String moduleName = String.Empty;
                        UInt64 address = Query.Default.AddressToModule(element.BaseAddress, out moduleName);

                        PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: dataType, moduleName: moduleName, value: currentValue);
                        pointerItem.ForceResolveAddress();

                        scannedAddresses[index].Add(Int64.Parse(pointerItem.AddressSpecifier, NumberStyles.HexNumber, CultureInfo.CurrentCulture));
                    }
                }

                int nextIteration = index + 1;
                if (nextIteration < addressesToFind.Count)
                {
                    StartScan(nextIteration, addressesToFind[nextIteration], validatingProcess);
                }
                else
                {
                    SearchLogic(validatingProcess);
                }
            });
        }
Esempio n. 7
0
 private PointerItem CorrectValue(StructureInfo structureInfo, PointerItem fieldValue)
 {
     if (fieldValue is PointerPageItem pointerPageItem)
     {
         pointerPageItem.ChannelSystemId = structureInfo.Id(pointerPageItem.ChannelSystemId);
     }
     fieldValue.EntitySystemId = structureInfo.Id(fieldValue.EntitySystemId);
     return(fieldValue);
 }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScanResult" /> class.
        /// </summary>
        /// <param name="pointerItem">The inner pointer item.</param>
        /// <param name="dataType">The data type of the value at this address.</param>
        /// <param name="value">The initial value of this result.</param>
        /// <param name="previousValue">The previous scan value.</param>
        /// <param name="label">The label of this result.</param>
        public ScanResult(PointerItem pointerItem, Object previousValue, String label)
        {
            this.PointerItem   = pointerItem;
            this.PreviousValue = previousValue;
            this.Label         = label;

            PropertyChangedEventHandler eventHandler = new PropertyChangedEventHandler(PointerItemChanged);

            this.PointerItem.PropertyChanged += eventHandler;
        }
Esempio n. 9
0
 protected virtual void UpdateUI(PointerItem Pitem)
 {
     if (Pitem != null)
     {
         ItemImage.sprite     = Pitem.Item?.DisplayImage;
         ItemImage.color      = Pitem.Item == null ? Color.clear : Color.white;
         ItemAmountText.text  = Pitem.Amount.ToString();
         ItemAmountText.color = Pitem.Amount < 1 ? Color.clear : Color.white;
     }
 }
Esempio n. 10
0
        private void ExtractPointer(Int32 levelIndex)
        {
            Pointer pointer = this.DiscoveredPointers.GetRandomPointer(levelIndex);

            if (pointer != null)
            {
                PointerItem pointerItem = new PointerItem(pointer.BaseAddress, this.ActiveType, "New Pointer", null, pointer.Offsets);
                ProjectExplorerViewModel.GetInstance().AddProjectItems(pointerItem);
            }
        }
Esempio n. 11
0
 public override void Transfer(ref PointerItem otherpitem, string Button)
 {
     if (otherpitem.Item == null)
     {
         QuickSwap(ref otherpitem);
     }
     else if (otherpitem.Item == Pitem.Item)
     {
         otherpitem = new PointerItem(Pitem.Item, otherpitem.Amount + Pitem.Amount);
         SetSlotItem(new PointerItem());
     }
 }
Esempio n. 12
0
 public void SetOutputSihlouette(PointerItem PItem)
 {
     if (PItem != null)
     {
         TradePItem = PItem;
         if (ReferenceSlot.Pitem.IsEmpty())
         {
             Sihlouette.sprite   = PItem.Item?.DisplayImage;
             ItemAmountText.text = PItem.Amount.ToString();
             ItemImage.color     = Color.clear;
         }
     }
 }
Esempio n. 13
0
 protected override void UpdateUI(PointerItem Pitem)
 {
     if (Pitem != null)
     {
         if (Pitem.Item != null)
         {
             base.UpdateUI(Pitem);
         }
         else
         {
             SetOutputSihlouette(TradePItem);
         }
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Enumerates the pointers of the specified pointer branch.
        /// </summary>
        /// <param name="baseAddress">The current base address.</param>
        /// <param name="offsets">The offsets leading to this branch.</param>
        /// <param name="branch">The current branch.</param>
        /// <param name="pointerIndicies">The indicies at which to return non-null values.</param>
        /// <returns>The full pointer path to the branch.</returns>
        private IEnumerable <PointerItem> EnumerateBranches(UInt64 baseAddress, Stack <Int32> offsets, PointerBranch branch, PointerIndicies pointerIndicies)
        {
            offsets.Push(branch.Offset);

            // End index reached
            if (pointerIndicies.Finished)
            {
                yield break;
            }

            if (branch.Branches.Count <= 0)
            {
                PointerItem pointerItem;

                // Only create pointer items when in the range of the selection indicies. This is an optimization to prevent creating unneeded objects.
                if (pointerIndicies.IterateNext())
                {
                    String moduleName;
                    UInt64 address = AddressResolver.GetInstance().AddressToModule(baseAddress, out moduleName);
                    pointerItem = new PointerItem(address.ToIntPtr(), DataTypes.Int32, "New Pointer", moduleName, offsets.ToArray().Reverse());
                }
                else
                {
                    pointerItem = null;
                }

                yield return(pointerItem);
            }
            else
            {
                foreach (PointerBranch childBranch in branch)
                {
                    foreach (PointerItem pointerItem in this.EnumerateBranches(baseAddress, offsets, childBranch, pointerIndicies))
                    {
                        yield return(pointerItem);
                    }
                }
            }

            offsets.Pop();
        }
Esempio n. 15
0
        /// <summary>
        /// Enumerates the pointers of the specified pointer branch.
        /// </summary>
        /// <param name="baseAddress">The current base address.</param>
        /// <param name="offsets">The offsets leading to this branch.</param>
        /// <param name="branch">The current branch.</param>
        /// <returns>The full pointer path to the branch.</returns>
        private IEnumerable <PointerItem> EnumerateBranches(UInt64 baseAddress, Stack <Int32> offsets, PointerBranch branch)
        {
            offsets.Push(branch.Offset);

            if (branch.Branches.Count <= 0)
            {
                PointerItem pointerItem = new PointerItem(baseAddress.ToIntPtr(), typeof(Int32), "New Pointer", null, offsets.ToArray().Reverse());

                yield return(pointerItem);
            }
            else
            {
                foreach (PointerBranch childBranch in branch)
                {
                    foreach (PointerItem pointerItem in this.EnumerateBranches(baseAddress, offsets, childBranch))
                    {
                        yield return(pointerItem);
                    }
                }
            }

            offsets.Pop();
        }
 public MaininventorySlot(PointerItem pitem) => Pitem = pitem;
Esempio n. 17
0
 public PointerItemView(PointerItem pointerItem)
 {
     this.PointerItem = pointerItem;
 }
Esempio n. 18
0
 public PointerItemView(PointerItem pointerItem)
 {
     this.PointerItem = pointerItem;
     this.PointerItem.PropertyChanged += PointerItemPropertyChanged;
 }
Esempio n. 19
0
 /// <summary>
 /// Adds the given scan result address to the project explorer.
 /// </summary>
 /// <param name="scanResult">The scan result to add to the project explorer.</param>
 private void AddAddress(PointerItem scanResult)
 {
     ProjectExplorerViewModel.GetInstance().AddNewProjectItems(addToSelected: false, projectItems: scanResult);
 }
Esempio n. 20
0
 public Slot(PointerItem pitem) => Pitem = pitem;