From 58b142f26eb016f365237b84fd7b704fab4c6515 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 17 Aug 2019 14:03:21 -0400 Subject: [PATCH] Misc Fixes --- Source/Framework/Util/MathFunctions.cs | 22 ++++++++++----------- Source/Game/DataStorage/WhoListStorage.cs | 21 +++++++++++++++++--- Source/Game/Entities/Creature/Creature.cs | 2 +- Source/Game/Entities/Player/Player.Items.cs | 2 +- Source/Game/Entities/Player/Player.cs | 3 ++- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Source/Framework/Util/MathFunctions.cs b/Source/Framework/Util/MathFunctions.cs index 9adac989a..cc2ae48f7 100644 --- a/Source/Framework/Util/MathFunctions.cs +++ b/Source/Framework/Util/MathFunctions.cs @@ -78,13 +78,13 @@ public static class MathFunctions } #endregion - static double eps(double a, double b) + static double eps(float a, float b) { - double aa = Math.Abs(a) + 1.0; - if (double.IsPositiveInfinity(aa)) - return double.Epsilon; + float aa = Math.Abs(a) + 1.0f; + if (float.IsPositiveInfinity(aa)) + return 0.00001f; - return double.Epsilon * aa; + return 0.00001f * aa; } public static float lerp(float a, float b, float f) @@ -98,27 +98,27 @@ public static class MathFunctions } #region Fuzzy - public static bool fuzzyEq(double a, double b) + public static bool fuzzyEq(float a, float b) { return (a == b) || (Math.Abs(a - b) <= eps(a, b)); } - public static bool fuzzyGt(double a, double b) + public static bool fuzzyGt(float a, float b) { return a > b + eps(a, b); } - public static bool fuzzyLt(double a, double b) + public static bool fuzzyLt(float a, float b) { return a < b - eps(a, b); } - public static bool fuzzyNe(double a, double b) + public static bool fuzzyNe(float a, float b) { return !fuzzyEq(a, b); } - public static bool fuzzyLe(double a, double b) + public static bool fuzzyLe(float a, float b) { return a < b + eps(a, b); } - public static bool fuzzyGe(double a, double b) + public static bool fuzzyGe(float a, float b) { return a > b - eps(a, b); } diff --git a/Source/Game/DataStorage/WhoListStorage.cs b/Source/Game/DataStorage/WhoListStorage.cs index 911c9c299..353bc115f 100644 --- a/Source/Game/DataStorage/WhoListStorage.cs +++ b/Source/Game/DataStorage/WhoListStorage.cs @@ -1,9 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Text; +/* + * Copyright (C) 2012-2019 CypherCore + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + using Framework.Constants; using Game.Entities; using Game.Guilds; +using System.Collections.Generic; namespace Game.DataStorage { diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 6344ff474..327ef2ed9 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -2873,7 +2873,7 @@ namespace Game.Entities { return GetCreatureTemplate().InhabitType.HasAnyFlag(InhabitType.Air); } - public bool IsDungeonBoss() { return (GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.DungeonBoss); } + public bool IsDungeonBoss() { return (GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.DungeonBoss)); } public void SetReactState(ReactStates st) { diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 5e7002cb4..9bfde73cb 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -6585,7 +6585,7 @@ namespace Game.Entities m_AELootView[loot.GetGUID()] = guid; if (loot_type == LootType.Corpse && !guid.IsItem()) - SetUnitFlags(UnitFlags.Looting); + AddUnitFlag(UnitFlags.Looting); } else SendLootError(loot.GetGUID(), guid, LootError.DidntKill); diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 4f8b1f67a..f03772e95 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -4211,7 +4211,8 @@ namespace Game.Entities packet.PlayerGUID = GetGUID(); SendPacket(packet); - if (GetRace() == Race.NightElf) + // If the player has the Wisp racial then cast the Wisp aura on them + if (HasSpell(20585)) CastSpell(this, 20584, true); CastSpell(this, 8326, true);