Misc bug fixes
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Framework.Constants
|
||||
{
|
||||
[Flags]
|
||||
public enum UpdateFlag
|
||||
{
|
||||
None = 0x0,
|
||||
Self = 0x1,
|
||||
Transport = 0x2,
|
||||
HasTarget = 0x4,
|
||||
Living = 0x8,
|
||||
StationaryPosition = 0x10,
|
||||
Vehicle = 0x20,
|
||||
TransportPosition = 0x40,
|
||||
Rotation = 0x80,
|
||||
AnimKits = 0x100,
|
||||
Areatrigger = 0x0200,
|
||||
Gameobject = 0x0400,
|
||||
//UPDATEFLAG_REPLACE_ACTIVE = 0x0800,
|
||||
//UPDATEFLAG_NO_BIRTH_ANIM = 0x1000,
|
||||
//UPDATEFLAG_ENABLE_PORTALS = 0x2000,
|
||||
//UPDATEFLAG_PLAY_HOVER_ANIM = 0x4000,
|
||||
//UPDATEFLAG_IS_SUPPRESSING_GREETINGS = 0x8000
|
||||
//UPDATEFLAG_SCENEOBJECT = 0x10000,
|
||||
//UPDATEFLAG_SCENE_PENDING_INSTANCE = 0x20000
|
||||
}
|
||||
|
||||
public enum UpdateFieldFlag
|
||||
{
|
||||
None = 0,
|
||||
Owner = 0x01,
|
||||
PartyMember = 0x02,
|
||||
UnitAll = 0x04,
|
||||
Empath = 0x08
|
||||
}
|
||||
}
|
||||
@@ -24,4 +24,13 @@ namespace Framework.Constants
|
||||
CreateObject2 = 2,
|
||||
OutOfRangeObjects = 3,
|
||||
}
|
||||
|
||||
public enum UpdateFieldFlag
|
||||
{
|
||||
None = 0,
|
||||
Owner = 0x01,
|
||||
PartyMember = 0x02,
|
||||
UnitAll = 0x04,
|
||||
Empath = 0x08
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1688,6 +1688,9 @@ namespace Game.DungeonFinding
|
||||
|
||||
public void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid)
|
||||
{
|
||||
if (!GroupsStore.ContainsKey(gguid))
|
||||
GroupsStore[gguid] = new LFGGroupData();
|
||||
|
||||
GroupsStore[gguid].AddPlayer(guid);
|
||||
}
|
||||
|
||||
@@ -1695,6 +1698,7 @@ namespace Game.DungeonFinding
|
||||
{
|
||||
if (!GroupsStore.ContainsKey(gguid))
|
||||
GroupsStore[gguid] = new LFGGroupData();
|
||||
|
||||
GroupsStore[gguid].SetLeader(leader);
|
||||
}
|
||||
|
||||
|
||||
@@ -1233,7 +1233,7 @@ namespace Game.Entities
|
||||
data.WriteBytes(buffer);
|
||||
}
|
||||
|
||||
void BuildValuesUpdateWithFlag(ByteBuffer data, UpdateFieldFlag flags, Player target)
|
||||
public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
{
|
||||
UpdateMask valuesMask = new UpdateMask(14);
|
||||
valuesMask.Set((int)TypeId.Item);
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Game.Entities
|
||||
public void ClearChangesMask<T>(BaseUpdateData<T> updateData)
|
||||
{
|
||||
_changesMask.Reset(updateData.Bit);
|
||||
updateData.ClearChangesMask();
|
||||
}
|
||||
|
||||
public void ClearChangesMask<T, U>(BaseUpdateData<T> updateData, ref UpdateField<U> updateField) where T : new() where U : new()
|
||||
@@ -341,13 +342,13 @@ namespace Game.Entities
|
||||
|
||||
public void ClearChangesMask<U>(UpdateField<U> updateField) where U : new()
|
||||
{
|
||||
if (typeof(U).BaseType == typeof(IHasChangesMask))
|
||||
if (typeof(U).GetInterfaces().Any(x => typeof(IHasChangesMask) == x))
|
||||
((IHasChangesMask)updateField._value).ClearChangesMask();
|
||||
}
|
||||
|
||||
public void ClearChangesMask<U>(UpdateFieldArray<U> updateField) where U : new()
|
||||
{
|
||||
if (typeof(U).BaseType == typeof(IHasChangesMask))
|
||||
if (typeof(U).GetInterfaces().Any(x => typeof(IHasChangesMask) == x))
|
||||
{
|
||||
for (int i = 0; i < updateField.GetSize(); ++i)
|
||||
((IHasChangesMask)updateField[i]).ClearChangesMask();
|
||||
@@ -356,7 +357,7 @@ namespace Game.Entities
|
||||
|
||||
public void ClearChangesMask<U>(DynamicUpdateField<U> updateField) where U : new()
|
||||
{
|
||||
if (typeof(U).BaseType == typeof(IHasChangesMask))
|
||||
if (typeof(U).GetInterfaces().Any(x => typeof(IHasChangesMask) == x))
|
||||
{
|
||||
for (int i = 0; i < updateField.Size(); ++i)
|
||||
((IHasChangesMask)updateField[i]).ClearChangesMask();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -738,7 +738,7 @@ namespace Game.Entities
|
||||
return UpdateFieldFlag.None;
|
||||
}
|
||||
|
||||
void BuildValuesUpdateWithFlag(ByteBuffer data, UpdateFieldFlag flags, Player target)
|
||||
public virtual void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
{
|
||||
data.WriteUInt32(0);
|
||||
data.WriteUInt32(0);
|
||||
|
||||
@@ -186,8 +186,7 @@ namespace Game.Entities
|
||||
|
||||
public int NextGroupUpdateSequenceNumber(GroupCategory category)
|
||||
{
|
||||
var groupUpdate = m_groupUpdateSequences[(int)category];
|
||||
return groupUpdate.UpdateSequenceNumber++;
|
||||
return m_groupUpdateSequences[(int)category].UpdateSequenceNumber++;
|
||||
}
|
||||
|
||||
public bool IsAtGroupRewardDistance(WorldObject pRewardSource)
|
||||
|
||||
@@ -7544,7 +7544,7 @@ namespace Game.Entities
|
||||
data.WriteBytes(buffer);
|
||||
}
|
||||
|
||||
void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
{
|
||||
UpdateMask valuesMask = new UpdateMask((int)TypeId.Max);
|
||||
valuesMask.Set((int)TypeId.Unit);
|
||||
|
||||
@@ -21,6 +21,7 @@ using Game.DataStorage;
|
||||
using Game.Network.Packets;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -116,15 +117,18 @@ namespace Game.Entities
|
||||
|
||||
public void AppendTaximaskTo(ShowTaxiNodes data, bool all)
|
||||
{
|
||||
data.CanLandNodes = new byte[PlayerConst.TaxiMaskSize];
|
||||
data.CanUseNodes = new byte[PlayerConst.TaxiMaskSize];
|
||||
|
||||
if (all)
|
||||
{
|
||||
data.CanLandNodes = CliDB.TaxiNodesMask; // all existed nodes
|
||||
data.CanUseNodes = CliDB.TaxiNodesMask;
|
||||
Buffer.BlockCopy(CliDB.TaxiNodesMask, 0, data.CanLandNodes, 0, PlayerConst.TaxiMaskSize); // all existed nodes
|
||||
Buffer.BlockCopy(CliDB.TaxiNodesMask, 0, data.CanLandNodes, 0, PlayerConst.TaxiMaskSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.CanLandNodes = m_taximask; // known nodes
|
||||
data.CanUseNodes = m_taximask;
|
||||
Buffer.BlockCopy(m_taximask, 0, data.CanLandNodes, 0, PlayerConst.TaxiMaskSize); // known nodes
|
||||
Buffer.BlockCopy(m_taximask, 0, data.CanUseNodes, 0, PlayerConst.TaxiMaskSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2729,7 +2729,7 @@ namespace Game.Entities
|
||||
data.WriteBytes(buffer);
|
||||
}
|
||||
|
||||
void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
public override void BuildValuesUpdateWithFlag(WorldPacket data, UpdateFieldFlag flags, Player target)
|
||||
{
|
||||
UpdateMask valuesMask = new UpdateMask(14);
|
||||
valuesMask.Set((int)TypeId.Unit);
|
||||
|
||||
+15
-12
@@ -133,7 +133,7 @@ namespace Game.Groups
|
||||
m_lootThreshold = (ItemQuality)field.Read<byte>(3);
|
||||
|
||||
for (byte i = 0; i < MapConst.TargetIconsCount; ++i)
|
||||
m_targetIcons[i].SetRawValue(field.Read<string>(4 + i).ToByteArray());
|
||||
m_targetIcons[i].SetRawValue(field.Read<byte[]>(4 + i));
|
||||
|
||||
m_groupFlags = (GroupFlags)field.Read<byte>(12);
|
||||
if (m_groupFlags.HasAnyFlag(GroupFlags.Raid))
|
||||
@@ -910,19 +910,20 @@ namespace Game.Groups
|
||||
public void GroupLoot(Loot loot, WorldObject lootedObject)
|
||||
{
|
||||
byte itemSlot = 0;
|
||||
foreach (var i in loot.items)
|
||||
for (var i = 0; i < loot.items.Count; ++i, ++itemSlot)
|
||||
{
|
||||
if (i.freeforall)
|
||||
LootItem lootItem = loot.items[i];
|
||||
if (lootItem.freeforall)
|
||||
continue;
|
||||
|
||||
ItemTemplate item = Global.ObjectMgr.GetItemTemplate(i.itemid);
|
||||
ItemTemplate item = Global.ObjectMgr.GetItemTemplate(lootItem.itemid);
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
//roll for over-threshold item if it's one-player loot
|
||||
if (item.GetQuality() >= m_lootThreshold)
|
||||
{
|
||||
Roll r = new Roll(i);
|
||||
Roll r = new Roll(lootItem);
|
||||
|
||||
for (GroupReference refe = GetFirstMember(); refe != null; refe = refe.next())
|
||||
{
|
||||
@@ -930,7 +931,7 @@ namespace Game.Groups
|
||||
if (!playerToRoll || playerToRoll.GetSession() == null)
|
||||
continue;
|
||||
|
||||
bool allowedForPlayer = i.AllowedForPlayer(playerToRoll);
|
||||
bool allowedForPlayer = lootItem.AllowedForPlayer(playerToRoll);
|
||||
if (allowedForPlayer && playerToRoll.IsAtGroupRewardDistance(lootedObject))
|
||||
{
|
||||
r.totalPlayersRolling++;
|
||||
@@ -984,7 +985,7 @@ namespace Game.Groups
|
||||
}
|
||||
}
|
||||
else
|
||||
i.is_underthreshold = true;
|
||||
lootItem.is_underthreshold = true;
|
||||
}
|
||||
|
||||
foreach (var i in loot.quest_items)
|
||||
@@ -1076,15 +1077,15 @@ namespace Game.Groups
|
||||
if (roll == null)
|
||||
return;
|
||||
|
||||
var rollType = roll.playerVote.LookupByKey(playerGuid);
|
||||
// this condition means that player joins to the party after roll begins
|
||||
if (rollType == 0)
|
||||
if (!roll.playerVote.ContainsKey(playerGuid))
|
||||
return;
|
||||
|
||||
if (roll.getLoot() != null)
|
||||
if (roll.getLoot().items.Empty())
|
||||
return;
|
||||
|
||||
RollType rollType = RollType.MaxTypes;
|
||||
switch (choice)
|
||||
{
|
||||
case RollType.Pass: // Player choose pass
|
||||
@@ -1109,13 +1110,15 @@ namespace Game.Groups
|
||||
break;
|
||||
}
|
||||
|
||||
roll.playerVote[playerGuid] = rollType;
|
||||
|
||||
if (roll.totalPass + roll.totalNeed + roll.totalGreed >= roll.totalPlayersRolling)
|
||||
CountTheRoll(roll, null);
|
||||
}
|
||||
|
||||
public void EndRoll(Loot pLoot, Map allowedMap)
|
||||
{
|
||||
foreach (var roll in RollId)
|
||||
foreach (var roll in RollId.ToList())
|
||||
{
|
||||
if (roll.getLoot() == pLoot)
|
||||
{
|
||||
@@ -1902,7 +1905,7 @@ namespace Game.Groups
|
||||
if (difficultyDic == null)
|
||||
return;
|
||||
|
||||
foreach (var pair in difficultyDic)
|
||||
foreach (var pair in difficultyDic.ToList())
|
||||
{
|
||||
InstanceSave instanceSave = pair.Value.save;
|
||||
MapRecord entry = CliDB.MapStorage.LookupByKey(pair.Key);
|
||||
@@ -2484,7 +2487,7 @@ namespace Game.Groups
|
||||
Roll GetRoll(ObjectGuid lootObjectGuid, byte lootListId)
|
||||
{
|
||||
foreach (var roll in RollId)
|
||||
if (roll.getTarget().GetGUID() == lootObjectGuid && roll.itemSlot == lootListId && roll.isValid())
|
||||
if (roll.getTarget() != null && roll.getTarget().GetGUID() == lootObjectGuid && roll.itemSlot == lootListId && roll.isValid())
|
||||
return roll;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -71,10 +71,7 @@ namespace Game.Groups
|
||||
|
||||
public Group GetGroupByDbStoreId(uint storageId)
|
||||
{
|
||||
if (storageId < GroupDbStore.Count)
|
||||
return GroupDbStore[storageId];
|
||||
|
||||
return null;
|
||||
return GroupDbStore.LookupByKey(storageId);
|
||||
}
|
||||
|
||||
public ulong GenerateGroupId()
|
||||
|
||||
@@ -128,6 +128,8 @@ namespace Game
|
||||
queryCreatureResponse.Stats.NameAlt[0] = nameAlt;
|
||||
}
|
||||
}
|
||||
|
||||
SendPacket(queryCreatureResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1032,7 +1032,7 @@ namespace Game.Network.Packets
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteBits(Name.GetByteCount(), 6);
|
||||
data.WriteBits(VoiceStateID.GetByteCount(), 6);
|
||||
data.WriteBits(VoiceStateID.GetByteCount() + 1, 6);
|
||||
data.WriteBit(FromSocialQueue);
|
||||
data.WriteBit(VoiceChatSilenced);
|
||||
data.WritePackedGuid(GUID);
|
||||
|
||||
Reference in New Issue
Block a user