Example #1
0
 public ItemBase RemoveItem()
 {
     var item = this.item;
     item.Hide();
     this.item = null;
     return item;
 }
Example #2
0
 private void ActorUnitMoved(object sender, MovementEventArgs e)
 {
     var floor = Cell.GetComponent<FloorTile>();
     if (floor != null)
     {
         //Item pickup
         if (floor.HasItem && !HasItem)
         {
             this.item = floor.RemoveItem();
             FindObjectOfType<GameManager>().AcquiredTarget(this.item.Target);
         }
         //Win condition
         if(floor.Rune.HasValue && FindObjectOfType<GameManager>().HasAcquiredTarget(floor.Rune.Value))
         {
             FindObjectOfType<GameManager>().playerEscaped++;
             RemoveLater(); return;
         }
     }
     //Move camera along with the player
     if (Camera.current != null)
     {
         var cameraController = Camera.current.GetComponent<CameraController>();
         if (cameraController != null) { cameraController.target = e.DestinationCell.transform; }
     }
 }
 //applies the appropriate material to a weapon model
 public virtual void SwitchTexture(ItemBase.tOreType type)
 {
     switch (type)
     {
         case ItemBase.tOreType.Bone:
             transform.renderer.material = materials[0];
             break;
         case ItemBase.tOreType.Copper:
             transform.renderer.material = materials[1];
             break;
         case ItemBase.tOreType.Dragon:
             transform.renderer.material = materials[2];
             break;
         case ItemBase.tOreType.Ethereal:
             transform.renderer.material = materials[3];
             break;
         case ItemBase.tOreType.Iron:
             transform.renderer.material = materials[4];
             break;
         case ItemBase.tOreType.Mithril:
             transform.renderer.material = materials[5];
             break;
         case ItemBase.tOreType.Steel:
         default:
             transform.renderer.material = materials[6];
             break;
     }
 }
Example #4
0
 // ------------------------------------------------------------------------------------ //
 public void onItemRecieved(ItemBase item)
 {
     if (item is ItemBonus) {
         starsCount++;
         gameUI.setStarsText(starsCount);
     }
 }
    public void EquipItem(ItemBase.ItemType itemType)
    {
        if (equippedItem != null &&
            equippedItem.thisItemType == itemType &&
            equippedItem.thisItemType != ItemBase.ItemType.none)
        {

            EquipItem(ItemBase.ItemType.none);

            return;
        }

        if (!equipSlots.ContainsKey(itemType)) { return; }//only allow equipping if item is in the Player's inventory

        if (equippedItem != null) {
            PutAwayEquippedItem();//put away the previously equipped item
        }

        //reset all items to unequiped
        foreach (KeyValuePair<ItemBase.ItemType, EquipmentSlot> kvp in equipSlots) {
            kvp.Value.currentlyEquipped = false;
        }

        equipSlots[itemType].currentlyEquipped = true;
        equippedItem = equipSlots[itemType].item;

        PutEquippedItemInHand();//show newly equipped item
    }
Example #6
0
 public void OnPlayerCollision(ItemBase itemBase)
 {
     if (!_playerBase.PlayerInventory.IsFull ())
     {
         itemBase.ItemVisual.Disappear ();
     }
 }
    public ItemField([NotNull] string fieldName)
    {
      Assert.ArgumentNotNull(fieldName, "fieldName");

      this.FieldName = fieldName;
      this.item = null;
    }
Example #8
0
 public static void DisableItem(ItemBase item)
 {
     if (activeItem == item)
     {
         activeItem = null;
     }
 }
Example #9
0
 public static void EnableItem(ItemBase item)
 {
     if (activeItem != item)
     {
         activeItem = item;
     }
 }
 public bool ItemInInventory(ItemBase.ItemType type)
 {
     if (equipSlots.ContainsKey(type)) {
         return true;
     }
     else {
         return false;
     }
 }
 public ItemBaseEntity(ItemBase item)
     : base(item.IsProcessed ? "1" : "0", item.ResourceId.ToString())
 {
     ResourceId = item.ResourceId;
     FileName = item.FileName;
     Received = item.Received;
     Processed = item.Processed;
     IsProcessed = item.IsProcessed;
 }
 public void Enqueue(ItemBase item)
 {
     CloudQueueMessage message;
     using(var stream = new MemoryStream()){
         new BinaryFormatter().Serialize(stream, item);
         stream.Flush();
         message = new CloudQueueMessage(stream.ToArray());
     }
     GetQueue().AddMessage(message);
 }
Example #13
0
    /// <summary>
    /// This constructor makes an item with the specified name and ore type.
    /// </summary>
    /// <param name="name"></param>
    /// <param name="oreType"></param>
    public ItemBase(string name, ItemBase.tOreType oreType)
    {
        this.oreType = oreType;
        type = tItemType.Item;
        _name = name;
        _description = "A fine " + _name + ".";
        _quantity = 1;

        neededOreQuantity = 1;
        neededPoints = 1;
    }
Example #14
0
 /// <summary>
 /// Constructs a new Cube struct.
 /// </summary>
 /// <param name="_parent">Parent of this cube</param>
 /// <param name="_type">Type of this cube</param>
 /// <param name="_x">X Coordinate of this cube's position</param>
 /// <param name="_y">Y Coordinate of this cube's position</param>
 /// <param name="_z">Z Coordinate of this cube's position</param>
 public Cube(CubeTracker _parent,
             ItemBase.tOreType _type,
             int _x, int _y, int _z)
     : this()
 {
     Parent = _parent;
     Type = _type;
     X = _x;
     Y = _y;
     Z = _z;
 }
Example #15
0
 public void OnItemCollision(ItemBase itemBase)
 {
     if (!IsFull() && !_itemList.Contains(itemBase))
     {
         itemBase.ItemProperty.WeaponType = WeaponController.RandomWeaponType ();
         _itemList.Add (itemBase);
         itemBase.ItemProperty.ResetPosessionCount();
         if (OnInventoryAdded != null)
         {
             OnInventoryAdded(itemBase);
         }
     }
 }
        public void Update(ItemBase item)
        {
            // this update actually needs to do a delete and re-add since I made the isprocesed value the partition key
            TableServiceContext serviceContext = GetContext();
            var entity = serviceContext.CreateQuery<ItemBaseEntity>(_tableName)
                                       .Where(ib => ib.RowKey == item.ResourceId.ToString())
                                       .AsTableServiceQuery()
                                       .FirstOrDefault();

            serviceContext.DeleteObject(entity);
            serviceContext.AddObject(_tableName, new ItemBaseEntity(item));

            serviceContext.SaveChangesWithRetries();
        }
Example #17
0
 public void ReactToItem(ItemBase.ItemType itemType)
 {
     if (itemType == ItemBase.ItemType.gun) {
         Despawn();
     }
     if (itemType == ItemBase.ItemType.flashlight) {
         if (_isReal) {
             Enrage();
         }
         else {
             Despawn();
         }
     }
 }
Example #18
0
    // return the item_id which is the type we given
    public string[] Contain_Item_Type(ItemBase.Type type)
    {
        HashSet<string> ret = new HashSet<string>();
        foreach(ItemSlot it in backpack)
        {
            ItemBase item = ItemDatabase.GetItem(it.Get_Item_ID());
            if (item == null)
                continue;

            if (type == item.type)
            {
                ret.Add(item.item_id);
            }
        }

        return (new List<string>(ret)).ToArray();
    }
        public List<ArticleRecommender> GetArtikliPreporucine(double ElasticnostFinal = 0.65, double ElasticnostTag = 0.65, double ElasticnostKategorije = 0.65, double ElasticnostOcjene = 0.35)
        {
            List<Article> la = new List<Article>();
            List<ArticleRecommender> listaPreporuka = new List<ArticleRecommender>();

            using (DBBL Baza = new DBBL())
            {
                la = Baza.GetAllWikis();
                wiki = this.wiki;

                VektorskaDuzina<Tag> vektorTagDomaci = new VektorskaDuzina<Tag>(wiki.Tags.ToArray());
                VektorskaDuzina<Category> vektorKategorijeDomaci = new VektorskaDuzina<Category>(wiki.Categories.ToArray());
                VektorskaDuzina<ArticlesRating> vektorRatingDomaci = new VektorskaDuzina<ArticlesRating>(wiki.ArticlesRatings.ToArray());

                foreach (var w in la)
                {
                    VektorskaDuzina<Tag> vektorTagExterni = new VektorskaDuzina<Tag>(w.Tags.ToArray());
                    ItemBase<Tag> ibTag = new ItemBase<Tag>(vektorTagDomaci, vektorTagExterni);

                    VektorskaDuzina<Category> vektorKategorijeExterni = new VektorskaDuzina<Category>(w.Categories.ToArray());
                    ItemBase<Category> ibKategorije = new ItemBase<Category>(vektorKategorijeDomaci, vektorKategorijeExterni);

                    VektorskaDuzina<ArticlesRating> vektorRatingExterni = new VektorskaDuzina<ArticlesRating>(w.ArticlesRatings.ToArray());
                    ItemBase<ArticlesRating> ibRating = new ItemBase<ArticlesRating>(vektorRatingDomaci, vektorRatingExterni);

                    double tpr = ibTag.GetSlicnost(false);
                    double kpr = ibKategorije.GetSlicnost(false);
                    double rpr = ibRating.GetSlicnost(false);
                    double pr = (tpr + kpr ) * 1/(double)2;
                    if (pr >= ElasticnostFinal && w.ArticlesID != wiki.ArticlesID)
                    {
                        listaPreporuka.Add(new ArticleRecommender()
                        {
                            Name = w.Name,
                            Score = pr,
                            WikiID = w.ArticlesID
                        });
                    }

                }
                return listaPreporuka.OrderByDescending(x=>x.Score).Take(10).ToList();

            }
        }
Example #20
0
    void LoadItem(string path)
    {
        IniFile ini = new IniFile();
        if (!ini.Load_File(path))
        {
            Debug.LogError("File " + path + " NOT exists!");
        }

        foreach(string s in ini.Get_All_Section())
        {
            ini.Goto_Section(s);
            ItemBase item = new ItemBase();

            item.item_id = s;

            item.displayName = ini.Get_String("displayName","unnamed");
            item.ValidType(ini.Get_String("type"));
            item.color = ini.Get_Color("color",Color.white);

            string tPath = ini.Get_String("icon","");
            if (tPath != "")
            {
                Texture t = Resources.Load<Texture>(tPath);
                item.icon = t;
            }

            tPath = ini.Get_String("att1","");
            if (tPath != "")
            {
                Texture t = Resources.Load<Texture>(tPath);
                item.att1 = t;
            }

            item.sell = ini.Get_Int("sell",0);
            item.buy = ini.Get_Int("buy",0);
            item.weight = ini.Get_Float("weight",0f);
            item.comment = ini.Get_String("comment","");
            item.maxStack = ini.Get_Int("maxStack",int.MaxValue);

            database.Add(s,item);
        }
    }
Example #21
0
    public override void Awake()
    {
        base.Awake();

        activeItem = null;

        talkIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/talk_icon");
        useIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/use_icon");
        pickupIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/pickup_icon");
        portalIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/portal_icon");
        actionIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/action_icon");
        actionShadowIcon = ResourceManager.Instance.LoadTexture2D("GUI/HUD/action_shadow");

        commandStyle = new GUIStyle();
        commandStyle.font = (Font)ResourceManager.Instance.LoadFont(ResourceManager.FontComicSerif);
        commandStyle.alignment = TextAnchor.MiddleCenter;
        commandStyle.fontSize = 20;
        commandStyle.normal.textColor = new Color(0.2f, 0.2f, 0.2f);

        hintStyle = new GUIStyle();
        hintStyle.font = (Font)ResourceManager.Instance.LoadFont(ResourceManager.FontDroidSansBold);
        hintStyle.alignment = TextAnchor.MiddleLeft;
        hintStyle.normal.textColor = Color.white;
        hintStyle.fontSize = 14;

        hintContent = new GUIContent();

        // Create our Rects here to avoid garbage collection

        commandPositionRect = new Rect(Screen.width * 0.5f - actionIcon.width * 0.5f, Screen.height - actionIcon.height - 5, actionIcon.width, actionIcon.height);
        commandTextPositionRect = new Rect(commandPositionRect.x + 36, commandPositionRect.y, commandPositionRect.width - 50, commandPositionRect.height);

        hintPositionRect = new Rect(0, 0, talkIcon.width, talkIcon.height);
        hintTextPositionRect = new Rect(0, 0, 100, 50);
        actionShadowRect = new Rect(0, 0, 100, 50);
    }
Example #22
0
 public ItemBase GetItem()
 {
     return(ItemBase.Get(ItemId));
 }
Example #23
0
 public static void IsNovaWand(ItemBase item)
 {
     Assert.AreEqual(500, item.Attack);
     Assert.AreEqual(3000, item.Defense);
     Assert.AreEqual(500, item.Strength);
     Assert.AreEqual(3500, item.Spirit);
     Assert.AreEqual(10, item.Weight);
     Assert.AreEqual(320, item.Characters);
     Assert.AreEqual(7, item.Slot);
     Assert.AreEqual(1, item.Range);
     Assert.AreEqual(500000000, item.Price);
 }
Example #24
0
 public static void IsM9(ItemBase item)
 {
     Assert.AreEqual(8, item.Range);
     Assert.AreEqual(2, item.ScatterRange);
 }
Example #25
0
 public static void IsBeer(ItemBase item)
 {
     Assert.AreEqual(0, item.HP);
     Assert.AreEqual(400, item.MP);
     Assert.AreEqual(14, item.Slot);
     Assert.AreEqual(200, item.Price);
 }
Example #26
0
        static public object Rit_RefreshUpgradeIdol(Thea2.Server.Group target, RitualsTask sourceTask)
        {
            if (target != null && target.items != null)
            {
                BuildingRecipe br = (BuildingRecipe)BUILD_REC.IDOL;

                var oldIdol = target.items.Find(o => o.GetItem().GetSource() == br);
                if (oldIdol == null)
                {
                    return(null);
                }

                var oldDemon = oldIdol.GetItem().superConnection;

                #region Create new idol
                List <ItemBase> ibs = ItemBase.items.Where(o =>
                                                           o.GetSource() == br &&
                                                           (o as ItemCrafted).recipeIngredientCount[0] == sourceTask.GetMaterial1Count() &&
                                                           (o as ItemCrafted).recipeIngreadients[0].Get() == sourceTask.GetMaterial1()).ToList();

                if (ibs.Count != 1)
                {
                    Debug.LogError("[ERROR]Number of options in upgrade idol is different than 1: " + ibs.Count);
                    return(null);
                }

                ItemCrafted ib    = ibs[0] as ItemCrafted;
                ItemBase    inst  = ib.Clone <ItemBase>(true);
                Skill       skill = null;
                if (br.skills != null)
                {
                    if (!SkillInstance.skillPacks.ContainsKey(br.skills))
                    {
                        Debug.LogError("[ERROR]Missing skillpack " + br.skills);
                        return(null);
                    }

                    List <Skill>           si            = SkillInstance.skillPacks[br.skills];
                    HashSet <Tag>          essences      = new HashSet <Tag>();
                    Dictionary <Tag, FInt> essenceCounts = new Dictionary <Tag, FInt>();
                    List <Skill>           valid         = new List <Skill>();

                    CountedResource material1 = null;
                    CountedResource material2 = null;
                    if (ib.recipeIngreadients.Length > 0)
                    {
                        material1 = new CountedResource();
                        material1.resourceName  = ib.recipeIngreadients[0].Get();
                        material1.resourceCount = ib.recipeIngredientCount[0];
                    }
                    if (ib.recipeIngreadients.Length > 1)
                    {
                        material2 = new CountedResource();
                        material2.resourceName  = ib.recipeIngreadients[1].Get();
                        material2.resourceCount = ib.recipeIngredientCount[1];
                    }

                    if (material1 != null)
                    {
                        foreach (var v in material1.resourceName.essences)
                        {
                            FInt count = new FInt(v.amount) * material1.resourceCount;
                            if (count <= 0)
                            {
                                continue;
                            }

                            essences.Add(v.tag);
                            essenceCounts[v.tag] = count;
                        }
                    }
                    if (material2 != null)
                    {
                        foreach (var v in material2.resourceName.essences)
                        {
                            FInt count = new FInt(v.amount) * material2.resourceCount;
                            if (count <= 0)
                            {
                                continue;
                            }

                            if (!essences.Contains(v.tag))
                            {
                                essences.Add(v.tag);
                            }

                            if (!essenceCounts.ContainsKey(v.tag))
                            {
                                essenceCounts[v.tag] = count;
                            }
                            else
                            {
                                essenceCounts[v.tag] += count;
                            }
                        }

                        if (essences.Count > 0)
                        {
                            Tag g = (Tag)TAG.ESSENCE_GRAY;
                            essences.Add(g);
                        }
                    }

                    foreach (var v in si)
                    {
                        bool b = true;
                        foreach (var e in v.baseEssence)
                        {
                            if (!essences.Contains(e.tag))
                            {
                                b = false;
                                break;
                            }
                        }

                        if (!b)
                        {
                            continue;
                        }

                        valid.Add(v);
                    }

                    if (valid.Count < 1)
                    {
                        Debug.LogError("[ERROR]No valid skill during upgrade of the idol in skillpack " + br.skills);
                        return(null);
                    }
                    skill = valid[0];
                }

                if (skill != null)
                {
                    inst.skill = SkillInstance.Instantiate(skill, inst);
                }
                #endregion
                #region Destroy old idol
                //destroy old idol
                var ceb = target.TakeItem(oldIdol.GetItem(), 1);
                ceb.GetItem().Destroy();
                #endregion

                //Add new idol
                var cebNewIdol = target.AddItem(inst, 1);

                //super connect with old demon to keep it alive if one was still there, otherwise it will create new one.
                if (oldDemon != null && oldDemon.Valid())
                {
                    cebNewIdol.GetItem().SuperConnectWith(oldDemon);
                }
            }

            return(null);
        }
Example #27
0
 public ItemVm(IActuator actuator)
 {
     baseItem = actuator as ItemBase;
 }
Example #28
0
    public void useItem(ItemBase item)
    {
        activeItem = true;
        if (item == null)
        {
            Debug.Log("Não possui item neste slot do intentario");
            return;
        }

        int efeito    = item.getEfeito();
        int vidaAtual = jogador.getVida();
        int aux       = efeito + vidaAtual;

        if (GameController.getCurrentState() == GAME_STATE.IN_BATTLE)
        {
            if (item.getCurrentState() == TYPE_ITEM.IN_POCAO)
            {
                if (aux > jogador.getMaxVida())
                {
                    jogador.setVida(jogador.getMaxVida());
                }
                else if (aux < jogador.getMaxVida())
                {
                    jogador.setVida(efeito + jogador.getVida());
                }
                Debug.Log("usou pocao");
                faseMonstro();
            }
            else
            {
                int ataquePlayer = Random.Range((jogador.getAtaque() / 2), jogador.getAtaque());
                int efeitoMagia  = item.getEfeito();
                Debug.Log("Ataque com magia: " + efeitoMagia);
                fight(efeitoMagia);
            }
            inventory.gameObject.SetActive(!inventory.gameObject.activeSelf);
        }
        if (GameController.getCurrentState() == GAME_STATE.IN_INVENTORY)
        {
            if (item.getCurrentState() != TYPE_ITEM.IN_MAGIC)
            {
                if (aux > jogador.getMaxVida())
                {
                    jogador.setVida(jogador.getMaxVida());
                }
                else if (aux < jogador.getMaxVida())
                {
                    jogador.setVida(efeito + jogador.getVida());
                }
                Debug.Log("usou pocao");
            }
            else
            {
                sourceBattle.clip = audioBattle.getAudioBattle(19);
                sourceBattle.Play();
                Debug.Log("magia não pode ser usada fora de batalha");
                //sourceNumbers = addAudioSourceNumbers(audioBattle.selectAudio(19));
                //sourceNumbers.Play(); // magia não pode ser usada fora de batalha
            }
        }
    }
Example #29
0
 public InventoryItem(ItemBase item, int itemAmount)
 {
     this.item       = item;
     this.itemAmount = itemAmount;
 }
Example #30
0
 void DoWork(ItemBase itembase)
 {
     Console.WriteLine("In DoWork(itemBase)");
 }
Example #31
0
        /// <summary>
        /// Spawn an item to this map instance.
        /// </summary>
        /// <param name="x">The horizontal location of this item</param>
        /// <param name="y">The vertical location of this item.</param>
        /// <param name="item">The <see cref="Item"/> to spawn on the map.</param>
        /// <param name="amount">The amount of times to spawn this item to the map. Set to the <see cref="Item"/> quantity, overwrites quantity if stackable!</param>
        /// <param name="owner">The player Id that will be the temporary owner of this item.</param>
        public void SpawnItem(int x, int y, Item item, int amount, Guid owner)
        {
            if (item == null)
            {
                Log.Warn($"Tried to spawn {amount} of a null item at ({x}, {y}) in map {Id}.");

                return;
            }

            var itemDescriptor = ItemBase.Get(item.ItemId);

            if (itemDescriptor == null)
            {
                Log.Warn($"No item found for {item.ItemId}.");

                return;
            }

            // if we can stack this item or the user configured to drop items consolidated, simply spawn a single stack of it.
            if (itemDescriptor.Stackable || Options.Loot.ConsolidateMapDrops)
            {
                var mapItem = new MapItem(item.ItemId, amount, item.BagId, item.Bag)
                {
                    X             = x,
                    Y             = y,
                    DespawnTime   = Globals.Timing.Milliseconds + Options.Loot.ItemDespawnTime,
                    Owner         = owner,
                    OwnershipTime = Globals.Timing.Milliseconds + Options.Loot.ItemOwnershipTime,
                    VisibleToAll  = Options.Loot.ShowUnownedItems
                };

                // If this is a piece of equipment, set up the stat buffs for it.
                if (itemDescriptor.ItemType == ItemTypes.Equipment)
                {
                    mapItem.SetupStatBuffs(item);
                }

                MapItems.Add(mapItem);
                PacketSender.SendMapItemUpdate(Id, MapItems.Count - 1);
            }
            else
            {
                // Oh boy here we go! Set quantity to 1 and drop multiple!
                for (var i = 0; i < amount; i++)
                {
                    var mapItem = new MapItem(item.ItemId, amount, item.BagId, item.Bag)
                    {
                        X             = x,
                        Y             = y,
                        DespawnTime   = Globals.Timing.Milliseconds + Options.Loot.ItemDespawnTime,
                        Owner         = owner,
                        OwnershipTime = Globals.Timing.Milliseconds + Options.Loot.ItemOwnershipTime,
                        VisibleToAll  = Options.Loot.ShowUnownedItems
                    };

                    // If this is a piece of equipment, set up the stat buffs for it.
                    if (itemDescriptor.ItemType == ItemTypes.Equipment)
                    {
                        mapItem.SetupStatBuffs(item);
                    }

                    MapItems.Add(mapItem);
                }
                PacketSender.SendMapItemsToProximity(Id);
            }
        }
Example #32
0
 private void AssignEditorItem(Guid id)
 {
     mEditorItem = ItemBase.Get(id);
     UpdateEditor();
 }
Example #33
0
 // Use this for initialization
 public virtual void Init(ItemBase _parent)
 {
     parent = _parent;
 }
Example #34
0
 public bool ReceiveFreight(ItemBase item)
 {
     return(Machine.TryInsert(Station, item));
 }
        /// <summary>
        /// Triggers the enable protection operation for the given item
        /// </summary>
        /// <returns>The job response returned from the service</returns>
        public BaseRecoveryServicesJobResponse EnableProtection()
        {
            string azureVMName              = (string)ProviderData[ItemParams.AzureVMName];
            string azureVMCloudServiceName  = (string)ProviderData[ItemParams.AzureVMCloudServiceName];
            string azureVMResourceGroupName = (string)ProviderData[ItemParams.AzureVMResourceGroupName];
            string parameterSetName         = (string)ProviderData[ItemParams.ParameterSetName];

            PolicyBase policy = (PolicyBase)
                                ProviderData[ItemParams.Policy];

            ItemBase itemBase = (ItemBase)
                                ProviderData[ItemParams.Item];

            AzureVmItem item = (AzureVmItem)
                               ProviderData[ItemParams.Item];
            // do validations

            string containerUri     = "";
            string protectedItemUri = "";
            bool   isComputeAzureVM = false;
            string sourceResourceId = null;

            if (itemBase == null)
            {
                isComputeAzureVM = string.IsNullOrEmpty(azureVMCloudServiceName) ? true : false;
                string azureVMRGName = (isComputeAzureVM) ?
                                       azureVMResourceGroupName : azureVMCloudServiceName;

                ValidateAzureVMWorkloadType(policy.WorkloadType);

                ValidateAzureVMEnableProtectionRequest(
                    azureVMName,
                    azureVMCloudServiceName,
                    azureVMResourceGroupName,
                    policy);

                ProtectableObjectResource protectableObjectResource =
                    GetAzureVMProtectableObject(azureVMName, azureVMRGName, isComputeAzureVM);

                Dictionary <UriEnums, string> keyValueDict =
                    HelperUtils.ParseUri(protectableObjectResource.Id);
                containerUri     = HelperUtils.GetContainerUri(keyValueDict, protectableObjectResource.Id);
                protectedItemUri = HelperUtils.GetProtectableItemUri(keyValueDict, protectableObjectResource.Id);

                AzureIaaSVMProtectableItem iaasVmProtectableItem = (AzureIaaSVMProtectableItem)protectableObjectResource.Properties;
                if (iaasVmProtectableItem != null)
                {
                    sourceResourceId = iaasVmProtectableItem.VirtualMachineId;
                }
            }
            else
            {
                ValidateAzureVMWorkloadType(item.WorkloadType, policy.WorkloadType);
                ValidateAzureVMModifyProtectionRequest(itemBase, policy);

                isComputeAzureVM = IsComputeAzureVM(item.VirtualMachineId);
                Dictionary <UriEnums, string> keyValueDict = HelperUtils.ParseUri(item.Id);
                containerUri     = HelperUtils.GetContainerUri(keyValueDict, item.Id);
                protectedItemUri = HelperUtils.GetProtectedItemUri(keyValueDict, item.Id);
                sourceResourceId = item.SourceResourceId;
            }

            // construct Service Client protectedItem request

            AzureIaaSVMProtectedItem properties;

            if (isComputeAzureVM == false)
            {
                properties = new AzureIaaSClassicComputeVMProtectedItem();
            }
            else
            {
                properties = new AzureIaaSComputeVMProtectedItem();
            }

            properties.PolicyId         = policy.Id;
            properties.SourceResourceId = sourceResourceId;

            ProtectedItemCreateOrUpdateRequest serviceClientRequest = new ProtectedItemCreateOrUpdateRequest()
            {
                Item = new ProtectedItemResource()
                {
                    Properties = properties,
                }
            };

            return(ServiceClientAdapter.CreateOrUpdateProtectedItem(
                       containerUri,
                       protectedItemUri,
                       serviceClientRequest));
        }
Example #36
0
 public void ChildNodeTraversal(ItemBase item)
 {
     ChildNodeRecursive(item, -1, true);
 }
Example #37
0
 public void SetItem(ItemBase newItem)
 {
     image.sprite     = newItem.GetImage();
     title.text       = newItem.Name;
     description.text = newItem.Description;
 }
Example #38
0
        private void StartRequest()
        {
            httpThread = new Thread(new ThreadStart(delegate()
            {
                IList <ItemBase> userList = LoadUser();
                StreamWriter writer       = GetOutput();
                using (writer)
                {
                    int total = userList.Count;
                    this.BeginInvoke(new ThreadStart(delegate()
                    {
                        ucProgress1.StartTimer();
                    }));

                    for (int i = 0; i < userList.Count; i++)
                    {
                        if (isClosing)
                        {
                            return;
                        }

                        ItemBase item = userList[i];
                        if (item == null)
                        {
                            continue;
                        }
                        string result = HttpHelper.Get(item);
                        if (string.IsNullOrEmpty(result))
                        {
                            continue;
                        }

                        if (!TextHelper.IsContains(result, "jQuery(-4)"))
                        {
                            writer.WriteLine(result);
                        }

                        int lineIndex = i + 1;
                        WowLogManager.Instance.InfoWithCallback(string.Format("第{0}个:{1},结果:{2}", lineIndex, item.User, result));

                        Application.DoEvents();
                        ucProgress1.SetCount(new ProgressEventArgs(lineIndex, lineIndex, total));
                        if (i % 5 == 0)
                        {
                            writer.Flush();
                        }

                        if (TextHelper.IsContains(result, "jQuery(-4)") || isDialing)
                        {
                            i = i - 2;
                            autoResetEvent.WaitOne();
                        }
                    }
                    writer.Flush();
                }

                this.BeginInvoke(new ThreadStart(delegate()
                {
                    ucProgress1.StopTimer();
                    MessageBox.Show("处理完成");
                }));
            }));
            httpThread.Start();
        }
Example #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Flashlight"/> class.
 /// </summary>
 /// <param name="itemBase"><inheritdoc cref="Base"/></param>
 public Flashlight(ItemBase itemBase)
     : base(itemBase)
 {
     Base = (FlashlightItem)itemBase;
 }
Example #40
0
 public void AddItem(ItemBase item)
 {
     this.item = item;
     item.Show();
     item.transform.position = transform.position;
 }
Example #41
0
 public ItemVm(ISensor sensor)
 {
     baseItem = sensor as ItemBase;
 }
        public void Update()
        {
            var equipped = false;

            for (var i = 0; i < Options.EquipmentSlots.Count; i++)
            {
                if (Globals.Me.MyEquipment[i] == mMySlot)
                {
                    equipped = true;

                    break;
                }
            }

            var item = ItemBase.Get(Globals.Me.Inventory[mMySlot].ItemId);

            if (Globals.Me.Inventory[mMySlot].ItemId != mCurrentItemId ||
                Globals.Me.Inventory[mMySlot].Quantity != mCurrentAmt ||
                equipped != mIsEquipped ||
                item == null && mTexLoaded != "" ||
                item != null && mTexLoaded != item.Icon ||
                mIconCd != Globals.Me.ItemOnCd(mMySlot) ||
                Globals.Me.ItemOnCd(mMySlot))
            {
                mCurrentItemId          = Globals.Me.Inventory[mMySlot].ItemId;
                mCurrentAmt             = Globals.Me.Inventory[mMySlot].Quantity;
                mIsEquipped             = equipped;
                EquipPanel.IsHidden     = !mIsEquipped;
                EquipLabel.IsHidden     = !mIsEquipped;
                mCooldownLabel.IsHidden = true;
                if (item != null)
                {
                    var itemTex = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Item, item.Icon);
                    if (itemTex != null)
                    {
                        Pnl.Texture = itemTex;
                        if (Globals.Me.ItemOnCd(mMySlot))
                        {
                            Pnl.RenderColor = new Color(100, item.Color.R, item.Color.G, item.Color.B);
                        }
                        else
                        {
                            Pnl.RenderColor = item.Color;
                        }
                    }
                    else
                    {
                        if (Pnl.Texture != null)
                        {
                            Pnl.Texture = null;
                        }
                    }

                    mTexLoaded = item.Icon;
                    mIconCd    = Globals.Me.ItemOnCd(mMySlot);
                    if (mIconCd)
                    {
                        mCooldownLabel.IsHidden = false;
                        var secondsRemaining = (float)Globals.Me.ItemCdRemainder(mMySlot) / 1000f;
                        if (secondsRemaining > 10f)
                        {
                            mCooldownLabel.Text = Strings.Inventory.cooldown.ToString(secondsRemaining.ToString("N0"));
                        }
                        else
                        {
                            mCooldownLabel.Text = Strings.Inventory.cooldown.ToString(
                                secondsRemaining.ToString("N1").Replace(".", Strings.Numbers.dec)
                                );
                        }
                    }
                }
                else
                {
                    if (Pnl.Texture != null)
                    {
                        Pnl.Texture = null;
                    }

                    mTexLoaded = "";
                }

                if (mDescWindow != null)
                {
                    mDescWindow.Dispose();
                    mDescWindow = null;
                    pnl_HoverEnter(null, null);
                }
            }

            if (!IsDragging)
            {
                if (mMouseOver)
                {
                    if (!Globals.InputManager.MouseButtonDown(GameInput.MouseButtons.Left))
                    {
                        mCanDrag = true;
                        mMouseX  = -1;
                        mMouseY  = -1;
                        if (Globals.System.GetTimeMs() < mClickTime)
                        {
                            Globals.Me.TryUseItem(mMySlot);
                            mClickTime = 0;
                        }
                    }
                    else
                    {
                        if (mCanDrag && Draggable.Active == null)
                        {
                            if (mMouseX == -1 || mMouseY == -1)
                            {
                                mMouseX = InputHandler.MousePosition.X - Pnl.LocalPosToCanvas(new Point(0, 0)).X;
                                mMouseY = InputHandler.MousePosition.Y - Pnl.LocalPosToCanvas(new Point(0, 0)).Y;
                            }
                            else
                            {
                                var xdiff = mMouseX -
                                            (InputHandler.MousePosition.X - Pnl.LocalPosToCanvas(new Point(0, 0)).X);

                                var ydiff = mMouseY -
                                            (InputHandler.MousePosition.Y - Pnl.LocalPosToCanvas(new Point(0, 0)).Y);

                                if (Math.Sqrt(Math.Pow(xdiff, 2) + Math.Pow(ydiff, 2)) > 5)
                                {
                                    IsDragging = true;
                                    mDragIcon  = new Draggable(
                                        Pnl.LocalPosToCanvas(new Point(0, 0)).X + mMouseX,
                                        Pnl.LocalPosToCanvas(new Point(0, 0)).X + mMouseY, Pnl.Texture
                                        );
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (mDragIcon.Update())
                {
                    //Drug the item and now we stopped
                    IsDragging = false;
                    var dragRect = new FloatRect(
                        mDragIcon.X - (Container.Padding.Left + Container.Padding.Right) / 2,
                        mDragIcon.Y - (Container.Padding.Top + Container.Padding.Bottom) / 2,
                        (Container.Padding.Left + Container.Padding.Right) / 2 + Pnl.Width,
                        (Container.Padding.Top + Container.Padding.Bottom) / 2 + Pnl.Height
                        );

                    float bestIntersect      = 0;
                    var   bestIntersectIndex = -1;

                    //So we picked up an item and then dropped it. Lets see where we dropped it to.
                    //Check inventory first.
                    if (mInventoryWindow.RenderBounds().IntersectsWith(dragRect))
                    {
                        for (var i = 0; i < Options.MaxInvItems; i++)
                        {
                            if (mInventoryWindow.Items[i].RenderBounds().IntersectsWith(dragRect))
                            {
                                if (FloatRect.Intersect(mInventoryWindow.Items[i].RenderBounds(), dragRect).Width *
                                    FloatRect.Intersect(mInventoryWindow.Items[i].RenderBounds(), dragRect).Height >
                                    bestIntersect)
                                {
                                    bestIntersect =
                                        FloatRect.Intersect(mInventoryWindow.Items[i].RenderBounds(), dragRect).Width *
                                        FloatRect.Intersect(mInventoryWindow.Items[i].RenderBounds(), dragRect).Height;

                                    bestIntersectIndex = i;
                                }
                            }
                        }

                        if (bestIntersectIndex > -1)
                        {
                            if (mMySlot != bestIntersectIndex)
                            {
                                //Try to swap....
                                PacketSender.SendSwapInvItems(bestIntersectIndex, mMySlot);
                                Globals.Me.SwapItems(bestIntersectIndex, mMySlot);
                            }
                        }
                    }
                    else if (Interface.GameUi.Hotbar.RenderBounds().IntersectsWith(dragRect))
                    {
                        for (var i = 0; i < Options.MaxHotbar; i++)
                        {
                            if (Interface.GameUi.Hotbar.Items[i].RenderBounds().IntersectsWith(dragRect))
                            {
                                if (FloatRect.Intersect(
                                        Interface.GameUi.Hotbar.Items[i].RenderBounds(), dragRect
                                        )
                                    .Width *
                                    FloatRect.Intersect(Interface.GameUi.Hotbar.Items[i].RenderBounds(), dragRect)
                                    .Height >
                                    bestIntersect)
                                {
                                    bestIntersect =
                                        FloatRect.Intersect(Interface.GameUi.Hotbar.Items[i].RenderBounds(), dragRect)
                                        .Width *
                                        FloatRect.Intersect(Interface.GameUi.Hotbar.Items[i].RenderBounds(), dragRect)
                                        .Height;

                                    bestIntersectIndex = i;
                                }
                            }
                        }

                        if (bestIntersectIndex > -1)
                        {
                            Globals.Me.AddToHotbar((byte)bestIntersectIndex, 0, mMySlot);
                        }
                    }
                    else if (Globals.InBag)
                    {
                        var bagWindow = Interface.GameUi.GetBag();
                        if (bagWindow.RenderBounds().IntersectsWith(dragRect))
                        {
                            for (var i = 0; i < Globals.Bag.Length; i++)
                            {
                                if (bagWindow.Items[i].RenderBounds().IntersectsWith(dragRect))
                                {
                                    if (FloatRect.Intersect(bagWindow.Items[i].RenderBounds(), dragRect).Width *
                                        FloatRect.Intersect(bagWindow.Items[i].RenderBounds(), dragRect).Height >
                                        bestIntersect)
                                    {
                                        bestIntersect =
                                            FloatRect.Intersect(bagWindow.Items[i].RenderBounds(), dragRect).Width *
                                            FloatRect.Intersect(bagWindow.Items[i].RenderBounds(), dragRect).Height;

                                        bestIntersectIndex = i;
                                    }
                                }
                            }

                            if (bestIntersectIndex > -1)
                            {
                                Globals.Me.TryStoreBagItem(mMySlot, bestIntersectIndex);
                            }
                        }
                    }
                    //We may need to check if its a ground tile we just dropped on at some point.
                    else
                    {
                        var xModifier = 0;
                        var yModifier = 0;

                        switch (Globals.Me.Dir)
                        {
                        case 0:
                            yModifier--;
                            break;

                        case 1:
                            yModifier++;
                            break;

                        case 2:
                            xModifier--;
                            break;

                        case 3:
                            xModifier++;
                            break;
                        }

                        PacketSender.SendDropItem(mMySlot, 1, Globals.Me.MapInstance.Id, Globals.Me.X + xModifier, Globals.Me.Y + yModifier);
                    }

                    mDragIcon.Dispose();
                }
            }
        }
Example #43
0
        void GetMenuItem()
        {
            RibbonBase rb = (RibbonBase)localMenu.DataContext;

            ibase = UtilDisplay.GetMenuCommandByName(rb, "ExpandAndCollapse");
        }
Example #44
0
 public override void Update(ItemBase item)
 {
     graphCtrlSolution.Invalidate();
 }
Example #45
0
 public static void IsGoldfish(ItemBase item)
 {
     Assert.AreEqual(4, item.ID.Kind);
     Assert.AreEqual(1, item.ID.Index);
     Assert.AreEqual(75, item.HP);
     Assert.AreEqual(0, item.MP);
     Assert.AreEqual(0, item.Attack);
     Assert.AreEqual(0, item.Defense);
     Assert.AreEqual(0, item.Strength);
     Assert.AreEqual(0, item.Spirit);
     Assert.AreEqual(0, item.Dexterity);
     Assert.AreEqual(0, item.Power);
     Assert.AreEqual(0, item.RequiredLevel);
     Assert.AreEqual(0, item.RequiredStrength);
     Assert.AreEqual(0, item.RequiredSpirit);
     Assert.AreEqual(0, item.RequiredDexterity);
     Assert.AreEqual(0, item.RequiredPower);
     Assert.AreEqual(0, item.Unused0);
     Assert.AreEqual(0, item.Characters);
     Assert.AreEqual(1, item.Weight);
     Assert.AreEqual(0, item.Unused1);
     Assert.AreEqual(14, item.Slot);
     Assert.AreEqual(0, item.Unused2);
     Assert.AreEqual(0, item.Formula);
     Assert.AreEqual(0, item.Range);
     Assert.AreEqual(0, item.ScatterRange);
     Assert.AreEqual(0, item.Animation);
     Assert.AreEqual(50, item.Price);
 }
Example #46
0
 public override void Kill(ItemBase item)
 {
     Close();
     _analysis.RemoveListener(this);
 }
Example #47
0
 public static void IsNovaBlade(ItemBase item)
 {
     Assert.AreEqual(108000, item.Attack);
     Assert.AreEqual(5000, item.Defense);
     Assert.AreEqual(2000, item.Dexterity);
     Assert.AreEqual(400, item.Power);
     Assert.AreEqual(650, item.RequiredLevel);
     Assert.AreEqual(40, item.Weight);
     Assert.AreEqual(204, item.Characters);
     Assert.AreEqual(7, item.Slot);
     Assert.AreEqual(1, item.Range);
     Assert.AreEqual(1000000000, item.Price);
 }
Example #48
0
        /// <summary>
        /// Verarbeitet ankommende SMCP-Nachrichten
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Die SMCP-Nachricht</param>
        private void Connection_SMCPMessageReceived(object sender, Protocol.SMCPMessage e)
        {
            switch ((SMCPAction)e.ActionID)
            {
            case SMCPAction.VIEW_CHANGED:
                ///Die Ansicht wurde im Netzwerk verändert -> auch auf diesem Client ändern
                ChangeView(e.GetData <int>(this.Connection));
                break;

            case SMCPAction.REQUEST_ITEM_ID:
            {
                //  Einer der Clients hat eine neue Item-ID angefragt -> Falls es sich hier um einen Server handelt,
                //  schicke eine neue ID zurück
                if (this.Connection.IsServer)
                {
                    SMCPMessage respone = Connection.CreateMessage(UserStory.NextUserStoryID++, false, SMCPAction.ASSIGN_ITEM_ID);
                    Connection.SendMessage(respone, Connection.ConnectedClients[e.SenderID]);
                }
            }
            break;

            case SMCPAction.ASSIGN_ITEM_ID:
                //Neue Item-ID wurde angefragt und erhalten -> weise sie einem der wartenden Items zu
                //Client: Item Teilen - Schritt 2 / 3
                ItemBase item = WaitingForID.Dequeue();
                if (item != null)
                {
                    item.ItemID = e.GetData <short>(this.Connection);
                    ShareItemFinally(item);
                }
                break;

            case SMCPAction.ADD_ITEM:
            {
                //Neues Item erhalten, zu den Items der Oberfläche hinzufügen
                AddItem(e.GetData <ItemBase>(this.Connection));
            }
            break;

            case SMCPAction.START_EDITING:
                //In den (Readonly)-Editiermodus eines Items wechseln
                ChangeEditorState(e.GetData <ItemBase>(this.Connection).ItemID, true);
                break;

            case SMCPAction.END_EDITING:
                //Den Editiermodus wieder beenden
                ChangeEditorState(e.GetData <ItemBase>(this.Connection).ItemID, false);
                break;

            case SMCPAction.UPDATE_ITEM:
                //Die Daten eines Items aktualisieren (wurde von einem anderem Teilnehmer initiiert)
                UpdateItem(e.GetData <ItemBase>(this.Connection));
                break;

            case SMCPAction.FOCUS_ON_ITEM:
                //Ein Item in den Fokus aller Teilnehmer rücken (wurde von einem anderem Teilnehmer initiiert)
                RequestFocus(e.GetData <short>(this.Connection));
                break;

            case SMCPAction.REMOVE_ITEM:
                //Ein Item wurde von einem anderen Teilnehmer gelöscht
                RemoveItem(e.GetData <short>(this.Connection));
                break;

            case SMCPAction.ALL_ITEMS:
                //Liste von Items erhalten -> Aktuelle Datenbank durch Internet Datenbank ersetzen
                Surface.Invoke(() =>
                {
                    SendableDatabase sdb = e.GetData <SendableDatabase>(this.Connection);
                    sdb.LoadIntoDB(Surface.Database);
                });
                break;
            }
        }
Example #49
0
 void Start()
 {
     _itemBase = GetComponent<ItemBase> ();
     _playerInventory = GameObject.FindGameObjectWithTag (Tags.PLAYER).GetComponent<PlayerInventory> ();
 }
Example #50
0
        /// <summary>
        /// Wenn die neue UserStory eine ID erhalten hat, kann sie
        /// endgültig mit dem Netzwerk geteilt werden
        /// Client: Item Teilen - Schritt 3 / 3
        /// Server: Item Teilen - Schritt 2 / 2
        /// </summary>
        /// <param name="item">Das Item, das geteilt werden soll</param>
        private void ShareItemFinally(ItemBase item)
        {
            SMCPMessage msg = Connection.CreateMessage(item, true, SMCPAction.ADD_ITEM);

            Connection.MulticastMessage(msg);
        }
Example #51
0
 public void ParentNodeTraversal(ItemBase item)
 {
     ParentNodeRecursive(item);
 }
Example #52
0
 // Update is called once per frame
 void Update()
 {
     GetCamera(); // Don't know if we need to do this every frame but hey hoo will look later #RIP AZIR
     // Reduce the cooldown
     if (CoolDown > 0.0f)
     {
         CoolDown -= Time.deltaTime;
     }
     // if action is locked then reduce the timer till 0 and reset
     if (actionLocked)
     {
         actionLockedTimer -= Time.deltaTime;
         if (actionLockedTimer < 0)
         {
             actionLocked      = false;
             actionLockedTimer = actionLock;
         }
     }
     /*This is used to assign tools when one of the keys are pressed*/
     if (Input.GetKeyUp(KeyCode.Alpha1) && !Selected[0])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[0] != false)
         {
             Selected[0] = true;
             Debug.Log("SLOT: 0 SELECTED");
             tool = ItemList[0].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[0].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[0].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha2) && !Selected[1])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[1] != false)
         {
             Selected[1] = true;
             Debug.Log("SLOT: 1 SELECTED");
             tool = ItemList[1].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[1].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[1].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha3) && !Selected[2])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[2] != false)
         {
             Selected[2] = true;
             Debug.Log("SLOT: 2 SELECTED");
             tool = ItemList[2].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[2].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[2].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha4) && !Selected[3])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[3] != false)
         {
             Selected[3] = true;
             Debug.Log("SLOT: 3 SELECTED");
             tool = ItemList[3].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[3].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[3].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha5) && !Selected[4])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[4] != false)
         {
             Selected[4] = true;
             Debug.Log("SLOT: 4 SELECTED");
             tool = ItemList[4].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[4].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[4].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha6) && !Selected[5])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[5] != false)
         {
             Selected[5] = true;
             Debug.Log("SLOT: 5 SELECTED");
             tool = ItemList[5].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[5].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[5].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha7) && !Selected[6])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[6] != false)
         {
             Selected[6] = true;
             Debug.Log("SLOT: 6 SELECTED");
             tool = ItemList[6].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[6].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[6].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha8) && !Selected[7])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[7] != false)
         {
             Selected[7] = true;
             Debug.Log("SLOT: 7 SELECTED");
             tool = ItemList[7].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[7].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[7].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha9) && !Selected[8])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[8] != false)
         {
             Selected[8] = true;
             Debug.Log("SLOT: 8 SELECTED");
             tool = ItemList[8].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[8].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[8].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     if (Input.GetKeyUp(KeyCode.Alpha0) && !Selected[9])
     {
         for (int i = 0; i < 10; i++)
         {
             if (Selected[i])
             {
                 Vector3 transform = ImageSlots[i].transform.parent.transform.position;
                 transform.y = 70.0f;
                 ImageSlots[i].transform.parent.transform.position = transform;
             }
             Selected[i] = false;
         }
         if (Markers[9] != false)
         {
             Selected[9] = true;
             Debug.Log("SLOT: 9 SELECTED");
             tool = ItemList[9].GetComponent <ItemBase>();
             Vector3 transform = ImageSlots[9].transform.parent.transform.position;
             transform.y += 3.0f;
             ImageSlots[9].transform.parent.transform.position = transform;
             FindFarmComponenets();
         }
         else
         {
             tool = new ItemBase();
         }
     }
     /******************************************/
     /* If we can act */
     if (!actionLocked && !cInventory.UIEnabled && !Chest.UIEnabled)
     {
         if (Input.GetMouseButtonDown(0))
         {
             /*If we don't have an active tool then tell the player*/
             if (tool == null)
             {
                 Debug.Log("PLEASE SELECT A VALID TOOL");
             }
             /*Make sure that we actually have an amount of the used tool*/
             else if (tool.GetAmount() > 0)
             {
                 // Get the camera if null
                 if (camera == null)
                 {
                     GetCamera();
                 }
                 // Get the mouse pos
                 mouseWorldPoint = camera.ScreenToWorldPoint(Input.mousePosition);
                 // Get the player
                 GameObject Player = GameObject.FindGameObjectWithTag("Player");
                 Debug.Log(Vector2.Distance(Player.transform.position, mouseWorldPoint));
                 /*If we are in range, the lock our actions and find the farm compoents and then use the tool. */
                 if (Vector2.Distance(Player.transform.position, mouseWorldPoint) < interactRange)
                 {
                     actionLocked = true;
                     FindFarmComponenets();
                     tool.useTool();
                     ToolScript Tool = (ToolScript)tool;
                     if (Tool.ToolUsed)
                     {
                         Tool.ToolUsed = false;
                         Stam.UseStamina(tool.GetCustomData());
                     }
                 }
                 else
                 {
                     Debug.Log("OUT OF RANGE OF TOOL");
                 }
             }
         }
     }
 }
 void DropLeftOvers(ItemBase pItem, int pAmount)
 {
     ItemSpawner.Instance.SpawnItems(pItem, transform.position, (uint)pAmount);
 }
        void pnl_HoverEnter(Base sender, EventArgs arguments)
        {
            if (InputHandler.MouseFocus != null)
            {
                return;
            }

            mMouseOver = true;
            mCanDrag   = true;
            if (Globals.InputManager.MouseButtonDown(GameInput.MouseButtons.Left))
            {
                mCanDrag = false;

                return;
            }

            if (mDescWindow != null)
            {
                mDescWindow.Dispose();
                mDescWindow = null;
            }

            if (Globals.GameShop == null)
            {
                if (Globals.Me.Inventory[mMySlot]?.Base != null)
                {
                    mDescWindow = new ItemDescWindow(
                        Globals.Me.Inventory[mMySlot].Base, Globals.Me.Inventory[mMySlot].Quantity, mInventoryWindow.X,
                        mInventoryWindow.Y, Globals.Me.Inventory[mMySlot].StatBuffs
                        );
                }
            }
            else
            {
                var      invItem  = Globals.Me.Inventory[mMySlot];
                ShopItem shopItem = null;
                for (var i = 0; i < Globals.GameShop.BuyingItems.Count; i++)
                {
                    var tmpShop = Globals.GameShop.BuyingItems[i];

                    if (invItem.ItemId == tmpShop.ItemId)
                    {
                        shopItem = tmpShop;

                        break;
                    }
                }

                if (Globals.GameShop.BuyingWhitelist && shopItem != null)
                {
                    var hoveredItem = ItemBase.Get(shopItem.CostItemId);
                    if (hoveredItem != null && Globals.Me.Inventory[mMySlot]?.Base != null)
                    {
                        mDescWindow = new ItemDescWindow(
                            Globals.Me.Inventory[mMySlot].Base, Globals.Me.Inventory[mMySlot].Quantity,
                            mInventoryWindow.X, mInventoryWindow.Y, Globals.Me.Inventory[mMySlot].StatBuffs, "",
                            Strings.Shop.sellsfor.ToString(shopItem.CostItemQuantity, hoveredItem.Name)
                            );
                    }
                }
                else if (shopItem == null)
                {
                    var costItem = Globals.GameShop.DefaultCurrency;
                    if (invItem.Base != null && costItem != null && Globals.Me.Inventory[mMySlot]?.Base != null)
                    {
                        mDescWindow = new ItemDescWindow(
                            Globals.Me.Inventory[mMySlot].Base, Globals.Me.Inventory[mMySlot].Quantity,
                            mInventoryWindow.X, mInventoryWindow.Y, Globals.Me.Inventory[mMySlot].StatBuffs, "",
                            Strings.Shop.sellsfor.ToString(invItem.Base.Price.ToString(), costItem.Name)
                            );
                    }
                }
                else
                {
                    if (invItem?.Base != null)
                    {
                        mDescWindow = new ItemDescWindow(
                            invItem.Base, invItem.Quantity, mInventoryWindow.X, mInventoryWindow.Y, invItem.StatBuffs,
                            "", Strings.Shop.wontbuy
                            );
                    }
                }
            }
        }
        public List<QuestionRecommender> GetQuestionsPreporke(double ElasticnostFinal = 0.65, double ElasticnostTag = 0.65, double ElasticnostKategorije = 0.65, double ElasticnostOcjene = 0.35)
        {
            List<Question> la = new List<Question>();
            List<QuestionRecommender> listaPreporuka = new List<QuestionRecommender>();

            using (DBBL Baza = new DBBL())
            {
                la = Baza.GetAllQuestios();

                question = this.question;

                VektorskaDuzina<Tag> vektorTagDomaci = new VektorskaDuzina<Tag>(question.Tags.ToArray());
                VektorskaDuzina<Category> vektorKategorijeDomaci = new VektorskaDuzina<Category>(question.Categories.ToArray());
                VektorskaDuzina<QuestionsRating> vektorRatingDomaci = new VektorskaDuzina<QuestionsRating>(question.QuestionsRatings.ToArray());

                foreach (var w in la)
                {
                    VektorskaDuzina<Tag> vektorTagExterni = new VektorskaDuzina<Tag>(w.Tags.ToArray());
                    ItemBase<Tag> ibTag = new ItemBase<Tag>(vektorTagDomaci, vektorTagExterni);

                    VektorskaDuzina<Category> vektorKategorijeExterni = new VektorskaDuzina<Category>(w.Categories.ToArray());
                    ItemBase<Category> ibKategorije = new ItemBase<Category>(vektorKategorijeDomaci, vektorKategorijeExterni);

                    VektorskaDuzina<QuestionsRating> vektorRatingExterni = new VektorskaDuzina<QuestionsRating>(w.QuestionsRatings.ToArray());
                    ItemBase<QuestionsRating> ibRating = new ItemBase<QuestionsRating>(vektorRatingDomaci, vektorRatingExterni);

                    double tpr = ibTag.GetSlicnost(false);
                    double kpr = ibKategorije.GetSlicnost(false);
                    double rpr = ibRating.GetSlicnost(false);
                    double pr = (tpr + kpr) * 1 / (double)2;
                    if (pr >= ElasticnostFinal && w.QuestionID != question.QuestionID)
                    {
                        listaPreporuka.Add(new QuestionRecommender()
                        {
                            Name = w.QuestionTitle,
                            Score = pr,
                            QuestionID = w.QuestionID,
                            CreatorID=w.User.UserID
                        });
                    }

                }
                return listaPreporuka.OrderByDescending(x => x.Score).Take(10).ToList();

            }
        }
Example #56
0
    public void EndGame(int id)
    {
        if (isFinished)
        {
            return;
        }

        DataLogger.LogMessage("Game Finished >" + DataHandler.s.myPlayerInteger.ToString() + " - " + id.ToString());
        isFinished    = true;
        isGamePlaying = false;
        finisherId    = id;
        LocalPlayerController.isActive = false;

        NPCManager.s.StopAllNPCs();

        bool isWon = CheckisWon();

        try {
            /*if (_NPCBehaviour.activeNPC != null)
             *      _NPCBehaviour.activeNPC.isActive = false;*/

            PowerUpManager.s.DisablePowerUps();

            if (GS.a.nextStage == null)
            {
                if (GoogleAPI.s.gameInProgress)
                {
                    GoogleAPI.s.LeaveGame();
                }
            }
        } catch (System.Exception e) {
            DataLogger.LogError(this.name, e);
        }

        if (isWon)
        {
            try {
                SaveMaster.LevelFinished(true, GS.a);
            } catch (System.Exception e) {
                DataLogger.LogError("Cant save level finished data: ", e);
            }

            if (GS.a.winDrops != null)
            {
                for (int i = 0; i < GS.a.winDrops.Length; i++)
                {
                    ItemBase item       = GS.a.winDrops[i];
                    int      itemAmount = 1;
                    if (GS.a.windDropAmounts.Length < i)
                    {
                        if (GS.a.windDropAmounts[i] > 0)
                        {
                            itemAmount = GS.a.windDropAmounts[i];
                        }
                    }

                    if (item != null)
                    {
                        InventoryMaster.s.Add(item, itemAmount);
                    }
                }
            }

            if (GS.a.levelOutroDialog != null)
            {
                GameEndScreen.s.Endgame(finisherId, isWon, false);
            }
            else
            {
                RestOffTheEndingStuff(isWon);
            }

            if (GS.a.autoTransferHealthAcrossLevels)
            {
                int oldHealth = PlayerPrefs.GetInt(GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString, -1);
                int curHealth = ScoreBoardManager.s.allScores[DataHandler.s.myPlayerInteger, 0];
                if (curHealth > oldHealth)
                {
                    PlayerPrefs.SetInt(GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString, curHealth);
                }

                print("Health saved as " + curHealth.ToString() + " to " + GS.a.name + GameSettings.autoTransferHealthAcrossLevelsPlayerPrefString);
            }
        }
        else
        {
            GameEndScreen.s.Endgame(finisherId, isWon, true);
            InventoryMaster.s.ReduceEquipmentChargeLeft();
        }
    }
        public async override Task GetHolidayList()
        {
            credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                       new Uri("ms-appx:///Assets/client_secret.json"),
                       Scopes,
                       "user",
                       CancellationToken.None);


            // Create Google Calendar API service.
            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Calendar and Holidays",
            });

            // Define parameters of request.
            EventsResource.ListRequest request = service.Events.List("primary");
            //set user max and min dates
            request.TimeMin = DateStart.Date;
            request.TimeMax = DateEnd.Date;
            //set details
            request.ShowDeleted = false;
            request.SingleEvents = true;
            request.MaxResults = 100;
            request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

            // List events.
            Events events = request.Execute();
            if (events.Items != null && events.Items.Count > 0)
            {
                foreach (var eventItem in events.Items)
                {
                    string when = null;
                    try
                    {
                        when = eventItem.Start.DateTime.Value.Date.ToString(DateFormat);
                    }
                    catch
                    {
                        if (String.IsNullOrEmpty(when))
                        {
                            when = eventItem.Start.Date;
                        }
                    }
                    var array = when.Split('-');
                    ItemBase item = new ItemBase
                    {
                        HolidayName = eventItem.Summary,
                        Day = Convert.ToInt32(array[2]),
                        Month = Convert.ToInt32(array[1]),
                        Year = Convert.ToInt32(array[0]),
                        HolidayTag = "M"
                    };

                    Items.Add(item);
                }
            }
            else Items = null;
            
            base.Message();
        }
Example #58
0
        private RestAzureNS.AzureOperationResponse <ProtectedItemResource> EnableOrModifyProtection(bool disableWithRetentionData = false)
        {
            string vaultName = (string)ProviderData[VaultParams.VaultName];
            string vaultResourceGroupName = (string)ProviderData[VaultParams.ResourceGroupName];

            PolicyBase policy = ProviderData.ContainsKey(ItemParams.Policy) ?
                                (PolicyBase)ProviderData[ItemParams.Policy] : null;

            ProtectableItemBase protectableItemBase = ProviderData.ContainsKey(ItemParams.ProtectableItem) ?
                                                      (ProtectableItemBase)ProviderData[ItemParams.ProtectableItem] : null;
            AzureWorkloadProtectableItem protectableItem = ProviderData.ContainsKey(ItemParams.ProtectableItem) ?
                                                           (AzureWorkloadProtectableItem)ProviderData[ItemParams.ProtectableItem] : null;

            ItemBase itemBase = ProviderData.ContainsKey(ItemParams.Item) ?
                                (ItemBase)ProviderData[ItemParams.Item] : null;
            AzureWorkloadSQLDatabaseProtectedItem item = ProviderData.ContainsKey(ItemParams.Item) ?
                                                         (AzureWorkloadSQLDatabaseProtectedItem)ProviderData[ItemParams.Item] : null;

            AzureVmWorkloadSQLDatabaseProtectedItem properties = new AzureVmWorkloadSQLDatabaseProtectedItem();
            string containerUri     = "";
            string protectedItemUri = "";

            if (disableWithRetentionData)
            {
                //Disable protection while retaining backup data
                ValidateAzureWorkloadDisableProtectionRequest(itemBase);

                Dictionary <UriEnums, string> keyValueDict = HelperUtils.ParseUri(item.Id);
                containerUri                = HelperUtils.GetContainerUri(keyValueDict, item.Id);
                protectedItemUri            = HelperUtils.GetProtectedItemUri(keyValueDict, item.Id);
                properties.PolicyId         = string.Empty;
                properties.ProtectionState  = ProtectionState.ProtectionStopped;
                properties.SourceResourceId = item.SourceResourceId;
            }
            else
            {
                if (protectableItem != null)
                {
                    Dictionary <UriEnums, string> keyValueDict =
                        HelperUtils.ParseUri(protectableItem.Id);
                    containerUri = HelperUtils.GetContainerUri(
                        keyValueDict, protectableItem.Id);
                    protectedItemUri = HelperUtils.GetProtectableItemUri(
                        keyValueDict, protectableItem.Id);

                    properties.PolicyId = policy.Id;
                }
                else if (item != null)
                {
                    Dictionary <UriEnums, string> keyValueDict =
                        HelperUtils.ParseUri(item.Id);
                    containerUri = HelperUtils.GetContainerUri(
                        keyValueDict, item.Id);
                    protectedItemUri = HelperUtils.GetProtectedItemUri(
                        keyValueDict, item.Id);

                    properties.PolicyId = policy.Id;
                }
            }

            ProtectedItemResource serviceClientRequest = new ProtectedItemResource()
            {
                Properties = properties
            };

            return(ServiceClientAdapter.CreateOrUpdateProtectedItem(
                       containerUri,
                       protectedItemUri,
                       serviceClientRequest,
                       vaultName: vaultName,
                       resourceGroupName: vaultResourceGroupName));
        }
Example #59
0
    public void StoreItem(ItemBase item, int store_num)
    {
        if (!isInit)
        {
            return;
        }
        if (PlayerInfoManager.Instance.PlayerInfo.warehouseInfo == null || item == null || store_num <= 0)
        {
            return;
        }
        int finallyGet = 0;

        if (item.StackAble)
        {
            finallyGet = PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.Find(i => i.ItemID == item.ID) == null ?
                         0 : PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.Find(i => i.ItemID == item.ID).Quantity;
        }
        List <ItemInfo> itemsBefore = PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.FindAll(i => i.ItemID == item.ID);

        try
        {
            PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.StoreItem(item, BagManager.Instance.bagInfo, store_num);
        }
        catch (System.Exception ex)
        {
            NotificationManager.Instance.NewNotification(ex.Message);
            return;
        }
        List <ItemInfo> itemsAfter = PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.FindAll(i => i.ItemID == item.ID);
        List <ItemInfo> difference = new List <ItemInfo>();

        if (itemsBefore.Count > 0)
        {
            foreach (ItemInfo info in itemsAfter)
            {
                if (itemsBefore.Find(i => i.Item == info.Item) == null)
                {
                    difference.Add(info);
                }
            }
        }
        else
        {
            difference = itemsAfter;
        }
        if (item.StackAble)
        {
            finallyGet = PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.Find(i => i.ItemID == item.ID) == null ?
                         0 : PlayerInfoManager.Instance.PlayerInfo.warehouseInfo.itemList.Find(i => i.ItemID == item.ID).Quantity
                         - finallyGet;
        }
        else
        {
            finallyGet = difference.Count;
        }
        if (finallyGet > 0)
        {
            NotificationManager.Instance.NewNotification("存储了" + finallyGet + "个<color=orange>" + item.Name + "</color>");
        }
        if (item.StackAble && ItemCells.Exists(ic => ic.GetComponent <ItemAgent>().itemInfo.ItemID == item.ID))
        {
            return;
        }
        if (difference.Count > 0)
        {
            foreach (ItemInfo info in difference)
            {
                for (int i = 0; i < HouseCells.Count; i++)
                {
                    if (HouseCells[i].transform.childCount <= 0)
                    {
                        ItemAgent tempCell = (Instantiate(itemCellPrefab, HouseCells[i].transform) as GameObject).GetComponent <ItemAgent>();
                        tempCell.itemInfo = info;
                        tempCell.isStored = true;
                        ItemCells.Add(tempCell);
                        break;
                    }
                }
            }
        }
    }
Example #60
0
        public static RecoveryPointBase GetPSAzureVMRecoveryPoint(
            ServiceClientModel.RecoveryPointResource rp, ItemBase item)
        {
            Dictionary <UriEnums, string> uriDict = HelperUtils.ParseUri(item.Id);
            string containerUri     = HelperUtils.GetContainerUri(uriDict, item.Id);
            string protectedItemUri = HelperUtils.GetProtectedItemUri(uriDict, item.Id);

            string containerName     = IdUtils.GetNameFromUri(containerUri);
            string protectedItemName = IdUtils.GetNameFromUri(protectedItemUri);

            ServiceClientModel.IaasVMRecoveryPoint recoveryPoint =
                rp.Properties as ServiceClientModel.IaasVMRecoveryPoint;

            DateTime recoveryPointTime = DateTime.MinValue;

            if (recoveryPoint.RecoveryPointTime.HasValue)
            {
                recoveryPointTime = (DateTime)recoveryPoint.RecoveryPointTime;
            }
            else
            {
                throw new ArgumentNullException("RecoveryPointTime is null");
            }

            bool isInstantILRSessionActive =
                recoveryPoint.IsInstantIlrSessionActive.HasValue ?
                (bool)recoveryPoint.IsInstantIlrSessionActive : false;

            AzureVmRecoveryPoint rpBase = new AzureVmRecoveryPoint()
            {
                RecoveryPointId      = rp.Name,
                BackupManagementType = item.BackupManagementType,
                ItemName             = protectedItemName,
                ContainerName        = containerName,
                ContainerType        = item.ContainerType,
                RecoveryPointTime    = recoveryPointTime,
                RecoveryPointType    = recoveryPoint.RecoveryPointType,
                Id           = rp.Id,
                WorkloadType = item.WorkloadType,
                RecoveryPointAdditionalInfo = recoveryPoint.RecoveryPointAdditionalInfo,
                SourceVMStorageType         = recoveryPoint.SourceVMStorageType,
                SourceResourceId            = item.SourceResourceId,
                EncryptionEnabled           = recoveryPoint.IsSourceVMEncrypted.HasValue ?
                                              recoveryPoint.IsSourceVMEncrypted.Value : false,
                IlrSessionActive        = isInstantILRSessionActive,
                IsManagedVirtualMachine = recoveryPoint.IsManagedVirtualMachine.HasValue ?
                                          recoveryPoint.IsManagedVirtualMachine.Value : false,
                OriginalSAEnabled = recoveryPoint.OriginalStorageAccountOption.HasValue ?
                                    recoveryPoint.OriginalStorageAccountOption.Value : false,
                Zones = recoveryPoint.Zones,
                RehydrationExpiryTime = (DateTime?)null,
            };

            if (recoveryPoint.RecoveryPointTierDetails != null)
            {
                bool isHardenedRP         = false;
                bool isInstantRecoverable = false;
                bool isArchived           = false;
                bool isRehydrated         = false;

                foreach (ServiceClientModel.RecoveryPointTierInformation tierInfo in recoveryPoint.RecoveryPointTierDetails)
                {
                    if (tierInfo.Status == ServiceClientModel.RecoveryPointTierStatus.Rehydrated)
                    {
                        if (tierInfo.Type == ServiceClientModel.RecoveryPointTierType.ArchivedRP)
                        {
                            isRehydrated = true;

                            rpBase.RehydrationExpiryTime = (tierInfo.ExtendedInfo.ContainsKey("RehydratedRPExpiryTime")) ? DateTime.Parse(tierInfo.ExtendedInfo["RehydratedRPExpiryTime"]) : (DateTime?)null;
                        }
                    }

                    if (tierInfo.Status == ServiceClientModel.RecoveryPointTierStatus.Valid)
                    {
                        if (tierInfo.Type == ServiceClientModel.RecoveryPointTierType.InstantRP)
                        {
                            isInstantRecoverable = true;
                        }
                        if (tierInfo.Type == ServiceClientModel.RecoveryPointTierType.HardenedRP)
                        {
                            isHardenedRP = true;
                        }
                        if (tierInfo.Type == ServiceClientModel.RecoveryPointTierType.ArchivedRP)
                        {
                            isArchived = true;
                        }
                    }
                }

                if ((isHardenedRP && isArchived) || (isRehydrated))
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.VaultStandardRehydrated;
                }
                else if (isInstantRecoverable && isHardenedRP)
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.SnapshotAndVaultStandard;
                }
                else if (isInstantRecoverable && isArchived)
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.SnapshotAndVaultArchive;
                }
                else if (isArchived)
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.VaultArchive;
                }
                else if (isInstantRecoverable)
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.Snapshot;
                }
                else if (isHardenedRP)
                {
                    rpBase.RecoveryPointTier = RecoveryPointTier.VaultStandard;
                }
            }


            if (rpBase.EncryptionEnabled && recoveryPoint.KeyAndSecret != null)
            {
                rpBase.KeyAndSecretDetails = new KeyAndSecretDetails()
                {
                    SecretUrl     = recoveryPoint.KeyAndSecret.BekDetails.SecretUrl,
                    KeyUrl        = recoveryPoint.KeyAndSecret.KekDetails.KeyUrl,
                    SecretData    = recoveryPoint.KeyAndSecret.BekDetails.SecretData,
                    KeyBackupData = recoveryPoint.KeyAndSecret.KekDetails.KeyBackupData,
                    KeyVaultId    = recoveryPoint.KeyAndSecret.KekDetails.KeyVaultId,
                    SecretVaultId = recoveryPoint.KeyAndSecret.BekDetails.SecretVaultId,
                };
            }
            return(rpBase);
        }