/// <summary> /// Checks tools from Prepare, to maybe cancel skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="productData"></param> /// <returns></returns> protected virtual bool CheckTools(Creature creature, Skill skill, ProductionData productData) { // Check tool // Sanity check, the client should be handling this. if (productData.Tool != null) { if (creature.RightHand == null || !creature.RightHand.HasTag(productData.Tool)) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without the appropriate tool.", creature.EntityId); return(false); } } else { if (creature.RightHand != null) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without empty hands.", creature.EntityId); return(false); } } // TODO: Check durability? What happens if tool is unusable? return(true); }
protected override void UpdateTool(Creature creature, ProductionData productData) { if (productData.Tool == null) { return; } Item item; if (productData.Category == ProductionCategory.Weaving) { item = creature.Inventory.GetItemAt(Pocket.Glove, 0, 0); } else if (productData.Category == ProductionCategory.Spinning) { item = creature.RightHand; } else { Log.Error("Weaving.UpdateTool: Unknown product category '{0}'.", productData.Category); return; } if (item == null) { Log.Error("Weaving.UpdateTool: No item to update found. Category: {0}", productData.Category); return; } creature.Inventory.ReduceDurability(item, productData.Durability); creature.Inventory.AddProficiency(item, Proficiency); }
public IActionResult Put(int id, ProductionData productionData) { if (id != productionData.Id) { return(BadRequest()); } _context.Update(productionData); try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductionDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private static void TransferHo1AndHo3(ProductionData data) { var processUnits = data.ProcessUnits.All().Where(x => x.ShortName == "ХО-1" || x.ShortName == "ХО-3").ToList(); var newFactory = data.Factories.All().Include(x => x.Plant).FirstOrDefault(x => x.Id == 4); if (processUnits.Any() && newFactory != null) { var activationData = new DateTime(2017, 2, 1); foreach (var processUnit in processUnits) { using ( var transaction = new TransactionScope(TransactionScopeOption.Required, DefaultTransactionOptions.Instance.TransactionOptions)) { processUnit.FactoryId = 4; data.ProcessUnitToFactoryHistory.Add(new ProcessUnitToFactoryHistory() { ProcessUnitId = processUnit.Id, ProcessUnitShortName = processUnit.ShortName, ProcessUnitFullName = processUnit.FullName, FactoryId = newFactory.Id, FactoryShortName = newFactory.ShortName, FactoryFullName = newFactory.FullName, PlantId = newFactory.Plant.Id, PlantShortName = newFactory.Plant.ShortName, PlantFullName = newFactory.Plant.FullName, ActivationDate = activationData }); data.SaveChanges("ProcessUnit Transfer"); transaction.Complete(); } } } }
private static void CreateProcessUnitHistoryLoad(ProductionData data) { var puHistory = data.ProcessUnitToFactoryHistory.All().Include(x => x.Factory.Plant).Where(x => x.ActivationDate == new DateTime(2017, 1, 1)).ToList(); var date = new DateTime(1977, 1, 1); var records = new List <ProcessUnitToFactoryHistory>(); for (int i = 0; i < 480; i++) { foreach (var historyRecord in puHistory) { var newRecord = new ProcessUnitToFactoryHistory() { ProcessUnitId = historyRecord.ProcessUnitId, ActivationDate = date, ProcessUnitShortName = historyRecord.ProcessUnitShortName, ProcessUnitFullName = historyRecord.ProcessUnitFullName, FactoryId = historyRecord.FactoryId, FactoryShortName = historyRecord.FactoryShortName, FactoryFullName = historyRecord.FactoryFullName, PlantId = historyRecord.PlantId, PlantShortName = historyRecord.PlantShortName, PlantFullName = historyRecord.PlantFullName, }; records.Add(newRecord); } date = date.AddMonths(1); } data.ProcessUnitToFactoryHistory.BulkInsert(records, "Load Test"); data.SaveChanges("Load Test"); }
public ProductionEventArgs(Creature creature, ProductionData data, bool success, Item item) { this.Creature = creature; this.ProductionData = data; this.Success = success; this.Item = item; }
public void InitSlot(ProductionData data) { productionData = data; productionData.onChangedHeroList += OnChangedDeployHeroData; productionData.onProduce += OnProduce; User.onChangedLevel += OnChangedLevel; lockPanel.SetActive(productionData.baseData.openLevel > User.Instance.userLevel); textOpenDescription.text = "왕국레벨 [" + productionData.baseData.openLevel + "] 달성시 사용가능"; heroSlotPool = new List <TerritoryDeployedHeroSlot>(deployHeroListParent.GetComponentsInChildren <TerritoryDeployedHeroSlot>()); for (int i = 0; i < productionData.heroList.Count; i++) { heroSlotPool[i].InitSlot(productionData.heroList[i]); } if (productionData.product == null) { if (productionData.productionLineID == "productionLine_01") { ApplyProduct(ProductManager.Instance.productList.Find(x => x.id == "food_001")); } else { ApplyProduct(); } } else { ApplyProduct(productionData.product); } }
/// <summary> /// Checks tools from Prepare, to maybe cancel skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="productData"></param> /// <returns></returns> protected virtual bool CheckTools(Creature creature, Skill skill, ProductionData productData) { // Sanity checks, the client should be handling this. // If null, anything can be equipped if (productData.Tool == null) { return(true); } if (productData.Tool == "/barehand/") { // Fail if bare hand required but an item is equipped if (creature.RightHand != null) { Log.Warning("ProductionSkill.Complete: User '{0}' tried to produce without empty hands.", creature.Client.Account.Id); return(false); } } else { // Fail if no item or the wrong one is equipped if (creature.RightHand == null || !creature.RightHand.HasTag(productData.Tool)) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without the appropriate tool.", creature.EntityId); return(false); } } // TODO: Check durability? What happens if tool is unusable? return(true); }
public async Task <IActionResult> Edit(int id, [Bind("PkProductionId,FkMillKey,FkProdCatId,Quantity,Units,FkSourceId,SourceYear,Comments")] ProductionData productionData) { if (id != productionData.PkProductionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(productionData); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductionDataExists(productionData.PkProductionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["FkMillKey"] = new SelectList(_context.MillInformation, "PkMillKey", "MillId", productionData.FkMillKey); ViewData["FkProdCatId"] = new SelectList(_context.NcasiprodCat, "PkProdCatId", "Category", productionData.FkProdCatId); ViewData["FkSourceId"] = new SelectList(_context.Source, "PkSourceId", "DataSource", productionData.FkSourceId); return(View(productionData)); }
/// <summary> 초기화 </summary> /// <param name="productionLineData"> 이 재료는 어떤 라인 생산품의 것인지. </param> /// <param name="ingredient"> 재료의 아이템 정의</param> /// <param name="count"> </param> public void Init(ProductionData _productionLineData, Item _ingredient, double count) { productionLineData = _productionLineData; productionLineData.onChangedProductionAmount += OnChangedProductionAmount; UpdateData(_ingredient, count); }
public void initdata(ProductionData pd) { productionData = pd; string[] namesplit = name.Split('@'); productionData.producttype = namesplit[0]; productionData.productnum = Int32.Parse(namesplit[1]); Debug.Log("[" + name + "] init : " + productionData.productnum); }
protected void btnSearch_Click(object sender, EventArgs e) { RMRecieve R = new RMRecieve(); ProductionData PD = new ProductionData(); R.RMRDate = Convert.ToDateTime(txtSearchDate.Text); GetQCProcssingDetails(R); }
public void SetTooltipData(ProductionData data) { _title.text = data.Name; _desc.text = data.Description; ResourceCost cost = data.Cost; _costs.text = string.Format(": {0}\n: {1}\n: {2}", cost.Gold, cost.Timber, cost.Food); }
protected void btnAddProductionInfo_Click(object sender, EventArgs e) { rmrdata = new RMRecieve(); proddata = new ProductionData(); int Result = 0; rmrdata.RMRId = 0; rmrdata.RMRDate = Convert.ToDateTime(txtDate.Text.ToString()); rmrdata.RMRShiftId = Convert.ToInt32(dpShiftDetails.SelectedItem.Value); rmrdata.BatchNo = txtBatchNo.Text; rmrdata.TankMilkReciptNo = txtTankerReceipitNo.Text; rmrdata.TankerNo = txtTankerNo.Text; rmrdata.Quantity = string.IsNullOrEmpty(txtQty.Text) ? 0 : Convert.ToDouble(txtQty.Text); rmrdata.MilkType = string.IsNullOrEmpty(txtMilkType.Text) ? string.Empty : txtMilkType.Text; rmrdata.CreatedBy = GlobalInfo.Userid; rmrdata.CreatedDate = Convert.ToDateTime(DateTime.Now).ToString("dd-MM-yyyy"); rmrdata.QCId = Convert.ToInt32(dpfinishQC.SelectedItem.Value); rmrdata.MBRTStart = string.IsNullOrEmpty(txtMBRTStartTime.Text) ? string.Empty : txtMBRTStartTime.Text; rmrdata.MBRTEnd = string.IsNullOrEmpty(txtMBRTEndTime.Text) ? string.Empty : txtMBRTEndTime.Text; rmrdata.TotalHours = string.IsNullOrEmpty(txtTotalHours.Text) ? string.Empty : txtTotalHours.Text; rmrdata.IsActive = true; rmrdata.flag = "Insert"; // rmrdata.CheckBatchNo = 0; Result = proddata.RMRData(rmrdata); if (Result > 0) { //Response.Redirect(Request.RawUrl); divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; RMRecieve R = new RMRecieve(); R.RMRDate = Convert.ToDateTime(txtDate.Text); GetRMRDetails(R); uprouteList.Update(); lblSuccess.Text = "RMR Data Add Successfully"; pnlError.Update(); clearText(); } else if (Result == 100) { divDanger.Visible = true; divwarning.Visible = false; divSusccess.Visible = false; lblSuccess.Text = "Batch No Already Exist"; pnlError.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblSuccess.Text = "Something went wrong plz contact site admin"; pnlError.Update(); } //return Result; }
public void GetRMRDetails(int RMRId) { DataSet DS = new DataSet(); ProductionData proddata = new ProductionData(); DS = proddata.GetRMRDatabyId(RMRId); if (!Comman.Comman.IsDataSetEmpty(DS)) { //string DATE = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RMRDate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["RMRDate"].ToString(); ////sky //DateTime date1 = Convert.ToDateTime(DATE, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat); //txtDate.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd")); txtDate.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RMRDate"].ToString()) ? string.Empty : Convert.ToDateTime(DS.Tables[0].Rows[0]["RMRDate"]).ToString("yyyy-MM-dd"); txtBatchNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["BatchNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["BatchNo"].ToString(); //txtDate.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Date"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Date"].ToString(); //dpShiftDetails.SelectedValue = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ShiftId"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ShiftId"].ToString(); dpShiftDetails.ClearSelection(); if (dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RMRShiftId"]).ToString()) != null) { dpShiftDetails.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RMRShiftId"]).ToString()).Selected = true; } txtTankerReceipitNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TankMilkReciptNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TankMilkReciptNo"].ToString(); txtTankerNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TankerNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TankerNo"].ToString(); txtQty.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Qty"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Qty"].ToString(); txtMilkType.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TypeOfMilk"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TypeOfMilk"].ToString(); txtMBRTStartTime.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MBRTStartTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MBRTStartTime"].ToString(); txtMBRTEndTime.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MBRTEndTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MBRTEndTime"].ToString(); txtTotalHours.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TotalHours"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TotalHours"].ToString(); //dpfinishQC.Enabled = true; dpfinishQC.ClearSelection(); if (dpfinishQC.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["QCId"]).ToString()) != null) { dpfinishQC.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["QCId"]).ToString()).Selected = true; if (dpfinishQC.SelectedItem.Text == "Accepted") { txtMBRTStartTime.ReadOnly = false; txtMBRTStartTime.Text = Convert.ToString(DateTime.Now.ToString("HH:mm")); txtMBRTEndTime.ReadOnly = false; txtTotalHours.ReadOnly = false; RFVMBRTStart.Enabled = true; RFVMBRTEnd.Enabled = true; RFVTotalHrs.Enabled = true; } else if (dpfinishQC.SelectedItem.Text == "Rejected" || dpfinishQC.SelectedItem.Text == "Pending" || dpfinishQC.SelectedItem.Text == "Re-Chilling") { txtMBRTStartTime.ReadOnly = true; txtMBRTEndTime.ReadOnly = true; txtTotalHours.ReadOnly = true; } } txtRMRQCStatus.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Status"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Status"].ToString(); } }
IEnumerator Start() { while (!WebServerConnectManager.Instance) { yield return(null); } WebServerConnectManager.onWebServerResult += OnWebServerResult; while (!TerritoryManager.Instance) { yield return(null); } while (!Storage.isInitialized) { yield return(null); } productList = GameDataManager.itemDic.Values.ToList().FindAll(x => x.itemType == ItemType.Production); List <ProductionLineBaseData> productionLineBaseData = GameDataManager.productionLineBaseDataDic.Values.ToList(); for (int i = 0; i < productionLineBaseData.Count; i++) { ProductionData data = new ProductionData(productionLineBaseData[i]); productionLineDataList.Add(data); } while (true) { bool isEnd = true; for (int i = 0; i < productionLineDataList.Count; i++) { if (productionLineDataList[i].isInitialized == false) { Debug.Log("없음!!!"); isEnd = false; } } if (isEnd) { break; } yield return(null); } isInitialized = true; if (onProductManagerInitialized != null) { onProductManagerInitialized(); } //TerritoryManager.Instance.onAddPlace += OnAddPlace; }
protected override void Seed(OwlFinanceDbContext context) { base.Seed(context); #if DEBUG DevelopmentData.Seed(context); #else ProductionData.Seed(context); #endif }
protected void btnSearch_Click(object sender, EventArgs e) { //string dates = Convert.ToDateTime(txtSearchDate.Text).ToString("dd-MM-yyyy"); //GetPasteurizationDetails(dates); RMRecieve R = new RMRecieve(); ProductionData PD = new ProductionData(); R.RMRDate = Convert.ToDateTime(txtSearchDate.Text); GetPasteurizationDetails(R); }
/// <summary> /// Updates tool's durability and proficiency. /// </summary> /// <param name="creature"></param> /// <param name="productData"></param> protected virtual void UpdateTool(Creature creature, ProductionData productData) { if (productData.Tool == null) { return; } creature.Inventory.ReduceDurability(creature.RightHand, productData.Durability); creature.Inventory.AddProficiency(creature.RightHand, Proficiency); }
public SettlementData(Planet planet, CosmicPortData cosmicPortData, ManufactoryData manufactoryData, StarLabsData starLabsData, StudiesSaveData studiesSaveData, ProductionData productionData, List <Resource> resources) { this.planet = planet; this.cosmicPortData = cosmicPortData; this.manufactoryData = manufactoryData; this.starLabsData = starLabsData; this.studiesSaveData = studiesSaveData; this.productionData = productionData; this.resources = resources; }
void ProduceItem(ref ProductionData Production) { for (int i = 0; i < Production.RequiredItems.Length; i++) { mStorage.RemoveItem(Production.RequiredItems[i]); } mStorage.AddItem(Production.TargetItem); Production.LastUpdateTime = Time.time; }
static void Main(string[] args) { using (var data = new ProductionData(new AppDbContext(new AuditablePersister()))) { var timer = new Stopwatch(); var times = new TimeSpan[4]; // TransferHo1AndHo3(data); timer.Start(); var factories = GetActualFactories(data, new DateTime(2017, 1, 12)).ToList(); PrintFactories(factories, new DateTime(2017, 1, 12)); timer.Stop(); times[0] = timer.Elapsed; timer.Reset(); Console.WriteLine(); timer.Start(); factories = GetActualFactories(data, new DateTime(2017, 3, 2)).ToList(); PrintFactories(factories, new DateTime(2017, 3, 2)); timer.Stop(); times[1] = timer.Elapsed; timer.Reset(); Console.WriteLine(); // CreateProcessUnitHistoryLoad(data); timer.Start(); factories = GetActualFactories(data, new DateTime(2017, 1, 12)).ToList(); PrintFactories(factories, new DateTime(2017, 1, 12)); timer.Stop(); times[2] = timer.Elapsed; timer.Reset(); Console.WriteLine(); timer.Start(); factories = GetActualFactories(data, new DateTime(2017, 3, 2)).ToList(); PrintFactories(factories, new DateTime(2017, 3, 2)); timer.Start(); times[3] = timer.Elapsed; Console.WriteLine(); Console.WriteLine($"Test summary:\n{"".PadLeft(20,'-')}"); for (int i = 0; i < times.Length; i++) { Console.WriteLine($"Estimated time for test #{i + 1}:{times[i]}"); } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } }
protected override bool CheckTools(Creature creature, Skill skill, ProductionData productData) { if (creature.RightHand == null || !creature.RightHand.HasTag("/handicraft_kit/")) { // Sanity check, the client should normally handle this. Send.MsgBox(creature, Localization.Get("You're going to need a Handicraft Kit for that.")); return(false); } return(true); }
/// <summary> /// Checks if creature has enough mana to produce product, /// returns false if not. Handles notices. /// </summary> /// <param name="creature"></param> /// <param name="productData"></param> /// <returns></returns> private bool CheckMana(Creature creature, ProductionData productData) { // Sanity check, client checks this as well. if (creature.Mana < productData.Mana) { Send.Notice(creature, Localization.Get("You do not have enough MP to make that many at once.")); return(false); } return(true); }
protected override bool CheckTools(Creature creature, Skill skill, ProductionData productData) { if (creature.RightHand == null || !creature.RightHand.HasTag("/handicraft_kit/")) { // Sanity check, the client should normally handle this. Send.MsgBox(creature, Localization.Get("You're going to need a Handicraft Kit for that.")); return false; } return true; }
protected override bool CheckTools(Creature creature, Skill skill, ProductionData productData) { if (creature.RightHand == null || !creature.RightHand.HasTag("/potion_making/kit/")) { // Sanity check, the client should normally handle this. Send.MsgBox(creature, Localization.Get("You need a Potion Concoction Kit to make potions!")); return(false); } return(true); }
private static IEnumerable <Factory> GetActualFactories(ProductionData data, DateTime targetDate) { var records = data.ProcessUnitToFactoryHistory.All().Include(x => x.Factory).Include(x => x.ProcessUnit) .Where(x => x.ActivationDate <= targetDate) .GroupBy(x => x.ProcessUnitId) .SelectMany(x => x.Where(y => y.ActivationDate == x.Max(z => z.ActivationDate))).OrderBy(x => x.ProcessUnitId); var jRecords = records.Join(data.ProcessUnits.All().Include(self => self.FactoryHistories), recs => recs.ProcessUnitId, pu => pu.Id, (recs, pu) => new { recs, pu }); var factories = new Dictionary <int, Factory>(); foreach (var historyRecord in jRecords) { var newHistoryProcessUnit = historyRecord.pu; newHistoryProcessUnit.ShortName = historyRecord.recs.ProcessUnitShortName; newHistoryProcessUnit.FullName = historyRecord.recs.ProcessUnitFullName; if (!factories.ContainsKey(historyRecord.recs.FactoryId)) { var newFactory = new Factory() { Id = historyRecord.recs.FactoryId, ShortName = historyRecord.recs.FactoryShortName, FullName = historyRecord.recs.FactoryFullName }; newFactory.ProcessUnits.Add(newHistoryProcessUnit); factories.Add(newFactory.Id, newFactory); } else { factories[historyRecord.recs.FactoryId].ProcessUnits.Add(newHistoryProcessUnit); } } return(factories.Select(x => x.Value).OrderBy(x => x.Id)); //new ProcessUnit() //{ // Id = x.Id, // ShortName = x.FactoryHistories. ShortName, // FullName = x.FullName, // FactoryHistories = new List<ProcessUnitToFactoryHistory>(), // Factory = x.FactoryHistories // .Where(z => z.ActivationDate <= targetDate && z.IsDeleted == false) // .OrderByDescending(y => y.ActivationDate) // .FirstOrDefault()?.Factory ?? new Factory() //} //); }
protected override bool CheckTools(Creature creature, Skill skill, ProductionData productData) { if (creature.RightHand == null || !creature.RightHand.HasTag("/potion_making/kit/")) { // Sanity check, the client should normally handle this. Send.MsgBox(creature, Localization.Get("You need a Potion Concoction Kit to make potions!")); return false; } return true; }
protected void btnSearch_Click(object sender, EventArgs e) { try { RMRecieve R = new RMRecieve(); ProductionData PD = new ProductionData(); R.RMRDate = Convert.ToDateTime(txtSearchDate.Text); GetCreamDetails(R); } catch (Exception) { } }
protected void btnSearch_Click(object sender, EventArgs e) { try { //string dates = Convert.ToDateTime(txtSearchDate.Text).ToString("dd-MM-yyyy"); //GetHomogenizerDetails(dates); RMRecieve R = new RMRecieve(); ProductionData PD = new ProductionData(); R.RMRDate = Convert.ToDateTime(txtSearchDate.Text); GetHomogenizerDetails(R); } catch (Exception) { } }
protected void txtBatchNo_TextChanged(object sender, EventArgs e) { string batchno = txtBatchNo.Text; ProductionData proddata = new ProductionData(); DS = proddata.GetExistingBatchNo(batchno); if (!Comman.Comman.IsDataSetEmpty(DS)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Batch No. Already exists.')", true); txtBatchNo.Text = string.Empty; } }
public void InitSlot(ProductionData data) { productionData = data; productionData.onChangedProduct += OnChangedProduct; productionData.onChangedProductionAmount += OnChangedProductionAmount; //Debug.Log("콜백 등록됨"); gameObject.SetActive(productionData.product != null); InitSlot(productionData.product); buttonApply.gameObject.SetActive(false); buttonRelease.gameObject.SetActive(false); }
bool CheckRequirements(ref ProductionData Production) { if (Time.time < Production.LastUpdateTime + Production.RequiredTime) return false; for(int i = 0; i < Production.RequiredItems.Length; i++) { if (mStorage.GetItemCount(Production.RequiredItems[i].Type) < Production.RequiredItems[i].Count) return false; } return true; }
protected override bool CheckTools(Creature creature, Skill skill, ProductionData productData) { // The only weaving tool in the db are gloves, for silk, // while spinning, which is also handled by Weaving, // uses blades for leather straps. That's why we need // special handling for weaving. if (productData.Category == ProductionCategory.Weaving) { // Hands need to be free if (!creature.HandsFree) { Send.Notice(creature, Localization.Get("You're going to need both hands free to weave anything.")); return false; } // The only production tool for weaving are gloves if (productData.Tool != null) { var glove = creature.Inventory.GetItemAt(Pocket.Glove, 0, 0); if (glove == null || !glove.HasTag(productData.Tool)) { // Unofficial Send.Notice(creature, Localization.Get("You need access to a Spinning Wheel or Loom.")); return false; } } } else if (productData.Category == ProductionCategory.Spinning) { // Run the standard tests for spinning. return base.CheckTools(creature, skill, productData); } else { Log.Error("Weaving.CheckTools: Unknown product category '{0}'.", productData.Category); return false; } return true; }
protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success) { // Hidden Novice Rank skill, no training. }
protected override void UpdateTool(Creature creature, ProductionData productData) { if (productData.Tool == null) return; Item item; if (productData.Category == ProductionCategory.Weaving) { item = creature.Inventory.GetItemAt(Pocket.Glove, 0, 0); } else if (productData.Category == ProductionCategory.Spinning) { item = creature.RightHand; } else { Log.Error("Weaving.UpdateTool: Unknown product category '{0}'.", productData.Category); return; } if (item == null) { Log.Error("Weaving.UpdateTool: No item to update found. Category: {0}", productData.Category); return; } creature.Inventory.ReduceDurability(item, productData.Durability); creature.Inventory.AddProficiency(item, Proficiency); }
protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success) { if (skill.Info.Rank == SkillRank.Novice) { skill.Train(1); // Use the skill. if (success) skill.Train(2); // Use the skill successfully. return; } if (!success) return; if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RD) { if (data.ItemData.HasTag("/yarn/01/")) skill.Train(1); // Successfully make Thick Thread. else if (data.ItemData.HasTag("/yarn/02/")) skill.Train(2); // Successfully make Thin Thread. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(3); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(4); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/texture/02/")) skill.Train(5); // Successfully make Common Fabric. else if (data.ItemData.HasTag("/texture/01/")) skill.Train(6); // Successfully make Cheap Fabric. else if (data.ItemData.HasTag("/silk/01/")) skill.Train(7); // Successfully make Cheap Silk. else if (skill.Info.Rank >= SkillRank.RE && data.ItemData.HasTag("/leather_strap/01/")) skill.Train(8); // Successfully make Cheap Leather Strap. return; } if (skill.Info.Rank == SkillRank.RC) { if (data.ItemData.HasTag("/yarn/02/")) skill.Train(1); // Successfully make Thin Thread. return; } if (skill.Info.Rank >= SkillRank.RB && skill.Info.Rank <= SkillRank.RA) { if (data.ItemData.HasTag("/yarn/02/")) skill.Train(1); // Successfully make Thin Thread. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(2); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(3); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/texture/02/")) skill.Train(4); // Successfully make Common Fabric. else if (data.ItemData.HasTag("/silk/01/")) skill.Train(5); // Successfully make Cheap Silk. else if (data.ItemData.HasTag("/leather_strap/01/")) skill.Train(6); // Successfully make Cheap Leather Strap. return; } if (skill.Info.Rank == SkillRank.R9) { if (data.ItemData.HasTag("/yarn/03/")) skill.Train(1); // Successfully make a Braid. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(2); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(3); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(4); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/silk/03/")) skill.Train(5); // Successfully make Fine Silk. else if (data.ItemData.HasTag("/silk/02/")) skill.Train(6); // Successfully make Common Silk. else if (data.ItemData.HasTag("/leather_strap/01/")) skill.Train(7); // Successfully make Cheap Leather Strap. return; } if (skill.Info.Rank == SkillRank.R8) { if (data.ItemData.HasTag("/silk/04/")) skill.Train(1); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/silk/03/")) return; } if (skill.Info.Rank == SkillRank.R7) { if (data.ItemData.HasTag("/yarn/03/")) skill.Train(1); // Successfully make a Braid. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(2); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(3); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(4); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/silk/03/")) skill.Train(5); // Successfully make Fine Silk. else if (data.ItemData.HasTag("/leather_strap/02/")) skill.Train(6); // Successfully make Common Leather Strap. return; } if (skill.Info.Rank == SkillRank.R6) { if (data.ItemData.HasTag("/texture/04/")) skill.Train(1); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(2); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(3); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/silk/03/")) skill.Train(4); // Successfully make Fine Silk. else if (data.ItemData.HasTag("/leather_strap/03/")) skill.Train(5); // Successfully make Fine Leather Strap. else if (data.ItemData.HasTag("/leather_strap/02/")) skill.Train(6); // Successfully make Common Leather Strap. return; } if (skill.Info.Rank == SkillRank.R5) { if (data.ItemData.HasTag("/toughband/")) skill.Train(1); // Successfully make a Tough String. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(2); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/texture/03/")) skill.Train(3); // Successfully make Fine Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(4); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/silk/03/")) skill.Train(5); // Successfully make Fine Silk. else if (data.ItemData.HasTag("/leather_strap/03/")) skill.Train(6); // Successfully make Fine Leather Strap. return; } if (skill.Info.Rank == SkillRank.R4) { if (data.ItemData.HasTag("/toughband/")) skill.Train(1); // Successfully make a Tough String. else if (data.ItemData.HasTag("/toughyarn/")) skill.Train(2); // Successfully make Tough Thread. return; } if (skill.Info.Rank >= SkillRank.R3 && skill.Info.Rank <= SkillRank.R2) { if (data.ItemData.HasTag("/toughyarn/")) skill.Train(1); // Successfully make Tough Thread. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(2); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(3); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/leather_strap/04/")) skill.Train(4); // Successfully make Finest Leather Strap. return; } if (skill.Info.Rank == SkillRank.R1) { if (data.ItemData.HasTag("/toughyarn/")) skill.Train(1); // Successfully make Tough Thread. else if (data.ItemData.HasTag("/toughband/")) skill.Train(2); // Successfully make a Tough String. else if (data.ItemData.HasTag("/texture/04/")) skill.Train(3); // Successfully make Finest Fabric. else if (data.ItemData.HasTag("/silk/04/")) skill.Train(4); // Successfully make Finest Silk. else if (data.ItemData.HasTag("/leather_strap/04/")) skill.Train(5); // Successfully make Finest Leather Strap. return; } }
/// <summary> /// Checks tools from Prepare, to maybe cancel skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="productData"></param> /// <returns></returns> protected virtual bool CheckTools(Creature creature, Skill skill, ProductionData productData) { // Sanity checks, the client should be handling this. // If null, anything can be equipped if (productData.Tool == null) return true; if (productData.Tool == "/barehand/") { // Fail if bare hand required but an item is equipped if (creature.RightHand != null) { Log.Warning("ProductionSkill.Complete: User '{0}' tried to produce without empty hands.", creature.Client.Account.Id); return false; } } else { // Fail if no item or the wrong one is equipped if (creature.RightHand == null || !creature.RightHand.HasTag(productData.Tool)) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without the appropriate tool.", creature.EntityId); return false; } } // TODO: Check durability? What happens if tool is unusable? return true; }
protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success) { if (skill.Info.Rank == SkillRank.Novice) { if (data.ItemData.HasTag("/potion/hp/")) { skill.Train(1); // Attempt to concoct a HP Potion. if (success) skill.Train(2); // Successful in concocting a HP Potion. } return; } if (!success) return; if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RE) { if (data.ItemData.HasTag("/potion/hp/")) skill.Train(2); // Successful in concocting a HP Potion. else if (data.ItemData.HasTag("/potion/mana/")) skill.Train(4); // Successful in concocting an MP Potion. else if (data.ItemData.HasTag("/potion/stamina/")) skill.Train(6); // Successful in concocting a Stamina Potion. return; } if (skill.Info.Rank >= SkillRank.RD && skill.Info.Rank <= SkillRank.RA) { if (data.Materials.Any(a => a.Tag == "*/bloodyherb/*")) skill.Train(1); // Successful in concocting a potion using a Bloody Herb. if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*")) skill.Train(2); // Successful in concocting a potion using a Sunlight Herb. if (data.Materials.Any(a => a.Tag == "*/manaherb/*")) skill.Train(3); // Successful in concocting a potion using a Mana Herb. if (data.ItemData.HasTag("/potion/mana/hp/")) skill.Train(4); // Successful in concocting a HP & MP Potion. if (data.Materials.Any(a => a.Tag == "*/goldenherb/*")) skill.Train(5); // Successful in concocting a potion using a Golden Herb. if (skill.Info.Rank == SkillRank.RA) { if (data.Materials.Any(a => a.Tag == "*/whiteherb/*")) skill.Train(6); // Successful in concocting a potion using a White Herb. } return; } if (skill.Info.Rank == SkillRank.R9) { if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*")) skill.Train(1); // Successful in concocting a potion using a Sunlight Herb. if (data.Materials.Any(a => a.Tag == "*/manaherb/*")) skill.Train(2); // Successful in concocting a potion using a Mana Herb. if (data.ItemData.HasTag("/potion/mana/hp/")) skill.Train(3); // Successful in concocting a HP & MP Potion. if (data.Materials.Any(a => a.Tag == "*/goldenherb/*")) skill.Train(4); // Successful in concocting a potion using a Golden Herb. if (data.Materials.Any(a => a.Tag == "*/whiteherb/*")) skill.Train(5); // Successful in concocting a potion using a White Herb. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(6); // Successful in concocting a potion using a Mandrake. return; } if (skill.Info.Rank == SkillRank.R8) { if (data.Materials.Any(a => a.Tag == "*/sunlightherb/*")) skill.Train(1); // Successful in concocting a potion using a Sunlight Herb. if (data.Materials.Any(a => a.Tag == "*/manaherb/*")) skill.Train(2); // Successful in concocting a potion using a Mana Herb. if (data.Materials.Any(a => a.Tag == "*/goldenherb/*")) skill.Train(3); // Successful in concocting a potion using a Golden Herb. if (data.ItemData.HasTag("/potion/wound/")) skill.Train(4); // Successful in concocting a Wound Remedy Potion. if (data.Materials.Any(a => a.Tag == "*/whiteherb/*")) skill.Train(5); // Successful in concocting a potion using a White Herb. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(6); // Successful in concocting a potion using a Mandrake. return; } if (skill.Info.Rank == SkillRank.R7) { if (data.Materials.Any(a => a.Tag == "*/manaherb/*")) skill.Train(1); // Successful in concocting a potion using a Mana Herb. if (data.Materials.Any(a => a.Tag == "*/goldenherb/*")) skill.Train(2); // Successful in concocting a potion using a Golden Herb. if (data.ItemData.HasTag("/potion/wound/")) skill.Train(3); // Successful in concocting a Wound Remedy Potion. if (data.Materials.Any(a => a.Tag == "*/whiteherb/*")) skill.Train(4); // Successful in concocting a potion using a White Herb. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(5); // Successful in concocting a potion using a Mandrake. return; } if (skill.Info.Rank == SkillRank.R6) { if (data.Materials.Any(a => a.Tag == "*/goldenherb/*")) skill.Train(1); // Successful in concocting a potion using a Golden Herb. if (data.ItemData.HasTag("/potion/wound/")) skill.Train(2); // Successful in concocting a Wound Remedy Potion. if (data.Materials.Any(a => a.Tag == "*/whiteherb/*")) skill.Train(3); // Successful in concocting a potion using a White Herb. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(4); // Successful in concocting a potion using a Mandrake. return; } if (skill.Info.Rank == SkillRank.R5) { if (data.ItemData.HasTag("/potion/wound/")) skill.Train(1); // Successful in concocting a Wound Remedy Potion. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(2); // Successful in concocting a potion using a Mandrake. if (data.Materials.Any(a => a.Tag == "*/antidoteherb/*")) skill.Train(3); // Successful in concocting a potion using an Antidote Herb. return; } if (skill.Info.Rank >= SkillRank.R3 && skill.Info.Rank <= SkillRank.R1) { if (data.ItemData.HasTag("/potion/wound/")) skill.Train(1); // Successful in concocting a Wound Remedy Potion. if (data.Materials.Any(a => a.Tag == "*/mandrake/*")) skill.Train(2); // Successful in concocting a potion using a Mandrake. if (data.Materials.Any(a => a.Tag == "*/poisonherb/*")) skill.Train(3); // Successful in concocting a potion using a Poison Herb. return; } }
/// <summary> /// Handles skill training. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="data"></param> /// <param name="success"></param> protected abstract void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success);
/// <summary> /// Checks if creature has enough mana to produce product, /// returns false if not. Handles notices. /// </summary> /// <param name="creature"></param> /// <param name="productData"></param> /// <returns></returns> private bool CheckMana(Creature creature, ProductionData productData) { // Sanity check, client checks this as well. if (creature.Mana < productData.Mana) { Send.Notice(creature, Localization.Get("You do not have enough MP to make that many at once.")); return false; } return true; }
/// <summary> /// Checks tools from Prepare, to maybe cancel skill. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="productData"></param> /// <returns></returns> protected virtual bool CheckTools(Creature creature, Skill skill, ProductionData productData) { // Check tool // Sanity check, the client should be handling this. if (productData.Tool != null) { if (creature.RightHand == null || !creature.RightHand.HasTag(productData.Tool)) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without the appropriate tool.", creature.EntityId); return false; } } else { if (creature.RightHand != null) { Log.Warning("ProductionSkill.Complete: Creature '{0:X16}' tried to produce without empty hands.", creature.EntityId); return false; } } // TODO: Check durability? What happens if tool is unusable? return true; }
/// <summary> /// Updates tool's durability and proficiency. /// </summary> /// <param name="creature"></param> /// <param name="productData"></param> protected virtual void UpdateTool(Creature creature, ProductionData productData) { if (productData.Tool == null) return; creature.Inventory.ReduceDurability(creature.RightHand, productData.Durability); creature.Inventory.AddProficiency(creature.RightHand, Proficiency); }
protected override void UpdateTool(Creature creature, ProductionData productData) { Item item; if (productData.Category == ProductionCategory.Weaving) { item = creature.Inventory.GetItemAt(Pocket.Glove, 0, 0); // Skip if no glove found and no tool required. if (item == null && productData.Tool == null) return; // Skip if found glove is not a production tool. if (item != null && !item.HasTag("/cloth_production_tool/|/silk_production_tool/")) return; // Continue to the null check below, in case a tool is // required, but we didn't find a glove. } else if (productData.Category == ProductionCategory.Spinning) { // Skip if no tool is required. if (productData.Tool == null) return; item = creature.RightHand; } else { Log.Error("Weaving.UpdateTool: Unknown product category '{0}'.", productData.Category); return; } if (item == null) { Log.Error("Weaving.UpdateTool: No item to update found. Category: {0}", productData.Category); return; } creature.Inventory.ReduceDurability(item, productData.Durability); creature.Inventory.AddProficiency(item, Proficiency); }
protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success) { if (skill.Info.Rank == SkillRank.RF) { if (success) { if (data.Rank >= SkillRank.RD) skill.Train(1); // Make a rank D or higher item. else skill.Train(2); // Make a rank F or E item. } else { if (data.Rank >= SkillRank.RD) skill.Train(3); // Fail at making a rank D or higher item. else skill.Train(4); // Fail at making a rank F or E item. } return; } if (skill.Info.Rank == SkillRank.RE) { if (success) { if (data.Rank >= SkillRank.RC) skill.Train(1); // Make a rank C or higher item. else skill.Train(2); // Make a rank F, E, or D item. } else { if (data.Rank >= SkillRank.RC) skill.Train(3); // Fail at making a rank C or higher item. else skill.Train(4); // Fail at making a rank F, E, or D item. } return; } if (skill.Info.Rank >= SkillRank.RD && skill.Info.Rank <= SkillRank.R3) { var high = skill.Info.Rank + 2; var mid = high - 1; var low = mid - 2; if (success) { if (data.Rank >= high) skill.Train(1); // Make a rank X or higher item. else if (data.Rank >= low && data.Rank <= mid) skill.Train(2); // Make a rank X, X, or X item. else skill.Train(3); // Make a rank X (or lower) item. } else { if (data.Rank >= high) skill.Train(4); // Fail at making a rank X or higher item. else if (data.Rank >= low && data.Rank <= mid) skill.Train(5); // Fail at making a rank X, X, or X item. else skill.Train(6); // Fail at making a rank X (or lower) item. } return; } if (skill.Info.Rank == SkillRank.R2) { if (success) { if (data.Rank >= SkillRank.R3) skill.Train(1); // Make a rank 3, 2, or 1 item. else skill.Train(2); // Make a rank 4 or lower item. } else { if (data.Rank >= SkillRank.R3) skill.Train(3); // Fail at making a rank 2, or 1 item. else skill.Train(4); // Fail at making a rank 3 or lower item. } return; } if (skill.Info.Rank == SkillRank.R1) { if (success) { if (data.Rank >= SkillRank.R2) skill.Train(1); // Make a rank 3, 2, or 1 item. else skill.Train(2); // Make a rank 4 or lower item. } else { if (data.Rank >= SkillRank.R2) skill.Train(3); // Fail at making a rank 2, or 1 item. else skill.Train(4); // Fail at making a rank 3 or lower item. } return; } }
protected override void SkillTraining(Creature creature, Skill skill, ProductionData data, bool success) { if (skill.Info.Rank == SkillRank.Novice) { skill.Train(1); // Use the skill. if (success) skill.Train(2); // Use the skill successfully. return; } if (skill.Info.Rank >= SkillRank.RF && skill.Info.Rank <= SkillRank.RD) { if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(1); // Successfully refine Iron Ore. else skill.Train(2); // Fail to refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.RB) { if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(1); // Successfully refine Copper Ore. else skill.Train(2); // Fail to refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(3); // Successfully refine Iron Ore. else skill.Train(4); // Fail to refine Iron Ore. } return; } if (skill.Info.Rank >= SkillRank.RA && skill.Info.Rank <= SkillRank.R9) { if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(1); // Successfully refine Silver Ore. else skill.Train(2); // Fail to refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(3); // Successfully refine Copper Ore. else skill.Train(4); // Fail to refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(5); // Successfully refine Iron Ore. else skill.Train(6); // Fail to refine Iron Ore. } return; } if (skill.Info.Rank >= SkillRank.R8 && skill.Info.Rank <= SkillRank.R7) { if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(1); // Successfully refine Gold Ore. else skill.Train(2); // Fail to refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(3); // Successfully refine Silver Ore. else skill.Train(4); // Fail to refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(5); // Successfully refine Copper Ore. else skill.Train(6); // Fail to refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(7); // Successfully refine Iron Ore. else skill.Train(8); // Fail to refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.R6) { if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(1); // Successfully refine Mythril Ore. else skill.Train(2); // Fail to refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(3); // Successfully refine Gold Ore. else skill.Train(4); // Fail to refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(5); // Successfully refine Silver Ore. else skill.Train(6); // Fail to refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(7); // Successfully refine Copper Ore. else skill.Train(8); // Fail to refine Copper Ore. } return; } if (skill.Info.Rank == SkillRank.R5) { if (data.ItemData.HasTag("/plate/iron/")) { if (success) skill.Train(1); // Successfully refine an Iron Plate. } else if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(2); // Successfully refine Mythril Ore. else skill.Train(3); // Fail to refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(4); // Successfully refine Gold Ore. else skill.Train(5); // Fail to refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(6); // Successfully refine Silver Ore. else skill.Train(7); // Fail to refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(8); // Successfully refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(9); // Successfully refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.R4) { if (data.ItemData.HasTag("/plate/copper/")) { if (success) skill.Train(1); // Successfully refine a Copper Plate. } else if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(2); // Successfully refine Mythril Ore. else skill.Train(3); // Fail to refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(4); // Successfully refine Gold Ore. else skill.Train(5); // Fail to refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(6); // Successfully refine Silver Ore. else skill.Train(7); // Fail to refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(8); // Successfully refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(9); // Successfully refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.R3) { if (data.ItemData.HasTag("/plate/silver/")) { if (success) skill.Train(1); // Successfully refine a Silver Plate. } else if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(2); // Successfully refine Mythril Ore. else skill.Train(3); // Fail to refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(4); // Successfully refine Gold Ore. else skill.Train(5); // Fail to refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(6); // Successfully refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(7); // Successfully refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(8); // Successfully refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.R2) { if (data.ItemData.HasTag("/plate/gold/")) { if (success) skill.Train(1); // Successfully refine a Gold Plate. } else if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(2); // Successfully refine Mythril Ore. else skill.Train(3); // Fail to refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(4); // Successfully refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(5); // Successfully refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(6); // Successfully refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(7); // Successfully refine Iron Ore. } return; } if (skill.Info.Rank == SkillRank.R1) { if (data.ItemData.HasTag("/plate/mythril/")) { if (success) skill.Train(1); // Successfully refine a Mythril Plate. } else if (data.ItemData.HasTag("/mythrilingot/")) { if (success) skill.Train(2); // Successfully refine Mythril Ore. } else if (data.ItemData.HasTag("/goldingot/")) { if (success) skill.Train(3); // Successfully refine Gold Ore. } else if (data.ItemData.HasTag("/silveringot/")) { if (success) skill.Train(4); // Successfully refine Silver Ore. } else if (data.ItemData.HasTag("/copperingot/")) { if (success) skill.Train(5); // Successfully refine Copper Ore. } else if (data.ItemData.HasTag("/ironingot/")) { if (success) skill.Train(6); // Successfully refine Iron Ore. } return; } }