Example #1
0
 public void cast(ItemIds item, Vector3 target)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
     {
         player.Spellbook.CastSpell(getInvSlot(itemId).SpellSlot, target);
     }
 }
Example #2
0
 public void cast(ItemIds item, Obj_AI_Base target)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
     {
         Items.UseItem(itemId, target);
     }
 }
Example #3
0
 public void cast(ItemIds item, Obj_AI_Base target)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
     {
         SmoothMouse.addMouseEvent(target.Position);
         Items.UseItem(itemId, target);
     }
 }
Example #4
0
 public void cast(ItemIds item, Vector3 target)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
     {
         SmoothMouse.addMouseEvent(target);
         player.Spellbook.CastSpell(getInvSlot(itemId).SpellSlot, target);
     }
 }
Example #5
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var groupIds = ItemIds.Where(i => i != "0").AsIntegerList();

            if (groupIds.Any())
            {
                var groups = new GroupService(new RockContext())
                             .Queryable()
                             .Where(g => groupIds.Contains(g.Id))
                             .ToList();
                this.SetValues(groups);
            }
            else
            {
                this.SetValues(null);
            }
        }
Example #6
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        /// <exception cref="System.NotImplementedException"></exception>
        protected override void SetValuesOnSelect()
        {
            var accountIds = ItemIds.Where(i => i != "0").AsIntegerList();

            if (accountIds.Any())
            {
                var accounts = new FinancialAccountService(new RockContext())
                               .Queryable()
                               .Where(g => accountIds.Contains(g.Id))
                               .ToList();
                this.SetValues(accounts);
            }
            else
            {
                this.SetValues(null);
            }
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is UpdateItemModifierListsRequest other &&
                   ((ItemIds == null && other.ItemIds == null) || (ItemIds?.Equals(other.ItemIds) == true)) &&
                   ((ModifierListsToEnable == null && other.ModifierListsToEnable == null) || (ModifierListsToEnable?.Equals(other.ModifierListsToEnable) == true)) &&
                   ((ModifierListsToDisable == null && other.ModifierListsToDisable == null) || (ModifierListsToDisable?.Equals(other.ModifierListsToDisable) == true)));
        }
            public static IEnumerable <ItemDetails> WhereBuy(ItemDataPool dataPool, ItemIds item)
            {
                if (!dataPool.itemDataPool.ContainsKey(item))
                {
                    Console.WriteLine("This Item Not exist at data pool.");
                    return(new ItemDetails[0]);
                }

                var itemAndCities = new List <ItemDetails>(dataPool.itemDataPool[item]);

                itemAndCities.RemoveAll(details => details.sell_price_min == 0);
                var removeAll =
                    itemAndCities.RemoveAll(details => details.MinSellDateDiff.TotalHours > Configs.UpdateDateHoursLimit);

                Console.WriteLine("Removed " + removeAll + " Old Date Items. (" + Configs.UpdateDateHoursLimit + " Hours)");
                itemAndCities.Sort((details, itemDetails) => itemDetails.sell_price_min - details.sell_price_min);
                return(itemAndCities.ToArray());
            }
Example #9
0
        /// <summary>
        /// Selecteds the values as int.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <int> SelectedValuesAsInt()
        {
            var ids = new List <int>();

            if (ItemIds == null || !ItemIds.Any())
            {
                return(ids);
            }

            foreach (string keyVal in ItemIds)
            {
                int id;

                if (int.TryParse(keyVal, out id))
                {
                    ids.Add(id);
                }
            }

            return(ids);
        }
        public override int GetHashCode()
        {
            int hashCode = 1248477288;

            if (ItemIds != null)
            {
                hashCode += ItemIds.GetHashCode();
            }

            if (ModifierListsToEnable != null)
            {
                hashCode += ModifierListsToEnable.GetHashCode();
            }

            if (ModifierListsToDisable != null)
            {
                hashCode += ModifierListsToDisable.GetHashCode();
            }

            return(hashCode);
        }
Example #11
0
        public bool Equals(DestinyItemSetActionRequest input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     ItemIds == input.ItemIds ||
                     (ItemIds != null && ItemIds.SequenceEqual(input.ItemIds))
                     ) &&
                 (
                     CharacterId == input.CharacterId ||
                     (CharacterId.Equals(input.CharacterId))
                 ) &&
                 (
                     MembershipType == input.MembershipType ||
                     (MembershipType != null && MembershipType.Equals(input.MembershipType))
                 ));
        }
Example #12
0
        public override int GetHashCode()
        {
            int hashCode = 651000777;

            if (ItemIds != null)
            {
                hashCode += ItemIds.GetHashCode();
            }

            if (TaxesToEnable != null)
            {
                hashCode += TaxesToEnable.GetHashCode();
            }

            if (TaxesToDisable != null)
            {
                hashCode += TaxesToDisable.GetHashCode();
            }

            return(hashCode);
        }
Example #13
0
 public void FinalizeDataHolder()
 {
     foreach (int key in ItemIds.Where(itemId => itemId != -1)
              .Where(itemId => !SetItemManager.ItemSetsRecordsByItemIds.ContainsKey(itemId)))
     {
         SetItemManager.ItemSetsRecordsByItemIds.Add(key, this);
     }
     MaxItemsCount = ItemIds.Count(i => i > 0);
     if (Stat1Type > 0)
     {
         SetBonuses.Add(new Asda2SetBonus
         {
             Type  = Stat1Type,
             Value = Stat1Value
         });
     }
     if (Stat2Type > 0)
     {
         SetBonuses.Add(new Asda2SetBonus
         {
             Type  = Stat2Type,
             Value = Stat2Value
         });
     }
     if (Stat3Type > 0)
     {
         SetBonuses.Add(new Asda2SetBonus
         {
             Type  = Stat3Type,
             Value = Stat3Value
         });
     }
     foreach (Asda2SetBonus setBonuse in SetBonuses)
     {
         if (setBonuse.Type == 10)
         {
             setBonuse.Value = (int)((setBonuse.Value + 0.5) / 5.0);
         }
     }
 }
 public void Update(DestinyItemSetActionRequest?other)
 {
     if (other is null)
     {
         return;
     }
     if (!ItemIds.DeepEqualsListNaive(other.ItemIds))
     {
         ItemIds = other.ItemIds;
         OnPropertyChanged(nameof(ItemIds));
     }
     if (CharacterId != other.CharacterId)
     {
         CharacterId = other.CharacterId;
         OnPropertyChanged(nameof(CharacterId));
     }
     if (MembershipType != other.MembershipType)
     {
         MembershipType = other.MembershipType;
         OnPropertyChanged(nameof(MembershipType));
     }
 }
Example #15
0
        public GameObject GetPrefab(ItemIds id)
        {
            //return ItemPrefabs.Single(item => item.ItemId == id).Prefab;

            if (id == ItemIds.stone)
            {
                return(stonePrfab);
            }
            if (id == ItemIds.coin)
            {
                return(coinPrefab);
            }
            if (id == ItemIds.redStone)
            {
                return(redStonePrefab);
            }
            if (id == ItemIds.crystal)
            {
                return(crystalPrefab);;
            }
            return(stonePrfab);
        }
        public async Task <ShopItem[]> GetSellerDataForItem(ItemIds itemId)
        {
            // If the api hasn't been initialized then get out.
            if (!_IsReady)
            {
                throw new Exception("Api has not been initialized");
            }

            // Request data about the specified item for each planet
            List <ShopItem> results = new List <ShopItem>();

            foreach (BoundlessWorld world in Worlds)
            {
                // Download the data, respecting delay times.
                byte[] apiData = await RequestBytes($"{world.ApiUrlString}/shopping/S/{(int)itemId}");

                // Parse the result data for return to the caller.
                results.AddRange(ParseData(apiData, itemId, world.WorldId));
            }

            // Return the data we downloaded.
            return(results.ToArray());
        }
        public IDictionary <string, string> GetParameters()
        {
            var parameters = new YunDictionary
            {
                { "pagenum", PageNum },
                { "pagesize", PageSize },
                { "itemtitle", ItemTitle },
                { "mincreatetime", MinCreateTime },
                { "maxcreatetime", MaxCreateTime },
                { "nick", Nick },
                { "orderid", OrderId },
                { "mobile", Mobile },
                { "tradestatus", TradeStatus },
                { "commentstatus", CommentStatus },
                { "logisticsservice", LogisticsService },
                { "type", Type },
                { "itemids", ItemIds != null && ItemIds.Any() ? string.Join(",", ItemIds) : "" },
                { "ordertypes", OrderTypes },
                { "shopid", ShopId }
            };

            return(parameters);
        }
Example #18
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var registrationTemplates = new RegistrationTemplateService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(registrationTemplates);
        }
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var metricCategories = new MetricCategoryService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(metricCategories);
        }
Example #20
0
 public ItemDrop(ItemIds item, float dropChance = 0.3f)
 {
     this.item       = item;
     this.dropChance = dropChance;
 }
Example #21
0
        protected override Composite CreateBehavior()
        {
            return(new PrioritySelector(
                       CommonBehaviors.HandleLoading,
                       new Decorator(ret => QuestLogManager.InCutscene,
                                     new ActionAlwaysSucceed()
                                     ),
                       new Decorator(r => Request.IsOpen,
                                     new Action(r =>
            {
                var items = InventoryManager.FilledInventoryAndArmory.ToArray();
                for (int i = 0; i < ItemIds.Length; i++)
                {
                    BagSlot item;
                    item = items.FirstOrDefault(z => z.RawItemId == ItemIds[i] && !usedSlots.Contains(z));

                    if (item == null)
                    {
                        LogError($"We don't have any items with an id of {ItemIds[i]}.");
                    }
                    else
                    {
                        item.Handover();
                        usedSlots.Add(item);
                    }
                }

                usedSlots.Clear();
                Request.HandOver();
            })
                                     ),
                       new Decorator(r => Core.Player.HasTarget && UseItem && !doneUseItem,
                                     new Action(r =>
            {
                var targetNpc = GameObjectManager.GetObjectByNPCId(InteractNpcId);
                foreach (BagSlot slot in InventoryManager.FilledSlots)
                {
                    if (slot.RawItemId == ItemIds.FirstOrDefault())
                    {
                        Log($"Using {slot.EnglishName} on {targetNpc.EnglishName}.");
                        slot.UseItem(targetNpc);
                    }
                }

                if (Core.Player.IsCasting)
                {
                    doneUseItem = true;
                }

                if (SelectYesno.IsOpen)
                {
                    doneUseItem = true;
                }
            })
                                     ),
                       new Decorator(ret => HasInteractObjects && DutyManager.InInstance && !Core.Player.InCombat && InteractableTarget != null,
                                     new PrioritySelector(
                                         new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) <= 5,
                                                       new Action(r =>
            {
                InteractableTarget.Interact();
            })
                                                       ),
                                         new Decorator(ret => Core.Player.Location.Distance(InteractableTarget.Location) > 5,
                                                       CommonBehaviors.MoveAndStop(ret => InteractableTarget.Location, 3)
                                                       ),
                                         new ActionAlwaysSucceed()
                                         )
                                     ),
                       new Decorator(ret => HasCheckpoints && DutyManager.InInstance,
                                     new PrioritySelector(
                                         new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) < 5,
                                                       new Action(r =>
            {
                Checkpoints.Remove(Checkpoints.First());
            })
                                                       ),
                                         new Decorator(ret => Core.Player.Location.Distance(CurrentCheckpoint) > 5,
                                                       CommonBehaviors.MoveAndStop(ret => CurrentCheckpoint, 3)
                                                       )
                                         )
                                     ),

                       base.CreateBehavior()
                       ));
        }
Example #22
0
 public static bool HasItem(this Inventory inv, ItemIds id) => inv.Items.Exists(i => i.Id == id);
Example #23
0
 public static InventoryItem GetItem(this Inventory inv, ItemIds id) => inv.Items.Find(i => i.Id == id);
Example #24
0
 public InventoryItem(ItemIds toAdd, int parInvPos)
 {
     id     = toAdd;
     amount = 1;
     invPos = parInvPos;
 }
Example #25
0
 public ItemWare(int cost, string title, string desc, ItemIds itemId) : base(cost, title, desc)
 {
     this.itemId = itemId;
 }
Example #26
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var schedules = new ScheduleService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(schedules);
        }
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var workflowTypes = new WorkflowTypeService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(workflowTypes);
        }
    public static string ProcessModXml(Stream stream, string dir)
    {
        XElement root = XElement.Load(stream);

        foreach (var elem in root.Elements("Ground"))
        {
            short  type = 0x3000;
            string id   = elem.Attribute("id").Value;

            if (!ItemIds.ContainsKey(id))
            {
                for (var i = 0x3001; i < 0xffff; i++)
                {
                    if (!UsedIds.Contains((short)i))
                    {
                        ItemIds.Add(id, (short)i);
                        UsedIds.Add((short)i);
                    }
                }
            }
            type = ItemIds[id];

            elem.SetAttributeValue("type", type);

            TypeToId[type]      = id;
            IdToType[id]        = type;
            TypeToElement[type] = elem;

            TileDescs[type] = new TileDesc(elem);
        }
        foreach (var elem in root.Elements("Object"))
        {
            if (elem.Element("Class") == null)
            {
                continue;
            }
            string cls  = elem.Element("Class").Value;
            short  type = 0x4000;
            string id   = elem.Attribute("id").Value;

            if (!ItemIds.ContainsKey(id))
            {
                for (var i = 0x4001; i < 0xffff; i++)
                {
                    if (!UsedIds.Contains((short)i))
                    {
                        ItemIds.Add(id, (short)i);
                        UsedIds.Add((short)i);
                        break;
                    }
                }
            }
            type = ItemIds[id];

            Console.Out.WriteLine("(" + new DirectoryInfo(dir).Name + ") Adding mod object: " + id + " (" + type.ToString() + ")");
            if (File.Exists(dir + ds + id + ".png"))
            {
                Console.Out.WriteLine("(" + new DirectoryInfo(dir).Name + ") Adding mod texture: " + id);

                if (elem.Element("RemoteTexture") != null)
                {
                    elem.Element("RemoteTexture").Remove();
                }
                if (elem.Element("Texture") != null)
                {
                    elem.Element("Texture").Remove();
                }

                XElement texElem = new XElement("RemoteTexture",
                                                new XElement("Instance",
                                                             new XText("production")
                                                             ),
                                                new XElement("Id",
                                                             new XText("mod:" + id)
                                                             )
                                                );

                elem.Add(texElem);

                try
                {
                    ModTextures.Add(id, File.ReadAllBytes(dir + ds + id + ".png"));
                }
                catch { Console.Out.WriteLine("(" + new DirectoryInfo(dir).Name + ") Error adding texture: " + id); }
            }

            elem.SetAttributeValue("type", type);

            TypeToId[type]      = id;
            IdToType[id]        = type;
            TypeToElement[type] = elem;

            if (cls == "Equipment" || cls == "Dye" || cls == "Pet")
            {
                ItemDescs[type] = new Item(elem);
                if (elem.Element("Shop") != null)
                {
                    XElement shop = elem.Element("Shop");
                    ItemShops[type]  = shop.Element("Name").Value;
                    ItemPrices[type] = Utils.FromString(shop.Element("Price").Value);
                }
            }
            if (cls == "Character" || cls == "GameObject" || cls == "Wall" ||
                cls == "ConnectedWall" || cls == "CaveWall" || cls == "Portal")
            {
                ObjectDescs[type] = new ObjectDesc(elem);
            }
            if (cls == "Portal")
            {
                try
                {
                    PortalDescs[type] = new PortalDesc(elem);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error for portal: " + type + " id: " + id);

                    /*3392,1792,1795,1796,1805,1806,1810,1825 -- no location, assume nexus?*
                     *  Tomb Portal of Cowardice,  Dungeon Portal,  Portal of Cowardice,  Realm Portal,  Glowing Portal of Cowardice,  Glowing Realm Portal,  Nexus Portal,  Locked Wine Cellar Portal*/
                }
            }

            XElement key = elem.Element("Key");
            if (key != null)
            {
                Keys.Add(type);
                KeyPrices[type] = Utils.FromString(key.Value);
            }
        }
        foreach (var elem in root.Elements("Dungeon"))
        {
            string name     = elem.Attribute("name").Value;
            short  portalid = (short)Utils.FromString(elem.Attribute("type").Value);

            IdToDungeon[portalid] = name;
            DungeonDescs[name]    = new DungeonDesc(elem);
        }
        using (StringWriter sw = new StringWriter())
        {
            root.Save(sw);
            return(sw.ToString());
        }
    }
Example #29
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var groups = new GroupService().Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(groups);
        }
Example #30
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var reports = new ReportService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(reports);
        }
Example #31
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var dataViews = new DataViewService(new RockContext()).Queryable().Where(g => ItemIds.Contains(g.Id.ToString()));

            this.SetValues(dataViews);
        }
Example #32
0
 public InventoryItem(ItemIds toAdd, int parInvPos, int num) : this(toAdd, parInvPos) => amount = num;
Example #33
0
 public void cast(ItemIds item, Vector3 target)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
         getInvSlot(itemId).UseItem(target);
 }
Example #34
0
        /// <summary>
        /// Sets the values on select.
        /// </summary>
        protected override void SetValuesOnSelect()
        {
            var pages = new PageService(new RockContext()).Queryable().Where(p => ItemIds.Contains(p.Id.ToString()));

            this.SetValues(pages);
        }
Example #35
0
 public void cast(ItemIds item)
 {
     var itemId = (int)item;
     if (Items.CanUseItem(itemId))
         Items.UseItem(itemId);
 }
Example #36
0
        public override TestResult Execute()
        {
            if (string.IsNullOrEmpty(Session))
            {
                return(TestResult.ParameterMissing("Session"));
            }

            DaSession session = GetProperty(Session) as DaSession;

            if (session == null)
            {
                return(TestResult.ParameterInvalid("Session"));
            }

            ValueQT[] values;

            if (Values.Count == 0)
            {
                if (!string.IsNullOrEmpty(ValuesProperty))
                {
                    values = GetProperty(ValuesProperty) as ValueQT[];
                    if (values == null)
                    {
                        return(TestResult.ParameterInvalid("ValuesProperty"));
                    }
                }
                else
                {
                    return(TestResult.ParameterMissing("Values"));
                }
            }
            else
            {
                //if the quality was not set ; set it to the value QUALITY_NOT_SET
                for (int i = 0; i < Values.Count; i++)
                {
                    if (Values[i].Wrapped.Quality == Softing.OPCToolbox.EnumQuality.BAD_WAITING_FOR_INITIAL_DATA)
                    {
                        Values[i].Wrapped.SetData(Values[i].Wrapped.Data, Softing.OPCToolbox.EnumQuality.QUALITY_NOT_SET, Values[i].Wrapped.TimeStamp);
                    }
                }
                values = Value.CreateSDKCollection(Values);
            }

            try
            {
                int   result = (int)EnumResultCode.S_FALSE;
                int[] results;

                string[] itemIDs   = ItemIds.ToArray();
                string[] itemPaths = ItemPaths.Count > 0 ? ItemPaths.ToArray() : null;

                if (ExecutionType == EnumExecutionType.SYNCHRONOUS)
                {
                    result = session.Write(itemIDs, itemPaths, values, out results, null);
                }
                else
                {
                    m_asyncExecutionContext = DaExecutionContext.Next;
                    ExecutionOptions executionOptions = new ExecutionOptions(EnumExecutionType.ASYNCHRONOUS, m_asyncExecutionContext);

                    m_waitHandle = new System.Threading.AutoResetEvent(false);

                    SessionWriteEventHandler asyncHandler = new SessionWriteEventHandler(session_WriteCompleted);
                    session.WriteCompleted += asyncHandler;

                    result = session.Write(itemIDs, itemPaths, values, out results, executionOptions);

                    if (m_waitHandle.WaitOne(30000))
                    {
                        result  = m_asyncResult;
                        results = m_asyncResults;
                    }

                    session.WriteCompleted -= asyncHandler;
                }

                if (ResultCode.SUCCEEDED(result))
                {
                    if (!string.IsNullOrEmpty(ResultsProperty))
                    {
                        SetProperty(ResultsProperty, results);
                    }

                    if (ValidateAllResults)
                    {
                        for (int i = 0; i < results.Length; i++)
                        {
                            if (ResultCode.FAILED(results[i]))
                            {
                                EnumResultCode resCode = (EnumResultCode)Enum.Parse(typeof(EnumResultCode), results[i].ToString());

                                return(TestResult.Failed(string.Format("Result {0} failed with the code: {1}  ({2})", i, resCode.ToString(), results[i])));
                            }
                        }
                    }
                    else if (ExpectedResults.Count > 0)
                    {
                        //validate with expected values
                        if (ExpectedResults.Count != results.Length)
                        {
                            return(new DaWriteTestResult(result, results, "Unexpected number of results"));
                        }

                        for (int i = 0; i < results.Length; i++)
                        {
                            if (results[i] != ExpectedResults[i])
                            {
                                EnumResultCode resCode         = (EnumResultCode)Enum.Parse(typeof(EnumResultCode), results[i].ToString());
                                EnumResultCode resExpectedCode = (EnumResultCode)Enum.Parse(typeof(EnumResultCode), ExpectedResults[i].ToString());

                                return(new DaWriteTestResult(result, results, string.Format("Unexpected result code for item {0}: received {1}  ({2}) instead of {3}  ({4})", i, resCode.ToString(), results[i], resExpectedCode.ToString(), ExpectedResults[i])));
                            }
                        }
                    }

                    return(new DaWriteTestResult(result, results));
                }
                else
                {
                    EnumResultCode resCode = (EnumResultCode)Enum.Parse(typeof(EnumResultCode), result.ToString());
                    if (!string.IsNullOrEmpty(ExpectedServiceResult))
                    {
                        EnumResultCode expectedResCode = (EnumResultCode)Enum.Parse(typeof(EnumResultCode), ExpectedServiceResult.ToString());
                        if (expectedResCode != resCode)
                        {
                            return(TestResult.Failed(string.Format("Unexpected service result: expected {0}, actual {1}", resCode, expectedResCode)));
                        }
                        return(TestResult.Success());
                    }

                    return(TestResult.Failed(string.Format("Call returned: {0}  ({1})", resCode.ToString(), result)));
                }
            }
            catch (Exception ex)
            {
                return(new TestResult(ex));
            }
        }