internal void OnProfileBehaviorChanged(Profile.ProfileBehaviorTypes type) { if (type == Profile.ProfileBehaviorTypes.Unknown) { InteractableCachedObject = null; return; } if (type == Profile.ProfileBehaviorTypes.SetQuestMode) QuestMode = true; else if(type.HasFlag(Profile.ProfileBehaviorTypes.Interactive)) { Logger.DBLog.DebugFormat("Interactable Profile Tag!"); InteractableCachedObject = GetInteractiveCachedObject(type); if (InteractableCachedObject != null) Logger.DBLog.DebugFormat("Found Cached Interactable Server Object"); } }
internal CacheObject GetInteractiveCachedObject(Profile.ProfileBehaviorTypes type) { if (type == Profile.ProfileBehaviorTypes.UseWaypoint) { UseWaypointTag tagWP = (UseWaypointTag)FunkyGame.Profile.CurrentProfileBehavior; var WaypointObjects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == 6442); foreach (CacheObject item in WaypointObjects) { if (item.Position.Distance(tagWP.Position) < 100f) { //Found matching waypoint object! return item; } } } else if (type == Profile.ProfileBehaviorTypes.UseObject) { UseObjectTag tagUseObj = (UseObjectTag)FunkyGame.Profile.CurrentProfileBehavior; if (tagUseObj.ActorId > 0) {//Using SNOID.. var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUseObj.ActorId); foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position))) { //Found matching object! return item; } } else {//use position to match object Vector3 tagPosition = tagUseObj.Position; var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f); foreach (CacheObject item in Objects) { //Found matching object! return item; } } } else if (type == Profile.ProfileBehaviorTypes.UsePortal) { UsePortalTag tagUsePortal = (UsePortalTag)FunkyGame.Profile.CurrentProfileBehavior; if (tagUsePortal.ActorId > 0) {//Using SNOID.. var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUsePortal.ActorId); foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position))) { //Found matching object! return item; } } else {//use position to match object Vector3 tagPosition = tagUsePortal.Position; var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f); foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position))) { //Found matching object! return item; } } } return null; }