Example #1
0
        /// <summary>
        /// 家族贡献任务
        /// </summary>
        /// <param name="pb"></param>
        public static void FamilyTask(PlayerBusiness pb, bool iscall)
        {
            string soleid = pb.ID + "FamilyTask";
            if (!m_dic.TryAdd(soleid, soleid))
                return;
            try
            {
                //不存在家族
                if (!TaskBusinessBase.IsFamily(pb))
                    return;
                int num = pb.TaskTotal(7);
                if (num >= 20)
                    return;
                if (num == 0)
                {
                    List<string> list = TaskAccess.Instance.Remove_1(pb.ID, 7);
                    if (iscall)
                    {
                        foreach (string id in list)
                        {
                            pb.Call(TaskCommand.GiveupR, true, id);
                        }
                    }
                }

                if (TaskAccess.Instance.IsDayTask(pb.ID, 7))
                    return;
                //随机取得一个家族贡献任务
                GameConfig gc = GameConfigAccess.Instance.GetDayTaskOne(pb.Level, 7);
                if (gc != null)
                {
                    Task t = TaskAccess.Instance.TaskBase(pb.ID, pb.RoleID, gc, 0, 0);
                    if (t != null)
                    {
                        if (iscall)
                        {
                            pb.Call(TaskCommand.TaskActivationR, TaskAccess.Instance.GetTaskInfo(t));
                        }
                    }
                }
            }
            finally
            {
                m_dic.TryRemove(soleid, out soleid);
            }
        }