예제 #1
0
 private void getAllEquipment()
 {
     using (var context = new NinjaDBEntities())
     {
         context.Equipments.ToList().ForEach(e => Equipment.Add(new EquipmentViewModel(e)));
     }
 }
        public async void LoadDataSources(object e)
        {
            var equipment = await GetData.EquipmentQueryAsync();

            var employees = await GetData.EmployeeQueryAsync();

            var departments = await GetData.DepartmentQueryAsync();

            var jobsites = await GetData.JobsiteQueryAsync();

            foreach (EquipmentModel item in equipment)
            {
                Equipment.Add(item);
            }
            foreach (DepartmentModel department in departments)
            {
                Departments.Add(department);
            }
            foreach (JobsiteModel jobsite in jobsites)
            {
                Jobsites.Add(jobsite);
            }

            var today = DateTime.Now;
            var authorizedEmployees = employees.Where(x => !x.Restrictions.Any(x => x.Name == "Equipment Assignments" && x.EndDate >= today));

            foreach (EmployeeModel employee in authorizedEmployees)
            {
                AuthorizedEmployees.Add(employee);
            }
        }
예제 #3
0
        public void Update()
        {
            string resultJson = HookManager.GetEquipmentItems();

            if (resultJson.Length > 1 && resultJson.Substring(resultJson.Length - 2, 2).Equals(",]"))
            {
                resultJson.Remove(resultJson.Length - 2);
            }

            try
            {
                List <WowBasicItem> rawEquipment = ItemFactory.ParseItemList(resultJson);

                Equipment.Clear();
                foreach (WowBasicItem rawItem in rawEquipment)
                {
                    IWowItem item = ItemFactory.BuildSpecificItem(rawItem);
                    Equipment.Add(item.EquipSlot, item);
                }
            }
            catch (Exception e)
            {
                AmeisenLogger.Instance.Log($"Failed to parse Equipment JSON:\n{resultJson}\n{e.ToString()}", LogLevel.Error);
            }
        }
예제 #4
0
 void ITypicalable.AddChildForProperty(string property, ITECObject item)
 {
     if (property == "Controllers" && item is TECController controller)
     {
         AddController(controller);
     }
     else if (property == "Equipment" && item is TECEquipment equipment)
     {
         Equipment.Add(equipment);
     }
     else if (property == "Panels" && item is TECPanel panel)
     {
         Panels.Add(panel);
     }
     else if (property == "MiscCosts" && item is TECMisc misc)
     {
         MiscCosts.Add(misc);
     }
     else if (property == "ScopeBranches" && item is TECScopeBranch branch)
     {
         ScopeBranches.Add(branch);
     }
     else if (property == "ProposalItems" && item is TECProposalItem propItem)
     {
         ProposalItems.Add(propItem);
     }
     else
     {
         this.AddChildForScopeProperty(property, item);
     }
 }
 public void ConfigureAssignableSlots()
 {
     if (!slotsConfigured)
     {
         Ownables  component  = GetComponent <Ownables>();
         Equipment component2 = GetComponent <Equipment>();
         if ((Object)component2 != (Object)null)
         {
             foreach (AssignableSlot resource in Db.Get().AssignableSlots.resources)
             {
                 if (resource is OwnableSlot)
                 {
                     OwnableSlotInstance slot_instance = new OwnableSlotInstance(component, (OwnableSlot)resource);
                     component.Add(slot_instance);
                 }
                 else if (resource is EquipmentSlot)
                 {
                     EquipmentSlotInstance slot_instance2 = new EquipmentSlotInstance(component2, (EquipmentSlot)resource);
                     component2.Add(slot_instance2);
                 }
             }
         }
         slotsConfigured = true;
     }
 }
예제 #6
0
        public TECSystem(TECSystem source, Dictionary <Guid, Guid> guidDictionary      = null,
                         ObservableListDictionary <ITECObject> characteristicReference = null,
                         Tuple <TemplateSynchronizer <TECEquipment>, TemplateSynchronizer <TECSubScope> > synchronizers = null) : this()
        {
            if (guidDictionary == null)
            {
                guidDictionary = new Dictionary <Guid, Guid>();
            }

            guidDictionary[_guid] = source.Guid;
            foreach (TECEquipment equipment in source.Equipment)
            {
                var toAdd = new TECEquipment(equipment, guidDictionary, characteristicReference, ssSynchronizer: synchronizers?.Item2);
                if (synchronizers != null && synchronizers.Item1.Contains(equipment))
                {
                    synchronizers.Item1.LinkNew(synchronizers.Item1.GetTemplate(equipment), toAdd);
                }
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(equipment, toAdd);
                }
                Equipment.Add(toAdd);
            }
            foreach (TECController controller in source._controllers)
            {
                var toAdd = controller.CopyController(guidDictionary);
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(controller, toAdd);
                }
                _controllers.Add(toAdd);
            }
            foreach (TECPanel panel in source.Panels)
            {
                var toAdd = new TECPanel(panel, guidDictionary);
                if (characteristicReference != null)
                {
                    characteristicReference.AddItem(panel, toAdd);
                }
                Panels.Add(toAdd);
            }
            foreach (TECMisc misc in source.MiscCosts)
            {
                var toAdd = new TECMisc(misc);
                MiscCosts.Add(toAdd);
            }
            foreach (TECScopeBranch branch in source.ScopeBranches)
            {
                var toAdd = new TECScopeBranch(branch);
                ScopeBranches.Add(toAdd);
            }
            foreach (TECProposalItem item in source.ProposalItems)
            {
                var toAdd = new TECProposalItem(item, guidDictionary);
                ProposalItems.Add(toAdd);
            }
            this.copyPropertiesFromLocated(source);
            ModelLinkingHelper.LinkSystem(this, guidDictionary);
        }
예제 #7
0
        public void Initialize(string equipmentId)
        {
            EquipmentDetails = m_equipmentService.GetEquipmentById(equipmentId);

            // Get Rigs equipment by rig id.
            Equipment.Clear();
            foreach (Equipment equipment in m_equipmentService.GetEquipmentByParentId(EquipmentDetails.Id))
            {
                Equipment.Add(equipment);
            }
        }
예제 #8
0
        internal void AddEquipment(RawEquipment[] rpRawData)
        {
            if (rpRawData == null)
            {
                return;
            }

            foreach (var rRawData in rpRawData)
            {
                Equipment.Add(new Equipment(rRawData));
            }
            OnPropertyChanged(nameof(Equipment));
        }
예제 #9
0
 private void UpdateEquipment()
 {
     Equipment.Clear();
     for (int i = 0; i < Objects.Count; i++)
     {
         if (Enum.IsDefined(typeof(CharacterInventoryPositionEnum), (int)Objects[i].Position))
         {
             if (!Equipment.ContainsKey((CharacterInventoryPositionEnum)Objects[i].Position))
             {
                 Equipment.Add((CharacterInventoryPositionEnum)Objects[i].Position, Objects[i]);
             }
         }
     }
 }
예제 #10
0
    public void WearItem(Item item)
    {
        if (item.type == Item.ItemType.Fish || item.type == Item.ItemType.None)
        {
            return;
        }

        if (item.type == Item.ItemType.Shoe)
        {
            Instance.nvAgent.speed = item.data.movementSpeed;
        }

        var sameItems = Equipment.Where(x => x.type == item.type);

        if (sameItems.Count() > 0)
        {
            UnwearItem(sameItems.ElementAt(0));
        }

        Equipment.Add(item);

        if (item.type == Item.ItemType.Rod)
        {
            return;
        }

        foreach (var child in item.transform.GetComponentsInChildren <Transform>())
        {
            child.gameObject.layer = LayerMask.NameToLayer("Player");
        }

        var reassignWeights = item.rendererGameObject.GetComponent <ReassignBoneWeigthsToNewMesh>();

        item.transform.position = transform.position;
        item.rendererGameObject.transform.parent = transform;

        if (smCombiner.isMeshesCombined())
        {
            smCombiner.UndoCombineMeshes(true, true);
        }

        reassignWeights.newArmature  = Instance.armature;
        reassignWeights.rootBoneName = "Spine1";
        reassignWeights.Reassign();


        smCombiner.CombineMeshes();
    }
예제 #11
0
 public TECTypical(TECTypical source, Dictionary <Guid, Guid> guidDictionary     = null,
                   ObservableListDictionary <ITECObject> characteristicReference = null) : this()
 {
     if (guidDictionary != null)
     {
         guidDictionary[_guid] = source.Guid;
     }
     foreach (TECEquipment equipment in source.Equipment)
     {
         var toAdd = new TECEquipment(equipment, guidDictionary, characteristicReference);
         if (characteristicReference != null)
         {
             characteristicReference.AddItem(equipment, toAdd);
         }
         Equipment.Add(toAdd);
     }
     foreach (TECController controller in source.Controllers)
     {
         var toAdd = controller.CopyController(guidDictionary);
         if (characteristicReference != null)
         {
             characteristicReference.AddItem(controller, toAdd);
         }
         AddController(toAdd);
     }
     foreach (TECPanel panel in source.Panels)
     {
         var toAdd = new TECPanel(panel, guidDictionary);
         if (characteristicReference != null)
         {
             characteristicReference.AddItem(panel, toAdd);
         }
         Panels.Add(toAdd);
     }
     foreach (TECMisc misc in source.MiscCosts)
     {
         var toAdd = new TECMisc(misc);
         MiscCosts.Add(toAdd);
     }
     foreach (TECScopeBranch branch in source.ScopeBranches)
     {
         var toAdd = new TECScopeBranch(branch);
         ScopeBranches.Add(toAdd);
     }
     copyPropertiesFromLocated(source);
 }
예제 #12
0
 public bool AddToEquipment(int backpackItemIndex)
 {
     if (Backpack.Count == 0)
     {
         return(false);
     }
     if (Equipment.Count < 6)
     {
         Equipment.Add(Backpack[backpackItemIndex]);
         DropFromBackpack(backpackItemIndex);
         Equipment[Equipment.Count - 1].Equip();
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #13
0
        public List <EquipmentItem> Equip(EquipmentItem item)
        {
            var unequippedItems = new List <EquipmentItem>();
            var equipment       = GetEquipmentAt(item.Slot);

            if (equipment != null)
            {
                unequippedItems.Add(UnEquip(item.Slot));
            }

            if (item.IsHandSlot())
            {
                unequippedItems.AddRange(EquipWeapon(item));
            }

            Equipment.Add(item.Slot, item);
            SetLoadoutStrings();
            return(unequippedItems);
        }
        public async void RefreshEquipment(object e)
        {
            var equipment = await GetData.EquipmentQueryAsync();

            var Ids = new List <int>();

            foreach (EquipmentModel _equipment in Equipment)
            {
                Ids.Add(_equipment.Id);
            }

            foreach (EquipmentModel _equipment in equipment)
            {
                if (Ids.Contains(_equipment.Id))
                {
                }
                else
                {
                    Equipment.Add(_equipment);
                }
            }
        }
예제 #15
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            Equipment newEquipment = new Equipment();

            if (newEquipment.Add(Convert.ToInt32(cmbType.SelectedValue),
                                 txtModel.Text,
                                 txtWaranty.Text,
                                 txtWarBegin.Text,
                                 txtWarEnd.Text,
                                 Convert.ToInt32(cmbState.SelectedValue),
                                 Convert.ToInt32(cmbAccess.SelectedValue)))
            {
                MessageBox.Show("عملیات با موفقیت انجام شد");
            }

            else
            {
                MessageBox.Show(newEquipment.Message);
            }

            this.frmEquipment_Load(sender, e);
        }
        public void initEquipment()
        {
            var utilBranch = new BranchOfficeVM();
            var r1         = new EquipmentVM();

            r1.id       = Guid.NewGuid().ToString();
            r1.title    = "Projector 1";
            r1.branchId = utilBranch.GetBranchByName(Branches, "New York").BranchOfficeID;
            Equipment.Add(r1);
            var r2 = new EquipmentVM();

            r2.id       = Guid.NewGuid().ToString();
            r2.title    = "Hololens demo kit";
            r2.branchId = utilBranch.GetBranchByName(Branches, "London").BranchOfficeID;
            Equipment.Add(r2);
            var r3 = new EquipmentVM();

            r3.id       = Guid.NewGuid().ToString();
            r3.title    = "iPad test device 1";
            r3.branchId = utilBranch.GetBranchByName(Branches, "New York").BranchOfficeID;
            Equipment.Add(r3);
        }
예제 #17
0
        public TECTypical(TECSystem system, TECScopeManager manager) : this()
        {
            Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>();

            guidDictionary[_guid] = system.Guid;
            foreach (TECEquipment equipment in system.Equipment)
            {
                var toAdd = new TECEquipment(equipment, guidDictionary);
                Equipment.Add(toAdd);
            }
            foreach (TECController controller in system.Controllers)
            {
                var toAdd = controller.CopyController(guidDictionary);
                AddController(toAdd);
            }
            foreach (TECPanel panel in system.Panels)
            {
                var toAdd = new TECPanel(panel, guidDictionary);
                Panels.Add(toAdd);
            }
            foreach (TECMisc misc in system.MiscCosts)
            {
                var toAdd = new TECMisc(misc);
                MiscCosts.Add(toAdd);
            }
            foreach (TECScopeBranch branch in system.ScopeBranches)
            {
                var toAdd = new TECScopeBranch(branch);
                ScopeBranches.Add(toAdd);
            }
            foreach (TECProposalItem item in system.ProposalItems)
            {
                var toAdd = new TECProposalItem(item, guidDictionary);
                ProposalItems.Add(toAdd);
            }
            copyPropertiesFromLocated(system);
            ModelLinkingHelper.LinkSystem(this, guidDictionary);
        }
 private void setBoots()
 {
     Equipment.Clear();
     using (var context = new MyEntities())
     {
         context.Ninjas.Attach(SelectedNinja.ToModel());
         context.Equipments.Where(s => s.Category.Equals("Boots")).ToList().Where(s => !s.Ninjas.Contains(SelectedNinja.ToModel())).ToList().ForEach(s => Equipment.Add(new EquipmentVM(s)));
     }
 }
예제 #19
0
        public void GiveEquipment()
        {
            if (Deleted || Owner == null)
            {
                return;
            }

            TakeEquipment();

            if (Owner.Dex > 80)
            {
                Equipment.AddRange(
                    new Item[]
                {
                    new CloseHelm
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new ChainChest
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new ChainLegs
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new RingmailArms
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new RingmailGloves
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    }
                });
            }
            else
            {
                Equipment.AddRange(
                    new Item[]
                {
                    new LeatherChest
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new LeatherLegs
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new LeatherGorget
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new LeatherArms
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    },
                    new LeatherGloves
                    {
                        Quality     = ArmorQuality.Exceptional,
                        Association = 51,
                        Weight      = 0,
                    }
                });
            }

            Equipment.AddRange(
                new Item[]
            {
                new Sandals(), new Cloak()
            });

            PackItems.AddRange(
                new Item[]
            {
                new TemplateSpellBook(),
                new TemplateBagOfReagents(100),
                new TemplateBandages()
            });

            PackItems.AddRange(
                new Item[]
            {
                new TemplateTotalRefreshPotion(),
                new TemplateGreaterExplosionPotion {
                    Amount = 20
                },
                new TemplateGreaterCurePotion(),
                new TemplateGreaterHealPotion()
            });

            if (Owner.Skills.Poisoning.Value > 50)
            {
                PackItems.Add(
                    new TemplateDeadlyPoisonPotion
                {
                    Association = 51,
                    Weight      = 0,
                    Stackable   = true,
                    Amount      = 20
                });
            }

            if (Owner.Skills.Fencing.Value > 50)
            {
                Equipment.AddRange(
                    new Item[]
                {
                    new WarFork
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    },
                    new ShortSpear
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    }
                });
            }

            if (Owner.Skills.Swords.Value > 50 && Owner.Skills.Lumberjacking.Value == 0 ||
                Owner.Skills.Swords.Value > 50 && Owner.Int > 50)
            {
                Equipment.Add(
                    new Halberd
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
                PackItems.Add(
                    new Katana
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
            }

            if (Owner.Skills.Swords.Value > 50 && Owner.Skills.Lumberjacking.Value > 50)
            {
                Equipment.Add(
                    new TwoHandedAxe
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
                PackItems.AddRange(
                    new Item[]
                {
                    new Halberd
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    },
                    new DoubleAxe
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    },
                    new Katana
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    }
                });
            }

            if (Owner.Skills.Macing.Value > 50)
            {
                Equipment.Add(
                    new WarAxe
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
                PackItems.Add(
                    new WarHammer
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
            }

            if (Owner.Skills.Archery.Value > 50)
            {
                Equipment.Add(
                    new Bow
                {
                    Association = 51,
                    Quality     = WeaponQuality.Exceptional,
                    Weight      = 0
                });
                PackItems.AddRange(
                    new Item[]
                {
                    new HeavyCrossbow
                    {
                        Association = 51,
                        Quality     = WeaponQuality.Exceptional,
                        Weight      = 0
                    },
                    new TemplateArrows(),
                    new TemplateBolts()
                });
            }

            if (Owner.Skills.Parry.Value > 50)
            {
                Equipment.Add(
                    new MetalKiteShield
                {
                    Association  = 51,
                    Quality      = ArmorQuality.Exceptional,
                    MaxHitPoints = 10000,
                    HitPoints    = 10000,
                    Weight       = 0,
                });
            }

            foreach (Item i in Equipment.Where(item => !Owner.EquipItem(item) && !Owner.AddToBackpack(item)).ToArray()
                     )
            {
                i.Delete();
                Equipment.Remove(i);
            }

            foreach (Item i in PackItems.Where(item => !Owner.AddToBackpack(item)).ToArray())
            {
                i.Delete();
                PackItems.Remove(i);
            }
        }
예제 #20
0
 internal void AddEquipment(Equipment rpEquipment)
 {
     Equipment.Add(rpEquipment);
     OnPropertyChanged(nameof(Equipment));
 }
예제 #21
0
 public void Equip(EquipmentItem item)
 {
     Equipment.Add(item.Slot, item);
     SetLoadoutStrings();
 }