Fixes Script loading.

Some cleanup on array Clear
Misc errors
This commit is contained in:
hondacrx
2017-12-24 16:37:15 -05:00
parent 9937d1e421
commit c7219c7098
15 changed files with 30 additions and 13 deletions
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
namespace Framework.Constants namespace Framework.Constants
{ {
@@ -2131,6 +2132,8 @@ namespace Framework.Constants
Finish = 0x4, Finish = 0x4,
MaskAll = Cast | Hit | Finish MaskAll = Cast | Hit | Finish
} }
[Flags]
public enum ProcFlagsHit public enum ProcFlagsHit
{ {
None = 0x0, // No Value - Proc_Hit_Normal | Proc_Hit_Critical For Taken Proc Type, Proc_Hit_Normal | Proc_Hit_Critical | Proc_Hit_Absorb For Done None = 0x0, // No Value - Proc_Hit_Normal | Proc_Hit_Critical For Taken Proc Type, Proc_Hit_Normal | Proc_Hit_Critical | Proc_Hit_Absorb For Done
+3 -1
View File
@@ -13,7 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
namespace Framework.Constants namespace Framework.Constants
{ {
@@ -206,6 +207,7 @@ namespace Framework.Constants
Deflects = 8 Deflects = 8
} }
[Flags]
public enum HitInfo public enum HitInfo
{ {
NormalSwing = 0x0, NormalSwing = 0x0,
+4 -1
View File
@@ -364,7 +364,10 @@ namespace Framework.Database
{ {
MySqlErrorCode code = (MySqlErrorCode)ex.Number; MySqlErrorCode code = (MySqlErrorCode)ex.Number;
if (ex.InnerException != null) if (ex.InnerException != null)
code = (MySqlErrorCode)((MySqlException)ex.InnerException).Number; {
if (ex.InnerException is MySqlException)
code = (MySqlErrorCode)((MySqlException)ex.InnerException).Number;
}
switch (code) switch (code)
{ {
@@ -162,6 +162,11 @@ namespace System.Collections.Generic
array.CopyTo(blockValues, 0); array.CopyTo(blockValues, 0);
return blockValues; return blockValues;
} }
public static void Clear(this Array array)
{
Array.Clear(array, 0, array.Length);
}
} }
public interface ICheck<T> public interface ICheck<T>
+2 -2
View File
@@ -1559,10 +1559,10 @@ namespace Game.Entities
// This makes sure that creatures such as bosses wont have a bigger aggro range than the rest of the npc's // This makes sure that creatures such as bosses wont have a bigger aggro range than the rest of the npc's
// The following code is used for blizzlike behavior such as skipable bosses (e.g. Commander Springvale at level 85) // The following code is used for blizzlike behavior such as skipable bosses (e.g. Commander Springvale at level 85)
if (creatureLevel > expansionMaxLevel) if (creatureLevel > expansionMaxLevel)
aggroRadius += expansionMaxLevel - playerLevel; aggroRadius += (float)expansionMaxLevel - (float)playerLevel;
// + - 1 yard for each level difference between player and creature // + - 1 yard for each level difference between player and creature
else else
aggroRadius += creatureLevel - playerLevel; aggroRadius += (float)creatureLevel - (float)playerLevel;
// Make sure that we wont go over the total range limits // Make sure that we wont go over the total range limits
if (aggroRadius > maxRadius) if (aggroRadius > maxRadius)
+1 -1
View File
@@ -170,7 +170,7 @@ namespace Game.Entities
public override string ToString() public override string ToString()
{ {
string str = string.Format("GUID Full: 0x{0}, Type: {1}", _low, GetHigh()); string str = string.Format("GUID Full: 0x{0}, Type: {1}", _high + _low, GetHigh());
if (HasEntry()) if (HasEntry())
str += (IsPet() ? " Pet number: " : " Entry: ") + GetEntry() + " "; str += (IsPet() ? " Pet number: " : " Entry: ") + GetEntry() + " ";
+2 -1
View File
@@ -107,7 +107,7 @@ namespace Game.Entities
uint m_removedAurasCount; uint m_removedAurasCount;
//General //General
Array<DiminishingReturn> m_Diminishing = new Array<DiminishingReturn>((int)DiminishingGroup.Max); DiminishingReturn[] m_Diminishing = new DiminishingReturn[(int)DiminishingGroup.Max];
protected List<GameObject> m_gameObj = new List<GameObject>(); protected List<GameObject> m_gameObj = new List<GameObject>();
List<AreaTrigger> m_areaTrigger = new List<AreaTrigger>(); List<AreaTrigger> m_areaTrigger = new List<AreaTrigger>();
protected List<DynamicObject> m_dynObj = new List<DynamicObject>(); protected List<DynamicObject> m_dynObj = new List<DynamicObject>();
@@ -140,6 +140,7 @@ namespace Game.Entities
public class DiminishingReturn public class DiminishingReturn
{ {
public DiminishingReturn() { }
public DiminishingReturn(uint hitTime, DiminishingLevels hitCount) public DiminishingReturn(uint hitTime, DiminishingLevels hitCount)
{ {
Stack = 0; Stack = 0;
+3 -1
View File
@@ -2811,6 +2811,8 @@ namespace Game.Entities
{ {
// Checking for existing in the table // Checking for existing in the table
DiminishingReturn diminish = m_Diminishing[(int)group]; DiminishingReturn diminish = m_Diminishing[(int)group];
if (diminish == null)
diminish = new DiminishingReturn();
if (apply) if (apply)
++diminish.Stack; ++diminish.Stack;
@@ -2891,7 +2893,7 @@ namespace Game.Entities
} }
public void UpdateInterruptMask() public void UpdateInterruptMask()
{ {
m_interruptMask.Initialize(); m_interruptMask.Clear();
foreach (AuraApplication aurApp in m_interruptableAuras) foreach (AuraApplication aurApp in m_interruptableAuras)
{ {
for (var i = 0; i < m_interruptMask.Length; ++i) for (var i = 0; i < m_interruptMask.Length; ++i)
+1 -1
View File
@@ -215,7 +215,7 @@ namespace Game
SQLResult result = DB.World.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event, announce FROM game_event"); SQLResult result = DB.World.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event, announce FROM game_event");
if (result.IsEmpty()) if (result.IsEmpty())
{ {
mGameEvent.Initialize(); mGameEvent.Clear();
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 game events. DB table `game_event` is empty."); Log.outInfo(LogFilter.ServerLoading, "Loaded 0 game events. DB table `game_event` is empty.");
return; return;
} }
+1 -1
View File
@@ -70,7 +70,7 @@ namespace Game.Scripting
return; return;
} }
Assembly assembly = Assembly.LoadFile(Path.GetFullPath("Scripts.dll")); Assembly assembly = Assembly.LoadFile(AppContext.BaseDirectory + "Scripts.dll");
if (assembly == null) if (assembly == null)
{ {
Log.outError(LogFilter.ServerLoading, "Error Loading Scripts.dll, Only Core Scripts are loaded."); Log.outError(LogFilter.ServerLoading, "Error Loading Scripts.dll, Only Core Scripts are loaded.");
+1 -1
View File
@@ -2488,7 +2488,7 @@ namespace Game.Entities
break; break;
case 63414: // Spinning Up (Mimiron) case 63414: // Spinning Up (Mimiron)
spellInfo.GetEffect(0).TargetB = new SpellImplicitTargetInfo(Targets.UnitCaster); spellInfo.GetEffect(0).TargetB = new SpellImplicitTargetInfo(Targets.UnitCaster);
spellInfo.ChannelInterruptFlags.Initialize(); spellInfo.ChannelInterruptFlags.Clear();
break; break;
case 63036: // Rocket Strike (Mimiron) case 63036: // Rocket Strike (Mimiron)
spellInfo.Speed = 0; spellInfo.Speed = 0;
@@ -22,6 +22,7 @@ namespace Scripts.Northrend.FrozenHalls.PitOfSaron
}; };
} }
[Script]
class instance_pit_of_saron : InstanceMapScript class instance_pit_of_saron : InstanceMapScript
{ {
public instance_pit_of_saron() : base(nameof(instance_pit_of_saron), 658) { } public instance_pit_of_saron() : base(nameof(instance_pit_of_saron), 658) { }
-1
View File
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
+2 -1
View File
@@ -8,7 +8,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Game\Game.csproj" /> <ProjectReference Include="..\Game\Game.csproj" />
<ProjectReference Include="..\Scripts\Scripts.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputPath>../../Build/$(Configuration)/$(Platform)</OutputPath> <OutputPath>../../Build/$(Configuration)/$(Platform)</OutputPath>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>False</AppendRuntimeIdentifierToOutputPath> <AppendRuntimeIdentifierToOutputPath>False</AppendRuntimeIdentifierToOutputPath>
<Platforms>win-x64;linux-x64;mac-x64</Platforms> <Platforms>win-x64;linux-x64;mac-x64</Platforms>