// Token: 0x0600416C RID: 16748 RVA: 0x00133E60 File Offset: 0x00132060
        public int GetDropCountByTaskWorkSeconds(int TaskId, int WorkSeconds)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetDropCountByTaskWorkSecondsInt32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_GetDropCountByTaskWorkSecondsInt32Int32_hotfix.call(new object[]
                {
                    this,
                    TaskId2,
                    WorkSeconds
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int TaskId = TaskId2;
            HeroAssistantsTask heroAssistantsTask = this.m_heroAssistantsDS.HeroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == TaskId);

            if (heroAssistantsTask == null)
            {
                return(-1);
            }
            int num = heroAssistantsTask.RewardWorkSeconds.BinarySearch(WorkSeconds);

            if (num < 0)
            {
                num = ~num - 1;
            }
            if (num < 0)
            {
                return(-1);
            }
            return(heroAssistantsTask.RewardDropCount[num]);
        }
        // Token: 0x0600416B RID: 16747 RVA: 0x00133D6C File Offset: 0x00131F6C
        public int GetDropIdByTaskCompleteRate(int TaskId, int CompleteRate)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetDropIdByTaskCompleteRateInt32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_GetDropIdByTaskCompleteRateInt32Int32_hotfix.call(new object[]
                {
                    this,
                    TaskId2,
                    CompleteRate
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int TaskId = TaskId2;
            HeroAssistantsTask heroAssistantsTask = this.m_heroAssistantsDS.HeroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == TaskId);

            if (heroAssistantsTask == null)
            {
                return(-1);
            }
            int num = heroAssistantsTask.RewardCompleteRate.BinarySearch(CompleteRate);

            if (num < 0)
            {
                num = ~num - 1;
            }
            if (num < 0)
            {
                return(-1);
            }
            return(heroAssistantsTask.RewardDropId[num]);
        }
        // Token: 0x06004169 RID: 16745 RVA: 0x00133B24 File Offset: 0x00131D24
        public virtual int ClaimRewards(int TaskId, int Slot, bool NoCheck = false)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_ClaimRewardsInt32Int32Boolean_hotfix != null)
            {
                return(Convert.ToInt32(this.m_ClaimRewardsInt32Int32Boolean_hotfix.call(new object[]
                {
                    this,
                    TaskId2,
                    Slot2,
                    NoCheck
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int TaskId = TaskId2;
            int Slot   = Slot2;

            if (!NoCheck)
            {
                int num = this.CanClaimRewards(TaskId, Slot);
                if (num != 0)
                {
                    return(num);
                }
            }
            HeroAssistants     heroAssistants     = this.m_heroAssistantsDS.HeroAssistants;
            HeroAssistantsTask heroAssistantsTask = heroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == TaskId);

            if (heroAssistantsTask != null)
            {
                heroAssistants.Assignments.RemoveAll((HeroAssistantsTaskAssignment a) => a.Slot == Slot);
            }
            return(0);
        }
        // Token: 0x06004165 RID: 16741 RVA: 0x001335FC File Offset: 0x001317FC
        public virtual int AssignHero(List <int> HeroIds, int TaskId, int Slot, int WorkSeconds, bool NoCheck = false)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_AssignHeroList ` 1Int32Int32Int32Boolean_hotfix != null)
            {
                return(Convert.ToInt32(this.m_AssignHeroList ` 1Int32Int32Int32Boolean_hotfix.call(new object[]
                {
                    this,
                    HeroIds,
                    TaskId2,
                    Slot,
                    WorkSeconds,
                    NoCheck
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int TaskId = TaskId2;

            if (!NoCheck)
            {
                int num = this.CanAssignHero(HeroIds, TaskId, Slot, WorkSeconds);
                if (num != 0)
                {
                    return(num);
                }
            }
            HeroAssistantsTask           heroAssistantsTask           = this.m_heroAssistantsDS.HeroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == TaskId);
            HeroAssistantsTaskAssignment heroAssistantsTaskAssignment = new HeroAssistantsTaskAssignment
            {
                Task            = heroAssistantsTask,
                TaskId          = heroAssistantsTask.ConfigId,
                AssignedHeroIds = HeroIds,
                Slot            = Slot,
                StartTime       = this.m_basicInfo.GetCurrentTime()
            };
            int num2 = heroAssistantsTask.RewardWorkSeconds.BinarySearch(WorkSeconds);

            if (num2 < 0)
            {
                num2 = ~num2 - 1;
            }
            if (num2 < 0)
            {
                return(-2110);
            }
            this.m_heroAssistantsDS.HeroAssistants.Assignments.Add(heroAssistantsTaskAssignment);
            heroAssistantsTaskAssignment.EndTime = this.m_basicInfo.GetCurrentTime().AddSeconds((double)heroAssistantsTask.RewardWorkSeconds[num2]);
            if (this.AssignHeroToTaskMissionEvent != null)
            {
                this.AssignHeroToTaskMissionEvent();
            }
            return(0);
        }
        // Token: 0x06004164 RID: 16740 RVA: 0x00133470 File Offset: 0x00131670
        public int CanAssignHero(List <int> HeroIds, int TaskId, int Slot, int WorkSeconds)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanAssignHeroList ` 1Int32Int32Int32_hotfix != null)
            {
                return(Convert.ToInt32(this.m_CanAssignHeroList ` 1Int32Int32Int32_hotfix.call(new object[]
                {
                    this,
                    HeroIds,
                    TaskId2,
                    Slot2,
                    WorkSeconds
                })));
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            int TaskId = TaskId2;
            int Slot   = Slot2;

            if (HeroIds == null || HeroIds.Count == 0)
            {
                return(-2111);
            }
            HeroAssistants     heroAssistants     = this.m_heroAssistantsDS.HeroAssistants;
            HeroAssistantsTask heroAssistantsTask = heroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == TaskId);

            if (heroAssistantsTask == null)
            {
                return(-2102);
            }
            if (heroAssistantsTask.Locked)
            {
                return(-2101);
            }
            if (heroAssistants.Assignments.Count >= this.m_configDataLoader.ConfigableConstId_HeroAssistantTaskSlotCount)
            {
                return(-2112);
            }
            HeroAssistantsTaskAssignment heroAssistantsTaskAssignment = heroAssistants.Assignments.Find((HeroAssistantsTaskAssignment a) => a.Slot == Slot);

            if (heroAssistantsTaskAssignment != null && heroAssistantsTaskAssignment.AssignedHeroIds.Count > 0)
            {
                return(-2105);
            }
            if (HeroIds.Count > this.m_configDataLoader.ConfigableConstId_HeroAssistantTaskHeroAssignMaxCount)
            {
                return(-2109);
            }
            return(0);
        }
Пример #6
0
        // Token: 0x06004FA9 RID: 20393 RVA: 0x0017F3CC File Offset: 0x0017D5CC
        public void ReloadConfigData()
        {
            IEnumerable <KeyValuePair <int, ConfigDataHeroAssistantTaskInfo> > allConfigDataHeroAssistantTaskInfo = this.ConfigDataLoader.GetAllConfigDataHeroAssistantTaskInfo();

            using (IEnumerator <KeyValuePair <int, ConfigDataHeroAssistantTaskInfo> > enumerator = allConfigDataHeroAssistantTaskInfo.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, ConfigDataHeroAssistantTaskInfo> kv = enumerator.Current;
                    HeroAssistantsTask heroAssistantsTask = this.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == kv.Key);
                    if (heroAssistantsTask == null)
                    {
                        this.Tasks.Add(new HeroAssistantsTask
                        {
                            ConfigId            = kv.Value.ID,
                            WhichHeroAssistants = this,
                            ConfigDataLoader    = this.ConfigDataLoader
                        });
                    }
                    else
                    {
                        heroAssistantsTask.ConfigDataLoader = this.ConfigDataLoader;
                    }
                }
            }
            List <int> list = new List <int>();
            int        i;

            for (i = this.Tasks.Count - 1; i >= 0; i--)
            {
                if (!allConfigDataHeroAssistantTaskInfo.Any((KeyValuePair <int, ConfigDataHeroAssistantTaskInfo> kv) => kv.Key == this.Tasks[i].ConfigId))
                {
                    list.Add(i);
                }
            }
            foreach (int index in list)
            {
                this.Tasks.RemoveAt(index);
            }
        }
Пример #7
0
 // Token: 0x06004B98 RID: 19352 RVA: 0x001769D4 File Offset: 0x00174BD4
 public void UpdateInstantiatedData(DSHeroAssistantNtf DS)
 {
     using (List <ProHeroAssistantTask> .Enumerator enumerator = DS.Tasks.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ProHeroAssistantTask AT = enumerator.Current;
             HeroAssistantsTask   heroAssistantsTask = this.HeroAssistants.Tasks.Find((HeroAssistantsTask t) => t.ConfigId == AT.ConfigId);
             if (heroAssistantsTask != null)
             {
                 HeroAssistantsTaskAssignment item = new HeroAssistantsTaskAssignment
                 {
                     Task            = heroAssistantsTask,
                     TaskId          = heroAssistantsTask.ConfigId,
                     EndTime         = new DateTime(AT.EndTime),
                     StartTime       = new DateTime(AT.StartTime),
                     Slot            = AT.Slot,
                     AssignedHeroIds = AT.AssignedHeroIds
                 };
                 this.HeroAssistants.Assignments.Add(item);
             }
         }
     }
 }