Fixed some errors from analyzer

This commit is contained in:
hondacrx
2017-06-22 17:02:27 -04:00
parent 0e40e90a11
commit d538acc979
26 changed files with 38 additions and 46 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ namespace Framework.Configuration
foreach (var line in ConfigContent)
{
lineCounter++;
if (line.StartsWith("#") || line.StartsWith("-") || string.IsNullOrEmpty(line))
if (string.IsNullOrEmpty(line) || line.StartsWith("#") || line.StartsWith("-"))
continue;
var configOption = new StringArray(line, '=');
-2
View File
@@ -50,8 +50,6 @@ namespace Framework.Cryptography
public void Initialize(byte[] sessionKey, byte[] serverSeed, byte[] clientSeed)
{
IsInitialized = false;
if (IsInitialized)
throw new InvalidOperationException("PacketCrypt already initialized!");
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Framework.Database
Log.outInfo(LogFilter.ServerLoading, "Database \"{0}\" does not exist, do you want to create it? [yes (default) / no]: ", name);
string answer = Console.ReadLine();
if (string.IsNullOrEmpty(answer) && answer[0] != 'y')
if (string.IsNullOrEmpty(answer) || answer[0] != 'y')
return false;
Log.outInfo(LogFilter.ServerLoading, "Creating database \"{0}\"...", name);
+1 -2
View File
@@ -482,8 +482,7 @@ namespace Framework.Dynamic
public void ModifyIf(Func<Task, bool> filter)
{
List<Task> cache = new List<Task>();
container.Where(filter);
foreach (var task in container.ToList())
foreach (var task in container.Where(filter))
{
if (filter(task))
{
+5 -5
View File
@@ -131,12 +131,12 @@ namespace Framework.GameMath
vertices[0] = _lo;
vertices[1] = new Vector3(_hi.X, _lo.Y, _lo.Z);
vertices[2] = new Vector3(_hi.X, _hi.Y, _lo.Z);
vertices[4] = new Vector3(_lo.X, _hi.Y, _lo.Z);
vertices[3] = new Vector3(_lo.X, _hi.Y, _lo.Z);
vertices[5] = new Vector3(_lo.X, _lo.Y, _hi.Z);
vertices[6] = new Vector3(_hi.X, _lo.Y, _hi.Z);
vertices[7] = _hi;
vertices[8] = new Vector3(_lo.X, _hi.Y, _hi.Z);
vertices[4] = new Vector3(_lo.X, _lo.Y, _hi.Z);
vertices[5] = new Vector3(_hi.X, _lo.Y, _hi.Z);
vertices[6] = _hi;
vertices[7] = new Vector3(_lo.X, _hi.Y, _hi.Z);
return vertices;
}
+1 -1
View File
@@ -26,7 +26,7 @@ public class Realm : IEquatable<Realm>
{
Name = name;
NormalizedName = name;
NormalizedName.Replace(" ", "");
NormalizedName = NormalizedName.Replace(" ", "");
}
public IPEndPoint GetAddressForClient(IPAddress clientAddr)
+2 -2
View File
@@ -162,8 +162,8 @@ namespace Game.Arenas
if (winner != 0)
{
winnerMatchmakerChange = winnerArenaTeam.WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange);
loserMatchmakerChange = loserArenaTeam.LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange);
winnerMatchmakerChange = winnerArenaTeam.WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, ref winnerChange);
loserMatchmakerChange = loserArenaTeam.LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, ref loserChange);
Log.outDebug(LogFilter.Arena, "match Type: {0} --- Winner: old rating: {1}, rating gain: {2}, old MMR: {3}, MMR gain: {4} --- Loser: old rating: {5}, " +
"rating loss: {6}, old MMR: {7}, MMR loss: {8} ---", GetArenaType(), winnerTeamRating, winnerChange, winnerMatchmakerRating, winnerMatchmakerChange,
+2 -2
View File
@@ -588,7 +588,7 @@ namespace Game.Arenas
}
}
public int WonAgainst(uint ownMMRating, uint opponentMMRating, int ratingChange)
public int WonAgainst(uint ownMMRating, uint opponentMMRating, ref int ratingChange)
{
// Called when the team has won
// Change in Matchmaker rating
@@ -608,7 +608,7 @@ namespace Game.Arenas
return mod;
}
public int LostAgainst(uint ownMMRating, uint opponentMMRating, int ratingChange)
public int LostAgainst(uint ownMMRating, uint opponentMMRating, ref int ratingChange)
{
// Called when the team has lost
// Change in Matchmaker Rating
+5 -5
View File
@@ -27,7 +27,7 @@ namespace Game.Chat.Commands
[Command("god", RBACPermissions.CommandCheatGod)]
static bool HandleGodModeCheat(StringArguments args, CommandHandler handler)
{
if (handler.GetSession() == null && handler.GetSession().GetPlayer())
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
return false;
string argstr = args.NextString();
@@ -53,7 +53,7 @@ namespace Game.Chat.Commands
[Command("casttime", RBACPermissions.CommandCheatCasttime)]
static bool HandleCasttimeCheat(StringArguments args, CommandHandler handler)
{
if (handler.GetSession() == null && handler.GetSession().GetPlayer())
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
return false;
string argstr = args.NextString();
@@ -80,7 +80,7 @@ namespace Game.Chat.Commands
[Command("cooldown", RBACPermissions.CommandCheatCooldown)]
static bool HandleCoolDownCheat(StringArguments args, CommandHandler handler)
{
if (handler.GetSession() == null && handler.GetSession().GetPlayer())
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
return false;
string argstr = args.NextString();
@@ -107,7 +107,7 @@ namespace Game.Chat.Commands
[Command("power", RBACPermissions.CommandCheatPower)]
static bool HandlePowerCheat(StringArguments args, CommandHandler handler)
{
if (handler.GetSession() == null && handler.GetSession().GetPlayer())
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
return false;
string argstr = args.NextString();
@@ -152,7 +152,7 @@ namespace Game.Chat.Commands
[Command("waterwalk", RBACPermissions.CommandCheatWaterwalk)]
static bool HandleWaterWalkCheat(StringArguments args, CommandHandler handler)
{
if (handler.GetSession() == null && handler.GetSession().GetPlayer())
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
return false;
string argstr = args.NextString();
+1 -1
View File
@@ -227,7 +227,7 @@ namespace Game.Collision
}
static uint packTileID(uint tileX, uint tileY) { return tileX << 16 | tileY; }
static void unpackTileID(uint ID, uint tileX, uint tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
static void unpackTileID(uint ID, ref uint tileX, ref uint tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
public static bool CanLoadMap(string vmapPath, uint mapID, uint tileX, uint tileY)
{
string fullname = vmapPath + VMapManager.getMapFileName(mapID);
-3
View File
@@ -612,9 +612,6 @@ namespace Game.DataStorage
return 0.0f;
CurveRecord curve = CliDB.CurveStorage.LookupByKey(curveId);
if (points.Empty())
return 0.0f;
switch (DetermineCurveType(curve, points))
{
case CurveInterpolationMode.Linear:
+1 -1
View File
@@ -705,7 +705,7 @@ namespace Game.Entities
public void SetState(ItemUpdateState state, Player forplayer = null)
{
if (uState == ItemUpdateState.New && uState == ItemUpdateState.Removed)
if (uState == ItemUpdateState.New && state == ItemUpdateState.Removed)
{
// pretend the item never existed
if (forplayer)
+1 -1
View File
@@ -192,7 +192,7 @@ namespace Game.Entities
float avgDamage = dps * GetDelay() * 0.001f;
minDamage = (GetStatScalingFactor() * -0.5f + 1.0f) * avgDamage;
maxDamage = (float)Math.Floor((avgDamage * (GetStatScalingFactor() * 0.5f + 1.0f) + 0.5f));
maxDamage = (float)Math.Floor(avgDamage * (GetStatScalingFactor() * 0.5f + 1.0f) + 0.5f);
}
public bool IsUsableByLootSpecialization(Player player)
-3
View File
@@ -164,9 +164,6 @@ namespace Game.Entities
if (eventList.Empty())
return;
if (eventList.Empty())
return;
foreach (uint questId in eventList)
{
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
+2 -2
View File
@@ -1836,7 +1836,7 @@ namespace Game.Entities
}
}
if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent))
if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, ref triggerData.spellProcEvent))
continue;
// do checks using conditions table
@@ -2415,7 +2415,7 @@ namespace Game.Entities
}
}
bool IsTriggeredAtSpellProcEvent(Unit victim, Aura aura, SpellInfo procSpell, ProcFlags procFlag, ProcFlagsExLegacy procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry spellProcEvent)
bool IsTriggeredAtSpellProcEvent(Unit victim, Aura aura, SpellInfo procSpell, ProcFlags procFlag, ProcFlagsExLegacy procExtra, WeaponAttackType attType, bool isVictim, bool active, ref SpellProcEventEntry spellProcEvent)
{
SpellInfo spellInfo = aura.GetSpellInfo();
+1 -1
View File
@@ -269,7 +269,7 @@ namespace Game.Garrisons
}
List<GarrAbilityRecord> genericTraits = genericTraitsTemp.Except(forcedTraits).ToList();
genericTraits.AddRange(genericTraits);
genericTraits.AddRange(traitList);
genericTraits.Sort((GarrAbilityRecord a1, GarrAbilityRecord a2) =>
{
int e1 = (int)(a1.Flags & GarrisonAbilityFlags.Exclusive);
+1 -1
View File
@@ -34,7 +34,7 @@ namespace Game.Garrisons
public override void LoadGridObjects(Grid grid, Cell cell)
{
LoadGridObjects(grid, cell);
base.LoadGridObjects(grid, cell);
GarrisonGridLoader loader = new GarrisonGridLoader(grid, this, cell);
loader.LoadN();
+3 -3
View File
@@ -184,7 +184,7 @@ namespace Game.Loots
if (_difficultyBonusTreeMod != 0)
{
List<uint> bonusListIDs = Global.DB2Mgr.GetItemBonusTree(generatedLoot.itemid, _difficultyBonusTreeMod);
generatedLoot.BonusListIDs.AddRange(generatedLoot.BonusListIDs);
generatedLoot.BonusListIDs.AddRange(bonusListIDs);
}
lootItems.Add(generatedLoot);
count -= proto.GetMaxStackSize();
@@ -767,7 +767,7 @@ namespace Game.Loots
if (!fi.is_looted && !item.is_looted)
{
LootItemData lootItem = new LootItemData();
lootItem.LootListID = (byte)(items.Count + fi.index + 1);
lootItem.LootListID = (byte)(fi.index + 1);
lootItem.UIType = slotType;
lootItem.Quantity = item.count;
lootItem.Loot = new ItemInstance(item);
@@ -786,7 +786,7 @@ namespace Game.Loots
if (!ci.is_looted && !item.is_looted)
{
LootItemData lootItem = new LootItemData();
lootItem.LootListID = (byte)(items.Count + ci.index + 1);
lootItem.LootListID = (byte)(ci.index + 1);
lootItem.Quantity = item.count;
lootItem.Loot = new ItemInstance(item);
+1 -1
View File
@@ -302,7 +302,7 @@ namespace Game.Maps
high_bound = high;
}
void ResizeBorders(ICoord begin_cell, ICoord end_cell)
void ResizeBorders(ref ICoord begin_cell, ref ICoord end_cell)
{
begin_cell = low_bound;
end_cell = high_bound;
+1 -1
View File
@@ -3792,7 +3792,7 @@ namespace Game.Maps
if (unit)
{
// Target must be GameObject.
if (target != null)
if (target == null)
{
Log.outError(LogFilter.Scripts, "{0} target object is NULL.", step.script.GetDebugInfo());
break;
+2 -2
View File
@@ -4930,7 +4930,7 @@ namespace Game.Spells
int skillValue = 0;
// check lock compatibility
SpellCastResult res = CanOpenLock(effect.EffectIndex, lockId, skillId, ref reqSkillValue, ref skillValue);
SpellCastResult res = CanOpenLock(effect.EffectIndex, lockId, ref skillId, ref reqSkillValue, ref skillValue);
if (res != SpellCastResult.SpellCastOk)
return res;
break;
@@ -6541,7 +6541,7 @@ namespace Game.Spells
modOwner.SetSpellModTakingSpell(this, false);
}
SpellCastResult CanOpenLock(uint effIndex, uint lockId, SkillType skillId, ref int reqSkillValue, ref int skillValue)
SpellCastResult CanOpenLock(uint effIndex, uint lockId, ref SkillType skillId, ref int reqSkillValue, ref int skillValue)
{
if (lockId == 0) // possible case for GO and maybe for items.
return SpellCastResult.SpellCastOk;
+1 -1
View File
@@ -1579,7 +1579,7 @@ namespace Game.Spells
int reqSkillValue = 0;
int skillValue = 0;
SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, ref reqSkillValue, ref skillValue);
SpellCastResult res = CanOpenLock(effIndex, lockId, ref skillId, ref reqSkillValue, ref skillValue);
if (res != SpellCastResult.SpellCastOk)
{
SendCastResult(res);
+1 -1
View File
@@ -91,7 +91,7 @@ namespace Game.Spells
_visuals = visuals;
// sort all visuals so that the ones without a condition requirement are last on the list
foreach (var key in _visuals.Keys)
_visuals[key].OrderByDescending(x => x.PlayerConditionID);
_visuals[key] = _visuals[key].OrderByDescending(x => x.PlayerConditionID).ToList();
// SpellScalingEntry
SpellScalingRecord _scaling = data.Scaling;
@@ -368,7 +368,7 @@ namespace Scripts.Northrend.IcecrownCitadel
public SlotInfo(uint _entry, float x, float y, float z, float o, uint _cooldown)
{
Entry = _entry;
TargetPosition = new Position(x, y, z);
TargetPosition = new Position(x, y, z, o);
Cooldown = _cooldown;
}
public SlotInfo(uint _entry, Position pos, uint _cooldown)
@@ -85,7 +85,7 @@ namespace Scripts.Northrend.IcecrownCitadel
if (player.IsInCombat())
{
SpellInfo spell = Global.SpellMgr.GetSpellInfo(TeleporterSpells.FROZEN_THRONE_TELEPORT);
if (spell == null)
if (spell != null)
{
ObjectGuid castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, player.GetMapId(), spell.Id, player.GetMap().GenerateLowGuid(HighGuid.Cast));
Spell.SendCastResult(player, spell, 0, castId, SpellCastResult.AffectingCombat);
+2 -1
View File
@@ -1147,7 +1147,8 @@ namespace Scripts.Spells.Druid
void SetTargets(List<WorldObject> targets)
{
targets = _targets;
targets.Clear();
targets .AddRange(_targets);
}
public override void Register()