/// <summary> /// Kill all loaded objects /// </summary> public void KillAllLoadedObjects() { landscapeObjects.Clear(); nearTrackObjects.Clear(); startLightObject = null; }
/// <summary> /// Add object to render /// </summary> /// <param name="modelName">Model name</param> /// <param name="renderMatrix">Render matrix</param> /// <param name="isNearTrack">Is near track</param> public void AddObjectToRender(string modelName, Matrix renderMatrix, bool isNearTrackForShadowGeneration) { // Fix wrong model names if (modelName == "OilWell") { modelName = "OilPump"; } else if (modelName == "PalmSmall") { modelName = "AlphaPalmSmall"; } else if (modelName == "AlphaPalm4") { modelName = "AlphaPalmSmall"; } else if (modelName == "Palm") { modelName = "AlphaPalm"; } else if (modelName == "Casino") { modelName = "Casino01"; } else if (modelName == "Combi") { modelName = "CombiPalms"; } // Always include windmills and buildings for shadow generation if (modelName.ToLower() == "windmill" || modelName.ToLower().Contains("hotel") || modelName.ToLower().Contains("building") || modelName.ToLower().Contains("casino01")) { isNearTrackForShadowGeneration = true; } // Search for combos for (int num = 0; num < combos.Length; num++) { TrackCombiModels combi = combos[num]; //slower: if (StringHelper.Compare(combi.Name, modelName)) if (combi.Name == modelName) { // Add all combi objects (calls this method for each model) combi.AddAllModels(this, renderMatrix); // Thats it. return; } } Model foundModel = null; // Search model by name! for (int num = 0; num < landscapeModels.Length; num++) { Model model = landscapeModels[num]; //slower: if (StringHelper.Compare(model.Name, modelName)) if (model.Name == modelName) { foundModel = model; break; } } // Only add if we found the model if (foundModel != null) { // Fix z position to be always ABOVE the landscape Vector3 modelPos = renderMatrix.Translation; // Get landscape height here float landscapeHeight = GetMapHeight(modelPos.X, modelPos.Y); // And make sure we are always above it! if (modelPos.Z < landscapeHeight) { modelPos.Z = landscapeHeight; // Fix render matrix renderMatrix.Translation = modelPos; } // Check if another object is nearby, then skip this one! // Don't skip signs or banners! if (modelName.StartsWith("Banner") == false && modelName.StartsWith("Sign") == false && modelName.StartsWith("StartLight") == false) { for (int num = 0; num < landscapeObjects.Count; num++) { if (Vector3.DistanceSquared( landscapeObjects[num].Position, modelPos) < foundModel.Size * foundModel.Size / 4) { // Don't add return; } } } LandscapeObject newObject = new LandscapeObject(foundModel, // Scale all objects up a little (else world is not filled enough) Matrix.CreateScale(1.2f) * renderMatrix); // Add landscapeObjects.Add(newObject); // Add again to the nearTrackObjects list if near the track if (isNearTrackForShadowGeneration) { nearTrackObjects.Add(newObject); } if (modelName.StartsWith("StartLight")) { startLightObject = newObject; } } #if DEBUG else if (modelName.Contains("Track") == false) { // Add warning in log file Log.Write("Landscape model " + modelName + " is not supported and " + "can't be added for rendering!"); } #endif }
private void CheckCorpse(LandscapeObject IOCorpse) { try { if(IOCorpse.Name.Contains(AetherCharacter.CharStats.Name) && mGeneralSettings.GearVisectionSettings.bDeadMes) { IOCorpse.IOR = IOResult.corpseofself; if(!mGeneralSettings.GearVisectionSettings.DeadMeList.Any(x => x.GUID == IOCorpse.Id)) { MyCorpses DeadMe = new MyCorpses(); DeadMe.Name = IOCorpse.Name; DeadMe.IconID = IOCorpse.Icon; DeadMe.GUID = IOCorpse.Id; mGeneralSettings.GearVisectionSettings.DeadMeList.Add(DeadMe); } if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mGeneralSettings.SoundSettings.DeadMe); return; } if(mGeneralSettings.GearVisectionSettings.Permitteds && PermittedCorpsesList.Contains(IOCorpse.Name)) { IOCorpse.IOR = IOResult.corpsepermitted; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mGeneralSettings.SoundSettings.DeadPermitted); return; } if(IOCorpse.Burden > 6000) { if(!IOCorpse.HasIdData) {Core.Actions.RequestId(IOCorpse.Id); return;} else if(string.IsNullOrEmpty(IOCorpse.FullDescription)){return;} else { if(IOCorpse.FullDescription.Contains(AetherCharacter.CharStats.Name)) { if (IOCorpse.FullDescription.Contains("generated a rare item")) { IOCorpse.IOR = IOResult.corpsewithrare; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mGeneralSettings.SoundSettings.CorpseRare); return; } else if(mGeneralSettings.GearVisectionSettings.bKillsBySelf) { IOCorpse.IOR = IOResult.corpseselfkill; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mGeneralSettings.SoundSettings.CorpseSelfKill); return; } else{return;} } else if(mGeneralSettings.GearVisectionSettings.bKillsByFellows) { string KillerName = IOCorpse.FullDescription.Substring(10).Replace(".","").Trim(); int PetIndex = IOCorpse.FullDescription.LastIndexOf(@"'"); var Fellow = AetherFellow.Fellowship.GetByFellowName(@KillerName); if(Fellow == null && PetIndex > -1) { string PetKillerName = IOCorpse.FullDescription.Substring(10, (PetIndex - 10)).Trim(); Fellow = AetherFellow.Fellowship.GetByFellowName(PetKillerName); } if(Fellow != null && Fellow.ShareLoot) { IOCorpse.IOR = IOResult.corpsefellowkill; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mGeneralSettings.SoundSettings.CorpseFellowKill); return; } } } } if(mGeneralSettings.GearVisectionSettings.bAllCorpses) { if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.IOR = IOResult.allcorpses; IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); return; } } } catch (Exception ex){LogError(ex);} }
private void CheckCorpse(LandscapeObject IOCorpse) { try { if(!IOCorpse.isvalid){return;} if(IOCorpse.Name.Contains(Core.CharacterFilter.Name) && ghSettings.bDeadMes) { IOCorpse.IOR = IOResult.corpseofself; if(!ghSettings.DeadMeList.Any(x => x.GUID == IOCorpse.Id)) { MyCorpses DeadMe = new MyCorpses(); DeadMe.Name = IOCorpse.Name; DeadMe.IconID = IOCorpse.Icon; // DeadMe.Coordinates = IOCorpse.Coordinates.ToString(); DeadMe.GUID = IOCorpse.Id; ghSettings.DeadMeList.Add(DeadMe); } if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mSoundsSettings.DeadMe); return; } //Flags corpes for recovery by that player as permitted if(ghSettings.Permitteds && PermittedCorpsesList.Contains(IOCorpse.Name)) { IOCorpse.IOR = IOResult.corpsepermitted; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mSoundsSettings.DeadPermitted); return; } //Corpses with loot on them. //Enables tracking of kills made by the character if(IOCorpse.LValue(LongValueKey.Burden) > 6000 && ghSettings.bKillsBySelf) { if(!IOCorpse.HasIdData) {IdqueueAdd(IOCorpse.Id); return;} else if(string.IsNullOrEmpty(IOCorpse.SValue(StringValueKey.FullDescription))){return;} else { if (IOCorpse.SValue(StringValueKey.FullDescription).Contains(Core.CharacterFilter.Name)) { if (IOCorpse.SValue(StringValueKey.FullDescription).Contains("generated a rare item")) { IOCorpse.IOR = IOResult.corpsewithrare; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mSoundsSettings.CorpseRare); return; } else { IOCorpse.IOR = IOResult.corpseselfkill; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mSoundsSettings.CorpseSelfKill); return; } } else if(FellowMemberList.Count > 0 && ghSettings.bKillsByFellows) { if(FellowMemberList.Any(x => x.Looting && IOCorpse.SValue(StringValueKey.FullDescription).Contains(x.Name))) { IOCorpse.IOR = IOResult.corpsefellowkill; if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); } playSoundFromResource(mSoundsSettings.CorpseFellowKill); return; } } } } if(ghSettings.bAllCorpses) { if(!CorpseTrackingList.Any(x => x.Id == IOCorpse.Id)) { IOCorpse.IOR = IOResult.allcorpses; IOCorpse.notify = true; CorpseTrackingList.Add(IOCorpse); UpdateCorpseHud(); return; } } } catch (Exception ex){LogError(ex);} }
/// <summary> /// Add object to render /// </summary> /// <param name="modelName">Model name</param> /// <param name="renderMatrix">Render matrix</param> /// <param name="isNearTrack">Is near track</param> public void AddObjectToRender(string modelName, Matrix renderMatrix, bool isNearTrackForShadowGeneration) { // Fix wrong model names if (modelName == "OilWell") modelName = "OilPump"; else if (modelName == "PalmSmall") modelName = "AlphaPalmSmall"; else if (modelName == "AlphaPalm4") modelName = "AlphaPalmSmall"; else if (modelName == "Palm") modelName = "AlphaPalm"; else if (modelName == "Casino") modelName = "Casino01"; else if (modelName == "Combi") modelName = "CombiPalms"; // Always include windmills and buildings for shadow generation if (modelName == "Windmill" || StringHelper.Contains(modelName, new string[] { "Hotel", "Building", "Casino01" })) isNearTrackForShadowGeneration = true; // Search for combos for (int num = 0; num < combos.Length; num++) { TrackCombiModels combi = combos[num]; //slower: if (StringHelper.Compare(combi.Name, modelName)) if (combi.Name == modelName) { // Add all combi objects (calls this method for each model) combi.AddAllModels(this, renderMatrix); // Thats it. return; } // if (combi.Name) } // for (num) Model foundModel = null; // Search model by name! for (int num = 0; num < landscapeModels.Length; num++) { Model model = landscapeModels[num]; //slower: if (StringHelper.Compare(model.Name, modelName)) if (model.Name == modelName) { foundModel = model; break; } // if (model.Name) } // for (num) // Only add if we found the model if (foundModel != null) { // Fix z position to be always ABOVE the landscape Vector3 modelPos = renderMatrix.Translation; // Get landscape height here float landscapeHeight = GetMapHeight(modelPos.X, modelPos.Y); // And make sure we are always above it! if (modelPos.Z < landscapeHeight) { modelPos.Z = landscapeHeight; // Fix render matrix renderMatrix.Translation = modelPos; } // if (modelPos.Z) // Check if another object is nearby, then skip this one! // Don't skip signs or banners! if (modelName.StartsWith("Banner") == false && modelName.StartsWith("Sign") == false && modelName.StartsWith("StartLight") == false) { for (int num = 0; num < landscapeObjects.Count; num++) if (Vector3.DistanceSquared( landscapeObjects[num].Position, modelPos) < foundModel.Size*foundModel.Size / 4) { // Don't add return; } // for if (Vector3.DistanceSquared) } // if (modelName.StartsWith) LandscapeObject newObject = new LandscapeObject(foundModel, // Scale all objects up a little (else world is not filled enough) Matrix.CreateScale(1.2f) * renderMatrix); // Add landscapeObjects.Add(newObject); // Add again to the nearTrackObjects list if near the track if (isNearTrackForShadowGeneration) nearTrackObjects.Add(newObject); if (modelName.StartsWith("StartLight")) startLightObject = newObject; } // if (foundModel) #if DEBUG else if (StringHelper.Contains(modelName, "Track") == false) // Add warning in log file Log.Write("Landscape model "+modelName+" is not supported and "+ "can't be added for rendering!"); #endif }
private void SubscribeLandscapeEvents() { try { GearSenseReadWriteSettings(true); LandscapeTimer.Interval = 5000; LandscapeTimer.Start(); LandscapeTimer.Tick += LandscapeTimerTick; Core.WorldFilter.CreateObject += OnWorldFilterCreateLandscape; Core.WorldFilter.ReleaseObject += OnWorldFilterDeleteLandscape; Core.ItemDestroyed += OnLandscapeDestroyed; Core.CharacterFilter.Logoff += LandscapeLogoff; Core.CharacterFilter.ChangePortalMode += GearSense_PortalChange; foreach(WorldObject wo in Core.WorldFilter.GetLandscape()) { if(wo.ObjectClass != ObjectClass.Unknown) { int index = LandscapeTrackingList.FindIndex(x => x.Id == wo.Id); if(index < 0) { LandscapeObject lo = new LandscapeObject(wo); LandscapeTrackingList.Add(lo); CheckLandscape(wo.Id); } } } } catch(Exception ex) {LogError(ex);} }
private void TrophyListCheckLandscape(ref LandscapeObject IOLandscape) { try { string namecheck = IOLandscape.Name; List<XElement> matches; var exacttrophies = from XTrophies in mSortedTrophiesList where XTrophies.Element("checked").Value == "true" && XTrophies.Element("isexact").Value == "true" select XTrophies; matches = (from exTrophies in exacttrophies where (string)@exTrophies.Element("key").Value == @namecheck select exTrophies).ToList(); if(matches.Count() == 0) { var notexacttrophies = from XTrophies in mSortedTrophiesList where XTrophies.Element("checked").Value == "true" && XTrophies.Element("isexact").Value == "false" select XTrophies; matches = (from nxTrophies in notexacttrophies where @namecheck.ToLower().Contains((string)@nxTrophies.Element("key").Value.ToLower()) select nxTrophies).ToList(); } if(matches.Count() > 0) { if(IOLandscape.ObjectClass == ObjectClass.Npc) { IOLandscape.IOR = IOResult.npc; } else { IOLandscape.IOR = IOResult.trophy; } } else { IOLandscape.IOR = IOResult.nomatch; } } catch (Exception ex) {LogError(ex);} return; }
private void MonsterListCheckLandscape(ref LandscapeObject IOLandscape) { try { string namecheck = IOLandscape.Name; List<XElement> matches; var exactmobs = from XMobs in mSortedMobsList where XMobs.Element("checked").Value == "true" && XMobs.Element("isexact").Value == "true" select XMobs; matches = (from exMobs in exactmobs where (string)@exMobs.Element("key").Value == @namecheck select exMobs).ToList(); if(matches.Count() == 0) { var notexactmobs = from XMobs in mSortedMobsList where XMobs.Element("checked").Value == "true" && XMobs.Element("isexact").Value == "false" select XMobs; matches = (from nxMobs in notexactmobs where @namecheck.ToLower().Contains((string)@nxMobs.Element("key").Value.ToLower()) select nxMobs).ToList(); } if(matches.Count() > 0) { IOLandscape.IOR = IOResult.monster; } else { IOLandscape.IOR = IOResult.nomatch; } } catch (Exception ex) {LogError(ex);} }
private void OnWorldFilterCreateLandscape(object sender, Decal.Adapter.Wrappers.CreateObjectEventArgs e) { try { if(e.New.ObjectClass == ObjectClass.Unknown || e.New.Container != 0) {return;} int index = LandscapeTrackingList.FindIndex(x => x.Id == e.New.Id); if(index < 0) { LandscapeObject lo = new LandscapeObject(e.New); LandscapeTrackingList.Add(lo); CheckLandscape(e.New.Id); } } catch (Exception ex){LogError(ex);} return; }
private void GearSense_PortalChange(object sender, EventArgs e) { try { LandscapeTrackingList.Clear(); foreach(WorldObject wo in Core.WorldFilter.GetLandscape()) { if(wo.ObjectClass != ObjectClass.Unknown) { int index = LandscapeTrackingList.FindIndex(x => x.Id == wo.Id); if(index < 0) { LandscapeObject lo = new LandscapeObject(wo); LandscapeTrackingList.Add(lo); CheckLandscape(wo.Id); } } } }catch(Exception ex){LogError(ex);} }
private void TrophyHashCheckLandscape(ref LandscapeObject IOItem) { try { string IsTrophyName = String.Empty; if(mTrophyHash.Contains(@IOItem.Name)){IsTrophyName = @IOItem.Name;} else { foreach(string name in mTrophyStartsWithHash) { if(@IOItem.Name.StartsWith(@name)){IsTrophyName = @name; break;} } } if(IsTrophyName == String.Empty){return;} int LootMax = mTrophyLootMaxDictionary[IsTrophyName]; if(LootMax == 0) { IOItem.IOR = IOResult.trophy; return; } else if(LootMax > 0) { if(AetherObjects.InventoryCountByName(@IOItem.Name) < LootMax) { IOItem.IOR = IOResult.trophy; } else{IOItem.IOR = IOResult.nomatch;} return; } else if(LootMax == -1) { string Name = @IOItem.Name; if(LOHash.Any(x => @x.Name == @Name && AetherObjects.IsInInventory(x.Id))) { IOItem.IOR = IOResult.nomatch; return; } IOItem.IOR = IOResult.trophy; return; } } catch(Exception ex){LogError(ex);} return; }
private void SubscribeLandscapeEvents() { try { FiveSecondTimer.Tick += LandscapeTimerTick; AetherObjects.LandscapeCreated += OnCreateLandscape; AetherObjects.LandscapeRemoved += OnLandscapeRemoved; AetherCharacter.CharacterLogOff += LandscapeLogoff; foreach(AetherObject ao in AetherObjects.GetLandscape()) { if(ao.ObjectClass != AObjectClass.Unknown) { int index = LandscapeTrackingList.FindIndex(x => x.Id == ao.Id); if(index < 0) { LandscapeObject lo = new LandscapeObject(ao); LandscapeTrackingList.Add(lo); CheckLandscape(ao.Id); } } } } catch(Exception ex) {LogError(ex);} }
private void OnCreateLandscape(object sender, int ObjectId) { try { AetherObject ao = AetherObjects.Collection[ObjectId]; if(ao != null || ao.ObjectClass == AObjectClass.Unknown) { int index = LandscapeTrackingList.FindIndex(x => x.Id == ObjectId); if(index < 0) { LandscapeObject lo = new LandscapeObject(ao); LandscapeTrackingList.Add(lo); CheckLandscape(ao.Id); } } } catch (Exception ex){LogError(ex);} return; }
private void MonsterListCheckLandscape(ref LandscapeObject IOItem) { try { if(mMobsHash.Contains(@IOItem.Name)){IOItem.IOR = IOResult.monster;} } catch (Exception ex) {LogError(ex);} return; }