示例#1
0
        private static int GetDropCondiction(eDropType type, string para1, string para2)
        {
            int result;

            try
            {
                int dropId = DropMgr.FindCondiction(type, para1, para2);
                result = dropId;
                return(result);
            }
            catch (Exception ex)
            {
                //if (DropInventory.log.IsErrorEnabled)
                {
                    DropInventory.log.Error(string.Concat(new object[]
                    {
                        "Drop Error:",
                        type,
                        " @ ",
                        ex
                    }));
                }
            }
            result = 0;
            return(result);
        }
示例#2
0
 /// <summary>
 /// 查询条件后的物品
 /// </summary>
 /// <param name="type"></param>
 /// <param name="para1"></param>
 /// <param name="para2"></param>
 /// <returns></returns>
 public static int FindCondiction(eDropType type, string para1, string para2)
 {
     int itemId = 0;
     string temppara1 = "," + para1 + ",";
     string temppara2 = "," + para2 + ",";
     foreach (DropCondiction drop in m_dropcondiction)
     {
         if ((drop.CondictionType == (int)type) && (drop.Para1.IndexOf(temppara1) !=-1) && (drop.Para2.IndexOf(temppara2) != -1))
             return drop.DropId;
     }
     return 0;
 }
示例#3
0
        public static int FindCondiction(eDropType type, string para1, string para2)
        {
            string str1 = "," + para1 + ",";
            string str2 = "," + para2 + ",";

            foreach (DropCondiction dropCondiction in DropMgr.m_dropcondiction)
            {
                if ((eDropType)dropCondiction.CondictionType == type && dropCondiction.Para1.IndexOf(str1) != -1 && dropCondiction.Para2.IndexOf(str2) != -1)
                {
                    return(dropCondiction.DropId);
                }
            }
            return(0);
        }
示例#4
0
        public static int FindCondiction(eDropType type, string para1, string para2)
        {
            string value  = "," + para1 + ",";
            string value2 = "," + para2 + ",";

            foreach (DropCondiction current in DropMgr.m_dropcondiction)
            {
                if (current.CondictionType == (int)type && current.Para1.IndexOf(value) != -1 && current.Para2.IndexOf(value2) != -1)
                {
                    return(current.DropId);
                }
            }
            return(0);
        }
示例#5
0
        /// <summary>
        /// 查询条件后的物品
        /// </summary>
        /// <param name="type"></param>
        /// <param name="para1"></param>
        /// <param name="para2"></param>
        /// <returns></returns>
        public static int FindCondiction(eDropType type, string para1, string para2)
        {
            int    itemId    = 0;
            string temppara1 = "," + para1 + ",";
            string temppara2 = "," + para2 + ",";

            foreach (DropCondiction drop in m_dropcondiction)
            {
                if ((drop.CondictionType == (int)type) && (drop.Para1.IndexOf(temppara1) != -1) && (drop.Para2.IndexOf(temppara2) != -1))
                {
                    return(drop.DropId);
                }
            }
            return(0);
        }
示例#6
0
 /// <summary>
 /// 检测是否满足掉落条件
 /// </summary>
 /// <param name="type">掉落类型</param>
 /// <param name="para1">掉落参数一</param>
 /// <param name="para2">掉落参数二</param>
 /// <returns>返回物品id</returns>
 private static int GetDropCondiction(eDropType type, string para1, string para2)
 {
     try
     {
         int dropId = Bussiness.Managers.DropMgr.FindCondiction(type, para1, para2);
         return(dropId);
     }
     catch (Exception ex)
     {
         if (log.IsErrorEnabled)
         {
             log.Error("Drop Error:" + type + " @ " + ex);
         }
     }
     return(0);
 }
示例#7
0
        public static bool BoxDrop(eRoomType e, ref List <ItemInfo> info)
        {
            eDropType arg_0F_0       = eDropType.Box;
            int       num            = (int)e;
            int       dropCondiction = DropInventory.GetDropCondiction(arg_0F_0, num.ToString(), "0");

            if (dropCondiction > 0)
            {
                List <ItemInfo> list = null;
                if (DropInventory.GetDropItems(eDropType.Box, dropCondiction, ref list))
                {
                    info = ((list != null) ? list : null);
                    return(true);
                }
            }
            return(false);
        }
示例#8
0
        public static bool PvPQuestsDrop(eRoomType e, bool playResult, ref List <ItemInfo> info)
        {
            eDropType arg_18_0       = eDropType.PvpQuests;
            int       num            = (int)e;
            int       dropCondiction = DropInventory.GetDropCondiction(arg_18_0, num.ToString(), Convert.ToInt16(playResult).ToString());

            if (dropCondiction > 0)
            {
                List <ItemInfo> list = null;
                if (DropInventory.GetDropItems(eDropType.PvpQuests, dropCondiction, ref list))
                {
                    info = ((list != null) ? list : null);
                    return(true);
                }
            }
            return(false);
        }
示例#9
0
        public static int FindCondiction(eDropType type, string para1, string para2)
        {
            string temppara  = "," + para1 + ",";
            string temppara2 = "," + para2 + ",";
            int    result;

            foreach (DropCondiction drop in DropMgr.m_dropcondiction)
            {
                if (drop.CondictionType == (int)type && drop.Para1.IndexOf(temppara) != -1 && drop.Para2.IndexOf(temppara2) != -1)
                {
                    result = drop.DropId;
                    return(result);
                }
            }
            result = 0;
            return(result);
        }
示例#10
0
        public static bool BoxDrop(eRoomType e, ref List <ItemInfo> info)
        {
            eDropType arg_10_0 = eDropType.Box;
            int       num      = (int)e;
            int       dropId   = DropInventory.GetDropCondiction(arg_10_0, num.ToString(), "0");
            bool      result;

            if (dropId > 0)
            {
                List <ItemInfo> infos = null;
                if (DropInventory.GetDropItems(eDropType.Box, dropId, ref infos))
                {
                    info   = ((infos != null) ? infos : null);
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
示例#11
0
 private static int GetDropCondiction(eDropType type, string para1, string para2)
 {
     try
     {
         return(DropMgr.FindCondiction(type, para1, para2));
     }
     catch (Exception ex)
     {
         if (DropInventory.log.IsErrorEnabled)
         {
             DropInventory.log.Error(string.Concat(new object[]
             {
                 "Drop Error:",
                 type,
                 " @ ",
                 ex
             }));
         }
     }
     return(0);
 }
示例#12
0
        /// <summary>
        /// 获取掉落多个物品
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private static bool GetDropItems(eDropType type, int dropId, ref List<ItemInfo> itemInfos)
        {
            #region 定义变量
            if (dropId == 0)
                return false;
            #endregion

            try
            {
                #region 生成随机物品
                int dropItemCount = 1;
                List<DropItem> unFiltItems = Bussiness.Managers.DropMgr.FindDropItem(dropId);
                int maxRound = Bussiness.ThreadSafeRandom.NextStatic(unFiltItems.Select(s => s.Random).Max());
                List<DropItem> filtItems = unFiltItems.Where(s => s.Random >= maxRound).ToList();
                int maxItems = filtItems.Count();
                if (maxItems == 0)
                {
                    return false;
                }
                else
                {
                    dropItemCount = dropItemCount > maxItems ? maxItems : dropItemCount;
                }
                int[] randomArray = GetRandomUnrepeatArray(0, maxItems - 1, dropItemCount);
                #endregion

                #region 设置随机物品属性
                foreach (int i in randomArray)
                {
                    int itemCount = Bussiness.ThreadSafeRandom.NextStatic(filtItems[i].BeginData, filtItems[i].EndData);
                    ItemTemplateInfo temp = Bussiness.Managers.ItemMgr.FindItemTemplate(filtItems[i].ItemId);
                    ItemInfo item = ItemInfo.CreateFromTemplate(temp, itemCount, 101);
                    if (item == null)
                        continue;
                    item.IsBinds = filtItems[i].IsBind;
                    item.ValidDate = filtItems[i].ValueDate;
                    if (itemInfos == null)
                        itemInfos = new List<ItemInfo>();
                    if (DropInfoMgr.CanDrop(temp.TemplateID))//宏观掉落
                    {
                        itemInfos.Add(item);
                    }
                }
                return true;
                #endregion
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled)
                    log.Error("Drop Error:" + type + " @ " + ex);
            }
            return false;
        }
示例#13
0
 /// <summary>
 /// 检测是否满足掉落条件
 /// </summary>
 /// <param name="type">掉落类型</param>
 /// <param name="para1">掉落参数一</param>
 /// <param name="para2">掉落参数二</param>
 /// <returns>返回物品id</returns>
 private static int GetDropCondiction(eDropType type, string para1, string para2)
 {
     try
     {
         int dropId = Bussiness.Managers.DropMgr.FindCondiction(type, para1, para2);
         return dropId;
     }
     catch (Exception ex)
     {
         if (log.IsErrorEnabled)
             log.Error("Drop Error:" + type + " @ " + ex);
     }
     return 0;
 }
示例#14
0
 private static bool GetDropItems(eDropType type, int dropId, ref List <ItemInfo> itemInfos)
 {
     if (dropId == 0)
     {
         return(false);
     }
     try
     {
         int             num      = 1;
         List <DropItem> source   = DropMgr.FindDropItem(dropId);
         int             maxRound = ThreadSafeRandom.NextStatic((
                                                                    from s in source
                                                                    select s.Random).Max());
         List <DropItem> list = (
             from s in source
             where s.Random >= maxRound
             select s).ToList <DropItem>();
         int  num2 = list.Count <DropItem>();
         bool result;
         if (num2 == 0)
         {
             result = false;
             return(result);
         }
         num = ((num > num2) ? num2 : num);
         int[] randomUnrepeatArray = DropInventory.GetRandomUnrepeatArray(0, num2 - 1, num);
         int[] array = randomUnrepeatArray;
         for (int i = 0; i < array.Length; i++)
         {
             int index = array[i];
             int count = ThreadSafeRandom.NextStatic(list[index].BeginData, list[index].EndData);
             ItemTemplateInfo itemTemplateInfo = ItemMgr.FindItemTemplate(list[index].ItemId);
             ItemInfo         itemInfo         = ItemInfo.CreateFromTemplate(itemTemplateInfo, count, 101);
             if (itemInfo != null)
             {
                 itemInfo.IsBinds   = list[index].IsBind;
                 itemInfo.ValidDate = list[index].ValueDate;
                 if (itemInfos == null)
                 {
                     itemInfos = new List <ItemInfo>();
                 }
                 if (DropInfoMgr.CanDrop(itemTemplateInfo.TemplateID))
                 {
                     itemInfos.Add(itemInfo);
                 }
             }
         }
         result = true;
         return(result);
     }
     catch (Exception ex)
     {
         if (DropInventory.log.IsErrorEnabled)
         {
             DropInventory.log.Error(string.Concat(new object[]
             {
                 "Drop Error:",
                 type,
                 " @ ",
                 ex
             }));
         }
     }
     return(false);
 }
示例#15
0
        private static bool GetDropItems(eDropType type, int dropId, ref List <ItemInfo> itemInfos)
        {
            bool result;

            if (dropId == 0)
            {
                result = false;
            }
            else
            {
                try
                {
                    int             dropItemCount = 1;
                    List <DropItem> unFiltItems   = DropMgr.FindDropItem(dropId);
                    int             maxRound      = DropInventory.random.Next((
                                                                                  from s in unFiltItems
                                                                                  select s.Random).Max());
                    List <DropItem> filtItems = (
                        from s in unFiltItems
                        where s.Random >= maxRound
                        select s).ToList <DropItem>();
                    int maxItems = filtItems.Count <DropItem>();
                    if (maxItems == 0)
                    {
                        result = false;
                        return(result);
                    }
                    dropItemCount = ((dropItemCount > maxItems) ? maxItems : dropItemCount);
                    int[] randomArray = DropInventory.GetRandomUnrepeatArray(0, maxItems - 1, dropItemCount);
                    int[] array       = randomArray;
                    for (int j = 0; j < array.Length; j++)
                    {
                        int i                 = array[j];
                        int itemCount         = DropInventory.random.Next(filtItems[i].BeginData, filtItems[i].EndData);
                        ItemTemplateInfo temp = ItemMgr.FindItemTemplate(filtItems[i].ItemId);
                        ItemInfo         item = ItemInfo.CreateFromTemplate(temp, itemCount, 101);
                        if (item != null)
                        {
                            item.IsBinds   = filtItems[i].IsBind;
                            item.ValidDate = filtItems[i].ValueDate;
                            item.IsTips    = filtItems[i].IsTips;
                            item.IsLogs    = filtItems[i].IsLogs;
                            if (itemInfos == null)
                            {
                                itemInfos = new List <ItemInfo>();
                            }
                            switch (type)
                            {
                            case eDropType.Cards:
                            case eDropType.Box:
                            case eDropType.NPC:
                            case eDropType.Boss:
                            case eDropType.Special:
                                if (DropInfoMgr.CanDrop(temp.TemplateID))
                                {
                                    itemInfos.Add(item);
                                }
                                break;

                            default:
                                itemInfos.Add(item);
                                break;
                            }
                        }
                    }
                    if (itemInfos != null && itemInfos.Count > 0)
                    {
                        result = true;
                        return(result);
                    }
                }
                catch (Exception ex)
                {
                    //if (DropInventory.log.IsErrorEnabled)
                    {
                        DropInventory.log.Error(string.Concat(new object[]
                        {
                            "Drop Error:",
                            type,
                            " @ ",
                            ex
                        }));
                    }
                }
                result = false;
            }
            return(result);
        }
示例#16
0
        /// <summary>
        /// 获取掉落多个物品
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private static bool GetDropItems(eDropType type, int dropId, ref List <ItemInfo> itemInfos)
        {
            #region 定义变量
            if (dropId == 0)
            {
                return(false);
            }
            #endregion

            try
            {
                #region 生成随机物品
                int             dropItemCount = 1;
                List <DropItem> unFiltItems   = Bussiness.Managers.DropMgr.FindDropItem(dropId);
                int             maxRound      = Bussiness.ThreadSafeRandom.NextStatic(unFiltItems.Select(s => s.Random).Max());
                List <DropItem> filtItems     = unFiltItems.Where(s => s.Random >= maxRound).ToList();
                int             maxItems      = filtItems.Count();
                if (maxItems == 0)
                {
                    return(false);
                }
                else
                {
                    dropItemCount = dropItemCount > maxItems ? maxItems : dropItemCount;
                }
                int[] randomArray = GetRandomUnrepeatArray(0, maxItems - 1, dropItemCount);
                #endregion

                #region 设置随机物品属性
                foreach (int i in randomArray)
                {
                    int itemCount         = Bussiness.ThreadSafeRandom.NextStatic(filtItems[i].BeginData, filtItems[i].EndData);
                    ItemTemplateInfo temp = Bussiness.Managers.ItemMgr.FindItemTemplate(filtItems[i].ItemId);
                    ItemInfo         item = ItemInfo.CreateFromTemplate(temp, itemCount, 101);
                    if (item == null)
                    {
                        continue;
                    }
                    item.IsBinds   = filtItems[i].IsBind;
                    item.ValidDate = filtItems[i].ValueDate;
                    if (itemInfos == null)
                    {
                        itemInfos = new List <ItemInfo>();
                    }
                    if (DropInfoMgr.CanDrop(temp.TemplateID))//宏观掉落
                    {
                        itemInfos.Add(item);
                    }
                }
                return(true);

                #endregion
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Drop Error:" + type + " @ " + ex);
                }
            }
            return(false);
        }