Refactoring Cleanup

This commit is contained in:
hondacrx
2020-02-03 14:42:20 -05:00
parent 2a065d22da
commit 752137af52
37 changed files with 107 additions and 157 deletions
+3 -3
View File
@@ -55,16 +55,16 @@ public class RealmManager : Singleton<RealmManager>
build.MinorVersion = result.Read<uint>(1);
build.BugfixVersion = result.Read<uint>(2);
string hotfixVersion = result.Read<string>(3);
if (hotfixVersion.Length < build.HotfixVersion.Length)
if (!hotfixVersion.IsEmpty() && hotfixVersion.Length < build.HotfixVersion.Length)
build.HotfixVersion = hotfixVersion.ToCharArray();
build.Build = result.Read<uint>(4);
string win64AuthSeedHexStr = result.Read<string>(5);
if (win64AuthSeedHexStr.Length == build.Win64AuthSeed.Length * 2)
if (!win64AuthSeedHexStr.IsEmpty() && win64AuthSeedHexStr.Length == build.Win64AuthSeed.Length * 2)
build.Win64AuthSeed = win64AuthSeedHexStr.ToByteArray();
string mac64AuthSeedHexStr = result.Read<string>(6);
if (mac64AuthSeedHexStr.Length == build.Mac64AuthSeed.Length * 2)
if (!mac64AuthSeedHexStr.IsEmpty() && mac64AuthSeedHexStr.Length == build.Mac64AuthSeed.Length * 2)
build.Mac64AuthSeed = mac64AuthSeedHexStr.ToByteArray();
_builds.Add(build);
@@ -312,7 +312,7 @@ namespace Game.AI
UpdateEscortAI(diff);
}
void UpdateEscortAI(uint diff)
public virtual void UpdateEscortAI(uint diff)
{
if (!UpdateVictim())
return;
@@ -505,7 +505,7 @@ namespace Game.AI
return false;
int size = WaypointList.Count;
Escort_Waypoint waypoint = new Escort_Waypoint(0, 0, 0, 0, 0);
Escort_Waypoint waypoint;
do
{
waypoint = WaypointList.First();
-11
View File
@@ -448,17 +448,6 @@ namespace Game.AI
MovepointReached(Data);
}
void RemoveAuras()
{
//fixme: duplicated logic in CreatureAI._EnterEvadeMode (could use RemoveAllAurasExceptType)
foreach (var pair in me.GetAppliedAuras())
{
Aura aura = pair.Value.GetBase();
if (!aura.IsPassive() && !aura.HasEffectType(AuraType.ControlVehicle) && !aura.HasEffectType(AuraType.CloneCaster) && aura.GetCasterGUID() != me.GetGUID())
me.RemoveAura(pair);
}
}
public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other)
{
if (mEvadeDisabled)
+1 -1
View File
@@ -1583,7 +1583,7 @@ namespace Game.AI
if (!IsSmart())
break;
WorldObject target = null;
WorldObject target;
/*if (e.GetTargetType() == SmartTargets.CreatureRange || e.GetTargetType() == SmartTargets.CreatureGuid ||
e.GetTargetType() == SmartTargets.CreatureDistance || e.GetTargetType() == SmartTargets.GameobjectRange ||
+2 -6
View File
@@ -189,9 +189,7 @@ namespace Game
public AccountOpResult ChangeEmail(uint accountId, string newEmail)
{
string username;
if (!GetName(accountId, out username))
if (!GetName(accountId, out _))
return AccountOpResult.NameNotExist; // account doesn't exist
if (newEmail.Length > MaxEmailLength)
@@ -207,9 +205,7 @@ namespace Game
public AccountOpResult ChangeRegEmail(uint accountId, string newEmail)
{
string username;
if (!GetName(accountId, out username))
if (!GetName(accountId, out _))
return AccountOpResult.NameNotExist; // account doesn't exist
if (newEmail.Length > MaxEmailLength)
@@ -425,7 +425,7 @@ namespace Game.Achievements
SendPacket(achievementData);
}
public void SendAchievementInfo(Player receiver, uint achievementId = 0)
public void SendAchievementInfo(Player receiver)
{
RespondInspectAchievements inspectedAchievements = new RespondInspectAchievements();
inspectedAchievements.Player = _owner.GetGUID();
+3 -4
View File
@@ -79,12 +79,12 @@ namespace Game
if (!item)
return;
uint bidderAccId = 0;
uint bidderAccId;
ObjectGuid bidderGuid = ObjectGuid.Create(HighGuid.Player, auction.bidder);
Player bidder = Global.ObjAccessor.FindPlayer(bidderGuid);
// data for gm.log
string bidderName = "";
bool logGmTrade = false;
bool logGmTrade;
if (bidder)
{
@@ -428,8 +428,7 @@ namespace Game
public bool RemoveAuction(AuctionEntry auction)
{
Global.ScriptMgr.OnAuctionRemove(this, auction);
return AuctionsMap.TryRemove(auction.Id, out AuctionEntry removedItem);
return AuctionsMap.TryRemove(auction.Id, out _);
}
public void Update()
+2 -2
View File
@@ -1125,7 +1125,7 @@ namespace Game.BattleFields
{
capturePoint.SetRespawnTime(0); // not save respawn time
capturePoint.Delete();
capturePoint = null;
capturePoint.Dispose();
}
m_capturePointGUID.Clear();
}
@@ -1176,7 +1176,7 @@ namespace Game.BattleFields
if (MathFunctions.fuzzyEq(fact_diff, 0.0f))
return false;
Team Challenger = 0;
Team Challenger;
float maxDiff = m_maxSpeed * diff;
if (fact_diff < 0)
@@ -527,7 +527,7 @@ namespace Game.BattleFields
public override void OnGameObjectCreate(GameObject go)
{
uint workshopId = 0;
uint workshopId;
switch (go.GetEntry())
{
+1 -1
View File
@@ -674,7 +674,7 @@ namespace Game.BattleGrounds
SetWinner(BattlegroundTeamId.Neutral);
}
PreparedStatement stmt = null;
PreparedStatement stmt;
ulong battlegroundId = 1;
if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable))
{
@@ -428,7 +428,7 @@ namespace Game.BattleGrounds.Zones
return;
source.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.EnterPvpCombat);
uint sound = 0;
uint sound;
// If node is neutral, change to contested
if (m_Nodes[node] == ABNodeStatus.Neutral)
{
+7 -10
View File
@@ -163,7 +163,7 @@ namespace Game.BattleGrounds.Zones
void CheckSomeoneJoinedPo()
{
GameObject obj = null;
GameObject obj;
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
{
obj = GetBgMap().GetGameObject(BgObjects[EotSObjectTypes.TowerCapFelReaver + i]);
@@ -203,7 +203,8 @@ namespace Game.BattleGrounds.Zones
//reset current point counts
for (byte i = 0; i < 2 * EotSPoints.PointsMax; ++i)
m_CurrentPointPlayersCount[i] = 0;
GameObject obj = null;
GameObject obj;
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
{
obj = GetBgMap().GetGameObject(BgObjects[EotSObjectTypes.TowerCapFelReaver + i]);
@@ -255,7 +256,7 @@ namespace Game.BattleGrounds.Zones
//point is fully horde's
m_PointBarStatus[point] = EotSProgressBarConsts.ProgressBarHordeControlled;
uint pointOwnerTeamId = 0;
uint pointOwnerTeamId;
//find which team should own this point
if (m_PointBarStatus[point] <= EotSProgressBarConsts.ProgressBarNeutralLow)
pointOwnerTeamId = (uint)Team.Horde;
@@ -871,8 +872,7 @@ namespace Game.BattleGrounds.Zones
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
uint g_id = 0;
uint g_id;
switch (player.GetTeam())
{
case Team.Alliance:
@@ -884,11 +884,8 @@ namespace Game.BattleGrounds.Zones
default: return null;
}
WorldSafeLocsEntry entry = null;
WorldSafeLocsEntry nearestEntry = null;
entry = Global.ObjectMgr.GetWorldSafeLoc(g_id);
nearestEntry = entry;
WorldSafeLocsEntry entry = Global.ObjectMgr.GetWorldSafeLoc(g_id);
WorldSafeLocsEntry nearestEntry = entry;
if (entry == null)
{
Log.outError(LogFilter.Battleground, "BattlegroundEY: The main team graveyard could not be found. The graveyard system will not be operational!");
@@ -702,7 +702,7 @@ namespace Game.BattleGrounds.Zones
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
{
uint safeloc = 0;
uint safeloc;
if (player.GetTeamId() == Attackers)
safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy];
@@ -820,9 +820,9 @@ namespace Game.BattleGrounds.Zones
}
AddSpiritGuide(i + SACreatureTypes.Max, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), SAMiscConst.GYOrientation[i], GraveyardStatus[i]);
uint npc = 0;
int flag = 0;
uint npc;
int flag;
switch (i)
{
case SAGraveyards.LeftCapturableGy:
+3 -7
View File
@@ -474,18 +474,14 @@ namespace Game.BattlePets
{
public void CalculateStats()
{
float health = 0.0f;
float power = 0.0f;
float speed = 0.0f;
// get base breed stats
var breedState = _battlePetBreedStates.LookupByKey(PacketInfo.Breed);
if (breedState == null) // non existing breed id
return;
health = breedState[BattlePetState.StatStamina];
power = breedState[BattlePetState.StatPower];
speed = breedState[BattlePetState.StatSpeed];
float health = breedState[BattlePetState.StatStamina];
float power = breedState[BattlePetState.StatPower];
float speed = breedState[BattlePetState.StatSpeed];
// modify stats depending on species - not all pets have this
var speciesState = _battlePetSpeciesStates.LookupByKey(PacketInfo.Species);
@@ -213,12 +213,12 @@ namespace Game.BlackMarket
if (entry.GetMailSent())
return;
uint bidderAccId = 0;
uint bidderAccId;
ObjectGuid bidderGuid = ObjectGuid.Create(HighGuid.Player, entry.GetBidder());
Player bidder = Global.ObjAccessor.FindConnectedPlayer(bidderGuid);
// data for gm.log
string bidderName = "";
bool logGmTrade = false;
bool logGmTrade;
if (bidder)
{
+5 -12
View File
@@ -273,13 +273,11 @@ namespace Game.Chat
public string ExtractKeyFromLink(StringArguments args, params string[] linkType)
{
int throwaway;
return ExtractKeyFromLink(args, linkType, out throwaway);
return ExtractKeyFromLink(args, linkType, out _);
}
public string ExtractKeyFromLink(StringArguments args, string[] linkType, out int found_idx)
{
string throwaway;
return ExtractKeyFromLink(args, linkType, out found_idx, out throwaway);
return ExtractKeyFromLink(args, linkType, out found_idx, out _);
}
public string ExtractKeyFromLink(StringArguments args, string[] linkType, out int found_idx, out string something1)
{
@@ -378,14 +376,11 @@ namespace Game.Chat
}
public bool ExtractPlayerTarget(StringArguments args, out Player player)
{
ObjectGuid guid;
string name;
return ExtractPlayerTarget(args, out player, out guid, out name);
return ExtractPlayerTarget(args, out player, out _, out _);
}
public bool ExtractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid)
{
string name;
return ExtractPlayerTarget(args, out player, out playerGuid, out name);
return ExtractPlayerTarget(args, out player, out playerGuid, out _);
}
public bool ExtractPlayerTarget(StringArguments args, out Player player, out ObjectGuid playerGuid, out string playerName)
@@ -496,9 +491,7 @@ namespace Game.Chat
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
// number or [name] Shift-click form |color|Htalent:talent_id, rank|h[name]|h|r
// number or [name] Shift-click form |color|Htrade:spell_id, skill_id, max_value, cur_value|h[name]|h|r
int type = 0;
string param1Str = null;
string idS = ExtractKeyFromLink(args, spellKeys, out type, out param1Str);
string idS = ExtractKeyFromLink(args, spellKeys, out int type, out string param1Str);
if (string.IsNullOrEmpty(idS))
return 0;
+4 -3
View File
@@ -521,9 +521,10 @@ namespace Game.Chat
}
string targetAccountName = "";
uint targetAccountId = 0;
AccountTypes targetSecurity = 0;
uint gm = 0;
uint targetAccountId;
AccountTypes targetSecurity;
uint gm;
string arg1 = args.NextString();
string arg2 = args.NextString();
string arg3 = args.NextString();
+3 -5
View File
@@ -133,8 +133,7 @@ namespace Game.Chat.Commands
}
break;
case BanMode.IP:
IPAddress address;
if (!IPAddress.TryParse(nameOrIP, out address))
if (!IPAddress.TryParse(nameOrIP, out _))
return false;
break;
}
@@ -143,7 +142,7 @@ namespace Game.Chat.Commands
switch (Global.WorldMgr.BanAccount(mode, nameOrIP, durationStr, reasonStr, author))
{
case BanReturn.Success:
if (!uint.TryParse(durationStr, out uint tempValue) || tempValue > 0)
if (duration > 0)
{
if (WorldConfig.GetBoolValue(WorldCfg.ShowBanInWorld))
Global.WorldMgr.SendWorldText(CypherStrings.BanAccountYoubannedmessageWorld, author, nameOrIP, Time.secsToTimeString(Time.TimeStringToSecs(durationStr)), reasonStr);
@@ -654,8 +653,7 @@ namespace Game.Chat.Commands
}
break;
case BanMode.IP:
IPAddress address;
if (!IPAddress.TryParse(nameOrIP, out address))
if (!IPAddress.TryParse(nameOrIP, out _))
return false;
break;
}
@@ -277,8 +277,7 @@ namespace Game.Chat
ObjectGuid targetGuid;
string targetName;
Player playerNotUsed;
if (!handler.ExtractPlayerTarget(new StringArguments(playerNameStr), out playerNotUsed, out targetGuid, out targetName))
if (!handler.ExtractPlayerTarget(new StringArguments(playerNameStr), out _, out targetGuid, out targetName))
return false;
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(targetGuid);
@@ -393,11 +393,6 @@ namespace Game.Chat
[Command("info", RBACPermissions.CommandGobjectInfo)]
static bool HandleGameObjectInfoCommand(StringArguments args, CommandHandler handler)
{
uint entry = 0;
GameObjectTypes type = 0;
uint displayId = 0;
uint lootId = 0;
if (args.Empty())
return false;
@@ -405,6 +400,7 @@ namespace Game.Chat
if (param1.IsEmpty())
return false;
uint entry;
if (param1.Equals("guid"))
{
string cValue = handler.ExtractKeyFromLink(args, "Hgameobject");
@@ -429,10 +425,10 @@ namespace Game.Chat
if (gameObjectInfo == null)
return false;
type = gameObjectInfo.type;
displayId = gameObjectInfo.displayId;
GameObjectTypes type = gameObjectInfo.type;
uint displayId = gameObjectInfo.displayId;
string name = gameObjectInfo.name;
lootId = gameObjectInfo.GetLootId();
uint lootId = gameObjectInfo.GetLootId();
handler.SendSysMessage(CypherStrings.GoinfoEntry, entry);
handler.SendSysMessage(CypherStrings.GoinfoType, type);
+2 -2
View File
@@ -262,8 +262,8 @@ namespace Game.Chat.Commands
return false;
}
float x, y, z = 0;
uint mapId = 0;
float x, y, z;
uint mapId;
var poiData = Global.ObjectMgr.GetQuestPOIData(questID);
if (poiData != null)
+16 -19
View File
@@ -125,9 +125,9 @@ namespace Game.Chat
[Command("leader", RBACPermissions.CommandGroupLeader)]
static bool HandleGroupLeaderCommand(StringArguments args, CommandHandler handler)
{
Player player = null;
Group group = null;
ObjectGuid guid = ObjectGuid.Empty;
Player player;
Group group;
ObjectGuid guid;
string nameStr = args.NextString();
if (!handler.GetPlayerGroupAndGUIDByName(nameStr, out player, out group, out guid))
@@ -151,12 +151,11 @@ namespace Game.Chat
[Command("disband", RBACPermissions.CommandGroupDisband)]
static bool HandleGroupDisbandCommand(StringArguments args, CommandHandler handler)
{
Player player = null;
Group group = null;
ObjectGuid guid = ObjectGuid.Empty;
Player player;
Group group;
string nameStr = args.NextString();
if (!handler.GetPlayerGroupAndGUIDByName(nameStr, out player, out group, out guid))
if (!handler.GetPlayerGroupAndGUIDByName(nameStr, out player, out group, out _))
return false;
if (!group)
@@ -172,9 +171,9 @@ namespace Game.Chat
[Command("remove", RBACPermissions.CommandGroupRemove)]
static bool HandleGroupRemoveCommand(StringArguments args, CommandHandler handler)
{
Player player = null;
Group group = null;
ObjectGuid guid = ObjectGuid.Empty;
Player player;
Group group;
ObjectGuid guid;
string nameStr = args.NextString();
if (!handler.GetPlayerGroupAndGUIDByName(nameStr, out player, out group, out guid))
@@ -196,16 +195,14 @@ namespace Game.Chat
if (args.Empty())
return false;
Player playerSource = null;
Player playerTarget = null;
Group groupSource = null;
Group groupTarget = null;
ObjectGuid guidSource = ObjectGuid.Empty;
ObjectGuid guidTarget = ObjectGuid.Empty;
Player playerSource;
Player playerTarget;
Group groupSource;
Group groupTarget;
string nameplgrStr = args.NextString();
string nameplStr = args.NextString();
if (!handler.GetPlayerGroupAndGUIDByName(nameplgrStr, out playerSource, out groupSource, out guidSource, true))
if (!handler.GetPlayerGroupAndGUIDByName(nameplgrStr, out playerSource, out groupSource, out _, true))
return false;
if (!groupSource)
@@ -214,7 +211,7 @@ namespace Game.Chat
return false;
}
if (!handler.GetPlayerGroupAndGUIDByName(nameplStr, out playerTarget, out groupTarget, out guidTarget, true))
if (!handler.GetPlayerGroupAndGUIDByName(nameplStr, out playerTarget, out groupTarget, out _, true))
return false;
if (groupTarget || playerTarget.GetGroup() == groupSource)
@@ -243,7 +240,7 @@ namespace Game.Chat
ObjectGuid guidTarget;
string nameTarget;
string zoneName = "";
string onlineState = "";
string onlineState;
// Parse the guid to uint32...
ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64());
+2 -3
View File
@@ -99,7 +99,7 @@ namespace Game.Chat
static bool HandleGuildUninviteCommand(StringArguments args, CommandHandler handler)
{
Player target;
ObjectGuid targetGuid = ObjectGuid.Empty;
ObjectGuid targetGuid;
if (!handler.ExtractPlayerTarget(args, out target, out targetGuid))
return false;
@@ -126,8 +126,7 @@ namespace Game.Chat
Player target;
ObjectGuid targetGuid;
string target_name;
if (!handler.ExtractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out target_name))
if (!handler.ExtractPlayerTarget(new StringArguments(nameStr), out target, out targetGuid, out _))
return false;
ulong guildId = target ? target.GetGuildId() : Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(targetGuid);
@@ -220,7 +220,6 @@ namespace Game.Chat
string param1 = args.NextString();
string param2 = args.NextString();
uint encounterId = 0;
Player player = null;
// Character name must be provided when using this from console.
@@ -257,7 +256,7 @@ namespace Game.Chat
return false;
}
if (!uint.TryParse(param1, out encounterId))
if (!uint.TryParse(param1, out uint encounterId))
return false;
if (encounterId > map.GetInstanceScript().GetEncounterCount())
+3 -5
View File
@@ -30,10 +30,8 @@ namespace Game.Chat
[Command("player", RBACPermissions.CommandLfgPlayer, true)]
static bool HandleLfgPlayerInfoCommand(StringArguments args, CommandHandler handler)
{
Player target = null;
string playerName;
ObjectGuid guid;
if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
Player target;
if (!handler.ExtractPlayerTarget(args, out target))
return false;
GetPlayerInfo(handler, target);
@@ -46,7 +44,7 @@ namespace Game.Chat
if (args.Empty())
return false;
Player playerTarget = null;
Player playerTarget;
ObjectGuid guidTarget;
string nameTarget;
+14 -16
View File
@@ -125,7 +125,7 @@ namespace Game.Chat
[CommandNonGroup("gps", RBACPermissions.CommandGps)]
static bool HandleGPSCommand(StringArguments args, CommandHandler handler)
{
WorldObject obj = null;
WorldObject obj;
if (!args.Empty())
{
HighGuid guidHigh = 0;
@@ -604,8 +604,7 @@ namespace Game.Chat
// to point where player stay (if loaded)
WorldLocation loc;
bool in_flight;
if (!Player.LoadPositionFromDB(out loc, out in_flight, targetGuid))
if (!Player.LoadPositionFromDB(out loc, out _, targetGuid))
return false;
// stop flight if need
@@ -809,7 +808,7 @@ namespace Game.Chat
[CommandNonGroup("distance", RBACPermissions.CommandDistance)]
static bool HandleGetDistanceCommand(StringArguments args, CommandHandler handler)
{
WorldObject obj = null;
WorldObject obj;
if (!args.Empty())
{
@@ -935,10 +934,9 @@ namespace Game.Chat
[CommandNonGroup("kick", RBACPermissions.CommandKick, true)]
static bool Kick(StringArguments args, CommandHandler handler)
{
Player target = null;
Player target;
string playerName;
ObjectGuid guid;
if (!handler.ExtractPlayerTarget(args, out target, out guid, out playerName))
if (!handler.ExtractPlayerTarget(args, out target, out _, out playerName))
return false;
if (handler.GetSession() != null && target == handler.GetSession().GetPlayer())
@@ -990,7 +988,7 @@ namespace Game.Chat
if (string.IsNullOrEmpty(loc))
location_str = loc;
Player player = null;
Player player;
ObjectGuid targetGUID;
if (!handler.ExtractPlayerTarget(args, out player, out targetGUID))
return false;
@@ -1285,7 +1283,7 @@ namespace Game.Chat
Player target;
ObjectGuid targetGuid;
string targetName;
PreparedStatement stmt = null;
PreparedStatement stmt;
// To make sure we get a target, we convert our guid to an omniversal...
ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64());
@@ -1334,7 +1332,7 @@ namespace Game.Chat
// Account data print variables
string userName = handler.GetCypherString(CypherStrings.Error);
uint accId = 0;
uint accId;
ulong lowguid = targetGuid.GetCounter();
string eMail = handler.GetCypherString(CypherStrings.Error);
string regMail = handler.GetCypherString(CypherStrings.Error);
@@ -1362,10 +1360,10 @@ namespace Game.Chat
Class classid;
Gender gender;
LocaleConstant locale = handler.GetSessionDbcLocale();
uint totalPlayerTime = 0;
uint level = 0;
uint totalPlayerTime;
uint level;
string alive = handler.GetCypherString(CypherStrings.Error);
ulong money = 0;
ulong money;
uint xp = 0;
uint xptotal = 0;
@@ -1691,7 +1689,7 @@ namespace Game.Chat
return false;
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME);
string muteBy = "";
string muteBy;
if (handler.GetSession() != null)
muteBy = handler.GetSession().GetPlayerName();
else
@@ -1875,7 +1873,7 @@ namespace Game.Chat
break;
case MovementGeneratorType.Chase:
{
Unit target = null;
Unit target;
if (unit.IsTypeId(TypeId.Player))
target = ((ChaseMovementGenerator<Player>)movementGenerator).Target;
else
@@ -1891,7 +1889,7 @@ namespace Game.Chat
}
case MovementGeneratorType.Follow:
{
Unit target = null;
Unit target;
if (unit.IsTypeId(TypeId.Player))
target = ((FollowMovementGenerator<Player>)movementGenerator).Target;
else
+2 -4
View File
@@ -31,9 +31,8 @@ namespace Game.Chat
[Command("hp", RBACPermissions.CommandModifyHp)]
static bool HandleModifyHPCommand(StringArguments args, CommandHandler handler)
{
int hp, hpmax = 0;
Player target = handler.GetSelectedPlayerOrSelf();
if (CheckModifyResources(args, handler, target, out hp, out hpmax))
if (CheckModifyResources(args, handler, target, out int hp, out int hpmax))
{
NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, hpmax);
target.SetMaxHealth((uint)hpmax);
@@ -390,9 +389,8 @@ namespace Game.Chat
if (!uint.TryParse(factionTxt, out uint factionId))
return false;
int amount = 0;
string rankTxt = args.NextString();
if (factionId == 0 || !int.TryParse(rankTxt, out amount))
if (factionId == 0 || !int.TryParse(rankTxt, out int amount))
return false;
if ((amount == 0) && !(amount < 0) && !rankTxt.IsNumber())
+3 -3
View File
@@ -113,7 +113,7 @@ namespace Game.Chat
[Command("move", RBACPermissions.CommandNpcMove)]
static bool Move(StringArguments args, CommandHandler handler)
{
ulong lowguid = 0;
ulong lowguid;
Creature creature = handler.GetSelectedCreature();
if (!creature)
@@ -812,7 +812,7 @@ namespace Game.Chat
if (string.IsNullOrEmpty(guid_str))
return false;
ulong lowguid = 0;
ulong lowguid;
Creature creature = null;
if (!string.IsNullOrEmpty(dontdel_str))
@@ -980,7 +980,7 @@ namespace Game.Chat
mtype = MovementGeneratorType.Random;
Creature creature = handler.GetSelectedCreature();
ulong guidLow = 0;
ulong guidLow;
if (creature)
guidLow = creature.GetSpawnId();
+1 -1
View File
@@ -225,7 +225,7 @@ namespace Game.Chat.Commands
string param3 = args.NextString();
int realmId = -1;
uint accountId = 0;
uint accountId;
string accountName;
uint id = 0;
RBACData rdata = null;
+1 -2
View File
@@ -118,8 +118,7 @@ namespace Game.Chat.Commands
return false;
}
uint itemCount = 0;
if (string.IsNullOrEmpty(itemCountStr) || !uint.TryParse(itemCountStr, out itemCount))
if (string.IsNullOrEmpty(itemCountStr) || !uint.TryParse(itemCountStr, out uint itemCount))
itemCount = 1;
if (itemCount < 1 || (item_proto.GetMaxCount() > 0 && itemCount > item_proto.GetMaxCount()))
+1 -1
View File
@@ -115,7 +115,7 @@ namespace Game.Chat
uint playerAmountLimit = Global.WorldMgr.GetPlayerAmountLimit();
AccountTypes allowedAccountType = Global.WorldMgr.GetPlayerSecurityLimit();
string secName = "";
string secName;
switch (allowedAccountType)
{
case AccountTypes.Player:
+1 -1
View File
@@ -440,7 +440,7 @@ namespace Game.Chat.Commands
}
// Get security level of player, whom this ticket is assigned to
AccountTypes security = AccountTypes.Player;
AccountTypes security;
Player assignedPlayer = ticket.GetAssignedPlayer();
if (assignedPlayer && assignedPlayer.IsInWorld)
security = assignedPlayer.GetSession().GetSecurity();
+3 -3
View File
@@ -33,7 +33,7 @@ namespace Game.Chat.Commands
{
// optional
string path_number = null;
uint pathid = 0;
uint pathid;
if (!args.Empty())
path_number = args.NextString();
@@ -108,7 +108,7 @@ namespace Game.Chat.Commands
return false;
string arg_id = args.NextString();
uint id = 0;
uint id;
if (show == "add")
{
if (!uint.TryParse(arg_id, out id))
@@ -624,7 +624,7 @@ namespace Game.Chat.Commands
// second arg: GUID (optional, if a creature is selected)
string guid_str = args.NextString();
uint pathid = 0;
uint pathid;
Creature target = handler.GetSelectedCreature();
// Did player provide a PathID?
+3 -3
View File
@@ -324,7 +324,7 @@ namespace Game.Collision
public bool GetObjectHitPos(Vector3 pPos1, Vector3 pPos2, out Vector3 pResultHitPos, float pModifyDist)
{
bool result = false;
bool result;
float maxDist = (pPos2 - pPos1).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
Cypher.Assert(maxDist < float.MaxValue);
@@ -344,7 +344,7 @@ namespace Game.Collision
{
if ((pResultHitPos - pPos1).magnitude() > -pModifyDist)
{
pResultHitPos = pResultHitPos + dir * pModifyDist;
pResultHitPos += dir * pModifyDist;
}
else
{
@@ -353,7 +353,7 @@ namespace Game.Collision
}
else
{
pResultHitPos = pResultHitPos + dir * pModifyDist;
pResultHitPos += dir * pModifyDist;
}
result = true;
}
@@ -196,7 +196,6 @@ namespace Game.Collision
void SetLiquidData(WmoLiquid liquid)
{
iLiquid = liquid;
liquid = null;
}
public bool ReadFromFile(BinaryReader reader)
@@ -861,7 +861,7 @@ namespace Scripts.Northrend.IcecrownCitadel
}
}
void UpdateEscortAI(uint diff)
public override void UpdateEscortAI(uint diff)
{
if (_wipeCheckTimer <= diff)
_wipeCheckTimer = 0;
@@ -1029,7 +1029,7 @@ namespace Scripts.Northrend.IcecrownCitadel
{
IsUndead = true;
me.SetDeathState(DeathState.JustRespawned);
uint newEntry = 0;
uint newEntry;
switch (me.GetEntry())
{
case CreatureIds.CaptainArnath:
@@ -1367,7 +1367,7 @@ namespace Scripts.Northrend.IcecrownCitadel
_events.ScheduleEvent(EventTypes.SoulMissile, RandomHelper.URand(1000, 6000));
}
void Update(uint diff)
public override void UpdateAI(uint diff)
{
if (_events.Empty())
return;
@@ -1427,7 +1427,7 @@ namespace Scripts.Northrend.IcecrownCitadel
void HandleEvent(uint effIndex)
{
PreventHitDefaultEffect(effIndex);
uint trapId = 0;
uint trapId;
switch (GetSpellInfo().GetEffect(effIndex).MiscValue)
{
case AwakenWard1:
+1 -2
View File
@@ -983,8 +983,7 @@ namespace Scripts.World.NpcSpecial
if (Coordinates.Empty())
return;
uint patientEntry = 0;
uint patientEntry;
switch (me.GetEntry())
{
case CreatureIds.DoctorAlliance: