Misc cleanups

This commit is contained in:
hondacrx
2020-05-05 19:09:57 -04:00
parent 9ec956becf
commit c3adef77a9
38 changed files with 90 additions and 100 deletions
+1
View File
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<StartupObject>BNetServer.Server</StartupObject> <StartupObject>BNetServer.Server</StartupObject>
<ApplicationIcon>Red.ico</ApplicationIcon> <ApplicationIcon>Red.ico</ApplicationIcon>
<LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+2 -2
View File
@@ -28,7 +28,7 @@ namespace Framework.Dynamic
set set
{ {
_hasValue = value; _hasValue = value;
Value = _hasValue ? new T() : default(T); Value = _hasValue ? new T() : default;
} }
} }
@@ -41,7 +41,7 @@ namespace Framework.Dynamic
public void Clear() public void Clear()
{ {
_hasValue = false; _hasValue = false;
Value = default(T); Value = default;
} }
public static explicit operator T(Optional<T> value) public static explicit operator T(Optional<T> value)
+1
View File
@@ -4,6 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -253,7 +253,7 @@ namespace Framework.GameMath
/// <returns>A string representation of this object.</returns> /// <returns>A string representation of this object.</returns>
public override string ToString() public override string ToString()
{ {
return $"Plane[n={_normal.ToString()}, c={_const.ToString()}]"; return $"Plane[n={_normal}, c={_const}]";
} }
#endregion #endregion
} }
@@ -464,7 +464,7 @@ namespace Game.AI
me.RemoveUnitFlag(UnitFlags.ImmuneToNpc); me.RemoveUnitFlag(UnitFlags.ImmuneToNpc);
} }
Log.outDebug(LogFilter.Scripts, $"EscortAI started. ActiveAttacker = {m_bIsActiveAttacker}, Run = {m_bIsRunning}, PlayerGUID = {m_uiPlayerGUID.ToString()}"); Log.outDebug(LogFilter.Scripts, $"EscortAI started. ActiveAttacker = {m_bIsActiveAttacker}, Run = {m_bIsRunning}, PlayerGUID = {m_uiPlayerGUID}");
CurrentWPIndex = 0; CurrentWPIndex = 0;
+3 -3
View File
@@ -1054,7 +1054,7 @@ namespace Game.AI
if (IsCreature(obj)) if (IsCreature(obj))
{ {
me.SetInCombatWithZone(); me.SetInCombatWithZone();
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {me.GetGUID().ToString()}, Target: {obj.GetGUID().ToString()}"); Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature: {me.GetGUID()}, Target: {obj.GetGUID()}");
} }
} }
@@ -1076,7 +1076,7 @@ namespace Game.AI
var builder = new BroadcastTextBuilder(me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, me.GetGender()); var builder = new BroadcastTextBuilder(me, ChatMsg.Emote, (uint)BroadcastTextIds.CallForHelp, me.GetGender());
Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.MonsterEmote); Global.CreatureTextMgr.SendChatPacket(me, builder, ChatMsg.MonsterEmote);
} }
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {me.GetGUID().ToString()}, Target: {obj.GetGUID().ToString()}"); Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature: {me.GetGUID()}, Target: {obj.GetGUID()}");
} }
} }
break; break;
@@ -2652,7 +2652,7 @@ namespace Game.AI
{ {
obj.ToUnit().SendPlaySpellVisualKit(e.Action.spellVisualKit.spellVisualKitId, e.Action.spellVisualKit.kitType, e.Action.spellVisualKit.duration); obj.ToUnit().SendPlaySpellVisualKit(e.Action.spellVisualKit.spellVisualKitId, e.Action.spellVisualKit.kitType, e.Action.spellVisualKit.duration);
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction:: SMART_ACTION_PLAY_SPELL_VISUAL_KIT: target: {obj.GetName()} ({obj.GetGUID().ToString()}), SpellVisualKit: {e.Action.spellVisualKit.spellVisualKitId}"); Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction:: SMART_ACTION_PLAY_SPELL_VISUAL_KIT: target: {obj.GetName()} ({obj.GetGUID()}), SpellVisualKit: {e.Action.spellVisualKit.spellVisualKitId}");
} }
} }
break; break;
@@ -660,7 +660,7 @@ namespace Game.Achievements
public override string GetOwnerInfo() public override string GetOwnerInfo()
{ {
return $"{_owner.GetGUID().ToString()} {_owner.GetName()}"; return $"{_owner.GetGUID()} {_owner.GetName()}";
} }
Player _owner; Player _owner;
+2 -2
View File
@@ -2210,8 +2210,8 @@ namespace Game.Achievements
return false; return false;
case CriteriaAdditionalCondition.ItemModifiedAppearance: // 200 case CriteriaAdditionalCondition.ItemModifiedAppearance: // 200
{ {
var hasAppearance = referencePlayer.GetSession().GetCollectionMgr().HasItemAppearance(reqValue); var (PermAppearance, TempAppearance) = referencePlayer.GetSession().GetCollectionMgr().HasItemAppearance(reqValue);
if (!hasAppearance.PermAppearance || hasAppearance.TempAppearance) if (!PermAppearance || TempAppearance)
return false; return false;
break; break;
} }
+7 -8
View File
@@ -135,17 +135,17 @@ namespace Game
public string BuildAuctionWonMailBody(ObjectGuid guid, ulong bid, ulong buyout) public string BuildAuctionWonMailBody(ObjectGuid guid, ulong bid, ulong buyout)
{ {
return $"{guid.ToString()}:{bid}:{buyout}:0"; return $"{guid}:{bid}:{buyout}:0";
} }
public string BuildAuctionSoldMailBody(ObjectGuid guid, ulong bid, ulong buyout, uint deposit, ulong consignment) public string BuildAuctionSoldMailBody(ObjectGuid guid, ulong bid, ulong buyout, uint deposit, ulong consignment)
{ {
return $"{guid.ToString()}:{bid}:{buyout}:{deposit}:{consignment}:0"; return $"{guid}:{bid}:{buyout}:{deposit}:{consignment}:0";
} }
public string BuildAuctionInvoiceMailBody(ObjectGuid guid, ulong bid, ulong buyout, uint deposit, ulong consignment, uint moneyDelay, uint eta) public string BuildAuctionInvoiceMailBody(ObjectGuid guid, ulong bid, ulong buyout, uint deposit, ulong consignment, uint moneyDelay, uint eta)
{ {
return $"{guid.ToString()}:{bid}:{buyout}:{deposit}:{consignment}:{moneyDelay}:{eta}:0"; return $"{guid}:{bid}:{buyout}:{deposit}:{consignment}:{moneyDelay}:{eta}:0";
} }
public void LoadAuctions() public void LoadAuctions()
@@ -383,7 +383,7 @@ namespace Game
else else
{ {
// Expire any auctions that we couldn't get a deposit for // Expire any auctions that we couldn't get a deposit for
Log.outWarn(LogFilter.Auctionhouse, $"Player {playerGUID.ToString()} was offline, unable to retrieve deposit!"); Log.outWarn(LogFilter.Auctionhouse, $"Player {playerGUID} was offline, unable to retrieve deposit!");
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
foreach (PendingAuctionInfo pendingAuction in pair.Value.Auctions) foreach (PendingAuctionInfo pendingAuction in pair.Value.Auctions)
@@ -1350,13 +1350,13 @@ namespace Game
public void SendAuctionWon(AuctionPosting auction, Player bidder, SQLTransaction trans) public void SendAuctionWon(AuctionPosting auction, Player bidder, SQLTransaction trans)
{ {
uint bidderAccId = 0; uint bidderAccId;
if (!bidder) if (!bidder)
bidder = Global.ObjAccessor.FindConnectedPlayer(auction.Bidder); // try lookup bidder when called from .Update bidder = Global.ObjAccessor.FindConnectedPlayer(auction.Bidder); // try lookup bidder when called from .Update
// data for gm.log // data for gm.log
string bidderName = ""; string bidderName = "";
bool logGmTrade = false; bool logGmTrade;
if (bidder) if (bidder)
{ {
@@ -1528,7 +1528,6 @@ namespace Game
AuctionHouseRecord _auctionHouse; AuctionHouseRecord _auctionHouse;
SortedList<uint, AuctionPosting> _itemsByAuctionId = new SortedList<uint, AuctionPosting>(); // ordered for replicate SortedList<uint, AuctionPosting> _itemsByAuctionId = new SortedList<uint, AuctionPosting>(); // ordered for replicate
Dictionary<uint, AuctionPosting> _soldItemsById = new Dictionary<uint, AuctionPosting>();
SortedDictionary<AuctionsBucketKey, AuctionsBucketData> _buckets = new SortedDictionary<AuctionsBucketKey, AuctionsBucketData>();// ordered for search by itemid only SortedDictionary<AuctionsBucketKey, AuctionsBucketData> _buckets = new SortedDictionary<AuctionsBucketKey, AuctionsBucketData>();// ordered for search by itemid only
Dictionary<ObjectGuid, CommodityQuote> _commodityQuotes = new Dictionary<ObjectGuid, CommodityQuote>(); Dictionary<ObjectGuid, CommodityQuote> _commodityQuotes = new Dictionary<ObjectGuid, CommodityQuote>();
@@ -1628,7 +1627,7 @@ namespace Game
} }
// all (not optional<>) // all (not optional<>)
auctionItem.DurationLeft = (int)Math.Max((EndTime - GameTime.GetGameTimeSystemPoint()).ToMilliseconds(), 0l); auctionItem.DurationLeft = (int)Math.Max((EndTime - GameTime.GetGameTimeSystemPoint()).ToMilliseconds(), 0L);
auctionItem.DeleteReason = 0; auctionItem.DeleteReason = 0;
// SMSG_AUCTION_LIST_ITEMS_RESULT (only if owned) // SMSG_AUCTION_LIST_ITEMS_RESULT (only if owned)
@@ -327,7 +327,7 @@ namespace Game.Chat
handler.SendSysMessage(CypherStrings.ChangeAccountSuccess, targetName, accountName); handler.SendSysMessage(CypherStrings.ChangeAccountSuccess, targetName, accountName);
string logString = $"changed ownership of player {targetName} ({targetGuid.ToString()}) from account {oldAccountId} to account {newAccountId}"; string logString = $"changed ownership of player {targetName} ({targetGuid}) from account {oldAccountId} to account {newAccountId}";
WorldSession session = handler.GetSession(); WorldSession session = handler.GetSession();
if (session != null) if (session != null)
{ {
+1 -1
View File
@@ -211,7 +211,7 @@ namespace Game.Chat
if (args.Empty()) if (args.Empty())
return false; return false;
uint entry = 0; uint entry;
while ((entry = args.NextUInt32()) != 0) while ((entry = args.NextUInt32()) != 0)
{ {
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE);
+1 -2
View File
@@ -1722,8 +1722,7 @@ namespace Game.DataStorage
public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty = Difficulty.None) public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty = Difficulty.None)
{ {
bool notUsed; return GetSpellPowers(spellId, difficulty, out _);
return GetSpellPowers(spellId, difficulty, out notUsed);
} }
public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty, out bool hasDifficultyPowers) public List<SpellPowerRecord> GetSpellPowers(uint spellId, Difficulty difficulty, out bool hasDifficultyPowers)
+7 -7
View File
@@ -1285,13 +1285,13 @@ namespace Game.DungeonFinding
uint gDungeonId = GetDungeon(gguid); uint gDungeonId = GetDungeon(gguid);
if (gDungeonId != dungeonId) if (gDungeonId != dungeonId)
{ {
Log.outDebug(LogFilter.Lfg, $"Group {gguid.ToString()} finished dungeon {dungeonId} but queued for {gDungeonId}. Ignoring"); Log.outDebug(LogFilter.Lfg, $"Group {gguid} finished dungeon {dungeonId} but queued for {gDungeonId}. Ignoring");
return; return;
} }
if (GetState(gguid) == LfgState.FinishedDungeon) // Shouldn't happen. Do not reward multiple times if (GetState(gguid) == LfgState.FinishedDungeon) // Shouldn't happen. Do not reward multiple times
{ {
Log.outDebug(LogFilter.Lfg, $"Group {gguid.ToString()} already rewarded"); Log.outDebug(LogFilter.Lfg, $"Group {gguid} already rewarded");
return; return;
} }
@@ -1302,7 +1302,7 @@ namespace Game.DungeonFinding
{ {
if (GetState(guid) == LfgState.FinishedDungeon) if (GetState(guid) == LfgState.FinishedDungeon)
{ {
Log.outDebug(LogFilter.Lfg, $"Group: {gguid.ToString()}, Player: {guid.ToString()} already rewarded"); Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} already rewarded");
continue; continue;
} }
@@ -1318,14 +1318,14 @@ namespace Game.DungeonFinding
if (dungeon == null || (dungeon.type != LfgType.RandomDungeon && !dungeon.seasonal)) if (dungeon == null || (dungeon.type != LfgType.RandomDungeon && !dungeon.seasonal))
{ {
Log.outDebug(LogFilter.Lfg, $"Group: {gguid.ToString()}, Player: {guid.ToString()} dungeon {rDungeonId} is not random or seasonal"); Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} dungeon {rDungeonId} is not random or seasonal");
continue; continue;
} }
Player player = Global.ObjAccessor.FindPlayer(guid); Player player = Global.ObjAccessor.FindPlayer(guid);
if (!player || player.GetMap() != currMap) if (!player || player.GetMap() != currMap)
{ {
Log.outDebug(LogFilter.Lfg, $"Group: {gguid.ToString()}, Player: {guid.ToString()} not found in world"); Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} not found in world");
continue; continue;
} }
@@ -1334,7 +1334,7 @@ namespace Game.DungeonFinding
if (player.GetMapId() != mapId) if (player.GetMapId() != mapId)
{ {
Log.outDebug(LogFilter.Lfg, $"Group: {gguid.ToString()}, Player: {guid.ToString()} is in map {player.GetMapId()} and should be in {mapId} to get reward"); Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} is in map {player.GetMapId()} and should be in {mapId} to get reward");
continue; continue;
} }
@@ -1366,7 +1366,7 @@ namespace Game.DungeonFinding
// Give rewards // Give rewards
string doneString = done ? "" : "not"; string doneString = done ? "" : "not";
Log.outDebug(LogFilter.Lfg, $"Group: {gguid.ToString()}, Player: {guid.ToString()} done dungeon {GetDungeon(gguid)}, {doneString} previously done."); Log.outDebug(LogFilter.Lfg, $"Group: {gguid}, Player: {guid} done dungeon {GetDungeon(gguid)}, {doneString} previously done.");
LfgPlayerRewardData data = new LfgPlayerRewardData(dungeon.Entry(), GetDungeon(gguid, false), done, quest); LfgPlayerRewardData data = new LfgPlayerRewardData(dungeon.Entry(), GetDungeon(gguid, false), done, quest);
player.GetSession().SendLfgPlayerReward(data); player.GetSession().SendLfgPlayerReward(data);
} }
@@ -1429,7 +1429,7 @@ namespace Game.Entities
var guid = ChairListSlots.LookupByKey(nearest_slot); var guid = ChairListSlots.LookupByKey(nearest_slot);
if (!guid.IsEmpty()) if (!guid.IsEmpty())
{ {
guid = player.GetGUID(); //this slot in now used by player ChairListSlots[nearest_slot] = player.GetGUID(); //this slot in now used by player
player.TeleportTo(GetMapId(), x_lowest, y_lowest, GetPositionZ(), GetOrientation(), (TeleportToOptions.NotLeaveTransport | TeleportToOptions.NotLeaveCombat | TeleportToOptions.NotUnSummonPet)); player.TeleportTo(GetMapId(), x_lowest, y_lowest, GetPositionZ(), GetOrientation(), (TeleportToOptions.NotLeaveTransport | TeleportToOptions.NotLeaveCombat | TeleportToOptions.NotUnSummonPet));
player.SetStandState(UnitStandStateType.SitLowChair + (byte)info.Chair.chairheight); player.SetStandState(UnitStandStateType.SitLowChair + (byte)info.Chair.chairheight);
return; return;
+2 -7
View File
@@ -1601,7 +1601,7 @@ namespace Game.Entities
return 0; return 0;
float qualityFactor = qualityPrice.Data; float qualityFactor = qualityPrice.Data;
float baseFactor = 0.0f; float baseFactor;
var inventoryType = proto.GetInventoryType(); var inventoryType = proto.GetInventoryType();
@@ -2308,11 +2308,6 @@ namespace Game.Entities
break; break;
case ItemEnchantmentType.ArtifactPowerBonusRankByID: case ItemEnchantmentType.ArtifactPowerBonusRankByID:
{ {
var indexItr = m_artifactPowerIdToIndex.LookupByKey(enchant.EffectArg[i]);
ushort index;
if (indexItr != 0)
index = indexItr;
ushort artifactPowerIndex = m_artifactPowerIdToIndex.LookupByKey(enchant.EffectArg[i]); ushort artifactPowerIndex = m_artifactPowerIdToIndex.LookupByKey(enchant.EffectArg[i]);
if (artifactPowerIndex != 0) if (artifactPowerIndex != 0)
{ {
@@ -2933,7 +2928,7 @@ namespace Game.Entities
break; break;
case ItemBonusType.Stat: case ItemBonusType.Stat:
{ {
uint statIndex = 0; uint statIndex;
for (statIndex = 0; statIndex < ItemConst.MaxStats; ++statIndex) for (statIndex = 0; statIndex < ItemConst.MaxStats; ++statIndex)
if (ItemStatType[statIndex] == values[0] || ItemStatType[statIndex] == -1) if (ItemStatType[statIndex] == values[0] || ItemStatType[statIndex] == -1)
break; break;
+1 -1
View File
@@ -99,7 +99,7 @@ namespace Game.Entities
ulong ownerid = owner.GetGUID().GetCounter(); ulong ownerid = owner.GetGUID().GetCounter();
PreparedStatement stmt = null; PreparedStatement stmt;
if (petnumber != 0) if (petnumber != 0)
{ {
@@ -109,7 +109,7 @@ namespace Game.Entities
public void SaveAccountToys(SQLTransaction trans) public void SaveAccountToys(SQLTransaction trans)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
foreach (var pair in _toys) foreach (var pair in _toys)
{ {
stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS); stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS);
+9 -9
View File
@@ -217,7 +217,7 @@ namespace Game.Entities
item = Bag.NewItemOrBag(proto); item = Bag.NewItemOrBag(proto);
if (item.LoadFromDB(itemGuid, GetGUID(), fields, itemEntry)) if (item.LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
// Do not allow to have item limited to another map/zone in alive state // Do not allow to have item limited to another map/zone in alive state
if (IsAlive() && item.IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) if (IsAlive() && item.IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
@@ -349,7 +349,7 @@ namespace Game.Entities
{ {
if (mSkillStatus.Count >= SkillConst.MaxPlayerSkills) // client limit if (mSkillStatus.Count >= SkillConst.MaxPlayerSkills) // client limit
{ {
Log.outError(LogFilter.Player, $"Player::_LoadSkills: Player '{GetName()}' ({GetGUID().ToString()}) has more than {SkillConst.MaxPlayerSkills} skills."); Log.outError(LogFilter.Player, $"Player::_LoadSkills: Player '{GetName()}' ({GetGUID()}) has more than {SkillConst.MaxPlayerSkills} skills.");
break; break;
} }
@@ -1235,7 +1235,7 @@ namespace Game.Entities
ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(itemEntry); ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(itemEntry);
if (proto == null) if (proto == null)
{ {
Log.outError(LogFilter.Player, $"Player {(player != null ? player.GetName() : "<unknown>")} ({playerGuid.ToString()}) has unknown item in mailed items (GUID: {itemGuid} template: {itemEntry}) in mail ({mailId}), deleted."); Log.outError(LogFilter.Player, $"Player {(player != null ? player.GetName() : "<unknown>")} ({playerGuid}) has unknown item in mailed items (GUID: {itemGuid} template: {itemEntry}) in mail ({mailId}), deleted.");
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
@@ -1657,7 +1657,7 @@ namespace Game.Entities
} }
void _SaveSpells(SQLTransaction trans) void _SaveSpells(SQLTransaction trans)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
foreach (var spell in m_spells.ToList()) foreach (var spell in m_spells.ToList())
{ {
@@ -1767,7 +1767,7 @@ namespace Game.Entities
} }
void _SaveCurrency(SQLTransaction trans) void _SaveCurrency(SQLTransaction trans)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
foreach (var pair in _currencyStorage) foreach (var pair in _currencyStorage)
{ {
CurrencyTypesRecord entry = CliDB.CurrencyTypesStorage.LookupByKey(pair.Key); CurrencyTypesRecord entry = CliDB.CurrencyTypesStorage.LookupByKey(pair.Key);
@@ -2180,7 +2180,7 @@ namespace Game.Entities
foreach (var pair in _equipmentSets) foreach (var pair in _equipmentSets)
{ {
EquipmentSetInfo eqSet = pair.Value; EquipmentSetInfo eqSet = pair.Value;
PreparedStatement stmt = null; PreparedStatement stmt;
byte j = 0; byte j = 0;
switch (eqSet.state) switch (eqSet.state)
{ {
@@ -2271,7 +2271,7 @@ namespace Game.Entities
} }
void _SaveVoidStorage(SQLTransaction trans) void _SaveVoidStorage(SQLTransaction trans)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
for (byte i = 0; i < SharedConst.VoidStorageMaxSlot; ++i) for (byte i = 0; i < SharedConst.VoidStorageMaxSlot; ++i)
{ {
if (_voidStorageItems[i] == null) // unused item if (_voidStorageItems[i] == null) // unused item
@@ -2307,7 +2307,7 @@ namespace Game.Entities
} }
void _SaveCUFProfiles(SQLTransaction trans) void _SaveCUFProfiles(SQLTransaction trans)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
ulong lowGuid = GetGUID().GetCounter(); ulong lowGuid = GetGUID().GetCounter();
for (byte i = 0; i < PlayerConst.MaxCUFProfiles; ++i) for (byte i = 0; i < PlayerConst.MaxCUFProfiles; ++i)
@@ -3144,7 +3144,7 @@ namespace Game.Entities
stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(0, GetGUID().GetCounter());
characterTransaction.Append(stmt); characterTransaction.Append(stmt);
float finiteAlways(float f) { return !float.IsInfinity(f) ? f : 0.0f; }; static float finiteAlways(float f) { return !float.IsInfinity(f) ? f : 0.0f; };
if (create) if (create)
{ {
@@ -593,14 +593,14 @@ namespace Game.Entities
PvpTalentRecord talentInfo = CliDB.PvpTalentStorage.LookupByKey(pvpTalents[slot]); PvpTalentRecord talentInfo = CliDB.PvpTalentStorage.LookupByKey(pvpTalents[slot]);
if (talentInfo == null) if (talentInfo == null)
{ {
Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID().ToString()}) has unknown pvp talent id: {pvpTalents[slot]}"); Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID()}) has unknown pvp talent id: {pvpTalents[slot]}");
continue; continue;
} }
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(talentInfo.SpellID);
if (spellEntry == null) if (spellEntry == null)
{ {
Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID().ToString()}) has unknown pvp talent spell: {talentInfo.SpellID}"); Log.outError(LogFilter.Player, $"Player.SendTalentsInfoData: Player '{GetName()}' ({GetGUID()}) has unknown pvp talent spell: {talentInfo.SpellID}");
continue; continue;
} }
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.3</LangVersion> <LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+4 -8
View File
@@ -841,7 +841,7 @@ namespace Game
WorldLocation loc = new WorldLocation(result.Read<uint>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5)); WorldLocation loc = new WorldLocation(result.Read<uint>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
if (!GridDefines.IsValidMapCoord(loc)) if (!GridDefines.IsValidMapCoord(loc))
{ {
Log.outError(LogFilter.Sql, $"World location (ID: {id}) has a invalid position MapID: {loc.GetMapId()} {loc.ToString()}, skipped"); Log.outError(LogFilter.Sql, $"World location (ID: {id}) has a invalid position MapID: {loc.GetMapId()} {loc}, skipped");
continue; continue;
} }
@@ -3452,10 +3452,8 @@ namespace Game
if (WorldConfig.GetBoolValue(WorldCfg.CalculateCreatureZoneAreaData)) if (WorldConfig.GetBoolValue(WorldCfg.CalculateCreatureZoneAreaData))
{ {
uint zoneId = 0;
uint areaId = 0;
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap); PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);
Global.MapMgr.GetZoneAndAreaId(phaseShift, out zoneId, out areaId, data.mapid, data.posX, data.posY, data.posZ); Global.MapMgr.GetZoneAndAreaId(phaseShift, out uint zoneId, out uint areaId, data.mapid, data.posX, data.posY, data.posZ);
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_ZONE_AREA_DATA); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_ZONE_AREA_DATA);
stmt.AddValue(0, zoneId); stmt.AddValue(0, zoneId);
@@ -4164,10 +4162,8 @@ namespace Game
if (WorldConfig.GetBoolValue(WorldCfg.CalculateGameobjectZoneAreaData)) if (WorldConfig.GetBoolValue(WorldCfg.CalculateGameobjectZoneAreaData))
{ {
uint zoneId = 0;
uint areaId = 0;
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap); PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);
Global.MapMgr.GetZoneAndAreaId(phaseShift, out zoneId, out areaId, data.mapid, data.posX, data.posY, data.posZ); Global.MapMgr.GetZoneAndAreaId(phaseShift, out uint zoneId, out uint areaId, data.mapid, data.posX, data.posY, data.posZ);
PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_GAMEOBJECT_ZONE_AREA_DATA); PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_GAMEOBJECT_ZONE_AREA_DATA);
stmt.AddValue(0, zoneId); stmt.AddValue(0, zoneId);
@@ -9518,7 +9514,7 @@ namespace Game
TaxiNodesRecord node = CliDB.TaxiNodesStorage.LookupByKey(id); TaxiNodesRecord node = CliDB.TaxiNodesStorage.LookupByKey(id);
if (node != null) if (node != null)
{ {
uint mount_entry = 0; uint mount_entry;
if (team == Team.Alliance) if (team == Team.Alliance)
mount_entry = node.MountCreatureID[1]; mount_entry = node.MountCreatureID[1];
else else
+20 -20
View File
@@ -41,7 +41,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(browseQuery.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(browseQuery.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {browseQuery.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {browseQuery.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -51,7 +51,7 @@ namespace Game
AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction()); AuctionHouseObject auctionHouse = Global.AuctionHouseMgr.GetAuctionsMap(creature.GetFaction());
Log.outDebug(LogFilter.Auctionhouse, $"Auctionhouse search ({browseQuery.Auctioneer.ToString()}), searchedname: {browseQuery.Name}, levelmin: {browseQuery.MinLevel}, levelmax: {browseQuery.MaxLevel}, filters: {browseQuery.Filters}"); Log.outDebug(LogFilter.Auctionhouse, $"Auctionhouse search ({browseQuery.Auctioneer}), searchedname: {browseQuery.Name}, levelmin: {browseQuery.MinLevel}, levelmax: {browseQuery.MaxLevel}, filters: {browseQuery.Filters}");
Optional<AuctionSearchClassFilters> classFilters = new Optional<AuctionSearchClassFilters>(); Optional<AuctionSearchClassFilters> classFilters = new Optional<AuctionSearchClassFilters>();
@@ -97,7 +97,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(cancelCommoditiesPurchase.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(cancelCommoditiesPurchase.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {cancelCommoditiesPurchase.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {cancelCommoditiesPurchase.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -119,7 +119,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(confirmCommoditiesPurchase.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(confirmCommoditiesPurchase.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {confirmCommoditiesPurchase.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {confirmCommoditiesPurchase.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -154,7 +154,7 @@ namespace Game
Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Guid, NPCFlags.Auctioneer, NPCFlags2.None); Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Guid, NPCFlags.Auctioneer, NPCFlags2.None);
if (!unit) if (!unit)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionHelloOpcode - {hello.Guid.ToString()} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionHelloOpcode - {hello.Guid} not found or you can't interact with him.");
return; return;
} }
@@ -175,7 +175,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listBidderItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(listBidderItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (!creature) if (!creature)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListBidderItems - {listBidderItems.Auctioneer.ToString()} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListBidderItems - {listBidderItems.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -203,7 +203,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listBucketsByBucketKeys.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(listBucketsByBucketKeys.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {listBucketsByBucketKeys.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {listBucketsByBucketKeys.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -234,7 +234,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listItemsByBucketKey.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(listItemsByBucketKey.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItemsByBucketKey - {listItemsByBucketKey.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItemsByBucketKey - {listItemsByBucketKey.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -266,7 +266,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listItemsByItemID.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(listItemsByItemID.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItemsByItemID - {listItemsByItemID.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItemsByItemID - {listItemsByItemID.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -298,7 +298,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(listOwnerItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(listOwnerItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (!creature) if (!creature)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListOwnerItems - {listOwnerItems.Auctioneer.ToString()} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionListOwnerItems - {listOwnerItems.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -325,7 +325,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(placeBid.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(placeBid.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (!creature) if (!creature)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionPlaceBid - {placeBid.Auctioneer.ToString()} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionPlaceBid - {placeBid.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -455,7 +455,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(removeItem.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(removeItem.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (!creature) if (!creature)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionRemoveItem - {removeItem.Auctioneer.ToString()} not found or you can't interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleAuctionRemoveItem - {removeItem.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -489,7 +489,7 @@ namespace Game
{ {
SendAuctionCommandResult(0, AuctionCommand.Cancel, AuctionResult.DatabaseError, throttle.DelayUntilNext); SendAuctionCommandResult(0, AuctionCommand.Cancel, AuctionResult.DatabaseError, throttle.DelayUntilNext);
//this code isn't possible ... maybe there should be assert //this code isn't possible ... maybe there should be assert
Log.outError(LogFilter.Network, $"CHEATER: {player.GetGUID().ToString()} tried to cancel auction (id: {removeItem.AuctionID}) of another player or auction is null"); Log.outError(LogFilter.Network, $"CHEATER: {player.GetGUID()} tried to cancel auction (id: {removeItem.AuctionID}) of another player or auction is null");
return; return;
} }
@@ -517,7 +517,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(replicateItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(replicateItems.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (!creature) if (!creature)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleReplicateItems - {replicateItems.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleReplicateItems - {replicateItems.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -546,7 +546,7 @@ namespace Game
if (sellCommodity.UnitPrice == 0 || sellCommodity.UnitPrice > PlayerConst.MaxMoneyAmount) if (sellCommodity.UnitPrice == 0 || sellCommodity.UnitPrice > PlayerConst.MaxMoneyAmount)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Player {_player.GetName()} ({_player.GetGUID().ToString()}) attempted to sell item with invalid price."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Player {_player.GetName()} ({_player.GetGUID()}) attempted to sell item with invalid price.");
SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.DatabaseError, throttle.DelayUntilNext); SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.DatabaseError, throttle.DelayUntilNext);
return; return;
} }
@@ -561,7 +561,7 @@ namespace Game
Creature creature = GetPlayer().GetNPCIfCanInteractWith(sellCommodity.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None); Creature creature = GetPlayer().GetNPCIfCanInteractWith(sellCommodity.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
if (creature == null) if (creature == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {sellCommodity.Auctioneer.ToString()} not found or you can't interact with him."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionListItems - {sellCommodity.Auctioneer} not found or you can't interact with him.");
return; return;
} }
@@ -569,7 +569,7 @@ namespace Game
AuctionHouseRecord auctionHouseEntry = Global.AuctionHouseMgr.GetAuctionHouseEntry(creature.GetFaction(), ref houseId); AuctionHouseRecord auctionHouseEntry = Global.AuctionHouseMgr.GetAuctionHouseEntry(creature.GetFaction(), ref houseId);
if (auctionHouseEntry == null) if (auctionHouseEntry == null)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Unit ({sellCommodity.Auctioneer.ToString()}) has wrong faction."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Unit ({sellCommodity.Auctioneer}) has wrong faction.");
return; return;
} }
@@ -771,7 +771,7 @@ namespace Game
if (sellItem.MinBid > PlayerConst.MaxMoneyAmount || sellItem.BuyoutPrice > PlayerConst.MaxMoneyAmount) if (sellItem.MinBid > PlayerConst.MaxMoneyAmount || sellItem.BuyoutPrice > PlayerConst.MaxMoneyAmount)
{ {
Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Player {_player.GetName()} ({_player.GetGUID().ToString()}) attempted to sell item with higher price than max gold amount."); Log.outError(LogFilter.Network, $"WORLD: HandleAuctionSellItem - Player {_player.GetName()} ({_player.GetGUID()}) attempted to sell item with higher price than max gold amount.");
SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.Inventory, throttle.DelayUntilNext, InventoryResult.TooMuchGold); SendAuctionCommandResult(0, AuctionCommand.SellItem, AuctionResult.Inventory, throttle.DelayUntilNext, InventoryResult.TooMuchGold);
return; return;
} }
@@ -862,8 +862,8 @@ namespace Game
auction.Items.Add(item); auction.Items.Add(item);
Log.outInfo(LogFilter.Network, $"CMSG_AuctionAction.SellItem: {_player.GetGUID().ToString()} {_player.GetName()} is selling item {item.GetGUID().ToString()} {item.GetTemplate().GetName()} " + Log.outInfo(LogFilter.Network, $"CMSG_AuctionAction.SellItem: {_player.GetGUID()} {_player.GetName()} is selling item {item.GetGUID()} {item.GetTemplate().GetName()} " +
$"to auctioneer {creature.GetGUID().ToString()} with count {item.GetCount()} with initial bid {sellItem.MinBid} with buyout {sellItem.BuyoutPrice} and with time {auctionTime.TotalSeconds} " + $"to auctioneer {creature.GetGUID()} with count {item.GetCount()} with initial bid {sellItem.MinBid} with buyout {sellItem.BuyoutPrice} and with time {auctionTime.TotalSeconds} " +
$"(in sec) in auctionhouse {auctionHouse.GetAuctionHouseId()}"); $"(in sec) in auctionhouse {auctionHouse.GetAuctionHouseId()}");
// Add to pending auctions, or fail with insufficient funds error // Add to pending auctions, or fail with insufficient funds error
+1 -1
View File
@@ -60,7 +60,7 @@ namespace Game
if (battlemasterJoin.QueueIDs.Empty()) if (battlemasterJoin.QueueIDs.Empty())
{ {
Log.outError(LogFilter.Network, $"Battleground: no bgtype received. possible cheater? {_player.GetGUID().ToString()}"); Log.outError(LogFilter.Network, $"Battleground: no bgtype received. possible cheater? {_player.GetGUID()}");
return; return;
} }
+1 -1
View File
@@ -1399,7 +1399,7 @@ namespace Game
if (!CliDB.ItemModifiedAppearanceStorage.ContainsKey(saveEquipmentSet.Set.Appearances[i])) if (!CliDB.ItemModifiedAppearanceStorage.ContainsKey(saveEquipmentSet.Set.Appearances[i]))
return; return;
(bool hasAppearance, bool isTemporary) = GetCollectionMgr().HasItemAppearance((uint)saveEquipmentSet.Set.Appearances[i]); (bool hasAppearance, _) = GetCollectionMgr().HasItemAppearance((uint)saveEquipmentSet.Set.Appearances[i]);
if (!hasAppearance) if (!hasAppearance)
return; return;
} }
+1 -1
View File
@@ -1097,7 +1097,7 @@ namespace Game
Item item = _player.GetItemByGuid(removeNewItem.ItemGuid); Item item = _player.GetItemByGuid(removeNewItem.ItemGuid);
if (!item) if (!item)
{ {
Log.outDebug(LogFilter.Network, $"WorldSession.HandleRemoveNewItem: Item ({removeNewItem.ItemGuid.ToString()}) not found for {GetPlayerInfo()}!"); Log.outDebug(LogFilter.Network, $"WorldSession.HandleRemoveNewItem: Item ({removeNewItem.ItemGuid}) not found for {GetPlayerInfo()}!");
return; return;
} }
+1 -1
View File
@@ -144,7 +144,7 @@ namespace Game
byte mailsCount = 0; //do not allow to send to one player more than 100 mails byte mailsCount = 0; //do not allow to send to one player more than 100 mails
byte receiverLevel = 0; byte receiverLevel = 0;
uint receiverAccountId = 0; uint receiverAccountId = 0;
uint receiverBnetAccountId = 0; uint receiverBnetAccountId;
if (receiver) if (receiver)
{ {
+2 -2
View File
@@ -630,7 +630,7 @@ namespace Game
// prevent tampered movement data // prevent tampered movement data
if (moveApplyMovementForceAck.Ack.Status.Guid != mover.GetGUID()) if (moveApplyMovementForceAck.Ack.Status.Guid != mover.GetGUID())
{ {
Log.outError(LogFilter.Network, $"HandleMoveApplyMovementForceAck: guid error, expected {mover.GetGUID().ToString()}, got {moveApplyMovementForceAck.Ack.Status.Guid.ToString()}"); Log.outError(LogFilter.Network, $"HandleMoveApplyMovementForceAck: guid error, expected {mover.GetGUID()}, got {moveApplyMovementForceAck.Ack.Status.Guid}");
return; return;
} }
@@ -652,7 +652,7 @@ namespace Game
// prevent tampered movement data // prevent tampered movement data
if (moveRemoveMovementForceAck.Ack.Status.Guid != mover.GetGUID()) if (moveRemoveMovementForceAck.Ack.Status.Guid != mover.GetGUID())
{ {
Log.outError(LogFilter.Network, $"HandleMoveRemoveMovementForceAck: guid error, expected {mover.GetGUID().ToString()}, got {moveRemoveMovementForceAck.Ack.Status.Guid.ToString()}"); Log.outError(LogFilter.Network, $"HandleMoveRemoveMovementForceAck: guid error, expected {mover.GetGUID()}, got {moveRemoveMovementForceAck.Ack.Status.Guid}");
return; return;
} }
+3 -3
View File
@@ -59,7 +59,7 @@ namespace Game
Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer, NPCFlags2.None); Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer, NPCFlags2.None);
if (!npc) if (!npc)
{ {
Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - {packet.Unit.ToString()} not found or you can not interact with him."); Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - {packet.Unit} not found or you can not interact with him.");
return; return;
} }
@@ -79,7 +79,7 @@ namespace Game
Trainer trainer = Global.ObjectMgr.GetTrainer(trainerId); Trainer trainer = Global.ObjectMgr.GetTrainer(trainerId);
if (trainer == null) if (trainer == null)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: SendTrainerList - trainer spells not found for trainer {npc.GetGUID().ToString()} id {trainerId}"); Log.outDebug(LogFilter.Network, $"WORLD: SendTrainerList - trainer spells not found for trainer {npc.GetGUID()} id {trainerId}");
return; return;
} }
@@ -95,7 +95,7 @@ namespace Game
Creature npc = _player.GetNPCIfCanInteractWith(packet.TrainerGUID, NPCFlags.Trainer, NPCFlags2.None); Creature npc = _player.GetNPCIfCanInteractWith(packet.TrainerGUID, NPCFlags.Trainer, NPCFlags2.None);
if (npc == null) if (npc == null)
{ {
Log.outDebug(LogFilter.Network, $"WORLD: HandleTrainerBuySpell - {packet.TrainerGUID.ToString()} not found or you can not interact with him."); Log.outDebug(LogFilter.Network, $"WORLD: HandleTrainerBuySpell - {packet.TrainerGUID} not found or you can not interact with him.");
return; return;
} }
+1 -1
View File
@@ -209,7 +209,7 @@ namespace Game
if (result.IsEmpty()) if (result.IsEmpty())
{ {
Log.outError(LogFilter.Network, $"Wrapped item {item.GetGUID().ToString()} don't have record in character_gifts table and will deleted"); Log.outError(LogFilter.Network, $"Wrapped item {item.GetGUID()} don't have record in character_gifts table and will deleted");
GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true); GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
return; return;
} }
+1 -2
View File
@@ -469,8 +469,7 @@ namespace Game.Loots
public LootItem LootItemInSlot(uint lootSlot, Player player) public LootItem LootItemInSlot(uint lootSlot, Player player)
{ {
NotNormalLootItem qitem, ffaitem, conditem; return LootItemInSlot(lootSlot, player, out _, out _, out _);
return LootItemInSlot(lootSlot, player, out qitem, out ffaitem, out conditem);
} }
public LootItem LootItemInSlot(uint lootSlot, Player player, out NotNormalLootItem qitem, out NotNormalLootItem ffaitem, out NotNormalLootItem conditem) public LootItem LootItemInSlot(uint lootSlot, Player player, out NotNormalLootItem qitem, out NotNormalLootItem ffaitem, out NotNormalLootItem conditem)
{ {
-1
View File
@@ -328,7 +328,6 @@ namespace Game.Movement
if (transport != null) if (transport != null)
{ {
float unused = 0.0f; // need reference float unused = 0.0f; // need reference
transport.CalculatePassengerOffset(ref x, ref y, ref z, ref unused); transport.CalculatePassengerOffset(ref x, ref y, ref z, ref unused);
} }
} }
+3 -3
View File
@@ -156,14 +156,14 @@ namespace Game.Network
if (!_worldCrypt.Decrypt(ref data, header.Tag)) if (!_worldCrypt.Decrypt(ref data, header.Tag))
{ {
Log.outError(LogFilter.Network, $"WorldSocket.ReadHandler(): client {GetRemoteIpAddress().ToString()} failed to decrypt packet (size: {header.Size})"); Log.outError(LogFilter.Network, $"WorldSocket.ReadHandler(): client {GetRemoteIpAddress()} failed to decrypt packet (size: {header.Size})");
return; return;
} }
WorldPacket worldPacket = new WorldPacket(data); WorldPacket worldPacket = new WorldPacket(data);
if (worldPacket.GetOpcode() >= (int)ClientOpcodes.Max) if (worldPacket.GetOpcode() >= (int)ClientOpcodes.Max)
{ {
Log.outError(LogFilter.Network, $"WorldSocket.ReadHandler(): client {GetRemoteIpAddress().ToString()} sent wrong opcode (opcode: {worldPacket.GetOpcode()})"); Log.outError(LogFilter.Network, $"WorldSocket.ReadHandler(): client {GetRemoteIpAddress()} sent wrong opcode (opcode: {worldPacket.GetOpcode()})");
return; return;
} }
@@ -395,7 +395,7 @@ namespace Game.Network
if (buildInfo == null) if (buildInfo == null)
{ {
SendAuthResponseError(BattlenetRpcErrorCode.BadVersion); SendAuthResponseError(BattlenetRpcErrorCode.BadVersion);
Log.outError(LogFilter.Network, $"WorldSocket.HandleAuthSessionCallback: Missing auth seed for realm build {Global.WorldMgr.GetRealm().Build} ({GetRemoteIpAddress().ToString()})."); Log.outError(LogFilter.Network, $"WorldSocket.HandleAuthSessionCallback: Missing auth seed for realm build {Global.WorldMgr.GetRealm().Build} ({GetRemoteIpAddress()}).");
CloseSocket(); CloseSocket();
return; return;
} }
@@ -312,7 +312,7 @@ namespace Game
public override string GetOwnerInfo() public override string GetOwnerInfo()
{ {
return $"{_owner.GetGUID().ToString()} {_owner.GetName()}"; return $"{_owner.GetGUID()} {_owner.GetName()}";
} }
public override List<Criteria> GetCriteriaByType(CriteriaTypes type) public override List<Criteria> GetCriteriaByType(CriteriaTypes type)
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Game
Values[WorldCfg.EnableSinfoLogin] = GetDefaultValue("Server.LoginInfo", 0); Values[WorldCfg.EnableSinfoLogin] = GetDefaultValue("Server.LoginInfo", 0);
// Read all rates from the config file // Read all rates from the config file
void SetRegenRate(WorldCfg rate, string configKey) static void SetRegenRate(WorldCfg rate, string configKey)
{ {
Values[rate] = GetDefaultValue(configKey, 1.0f); Values[rate] = GetDefaultValue(configKey, 1.0f);
if ((float) Values[rate] < 0.0f) if ((float) Values[rate] < 0.0f)
+2 -2
View File
@@ -1444,7 +1444,7 @@ namespace Game
return BanReturn.Exists; return BanReturn.Exists;
SQLResult resultAccounts; SQLResult resultAccounts;
PreparedStatement stmt = null; PreparedStatement stmt;
// Update the database with ban information // Update the database with ban information
switch (mode) switch (mode)
@@ -1522,7 +1522,7 @@ namespace Game
/// Remove a ban from an account or IP address /// Remove a ban from an account or IP address
public bool RemoveBanAccount(BanMode mode, string nameOrIP) public bool RemoveBanAccount(BanMode mode, string nameOrIP)
{ {
PreparedStatement stmt = null; PreparedStatement stmt;
if (mode == BanMode.IP) if (mode == BanMode.IP)
{ {
stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_IP_NOT_BANNED); stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_IP_NOT_BANNED);
-1
View File
@@ -1972,7 +1972,6 @@ namespace Game.Entities
Dictionary<uint, SpellInfoLoadHelper> loadData = new Dictionary<uint, SpellInfoLoadHelper>(); Dictionary<uint, SpellInfoLoadHelper> loadData = new Dictionary<uint, SpellInfoLoadHelper>();
Dictionary<uint, BattlePetSpeciesRecord> battlePetSpeciesByCreature = new Dictionary<uint, BattlePetSpeciesRecord>(); Dictionary<uint, BattlePetSpeciesRecord> battlePetSpeciesByCreature = new Dictionary<uint, BattlePetSpeciesRecord>();
Dictionary<uint, BattlePetSpeciesRecord> battlePetSpeciesBySpellId = new Dictionary<uint, BattlePetSpeciesRecord>();
foreach (var battlePetSpecies in CliDB.BattlePetSpeciesStorage.Values) foreach (var battlePetSpecies in CliDB.BattlePetSpeciesStorage.Values)
if (battlePetSpecies.CreatureID != 0) if (battlePetSpecies.CreatureID != 0)
battlePetSpeciesByCreature[battlePetSpecies.CreatureID] = battlePetSpecies; battlePetSpeciesByCreature[battlePetSpecies.CreatureID] = battlePetSpecies;
+1
View File
@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+1
View File
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<ApplicationIcon>Blue.ico</ApplicationIcon> <ApplicationIcon>Blue.ico</ApplicationIcon>
<StartupObject>WorldServer.Server</StartupObject> <StartupObject>WorldServer.Server</StartupObject>
<LangVersion>8.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>