Пример #1
0
        private void RemoveModsFromDevice()
        {
            CharacterEquipment objCharEquip  = new CharacterEquipment();
            CharacterArmor     objCharArmor  = new CharacterArmor();
            CharacterWeapon    objCharWeapon = new CharacterWeapon();;

            switch (enumModType)
            {
            case Common.ModificationType.Armor:
                objCharArmor.GetCharacterArmor(intModedObjID);
                break;

            case Common.ModificationType.Equipment:
                objCharEquip.GetCharacterEquipment(intModedObjID);
                break;

            case Common.ModificationType.Weapon:
                objCharWeapon.GetCharacterWeapon(intModedObjID);
                break;
            }

            //Delete the mod if its not in the selected list
            foreach (Modification objOrigMod in lstOriginalModfications)
            {
                if (!Modification.IsModificationInList(objOrigMod, lstModficationsSelected))
                {
                    switch (enumModType)
                    {
                    case Common.ModificationType.Armor:
                        objCharArmor.DeleteCharacterArmorModification(intModedObjID, objOrigMod.ModificationID);
                        break;

                    case Common.ModificationType.Equipment:
                        objCharEquip.DeleteCharacterEquipmentModification(intModedObjID, objOrigMod.ModificationID);
                        break;

                    case Common.ModificationType.Weapon:
                        objCharWeapon.DeleteCharacterWeaponModification(intModedObjID, objOrigMod.ModificationID);
                        break;
                    }
                }
            }

            //Add the mod if its not in the Original List
            foreach (Modification objSelMod in lstModficationsSelected)
            {
                if (!Modification.IsModificationInList(objSelMod, lstOriginalModfications))
                {
                    switch (enumModType)
                    {
                    case Common.ModificationType.Armor:
                        objSelMod.SaveCharacterArmorModification(objCharArmor.CharacterArmorID, objSelMod.ModificationID);
                        break;

                    case Common.ModificationType.Equipment:
                        objSelMod.SaveCharacterEquipmentModification(objCharEquip.CharacterEquipmentID, objSelMod.ModificationID);
                        break;

                    case Common.ModificationType.Weapon:
                        objSelMod.SaveCharacterWeaponModification(objCharWeapon.CharacterWeaponID, objSelMod.ModificationID);
                        break;
                    }
                }
            }
        }