Some startup fixes and cleanups
This commit is contained in:
@@ -15,13 +15,14 @@ namespace Game.Chat
|
|||||||
class ModifyCommand
|
class ModifyCommand
|
||||||
{
|
{
|
||||||
[Command("hp", RBACPermissions.CommandModifyHp)]
|
[Command("hp", RBACPermissions.CommandModifyHp)]
|
||||||
static bool HandleModifyHPCommand(CommandHandler handler, int hp, int? maxHp)
|
static bool HandleModifyHPCommand(CommandHandler handler, int hp)
|
||||||
{
|
{
|
||||||
Player target = handler.GetSelectedPlayerOrSelf();
|
Player target = handler.GetSelectedPlayerOrSelf();
|
||||||
|
int maxHp = 1;
|
||||||
if (CheckModifyResources(handler, target, ref hp, ref maxHp))
|
if (CheckModifyResources(handler, target, ref hp, ref maxHp))
|
||||||
{
|
{
|
||||||
NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, maxHp);
|
NotifyModification(handler, target, CypherStrings.YouChangeHp, CypherStrings.YoursHpChanged, hp, maxHp);
|
||||||
target.SetMaxHealth((uint)maxHp.Value);
|
target.SetMaxHealth((uint)maxHp);
|
||||||
target.SetHealth((uint)hp);
|
target.SetHealth((uint)hp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -29,14 +30,14 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("mana", RBACPermissions.CommandModifyMana)]
|
[Command("mana", RBACPermissions.CommandModifyMana)]
|
||||||
static bool HandleModifyManaCommand(CommandHandler handler, int mana, int? maxMana)
|
static bool HandleModifyManaCommand(CommandHandler handler, int mana)
|
||||||
{
|
{
|
||||||
Player target = handler.GetSelectedPlayerOrSelf();
|
Player target = handler.GetSelectedPlayerOrSelf();
|
||||||
|
int maxMana = 1;
|
||||||
if (CheckModifyResources(handler, target, ref mana, ref maxMana))
|
if (CheckModifyResources(handler, target, ref mana, ref maxMana))
|
||||||
{
|
{
|
||||||
NotifyModification(handler, target, CypherStrings.YouChangeMana, CypherStrings.YoursManaChanged, mana, maxMana.Value);
|
NotifyModification(handler, target, CypherStrings.YouChangeMana, CypherStrings.YoursManaChanged, mana, maxMana);
|
||||||
target.SetMaxPower(PowerType.Mana, maxMana.Value);
|
target.SetMaxPower(PowerType.Mana, maxMana);
|
||||||
target.SetPower(PowerType.Mana, mana);
|
target.SetPower(PowerType.Mana, mana);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -45,14 +46,15 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("energy", RBACPermissions.CommandModifyEnergy)]
|
[Command("energy", RBACPermissions.CommandModifyEnergy)]
|
||||||
static bool HandleModifyEnergyCommand(CommandHandler handler, int energy, int? maxEnergy)
|
static bool HandleModifyEnergyCommand(CommandHandler handler, int energy)
|
||||||
{
|
{
|
||||||
Player target = handler.GetSelectedPlayerOrSelf();
|
Player target = handler.GetSelectedPlayerOrSelf();
|
||||||
byte energyMultiplier = 10;
|
byte energyMultiplier = 10;
|
||||||
|
int maxEnergy = 1;
|
||||||
if (CheckModifyResources(handler, target, ref energy, ref maxEnergy, energyMultiplier))
|
if (CheckModifyResources(handler, target, ref energy, ref maxEnergy, energyMultiplier))
|
||||||
{
|
{
|
||||||
NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, maxEnergy.Value / energyMultiplier);
|
NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, maxEnergy / energyMultiplier);
|
||||||
target.SetMaxPower(PowerType.Energy, maxEnergy.Value);
|
target.SetMaxPower(PowerType.Energy, maxEnergy);
|
||||||
target.SetPower(PowerType.Energy, energy);
|
target.SetPower(PowerType.Energy, energy);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -60,14 +62,15 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("rage", RBACPermissions.CommandModifyRage)]
|
[Command("rage", RBACPermissions.CommandModifyRage)]
|
||||||
static bool HandleModifyRageCommand(CommandHandler handler, int rage, int? maxRage)
|
static bool HandleModifyRageCommand(CommandHandler handler, int rage)
|
||||||
{
|
{
|
||||||
Player target = handler.GetSelectedPlayerOrSelf();
|
Player target = handler.GetSelectedPlayerOrSelf();
|
||||||
byte rageMultiplier = 10;
|
byte rageMultiplier = 10;
|
||||||
|
int maxRage = 1;
|
||||||
if (CheckModifyResources(handler, target, ref rage, ref maxRage, rageMultiplier))
|
if (CheckModifyResources(handler, target, ref rage, ref maxRage, rageMultiplier))
|
||||||
{
|
{
|
||||||
NotifyModification(handler, target, CypherStrings.YouChangeRage, CypherStrings.YoursRageChanged, rage / rageMultiplier, maxRage.Value / rageMultiplier);
|
NotifyModification(handler, target, CypherStrings.YouChangeRage, CypherStrings.YoursRageChanged, rage / rageMultiplier, maxRage / rageMultiplier);
|
||||||
target.SetMaxPower(PowerType.Rage, maxRage.Value);
|
target.SetMaxPower(PowerType.Rage, maxRage);
|
||||||
target.SetPower(PowerType.Rage, rage);
|
target.SetPower(PowerType.Rage, rage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -75,14 +78,15 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("runicpower", RBACPermissions.CommandModifyRunicpower)]
|
[Command("runicpower", RBACPermissions.CommandModifyRunicpower)]
|
||||||
static bool HandleModifyRunicPowerCommand(CommandHandler handler, int rune, int? maxRune)
|
static bool HandleModifyRunicPowerCommand(CommandHandler handler, int rune)
|
||||||
{
|
{
|
||||||
Player target = handler.GetSelectedPlayerOrSelf();
|
Player target = handler.GetSelectedPlayerOrSelf();
|
||||||
byte runeMultiplier = 10;
|
byte runeMultiplier = 10;
|
||||||
|
int maxRune = 1;
|
||||||
if (CheckModifyResources(handler, target, ref rune, ref maxRune, runeMultiplier))
|
if (CheckModifyResources(handler, target, ref rune, ref maxRune, runeMultiplier))
|
||||||
{
|
{
|
||||||
NotifyModification(handler, target, CypherStrings.YouChangeRunicPower, CypherStrings.YoursRunicPowerChanged, rune / runeMultiplier, maxRune.Value / runeMultiplier);
|
NotifyModification(handler, target, CypherStrings.YouChangeRunicPower, CypherStrings.YoursRunicPowerChanged, rune / runeMultiplier, maxRune / runeMultiplier);
|
||||||
target.SetMaxPower(PowerType.RunicPower, maxRune.Value);
|
target.SetMaxPower(PowerType.RunicPower, maxRune);
|
||||||
target.SetPower(PowerType.RunicPower, rune);
|
target.SetPower(PowerType.RunicPower, rune);
|
||||||
return true;
|
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;
|
res *= multiplier;
|
||||||
resmax *= multiplier;
|
resmax *= multiplier;
|
||||||
|
|||||||
@@ -3030,7 +3030,8 @@ namespace Game
|
|||||||
"ConversationLine",
|
"ConversationLine",
|
||||||
"AreaTrigger Client Triggered",
|
"AreaTrigger Client Triggered",
|
||||||
"Trainer Spell",
|
"Trainer Spell",
|
||||||
"Object Visibility (by ID)"
|
"Object Visibility (by ID)",
|
||||||
|
"Spawn Group"
|
||||||
};
|
};
|
||||||
|
|
||||||
public ConditionTypeInfo[] StaticConditionTypeData =
|
public ConditionTypeInfo[] StaticConditionTypeData =
|
||||||
|
|||||||
@@ -90,13 +90,11 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long previousStringTableSize = 0;
|
|
||||||
long previousRecordCount = 0;
|
long previousRecordCount = 0;
|
||||||
for (int sectionIndex = 0; sectionIndex < Header.SectionsCount; sectionIndex++)
|
for (int sectionIndex = 0; sectionIndex < Header.SectionsCount; sectionIndex++)
|
||||||
{
|
{
|
||||||
if (sections[sectionIndex].TactKeyLookup != 0)// && !hasTactKeyFunc(sections[sectionIndex].TactKeyLookup))
|
if (sections[sectionIndex].TactKeyLookup != 0)// && !hasTactKeyFunc(sections[sectionIndex].TactKeyLookup))
|
||||||
{
|
{
|
||||||
previousStringTableSize += sections[sectionIndex].StringTableSize;
|
|
||||||
previousRecordCount += sections[sectionIndex].NumRecords;
|
previousRecordCount += sections[sectionIndex].NumRecords;
|
||||||
//Console.WriteLine("Detected db2 with encrypted section! HasKey {0}", CASC.HasKey(Sections[sectionIndex].TactKeyLookup));
|
//Console.WriteLine("Detected db2 with encrypted section! HasKey {0}", CASC.HasKey(Sections[sectionIndex].TactKeyLookup));
|
||||||
continue;
|
continue;
|
||||||
@@ -116,17 +114,11 @@ namespace Game.DataStorage
|
|||||||
// string data
|
// string data
|
||||||
stringsTable = new Dictionary<long, string>();
|
stringsTable = new Dictionary<long, string>();
|
||||||
|
|
||||||
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;)
|
for (int i = 0; i < sections[sectionIndex].StringTableSize;)
|
||||||
{
|
{
|
||||||
long oldPos = reader.BaseStream.Position;
|
long oldPos = reader.BaseStream.Position;
|
||||||
|
|
||||||
stringsTable[i + stringDataOffset] = reader.ReadCString();
|
stringsTable[i] = reader.ReadCString();
|
||||||
|
|
||||||
i += (int)(reader.BaseStream.Position - oldPos);
|
i += (int)(reader.BaseStream.Position - oldPos);
|
||||||
}
|
}
|
||||||
@@ -220,7 +212,6 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
previousStringTableSize += sections[sectionIndex].StringTableSize;
|
|
||||||
previousRecordCount += sections[sectionIndex].NumRecords;
|
previousRecordCount += sections[sectionIndex].NumRecords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
if (missingQuest != 0 && !string.IsNullOrEmpty(ar.questFailedText))
|
if (missingQuest != 0 && !string.IsNullOrEmpty(ar.questFailedText))
|
||||||
SendSysMessage("{0}", 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)
|
if (abortParams != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -813,10 +813,10 @@ namespace Game
|
|||||||
// Send PVPSeason
|
// Send PVPSeason
|
||||||
{
|
{
|
||||||
SeasonInfo seasonInfo = new();
|
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))
|
if (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress))
|
||||||
seasonInfo.PreviousArenaSeason = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
|
seasonInfo.CurrentArenaSeason = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
|
||||||
|
|
||||||
SendPacket(seasonInfo);
|
SendPacket(seasonInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Game.Networking.Packets
|
|||||||
_worldPacket.WritePackedGuid(PlayerGUID);
|
_worldPacket.WritePackedGuid(PlayerGUID);
|
||||||
_worldPacket.WriteUInt32(Flags);
|
_worldPacket.WriteUInt32(Flags);
|
||||||
_worldPacket.WritePackedTime(CurrentTime);
|
_worldPacket.WritePackedTime(CurrentTime);
|
||||||
_worldPacket.WriteUInt32(ElapsedTime);
|
_worldPacket.WriteInt64(ElapsedTime);
|
||||||
_worldPacket.WriteInt64(CreationTime);
|
_worldPacket.WriteInt64(CreationTime);
|
||||||
_worldPacket.WriteBit(RafAcceptanceID.HasValue);
|
_worldPacket.WriteBit(RafAcceptanceID.HasValue);
|
||||||
_worldPacket.FlushBits();
|
_worldPacket.FlushBits();
|
||||||
@@ -74,7 +74,7 @@ namespace Game.Networking.Packets
|
|||||||
public ObjectGuid PlayerGUID;
|
public ObjectGuid PlayerGUID;
|
||||||
public uint Flags;
|
public uint Flags;
|
||||||
public long CurrentTime;
|
public long CurrentTime;
|
||||||
public uint ElapsedTime;
|
public long ElapsedTime;
|
||||||
public long CreationTime;
|
public long CreationTime;
|
||||||
public ulong? RafAcceptanceID;
|
public ulong? RafAcceptanceID;
|
||||||
}
|
}
|
||||||
@@ -319,8 +319,8 @@ namespace Game.Networking.Packets
|
|||||||
data.WriteUInt64(Quantity);
|
data.WriteUInt64(Quantity);
|
||||||
data.WritePackedGuid(Player);
|
data.WritePackedGuid(Player);
|
||||||
data.WritePackedTime(Date);
|
data.WritePackedTime(Date);
|
||||||
data.WriteUInt32(TimeFromStart);
|
data.WriteInt64(TimeFromStart);
|
||||||
data.WriteUInt32(TimeFromCreate);
|
data.WriteInt64(TimeFromCreate);
|
||||||
data.WriteBits(Flags, 4);
|
data.WriteBits(Flags, 4);
|
||||||
data.WriteBit(RafAcceptanceID.HasValue);
|
data.WriteBit(RafAcceptanceID.HasValue);
|
||||||
data.FlushBits();
|
data.FlushBits();
|
||||||
@@ -334,8 +334,8 @@ namespace Game.Networking.Packets
|
|||||||
public ObjectGuid Player;
|
public ObjectGuid Player;
|
||||||
public uint Flags;
|
public uint Flags;
|
||||||
public long Date;
|
public long Date;
|
||||||
public uint TimeFromStart;
|
public long TimeFromStart;
|
||||||
public uint TimeFromCreate;
|
public long TimeFromCreate;
|
||||||
public ulong? RafAcceptanceID;
|
public ulong? RafAcceptanceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Game.Networking.Packets
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte State;
|
public byte State;
|
||||||
public bool SuppressNotification;
|
public bool SuppressNotification = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChangeRealmTicketResponse : ServerPacket
|
class ChangeRealmTicketResponse : ServerPacket
|
||||||
|
|||||||
@@ -1657,8 +1657,8 @@ namespace Game.Networking.Packets
|
|||||||
|
|
||||||
SendCastFlags = data.ReadBits<uint>(5);
|
SendCastFlags = data.ReadBits<uint>(5);
|
||||||
bool hasMoveUpdate = data.HasBit();
|
bool hasMoveUpdate = data.HasBit();
|
||||||
bool hasCraftingOrderID = data.HasBit();
|
|
||||||
var weightCount = data.ReadBits<uint>(2);
|
var weightCount = data.ReadBits<uint>(2);
|
||||||
|
bool hasCraftingOrderID = data.HasBit();
|
||||||
|
|
||||||
Target.Read(data);
|
Target.Read(data);
|
||||||
|
|
||||||
|
|||||||
@@ -375,7 +375,6 @@ namespace Game.Networking.Packets
|
|||||||
_worldPacket.WriteString(ServerTimeTZ);
|
_worldPacket.WriteString(ServerTimeTZ);
|
||||||
_worldPacket.WriteString(GameTimeTZ);
|
_worldPacket.WriteString(GameTimeTZ);
|
||||||
_worldPacket.WriteString(ServerRegionalTZ);
|
_worldPacket.WriteString(ServerRegionalTZ);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ServerTimeTZ;
|
public string ServerTimeTZ;
|
||||||
|
|||||||
@@ -28,17 +28,6 @@ namespace Game.Spells
|
|||||||
m_spellInfo = info;
|
m_spellInfo = info;
|
||||||
m_caster = (info.HasAttribute(SpellAttr6.OriginateFromController) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
|
m_caster = (info.HasAttribute(SpellAttr6.OriginateFromController) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
|
||||||
m_spellValue = new SpellValue(m_spellInfo, 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();
|
m_needComboPoints = m_spellInfo.NeedsComboPoints();
|
||||||
|
|
||||||
// Get data for type of attack
|
// Get data for type of attack
|
||||||
@@ -79,7 +68,6 @@ namespace Game.Spells
|
|||||||
m_originalCaster = null;
|
m_originalCaster = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_spellState = SpellState.None;
|
|
||||||
_triggeredCastFlags = triggerFlags;
|
_triggeredCastFlags = triggerFlags;
|
||||||
|
|
||||||
if (info.HasAttribute(SpellAttr2.DoNotReportSpellFailure))
|
if (info.HasAttribute(SpellAttr2.DoNotReportSpellFailure))
|
||||||
@@ -88,7 +76,14 @@ namespace Game.Spells
|
|||||||
if (m_spellInfo.HasAttribute(SpellAttr4.AllowCastWhileCasting))
|
if (m_spellInfo.HasAttribute(SpellAttr4.AllowCastWhileCasting))
|
||||||
_triggeredCastFlags = _triggeredCastFlags | TriggerCastFlags.IgnoreCastInProgress;
|
_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)
|
//Auto Shot & Shoot (wand)
|
||||||
m_autoRepeat = m_spellInfo.IsAutoRepeatRangedSpell();
|
m_autoRepeat = m_spellInfo.IsAutoRepeatRangedSpell();
|
||||||
@@ -104,7 +99,6 @@ namespace Game.Spells
|
|||||||
for (var i = 0; i < SpellConst.MaxEffects; ++i)
|
for (var i = 0; i < SpellConst.MaxEffects; ++i)
|
||||||
m_destTargets[i] = new SpellDestination(m_caster);
|
m_destTargets[i] = new SpellDestination(m_caster);
|
||||||
|
|
||||||
//not sure needed.
|
|
||||||
m_targets = new SpellCastTargets();
|
m_targets = new SpellCastTargets();
|
||||||
m_appliedMods = new List<Aura>();
|
m_appliedMods = new List<Aura>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user