Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Reagent reagent = other.GetComponent <Reagent>();

        if (reagent.AlreadyAdded)
        {
            return;
        }

        reagent.AlreadyAdded = true;

        if (reagent == null)
        {
            return;
        }

        Reagents[reagent.Type]++;

        Glow.color = new Color(
            (Glow.color.r * 2 + reagent.Colour.r) / 3,
            (Glow.color.g * 2 + reagent.Colour.g) / 3,
            (Glow.color.b * 2 + reagent.Colour.b) / 3,
            175);

        Destroy(reagent.gameObject);

        IngredientAdded.Invoke();
    }
        public void DispenseChemical(Reagent reagent)
        {
            if (ChemistryDispenser.Container != null)
            {
                if (ChemistryDispenser.ThisState == PowerStates.On ||
                    ChemistryDispenser.ThisState == PowerStates.LowVoltage ||
                    ChemistryDispenser.ThisState == PowerStates.OverVoltage)
                {
                    //Logger.Log (Chemical);
                    if (dispensableReagents.Contains(reagent))                     //Checks if the the dispenser can dispense this chemical
                    {
                        float OutDispensedNumber = 0;
                        switch (ChemistryDispenser.ThisState)
                        {
                        case (PowerStates.OverVoltage):
                            OutDispensedNumber = DispensedNumber * 2;
                            break;

                        case (PowerStates.LowVoltage):
                            OutDispensedNumber = DispensedNumber * 0.5f;
                            break;

                        default:
                            OutDispensedNumber = DispensedNumber;
                            break;
                        }

                        ChemistryDispenser.Container.Add(new ReagentMix(reagent, OutDispensedNumber,
                                                                        DispensedTemperatureCelsius));
                    }
                }
            }

            UpdateAll();
        }
Ejemplo n.º 3
0
    //public Item FindItemInventory(int slot){
    //	return itemInventory[slot];
    //}

    public void AddResourceType(Reagent res, int quantity)
    {
        if (resourceInventory == null)
        {
            resourceInventory = new Dictionary <string, Reagent>();
        }

        if (res.ReagentName == "Oak Logs")
        {
            Objective_Interface.instance.QuestObjectives["GatherOak"].Invoke();
        }
        if (res.ReagentName == "Oak Planks")
        {
            Objective_Interface.instance.QuestObjectives["CraftPlank"].Invoke();
        }

        if (resourceInventory.ContainsKey(res.ReagentName))
        {
            resourceInventory[res.ReagentName].ReagentQuantity += quantity;
            print(res + ": " + resourceInventory[res.ReagentName].ReagentName);
        }
        else
        {
            resourceInventory.Add(res.ReagentName, res);
            print(res + ": " + resourceInventory[res.ReagentName]);
        }
        Inventory_Interface.instance.UpdateResourceListQuantities();
    }
Ejemplo n.º 4
0
        //---------------------------------------------------------------------------------------------

        public bool GetMixureReagent(UOItem container, Potion potion, PotionQuality quality)
        {
            if (!potion.Reagent.IsValid)
            {
                Game.PrintMessage("!potion.Reagent.IsValid :", MessageType.Error);
                return(false);
            }
            int    amount   = potion.GetAmountOrDefault(quality);
            UOItem resource = Reagent.FindReagent(container.Serial, potion.Reagent.Graphic, potion.Reagent.Color);

            if (resource.Exist && amount > 0)
            {
                //UOItem invetoryRg = new UOItem(Serial.Invalid);
                //if ((invetoryRg = Reagent.FindReagent(UO.Backpack.Serial, potion.Reagent.Graphic, potion.Reagent.Color)).Exist)
                //{
                //  invetoryRg.Move(invetoryRg.Amount, container);
                //  Game.Wait(Settings.SmallestWait);
                //}
                resource.Move((ushort)amount, UO.Backpack.Serial, 20, 20);
                Game.Wait(Game.SmallestWait);
                return(true);
            }
            else
            {
                Game.PrintMessage("Ve zdrojovem kontaineru nejsou regy.", MessageType.Error);
            }

            return(false);
        }
Ejemplo n.º 5
0
        public static async Task AddAsync(ReagentViewModel reagentVM)
        {
            Reagent reagent = SimplifyCreate(reagentVM);
            await _context.Reagents.AddAsync(reagent);

            await _context.SaveChangesAsync();
        }
    public void LoadReagentList()
    {
        ClearReagentList();
        ResetReagentAdd();
        if (crafterRef.CurrentItem == null)
        {
            return;
        }

        if (crafterRef.CurrentItem.RequiredReagents == null)
        {
            crafterRef.CurrentItem.RequiredReagents = new List <Reagent>();
        }

        for (int i = 0; i < crafterRef.CurrentItem.RequiredReagents.Count; i++)
        {
            GameObject obj     = Instantiate(reagentCard, reagentCardParent, false);
            string     reagent = crafterRef.CurrentItem.RequiredReagents[i].ReagentName;
            Text       textRef = obj.transform.Find("BG/Reagent").GetComponent <Text>();
            obj.transform.Find("BG/Quantity").GetComponent <InputField>().text = crafterRef.CurrentItem.RequiredReagents[i].ReagentQuantity.ToString();
            Reagent reg = crafterRef.CurrentItem.RequiredReagents[i];
            textRef.text = reagent;
            currentReagents.Add(textRef);
            reagentList.Add(reg);
        }
    }
Ejemplo n.º 7
0
 public ReagentMix(Reagent reagent, float amount, float temperature = TemperatureUtils.ZERO_CELSIUS_IN_KELVIN)
 {
     Temperature = temperature;
     reagents    = new  SerializableDictionary <Reagent, float> {
         [reagent] = amount
     };
 }
Ejemplo n.º 8
0
        public void DispenseChemical(Reagent reagent)
        {
            if (BoozeDispenser.Container != null)
            {
                if (BoozeDispenser.ThisState == PowerStates.On ||
                    BoozeDispenser.ThisState == PowerStates.LowVoltage ||
                    BoozeDispenser.ThisState == PowerStates.OverVoltage)
                {
                    if (dispensableReagents.Contains(reagent))                     //Checks if the the dispenser can dispense this chemical
                    {
                        float OutDispensedNumber = 0;
                        switch (BoozeDispenser.ThisState)
                        {
                        case (PowerStates.OverVoltage):
                            OutDispensedNumber = DispensedNumber * 2;
                            break;

                        case (PowerStates.LowVoltage):
                            OutDispensedNumber = DispensedNumber * 0.5f;
                            break;

                        default:
                            OutDispensedNumber = DispensedNumber;
                            break;
                        }

                        BoozeDispenser.Container.Add(new ReagentMix(reagent, OutDispensedNumber, 18));
                    }
                }
            }

            UpdateAll();
        }
Ejemplo n.º 9
0
 public float GetGasCapacity(ReagentMix reagentMix, Reagent reagent = null)
 {
     if (reagent == CirculatedReagent || reagent == null)
     {
         return(reagentMix[this] * BloodCapacityOf);
     }
     return(reagentMix[this] * BloodGasCapability);
 }
 public void ReInit(Reagent newReagent, float amount, GUI_ChemMaster tab)
 {
     Reagent       = newReagent;
     reagentAmount = amount;
     chemMasterTab = tab;
     reagentName.SetValueServer(Reagent.Name);
     reagentAmountDisplay.SetValueServer($"{reagentAmount:F2}u");
 }
Ejemplo n.º 11
0
 public ReagentViewModel(Reagent reagent)
 {
     ID                   = reagent.ID;
     Name                 = reagent.Name;
     ReagentCode          = reagent.ReagentCode;
     InStock              = reagent.InStock;
     MinimumAmountInStock = reagent.MinimumAmountInStock;
 }
Ejemplo n.º 12
0
 public float GetGasCapacity(ReagentMix reagentMix, Reagent reagent)
 {
     if (reagent == CirculatedReagent || reagent == null)
     {
         return(GetNormalGasCapacity(reagentMix));
     }
     return(GetSpecialGasCapacity(reagentMix));
 }
Ejemplo n.º 13
0
 public ReagentsEditViewModel(Reagent reagent)
 {
     Reagent          = reagent;
     Name             = reagent.Name;
     Quantity         = reagent.Quantity;
     ExpiryDate       = reagent.ExpiryDate;
     ManufacturerCode = reagent.ManufacturerCode;
 }
Ejemplo n.º 14
0
 public float GetSpareGasCapacity(ReagentMix reagentMix, Reagent reagent = null)
 {
     if (reagent == CirculatedReagent || reagent == null)
     {
         return(GetGasCapacity(reagentMix) - reagentMix[CirculatedReagent]);
     }
     return(GetGasCapacity(reagentMix, reagent) - reagentMix[reagent]);
 }
Ejemplo n.º 15
0
    public override object Clone(float reagentVolume)
    {
        Reagent newCompound = new Reagent(this as Compound);

        newCompound.Volume   = reagentVolume;
        newCompound.RealMass = newCompound.Density * newCompound.Volume;
        return(newCompound);
    }
Ejemplo n.º 16
0
        public Reagent TransformToReagent()
        {
            Reagent result = new Reagent();

            result.MoleculeCAS = MoleculeCAS;
            result.Ratio       = Ratio;

            return(result);
        }
Ejemplo n.º 17
0
 public void OpenCustomPrompt(Reagent newTransferReagentCandidate, bool toBuffer)
 {
     sendCustomAmountToBuffer = toBuffer;
     customAmountInputPromptSwitcher.SetActivePage(customAmountInputPromptPage);
     customTransferAmount = 0;
     customAmountLabel.SetValueServer($"---");
     customTransferReagentCandidate = newTransferReagentCandidate;
     customAmountReagentLabel.SetValueServer($"{customTransferReagentCandidate}");
 }
Ejemplo n.º 18
0
        public ContainerCustomSprite Get(Reagent reagent)
        {
            if (spritesData.ContainsKey(reagent))
            {
                return(spritesData[reagent]);
            }

            return(null);
        }
Ejemplo n.º 19
0
        public ActionResult Edit(Reagent reagent)
        {
            if (reagent == null)
            {
                return(HttpNotFound());
            }

            return(View(new ReagentsEditViewModel(reagent)));
        }
Ejemplo n.º 20
0
        public ActionResult Details(Reagent reagent)
        {
            if (reagent == null)
            {
                return(HttpNotFound());
            }

            return(View(reagent));
        }
Ejemplo n.º 21
0
        public static async Task <Reagent> Delete(IRequestContext context, Reagent reagent)
        {
            context.DbContext.Reagents.Remove(reagent);
            await context.DbContext.SaveChangesAsync();

            await context.LogAsync($"Deleted reagent ID {reagent.ReagentId}");

            return(reagent);
        }
Ejemplo n.º 22
0
        public void EmptyReagentTest()
        {
            Reagent item = new Reagent();

            List <OutputMessage> errors = new List <OutputMessage>();

            errors = item.Validate();

            Assert.AreNotEqual(0, errors.Count);
        }
Ejemplo n.º 23
0
        internal Reagent GetById(int id)
        {
            Reagent reagent = _repo.GetById(id);

            if (reagent == null)
            {
                throw new Exception("Invalid Id");
            }
            return(reagent);
        }
Ejemplo n.º 24
0
/*	//! Dilutes the reagent into water
 *      //  Takes the reagent Water as a parapeter in order to destroy the component afterwards.
 *      public void Dilute (Compound water) {
 *              if (!IsSolid) {
 *                      this.Volume = this.Volume + water.Volume;
 *                      this.RealMass = this.RealMass + water.RealMass;
 *                      this.Molarity = (this.Molarity *  this.Volume) / (this.Volume + water.Volume);
 *                      this.Density = this.RealMass / this.Volume;
 *              } else {
 *                      this.Volume = water.Volume; //TODO:CHECK WITH TECA.
 *                      this.RealMass = this.RealMass + water.RealMass;
 *                      this.Molarity = (this.Molarity *  this.Volume) / (this.Volume + water.Volume);
 *                      this.Density = this.RealMass / this.Volume;
 *              }
 *
 *              water = null;
 *      }
 *      public void Dilute (float waterVolume) {
 *              Debug.Log ("Dilute() called");
 *              if (!IsSolid) {
 *                      this.Volume = this.Volume + waterVolume;
 *                      this.RealMass = this.RealMass + waterVolume * waterMolarMass;
 *                      this.Molarity = (this.Molarity  *  this.Volume) / (this.Volume + waterVolume);
 *                      this.Density = this.RealMass / this.Volume;
 *              } else {
 *                      this.Volume = waterVolume; //TODO:CHECK WITH TECA.
 *                      this.RealMass = this.RealMass + waterVolume * waterMolarMass;
 *                      this.Molarity = (this.Molarity *  this.Volume) / (this.Volume + waterVolume);
 *                      this.Density = this.RealMass / this.Volume;
 *              }
 *      }
 */
    public Mixture React(Reagent reagent)
    {
        Compound product = null;


        /*
         *
         */
        return(null);
    }
Ejemplo n.º 25
0
        public ActionResult Save(Reagent reagent)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new ReagentViewModel(reagent)
                {
                    Units            = _uow.GetRepository <Unit>().GetAll(),
                    StorageLocations = _uow.GetRepository <StorageLocation>().GetAll()
                };
                return(View("ReagentForm", viewModel));
            }

            bool reagentExist = _uow.GetRepository <Reagent>().CheckIfExist(r => r.Name == reagent.Name && r.StorageLocationId == reagent.StorageLocationId);

            Reagent reagentWithTheSameNameAndLocation = new Reagent();

            if (reagentExist)
            {
                reagentWithTheSameNameAndLocation = _uow.GetRepository <Reagent>().Get(r => r.Name == reagent.Name && r.StorageLocationId == reagent.StorageLocationId);
            }

            if (reagent.Id == 0)
            {
                if (!reagentExist)
                {
                    _uow.GetRepository <Reagent>().Add(reagent);
                }
                else
                {
                    return(RedirectToAction("New", "Reagents").WithError("Odczynnik o podanej nazwie istnieje już w danej lokalizacji!"));
                }
            }
            else
            {
                var reagentInDb = _uow.GetRepository <Reagent>().Get(r => r.Id == reagent.Id);

                if (!reagentExist || (reagentExist && reagentWithTheSameNameAndLocation.Id == reagent.Id))
                {
                    reagentInDb.Name              = reagent.Name;
                    reagentInDb.InitialAmount     = reagent.InitialAmount;
                    reagentInDb.ConsumedAmount    = reagent.ConsumedAmount;
                    reagentInDb.FinalAmount       = reagent.FinalAmount;
                    reagentInDb.UnitId            = reagent.UnitId;
                    reagentInDb.StorageLocationId = reagent.StorageLocationId;
                    reagentInDb.Comment           = reagent.Comment;
                }
                else
                {
                    return(RedirectToAction("New", "Reagents").WithError("Odczynnik o podanej nazwie istnieje już w danej lokalizacji!"));
                }
            }
            _uow.SaveChanges();

            return(RedirectToAction("Index", "Reagents"));
        }
Ejemplo n.º 26
0
        public bool MixurePotion(Potion potion, PotionQuality quality, bool findInAll)
        {
            int    amount     = potion.GetAmountOrDefault(quality);
            UOItem invetoryRg = Reagent.FindReagentAll(UO.Backpack.Serial, potion.Reagent.Graphic, potion.Reagent.Color, amount);

            if (!invetoryRg.Exist)
            {
                Game.PrintMessage("Nejsou regy.", MessageType.Error);
                return(false);
            }

            if (!Mortar.Exist)
            {
                Game.PrintMessage("Neni mortar.", MessageType.Error);
                return(false);
            }
            Game.RunScript(amount * 6000);

            Game.PrintMessage("Micham:" + potion.Name + " - " + quality.ToString());
            Journal.Clear();

            Targeting.ResetTarget();
            UO.WaitMenu("Vyber typ potionu", potion.GetQualityDefinition(quality).MenuName);
            Mortar.Use();
            JournalEventWaiter jew = new JournalEventWaiter(true, "*You toss", "You can't make another potion now", "You completed the mixture in the mortar", "Musis mit v batuzku prazdnou lahev.");
            DateTime           dt1 = DateTime.Now;

            if (jew.Wait(60000))
            {
                if (Journal.Contains(true, "You can't make another potion now"))
                {
                    Game.Wait(4000);
                    return(true);
                }
                else if (Journal.Contains(true, "You toss"))
                {
                    return(true);
                }
                else if (Journal.Contains(true, "Musis mit v batuzku prazdnou lahev."))
                {
                    UIManager.Reset();
                    return(false);
                }
                else
                {
                    Mortar.Use();
                    if (Journal.WaitForText(false, 500, "You pour the completed"))
                    {
                        return(true);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 27
0
 public ReagentViewModel(Reagent reagent)
 {
     Id                = reagent.Id;
     Name              = reagent.Name;
     InitialAmount     = reagent.InitialAmount;
     ConsumedAmount    = reagent.ConsumedAmount;
     FinalAmount       = reagent.FinalAmount;
     StorageLocationId = reagent.StorageLocationId;
     UnitId            = reagent.UnitId;
     Comment           = reagent.Comment;
 }
Ejemplo n.º 28
0
 public void BufferTransfer(Reagent reagent, float amount)
 {
     if (transferBack)
     {
         TransferBufferToContainer(reagent, amount);
     }
     else
     {
         RemoveFromBuffer(reagent, amount);
     }
 }
Ejemplo n.º 29
0
        public Reagent Create(Reagent newReagent)
        {
            string sql = @"
            INSERT INTO reagents
            (spellId, name, description)
            VALUES
            (@SpellId, @Name, @Description)
            SELECT LAST_INSERT_ID()";

            newReagent.Id = _db.ExecuteScalar <int>(sql, newReagent);
            return(newReagent);
        }
Ejemplo n.º 30
0
        public bool Update(Reagent original)
        {
            string sql          = @"
            UPDATE reagents
            SET
                spellId = @SpellId,
                name = @Name,
                description = @Description";
            int    affectedRows = _db.Execute(sql, original);

            return(affectedRows == 1);
        }
Ejemplo n.º 31
0
Archivo: Spell.cs Proyecto: Marosa/Calc
 public Spell(SpellName spellname,
     SpellTalentSchool talentSchool,
     SpellSchool directSpellSchool = default(SpellSchool),
     SpellSchool DoTSpellSchool = default(SpellSchool),
     double duration = 0,
     bool hasteAffectsDuration = false,
     double baseCasttime = 0,
     double flatCasttimeReduction = 0,
     double percentualCasttimeReduction = 0,
     double hasteFactor = 1,
     double cooldown = 0,
     double manaCostOfBaseMana = 0,
     double manaCostFactor = 1,
     double requiredBuffUptimeFactor = 1,
     Reagent reagent = Reagent.None,
     double averageDirectBaseDamage = 0,
     double averageDoTBaseDamage = 0,
     double SPDirectScaling = 0,
     double SPDoTScaling = 0,
     double APDirectScaling = 0,
     double APDoTScaling = 0,
     bool channeled = false,
     int numOfTicks = 1,
     double directDamageFactor = 1,
     double DoTDamageFactor = 1,
     bool directCanCrit = true,
     bool DoTCanCrit = false,
     double directCritChance = 0,
     double DoTCritChance = 0,
     double directCritDamageFactor = 1.5,
     double DoTCritDamageFactor = 1.5)
 {
     this.spellname = spellname;
     this.talentSchool = talentSchool;
     this.directSpellSchool = directSpellSchool;
     this.duration = duration;
     this.hasteAffectsDuration = hasteAffectsDuration;
     this.baseCasttime = baseCasttime;
     this.flatCasttimeReduction = flatCasttimeReduction;
     this.percentualCasttimeReduction = percentualCasttimeReduction;
     this.effectiveCasttime = ((baseCasttime * (1 - (percentualCasttimeReduction / 100))) - flatCasttimeReduction) / hasteFactor;
     this.hasteFactor = hasteFactor;
     this.cooldown = cooldown;
     this.effectiveCooldown = cooldown;
     this.manaCostOfBaseMana = manaCostOfBaseMana;
     this.manaCostFactor = manaCostFactor;
     this.requiredBuffUptimeFactor = requiredBuffUptimeFactor;
     this.averageDirectBaseDamage = averageDirectBaseDamage;
     this.averageDoTBaseDamage = averageDoTBaseDamage;
     this.SPDirectScaling = SPDirectScaling;
     this.SPDoTScaling = SPDoTScaling;
     this.APDirectScaling = APDirectScaling;
     this.APDoTScaling = APDoTScaling;
     this.reagent = reagent;
     this.channeled = channeled;
     this.numOfTicks = numOfTicks;
     this.directDamageFactor = directDamageFactor;
     this.DoTDamageFactor = DoTDamageFactor;
     this.directCanCrit = directCanCrit;
     this.DoTCanCrit = DoTCanCrit;
     this.directCritChance = directCritChance;
     this.DoTCritChance = DoTCritChance;
     this.directCritDamageFactor = directCritDamageFactor;
     this.DoTCritDamageFactor = DoTCritDamageFactor;
 }