public static void DoPveBuy(ShopInfo shopInfo, Units unit, string targetItemID, List <ItemInfo> possessItemsP, int realPrice) { List <ItemInfo> list = new List <ItemInfo>(possessItemsP); List <string> composition = BattleEquipTools_Travers.GetComposition(targetItemID, list); if (composition != null || composition.Count > 0) { for (int i = 0; i < composition.Count; i++) { ItemInfo target; int index; if (BattleEquipTools_Travers.GetItem_last_least(list, composition[i], out target, out index)) { BattleEquipTools_op.RemoveItem(list, target, index); } } } BattleEquipTools_op.AddItem(list, targetItemID); BattleEquipTools_op.ChangeHeroMoney(unit.unique_id, -realPrice); BattleEquipTools_op.SetHeroItems(unit, list); byte[] msgParam = SerializeHelper.Serialize <P2CBuyItem>(new P2CBuyItem { itemoid = 0, retaCode = 0 }); MobaMessage message = MobaMessageManager.GetMessage(PvpCode.C2P_BuyItem, msgParam, 0f, null); MobaMessageManager.DispatchMsg(message); }
public static Dictionary <ColumnType, Dictionary <string, SItemData> > GetShopItems_Recommend(Dictionary <ColumnType, Dictionary <string, SItemData> > sItems, List <string> recommendedItems) { List <string> ids = null; if (recommendedItems != null && recommendedItems.Count > 0) { ids = BattleEquipTools_Travers.GetComposition(recommendedItems[0]); } BattleEquipTools_config.idsToSItems(ref sItems, ids, BattleEquipType.none); return(sItems); }
public static List <string> GetRItems(List <string> recommendList, string newItem, List <ItemInfo> possessItems) { List <string> itemListString = BattleEquipTools_Travers.GetItemListString(possessItems); List <string> list = new List <string>(recommendList); if (list != null && !string.IsNullOrEmpty(newItem)) { List <string> composition = BattleEquipTools_Travers.GetComposition(newItem); while (list != null && list.Count != 0) { if (!(list[0] == newItem) && !composition.Contains(list[0]) && !itemListString.Contains(list[0])) { break; } list.RemoveAt(0); } } return(list); }