public virtual TaskStatus OnUpdate() { AgentActor agent = this.Agent; List <SearchAreaProbabilities.AddProb> addProbList = ListPool <SearchAreaProbabilities.AddProb> .Get(); StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile; if (agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(10)) { addProbList.Add(new SearchAreaProbabilities.AddProb(6, statusProfile.FishingSearchProbBuff)); } if (agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(18)) { addProbList.Add(new SearchAreaProbabilities.AddProb(0, statusProfile.HandSearchProbBuff)); } if (agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(42)) { addProbList.Add(new SearchAreaProbabilities.AddProb(4, statusProfile.PickelSearchProbBuff)); } if (agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(47)) { addProbList.Add(new SearchAreaProbabilities.AddProb(3, statusProfile.ShovelSearchProbBuff)); } if (agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(48)) { addProbList.Add(new SearchAreaProbabilities.AddProb(5, statusProfile.NetSearchProbBuff)); } Dictionary <int, bool> dictionary = DictionaryPool <int, bool> .Get(); dictionary[0] = true; dictionary[3] = agent.AgentData.EquipedShovelItem.ID > -1; dictionary[4] = agent.AgentData.EquipedPickelItem.ID > -1; dictionary[5] = agent.AgentData.EquipedPickelItem.ID > -1; dictionary[6] = agent.AgentData.EquipedFishingItem.ID > -1; agent.SearchAreaID = addProbList.Count <= 0 ? Singleton <Resources> .Instance.CommonDefine.ProbSearchAreaProfile.Lottery(dictionary, (List <SearchAreaProbabilities.AddProb>) null) : Singleton <Resources> .Instance.CommonDefine.ProbSearchAreaProfile.Lottery(dictionary, addProbList); DictionaryPool <int, bool> .Release(dictionary); ListPool <SearchAreaProbabilities.AddProb> .Release(addProbList); return((TaskStatus)2); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, bool isRain) { int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance; Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get(); int hizamakuraID = Singleton <Resources> .Instance.PlayerProfile.HizamakuraPTID; foreach (ActionPoint actionPoint in source) { if (!Object.op_Equality((Object)actionPoint, (Object)null) && !Object.op_Equality((Object)actionPoint.OwnerArea, (Object)null) && (actionPoint.IsNeutralCommand && !actionPoint.IsReserved(agent)) && (!isRain || actionPoint.AreaType == MapArea.AreaType.Indoor)) { MapArea ownerArea = actionPoint.OwnerArea; bool flag; if (!toRelease.TryGetValue(ownerArea.AreaID, out flag)) { toRelease[ownerArea.AreaID] = flag = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID); } if (flag) { EventType eventType = actionPoint.PlayerDateEventType[(int)Singleton <Manager.Map> .Instance.Player.ChaControl.sex]; if (!actionPoint.IDList.IsNullOrEmpty <int>() && ((IEnumerable <int>)actionPoint.IDList).Any <int>((Func <int, bool>)(x => x == hizamakuraID)) || actionPoint.IDList.IsNullOrEmpty <int>() && actionPoint.ID == hizamakuraID) { if (SetHizamkuraPoint._navMeshPath == null) { SetHizamkuraPoint._navMeshPath = new NavMeshPath(); } NavMeshHit navMeshHit; if (agent.NavMeshAgent.CalculatePath(actionPoint.LocatedPosition, SetHizamkuraPoint._navMeshPath) && SetHizamkuraPoint._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask())) { destination.Add(actionPoint); } } } } } DictionaryPool <int, bool> .Release(toRelease); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isFollow, bool isRain) { int chunkId = agent.ChunkID; Dictionary <int, bool> dictionary = DictionaryPool <int, bool> .Get(); int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance; foreach (ActionPoint pt in source) { if (SetDesiredActionOtherChunk.CheckNeutral(agent, pt, dictionary, searchCount, chunkId, eventType, isFollow, isRain, meshSampleDistance)) { destination.Add(pt); } } DictionaryPool <int, bool> .Release(dictionary); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isFollow) { int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get(); foreach (ActionPoint actionPoint1 in source) { if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent))) { List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints; if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>()) { bool flag = false; foreach (ActionPoint actionPoint2 in connectedActionPoints) { if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent))) { flag = true; break; } } if (flag) { continue; } } MapArea ownerArea = actionPoint1.OwnerArea; bool flag1; if (!toRelease.TryGetValue(ownerArea.AreaID, out flag1)) { toRelease[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID); } if (flag1 && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType)) { switch (eventType) { case EventType.Eat: StuffItem carryingItem = agent.AgentData.CarryingItem; AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag2 = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag2 = true; break; } } ActionPointInfo outInfo; if (flag2) { PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo)) { break; } continue; } PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo)) { break; } continue; case EventType.Search: SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint; if (Object.op_Inequality((Object)searchActionPoint, (Object)null)) { int registerId = searchActionPoint.RegisterID; Dictionary <int, Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable; Environment.SearchActionInfo searchActionInfo1; if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1)) { Environment.SearchActionInfo searchActionInfo2 = new Environment.SearchActionInfo(); searchActionLockTable[registerId] = searchActionInfo2; searchActionInfo1 = searchActionInfo2; } if (searchActionInfo1.Count < searchCount) { int tableId = searchActionPoint.TableID; StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId); if (agent.SearchAreaID == 0) { if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } continue; } break; } if (ExistsDesiredActionPoint._navMeshPath == null) { ExistsDesiredActionPoint._navMeshPath = new NavMeshPath(); } if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, ExistsDesiredActionPoint._navMeshPath) && ExistsDesiredActionPoint._navMeshPath.get_status() == null) { destination.Add(actionPoint1); } } } } DictionaryPool <int, bool> .Release(toRelease); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isRain) { int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance; Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get(); foreach (ActionPoint actionPoint1 in source) { if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent))) { List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints; if (connectedActionPoints.IsNullOrEmpty <ActionPoint>()) { bool flag = false; foreach (ActionPoint actionPoint2 in connectedActionPoints) { if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent))) { flag = true; break; } } if (flag) { continue; } } if (!isRain || actionPoint1.AreaType == MapArea.AreaType.Indoor) { MapArea ownerArea = actionPoint1.OwnerArea; bool flag; if (!toRelease.TryGetValue(ownerArea.AreaID, out flag)) { toRelease[ownerArea.AreaID] = flag = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID); } if (flag && actionPoint1.PlayerEventType.Contains(eventType)) { if (eventType == EventType.Search) { SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint; if (Object.op_Inequality((Object)searchActionPoint, (Object)null)) { int registerId = searchActionPoint.RegisterID; Dictionary <int, Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable; Environment.SearchActionInfo searchActionInfo1; if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1)) { Environment.SearchActionInfo searchActionInfo2 = new Environment.SearchActionInfo(); searchActionLockTable[registerId] = searchActionInfo2; searchActionInfo1 = searchActionInfo2; } if (searchActionInfo1.Count < searchCount) { int tableId = searchActionPoint.TableID; StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId); if (agent.SearchAreaID == 0) { if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } } else if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } } else { continue; } } } if (SetDesiredPAction._navMeshPath == null) { SetDesiredPAction._navMeshPath = new NavMeshPath(); } NavMeshHit navMeshHit; if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, SetDesiredPAction._navMeshPath) && SetDesiredPAction._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint1.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask())) { destination.Add(actionPoint1); } } } } } DictionaryPool <int, bool> .Release(toRelease); }