/// <summary> /// 获得人物身上的疗伤药 优先寻找能百分百发挥药效的疗伤药 /// </summary> /// <param name="actorId">人物ID</param> /// <param name="typ">1是外伤 2是内伤</param> /// <param name="injuryId">伤口id</param> /// <param name="useActorId">提供疗伤药的人物ID</param> /// <returns>疗伤药的物品id</returns> public static int GetActorHealingMedicine(int actorId, int typ, int injuryId, int useActorId) { Main.Logger.Log(actorId + " 寻找疗伤药 " + typ); ActorMenu _this = ActorMenu.instance; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(useActorId).Keys)); int result = -1; foreach (int itemId in itemSort) { int cureValue = typ == 1 ? (Mathf.Abs(DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 11)))) : (Mathf.Abs(DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 12)))); Main.Logger.Log(itemId + " 物品疗伤效果 " + cureValue); if (cureValue > 0) //判断是否要的疗伤药 { if ((cureValue * 3 >= DateFile.instance.actorInjuryDate[actorId][injuryId])) // 判断是否能百分百发挥疗伤药药效 { Main.Logger.Log("获得能百分百发挥药效的疗伤药"); return(itemId); } else if (result == -1) { Main.Logger.Log("记录疗伤药"); result = itemId; } } } return(result); }
// 获取解毒药物 public static int GetActorPoisonMedicine(int actorId, int useActorId, int typ) { // Main.Logger.Log("获取解毒药物"+ actorId+" "+ useActorId+" "+ typ); ActorMenu _this = ActorMenu.instance; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(useActorId).Keys)); int flag = -1; int result = -1; // Main.Logger.Log("物品数量 " + itemSort.Count); foreach (int itemId in itemSort) { for (int i = 0; i < 6; i++) { // Main.Logger.Log(DateFile.instance.GetItemDate(itemId, 0)); if (typ == -1 || typ == i) { int value = DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 61 + i)); if (value < 0) { int num = DateFile.instance.ParseInt(DateFile.instance.GetActorDate(actorId, 51 + i, addValue: false)); if (!(value < 0 && num > Mathf.Abs(value) * 3))// 判断是否能百分百发挥疗伤药药效 { if (result == -1) { result = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(result, 8))) { result = itemId; } } else if (result == -1) { if (flag == -1) { flag = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(flag, 8))) { flag = itemId; } } } } } } // Main.Logger.Log("获取解毒药 "+ result); if (result == -1) { return(flag); } else { return(result); } }
public static bool Prefix(int key, int typ) { if (!Main.enabled) { return(true); } Key = key; Typ = typ; // Main.Logger.Log((new System.Diagnostics.StackTrace(true)).ToString()); // Main.Logger.Log("UpdateItems 更新物品 key :" + key + " typ = " + typ); ActorMenu _this = ActorMenu.instance; _this.itemTyp = typ; _this.itemActorFace.SetActorFace(key); _this.itemActorAge.text = DateFile.instance.ShowActorAge(key); //int actorFavor = DateFile.instance.GetActorFavor(false, DateFile.instance.MianActorID(), key, getLevel: false, realFavor: true); //Transform transform = _this.itemsHolder[typ].transform; int num = 0; //int childCount = transform.childCount; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(key).Keys)); List <int> result = new List <int>(); // Main.Logger.Log("开始循环"); for (int i = 0; i < itemSort.Count; i++) { int num2 = itemSort[i]; if (num2 != StorySystem.instance.useFoodId && (typ == 0 || typ == DateFile.instance.ParseInt(DateFile.instance.GetItemDate(num2, 4)))) { num++; result.Add(num2); } } if (_this.isEnemy) { _this.actorItemSize.text = DateFile.instance.SetColoer(20003, "- / -"); } else { int maxItemSize = _this.GetMaxItemSize(key); int useItemSize = _this.GetUseItemSize(key); _this.actorItemSize.text = string.Format("{0}{3}{1} / {2}</color>", _this.Color8(useItemSize, maxItemSize), ((float)useItemSize / 100f).ToString("f1"), ((float)maxItemSize / 100f).ToString("f1"), DateFile.instance.massageDate[807][2].Split('|')[0]); } // Main.Logger.Log("设置数据"); items_data = result.ToArray(); m_itemPackage[typ].data = items_data; return(false); }
// 获取内息药物 public static int GetActorMianQiMedicine(int actorId, int useActorId, int actorMianQi) { ActorMenu _this = ActorMenu.instance; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(useActorId).Keys)); int flag = -1; int result = -1; // Main.Logger.Log("物品数量 " + itemSort.Count); foreach (int itemId in itemSort) { int cureValue = Mathf.Abs(DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 39))); // Main.Logger.Log(DateFile.instance.GetItemDate(itemId, 0) +" : "+cureValue); if (cureValue > 0) //判断是否内息药 { if (actorMianQi > cureValue) // 判断是否能百分百发挥疗伤药药效 { // Main.Logger.Log("获得能百分百发挥药效的疗伤药"); if (result == -1) { result = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(result, 8))) { result = itemId; } } else if (result == -1) { if (flag == -1) { flag = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(flag, 8))) { flag = itemId; } } } } // Main.Logger.Log("获取内息药 "+ result); if (result == -1) { return(flag); } else { return(result); } }
public static int GetActorHealthMedicine(int actorId, int useActorId, int lack) { ActorMenu _this = ActorMenu.instance; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(useActorId).Keys)); int flag = -1; int result = -1; // Main.Logger.Log("物品数量 " + itemSort.Count); foreach (int itemId in itemSort) { int cureValue = DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 13)); // Main.Logger.Log(DateFile.instance.GetItemDate(itemId, 0) +" : "+cureValue); if (cureValue > 0) //判断是否要的寿命药 { if (cureValue * 3 >= lack) // 判断是否能百分百发挥疗伤药药效 { if (result == -1) { result = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(result, 8))) { result = itemId; } } else { if (flag == -1) { flag = itemId; } else if (DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 8)) < DateFile.instance.ParseInt(DateFile.instance.GetItemDate(flag, 8))) { flag = itemId; } } } } // Main.Logger.Log("获取寿命药 "+ result); if (result == -1) { return(flag); } else { return(result); } }
public static int GetActorHealthMedicine(int actorId, int useActorId, int lack) { ActorMenu _this = ActorMenu.instance; List <int> itemSort = DateFile.instance.GetItemSort(new List <int>(_this.GetActorItems(useActorId).Keys)); int result = -1; foreach (int itemId in itemSort) { int cureValue = DateFile.instance.ParseInt(DateFile.instance.GetItemDate(itemId, 13)); if (cureValue > 0) //判断是否要的寿命药 { if (cureValue * 3 >= lack) // 判断是否能百分百发挥疗伤药药效 { return(itemId); } else if (result == -1) { result = itemId; } } } return(result); }