diff --git a/Source/Game/Chat/Commands/ModifyCommands.cs b/Source/Game/Chat/Commands/ModifyCommands.cs index bacde1897..319ab0648 100644 --- a/Source/Game/Chat/Commands/ModifyCommands.cs +++ b/Source/Game/Chat/Commands/ModifyCommands.cs @@ -15,13 +15,14 @@ namespace Game.Chat class ModifyCommand { [Command("hp", RBACPermissions.CommandModifyHp)] - static bool HandleModifyHPCommand(CommandHandler handler, int hp, int? maxHp) + static bool HandleModifyHPCommand(CommandHandler handler, int hp) { Player target = handler.GetSelectedPlayerOrSelf(); + int maxHp = 1; if (CheckModifyResources(handler, target, ref hp, ref maxHp)) { NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, maxHp); - target.SetMaxHealth((uint)maxHp.Value); + target.SetMaxHealth((uint)maxHp); target.SetHealth((uint)hp); return true; } @@ -29,14 +30,14 @@ namespace Game.Chat } [Command("mana", RBACPermissions.CommandModifyMana)] - static bool HandleModifyManaCommand(CommandHandler handler, int mana, int? maxMana) + static bool HandleModifyManaCommand(CommandHandler handler, int mana) { Player target = handler.GetSelectedPlayerOrSelf(); - + int maxMana = 1; if (CheckModifyResources(handler, target, ref mana, ref maxMana)) { - NotifyModification(handler, target, CypherStrings.YouChangeMana, CypherStrings.YoursManaChanged, mana, maxMana.Value); - target.SetMaxPower(PowerType.Mana, maxMana.Value); + NotifyModification(handler, target, CypherStrings.YouChangeMana, CypherStrings.YoursManaChanged, mana, maxMana); + target.SetMaxPower(PowerType.Mana, maxMana); target.SetPower(PowerType.Mana, mana); return true; } @@ -45,14 +46,15 @@ namespace Game.Chat } [Command("energy", RBACPermissions.CommandModifyEnergy)] - static bool HandleModifyEnergyCommand(CommandHandler handler, int energy, int? maxEnergy) + static bool HandleModifyEnergyCommand(CommandHandler handler, int energy) { Player target = handler.GetSelectedPlayerOrSelf(); byte energyMultiplier = 10; + int maxEnergy = 1; if (CheckModifyResources(handler, target, ref energy, ref maxEnergy, energyMultiplier)) { - NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, maxEnergy.Value / energyMultiplier); - target.SetMaxPower(PowerType.Energy, maxEnergy.Value); + NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, maxEnergy / energyMultiplier); + target.SetMaxPower(PowerType.Energy, maxEnergy); target.SetPower(PowerType.Energy, energy); return true; } @@ -60,14 +62,15 @@ namespace Game.Chat } [Command("rage", RBACPermissions.CommandModifyRage)] - static bool HandleModifyRageCommand(CommandHandler handler, int rage, int? maxRage) + static bool HandleModifyRageCommand(CommandHandler handler, int rage) { Player target = handler.GetSelectedPlayerOrSelf(); byte rageMultiplier = 10; + int maxRage = 1; if (CheckModifyResources(handler, target, ref rage, ref maxRage, rageMultiplier)) { - NotifyModification(handler, target, CypherStrings.YouChangeRage, CypherStrings.YoursRageChanged, rage / rageMultiplier, maxRage.Value / rageMultiplier); - target.SetMaxPower(PowerType.Rage, maxRage.Value); + NotifyModification(handler, target, CypherStrings.YouChangeRage, CypherStrings.YoursRageChanged, rage / rageMultiplier, maxRage / rageMultiplier); + target.SetMaxPower(PowerType.Rage, maxRage); target.SetPower(PowerType.Rage, rage); return true; } @@ -75,14 +78,15 @@ namespace Game.Chat } [Command("runicpower", RBACPermissions.CommandModifyRunicpower)] - static bool HandleModifyRunicPowerCommand(CommandHandler handler, int rune, int? maxRune) + static bool HandleModifyRunicPowerCommand(CommandHandler handler, int rune) { Player target = handler.GetSelectedPlayerOrSelf(); byte runeMultiplier = 10; + int maxRune = 1; if (CheckModifyResources(handler, target, ref rune, ref maxRune, runeMultiplier)) { - NotifyModification(handler, target, CypherStrings.YouChangeRunicPower, CypherStrings.YoursRunicPowerChanged, rune / runeMultiplier, maxRune.Value / runeMultiplier); - target.SetMaxPower(PowerType.RunicPower, maxRune.Value); + NotifyModification(handler, target, CypherStrings.YouChangeRunicPower, CypherStrings.YoursRunicPowerChanged, rune / runeMultiplier, maxRune / runeMultiplier); + target.SetMaxPower(PowerType.RunicPower, maxRune); target.SetPower(PowerType.RunicPower, rune); return true; } @@ -816,7 +820,7 @@ namespace Game.Chat } } - static bool CheckModifyResources(CommandHandler handler, Player target, ref int res, ref int? resmax, byte multiplier = 1) + static bool CheckModifyResources(CommandHandler handler, Player target, ref int res, ref int resmax, byte multiplier = 1) { res *= multiplier; resmax *= multiplier; diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index 55543590b..c5ae3b298 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -3030,7 +3030,8 @@ namespace Game "ConversationLine", "AreaTrigger Client Triggered", "Trainer Spell", - "Object Visibility (by ID)" + "Object Visibility (by ID)", + "Spawn Group" }; public ConditionTypeInfo[] StaticConditionTypeData = diff --git a/Source/Game/DataStorage/ClientReader/DBReader.cs b/Source/Game/DataStorage/ClientReader/DBReader.cs index 6b8b6f1d2..e28fc1fcd 100644 --- a/Source/Game/DataStorage/ClientReader/DBReader.cs +++ b/Source/Game/DataStorage/ClientReader/DBReader.cs @@ -90,13 +90,11 @@ namespace Game.DataStorage } } - long previousStringTableSize = 0; long previousRecordCount = 0; for (int sectionIndex = 0; sectionIndex < Header.SectionsCount; sectionIndex++) { if (sections[sectionIndex].TactKeyLookup != 0)// && !hasTactKeyFunc(sections[sectionIndex].TactKeyLookup)) { - previousStringTableSize += sections[sectionIndex].StringTableSize; previousRecordCount += sections[sectionIndex].NumRecords; //Console.WriteLine("Detected db2 with encrypted section! HasKey {0}", CASC.HasKey(Sections[sectionIndex].TactKeyLookup)); continue; @@ -116,17 +114,11 @@ namespace Game.DataStorage // string data stringsTable = new Dictionary(); - long stringDataOffset = 0; - if (sectionIndex == 0) - stringDataOffset = (Header.RecordCount - sections[sectionIndex].NumRecords) * Header.RecordSize; - else - stringDataOffset = previousStringTableSize; - for (int i = 0; i < sections[sectionIndex].StringTableSize;) { long oldPos = reader.BaseStream.Position; - stringsTable[i + stringDataOffset] = reader.ReadCString(); + stringsTable[i] = reader.ReadCString(); i += (int)(reader.BaseStream.Position - oldPos); } @@ -220,7 +212,6 @@ namespace Game.DataStorage } } - previousStringTableSize += sections[sectionIndex].StringTableSize; previousRecordCount += sections[sectionIndex].NumRecords; } } diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index 5e8682eb4..c894bd0c1 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -390,7 +390,7 @@ namespace Game.Entities { if (missingQuest != 0 && !string.IsNullOrEmpty(ar.questFailedText)) SendSysMessage("{0}", ar.questFailedText); - else if (mapDiff.Message[Global.WorldMgr.GetDefaultDbcLocale()][0] != '\0' || failedMapDifficultyXCondition != 0) // if (missingAchievement) covered by this case + else if (!mapDiff.Message[Global.WorldMgr.GetDefaultDbcLocale()].IsEmpty() && mapDiff.Message[Global.WorldMgr.GetDefaultDbcLocale()][0] != '\0' || failedMapDifficultyXCondition != 0) // if (missingAchievement) covered by this case { if (abortParams != null) { diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index bfe80bc73..6dab68648 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -813,10 +813,10 @@ namespace Game // Send PVPSeason { SeasonInfo seasonInfo = new(); - seasonInfo.MythicPlusMilestoneSeasonID = (WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId) - (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress) ? 1 : 0)); + seasonInfo.PreviousArenaSeason = (WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId) - (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress) ? 1 : 0)); if (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress)) - seasonInfo.PreviousArenaSeason = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId); + seasonInfo.CurrentArenaSeason = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId); SendPacket(seasonInfo); } diff --git a/Source/Game/Networking/Packets/AchievementPackets.cs b/Source/Game/Networking/Packets/AchievementPackets.cs index 5123f2333..bf72b2464 100644 --- a/Source/Game/Networking/Packets/AchievementPackets.cs +++ b/Source/Game/Networking/Packets/AchievementPackets.cs @@ -60,7 +60,7 @@ namespace Game.Networking.Packets _worldPacket.WritePackedGuid(PlayerGUID); _worldPacket.WriteUInt32(Flags); _worldPacket.WritePackedTime(CurrentTime); - _worldPacket.WriteUInt32(ElapsedTime); + _worldPacket.WriteInt64(ElapsedTime); _worldPacket.WriteInt64(CreationTime); _worldPacket.WriteBit(RafAcceptanceID.HasValue); _worldPacket.FlushBits(); @@ -74,7 +74,7 @@ namespace Game.Networking.Packets public ObjectGuid PlayerGUID; public uint Flags; public long CurrentTime; - public uint ElapsedTime; + public long ElapsedTime; public long CreationTime; public ulong? RafAcceptanceID; } @@ -319,8 +319,8 @@ namespace Game.Networking.Packets data.WriteUInt64(Quantity); data.WritePackedGuid(Player); data.WritePackedTime(Date); - data.WriteUInt32(TimeFromStart); - data.WriteUInt32(TimeFromCreate); + data.WriteInt64(TimeFromStart); + data.WriteInt64(TimeFromCreate); data.WriteBits(Flags, 4); data.WriteBit(RafAcceptanceID.HasValue); data.FlushBits(); @@ -334,8 +334,8 @@ namespace Game.Networking.Packets public ObjectGuid Player; public uint Flags; public long Date; - public uint TimeFromStart; - public uint TimeFromCreate; + public long TimeFromStart; + public long TimeFromCreate; public ulong? RafAcceptanceID; } diff --git a/Source/Game/Networking/Packets/BattlenetPackets.cs b/Source/Game/Networking/Packets/BattlenetPackets.cs index 279d96231..bbd4374da 100644 --- a/Source/Game/Networking/Packets/BattlenetPackets.cs +++ b/Source/Game/Networking/Packets/BattlenetPackets.cs @@ -51,7 +51,7 @@ namespace Game.Networking.Packets } public byte State; - public bool SuppressNotification; + public bool SuppressNotification = true; } class ChangeRealmTicketResponse : ServerPacket diff --git a/Source/Game/Networking/Packets/SpellPackets.cs b/Source/Game/Networking/Packets/SpellPackets.cs index 9d18019d7..500c73814 100644 --- a/Source/Game/Networking/Packets/SpellPackets.cs +++ b/Source/Game/Networking/Packets/SpellPackets.cs @@ -1657,8 +1657,8 @@ namespace Game.Networking.Packets SendCastFlags = data.ReadBits(5); bool hasMoveUpdate = data.HasBit(); - bool hasCraftingOrderID = data.HasBit(); var weightCount = data.ReadBits(2); + bool hasCraftingOrderID = data.HasBit(); Target.Read(data); diff --git a/Source/Game/Networking/Packets/SystemPackets.cs b/Source/Game/Networking/Packets/SystemPackets.cs index 0c9874d3f..40f76cb69 100644 --- a/Source/Game/Networking/Packets/SystemPackets.cs +++ b/Source/Game/Networking/Packets/SystemPackets.cs @@ -375,7 +375,6 @@ namespace Game.Networking.Packets _worldPacket.WriteString(ServerTimeTZ); _worldPacket.WriteString(GameTimeTZ); _worldPacket.WriteString(ServerRegionalTZ); - } public string ServerTimeTZ; diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index f676c3435..d657515fe 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -28,17 +28,6 @@ namespace Game.Spells m_spellInfo = info; m_caster = (info.HasAttribute(SpellAttr6.OriginateFromController) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster); m_spellValue = new SpellValue(m_spellInfo, caster); - m_castItemLevel = -1; - - if (IsIgnoringCooldowns()) - m_castFlagsEx |= SpellCastFlagsEx.IgnoreCooldown; - - m_castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, m_caster.GetMapId(), m_spellInfo.Id, m_caster.GetMap().GenerateLowGuid(HighGuid.Cast)); - m_originalCastId = originalCastId; - m_SpellVisual.SpellXSpellVisualID = caster.GetCastSpellXSpellVisualId(m_spellInfo); - - m_customError = SpellCustomErrors.None; - m_fromClient = false; m_needComboPoints = m_spellInfo.NeedsComboPoints(); // Get data for type of attack @@ -79,7 +68,6 @@ namespace Game.Spells m_originalCaster = null; } - m_spellState = SpellState.None; _triggeredCastFlags = triggerFlags; if (info.HasAttribute(SpellAttr2.DoNotReportSpellFailure)) @@ -88,7 +76,14 @@ namespace Game.Spells if (m_spellInfo.HasAttribute(SpellAttr4.AllowCastWhileCasting)) _triggeredCastFlags = _triggeredCastFlags | TriggerCastFlags.IgnoreCastInProgress; - effectHandleMode = SpellEffectHandleMode.Launch; + m_castItemLevel = -1; + + if (IsIgnoringCooldowns()) + m_castFlagsEx |= SpellCastFlagsEx.IgnoreCooldown; + + m_castId = ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, m_caster.GetMapId(), m_spellInfo.Id, m_caster.GetMap().GenerateLowGuid(HighGuid.Cast)); + m_originalCastId = originalCastId; + m_SpellVisual.SpellXSpellVisualID = caster.GetCastSpellXSpellVisualId(m_spellInfo); //Auto Shot & Shoot (wand) m_autoRepeat = m_spellInfo.IsAutoRepeatRangedSpell(); @@ -104,7 +99,6 @@ namespace Game.Spells for (var i = 0; i < SpellConst.MaxEffects; ++i) m_destTargets[i] = new SpellDestination(m_caster); - //not sure needed. m_targets = new SpellCastTargets(); m_appliedMods = new List(); }