Messed up the commit history, so here is all the files rip, Credit to TrinityCore

This commit is contained in:
hondacrx
2023-09-16 08:42:35 -04:00
parent 87284bbded
commit f636ea225f
373 changed files with 158910 additions and 2170 deletions
+2 -2
View File
@@ -354,7 +354,7 @@ namespace Game.BattleGrounds
{
Player player = Global.ObjAccessor.FindPlayer(guid);
if (player != null)
player.AtStartOfEncounter();
player.AtStartOfEncounter(EncounterType.Battleground);
}
// Remove preparation
@@ -805,7 +805,7 @@ namespace Game.BattleGrounds
player.RemoveAura(BattlegroundConst.SpellMercenaryShapeshift);
player.RemovePlayerFlagEx(PlayerFlagsEx.MercenaryMode);
player.AtEndOfEncounter();
player.AtEndOfEncounter(EncounterType.Battleground);
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.LeaveArenaOrBattleground);
@@ -270,20 +270,25 @@ namespace Game.DataStorage
public void LoadAreaTriggerSpawns()
{
// build single time for check spawnmask
MultiMap<uint, Difficulty> spawnMasks = new();
foreach (var mapDifficulty in CliDB.MapDifficultyStorage.Values)
spawnMasks.Add(mapDifficulty.MapID, (Difficulty)mapDifficulty.DifficultyID);
uint oldMSTime = Time.GetMSTime();
// Load area trigger positions (to put them on the server)
// 0 1 2 3 4 5 6 7 8 9 10
SQLResult templates = DB.World.Query("SELECT SpawnId, AreaTriggerId, IsServerSide, MapId, PosX, PosY, PosZ, Orientation, PhaseUseFlags, PhaseId, PhaseGroup, " +
//11 12 13 14 15 16 17 18 19 20
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5, ShapeData6, ShapeData7, ScriptName FROM `areatrigger`");
if (!templates.IsEmpty())
// 0 1 2 3 4 5 6 7 8 9 10 11
SQLResult result = DB.World.Query("SELECT SpawnId, AreaTriggerId, IsServerSide, MapId, SpawnDifficulties, PosX, PosY, PosZ, Orientation, PhaseUseFlags, PhaseId, PhaseGroup, " +
//12 13 14 15 16 17 18 19 20 21 22
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5, ShapeData6, ShapeData7, SpellForVisuals, ScriptName FROM `areatrigger`");
if (!result.IsEmpty())
{
do
{
ulong spawnId = templates.Read<ulong>(0);
AreaTriggerId areaTriggerId = new(templates.Read<uint>(1), templates.Read<byte>(2) == 1);
WorldLocation location = new(templates.Read<uint>(3), templates.Read<float>(4), templates.Read<float>(5), templates.Read<float>(6), templates.Read<float>(7));
AreaTriggerTypes shape = (AreaTriggerTypes)templates.Read<byte>(11);
ulong spawnId = result.Read<ulong>(0);
AreaTriggerId areaTriggerId = new(result.Read<uint>(1), result.Read<byte>(2) == 1);
WorldLocation location = new(result.Read<uint>(3), result.Read<float>(5), result.Read<float>(6), result.Read<float>(7), result.Read<float>(8));
AreaTriggerTypes shape = (AreaTriggerTypes)result.Read<byte>(12);
if (GetAreaTriggerTemplate(areaTriggerId) == null)
{
@@ -303,36 +308,60 @@ namespace Game.DataStorage
continue;
}
var difficulties = Global.ObjectMgr.ParseSpawnDifficulties(result.Read<string>(4), "areatrigger", spawnId, location.GetMapId(), spawnMasks[location.GetMapId()]);
if (difficulties.Empty())
{
Log.outDebug(LogFilter.Sql, $"Table `areatrigger` has areatrigger (GUID: {spawnId}) that is not spawned in any difficulty, skipped.");
continue;
}
AreaTriggerSpawn spawn = new();
spawn.SpawnId = spawnId;
spawn.MapId = location.GetMapId();
spawn.TriggerId = areaTriggerId;
spawn.SpawnPoint = new Position(location);
spawn.PhaseUseFlags = (PhaseUseFlagsValues)templates.Read<byte>(8);
spawn.PhaseId = templates.Read<uint>(9);
spawn.PhaseGroup = templates.Read<uint>(10);
spawn.PhaseUseFlags = (PhaseUseFlagsValues)result.Read<byte>(9);
spawn.PhaseId = result.Read<uint>(10);
spawn.PhaseGroup = result.Read<uint>(11);
spawn.Shape.TriggerType = shape;
unsafe
{
for (var i = 0; i < SharedConst.MaxAreatriggerEntityData; ++i)
spawn.Shape.DefaultDatas.Data[i] = templates.Read<float>(12 + i);
spawn.Shape.DefaultDatas.Data[i] = result.Read<float>(13 + i);
}
spawn.ScriptId = Global.ObjectMgr.GetScriptId(templates.Read<string>(20));
if (!result.IsNull(21))
{
spawn.SpellForVisuals = result.Read<uint>(21);
if (!Global.SpellMgr.HasSpellInfo(spawn.SpellForVisuals.Value, Difficulty.None))
{
Log.outError(LogFilter.Sql, $"Table `areatrigger` has listed areatrigger SpawnId: {spawnId} with invalid SpellForVisual {spawn.SpellForVisuals}, set to none.");
spawn.SpellForVisuals = null;
}
}
spawn.ScriptId = Global.ObjectMgr.GetScriptId(result.Read<string>(22));
spawn.spawnGroupData = Global.ObjectMgr.GetLegacySpawnGroup();
// Add the trigger to a map::cell map, which is later used by GridLoader to query
CellCoord cellCoord = GridDefines.ComputeCellCoord(spawn.SpawnPoint.GetPositionX(), spawn.SpawnPoint.GetPositionY());
if (!_areaTriggerSpawnsByLocation.ContainsKey((spawn.MapId, cellCoord.GetId())))
_areaTriggerSpawnsByLocation[(spawn.MapId, cellCoord.GetId())] = new SortedSet<ulong>();
_areaTriggerSpawnsByLocation[(spawn.MapId, cellCoord.GetId())].Add(spawnId);
foreach (Difficulty difficulty in difficulties)
{
if (!_areaTriggerSpawnsByLocation.ContainsKey((spawn.MapId, difficulty)))
_areaTriggerSpawnsByLocation[(spawn.MapId, difficulty)] = new Dictionary<uint, SortedSet<ulong>>();
if (!_areaTriggerSpawnsByLocation[(spawn.MapId, difficulty)].ContainsKey(cellCoord.GetId()))
_areaTriggerSpawnsByLocation[(spawn.MapId, difficulty)][cellCoord.GetId()] = new SortedSet<ulong>();
_areaTriggerSpawnsByLocation[(spawn.MapId, difficulty)][cellCoord.GetId()].Add(spawnId);
}
// add the position to the map
_areaTriggerSpawnsBySpawnId[spawnId] = spawn;
} while (templates.NextRow());
} while (result.NextRow());
}
Log.outInfo(LogFilter.ServerLoading, $"Loaded {_areaTriggerSpawnsBySpawnId.Count} areatrigger spawns in {Time.GetMSTimeDiffToNow(oldMSTime)} ms.");
@@ -348,9 +377,13 @@ namespace Game.DataStorage
return _areaTriggerCreateProperties.LookupByKey(spellMiscValue);
}
public SortedSet<ulong> GetAreaTriggersForMapAndCell(uint mapId, uint cellId)
public SortedSet<ulong> GetAreaTriggersForMapAndCell(uint mapId, Difficulty difficulty, uint cellId)
{
return _areaTriggerSpawnsByLocation.LookupByKey((mapId, cellId));
var atForMapAndDifficulty = _areaTriggerSpawnsByLocation.LookupByKey((mapId, difficulty));
if (atForMapAndDifficulty != null)
return atForMapAndDifficulty.LookupByKey(cellId);
return null;
}
public AreaTriggerSpawn GetAreaTriggerSpawn(ulong spawnId)
@@ -358,7 +391,7 @@ namespace Game.DataStorage
return _areaTriggerSpawnsBySpawnId.LookupByKey(spawnId);
}
Dictionary<(uint mapId, uint cellId), SortedSet<ulong>> _areaTriggerSpawnsByLocation = new();
Dictionary<(uint, Difficulty), Dictionary<uint, SortedSet<ulong>>> _areaTriggerSpawnsByLocation = new();
Dictionary<ulong, AreaTriggerSpawn> _areaTriggerSpawnsBySpawnId = new();
Dictionary<AreaTriggerId, AreaTriggerTemplate> _areaTriggerTemplateStore = new();
Dictionary<uint, AreaTriggerCreateProperties> _areaTriggerCreateProperties = new();
+7 -1
View File
@@ -34,7 +34,13 @@ namespace Game.DataStorage
DB6Storage<T> ReadDB2<T>(string fileName, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale = 0) where T : new()
{
DB6Storage<T> storage = new();
storage.LoadData($"{db2Path}/{defaultLocale}/{fileName}");
if (!storage.LoadData($"{db2Path}/{defaultLocale}/{fileName}"))
{
Log.outError(LogFilter.ServerLoading, "Error loading DB2 files");
Environment.Exit(1);
return null;
}
storage.LoadHotfixData(availableDb2Locales, preparedStatement, preparedStatementLocale);
Global.DB2Mgr.AddDB2(storage.GetTableHash(), storage);
@@ -32,12 +32,12 @@ namespace Game.DataStorage
WDCHeader _header;
string _tableName = typeof(T).Name;
public void LoadData(string fullFileName)
public bool LoadData(string fullFileName)
{
if (!File.Exists(fullFileName))
{
Log.outError(LogFilter.ServerLoading, $"File {fullFileName} not found.");
return;
return false;
}
DBReader reader = new();
@@ -46,7 +46,7 @@ namespace Game.DataStorage
if (!reader.Load(stream))
{
Log.outError(LogFilter.ServerLoading, $"Error loading {fullFileName}.");
return;
return false;
}
}
@@ -54,6 +54,8 @@ namespace Game.DataStorage
foreach (var b in reader.Records)
Add((uint)b.Key, b.Value.As<T>());
return true;
}
public void LoadHotfixData(BitSet availableDb2Locales, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale)
+4 -1
View File
@@ -92,7 +92,6 @@ namespace Game.DataStorage
public uint LowResScreenFileDataID;
public int Flags;
public uint SpellTextureBlobFileDataID;
public uint RolesMask;
public uint ArmorTypeMask;
public int CharStartKitUnknown901;
public int MaleCharacterCreationVisualFallback;
@@ -114,6 +113,7 @@ namespace Game.DataStorage
public byte ClassColorR;
public byte ClassColorG;
public byte ClassColorB;
public byte RolesMask;
}
public sealed class ChrClassesXPowerTypesRecord
@@ -161,6 +161,7 @@ namespace Game.DataStorage
public int ChrCustItemGeoModifyID;
public int ChrCustomizationVoiceID;
public int AnimKitID;
public int ParticleColorID;
}
public sealed class ChrCustomizationOptionRecord
@@ -481,6 +482,8 @@ namespace Game.DataStorage
public float[] GeoBox = new float[6];
public uint Flags;
public uint FileDataID;
public float WalkSpeed;
public float RunSpeed;
public uint BloodID;
public uint FootprintTextureID;
public float FootprintTextureLength;
+7 -1
View File
@@ -95,7 +95,13 @@ namespace Game.DataStorage
public bool IsDynamicDifficultyMap() { return GetFlags().HasFlag(MapFlags.DynamicDifficulty); }
public bool IsFlexLocking() { return GetFlags().HasFlag(MapFlags.FlexibleRaidLocking); }
public bool IsGarrison() { return GetFlags().HasFlag(MapFlags.Garrison); }
public bool IsSplitByFaction() { return Id == 609 || Id == 2175 || Id == 2570; }
public bool IsSplitByFaction()
{
return Id == 609 || // Acherus (DeathKnight Start)
Id == 1265 || // Assault on the Dark Portal (WoD Intro)
Id == 2175 || // Exiles Reach - NPE
Id == 2570; // Forbidden Reach (Dracthyr/Evoker Start)
}
public MapFlags GetFlags() { return (MapFlags)Flags[0]; }
public MapFlags2 GetFlags2() { return (MapFlags2)Flags[1]; }
+26 -13
View File
@@ -246,13 +246,26 @@ namespace Game.Entities
SetEntry(areaTriggerTemplate.Id.Id);
SetObjectScale(1.0f);
SetDuration(-1);
SetUpdateFieldValue(m_areaTriggerData.ModifyValue(m_areaTriggerData.BoundsRadius2D), GetMaxSearchRadius());
SetUpdateFieldValue(m_areaTriggerData.ModifyValue(m_areaTriggerData.DecalPropertiesID), 24u); // blue decal, for .debug areatrigger visibility
if (position.SpellForVisuals.HasValue)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(position.SpellForVisuals.Value, Difficulty.None);
SetUpdateFieldValue(m_areaTriggerData.ModifyValue(m_areaTriggerData.SpellForVisuals), position.SpellForVisuals.Value);
ScaleCurve extraScaleCurve = m_areaTriggerData.ModifyValue(m_areaTriggerData.ExtraScaleCurve);
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.ParameterCurve), (uint)1.0000001f);
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), true);
SpellCastVisualField spellCastVisual = m_areaTriggerData.ModifyValue(m_areaTriggerData.SpellVisual);
SetUpdateFieldValue(ref spellCastVisual.SpellXSpellVisualID, spellInfo.GetSpellXSpellVisualId());
SetUpdateFieldValue(ref spellCastVisual.ScriptVisualID, 0u);
}
if (IsServerSide())
SetUpdateFieldValue(m_areaTriggerData.ModifyValue(m_areaTriggerData.DecalPropertiesID), 24u); // blue decal, for .debug areatrigger visibility
SetScaleCurve(m_areaTriggerData.ModifyValue(m_areaTriggerData.ExtraScaleCurve), new AreaTriggerScaleCurveTemplate());
VisualAnim visualAnim = m_areaTriggerData.ModifyValue(m_areaTriggerData.VisualAnim);
SetUpdateFieldValue(visualAnim.ModifyValue(visualAnim.AnimationDataID), -1);
_shape = position.Shape;
_maxSearchRadius = _shape.GetMaxSearchRadius();
@@ -289,16 +302,16 @@ namespace Game.Entities
}
else
UpdateSplinePosition(diff);
}
if (GetDuration() != -1)
if (GetDuration() != -1)
{
if (GetDuration() > diff)
_UpdateDuration((int)(_duration - diff));
else
{
if (GetDuration() > diff)
_UpdateDuration((int)(_duration - diff));
else
{
Remove(); // expired
return;
}
Remove(); // expired
return;
}
}
@@ -368,7 +381,7 @@ namespace Game.Entities
SetUpdateFieldValue(scaleCurve.ModifyValue(scaleCurve.OverrideActive), true);
SetUpdateFieldValue(scaleCurve.ModifyValue(scaleCurve.StartTimeOffset), curve.StartTimeOffset);
Position point = null;
Position point = new Position();
// ParameterCurve packing information
// (not_using_points & 1) | ((interpolation_mode & 0x7) << 1) | ((first_point_offset & 0xFFFFF) << 4) | ((point_count & 0xFF) << 24)
// if not_using_points is set then the entire field is simply read as a float (ignoring that lowest bit)
@@ -292,6 +292,7 @@ namespace Game.Entities
{
public AreaTriggerId TriggerId;
public AreaTriggerShapeInfo Shape = new();
public uint? SpellForVisuals;
public AreaTriggerSpawn() : base(SpawnObjectType.AreaTrigger) { }
}
+32 -16
View File
@@ -1315,10 +1315,11 @@ namespace Game.Entities
CreatureData data = Global.ObjectMgr.NewOrExistCreatureData(m_spawnId);
uint displayId = GetNativeDisplayId();
ulong npcflag = ((ulong)m_unitData.NpcFlags[1] << 32) | m_unitData.NpcFlags[0];
uint unitFlags = m_unitData.Flags;
uint unitFlags2 = m_unitData.Flags2;
uint unitFlags3 = m_unitData.Flags3;
ulong spawnNpcFlags = ((ulong)m_unitData.NpcFlags[1] << 32) | m_unitData.NpcFlags[0];
ulong? npcflag = null;
uint? unitFlags = null;
uint? unitFlags2 = null;
uint? unitFlags3 = null;
// check if it's a custom model and if not, use 0 for displayId
CreatureTemplate cinfo = GetCreatureTemplate();
@@ -1328,17 +1329,17 @@ namespace Game.Entities
if (displayId != 0 && displayId == model.CreatureDisplayID)
displayId = 0;
if (npcflag == (uint)cinfo.Npcflag)
npcflag = 0;
if (spawnNpcFlags != cinfo.Npcflag)
npcflag = spawnNpcFlags;
if (unitFlags == (uint)cinfo.UnitFlags)
unitFlags = 0;
if (m_unitData.Flags == (uint)cinfo.UnitFlags)
unitFlags = m_unitData.Flags;
if (unitFlags2 == cinfo.UnitFlags2)
unitFlags2 = 0;
if (m_unitData.Flags2 == cinfo.UnitFlags2)
unitFlags2 = m_unitData.Flags2;
if (unitFlags3 == cinfo.UnitFlags3)
unitFlags3 = 0;
if (m_unitData.Flags3 == cinfo.UnitFlags3)
unitFlags3 = m_unitData.Flags3;
}
if (data.SpawnId == 0)
@@ -1408,10 +1409,25 @@ namespace Game.Entities
stmt.AddValue(index++, GetHealth());
stmt.AddValue(index++, GetPower(PowerType.Mana));
stmt.AddValue(index++, (byte)GetDefaultMovementType());
stmt.AddValue(index++, npcflag);
stmt.AddValue(index++, unitFlags);
stmt.AddValue(index++, unitFlags2);
stmt.AddValue(index++, unitFlags3);
if (npcflag.HasValue)
stmt.AddValue(index++, npcflag.Value);
else
stmt.AddNull(index++);
if (unitFlags.HasValue)
stmt.AddValue(index++, unitFlags.Value);
else
stmt.AddNull(index++);
if (unitFlags2.HasValue)
stmt.AddValue(index++, unitFlags2.Value);
else
stmt.AddNull(index++);
if (unitFlags3.HasValue)
stmt.AddValue(index++, unitFlags3.Value);
else
stmt.AddNull(index++);
trans.Append(stmt);
DB.World.CommitTransaction(trans);
@@ -266,10 +266,10 @@ namespace Game.Entities
public uint curhealth;
public uint curmana;
public byte movementType;
public ulong npcflag;
public uint unit_flags; // enum UnitFlags mask values
public uint unit_flags2; // enum UnitFlags2 mask values
public uint unit_flags3; // enum UnitFlags3 mask values
public ulong? npcflag;
public uint? unit_flags; // enum UnitFlags mask values
public uint? unit_flags2; // enum UnitFlags2 mask values
public uint? unit_flags3; // enum UnitFlags3 mask values
public CreatureData() : base(SpawnObjectType.Creature) { }
}
+10 -3
View File
@@ -716,7 +716,7 @@ namespace Game.Entities
loot?.Update();
// Non-consumable chest was partially looted and restock time passed, restock all loot now
if (GetGoInfo().Chest.consumable == 0 && GetGoInfo().Chest.chestRestockTime != 0 && GameTime.GetGameTime() >= m_restockTime)
if (GetGoInfo().Chest.consumable == 0 && m_restockTime != 0 && GameTime.GetGameTime() >= m_restockTime)
{
m_restockTime = 0;
m_lootState = LootState.Ready;
@@ -2361,7 +2361,11 @@ namespace Game.Entities
if (info == null)
return;
if (!user.IsPlayer())
Player player = user.ToPlayer();
if (player == null)
return;
if (!player.CanUseBattlegroundObject(this))
return;
GameObjectType.NewFlag newFlag = (GameObjectType.NewFlag)m_goTypeImpl;
@@ -2384,12 +2388,15 @@ namespace Game.Entities
if (!user.IsPlayer())
return;
if (!user.IsAlive())
return;
GameObject owner = GetMap().GetGameObject(GetOwnerGUID());
if (owner != null)
{
if (owner.GetGoType() == GameObjectTypes.NewFlag)
{
GameObjectType.NewFlag newFlag = (GameObjectType.NewFlag)m_goTypeImpl;
GameObjectType.NewFlag newFlag = (GameObjectType.NewFlag)owner.m_goTypeImpl;
if (newFlag == null)
return;
@@ -47,187 +47,187 @@ namespace Game.Entities
[FieldOffset(64)]
public uint ScriptId;
[FieldOffset(68)]
[FieldOffset(72)]
public string StringId;
[FieldOffset(72)]
[FieldOffset(80)]
public door Door;
[FieldOffset(72)]
[FieldOffset(80)]
public button Button;
[FieldOffset(72)]
[FieldOffset(80)]
public questgiver QuestGiver;
[FieldOffset(72)]
[FieldOffset(80)]
public chest Chest;
[FieldOffset(72)]
[FieldOffset(80)]
public binder Binder;
[FieldOffset(72)]
[FieldOffset(80)]
public generic Generic;
[FieldOffset(72)]
[FieldOffset(80)]
public trap Trap;
[FieldOffset(72)]
[FieldOffset(80)]
public chair Chair;
[FieldOffset(72)]
[FieldOffset(80)]
public spellFocus SpellFocus;
[FieldOffset(72)]
[FieldOffset(80)]
public text Text;
[FieldOffset(72)]
[FieldOffset(80)]
public goober Goober;
[FieldOffset(72)]
[FieldOffset(80)]
public transport Transport;
[FieldOffset(72)]
[FieldOffset(80)]
public areadamage AreaDamage;
[FieldOffset(72)]
[FieldOffset(80)]
public camera Camera;
[FieldOffset(72)]
[FieldOffset(80)]
public moTransport MoTransport;
[FieldOffset(72)]
[FieldOffset(80)]
public duelflag DuelFlag;
[FieldOffset(72)]
[FieldOffset(80)]
public fishingnode FishingNode;
[FieldOffset(72)]
[FieldOffset(80)]
public ritual Ritual;
[FieldOffset(72)]
[FieldOffset(80)]
public mailbox MailBox;
[FieldOffset(72)]
[FieldOffset(80)]
public guardpost GuardPost;
[FieldOffset(72)]
[FieldOffset(80)]
public spellcaster SpellCaster;
[FieldOffset(72)]
[FieldOffset(80)]
public meetingstone MeetingStone;
[FieldOffset(72)]
[FieldOffset(80)]
public flagstand FlagStand;
[FieldOffset(72)]
[FieldOffset(80)]
public fishinghole FishingHole;
[FieldOffset(72)]
[FieldOffset(80)]
public flagdrop FlagDrop;
[FieldOffset(72)]
[FieldOffset(80)]
public controlzone ControlZone;
[FieldOffset(72)]
[FieldOffset(80)]
public auraGenerator AuraGenerator;
[FieldOffset(72)]
[FieldOffset(80)]
public dungeonDifficulty DungeonDifficulty;
[FieldOffset(72)]
[FieldOffset(80)]
public barberChair BarberChair;
[FieldOffset(72)]
[FieldOffset(80)]
public destructiblebuilding DestructibleBuilding;
[FieldOffset(72)]
[FieldOffset(80)]
public guildbank GuildBank;
[FieldOffset(72)]
[FieldOffset(80)]
public trapDoor TrapDoor;
[FieldOffset(72)]
[FieldOffset(80)]
public newflag NewFlag;
[FieldOffset(72)]
[FieldOffset(80)]
public newflagdrop NewFlagDrop;
[FieldOffset(72)]
[FieldOffset(80)]
public garrisonbuilding GarrisonBuilding;
[FieldOffset(72)]
[FieldOffset(80)]
public garrisonplot GarrisonPlot;
[FieldOffset(72)]
[FieldOffset(80)]
public clientcreature ClientCreature;
[FieldOffset(72)]
[FieldOffset(80)]
public clientitem ClientItem;
[FieldOffset(72)]
[FieldOffset(80)]
public capturepoint CapturePoint;
[FieldOffset(72)]
[FieldOffset(80)]
public phaseablemo PhaseableMO;
[FieldOffset(72)]
[FieldOffset(80)]
public garrisonmonument GarrisonMonument;
[FieldOffset(72)]
[FieldOffset(80)]
public garrisonshipment GarrisonShipment;
[FieldOffset(72)]
[FieldOffset(80)]
public garrisonmonumentplaque GarrisonMonumentPlaque;
[FieldOffset(72)]
[FieldOffset(80)]
public itemforge ItemForge;
[FieldOffset(72)]
[FieldOffset(80)]
public uilink UILink;
[FieldOffset(72)]
[FieldOffset(80)]
public keystonereceptacle KeystoneReceptacle;
[FieldOffset(72)]
[FieldOffset(80)]
public gatheringnode GatheringNode;
[FieldOffset(72)]
[FieldOffset(80)]
public challengemodereward ChallengeModeReward;
[FieldOffset(72)]
[FieldOffset(80)]
public multi Multi;
[FieldOffset(72)]
[FieldOffset(80)]
public siegeableMulti SiegeableMulti;
[FieldOffset(72)]
[FieldOffset(80)]
public siegeableMO SiegeableMO;
[FieldOffset(72)]
[FieldOffset(80)]
public pvpReward PvpReward;
[FieldOffset(72)]
[FieldOffset(80)]
public playerchoicechest PlayerChoiceChest;
[FieldOffset(72)]
[FieldOffset(80)]
public legendaryforge LegendaryForge;
[FieldOffset(72)]
[FieldOffset(80)]
public garrtalenttree GarrTalentTree;
[FieldOffset(72)]
[FieldOffset(80)]
public weeklyrewardchest WeeklyRewardChest;
[FieldOffset(72)]
[FieldOffset(80)]
public clientmodel ClientModel;
[FieldOffset(72)]
[FieldOffset(80)]
public craftingTable CraftingTable;
[FieldOffset(72)]
[FieldOffset(80)]
public raw Raw;
[FieldOffset(208)]
[FieldOffset(224)]
public QueryGameObjectResponse QueryData;
// helpers
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -2638,9 +2638,13 @@ namespace Game.Entities
if (IsFriendlyTo(target) || target.IsFriendlyTo(this))
return false;
Player playerAffectingAttacker = unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled) ? GetAffectingPlayer() : go != null ? GetAffectingPlayer() : null;
Player playerAffectingAttacker = (unit != null && unit.HasUnitFlag(UnitFlags.PlayerControlled)) || go != null ? GetAffectingPlayer() : null;
Player playerAffectingTarget = unitTarget != null && unitTarget.HasUnitFlag(UnitFlags.PlayerControlled) ? unitTarget.GetAffectingPlayer() : null;
// Pets of mounted players are immune to NPCs
if (playerAffectingAttacker == null && unitTarget != null && unitTarget.IsPet() && playerAffectingTarget != null && playerAffectingTarget.IsMounted())
return false;
// Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
if ((playerAffectingAttacker && !playerAffectingTarget) || (!playerAffectingAttacker && playerAffectingTarget))
{
+9 -7
View File
@@ -176,6 +176,8 @@ namespace Game.Entities
return false;
}
owner.SetTemporaryUnsummonedPetNumber(0);
Map map = owner.GetMap();
ulong guid = map.GenerateLowGuid(HighGuid.Pet);
@@ -290,9 +292,6 @@ namespace Game.Entities
Cypher.Assert(activePetIndex != -1);
// Check that we either have no pet (unsummoned by player) or it matches temporarily unsummoned pet by server (for example on flying mount)
Cypher.Assert(!petStable.CurrentPetIndex.HasValue || petStable.CurrentPetIndex == activePetIndex);
petStable.SetCurrentActivePetIndex((uint)activePetIndex);
}
@@ -384,6 +383,9 @@ namespace Game.Entities
}
}
if (owner.IsMounted())
owner.DisablePetControlsOnMount(ReactStates.Passive, CommandStates.Follow);
// must be after SetMinion (owner guid check)
LoadTemplateImmunities();
m_loading = false;
@@ -458,7 +460,7 @@ namespace Game.Entities
string actionBar = GenerateActionBarData();
Cypher.Assert(owner.GetPetStable().GetCurrentPet() != null && owner.GetPetStable().GetCurrentPet().PetNumber == GetCharmInfo().GetPetNumber());
FillPetInfo(owner.GetPetStable().GetCurrentPet());
FillPetInfo(owner.GetPetStable().GetCurrentPet(), owner.GetTemporaryPetReactState());
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET);
stmt.AddValue(0, GetCharmInfo().GetPetNumber());
@@ -467,7 +469,7 @@ namespace Game.Entities
stmt.AddValue(3, GetNativeDisplayId());
stmt.AddValue(4, GetLevel());
stmt.AddValue(5, m_unitData.PetExperience);
stmt.AddValue(6, (byte)GetReactState());
stmt.AddValue(6, (byte)owner.GetTemporaryPetReactState().GetValueOrDefault(GetReactState()));
stmt.AddValue(7, (owner.GetPetStable().GetCurrentActivePetIndex().HasValue ? (short)owner.GetPetStable().GetCurrentActivePetIndex().Value : (short)PetSaveMode.NotInSlot));
stmt.AddValue(8, GetName());
stmt.AddValue(9, HasPetFlag(UnitPetFlags.CanBeRenamed) ? 0 : 1);
@@ -492,14 +494,14 @@ namespace Game.Entities
}
}
public void FillPetInfo(PetStable.PetInfo petInfo)
public void FillPetInfo(PetStable.PetInfo petInfo, ReactStates? forcedReactState = null)
{
petInfo.PetNumber = GetCharmInfo().GetPetNumber();
petInfo.CreatureId = GetEntry();
petInfo.DisplayId = GetNativeDisplayId();
petInfo.Level = (byte)GetLevel();
petInfo.Experience = m_unitData.PetExperience;
petInfo.ReactState = GetReactState();
petInfo.ReactState = forcedReactState.GetValueOrDefault(GetReactState());
petInfo.Name = GetName();
petInfo.WasRenamed = !HasPetFlag(UnitPetFlags.CanBeRenamed);
petInfo.Health = (uint)GetHealth();
@@ -122,6 +122,7 @@ namespace Game.Entities
PetStable m_petStable;
public List<PetAura> m_petAuras = new();
uint m_temporaryUnsummonedPetNumber;
ReactStates? m_temporaryPetReactState;
uint m_lastpetnumber;
// Player summoning
+28 -7
View File
@@ -35,9 +35,9 @@ namespace Game.Entities
return nearMembers[randTarget];
}
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default)
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember, byte? partyIndex)
{
Group grp = GetGroup();
Group grp = GetGroup(partyIndex);
if (!grp)
return PartyResult.NotInGroup;
@@ -58,7 +58,7 @@ namespace Game.Entities
return PartyResult.PartyLfgBootDungeonComplete;
Player player = Global.ObjAccessor.FindConnectedPlayer(guidMember);
if (!player.m_lootRolls.Empty())
if (player != null && !player.m_lootRolls.Empty())
return PartyResult.PartyLfgBootLootRolls;
// @todo Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer.
@@ -150,6 +150,23 @@ namespace Game.Entities
return false;
}
public Group GetGroup(byte? partyIndex)
{
Group group = GetGroup();
if (!partyIndex.HasValue)
return group;
GroupCategory category = (GroupCategory)partyIndex;
if (group != null && group.GetGroupCategory() == category)
return group;
Group originalGroup = GetOriginalGroup();
if (originalGroup && originalGroup.GetGroupCategory() == category)
return originalGroup;
return null;
}
public void SetGroup(Group group, byte subgroup = 0)
{
@@ -167,10 +184,7 @@ namespace Game.Entities
public void SetPartyType(GroupCategory category, GroupType type)
{
Cypher.Assert(category < GroupCategory.Max);
byte value = m_playerData.PartyType;
value &= (byte)~((byte)0xFF << ((byte)category * 4));
value |= (byte)((byte)type << ((byte)category * 4));
SetUpdateFieldValue(m_values.ModifyValue(m_playerData).ModifyValue(m_playerData.PartyType), value);
SetUpdateFieldValue(ref m_values.ModifyValue(m_playerData).ModifyValue(m_playerData.PartyType, (int)category), (byte)type);
}
public void ResetGroupUpdateSequenceIfNeeded(Group group)
@@ -207,12 +221,19 @@ namespace Game.Entities
}
public Group GetGroupInvite() { return m_groupInvite; }
public void SetGroupInvite(Group group) { m_groupInvite = group; }
public Group GetGroup() { return m_group.GetTarget(); }
public GroupReference GetGroupRef() { return m_group; }
public byte GetSubGroup() { return m_group.GetSubGroup(); }
public GroupUpdateFlags GetGroupUpdateFlag() { return m_groupUpdateMask; }
public void SetGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask |= flag; }
public void RemoveGroupUpdateFlag(GroupUpdateFlags flag) { m_groupUpdateMask &= ~flag; }
public Group GetOriginalGroup() { return m_originalGroup.GetTarget(); }
+54 -5
View File
@@ -109,8 +109,8 @@ namespace Game.Entities
m_questObjectiveCriteriaMgr = new QuestObjectiveCriteriaManager(this);
m_sceneMgr = new SceneMgr(this);
m_bgBattlegroundQueueID[0] = new BgBattlegroundQueueID_Rec();
m_bgBattlegroundQueueID[1] = new BgBattlegroundQueueID_Rec();
for (var i = 0; i < SharedConst.MaxPlayerBGQueues; ++i)
m_bgBattlegroundQueueID[i] = new BgBattlegroundQueueID_Rec();
m_bgData = new BGData();
@@ -1057,6 +1057,55 @@ namespace Game.Entities
public void SetLastPetNumber(uint petnumber) { m_lastpetnumber = petnumber; }
public uint GetTemporaryUnsummonedPetNumber() { return m_temporaryUnsummonedPetNumber; }
public void SetTemporaryUnsummonedPetNumber(uint petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
public ReactStates? GetTemporaryPetReactState() { return m_temporaryPetReactState; }
public void DisablePetControlsOnMount(ReactStates reactState, CommandStates commandState)
{
Pet pet = GetPet();
if (pet == null)
return;
m_temporaryPetReactState = pet.GetReactState();
pet.SetReactState(reactState);
CharmInfo charmInfo = pet.GetCharmInfo();
if (charmInfo != null)
charmInfo.SetCommandState(commandState);
pet.GetMotionMaster().MoveFollow(this, SharedConst.PetFollowDist, pet.GetFollowAngle());
PetMode petMode = new();
petMode.PetGUID = pet.GetGUID();
petMode.ReactState = reactState;
petMode.CommandState = commandState;
petMode.Flag = 0;
SendPacket(petMode);
}
public void EnablePetControlsOnDismount()
{
Pet pet = GetPet();
if (pet != null)
{
PetMode petMode = new();
petMode.PetGUID = pet.GetGUID();
if (m_temporaryPetReactState.HasValue)
{
petMode.ReactState = m_temporaryPetReactState.Value;
pet.SetReactState(m_temporaryPetReactState.Value);
}
CharmInfo charmInfo = pet.GetCharmInfo();
if (charmInfo != null)
petMode.CommandState = charmInfo.GetCommandState();
petMode.Flag = 0;
SendPacket(petMode);
}
m_temporaryPetReactState = null;
}
public void UnsummonPetTemporaryIfAny()
{
Pet pet = GetPet();
@@ -1091,7 +1140,7 @@ namespace Game.Entities
public bool IsPetNeedBeTemporaryUnsummoned()
{
return !IsInWorld || !IsAlive() || IsMounted();
return !IsInWorld || !IsAlive() || HasUnitMovementFlag(MovementFlag.Flying) || HasExtraUnitMovementFlag2(MovementFlags3.AdvFlying);
}
public void SendRemoveControlBar()
@@ -6400,8 +6449,8 @@ namespace Game.Entities
public void SendSellError(SellResult msg, Creature creature, ObjectGuid guid)
{
SellResponse sellResponse = new();
sellResponse.VendorGUID = (creature ? creature.GetGUID() : ObjectGuid.Empty);
sellResponse.ItemGUID = guid;
sellResponse.VendorGUID = creature ? creature.GetGUID() : ObjectGuid.Empty;
sellResponse.ItemGUIDs.Add(guid);
sellResponse.Reason = msg;
SendPacket(sellResponse);
}
+1 -1
View File
@@ -175,7 +175,7 @@ namespace Game.Entities
m_lifetime = duration;
if (m_type == TempSummonType.ManualDespawn)
m_type = (duration == TimeSpan.Zero) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn;
m_type = (duration <= TimeSpan.Zero) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn;
if (summoner != null && summoner.IsPlayer())
{
+4 -31
View File
@@ -1430,23 +1430,8 @@ namespace Game.Entities
}
}
// unsummon pet
Pet pet = player.GetPet();
if (pet != null)
{
Battleground bg = ToPlayer().GetBattleground();
// don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
if (bg && bg.IsArena())
pet.SetUnitFlag(UnitFlags.Stunned);
else
player.UnsummonPetTemporaryIfAny();
}
// if we have charmed npc, stun him also (everywhere)
Unit charm = player.GetCharmed();
if (charm)
if (charm.GetTypeId() == TypeId.Unit)
charm.SetUnitFlag(UnitFlags.Stunned);
// disable pet controls
player.DisablePetControlsOnMount(ReactStates.Passive, CommandStates.Follow);
player.SendMovementSetCollisionHeight(player.GetCollisionHeight(), UpdateCollisionHeightReason.Mount);
}
@@ -1483,20 +1468,8 @@ namespace Game.Entities
Player player = ToPlayer();
if (player != null)
{
Pet pPet = player.GetPet();
if (pPet != null)
{
if (pPet.HasUnitFlag(UnitFlags.Stunned) && !pPet.HasUnitState(UnitState.Stunned))
pPet.RemoveUnitFlag(UnitFlags.Stunned);
}
else
player.ResummonPetTemporaryUnSummonedIfAny();
// if we have charmed npc, remove stun also
Unit charm = player.GetCharmed();
if (charm)
if (charm.GetTypeId() == TypeId.Unit && charm.HasUnitFlag(UnitFlags.Stunned) && !charm.HasUnitState(UnitState.Stunned))
charm.RemoveUnitFlag(UnitFlags.Stunned);
player.EnablePetControlsOnDismount();
player.ResummonPetTemporaryUnSummonedIfAny();
}
}
+23 -2
View File
@@ -589,18 +589,39 @@ namespace Game.Entities
return GetTransport();
}
public void AtStartOfEncounter()
public void AtStartOfEncounter(EncounterType type)
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.StartOfEncounter);
switch (type)
{
case EncounterType.DungeonEncounter:
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.StartOfDungeonEncounter);
break;
case EncounterType.MythicPlusRun:
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.StartOfMythicPlusRun);
break;
default:
break;
}
if (IsAlive())
Unit.ProcSkillsAndAuras(this, null, new ProcFlagsInit(ProcFlags.EncounterStart), new ProcFlagsInit(), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, null, null, null);
}
public void AtEndOfEncounter()
public void AtEndOfEncounter(EncounterType type)
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.EndOfEncounter);
switch (type)
{
case EncounterType.DungeonEncounter:
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.EndOfDungeonEncounter);
break;
default:
break;
}
GetSpellHistory().ResetCooldowns(pair =>
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
+9
View File
@@ -188,6 +188,15 @@ namespace Game.Entities
// We just remove the aura and the unapply handler will make the target leave the vehicle.
// We don't need to iterate over Seats
_me.RemoveAurasByType(AuraType.ControlVehicle);
// Aura script might cause the vehicle to be despawned in the middle of handling SPELL_AURA_CONTROL_VEHICLE removal
// In that case, aura effect has already been unregistered but passenger may still be found in Seats
foreach (var (_, seat) in Seats)
{
Unit passenger = Global.ObjAccessor.GetUnit(_me, seat.Passenger.Guid);
if (passenger != null)
passenger._ExitVehicle();
}
}
public bool HasEmptySeat(sbyte seatId)
+35 -21
View File
@@ -106,10 +106,10 @@ namespace Game
public static void ChooseCreatureFlags(CreatureTemplate cInfo, out ulong npcFlag, out uint unitFlags, out uint unitFlags2, out uint unitFlags3, CreatureData data = null)
{
npcFlag = data != null && data.npcflag != 0 ? data.npcflag : cInfo.Npcflag;
unitFlags = data != null && data.unit_flags != 0 ? data.unit_flags : (uint)cInfo.UnitFlags;
unitFlags2 = data != null && data.unit_flags2 != 0 ? data.unit_flags2 : cInfo.UnitFlags2;
unitFlags3 = data != null && data.unit_flags3 != 0 ? data.unit_flags3 : cInfo.UnitFlags3;
npcFlag = data != null && data.npcflag.HasValue ? data.npcflag.Value : cInfo.Npcflag;
unitFlags = data != null && data.unit_flags.HasValue ? data.unit_flags.Value : (uint)cInfo.UnitFlags;
unitFlags2 = data != null && data.unit_flags2.HasValue ? data.unit_flags2.Value : cInfo.UnitFlags2;
unitFlags3 = data != null && data.unit_flags3.HasValue ? data.unit_flags3.Value : cInfo.UnitFlags3;
}
public static ResponseCodes CheckPlayerName(string name, Locale locale, bool create = false)
@@ -3519,10 +3519,15 @@ namespace Game
data.SpawnDifficulties = ParseSpawnDifficulties(result.Read<string>(15), "creature", guid, data.MapId, spawnMasks.LookupByKey(data.MapId));
short gameEvent = result.Read<short>(16);
data.poolId = result.Read<uint>(17);
data.npcflag = result.Read<ulong>(18);
data.unit_flags = result.Read<uint>(19);
data.unit_flags2 = result.Read<uint>(20);
data.unit_flags3 = result.Read<uint>(21);
if (!result.IsNull(18))
data.npcflag = result.Read<ulong>(18);
if (!result.IsNull(19))
data.unit_flags = result.Read<uint>(19);
if (!result.IsNull(20))
data.unit_flags2 = result.Read<uint>(20);
if (!result.IsNull(21))
data.unit_flags3 = result.Read<uint>(21);
data.PhaseUseFlags = (PhaseUseFlagsValues)result.Read<byte>(22);
data.PhaseId = result.Read<uint>(23);
@@ -3636,25 +3641,34 @@ namespace Game
}
}
uint disallowedUnitFlags = (uint)(cInfo.UnitFlags & ~UnitFlags.Allowed);
if (disallowedUnitFlags != 0)
if (data.unit_flags.HasValue)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags` {disallowedUnitFlags}, removing incorrect flag.");
cInfo.UnitFlags &= UnitFlags.Allowed;
uint disallowedUnitFlags = (data.unit_flags.Value & ~(uint)UnitFlags.Allowed);
if (disallowedUnitFlags != 0)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags` {disallowedUnitFlags}, removing incorrect flag.");
data.unit_flags = data.unit_flags & (uint)UnitFlags.Allowed;
}
}
uint disallowedUnitFlags2 = (cInfo.UnitFlags2 & ~(uint)UnitFlags2.Allowed);
if (disallowedUnitFlags2 != 0)
if (data.unit_flags2.HasValue)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags2}, removing incorrect flag.");
cInfo.UnitFlags2 &= (uint)UnitFlags2.Allowed;
uint disallowedUnitFlags2 = (data.unit_flags2.Value & ~(uint)UnitFlags2.Allowed);
if (disallowedUnitFlags2 != 0)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags2}, removing incorrect flag.");
data.unit_flags2 = data.unit_flags2 & (uint)UnitFlags2.Allowed;
}
}
uint disallowedUnitFlags3 = (cInfo.UnitFlags3 & ~(uint)UnitFlags3.Allowed);
if (disallowedUnitFlags3 != 0)
if (data.unit_flags3.HasValue)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags3}, removing incorrect flag.");
cInfo.UnitFlags3 &= (uint)UnitFlags3.Allowed;
uint disallowedUnitFlags3 = (data.unit_flags3.Value & ~(uint)UnitFlags3.Allowed);
if (disallowedUnitFlags3 != 0)
{
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags3}, removing incorrect flag.");
data.unit_flags3 = data.unit_flags3 & (uint)UnitFlags3.Allowed;
}
}
if (WorldConfig.GetBoolValue(WorldCfg.CalculateCreatureZoneAreaData))
@@ -4798,7 +4812,7 @@ namespace Game
goInfo.entry, goInfo.type, N, dataN);
}
List<Difficulty> ParseSpawnDifficulties(string difficultyString, string table, ulong spawnId, uint mapId, List<Difficulty> mapDifficulties)
public List<Difficulty> ParseSpawnDifficulties(string difficultyString, string table, ulong spawnId, uint mapId, List<Difficulty> mapDifficulties)
{
List<Difficulty> difficulties = new();
StringArray tokens = new(difficultyString, ',');
+55 -17
View File
@@ -141,7 +141,7 @@ namespace Game.Groups
stmt.AddValue(index++, m_targetIcons[5].GetRawValue());
stmt.AddValue(index++, m_targetIcons[6].GetRawValue());
stmt.AddValue(index++, m_targetIcons[7].GetRawValue());
stmt.AddValue(index++, (byte)m_groupFlags);
stmt.AddValue(index++, (ushort)m_groupFlags);
stmt.AddValue(index++, (byte)m_dungeonDifficulty);
stmt.AddValue(index++, (byte)m_raidDifficulty);
stmt.AddValue(index++, (byte)m_legacyRaidDifficulty);
@@ -181,7 +181,7 @@ namespace Game.Groups
for (byte i = 0; i < MapConst.TargetIconsCount; ++i)
m_targetIcons[i].SetRawValue(field.Read<byte[]>(4 + i));
m_groupFlags = (GroupFlags)field.Read<byte>(12);
m_groupFlags = (GroupFlags)field.Read<ushort>(12);
if (m_groupFlags.HasAnyFlag(GroupFlags.Raid))
_initRaidSubGroupsCounter();
@@ -210,6 +210,9 @@ namespace Game.Groups
return;
}
if (m_groupFlags.HasFlag(GroupFlags.EveryoneAssistant))
memberFlags |= (byte)GroupMemberFlags.Assistant;
member.name = character.Name;
member.race = character.RaceId;
member._class = (byte)character.ClassId;
@@ -234,7 +237,7 @@ namespace Game.Groups
{
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
stmt.AddValue(0, (byte)m_groupFlags);
stmt.AddValue(0, (ushort)m_groupFlags);
stmt.AddValue(1, m_dbStoreId);
DB.Characters.Execute(stmt);
@@ -253,7 +256,7 @@ namespace Game.Groups
{
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
stmt.AddValue(0, (byte)m_groupFlags);
stmt.AddValue(0, (ushort)m_groupFlags);
stmt.AddValue(1, m_dbStoreId);
DB.Characters.Execute(stmt);
@@ -275,7 +278,7 @@ namespace Game.Groups
if (m_memberSlots.Count > 5)
return; // What message error should we send?
m_groupFlags = GroupFlags.None;
m_groupFlags &= ~GroupFlags.Raid;
m_subGroupsCounts = null;
@@ -283,7 +286,7 @@ namespace Game.Groups
{
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
stmt.AddValue(0, (byte)m_groupFlags);
stmt.AddValue(0, (ushort)m_groupFlags);
stmt.AddValue(1, m_dbStoreId);
DB.Characters.Execute(stmt);
@@ -631,7 +634,7 @@ namespace Game.Groups
}
}
public void ChangeLeader(ObjectGuid newLeaderGuid, sbyte partyIndex = 0)
public void ChangeLeader(ObjectGuid newLeaderGuid)
{
var slot = _getMemberSlot(newLeaderGuid);
if (slot == null)
@@ -673,7 +676,7 @@ namespace Game.Groups
GroupNewLeader groupNewLeader = new();
groupNewLeader.Name = m_leaderName;
groupNewLeader.PartyIndex = partyIndex;
groupNewLeader.PartyIndex = (sbyte)GetGroupCategory();
BroadcastPacket(groupNewLeader, true);
}
@@ -743,7 +746,7 @@ namespace Game.Groups
Global.GroupMgr.RemoveGroup(this);
}
public void SetTargetIcon(byte symbol, ObjectGuid target, ObjectGuid changedBy, sbyte partyIndex)
public void SetTargetIcon(byte symbol, ObjectGuid target, ObjectGuid changedBy)
{
if (symbol >= MapConst.TargetIconsCount)
return;
@@ -752,25 +755,25 @@ namespace Game.Groups
if (!target.IsEmpty())
for (byte i = 0; i < MapConst.TargetIconsCount; ++i)
if (m_targetIcons[i] == target)
SetTargetIcon(i, ObjectGuid.Empty, changedBy, partyIndex);
SetTargetIcon(i, ObjectGuid.Empty, changedBy);
m_targetIcons[symbol] = target;
SendRaidTargetUpdateSingle updateSingle = new();
updateSingle.PartyIndex = partyIndex;
updateSingle.PartyIndex = (sbyte)GetGroupCategory();
updateSingle.Target = target;
updateSingle.ChangedBy = changedBy;
updateSingle.Symbol = (sbyte)symbol;
BroadcastPacket(updateSingle, true);
}
public void SendTargetIconList(WorldSession session, sbyte partyIndex)
public void SendTargetIconList(WorldSession session)
{
if (session == null)
return;
SendRaidTargetUpdateAll updateAll = new();
updateAll.PartyIndex = partyIndex;
updateAll.PartyIndex = (sbyte)GetGroupCategory();
for (byte i = 0; i < MapConst.TargetIconsCount; i++)
updateAll.TargetIcons.Add(i, m_targetIcons[i]);
@@ -1435,7 +1438,7 @@ namespace Game.Groups
EndReadyCheck();
}
public void StartReadyCheck(ObjectGuid starterGuid, sbyte partyIndex, TimeSpan duration)
public void StartReadyCheck(ObjectGuid starterGuid, TimeSpan duration)
{
if (m_readyCheckStarted)
return;
@@ -1453,7 +1456,7 @@ namespace Game.Groups
ReadyCheckStarted readyCheckStarted = new();
readyCheckStarted.PartyGUID = m_guid;
readyCheckStarted.PartyIndex = partyIndex;
readyCheckStarted.PartyIndex = (sbyte)GetGroupCategory();
readyCheckStarted.InitiatorGUID = starterGuid;
readyCheckStarted.Duration = (uint)duration.TotalMilliseconds;
BroadcastPacket(readyCheckStarted, false);
@@ -1554,11 +1557,11 @@ namespace Game.Groups
SendRaidMarkersChanged();
}
public void SendRaidMarkersChanged(WorldSession session = null, sbyte partyIndex = 0)
public void SendRaidMarkersChanged(WorldSession session = null)
{
RaidMarkersChanged packet = new();
packet.PartyIndex = partyIndex;
packet.PartyIndex = (sbyte)GetGroupCategory();
packet.ActiveMarkers = m_activeMarkers;
for (byte i = 0; i < MapConst.RaidMarkersCount; i++)
@@ -1843,6 +1846,41 @@ namespace Game.Groups
foreach (MemberSlot member in m_memberSlots)
ToggleGroupMemberFlag(member, GroupMemberFlags.Assistant, apply);
if (!IsBGGroup() && !IsBFGroup())
{
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
stmt.AddValue(0, (ushort)m_groupFlags);
stmt.AddValue(1, m_dbStoreId);
DB.Characters.Execute(stmt);
}
SendUpdate();
}
public bool IsRestrictPingsToAssistants()
{
return m_groupFlags.HasFlag(GroupFlags.RestrictPings);
}
public void SetRestrictPingsToAssistants(bool restrictPingsToAssistants)
{
if (restrictPingsToAssistants)
m_groupFlags |= GroupFlags.RestrictPings;
else
m_groupFlags &= ~GroupFlags.RestrictPings;
if (!IsBGGroup() && !IsBFGroup())
{
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE);
stmt.AddValue(0, (ushort)m_groupFlags);
stmt.AddValue(1, m_dbStoreId);
DB.Characters.Execute(stmt);
}
SendUpdate();
}
+131 -46
View File
@@ -82,17 +82,11 @@ namespace Game
return;
}
Group group = invitingPlayer.GetGroup();
if (group != null && group.IsBGGroup())
group = invitingPlayer.GetOriginalGroup();
Group group = invitingPlayer.GetGroup(packet.PartyIndex);
if (group == null)
group = invitingPlayer.GetGroupInvite();
Group group2 = invitedPlayer.GetGroup();
if (group2 != null && group2.IsBGGroup())
group2 = invitedPlayer.GetOriginalGroup();
Group group2 = invitedPlayer.GetGroup(packet.PartyIndex);
PartyInvite partyInvite;
// player already in another group or invited
if (group2 || invitedPlayer.GetGroupInvite())
@@ -161,7 +155,10 @@ namespace Game
void HandlePartyInviteResponse(PartyInviteResponse packet)
{
Group group = GetPlayer().GetGroupInvite();
if (!group)
if (group == null)
return;
if (packet.PartyIndex != 0 && group.GetGroupCategory() != (GroupCategory)packet.PartyIndex)
return;
if (packet.Accept)
@@ -235,14 +232,14 @@ namespace Game
return;
}
PartyResult res = GetPlayer().CanUninviteFromGroup(packet.TargetGUID);
PartyResult res = GetPlayer().CanUninviteFromGroup(packet.TargetGUID, packet.PartyIndex);
if (res != PartyResult.Ok)
{
SendPartyResult(PartyOperation.UnInvite, "", res);
return;
}
Group grp = GetPlayer().GetGroup();
Group grp = GetPlayer().GetGroup(packet.PartyIndex);
// grp is checked already above in CanUninviteFromGroup()
Cypher.Assert(grp);
@@ -265,7 +262,7 @@ namespace Game
void HandleSetPartyLeader(SetPartyLeader packet)
{
Player player = Global.ObjAccessor.FindConnectedPlayer(packet.TargetGUID);
Group group = GetPlayer().GetGroup();
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (!group || !player)
return;
@@ -274,7 +271,7 @@ namespace Game
return;
// Everything's fine, accepted.
group.ChangeLeader(packet.TargetGUID, packet.PartyIndex);
group.ChangeLeader(packet.TargetGUID);
group.SendUpdate();
}
@@ -283,12 +280,12 @@ namespace Game
{
RoleChangedInform roleChangedInform = new();
Group group = GetPlayer().GetGroup();
Group group = GetPlayer().GetGroup(packet.PartyIndex);
byte oldRole = (byte)(group ? group.GetLfgRoles(packet.TargetGUID) : 0);
if (oldRole == packet.Role)
return;
roleChangedInform.PartyIndex = packet.PartyIndex;
roleChangedInform.PartyIndex = (byte)group.GetGroupCategory();
roleChangedInform.From = GetPlayer().GetGUID();
roleChangedInform.ChangedUnit = packet.TargetGUID;
roleChangedInform.OldRole = oldRole;
@@ -306,7 +303,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.LeaveGroup)]
void HandleLeaveGroup(LeaveGroup packet)
{
Group grp = GetPlayer().GetGroup();
Group grp = GetPlayer().GetGroup(packet.PartyIndex);
Group grpInvite = GetPlayer().GetGroupInvite();
if (grp == null && grpInvite == null)
return;
@@ -338,7 +335,7 @@ namespace Game
{
// not allowed to change
/*
Group group = GetPlayer().GetGroup();
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (!group)
return;
@@ -376,14 +373,15 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.MinimapPing)]
void HandleMinimapPing(MinimapPingClient packet)
{
if (!GetPlayer().GetGroup())
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
MinimapPing minimapPing = new();
minimapPing.Sender = GetPlayer().GetGUID();
minimapPing.PositionX = packet.PositionX;
minimapPing.PositionY = packet.PositionY;
GetPlayer().GetGroup().BroadcastPacket(minimapPing, true, -1, GetPlayer().GetGUID());
group.BroadcastPacket(minimapPing, true, -1, GetPlayer().GetGUID());
}
[WorldPacketHandler(ClientOpcodes.RandomRoll)]
@@ -398,12 +396,12 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.UpdateRaidTarget)]
void HandleUpdateRaidTarget(UpdateRaidTarget packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
if (packet.Symbol == -1) // target icon request
group.SendTargetIconList(this, packet.PartyIndex);
group.SendTargetIconList(this);
else // target icon update
{
if (group.IsRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
@@ -416,7 +414,7 @@ namespace Game
return;
}
group.SetTargetIcon((byte)packet.Symbol, packet.Target, GetPlayer().GetGUID(), packet.PartyIndex);
group.SetTargetIcon((byte)packet.Symbol, packet.Target, GetPlayer().GetGUID());
}
}
@@ -447,20 +445,20 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.RequestPartyJoinUpdates)]
void HandleRequestPartyJoinUpdates(RequestPartyJoinUpdates packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
group.SendTargetIconList(this, packet.PartyIndex);
group.SendRaidMarkersChanged(this, packet.PartyIndex);
group.SendTargetIconList(this);
group.SendRaidMarkersChanged(this);
}
[WorldPacketHandler(ClientOpcodes.ChangeSubGroup, Processing = PacketProcessing.ThreadUnsafe)]
void HandleChangeSubGroup(ChangeSubGroup packet)
{
// we will get correct for group here, so we don't have to check if group is BG raid
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
if (packet.NewSubGroup >= MapConst.MaxRaidSubGroups)
@@ -479,8 +477,8 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.SwapSubGroups, Processing = PacketProcessing.ThreadUnsafe)]
void HandleSwapSubGroups(SwapSubGroups packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
ObjectGuid senderGuid = GetPlayer().GetGUID();
@@ -493,8 +491,8 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.SetAssistantLeader)]
void HandleSetAssistantLeader(SetAssistantLeader packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
if (!group.IsLeader(GetPlayer().GetGUID()))
@@ -506,8 +504,8 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.SetPartyAssignment)]
void HandleSetPartyAssignment(SetPartyAssignment packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
ObjectGuid senderGuid = GetPlayer().GetGUID();
@@ -532,8 +530,8 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.DoReadyCheck)]
void HandleDoReadyCheckOpcode(DoReadyCheck packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
/** error handling **/
@@ -541,14 +539,14 @@ namespace Game
return;
// everything's fine, do it
group.StartReadyCheck(GetPlayer().GetGUID(), packet.PartyIndex, TimeSpan.FromMilliseconds(MapConst.ReadycheckDuration));
group.StartReadyCheck(GetPlayer().GetGUID(), TimeSpan.FromMilliseconds(MapConst.ReadycheckDuration));
}
[WorldPacketHandler(ClientOpcodes.ReadyCheckResponse, Processing = PacketProcessing.Inplace)]
void HandleReadyCheckResponseOpcode(ReadyCheckResponseClient packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
// everything's fine, do it
@@ -596,8 +594,8 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.InitiateRolePoll)]
void HandleInitiateRolePoll(InitiateRolePoll packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
ObjectGuid guid = GetPlayer().GetGUID();
@@ -606,15 +604,15 @@ namespace Game
RolePollInform rolePollInform = new();
rolePollInform.From = guid;
rolePollInform.PartyIndex = packet.PartyIndex;
rolePollInform.PartyIndex = (sbyte)group.GetGroupCategory();
group.BroadcastPacket(rolePollInform, true);
}
[WorldPacketHandler(ClientOpcodes.SetEveryoneIsAssistant)]
void HandleSetEveryoneIsAssistant(SetEveryoneIsAssistant packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
Group group = GetPlayer().GetGroup(packet.PartyIndex);
if (group == null)
return;
if (!group.IsLeader(GetPlayer().GetGUID()))
@@ -627,7 +625,7 @@ namespace Game
void HandleClearRaidMarker(ClearRaidMarker packet)
{
Group group = GetPlayer().GetGroup();
if (!group)
if (group == null)
return;
if (group.IsRaidGroup() && !group.IsLeader(GetPlayer().GetGUID()) && !group.IsAssistant(GetPlayer().GetGUID()))
@@ -635,5 +633,92 @@ namespace Game
group.DeleteRaidMarker(packet.MarkerId);
}
bool CanSendPing(Player player, PingSubjectType type, ref Group group)
{
if (type >= PingSubjectType.Max)
return false;
if (!player.GetSession().CanSpeak())
return false;
group = player.GetGroup();
if (!group)
return false;
if (group.IsRestrictPingsToAssistants() && !group.IsLeader(player.GetGUID()) && !group.IsAssistant(player.GetGUID()))
return false;
return true;
}
[WorldPacketHandler(ClientOpcodes.SetRestrictPingsToAssistants)]
void HandleSetRestrictPingsToAssistants(SetRestrictPingsToAssistants setRestrictPingsToAssistants)
{
Group group = GetPlayer().GetGroup(setRestrictPingsToAssistants.PartyIndex);
if (!group)
return;
if (!group.IsLeader(GetPlayer().GetGUID()))
return;
group.SetRestrictPingsToAssistants(setRestrictPingsToAssistants.RestrictPingsToAssistants);
}
[WorldPacketHandler(ClientOpcodes.SendPingUnit)]
void HandleSendPingUnit(SendPingUnit pingUnit)
{
Group group = null;
if (!CanSendPing(_player, pingUnit.Type, ref group))
return;
Unit target = Global.ObjAccessor.GetUnit(_player, pingUnit.TargetGUID);
if (!target || !_player.HaveAtClient(target))
return;
ReceivePingUnit broadcastPingUnit = new();
broadcastPingUnit.SenderGUID = _player.GetGUID();
broadcastPingUnit.TargetGUID = pingUnit.TargetGUID;
broadcastPingUnit.Type = pingUnit.Type;
broadcastPingUnit.PinFrameID = pingUnit.PinFrameID;
broadcastPingUnit.Write();
for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next())
{
Player member = itr.GetSource();
if (_player == member || !_player.IsInMap(member))
continue;
member.SendPacket(broadcastPingUnit);
}
}
[WorldPacketHandler(ClientOpcodes.SendPingWorldPoint)]
void HandleSendPingWorldPoint(SendPingWorldPoint pingWorldPoint)
{
Group group = null;
if (!CanSendPing(_player, pingWorldPoint.Type, ref group))
return;
if (_player.GetMapId() != pingWorldPoint.MapID)
return;
ReceivePingWorldPoint broadcastPingWorldPoint = new();
broadcastPingWorldPoint.SenderGUID = _player.GetGUID();
broadcastPingWorldPoint.MapID = pingWorldPoint.MapID;
broadcastPingWorldPoint.Point = pingWorldPoint.Point;
broadcastPingWorldPoint.Type = pingWorldPoint.Type;
broadcastPingWorldPoint.PinFrameID = pingWorldPoint.PinFrameID;
broadcastPingWorldPoint.Write();
for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next())
{
Player member = itr.GetSource();
if (_player == member || !_player.IsInMap(member))
continue;
member.SendPacket(broadcastPingWorldPoint);
}
}
}
}
+10
View File
@@ -38,6 +38,16 @@ namespace Game
if (v.Value != PlayerSpellState.Removed)
inspectResult.Talents.Add((ushort)v.Key);
}
var pvpTalents = player.GetPvpTalentMap(player.GetActiveTalentGroup());
for (int i = 0; i < pvpTalents.Length; ++i)
inspectResult.PvpTalents[i] = (ushort)pvpTalents[i];
inspectResult.TalentTraits.Level = (int)player.GetLevel();
inspectResult.TalentTraits.ChrSpecializationID = (int)player.GetPrimarySpecialization();
TraitConfig traitConfig = player.GetTraitConfig((int)(uint)player.m_activePlayerData.ActiveCombatTraitConfigID);
if (traitConfig != null)
inspectResult.TalentTraits.Config = new TraitConfigPacket(traitConfig);
}
Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId());
+2 -2
View File
@@ -265,7 +265,7 @@ namespace Game
foreach (var dungeonId in updateData.dungeons)
lfgUpdateStatus.Slots.Add(Global.LFGMgr.GetLFGDungeonEntry(dungeonId));
lfgUpdateStatus.RequestedRoles = (uint)Global.LFGMgr.GetRoles(_player.GetGUID());
lfgUpdateStatus.RequestedRoles = (byte)Global.LFGMgr.GetRoles(_player.GetGUID());
//lfgUpdateStatus.SuspendedPlayers;
lfgUpdateStatus.IsParty = party;
lfgUpdateStatus.NotifyUI = true;
@@ -480,7 +480,7 @@ namespace Game
foreach (var pair in proposal.players)
{
var proposalPlayer = new LFGProposalUpdatePlayer();
proposalPlayer.Roles = (uint)pair.Value.role;
proposalPlayer.Roles = (byte)pair.Value.role;
proposalPlayer.Me = (pair.Key == playerGuid);
proposalPlayer.MyParty = !pair.Value.group.IsEmpty() && pair.Value.group == proposal.group;
proposalPlayer.SameParty = !pair.Value.group.IsEmpty() && pair.Value.group == guildGuid;
+3
View File
@@ -138,6 +138,9 @@ namespace Game
if (opcode == ClientOpcodes.MoveFallLand || opcode == ClientOpcodes.MoveStartSwim || opcode == ClientOpcodes.MoveSetFly)
mover.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.LandingOrFlight); // Parachutes
if (opcode == ClientOpcodes.MoveSetFly || opcode == ClientOpcodes.MoveSetAdvFly)
_player.UnsummonPetTemporaryIfAny(); // always do the pet removal on current client activeplayer only
movementInfo.Guid = mover.GetGUID();
movementInfo.Time = AdjustClientMovementTime(movementInfo.Time);
mover.m_movementInfo = movementInfo;
+3
View File
@@ -40,6 +40,9 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.PetAction)]
void HandlePetAction(PetAction packet)
{
if (_player.IsMounted())
return;
ObjectGuid guid1 = packet.PetGUID; //pet guid
ObjectGuid guid2 = packet.TargetGUID; //tag guid
+3 -3
View File
@@ -366,14 +366,14 @@ namespace Game.Maps
InitializeCombatResurrections(1, resInterval);
SendEncounterStart(1, 9, resInterval, resInterval);
instance.DoOnPlayers(player => player.AtStartOfEncounter());
instance.DoOnPlayers(player => player.AtStartOfEncounter(EncounterType.DungeonEncounter));
break;
}
case EncounterState.Fail:
ResetCombatResurrections();
SendEncounterEnd();
instance.DoOnPlayers(player => player.AtEndOfEncounter());
instance.DoOnPlayers(player => player.AtEndOfEncounter(EncounterType.DungeonEncounter));
break;
case EncounterState.Done:
ResetCombatResurrections();
@@ -385,7 +385,7 @@ namespace Game.Maps
SendBossKillCredit(dungeonEncounter.Id);
}
instance.DoOnPlayers(player => player.AtEndOfEncounter());
instance.DoOnPlayers(player => player.AtEndOfEncounter(EncounterType.DungeonEncounter));
break;
default:
break;
+1 -1
View File
@@ -120,7 +120,7 @@ namespace Game.Maps
public override void Visit(IList<AreaTrigger> objs)
{
CellCoord cellCoord = i_cell.GetCellCoord();
SortedSet<ulong> areaTriggers = Global.AreaTriggerDataStorage.GetAreaTriggersForMapAndCell(i_map.GetId(), cellCoord.GetId());
SortedSet<ulong> areaTriggers = Global.AreaTriggerDataStorage.GetAreaTriggersForMapAndCell(i_map.GetId(), i_map.GetDifficultyID(), cellCoord.GetId());
if (areaTriggers == null)
return;
+15 -20
View File
@@ -5,32 +5,32 @@ using Framework.Constants;
using System.Runtime.InteropServices;
namespace Game.Miscellaneous
{
{
public struct RaceMask
{
public static RaceMask<ulong> AllPlayable = new RaceMask<ulong>(
public static RaceMask<ulong> AllPlayable = new RaceMask<ulong>((ulong)(
RaceMask<ulong>.GetMaskForRace(Race.Human) | RaceMask<ulong>.GetMaskForRace(Race.Orc) | RaceMask<ulong>.GetMaskForRace(Race.Dwarf) | RaceMask<ulong>.GetMaskForRace(Race.NightElf) |
RaceMask<ulong>.GetMaskForRace(Race.Undead) | RaceMask<ulong>.GetMaskForRace(Race.Tauren) | RaceMask<ulong>.GetMaskForRace(Race.Gnome) | RaceMask<ulong>.GetMaskForRace(Race.Troll) |
RaceMask<ulong>.GetMaskForRace(Race.BloodElf) | RaceMask<ulong>.GetMaskForRace(Race.Draenei) | RaceMask<ulong>.GetMaskForRace(Race.Goblin) | RaceMask<ulong>.GetMaskForRace(Race.Worgen) |
RaceMask<ulong>.GetMaskForRace(Race.PandarenNeutral) | RaceMask<ulong>.GetMaskForRace(Race.PandarenAlliance) | RaceMask<ulong>.GetMaskForRace(Race.PandarenHorde) | RaceMask<ulong>.GetMaskForRace(Race.Nightborne) |
RaceMask<ulong>.GetMaskForRace(Race.HighmountainTauren) | RaceMask<ulong>.GetMaskForRace(Race.VoidElf) | RaceMask<ulong>.GetMaskForRace(Race.LightforgedDraenei) | RaceMask<ulong>.GetMaskForRace(Race.ZandalariTroll) |
RaceMask<ulong>.GetMaskForRace(Race.KulTiran) | RaceMask<ulong>.GetMaskForRace(Race.DarkIronDwarf) | RaceMask<ulong>.GetMaskForRace(Race.Vulpera) | RaceMask<ulong>.GetMaskForRace(Race.MagharOrc) |
RaceMask<ulong>.GetMaskForRace(Race.MechaGnome) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrAlliance) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrHorde));
RaceMask<ulong>.GetMaskForRace(Race.MechaGnome) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrAlliance) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrHorde)));
public static RaceMask<ulong> Neutral = new RaceMask<ulong>((ulong)RaceMask<ulong>.GetMaskForRace(Race.PandarenNeutral));
public static RaceMask<ulong> Neutral = new(RaceMask<ulong>.GetMaskForRace(Race.PandarenNeutral));
public static RaceMask<ulong> Alliance = new(
public static RaceMask<ulong> Alliance = new RaceMask<ulong>((ulong)(
RaceMask<ulong>.GetMaskForRace(Race.Human) | RaceMask<ulong>.GetMaskForRace(Race.Dwarf) | RaceMask<ulong>.GetMaskForRace(Race.NightElf) |
RaceMask<ulong>.GetMaskForRace(Race.Gnome) | RaceMask<ulong>.GetMaskForRace(Race.Draenei) | RaceMask<ulong>.GetMaskForRace(Race.Worgen) |
RaceMask<ulong>.GetMaskForRace(Race.PandarenAlliance) | RaceMask<ulong>.GetMaskForRace(Race.VoidElf) | RaceMask<ulong>.GetMaskForRace(Race.LightforgedDraenei) |
RaceMask<ulong>.GetMaskForRace(Race.KulTiran) | RaceMask<ulong>.GetMaskForRace(Race.DarkIronDwarf) | RaceMask<ulong>.GetMaskForRace(Race.MechaGnome) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrAlliance));
RaceMask<ulong>.GetMaskForRace(Race.KulTiran) | RaceMask<ulong>.GetMaskForRace(Race.DarkIronDwarf) | RaceMask<ulong>.GetMaskForRace(Race.MechaGnome) | RaceMask<ulong>.GetMaskForRace(Race.DracthyrAlliance)));
public static RaceMask<ulong> Horde = new(AllPlayable.RawValue & ~(Neutral | Alliance).RawValue);
public static RaceMask<ulong> Horde = new RaceMask<ulong>((ulong)(AllPlayable.RawValue & (~(Neutral | Alliance).RawValue)));
}
public struct RaceMask<T> where T : unmanaged
public struct RaceMask<T>
{
public T RawValue;
public dynamic RawValue;
public RaceMask(T rawValue)
{
@@ -39,26 +39,21 @@ namespace Game.Miscellaneous
public bool HasRace(Race raceId)
{
return ((dynamic)RawValue & GetMaskForRace(raceId)) != 0;
return (RawValue & GetMaskForRace(raceId)) != 0;
}
public bool IsEmpty()
{
return RawValue == (dynamic)0;
return RawValue == 0;
}
public static RaceMask<T> operator &(RaceMask<T> left, RaceMask<T> right) { return new RaceMask<T>((dynamic)left.RawValue & right.RawValue); }
public static RaceMask<T> operator |(RaceMask<T> left, RaceMask<T> right) { return new RaceMask<T>((dynamic)left.RawValue | right.RawValue); }
public static explicit operator T(RaceMask<T> raceMask)
{
return raceMask.RawValue;
}
public static RaceMask<T> operator &(RaceMask<T> left, RaceMask<T> right) { return new RaceMask<T>(left.RawValue & right.RawValue); }
public static RaceMask<T> operator |(RaceMask<T> left, RaceMask<T> right) { return new RaceMask<T>(left.RawValue | right.RawValue); }
public static dynamic GetMaskForRace(Race raceId)
{
int raceBit = GetRaceBit(raceId);
return (raceBit >= 0 && (uint)raceBit < Marshal.SizeOf<T>() * 8 ? (1 << raceBit) : 0);
return (T)(dynamic)(raceBit >= 0 && (uint)raceBit < Marshal.SizeOf<T>() * 8 ? (1 << raceBit) : 0);
}
static int GetRaceBit(Race raceId)
@@ -532,8 +532,8 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WriteUInt32(RankID);
_worldPacket.WriteInt32(WithdrawGoldLimit);
_worldPacket.WriteInt32(Flags);
_worldPacket.WriteInt32(WithdrawGoldLimit);
_worldPacket.WriteInt32(NumTabs);
_worldPacket.WriteInt32(Tab.Count);
@@ -224,7 +224,7 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WriteInt8((sbyte)BagResult);
_worldPacket.WriteInt32((int)BagResult);
_worldPacket.WritePackedGuid(Item[0]);
_worldPacket.WritePackedGuid(Item[1]);
_worldPacket.WriteUInt8(ContainerBSlot); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_WRONG_BAG_TYPE_2
@@ -389,12 +389,14 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WritePackedGuid(VendorGUID);
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt8((byte)Reason);
_worldPacket.WriteInt32(ItemGUIDs.Count);
_worldPacket.WriteInt32((int)Reason);
foreach (ObjectGuid itemGuid in ItemGUIDs)
_worldPacket.WritePackedGuid(itemGuid);
}
public ObjectGuid VendorGUID;
public ObjectGuid ItemGUID;
public List<ObjectGuid> ItemGUIDs = new();
public SellResult Reason = SellResult.Unk;
}
+24 -18
View File
@@ -16,18 +16,21 @@ namespace Game.Networking.Packets
public override void Read()
{
QueueAsGroup = _worldPacket.HasBit();
bool hasPartyIndex = _worldPacket.HasBit();
Unknown = _worldPacket.HasBit();
PartyIndex = _worldPacket.ReadUInt8();
Roles = (LfgRoles)_worldPacket.ReadUInt32();
var slotsCount = _worldPacket.ReadInt32();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
for (var i = 0; i < slotsCount; ++i) // Slots
Slots.Add(_worldPacket.ReadUInt32());
}
public bool QueueAsGroup;
bool Unknown; // Always false in 7.2.5
public byte PartyIndex;
public bool Unknown; // Always false in 7.2.5
public byte? PartyIndex;
public LfgRoles Roles;
public List<uint> Slots = new();
}
@@ -68,12 +71,14 @@ namespace Game.Networking.Packets
public override void Read()
{
bool hasPartyIndex = _worldPacket.HasBit();
RolesDesired = (LfgRoles)_worldPacket.ReadUInt32();
PartyIndex = _worldPacket.ReadUInt8();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public LfgRoles RolesDesired;
public byte PartyIndex;
public byte? PartyIndex;
}
class DFBootPlayerVote : ClientPacket
@@ -107,10 +112,11 @@ namespace Game.Networking.Packets
public override void Read()
{
Player = _worldPacket.HasBit();
PartyIndex = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public bool Player;
}
@@ -163,7 +169,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt8(SubType);
_worldPacket.WriteUInt8(Reason);
_worldPacket.WriteInt32(Slots.Count);
_worldPacket.WriteUInt32(RequestedRoles);
_worldPacket.WriteUInt8(RequestedRoles);
_worldPacket.WriteInt32(SuspendedPlayers.Count);
_worldPacket.WriteUInt32(QueueMapID);
@@ -186,7 +192,7 @@ namespace Game.Networking.Packets
public byte SubType;
public byte Reason;
public List<uint> Slots = new();
public uint RequestedRoles;
public byte RequestedRoles;
public List<ObjectGuid> SuspendedPlayers = new();
public uint QueueMapID;
public bool NotifyUI;
@@ -204,7 +210,7 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteUInt32((uint)RoleMask);
_worldPacket.WriteUInt8((byte)RoleMask);
_worldPacket.WriteBit(Accepted);
_worldPacket.FlushBits();
}
@@ -497,7 +503,7 @@ namespace Game.Networking.Packets
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Mask);
data.WriteUInt8(Mask);
data.WriteUInt32(RewardMoney);
data.WriteUInt32(RewardXP);
data.WriteInt32(Item.Count);
@@ -544,7 +550,7 @@ namespace Game.Networking.Packets
data.WriteInt32(Honor.Value);
}
public uint Mask;
public byte Mask;
public uint RewardMoney;
public uint RewardXP;
public List<LfgPlayerQuestRewardItem> Item = new();
@@ -608,7 +614,7 @@ namespace Game.Networking.Packets
public class LFGRoleCheckUpdateMember
{
public LFGRoleCheckUpdateMember(ObjectGuid guid, uint rolesDesired, byte level, bool roleCheckComplete)
public LFGRoleCheckUpdateMember(ObjectGuid guid, byte rolesDesired, byte level, bool roleCheckComplete)
{
Guid = guid;
RolesDesired = rolesDesired;
@@ -619,14 +625,14 @@ namespace Game.Networking.Packets
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WriteUInt32(RolesDesired);
data.WriteUInt8(RolesDesired);
data.WriteUInt8(Level);
data.WriteBit(RoleCheckComplete);
data.FlushBits();
}
public ObjectGuid Guid;
public uint RolesDesired;
public byte RolesDesired;
public byte Level;
public bool RoleCheckComplete;
}
@@ -723,7 +729,7 @@ namespace Game.Networking.Packets
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Roles);
data.WriteUInt8(Roles);
data.WriteBit(Me);
data.WriteBit(SameParty);
data.WriteBit(MyParty);
@@ -732,7 +738,7 @@ namespace Game.Networking.Packets
data.FlushBits();
}
public uint Roles;
public byte Roles;
public bool Me;
public bool SameParty;
public bool MyParty;
@@ -754,14 +754,16 @@ namespace Game.Networking.Packets
public override void Read()
{
bool hasPartyIndex = _worldPacket.HasBit();
Min = _worldPacket.ReadUInt32();
Max = _worldPacket.ReadUInt32();
PartyIndex = _worldPacket.ReadUInt8();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public uint Min;
public uint Max;
public byte PartyIndex;
public byte? PartyIndex;
}
public class RandomRoll : ServerPacket
+204 -61
View File
@@ -8,6 +8,7 @@ using Game.Groups;
using Game.Spells;
using System;
using System.Collections.Generic;
using System.Numerics;
namespace Game.Networking.Packets
{
@@ -39,8 +40,9 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
_worldPacket.ResetBitPos();
uint targetNameLen = _worldPacket.ReadBits<uint>(9);
uint targetRealmLen = _worldPacket.ReadBits<uint>(9);
@@ -49,9 +51,11 @@ namespace Game.Networking.Packets
TargetName = _worldPacket.ReadString(targetNameLen);
TargetRealm = _worldPacket.ReadString(targetRealmLen);
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public uint ProposedRoles;
public string TargetName;
public string TargetRealm;
@@ -70,7 +74,7 @@ namespace Game.Networking.Packets
InviterGUID = inviter.GetGUID();
InviterBNetAccountId = inviter.GetSession().GetAccountGUID();
ProposedRoles = proposedRoles;
ProposedRoles = (byte)proposedRoles;
var realm = Global.WorldMgr.GetRealm();
InviterRealm = new VirtualRealmInfo(realm.Id.GetAddress(), true, false, realm.Name, realm.NormalizedName);
@@ -91,7 +95,7 @@ namespace Game.Networking.Packets
_worldPacket.WritePackedGuid(InviterGUID);
_worldPacket.WritePackedGuid(InviterBNetAccountId);
_worldPacket.WriteUInt16(Unk1);
_worldPacket.WriteUInt32(ProposedRoles);
_worldPacket.WriteUInt8(ProposedRoles);
_worldPacket.WriteInt32(LfgSlots.Count);
_worldPacket.WriteInt32(LfgCompletedMask);
@@ -119,7 +123,7 @@ namespace Game.Networking.Packets
public bool IsXRealm;
// Lfg
public uint ProposedRoles;
public byte ProposedRoles;
public int LfgCompletedMask;
public List<int> LfgSlots = new();
}
@@ -130,18 +134,21 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
Accept = _worldPacket.HasBit();
bool hasRolesDesired = _worldPacket.HasBit();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
if (hasRolesDesired)
RolesDesired = _worldPacket.ReadUInt32();
RolesDesired = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public bool Accept;
public uint? RolesDesired;
public byte? RolesDesired;
}
class PartyUninvite : ClientPacket
@@ -150,14 +157,18 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
byte reasonLen = _worldPacket.ReadBits<byte>(8);
TargetGUID = _worldPacket.ReadPackedGuid();
byte reasonLen = _worldPacket.ReadBits<byte>(8);
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
Reason = _worldPacket.ReadString(reasonLen);
}
public byte PartyIndex;
public byte? PartyIndex;
public ObjectGuid TargetGUID;
public string Reason;
}
@@ -192,11 +203,13 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
TargetGUID = _worldPacket.ReadPackedGuid();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public ObjectGuid TargetGUID;
}
@@ -265,8 +278,8 @@ namespace Game.Networking.Packets
MemberStats.PositionZ = (short)(player.GetPositionZ());
MemberStats.SpecID = (ushort)player.GetPrimarySpecialization();
MemberStats.PartyType[0] = (sbyte)(player.m_playerData.PartyType & 0xF);
MemberStats.PartyType[1] = (sbyte)(player.m_playerData.PartyType >> 4);
MemberStats.PartyType[0] = player.m_playerData.PartyType[0];
MemberStats.PartyType[1] = player.m_playerData.PartyType[1];
MemberStats.WmoGroupID = 0;
MemberStats.WmoDoodadPlacementID = 0;
@@ -356,11 +369,13 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
bool hasPartyIndex = _worldPacket.HasBit();
TargetGUID = _worldPacket.ReadPackedGuid();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
public ObjectGuid TargetGUID;
}
@@ -370,14 +385,16 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
bool hasPartyIndex = _worldPacket.HasBit();
TargetGUID = _worldPacket.ReadPackedGuid();
Role = _worldPacket.ReadInt32();
Role = _worldPacket.ReadUInt8();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
public ObjectGuid TargetGUID;
public int Role;
public byte Role;
}
class RoleChangedInform : ServerPacket
@@ -386,18 +403,18 @@ namespace Game.Networking.Packets
public override void Write()
{
_worldPacket.WriteInt8(PartyIndex);
_worldPacket.WriteUInt8(PartyIndex);
_worldPacket.WritePackedGuid(From);
_worldPacket.WritePackedGuid(ChangedUnit);
_worldPacket.WriteInt32(OldRole);
_worldPacket.WriteInt32(NewRole);
_worldPacket.WriteUInt8(OldRole);
_worldPacket.WriteUInt8(NewRole);
}
public sbyte PartyIndex;
public byte PartyIndex;
public ObjectGuid From;
public ObjectGuid ChangedUnit;
public int OldRole;
public int NewRole;
public byte OldRole;
public byte NewRole;
}
class LeaveGroup : ClientPacket
@@ -406,10 +423,11 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
}
class GroupDestroyed : ServerPacket
@@ -425,13 +443,15 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
bool hasPartyIndex = _worldPacket.HasBit();
LootMethod = (LootMethod)_worldPacket.ReadUInt8();
LootMasterGUID = _worldPacket.ReadPackedGuid();
LootThreshold = (ItemQuality)_worldPacket.ReadUInt32();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
public ObjectGuid LootMasterGUID;
public LootMethod LootMethod;
public ItemQuality LootThreshold;
@@ -443,12 +463,14 @@ namespace Game.Networking.Packets
public override void Read()
{
bool hasPartyIndex = _worldPacket.HasBit();
PositionX = _worldPacket.ReadFloat();
PositionY = _worldPacket.ReadFloat();
PartyIndex = _worldPacket.ReadInt8();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
public float PositionX;
public float PositionY;
}
@@ -475,12 +497,14 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
bool hasPartyIndex = _worldPacket.HasBit();
Target = _worldPacket.ReadPackedGuid();
Symbol = _worldPacket.ReadInt8();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
public ObjectGuid Target;
public sbyte Symbol;
}
@@ -542,10 +566,11 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
}
class SetAssistantLeader : ClientPacket
@@ -554,13 +579,15 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
Target = _worldPacket.ReadPackedGuid();
bool hasPartyIndex = _worldPacket.HasBit();
Apply = _worldPacket.HasBit();
Target = _worldPacket.ReadPackedGuid();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public ObjectGuid Target;
public byte PartyIndex;
public byte? PartyIndex;
public bool Apply;
}
@@ -570,14 +597,16 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
Set = _worldPacket.HasBit();
Assignment = _worldPacket.ReadUInt8();
Target = _worldPacket.ReadPackedGuid();
Set = _worldPacket.HasBit();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public byte Assignment;
public byte PartyIndex;
public byte? PartyIndex;
public ObjectGuid Target;
public bool Set;
}
@@ -588,10 +617,11 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
}
class ReadyCheckStarted : ServerPacket
@@ -618,11 +648,12 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
IsReady = _worldPacket.HasBit();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public bool IsReady;
}
@@ -683,10 +714,11 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public sbyte PartyIndex;
public byte? PartyIndex;
}
class RolePollInform : ServerPacket
@@ -775,11 +807,13 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadUInt8();
bool hasPartyIndex = _worldPacket.HasBit();
EveryoneIsAssistant = _worldPacket.HasBit();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public byte? PartyIndex;
public bool EveryoneIsAssistant;
}
@@ -790,12 +824,13 @@ namespace Game.Networking.Packets
public override void Read()
{
TargetGUID = _worldPacket.ReadPackedGuid();
PartyIndex = _worldPacket.ReadInt8();
NewSubGroup = _worldPacket.ReadUInt8();
if (_worldPacket.HasBit())
PartyIndex = _worldPacket.ReadUInt8();
}
public ObjectGuid TargetGUID;
public sbyte PartyIndex;
public byte? PartyIndex;
public byte NewSubGroup;
}
@@ -805,14 +840,16 @@ namespace Game.Networking.Packets
public override void Read()
{
PartyIndex = _worldPacket.ReadInt8();
bool hasPartyIndex = _worldPacket.HasBit();
FirstTarget = _worldPacket.ReadPackedGuid();
SecondTarget = _worldPacket.ReadPackedGuid();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
public ObjectGuid FirstTarget;
public ObjectGuid SecondTarget;
public sbyte PartyIndex;
public byte? PartyIndex;
}
class ClearRaidMarker : ClientPacket
@@ -893,7 +930,113 @@ namespace Game.Networking.Packets
_worldPacket.FlushBits();
}
}
class SetRestrictPingsToAssistants : ClientPacket
{
public byte? PartyIndex;
public bool RestrictPingsToAssistants;
public SetRestrictPingsToAssistants(WorldPacket packet) : base(packet) { }
public override void Read()
{
bool hasPartyIndex = _worldPacket.HasBit();
RestrictPingsToAssistants = _worldPacket.HasBit();
if (hasPartyIndex)
PartyIndex = _worldPacket.ReadUInt8();
}
}
class SendPingUnit : ClientPacket
{
public ObjectGuid SenderGUID;
public ObjectGuid TargetGUID;
public PingSubjectType Type = PingSubjectType.Max;
public uint PinFrameID;
public SendPingUnit(WorldPacket packet) : base(packet) { }
public override void Read()
{
SenderGUID = _worldPacket.ReadPackedGuid();
TargetGUID = _worldPacket.ReadPackedGuid();
Type = (PingSubjectType)_worldPacket.ReadUInt8();
PinFrameID = _worldPacket.ReadUInt32();
}
}
class ReceivePingUnit : ServerPacket
{
public ObjectGuid SenderGUID;
public ObjectGuid TargetGUID;
public PingSubjectType Type = PingSubjectType.Max;
public uint PinFrameID;
public ReceivePingUnit() : base(ServerOpcodes.ReceivePingUnit) { }
public override void Write()
{
_worldPacket.WritePackedGuid(SenderGUID);
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WriteUInt8((byte)Type);
_worldPacket.WriteUInt32(PinFrameID);
}
}
class SendPingWorldPoint : ClientPacket
{
public ObjectGuid SenderGUID;
public uint MapID;
public Vector3 Point;
public PingSubjectType Type = PingSubjectType.Max;
public uint PinFrameID;
public SendPingWorldPoint(WorldPacket packet) : base(packet) { }
public override void Read()
{
SenderGUID = _worldPacket.ReadPackedGuid();
MapID = _worldPacket.ReadUInt32();
Point = _worldPacket.ReadVector3();
Type = (PingSubjectType)_worldPacket.ReadUInt8();
PinFrameID = _worldPacket.ReadUInt32();
}
}
class ReceivePingWorldPoint : ServerPacket
{
public ObjectGuid SenderGUID;
public uint MapID = 0;
public Vector3 Point;
public PingSubjectType Type = PingSubjectType.Max;
public uint PinFrameID;
public ReceivePingWorldPoint() : base(ServerOpcodes.ReceivePingWorldPoint) { }
public override void Write()
{
_worldPacket.WritePackedGuid(SenderGUID);
_worldPacket.WriteUInt32(MapID);
_worldPacket.WriteVector3(Point);
_worldPacket.WriteUInt8((byte)Type);
_worldPacket.WriteUInt32(PinFrameID);
}
}
class CancelPingPin : ServerPacket
{
public ObjectGuid SenderGUID;
public uint PinFrameID;
public CancelPingPin() : base(ServerOpcodes.CancelPingPin) { }
public override void Write()
{
_worldPacket.WritePackedGuid(SenderGUID);
_worldPacket.WriteUInt32(PinFrameID);
}
}
//Structs
public struct PartyMemberPhase
{
@@ -931,7 +1074,7 @@ namespace Game.Networking.Packets
}
class PartyMemberAuraStates
{
{
public int SpellID;
public ushort Flags;
public uint ActiveFlags;
@@ -993,7 +1136,7 @@ namespace Game.Networking.Packets
public void Write(WorldPacket data)
{
for (byte i = 0; i < 2; i++)
data.WriteInt8(PartyType[i]);
data.WriteUInt8(PartyType[i]);
data.WriteInt16((short)Status);
data.WriteUInt8(PowerType);
@@ -1053,7 +1196,7 @@ namespace Game.Networking.Packets
public ushort SpecID;
public ushort WmoGroupID;
public uint WmoDoodadPlacementID;
public sbyte[] PartyType = new sbyte[2];
public byte[] PartyType = new byte[2];
public CTROptions ChromieTime;
public DungeonScoreSummary DungeonScore = new();
}
@@ -337,6 +337,23 @@ namespace Game.Networking.Packets
public byte Result;
}
class PetMode : ServerPacket
{
public ObjectGuid PetGUID;
public ReactStates ReactState;
public CommandStates CommandState;
public byte Flag;
public PetMode() : base(ServerOpcodes.PetMode, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PetGUID);
_worldPacket.WriteUInt16((ushort)((int)CommandState | Flag << 8));
_worldPacket.WriteUInt8((byte)ReactState);
}
}
//Structs
public class PetSpellCooldown
+7 -21
View File
@@ -1753,11 +1753,9 @@ namespace Game.Networking.Packets
public void Write(WorldPacket data)
{
data.WriteBits((byte)Reason, 4);
data.WriteUInt8((byte)Reason);
if (Reason == SpellMissInfo.Reflect)
data.WriteBits(ReflectStatus, 4);
data.FlushBits();
data.WriteUInt8((byte)ReflectStatus);
}
public SpellMissInfo Reason;
@@ -1805,18 +1803,6 @@ namespace Game.Networking.Packets
}
}
public struct SpellAmmo
{
public int DisplayID;
public sbyte InventoryType;
public void Write(WorldPacket data)
{
data.WriteInt32(DisplayID);
data.WriteInt8(InventoryType);
}
}
public struct CreatureImmunities
{
public uint School;
@@ -1861,7 +1847,7 @@ namespace Game.Networking.Packets
MissileTrajectory.Write(data);
data.WriteInt32(Ammo.DisplayID);
data.WriteInt32(AmmoDisplayID);
data.WriteUInt8(DestLocSpellCastIndex);
Immunities.Write(data);
@@ -1876,9 +1862,6 @@ namespace Game.Networking.Packets
data.WriteBits(TargetPoints.Count, 16);
data.FlushBits();
foreach (SpellMissStatus missStatus in MissStatus)
missStatus.Write(data);
Target.Write(data);
foreach (ObjectGuid hitTarget in HitTargets)
@@ -1890,6 +1873,9 @@ namespace Game.Networking.Packets
foreach (SpellHitStatus hitStatus in HitStatus)
hitStatus.Write(data);
foreach (SpellMissStatus missStatus in MissStatus)
missStatus.Write(data);
foreach (SpellPowerData power in RemainingPower)
power.Write(data);
@@ -1917,7 +1903,7 @@ namespace Game.Networking.Packets
public List<SpellPowerData> RemainingPower = new();
public RuneData RemainingRunes;
public MissileTrajectoryResult MissileTrajectory;
public SpellAmmo Ammo;
public int AmmoDisplayID;
public byte DestLocSpellCastIndex;
public List<TargetLocation> TargetPoints = new();
public CreatureImmunities Immunities;
@@ -85,6 +85,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteBit(AddonsDisabled);
_worldPacket.WriteBit(Unused1000);
_worldPacket.WriteBit(ContentTrackingEnabled);
_worldPacket.WriteBit(IsSellAllJunkEnabled);
_worldPacket.FlushBits();
@@ -178,6 +179,7 @@ namespace Game.Networking.Packets
public bool AddonsDisabled;
public bool Unused1000;
public bool ContentTrackingEnabled;
public bool IsSellAllJunkEnabled;
public SocialQueueConfig QuickJoinConfig;
public SquelchInfo Squelch;
@@ -272,6 +274,10 @@ namespace Game.Networking.Packets
_worldPacket.WriteBit(AccountSaveDataExportEnabled);
_worldPacket.WriteBit(AccountLockedByExport);
_worldPacket.WriteBit(!RealmHiddenAlert.IsEmpty());
if (!RealmHiddenAlert.IsEmpty())
_worldPacket.WriteBits(RealmHiddenAlert.GetByteCount() + 1, 11);
_worldPacket.FlushBits();
@@ -299,6 +305,9 @@ namespace Game.Networking.Packets
if (LaunchETA.HasValue)
_worldPacket.WriteInt32(LaunchETA.Value);
if (!RealmHiddenAlert.IsEmpty())
_worldPacket.WriteString(RealmHiddenAlert);
foreach (var sourceRegion in LiveRegionCharacterCopySourceRegions)
_worldPacket.WriteInt32(sourceRegion);
@@ -349,6 +358,7 @@ namespace Game.Networking.Packets
public int? LaunchETA;
public List<DebugTimeEventInfo> DebugTimeEvents = new();
public int Unused1007;
public string RealmHiddenAlert;
}
public class MOTD : ServerPacket
+1
View File
@@ -156,6 +156,7 @@ namespace Game.Scripting
case "ConversationScript":
case "AchievementScript":
case "BattlefieldScript":
case "EventScript":
if (!attribute.Name.IsEmpty())
name = attribute.Name;
+5 -5
View File
@@ -3860,9 +3860,10 @@ namespace Game.Spells
}
}
UpdateSpellCastDataAmmo(castData.Ammo);
if (castFlags.HasFlag(SpellCastFlags.Projectile))
castData.AmmoDisplayID = (int)GetSpellCastDataAmmo();
if (castFlags.HasAnyFlag(SpellCastFlags.Immunity))
if (castFlags.HasFlag(SpellCastFlags.Immunity))
{
castData.Immunities.School = schoolImmunityMask;
castData.Immunities.Value = (uint)mechanicImmunityMask;
@@ -4010,7 +4011,7 @@ namespace Game.Spells
m_channelTargetEffectMask = 0;
}
void UpdateSpellCastDataAmmo(SpellAmmo ammo)
uint GetSpellCastDataAmmo()
{
InventoryType ammoInventoryType = 0;
uint ammoDisplayID = 0;
@@ -4084,8 +4085,7 @@ namespace Game.Spells
}
}
ammo.DisplayID = (int)ammoDisplayID;
ammo.InventoryType = (sbyte)ammoInventoryType;
return ammoDisplayID;
}
void SendSpellExecuteLog()