Updated to 8.2.0.31429 (scripts disabled atm, they still need updated)
Code Port from TrinityCore https://github.com/TrinityCore/TrinityCore Casc from WoW-Tools https://github.com/WoW-Tools/CASCExplorer
This commit is contained in:
@@ -44,13 +44,13 @@ namespace Game
|
||||
if (cost != null)
|
||||
xpCost = (ulong)(currentArtifactTier == PlayerConst.MaxArtifactTier ? cost.XP2 : cost.XP);
|
||||
|
||||
if (xpCost > artifact.GetUInt64Value(ItemFields.ArtifactXp))
|
||||
if (xpCost > artifact.m_itemData.ArtifactXP)
|
||||
return;
|
||||
|
||||
if (artifactAddPower.PowerChoices.Empty())
|
||||
return;
|
||||
|
||||
ItemDynamicFieldArtifactPowers artifactPower = artifact.GetArtifactPower(artifactAddPower.PowerChoices[0].ArtifactPowerID);
|
||||
ArtifactPower artifactPower = artifact.GetArtifactPower(artifactAddPower.PowerChoices[0].ArtifactPowerID);
|
||||
if (artifactPower == null)
|
||||
return;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Game
|
||||
if (artifactPowerLink == null)
|
||||
continue;
|
||||
|
||||
ItemDynamicFieldArtifactPowers artifactPowerLinkLearned = artifact.GetArtifactPower(artifactPowerLinkId);
|
||||
ArtifactPower artifactPowerLinkLearned = artifact.GetArtifactPower(artifactPowerLinkId);
|
||||
if (artifactPowerLinkLearned == null)
|
||||
continue;
|
||||
|
||||
@@ -105,16 +105,13 @@ namespace Game
|
||||
if (artifactPowerRank == null)
|
||||
return;
|
||||
|
||||
ItemDynamicFieldArtifactPowers newPower = artifactPower;
|
||||
++newPower.PurchasedRank;
|
||||
++newPower.CurrentRankWithBonus;
|
||||
artifact.SetArtifactPower(newPower);
|
||||
artifact.SetArtifactPower(artifactPower.ArtifactPowerId, (byte)(artifactPower.PurchasedRank + 1), (byte)(artifactPower.CurrentRankWithBonus + 1));
|
||||
|
||||
if (artifact.IsEquipped())
|
||||
{
|
||||
_player.ApplyArtifactPowerRank(artifact, artifactPowerRank, true);
|
||||
|
||||
foreach (ItemDynamicFieldArtifactPowers power in artifact.GetArtifactPowers())
|
||||
foreach (ArtifactPower power in artifact.m_itemData.ArtifactPowers)
|
||||
{
|
||||
ArtifactPowerRecord scaledArtifactPowerEntry = CliDB.ArtifactPowerStorage.LookupByKey(power.ArtifactPowerId);
|
||||
if (!scaledArtifactPowerEntry.Flags.HasAnyFlag(ArtifactPowerFlag.ScalesWithNumPowers))
|
||||
@@ -124,16 +121,14 @@ namespace Game
|
||||
if (scaledArtifactPowerRank == null)
|
||||
continue;
|
||||
|
||||
ItemDynamicFieldArtifactPowers newScaledPower = power;
|
||||
++newScaledPower.CurrentRankWithBonus;
|
||||
artifact.SetArtifactPower(newScaledPower);
|
||||
artifact.SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, (byte)(power.CurrentRankWithBonus + 1));
|
||||
|
||||
_player.ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, false);
|
||||
_player.ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, true);
|
||||
}
|
||||
}
|
||||
|
||||
artifact.SetUInt64Value(ItemFields.ArtifactXp, artifact.GetUInt64Value(ItemFields.ArtifactXp) - xpCost);
|
||||
artifact.SetArtifactXP(artifact.m_itemData.ArtifactXP - xpCost);
|
||||
artifact.SetState(ItemUpdateState.Changed, _player);
|
||||
|
||||
uint totalPurchasedArtifactPower = artifact.GetTotalPurchasedArtifactPowers();
|
||||
@@ -211,7 +206,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ConfirmArtifactRespec)]
|
||||
void HandleConfirmArtifactRespec(ConfirmArtifactRespec confirmArtifactRespec)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(confirmArtifactRespec.NpcGUID, NPCFlags.ArtifactPowerRespec))
|
||||
if (!_player.GetNPCIfCanInteractWith(confirmArtifactRespec.NpcGUID, NPCFlags.ArtifactPowerRespec, NPCFlags2.None))
|
||||
return;
|
||||
|
||||
Item artifact = _player.GetItemByGuid(confirmArtifactRespec.ArtifactGUID);
|
||||
@@ -223,10 +218,10 @@ namespace Game
|
||||
if (cost != null)
|
||||
xpCost = (ulong)(artifact.GetModifier(ItemModifier.ArtifactTier) == 1 ? cost.XP2 : cost.XP);
|
||||
|
||||
if (xpCost > artifact.GetUInt64Value(ItemFields.ArtifactXp))
|
||||
if (xpCost > artifact.m_itemData.ArtifactXP)
|
||||
return;
|
||||
|
||||
ulong newAmount = artifact.GetUInt64Value(ItemFields.ArtifactXp) - xpCost;
|
||||
ulong newAmount = artifact.m_itemData.ArtifactXP - xpCost;
|
||||
for (uint i = 0; i <= artifact.GetTotalPurchasedArtifactPowers(); ++i)
|
||||
{
|
||||
GtArtifactLevelXPRecord cost1 = CliDB.ArtifactLevelXPGameTable.GetRow(i);
|
||||
@@ -234,16 +229,13 @@ namespace Game
|
||||
newAmount += (ulong)(artifact.GetModifier(ItemModifier.ArtifactTier) == 1 ? cost1.XP2 : cost1.XP);
|
||||
}
|
||||
|
||||
foreach (ItemDynamicFieldArtifactPowers artifactPower in artifact.GetArtifactPowers())
|
||||
foreach (ArtifactPower artifactPower in artifact.m_itemData.ArtifactPowers)
|
||||
{
|
||||
byte oldPurchasedRank = artifactPower.PurchasedRank;
|
||||
if (oldPurchasedRank == 0)
|
||||
continue;
|
||||
|
||||
ItemDynamicFieldArtifactPowers newPower = artifactPower;
|
||||
newPower.PurchasedRank -= oldPurchasedRank;
|
||||
newPower.CurrentRankWithBonus -= oldPurchasedRank;
|
||||
artifact.SetArtifactPower(newPower);
|
||||
artifact.SetArtifactPower(artifactPower.ArtifactPowerId, (byte)(artifactPower.PurchasedRank - oldPurchasedRank), (byte)(artifactPower.CurrentRankWithBonus - oldPurchasedRank));
|
||||
|
||||
if (artifact.IsEquipped())
|
||||
{
|
||||
@@ -253,7 +245,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ItemDynamicFieldArtifactPowers power in artifact.GetArtifactPowers())
|
||||
foreach (ArtifactPower power in artifact.m_itemData.ArtifactPowers)
|
||||
{
|
||||
ArtifactPowerRecord scaledArtifactPowerEntry = CliDB.ArtifactPowerStorage.LookupByKey(power.ArtifactPowerId);
|
||||
if (!scaledArtifactPowerEntry.Flags.HasAnyFlag(ArtifactPowerFlag.ScalesWithNumPowers))
|
||||
@@ -263,14 +255,12 @@ namespace Game
|
||||
if (scaledArtifactPowerRank == null)
|
||||
continue;
|
||||
|
||||
ItemDynamicFieldArtifactPowers newScaledPower = power;
|
||||
newScaledPower.CurrentRankWithBonus = 0;
|
||||
artifact.SetArtifactPower(newScaledPower);
|
||||
artifact.SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, 0);
|
||||
|
||||
_player.ApplyArtifactPowerRank(artifact, scaledArtifactPowerRank, false);
|
||||
}
|
||||
|
||||
artifact.SetUInt64Value(ItemFields.ArtifactXp, newAmount);
|
||||
artifact.SetArtifactXP(newAmount);
|
||||
artifact.SetState(ItemUpdateState.Changed, _player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace Game
|
||||
public partial class WorldSession
|
||||
{
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionHelloRequest)]
|
||||
void HandleAuctionHelloOpcode(AuctionHelloRequest packet)
|
||||
void HandleAuctionHello(AuctionHelloRequest packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Guid, NPCFlags.Auctioneer);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Guid, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionHelloOpcode - {0} not found or you can't interact with him.", packet.Guid.ToString());
|
||||
@@ -55,7 +55,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
AuctionHouseRecord ahEntry = Global.AuctionMgr.GetAuctionHouseEntry(unit.getFaction());
|
||||
AuctionHouseRecord ahEntry = Global.AuctionMgr.GetAuctionHouseEntry(unit.GetFaction());
|
||||
if (ahEntry == null)
|
||||
return;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionSellItem - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -133,7 +133,7 @@ namespace Game
|
||||
}
|
||||
|
||||
uint houseId = 0;
|
||||
AuctionHouseRecord auctionHouseEntry = Global.AuctionMgr.GetAuctionHouseEntry(creature.getFaction(), ref houseId);
|
||||
AuctionHouseRecord auctionHouseEntry = Global.AuctionMgr.GetAuctionHouseEntry(creature.GetFaction(), ref houseId);
|
||||
if (auctionHouseEntry == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionSellItem - {0} has wrong faction.", packet.Auctioneer.ToString());
|
||||
@@ -166,7 +166,7 @@ namespace Game
|
||||
}
|
||||
|
||||
if (Global.AuctionMgr.GetAItem(items[i].GetGUID().GetCounter()) || !items[i].CanBeTraded() || items[i].IsNotEmptyBag() ||
|
||||
items[i].GetTemplate().GetFlags().HasAnyFlag(ItemFlags.Conjured) || items[i].GetUInt32Value(ItemFields.Duration) != 0 ||
|
||||
items[i].GetTemplate().GetFlags().HasAnyFlag(ItemFlags.Conjured) || items[i].m_itemData.Expiration != 0 ||
|
||||
items[i].GetCount() < packet.Items[i].UseCount)
|
||||
{
|
||||
SendAuctionCommandResult(null, AuctionAction.SellItem, AuctionError.DatabaseError);
|
||||
@@ -218,7 +218,7 @@ namespace Game
|
||||
Item item = items[0];
|
||||
|
||||
uint auctionTime = (uint)(packet.RunTime * WorldConfig.GetFloatValue(WorldCfg.RateAuctionTime));
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
ulong deposit = Global.AuctionMgr.GetAuctionDeposit(auctionHouseEntry, packet.RunTime, item, finalCount);
|
||||
if (!GetPlayer().HasEnoughMoney(deposit))
|
||||
@@ -358,7 +358,7 @@ namespace Game
|
||||
if (packet.AuctionItemID == 0 || packet.BidAmount == 0)
|
||||
return; // check for cheaters
|
||||
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionPlaceBid - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -369,7 +369,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
AuctionEntry auction = auctionHouse.GetAuction(packet.AuctionItemID);
|
||||
Player player = GetPlayer();
|
||||
@@ -480,7 +480,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionRemoveItem)]
|
||||
void HandleAuctionRemoveItem(AuctionRemoveItem packet)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionRemoveItem - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -491,7 +491,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
AuctionEntry auction = auctionHouse.GetAuction((uint)packet.AuctionItemID);
|
||||
Player player = GetPlayer();
|
||||
@@ -546,7 +546,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionListBidderItems)]
|
||||
void HandleAuctionListBidderItems(AuctionListBidderItems packet)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionListBidderItems - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -557,7 +557,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
AuctionListBidderItemsResult result = new AuctionListBidderItemsResult();
|
||||
|
||||
@@ -570,7 +570,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionListOwnerItems)]
|
||||
void HandleAuctionListOwnerItems(AuctionListOwnerItems packet)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionListOwnerItems - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -581,7 +581,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
AuctionListOwnerItemsResult result = new AuctionListOwnerItemsResult();
|
||||
|
||||
@@ -593,7 +593,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionListItems)]
|
||||
void HandleAuctionListItems(AuctionListItems packet)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, NPCFlags.Auctioneer, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleAuctionListItems - {0} not found or you can't interact with him.", packet.Auctioneer.ToString());
|
||||
@@ -604,7 +604,7 @@ namespace Game
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
GetPlayer().RemoveAurasByType(AuraType.FeignDeath);
|
||||
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
AuctionHouseObject auctionHouse = Global.AuctionMgr.GetAuctionsMap(creature.GetFaction());
|
||||
|
||||
|
||||
Optional<AuctionSearchFilters> filters = new Optional<AuctionSearchFilters>();
|
||||
@@ -647,7 +647,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.AuctionReplicateItems)]
|
||||
void HandleReplicateItems(AuctionReplicateItems packet)
|
||||
{
|
||||
/* Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
/* Creature* creature = GetPlayer().GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleReplicateItems - {0} not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
@@ -655,14 +655,14 @@ namespace Game
|
||||
}
|
||||
|
||||
// remove fake death
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
if (GetPlayer().HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer().RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(creature.getFaction());
|
||||
|
||||
WorldPackets::AuctionHouse::AuctionReplicateResponse response;
|
||||
|
||||
auctionHouse->BuildReplicate(response, GetPlayer(), packet.ChangeNumberGlobal, packet.ChangeNumberCursor, packet.ChangeNumberTombstone, packet.Count);
|
||||
auctionHouse.BuildReplicate(response, GetPlayer(), packet.ChangeNumberGlobal, packet.ChangeNumberCursor, packet.ChangeNumberTombstone, packet.Count);
|
||||
*/
|
||||
//@todo implement this properly
|
||||
AuctionReplicateResponse response = new AuctionReplicateResponse();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.BankerActivate)]
|
||||
void HandleBankerActivate(Hello packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Banker);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Banker, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outError(LogFilter.Network, "HandleBankerActivate: {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.BattlemasterHello)]
|
||||
void HandleBattlemasterHello(Hello hello)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Unit, NPCFlags.BattleMaster);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(hello.Unit, NPCFlags.BattleMaster, NPCFlags2.None);
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.BattlePetSummon, Processing = PacketProcessing.Inplace)]
|
||||
void HandleBattlePetSummon(BattlePetSummon battlePetSummon)
|
||||
{
|
||||
if (_player.GetGuidValue(ActivePlayerFields.SummonedBattlePetId) != battlePetSummon.PetGuid)
|
||||
if (_player.m_activePlayerData.SummonedBattlePetGUID != battlePetSummon.PetGuid)
|
||||
GetBattlePetMgr().SummonPet(battlePetSummon.PetGuid);
|
||||
else
|
||||
GetBattlePetMgr().DismissPet();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.BlackMarketOpen)]
|
||||
void HandleBlackMarketOpen(BlackMarketOpen blackMarketOpen)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketOpen.Guid, NPCFlags.BlackMarket | NPCFlags.BlackMarketView);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketOpen.Guid, NPCFlags.BlackMarket, NPCFlags2.BlackMarketView);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketHello - {0} not found or you can't interact with him.", blackMarketOpen.Guid.ToString());
|
||||
@@ -57,7 +57,7 @@ namespace Game
|
||||
if (!Global.BlackMarketMgr.IsEnabled())
|
||||
return;
|
||||
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketRequestItems.Guid, NPCFlags.BlackMarket | NPCFlags.BlackMarketView);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(blackMarketRequestItems.Guid, NPCFlags.BlackMarket, NPCFlags2.BlackMarketView);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketRequestItems - {0} not found or you can't interact with him.", blackMarketRequestItems.Guid.ToString());
|
||||
@@ -76,7 +76,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Player player = GetPlayer();
|
||||
Creature unit = player.GetNPCIfCanInteractWith(blackMarketBidOnItem.Guid, NPCFlags.BlackMarket);
|
||||
Creature unit = player.GetNPCIfCanInteractWith(blackMarketBidOnItem.Guid, NPCFlags.BlackMarket, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBlackMarketBidOnItem - {0} not found or you can't interact with him.", blackMarketBidOnItem.Guid.ToString());
|
||||
@@ -146,7 +146,6 @@ namespace Game
|
||||
|
||||
packet.MarketID = entry.GetMarketId();
|
||||
packet.Item = new ItemInstance(item);
|
||||
packet.RandomPropertiesID = item.GetItemRandomPropertyId();
|
||||
|
||||
SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -236,10 +236,10 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
//if (raceExpansionRequirement->AchievementId && !)
|
||||
//if (raceExpansionRequirement.AchievementId && !)
|
||||
//{
|
||||
// TC_LOG_ERROR("entities.player.cheat", "Expansion %u account:[%d] tried to Create character without achievement %u race (%u)",
|
||||
// GetAccountExpansion(), GetAccountId(), raceExpansionRequirement->AchievementId, charCreate.CreateInfo->Race);
|
||||
// GetAccountExpansion(), GetAccountId(), raceExpansionRequirement.AchievementId, charCreate.CreateInfo.Race);
|
||||
// SendCharCreate(CHAR_CREATE_ALLIED_RACE_ACHIEVEMENT);
|
||||
// return;
|
||||
//}
|
||||
@@ -477,7 +477,7 @@ namespace Game
|
||||
|
||||
Log.outInfo(LogFilter.Player, "Account: {0} (IP: {1}) Create Character: {2} {3}", GetAccountId(), GetRemoteAddress(), createInfo.Name, newChar.GetGUID().ToString());
|
||||
Global.ScriptMgr.OnPlayerCreate(newChar);
|
||||
Global.WorldMgr.AddCharacterInfo(newChar.GetGUID(), GetAccountId(), newChar.GetName(), newChar.GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender), (byte)newChar.GetRace(), (byte)newChar.GetClass(), (byte)newChar.getLevel(), false);
|
||||
Global.WorldMgr.AddCharacterInfo(newChar.GetGUID(), GetAccountId(), newChar.GetName(), newChar.m_playerData.NativeSex, (byte)newChar.GetRace(), (byte)newChar.GetClass(), (byte)newChar.getLevel(), false);
|
||||
|
||||
newChar.CleanupsBeforeDelete();
|
||||
}
|
||||
@@ -632,7 +632,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
pCurrChar.SetUInt32Value(PlayerFields.VirtualRealm, Global.WorldMgr.GetVirtualRealmAddress());
|
||||
pCurrChar.SetVirtualPlayerRealm(Global.WorldMgr.GetVirtualRealmAddress());
|
||||
|
||||
SendTutorialsData();
|
||||
|
||||
@@ -665,10 +665,10 @@ namespace Game
|
||||
// Send PVPSeason
|
||||
{
|
||||
PVPSeason season = new PVPSeason();
|
||||
season.PreviousSeason = (WorldConfig.GetUIntValue(WorldCfg.ArenaSeasonId) - (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress) ? 1u : 0u));
|
||||
season.PreviousSeason = (WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId) - (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress) ? 1 : 0));
|
||||
|
||||
if (WorldConfig.GetBoolValue(WorldCfg.ArenaSeasonInProgress))
|
||||
season.CurrentSeason = WorldConfig.GetUIntValue(WorldCfg.ArenaSeasonId);
|
||||
season.CurrentSeason = WorldConfig.GetIntValue(WorldCfg.ArenaSeasonId);
|
||||
|
||||
SendPacket(season);
|
||||
}
|
||||
@@ -793,10 +793,10 @@ namespace Game
|
||||
pCurrChar.LoadPet();
|
||||
|
||||
// Set FFA PvP for non GM in non-rest mode
|
||||
if (Global.WorldMgr.IsFFAPvPRealm() && !pCurrChar.IsGameMaster() && !pCurrChar.HasFlag(PlayerFields.Flags, PlayerFlags.Resting))
|
||||
pCurrChar.SetByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PvpFlag, UnitBytes2Flags.FFAPvp);
|
||||
if (Global.WorldMgr.IsFFAPvPRealm() && !pCurrChar.IsGameMaster() && !pCurrChar.HasPlayerFlag(PlayerFlags.Resting))
|
||||
pCurrChar.AddPvpFlag(UnitPVPStateFlags.FFAPvp);
|
||||
|
||||
if (pCurrChar.HasFlag(PlayerFields.Flags, PlayerFlags.ContestedPVP))
|
||||
if (pCurrChar.HasPlayerFlag(PlayerFlags.ContestedPVP))
|
||||
pCurrChar.SetContestedPvP();
|
||||
|
||||
// Apply at_login requests
|
||||
@@ -945,7 +945,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SetWatchedFaction)]
|
||||
void HandleSetWatchedFaction(SetWatchedFaction packet)
|
||||
{
|
||||
GetPlayer().SetInt32Value(ActivePlayerFields.WatchedFactionIndex, (int)packet.FactionIndex);
|
||||
GetPlayer().SetWatchedFactionIndex(packet.FactionIndex);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.SetFactionInactive)]
|
||||
@@ -1099,19 +1099,19 @@ namespace Game
|
||||
void HandleAlterAppearance(AlterApperance packet)
|
||||
{
|
||||
BarberShopStyleRecord bs_hair = CliDB.BarberShopStyleStorage.LookupByKey(packet.NewHairStyle);
|
||||
if (bs_hair == null || bs_hair.Type != 0 || bs_hair.Race != (byte)GetPlayer().GetRace() || bs_hair.Sex != GetPlayer().GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender))
|
||||
if (bs_hair == null || bs_hair.Type != 0 || bs_hair.Race != (byte)GetPlayer().GetRace() || bs_hair.Sex != GetPlayer().m_playerData.NativeSex)
|
||||
return;
|
||||
|
||||
BarberShopStyleRecord bs_facialHair = CliDB.BarberShopStyleStorage.LookupByKey(packet.NewFacialHair);
|
||||
if (bs_facialHair == null || bs_facialHair.Type != 2 || bs_facialHair.Race != (byte)GetPlayer().GetRace() || bs_facialHair.Sex != GetPlayer().GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender))
|
||||
if (bs_facialHair == null || bs_facialHair.Type != 2 || bs_facialHair.Race != (byte)GetPlayer().GetRace() || bs_facialHair.Sex != GetPlayer().m_playerData.NativeSex)
|
||||
return;
|
||||
|
||||
BarberShopStyleRecord bs_skinColor = CliDB.BarberShopStyleStorage.LookupByKey(packet.NewSkinColor);
|
||||
if (bs_skinColor != null && (bs_skinColor.Type != 3 || bs_skinColor.Race != (byte)GetPlayer().GetRace() || bs_skinColor.Sex != GetPlayer().GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender)))
|
||||
if (bs_skinColor != null && (bs_skinColor.Type != 3 || bs_skinColor.Race != (byte)GetPlayer().GetRace() || bs_skinColor.Sex != GetPlayer().m_playerData.NativeSex))
|
||||
return;
|
||||
|
||||
BarberShopStyleRecord bs_face = CliDB.BarberShopStyleStorage.LookupByKey(packet.NewFace);
|
||||
if (bs_face != null && (bs_face.Type != 4 || bs_face.Race != (byte)GetPlayer().GetRace() || bs_face.Sex != GetPlayer().GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender)))
|
||||
if (bs_face != null && (bs_face.Type != 4 || bs_face.Race != (byte)GetPlayer().GetRace() || bs_face.Sex != GetPlayer().m_playerData.NativeSex))
|
||||
return;
|
||||
|
||||
Array<BarberShopStyleRecord> customDisplayEntries = new Array<BarberShopStyleRecord>(PlayerConst.CustomDisplaySize);
|
||||
@@ -1119,16 +1119,16 @@ namespace Game
|
||||
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
|
||||
{
|
||||
BarberShopStyleRecord bs_customDisplay = CliDB.BarberShopStyleStorage.LookupByKey(packet.NewCustomDisplay[i]);
|
||||
if (bs_customDisplay != null && (bs_customDisplay.Type != 5 + i || bs_customDisplay.Race != (byte)_player.GetRace() || bs_customDisplay.Sex != _player.GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender)))
|
||||
if (bs_customDisplay != null && (bs_customDisplay.Type != 5 + i || bs_customDisplay.Race != (byte)_player.GetRace() || bs_customDisplay.Sex != _player.m_playerData.NativeSex))
|
||||
return;
|
||||
|
||||
customDisplayEntries[i] = bs_customDisplay;
|
||||
customDisplay[i] = (byte)(bs_customDisplay != null ? bs_customDisplay.Data : 0);
|
||||
}
|
||||
|
||||
if (!Player.ValidateAppearance(GetPlayer().GetRace(), GetPlayer().GetClass(), (Gender)GetPlayer().GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender),
|
||||
bs_hair.Data, (byte)packet.NewHairColor, bs_face != null ? bs_face.Data : GetPlayer().GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetFaceId),
|
||||
bs_facialHair.Data, (bs_skinColor != null ? bs_skinColor.Data : GetPlayer().GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetSkinId)), customDisplay))
|
||||
if (!Player.ValidateAppearance(GetPlayer().GetRace(), GetPlayer().GetClass(), (Gender)(byte)GetPlayer().m_playerData.NativeSex,
|
||||
bs_hair.Data, (byte)packet.NewHairColor, bs_face != null ? bs_face.Data : GetPlayer().m_playerData.FaceID,
|
||||
bs_facialHair.Data, bs_skinColor != null ? bs_skinColor.Data : GetPlayer().m_playerData.SkinID, customDisplay))
|
||||
return;
|
||||
|
||||
GameObject go = GetPlayer().FindNearestGameObjectOfType(GameObjectTypes.BarberChair, 5.0f);
|
||||
@@ -1156,16 +1156,16 @@ namespace Game
|
||||
_player.ModifyMoney(-cost);
|
||||
_player.UpdateCriteria(CriteriaTypes.GoldSpentAtBarber, cost);
|
||||
|
||||
_player.SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetHairStyleId, bs_hair.Data);
|
||||
_player.SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetHairColorId, (byte)packet.NewHairColor);
|
||||
_player.SetByteValue(PlayerFields.Bytes2, PlayerFieldOffsets.Bytes2OffsetFacialStyle, bs_facialHair.Data);
|
||||
_player.SetHairStyleId(bs_hair.Data);
|
||||
_player.SetHairColorId((byte)packet.NewHairColor);
|
||||
_player.SetFacialHairStyleId(bs_facialHair.Data);
|
||||
if (bs_skinColor != null)
|
||||
GetPlayer().SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetSkinId, bs_skinColor.Data);
|
||||
GetPlayer().SetSkinId(bs_skinColor.Data);
|
||||
if (bs_face != null)
|
||||
_player.SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetFaceId, bs_face.Data);
|
||||
_player.SetFaceId(bs_face.Data);
|
||||
|
||||
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
|
||||
_player.SetByteValue(PlayerFields.Bytes2, (byte)(PlayerFieldOffsets.Bytes2OffsetCustomDisplayOption + i), customDisplay[i]);
|
||||
_player.SetCustomDisplayOption(i, customDisplay[i]);
|
||||
|
||||
_player.UpdateCriteria(CriteriaTypes.VisitBarberShop, 1);
|
||||
|
||||
@@ -1929,20 +1929,13 @@ namespace Game
|
||||
// Title conversion
|
||||
if (!string.IsNullOrEmpty(knownTitlesStr))
|
||||
{
|
||||
uint ktcount = PlayerConst.KnowTitlesSize * 2;
|
||||
uint[] knownTitles = new uint[ktcount];
|
||||
List<uint> knownTitles = new List<uint>();
|
||||
|
||||
var tokens = new StringArray(knownTitlesStr, ' ');
|
||||
if (tokens.Length != ktcount)
|
||||
{
|
||||
SendCharFactionChange(ResponseCodes.CharCreateError, factionChangeInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index = 0; index < ktcount; ++index)
|
||||
for (int index = 0; index < tokens.Length; ++index)
|
||||
{
|
||||
if (uint.TryParse(tokens[index], out uint id))
|
||||
knownTitles[index] = id;
|
||||
knownTitles.Add(id);
|
||||
}
|
||||
|
||||
foreach (var it in Global.ObjectMgr.FactionChangeTitles)
|
||||
@@ -1956,9 +1949,12 @@ namespace Game
|
||||
if (newTeamId == TeamId.Alliance)
|
||||
{
|
||||
uint maskID = htitleInfo.MaskID;
|
||||
uint index = maskID / 32;
|
||||
int index = (int)maskID / 32;
|
||||
if (index >= knownTitles.Count)
|
||||
continue;
|
||||
|
||||
uint old_flag = (uint)(1 << (int)(maskID % 32));
|
||||
uint new_flag = (uint)(1 << (int)(atitleInfo.MaskID % 32));
|
||||
uint new_flag = (uint)(1 << (atitleInfo.MaskID % 32));
|
||||
if (Convert.ToBoolean(knownTitles[index] & old_flag))
|
||||
{
|
||||
knownTitles[index] &= ~old_flag;
|
||||
@@ -1969,9 +1965,12 @@ namespace Game
|
||||
else
|
||||
{
|
||||
uint maskID = atitleInfo.MaskID;
|
||||
uint index = maskID / 32;
|
||||
int index = (int)maskID / 32;
|
||||
if (index >= knownTitles.Count)
|
||||
continue;
|
||||
|
||||
uint old_flag = (uint)(1 << (int)(maskID % 32));
|
||||
uint new_flag = (uint)(1 << (int)(htitleInfo.MaskID % 32));
|
||||
uint new_flag = (uint)(1 << (htitleInfo.MaskID % 32));
|
||||
if (Convert.ToBoolean(knownTitles[index] & old_flag))
|
||||
{
|
||||
knownTitles[index] &= ~old_flag;
|
||||
@@ -1981,7 +1980,7 @@ namespace Game
|
||||
}
|
||||
|
||||
string ss = "";
|
||||
for (uint index = 0; index < ktcount; ++index)
|
||||
for (int index = 0; index < knownTitles.Count; ++index)
|
||||
ss += knownTitles[index] + ' ';
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_TITLES_FACTION_CHANGE);
|
||||
@@ -2009,7 +2008,7 @@ namespace Game
|
||||
void HandleOpeningCinematic(OpeningCinematic packet)
|
||||
{
|
||||
// Only players that has not yet gained any experience can use this
|
||||
if (GetPlayer().GetUInt32Value(ActivePlayerFields.Xp) != 0)
|
||||
if (GetPlayer().m_activePlayerData.XP != 0)
|
||||
return;
|
||||
|
||||
ChrClassesRecord classEntry = CliDB.ChrClassesStorage.LookupByKey(GetPlayer().GetClass());
|
||||
@@ -2142,7 +2141,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.RepopRequest)]
|
||||
void HandleRepopRequest(RepopRequest packet)
|
||||
{
|
||||
if (GetPlayer().IsAlive() || GetPlayer().HasFlag(PlayerFields.Flags, PlayerFlags.Ghost))
|
||||
if (GetPlayer().IsAlive() || GetPlayer().HasPlayerFlag(PlayerFlags.Ghost))
|
||||
return;
|
||||
|
||||
if (GetPlayer().HasAuraType(AuraType.PreventResurrection))
|
||||
@@ -2169,7 +2168,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ClientPortGraveyard)]
|
||||
void HandlePortGraveyard(PortGraveyard packet)
|
||||
{
|
||||
if (GetPlayer().IsAlive() || !GetPlayer().HasFlag(PlayerFields.Flags, PlayerFlags.Ghost))
|
||||
if (GetPlayer().IsAlive() || !GetPlayer().HasPlayerFlag(PlayerFlags.Ghost))
|
||||
return;
|
||||
GetPlayer().RepopAtGraveyard();
|
||||
}
|
||||
@@ -2217,7 +2216,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
// body not released yet
|
||||
if (!GetPlayer().HasFlag(PlayerFields.Flags, PlayerFlags.Ghost))
|
||||
if (!GetPlayer().HasPlayerFlag(PlayerFlags.Ghost))
|
||||
return;
|
||||
|
||||
Corpse corpse = GetPlayer().GetCorpse();
|
||||
|
||||
@@ -539,8 +539,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
Global.ScriptMgr.OnPlayerClearEmote(GetPlayer());
|
||||
if (GetPlayer().GetUInt32Value(UnitFields.NpcEmotestate) != 0)
|
||||
GetPlayer().SetUInt32Value(UnitFields.NpcEmotestate, 0);
|
||||
GetPlayer().SetEmoteState(Emote.OneshotNone);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.SendTextEmote)]
|
||||
@@ -573,7 +572,7 @@ namespace Game
|
||||
break;
|
||||
case Emote.StateDance:
|
||||
case Emote.StateRead:
|
||||
GetPlayer().SetUInt32Value(UnitFields.NpcEmotestate, emote_anim);
|
||||
GetPlayer().SetEmoteState((Emote)emote_anim);
|
||||
break;
|
||||
default:
|
||||
// Only allow text-emotes for "dead" entities (feign death included)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GarrisonPurchaseBuilding)]
|
||||
void HandleGarrisonPurchaseBuilding(GarrisonPurchaseBuilding garrisonPurchaseBuilding)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonPurchaseBuilding.NpcGUID, NPCFlags.GarrisonArchitect))
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonPurchaseBuilding.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect))
|
||||
return;
|
||||
|
||||
Garrison garrison = _player.GetGarrison();
|
||||
@@ -46,7 +46,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.GarrisonCancelConstruction)]
|
||||
void HandleGarrisonCancelConstruction(GarrisonCancelConstruction garrisonCancelConstruction)
|
||||
{
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonCancelConstruction.NpcGUID, NPCFlags.GarrisonArchitect))
|
||||
if (!_player.GetNPCIfCanInteractWith(garrisonCancelConstruction.NpcGUID, NPCFlags.None, NPCFlags2.GarrisonArchitect))
|
||||
return;
|
||||
|
||||
Garrison garrison = _player.GetGarrison();
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Game
|
||||
Guild.EmblemInfo emblemInfo = new Guild.EmblemInfo();
|
||||
emblemInfo.ReadPacket(packet);
|
||||
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(packet.Vendor, NPCFlags.TabardDesigner))
|
||||
if (GetPlayer().GetNPCIfCanInteractWith(packet.Vendor, NPCFlags.TabardDesigner, NPCFlags2.None))
|
||||
{
|
||||
// Remove fake death
|
||||
if (GetPlayer().HasUnitState(UnitState.Died))
|
||||
@@ -395,7 +395,10 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.DeclineGuildInvites)]
|
||||
void HandleDeclineGuildInvites(DeclineGuildInvites packet)
|
||||
{
|
||||
GetPlayer().ApplyModFlag(PlayerFields.Flags, PlayerFlags.AutoDeclineGuild, packet.Allow);
|
||||
if (packet.Allow)
|
||||
GetPlayer().AddPlayerFlag(PlayerFlags.AutoDeclineGuild);
|
||||
else
|
||||
GetPlayer().RemovePlayerFlag(PlayerFlags.AutoDeclineGuild);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.RequestGuildRewardsList, Processing = PacketProcessing.Inplace)]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2019 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -42,17 +43,7 @@ namespace Game
|
||||
return;
|
||||
|
||||
InspectResult inspectResult = new InspectResult();
|
||||
inspectResult.InspecteeGUID = inspect.Target;
|
||||
|
||||
for (byte i = 0; i < EquipmentSlot.End; ++i)
|
||||
{
|
||||
Item item = player.GetItemByPos(InventorySlots.Bag0, i);
|
||||
if (item)
|
||||
inspectResult.Items.Add(new InspectItemData(item, i));
|
||||
}
|
||||
|
||||
inspectResult.ClassID = player.GetClass();
|
||||
inspectResult.GenderID = (Gender)player.GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender);
|
||||
inspectResult.DisplayInfo.Initialize(player);
|
||||
|
||||
if (GetPlayer().CanBeGameMaster() || WorldConfig.GetIntValue(WorldCfg.TalentsInspecting) + (GetPlayer().GetTeamId() == player.GetTeamId() ? 1 : 0) > 1)
|
||||
{
|
||||
@@ -76,13 +67,11 @@ namespace Game
|
||||
inspectResult.GuildData.Set(guildData);
|
||||
}
|
||||
|
||||
inspectResult.InspecteeGUID = inspect.Target;
|
||||
inspectResult.SpecializationID = (int)player.GetUInt32Value(PlayerFields.CurrentSpecId);
|
||||
inspectResult.LifetimeMaxRank = player.GetByteValue(ActivePlayerFields.Bytes, PlayerFieldOffsets.FieldBytesOffsetLifetimeMaxPvpRank);
|
||||
inspectResult.TodayHK = player.GetUInt16Value(ActivePlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetTodayKills);
|
||||
inspectResult.YesterdayHK = player.GetUInt16Value(ActivePlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetYesterdayKills);
|
||||
inspectResult.LifetimeHK = player.GetUInt32Value(ActivePlayerFields.LifetimeHonorableKills);
|
||||
inspectResult.HonorLevel = player.GetUInt32Value(PlayerFields.HonorLevel);
|
||||
inspectResult.LifetimeMaxRank = player.m_activePlayerData.LifetimeMaxRank;
|
||||
inspectResult.TodayHK = player.m_activePlayerData.TodayHonorableKills;
|
||||
inspectResult.YesterdayHK = player.m_activePlayerData.YesterdayHonorableKills;
|
||||
inspectResult.LifetimeHK = player.m_activePlayerData.LifetimeHonorableKills;
|
||||
inspectResult.HonorLevel = player.m_playerData.HonorLevel;
|
||||
|
||||
SendPacket(inspectResult);
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dstItem.HasFlag(ItemFields.Flags, ItemFieldFlags.Child))
|
||||
if (!dstItem.HasItemFlag(ItemFieldFlags.Child))
|
||||
{
|
||||
// check dest.src move possibility
|
||||
List<ItemPosCount> sSrc = new List<ItemPosCount>();
|
||||
@@ -283,7 +283,7 @@ namespace Game
|
||||
}
|
||||
else
|
||||
{
|
||||
Item parentItem = _player.GetItemByGuid(dstItem.GetGuidValue(ItemFields.Creator));
|
||||
Item parentItem = _player.GetItemByGuid(dstItem.GetCreator());
|
||||
if (parentItem)
|
||||
{
|
||||
if (Player.IsEquipmentPos(dest))
|
||||
@@ -361,7 +361,7 @@ namespace Game
|
||||
{
|
||||
// @todo: 6.x research new values
|
||||
/*WorldPackets.Item.ReadItemResultFailed packet;
|
||||
packet.Item = item->GetGUID();
|
||||
packet.Item = item.GetGUID();
|
||||
packet.Subcode = ??;
|
||||
packet.Delay = ??;
|
||||
SendPacket(packet);*/
|
||||
@@ -382,7 +382,7 @@ namespace Game
|
||||
|
||||
var pl = GetPlayer();
|
||||
|
||||
Creature creature = pl.GetNPCIfCanInteractWith(packet.VendorGUID, NPCFlags.Vendor);
|
||||
Creature creature = pl.GetNPCIfCanInteractWith(packet.VendorGUID, NPCFlags.Vendor, NPCFlags2.None);
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleSellItemOpcode - {0} not found or you can not interact with him.", packet.VendorGUID.ToString());
|
||||
@@ -421,7 +421,7 @@ namespace Game
|
||||
// prevent selling item for sellprice when the item is still refundable
|
||||
// this probably happens when right clicking a refundable item, the client sends both
|
||||
// CMSG_SELL_ITEM and CMSG_REFUND_ITEM (unverified)
|
||||
if (pItem.HasFlag(ItemFields.Flags, ItemFieldFlags.Refundable))
|
||||
if (pItem.HasItemFlag(ItemFieldFlags.Refundable))
|
||||
return; // Therefore, no feedback to client
|
||||
|
||||
// special case at auto sell (sell all)
|
||||
@@ -492,7 +492,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.BuyBackItem)]
|
||||
void HandleBuybackItem(BuyBackItem packet)
|
||||
{
|
||||
Creature creature = _player.GetNPCIfCanInteractWith(packet.VendorGUID, NPCFlags.Vendor);
|
||||
Creature creature = _player.GetNPCIfCanInteractWith(packet.VendorGUID, NPCFlags.Vendor, NPCFlags2.None);
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBuybackItem - {0} not found or you can not interact with him.", packet.VendorGUID.ToString());
|
||||
@@ -507,7 +507,7 @@ namespace Game
|
||||
Item pItem = _player.GetItemFromBuyBackSlot(packet.Slot);
|
||||
if (pItem != null)
|
||||
{
|
||||
uint price = _player.GetUInt32Value(ActivePlayerFields.BuyBackPrice + (int)(packet.Slot - InventorySlots.BuyBackStart));
|
||||
uint price = _player.m_activePlayerData.BuybackPrice[(int)(packet.Slot - InventorySlots.BuyBackStart)];
|
||||
if (!_player.HasEnoughMoney(price))
|
||||
{
|
||||
_player.SendBuyError(BuyResult.NotEnoughtMoney, creature, pItem.GetEntry());
|
||||
@@ -684,7 +684,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.GetUInt64Value(ItemFields.GiftCreator) != 0) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
if (!item.GetGiftCreator().IsEmpty()) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
{
|
||||
GetPlayer().SendEquipError(InventoryResult.CantWrapWrapped, item);
|
||||
return;
|
||||
@@ -721,7 +721,7 @@ namespace Game
|
||||
stmt.AddValue(0, item.GetOwnerGUID().GetCounter());
|
||||
stmt.AddValue(1, item.GetGUID().GetCounter());
|
||||
stmt.AddValue(2, item.GetEntry());
|
||||
stmt.AddValue(3, item.GetUInt32Value(ItemFields.Flags));
|
||||
stmt.AddValue(3, (uint)item.m_itemData.DynamicFlags);
|
||||
trans.Append(stmt);
|
||||
|
||||
item.SetEntry(gift.GetEntry());
|
||||
@@ -748,8 +748,8 @@ namespace Game
|
||||
break;
|
||||
}
|
||||
|
||||
item.SetGuidValue(ItemFields.GiftCreator, GetPlayer().GetGUID());
|
||||
item.SetUInt32Value(ItemFields.Flags, (uint)ItemFieldFlags.Wrapped);
|
||||
item.SetGiftCreator(GetPlayer().GetGUID());
|
||||
item.SetItemFlags(ItemFieldFlags.Wrapped);
|
||||
item.SetState(ItemUpdateState.Changed, GetPlayer());
|
||||
|
||||
if (item.GetState() == ItemUpdateState.New) // save new item, to have alway for `character_gifts` record in `item_instance`
|
||||
@@ -789,7 +789,7 @@ namespace Game
|
||||
Item[] gems = new Item[ItemConst.MaxGemSockets];
|
||||
ItemDynamicFieldGems[] gemData = new ItemDynamicFieldGems[ItemConst.MaxGemSockets];
|
||||
GemPropertiesRecord[] gemProperties = new GemPropertiesRecord[ItemConst.MaxGemSockets];
|
||||
ItemDynamicFieldGems[] oldGemData = new ItemDynamicFieldGems[ItemConst.MaxGemSockets];
|
||||
SocketedGem[] oldGemData = new SocketedGem[ItemConst.MaxGemSockets];
|
||||
|
||||
|
||||
for (int i = 0; i < ItemConst.MaxGemSockets; ++i)
|
||||
@@ -799,9 +799,9 @@ namespace Game
|
||||
{
|
||||
gems[i] = gem;
|
||||
gemData[i].ItemId = gem.GetEntry();
|
||||
gemData[i].Context = (byte)gem.GetUInt32Value(ItemFields.Context);
|
||||
for (ushort b = 0; b < gem.GetDynamicValues(ItemDynamicFields.BonusListIds).Length && b < 16; ++b)
|
||||
gemData[i].BonusListIDs[b] = (ushort)gem.GetDynamicValue(ItemDynamicFields.BonusListIds, b);
|
||||
gemData[i].Context = (byte)gem.m_itemData.Context;
|
||||
for (int b = 0; b < ((List<uint>)gem.m_itemData.BonusListIDs).Count && b < 16; ++b)
|
||||
gemData[i].BonusListIDs[b] = (ushort)((List<uint>)gem.m_itemData.BonusListIDs)[b];
|
||||
|
||||
gemProperties[i] = CliDB.GemPropertiesStorage.LookupByKey(gem.GetTemplate().GetGemProperties());
|
||||
}
|
||||
@@ -1037,7 +1037,7 @@ namespace Game
|
||||
|
||||
if (!isUsingBankCommand)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(bankerGUID, NPCFlags.Banker);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(bankerGUID, NPCFlags.Banker, NPCFlags2.None);
|
||||
if (!creature)
|
||||
return false;
|
||||
}
|
||||
@@ -1069,69 +1069,6 @@ namespace Game
|
||||
GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.UpgradeItem)]
|
||||
void HandleUpgradeItem(UpgradeItem upgradeItem)
|
||||
{
|
||||
ItemUpgradeResult itemUpgradeResult = new ItemUpgradeResult();
|
||||
if (!_player.GetNPCIfCanInteractWith(upgradeItem.ItemMaster, NPCFlags.ItemUpgradeMaster))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleUpgradeItems - {0} not found or player can't interact with it.", upgradeItem.ItemMaster.ToString());
|
||||
itemUpgradeResult.Success = false;
|
||||
SendPacket(itemUpgradeResult);
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = _player.GetItemByGuid(upgradeItem.ItemGUID);
|
||||
if (!item)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleUpgradeItems: Item {0} not found!", upgradeItem.ItemGUID.ToString());
|
||||
itemUpgradeResult.Success = false;
|
||||
SendPacket(itemUpgradeResult);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemUpgradeRecord itemUpgradeEntry = CliDB.ItemUpgradeStorage.LookupByKey(upgradeItem.UpgradeID);
|
||||
if (itemUpgradeEntry == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleUpgradeItems - ItemUpgradeEntry ({0}) not found.", upgradeItem.UpgradeID);
|
||||
itemUpgradeResult.Success = false;
|
||||
SendPacket(itemUpgradeResult);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if player has enough currency
|
||||
if (!_player.HasCurrency(itemUpgradeEntry.CurrencyType, itemUpgradeEntry.CurrencyAmount))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleUpgradeItems - Player has not enougth currency (ID: {0}, Cost: {1}) not found.", itemUpgradeEntry.CurrencyType, itemUpgradeEntry.CurrencyAmount);
|
||||
itemUpgradeResult.Success = false;
|
||||
SendPacket(itemUpgradeResult);
|
||||
return;
|
||||
}
|
||||
|
||||
uint currentUpgradeId = item.GetModifier(ItemModifier.UpgradeId);
|
||||
if (currentUpgradeId != itemUpgradeEntry.PrerequisiteID)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleUpgradeItems - ItemUpgradeEntry ({0}) is not related to this ItemUpgradePath ({1}).", itemUpgradeEntry.Id, currentUpgradeId);
|
||||
itemUpgradeResult.Success = false;
|
||||
SendPacket(itemUpgradeResult);
|
||||
return;
|
||||
}
|
||||
|
||||
itemUpgradeResult.Success = true;
|
||||
SendPacket(itemUpgradeResult);
|
||||
|
||||
if (item.IsEquipped())
|
||||
_player._ApplyItemBonuses(item, item.GetSlot(), false);
|
||||
|
||||
item.SetModifier(ItemModifier.UpgradeId, itemUpgradeEntry.Id);
|
||||
|
||||
if (item.IsEquipped())
|
||||
_player._ApplyItemBonuses(item, item.GetSlot(), true);
|
||||
|
||||
item.SetState(ItemUpdateState.Changed, _player);
|
||||
_player.ModifyCurrency((CurrencyTypes)itemUpgradeEntry.CurrencyType, -(int)itemUpgradeEntry.CurrencyAmount);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.SortBags)]
|
||||
void HandleSortBags(SortBags sortBags)
|
||||
{
|
||||
@@ -1166,9 +1103,9 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.HasFlag(ItemFields.Flags, ItemFieldFlags.NewItem))
|
||||
if (item.HasItemFlag(ItemFieldFlags.NewItem))
|
||||
{
|
||||
item.RemoveFlag(ItemFields.Flags, ItemFieldFlags.NewItem);
|
||||
item.RemoveItemFlag(ItemFieldFlags.NewItem);
|
||||
item.SetState(ItemUpdateState.Changed, _player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace Game
|
||||
if (!GetPlayer().GetLootGUID().IsEmpty())
|
||||
GetPlayer().SendLootReleaseAll();
|
||||
|
||||
bool instantLogout = (pl.HasFlag(PlayerFields.Flags, PlayerFlags.Resting) && !pl.IsInCombat() ||
|
||||
bool instantLogout = (pl.HasPlayerFlag(PlayerFlags.Resting) && !pl.IsInCombat() ||
|
||||
pl.IsInFlight() || HasPermission(RBACPermissions.InstantLogout));
|
||||
|
||||
bool canLogoutInCombat = pl.HasFlag(PlayerFields.Flags, PlayerFlags.Resting);
|
||||
bool canLogoutInCombat = pl.HasPlayerFlag(PlayerFlags.Resting);
|
||||
|
||||
int reason = 0;
|
||||
if (pl.IsInCombat() && !canLogoutInCombat)
|
||||
@@ -68,7 +68,7 @@ namespace Game
|
||||
if (pl.GetStandState() == UnitStandStateType.Stand)
|
||||
pl.SetStandState(UnitStandStateType.Sit);
|
||||
pl.SetRooted(true);
|
||||
pl.SetFlag(UnitFields.Flags, UnitFlags.Stunned);
|
||||
pl.AddUnitFlag(UnitFlags.Stunned);
|
||||
}
|
||||
|
||||
SetLogoutStartTime(Time.UnixTime);
|
||||
@@ -95,7 +95,7 @@ namespace Game
|
||||
GetPlayer().SetStandState(UnitStandStateType.Stand);
|
||||
|
||||
//! DISABLE_ROTATE
|
||||
GetPlayer().RemoveFlag(UnitFields.Flags, UnitFlags.Stunned);
|
||||
GetPlayer().RemoveUnitFlag(UnitFlags.Stunned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Game
|
||||
player.SetLootGUID(ObjectGuid.Empty);
|
||||
player.SendLootRelease(lguid);
|
||||
|
||||
player.RemoveFlag(UnitFields.Flags, UnitFlags.Looting);
|
||||
player.RemoveUnitFlag(UnitFlags.Looting);
|
||||
|
||||
if (!player.IsInWorld)
|
||||
return;
|
||||
@@ -343,7 +343,7 @@ namespace Game
|
||||
if (go.GetGoType() == GameObjectTypes.FishingHole)
|
||||
{ // The fishing hole used once more
|
||||
go.AddUse(); // if the max usage is reached, will be despawned in next tick
|
||||
if (go.GetUseCount() >= go.m_goValue.FishingHole.MaxOpens)
|
||||
if (go.GetUseCount() >= go.GetGoValue().FishingHole.MaxOpens)
|
||||
go.SetLootState(LootState.JustDeactivated);
|
||||
else
|
||||
go.SetLootState(LootState.Ready);
|
||||
@@ -374,7 +374,7 @@ namespace Game
|
||||
if (loot.isLooted())
|
||||
{
|
||||
loot.clear();
|
||||
corpse.RemoveFlag(CorpseFields.DynamicFlags, 0x0001);
|
||||
corpse.RemoveCorpseDynamicFlag(CorpseDynFlags.Lootable);
|
||||
}
|
||||
}
|
||||
else if (lguid.IsItem())
|
||||
@@ -417,7 +417,7 @@ namespace Game
|
||||
loot = creature.loot;
|
||||
if (loot.isLooted())
|
||||
{
|
||||
creature.RemoveFlag(ObjectFields.DynamicFlags, UnitDynFlags.Lootable);
|
||||
creature.RemoveDynamicFlag(UnitDynFlags.Lootable);
|
||||
|
||||
// skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
|
||||
if (!creature.IsAlive())
|
||||
@@ -437,11 +437,10 @@ namespace Game
|
||||
{
|
||||
if (group.GetLootMethod() != LootMethod.MasterLoot)
|
||||
group.SendLooter(creature, null);
|
||||
|
||||
|
||||
}
|
||||
// force dynflag update to update looter and lootable info
|
||||
creature.ForceValuesUpdateAtIndex(ObjectFields.DynamicFlags);
|
||||
creature.m_values.ModifyValue(creature.m_objectData).ModifyValue(creature.m_objectData.DynamicFlags);
|
||||
creature.ForceUpdateFieldChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,7 +541,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// not move item from loot to target inventory
|
||||
Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomPropertyId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||
Item newitem = target.StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, item.BonusListIDs);
|
||||
target.SendNewItem(newitem, item.count, false, false, true);
|
||||
target.UpdateCriteria(CriteriaTypes.LootItem, item.itemid, item.count);
|
||||
target.UpdateCriteria(CriteriaTypes.LootType, item.itemid, item.count, (ulong)loot.loot_type);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Game
|
||||
}
|
||||
else if (guid.IsAnyTypeCreature())
|
||||
{
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Mailbox))
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Mailbox, NPCFlags2.None))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -237,13 +237,13 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.GetTemplate().GetFlags().HasAnyFlag(ItemFlags.Conjured) || item.GetUInt32Value(ItemFields.Duration) != 0)
|
||||
if (item.GetTemplate().GetFlags().HasAnyFlag(ItemFlags.Conjured) || item.m_itemData.Expiration != 0)
|
||||
{
|
||||
player.SendMailResult(0, MailResponseType.Send, MailResponseResult.EquipError, InventoryResult.MailBoundItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.Info.Cod != 0 && item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))
|
||||
if (packet.Info.Cod != 0 && item.HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
{
|
||||
player.SendMailResult(0, MailResponseType.Send, MailResponseResult.CantSendWrappedCod);
|
||||
return;
|
||||
@@ -624,9 +624,9 @@ namespace Game
|
||||
bodyItem.SetText(m.body);
|
||||
|
||||
if (m.messageType == MailMessageType.Normal)
|
||||
bodyItem.SetGuidValue(ItemFields.Creator, ObjectGuid.Create(HighGuid.Player, m.sender));
|
||||
bodyItem.SetCreator(ObjectGuid.Create(HighGuid.Player, m.sender));
|
||||
|
||||
bodyItem.SetFlag(ItemFields.Flags, ItemFieldFlags.Readable);
|
||||
bodyItem.AddItemFlag(ItemFieldFlags.Readable);
|
||||
|
||||
Log.outInfo(LogFilter.Network, "HandleMailCreateTextItem mailid={0}", packet.MailID);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
GetPlayer().SetByteValue(ActivePlayerFields.Bytes, PlayerFieldOffsets.FieldBytesOffsetActionBarToggles, packet.Mask);
|
||||
GetPlayer().SetMultiActionBars(packet.Mask);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.CompleteCinematic)]
|
||||
@@ -229,7 +229,7 @@ namespace Game
|
||||
player.GetRestMgr().SetRestFlag(RestFlag.Tavern, atEntry.Id);
|
||||
|
||||
if (Global.WorldMgr.IsFFAPvPRealm())
|
||||
player.RemoveByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PvpFlag, UnitBytes2Flags.FFAPvp);
|
||||
player.RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -455,41 +455,38 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TogglePvp)]
|
||||
void HandleTogglePvP(TogglePvP packet)
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
|
||||
bool inPvP = player.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP);
|
||||
player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.InPVP, !inPvP);
|
||||
player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.PVPTimer, inPvP);
|
||||
|
||||
if (player.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP))
|
||||
if (GetPlayer().HasPlayerFlag(PlayerFlags.InPVP))
|
||||
{
|
||||
if (!player.IsPvP() || player.pvpInfo.EndTimer != 0)
|
||||
player.UpdatePvP(true, true);
|
||||
GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP);
|
||||
GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer);
|
||||
if (!GetPlayer().pvpInfo.IsHostile && GetPlayer().IsPvP())
|
||||
GetPlayer().pvpInfo.EndTimer = Time.UnixTime; // start toggle-off
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player.pvpInfo.IsHostile && player.IsPvP())
|
||||
player.pvpInfo.EndTimer = Time.UnixTime; // start toggle-off
|
||||
GetPlayer().AddPlayerFlag(PlayerFlags.InPVP);
|
||||
GetPlayer().RemovePlayerFlag(PlayerFlags.PVPTimer);
|
||||
if (!GetPlayer().IsPvP() || GetPlayer().pvpInfo.EndTimer != 0)
|
||||
GetPlayer().UpdatePvP(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.SetPvp)]
|
||||
void HandleSetPvP(SetPvP packet)
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
|
||||
player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.InPVP, packet.EnablePVP);
|
||||
player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.PVPTimer, !packet.EnablePVP);
|
||||
|
||||
if (player.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP))
|
||||
if (!packet.EnablePVP)
|
||||
{
|
||||
if (!player.IsPvP() || player.pvpInfo.EndTimer != 0)
|
||||
player.UpdatePvP(true, true);
|
||||
GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP);
|
||||
GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer);
|
||||
if (!GetPlayer().pvpInfo.IsHostile && GetPlayer().IsPvP())
|
||||
GetPlayer().pvpInfo.EndTimer = Time.UnixTime; // start toggle-off
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!player.pvpInfo.IsHostile && player.IsPvP())
|
||||
player.pvpInfo.EndTimer = Time.UnixTime; // start set-off
|
||||
GetPlayer().AddPlayerFlag(PlayerFlags.InPVP);
|
||||
GetPlayer().RemovePlayerFlag(PlayerFlags.PVPTimer);
|
||||
if (!GetPlayer().IsPvP() || GetPlayer().pvpInfo.EndTimer != 0)
|
||||
GetPlayer().UpdatePvP(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,12 +495,12 @@ namespace Game
|
||||
{
|
||||
if (farSight.Enable)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Added FarSight {0} to player {1}", GetPlayer().GetUInt64Value(ActivePlayerFields.Farsight), GetPlayer().GetGUID().ToString());
|
||||
Log.outDebug(LogFilter.Network, "Added FarSight {0} to player {1}", GetPlayer().m_activePlayerData.FarsightObject.ToString(), GetPlayer().GetGUID().ToString());
|
||||
WorldObject target = GetPlayer().GetViewpoint();
|
||||
if (target)
|
||||
GetPlayer().SetSeer(target);
|
||||
else
|
||||
Log.outDebug(LogFilter.Network, "Player {0} (GUID: {1}) requests non-existing seer {2}", GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetPlayer().GetUInt64Value(ActivePlayerFields.Farsight));
|
||||
Log.outDebug(LogFilter.Network, "Player {0} (GUID: {1}) requests non-existing seer {2}", GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetPlayer().m_activePlayerData.FarsightObject.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -518,7 +515,7 @@ namespace Game
|
||||
void HandleSetTitle(SetTitle packet)
|
||||
{
|
||||
// -1 at none
|
||||
if (packet.TitleID > 0 && packet.TitleID < PlayerConst.MaxTitleIndex)
|
||||
if (packet.TitleID > 0)
|
||||
{
|
||||
if (!GetPlayer().HasTitle((uint)packet.TitleID))
|
||||
return;
|
||||
@@ -526,7 +523,7 @@ namespace Game
|
||||
else
|
||||
packet.TitleID = 0;
|
||||
|
||||
GetPlayer().SetUInt32Value(PlayerFields.ChosenTitle, (uint)packet.TitleID);
|
||||
GetPlayer().SetChosenTitle((uint)packet.TitleID);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.ResetInstances)]
|
||||
@@ -602,7 +599,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
// the difficulty is set even if the instances can't be reset
|
||||
//_player->SendDungeonDifficulty(true);
|
||||
//_player.SendDungeonDifficulty(true);
|
||||
group.ResetInstances(InstanceResetMethod.ChangeDifficulty, false, false, GetPlayer());
|
||||
group.SetDungeonDifficultyID(difficultyID);
|
||||
}
|
||||
@@ -703,7 +700,10 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SetTaxiBenchmarkMode, Processing = PacketProcessing.Inplace)]
|
||||
void HandleSetTaxiBenchmark(SetTaxiBenchmarkMode packet)
|
||||
{
|
||||
_player.ApplyModFlag(PlayerFields.Flags, PlayerFlags.TaxiBenchmark, packet.Enable);
|
||||
if (packet.Enable)
|
||||
_player.AddPlayerFlag(PlayerFlags.TaxiBenchmark);
|
||||
else
|
||||
_player.RemovePlayerFlag(PlayerFlags.TaxiBenchmark);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.GuildSetFocusedAchievement)]
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace Game
|
||||
}
|
||||
|
||||
// stop some emotes at player move
|
||||
if (plrMover && (plrMover.GetUInt32Value(UnitFields.NpcEmotestate) != 0))
|
||||
plrMover.SetUInt32Value(UnitFields.NpcEmotestate, (uint)Emote.OneshotNone);
|
||||
if (plrMover && (plrMover.GetEmoteState() != 0))
|
||||
plrMover.SetEmoteState(Emote.OneshotNone);
|
||||
|
||||
//handle special cases
|
||||
if (!movementInfo.transport.guid.IsEmpty())
|
||||
@@ -189,7 +189,7 @@ namespace Game
|
||||
// @todo discard movement packets after the player is rooted
|
||||
if (plrMover.IsAlive())
|
||||
{
|
||||
plrMover.SetFlag(PlayerFields.Flags, PlayerFlags.IsOutOfBounds);
|
||||
plrMover.AddPlayerFlag(PlayerFlags.IsOutOfBounds);
|
||||
plrMover.EnvironmentalDamage(EnviromentalDamage.FallToVoid, (uint)GetPlayer().GetMaxHealth());
|
||||
// player can be alive if GM/etc
|
||||
// change the death state to CORPSE to prevent the death timer from
|
||||
@@ -200,7 +200,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
else
|
||||
plrMover.RemoveFlag(PlayerFields.Flags, PlayerFlags.IsOutOfBounds);
|
||||
plrMover.RemovePlayerFlag(PlayerFlags.IsOutOfBounds);
|
||||
|
||||
if (opcode == ClientOpcodes.MoveJump)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ namespace Game
|
||||
|
||||
float z = loc.GetPositionZ();
|
||||
if (GetPlayer().HasUnitMovementFlag(MovementFlag.Hover))
|
||||
z += GetPlayer().GetFloatValue(UnitFields.HoverHeight);
|
||||
z += GetPlayer().m_unitData.HoverHeight;
|
||||
|
||||
GetPlayer().Relocate(loc.GetPositionX(), loc.GetPositionY(), z, loc.GetOrientation());
|
||||
|
||||
@@ -393,7 +393,7 @@ namespace Game
|
||||
GetPlayer().CastSpell(GetPlayer(), 2479, true);
|
||||
|
||||
// in friendly area
|
||||
else if (GetPlayer().IsPvP() && !GetPlayer().HasFlag(PlayerFields.Flags, PlayerFlags.InPVP))
|
||||
else if (GetPlayer().IsPvP() && !GetPlayer().HasPlayerFlag(PlayerFlags.InPVP))
|
||||
GetPlayer().UpdatePvP(false, false);
|
||||
|
||||
// resummon pet
|
||||
@@ -459,7 +459,7 @@ namespace Game
|
||||
plMover.CastSpell(plMover, 2479, true);
|
||||
|
||||
// in friendly area
|
||||
else if (plMover.IsPvP() && !plMover.HasFlag(PlayerFields.Flags, PlayerFlags.InPVP))
|
||||
else if (plMover.IsPvP() && !plMover.HasPlayerFlag(PlayerFlags.InPVP))
|
||||
plMover.UpdatePvP(false, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TabardVendorActivate)]
|
||||
void HandleTabardVendorActivate(Hello packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.TabardDesigner);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.TabardDesigner, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTabardVendorActivateOpcode - {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
@@ -56,7 +56,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TrainerList)]
|
||||
void HandleTrainerList(Hello packet)
|
||||
{
|
||||
Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer);
|
||||
Creature npc = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Trainer, NPCFlags2.None);
|
||||
if (!npc)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WorldSession.SendTrainerList - {packet.Unit.ToString()} not found or you can not interact with him.");
|
||||
@@ -92,7 +92,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TrainerBuySpell)]
|
||||
void HandleTrainerBuySpell(TrainerBuySpell packet)
|
||||
{
|
||||
Creature npc = _player.GetNPCIfCanInteractWith(packet.TrainerGUID, NPCFlags.Trainer);
|
||||
Creature npc = _player.GetNPCIfCanInteractWith(packet.TrainerGUID, NPCFlags.Trainer, NPCFlags2.None);
|
||||
if (npc == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, $"WORLD: HandleTrainerBuySpell - {packet.TrainerGUID.ToString()} not found or you can not interact with him.");
|
||||
@@ -129,7 +129,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.TalkToGossip)]
|
||||
void HandleGossipHello(Hello packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Gossip);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Gossip, NPCFlags2.None);
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleGossipHello - {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
@@ -137,7 +137,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// set faction visible if needed
|
||||
var factionTemplateEntry = CliDB.FactionTemplateStorage.LookupByKey(unit.getFaction());
|
||||
var factionTemplateEntry = CliDB.FactionTemplateStorage.LookupByKey(unit.GetFaction());
|
||||
if (factionTemplateEntry != null)
|
||||
GetPlayer().GetReputationMgr().SetVisible(factionTemplateEntry);
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Game
|
||||
GameObject go = null;
|
||||
if (packet.GossipUnit.IsCreatureOrVehicle())
|
||||
{
|
||||
unit = GetPlayer().GetNPCIfCanInteractWith(packet.GossipUnit, NPCFlags.Gossip);
|
||||
unit = GetPlayer().GetNPCIfCanInteractWith(packet.GossipUnit, NPCFlags.Gossip, NPCFlags2.None);
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleGossipSelectOption - {0} not found or you can't interact with him.", packet.GossipUnit.ToString());
|
||||
@@ -251,7 +251,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.SpiritHealerActivate)]
|
||||
void HandleSpiritHealerActivate(SpiritHealerActivate packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Healer, NPCFlags.SpiritHealer);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Healer, NPCFlags.SpiritHealer, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleSpiritHealerActivateOpcode - {0} not found or you can not interact with him.", packet.Healer.ToString());
|
||||
@@ -304,7 +304,7 @@ namespace Game
|
||||
if (!GetPlayer().IsInWorld || !GetPlayer().IsAlive())
|
||||
return;
|
||||
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Innkeeper);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Innkeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleBinderActivate - {0} not found or you can not interact with him.", packet.Unit.ToString());
|
||||
@@ -417,7 +417,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.RepairItem)]
|
||||
void HandleRepairItem(RepairItem packet)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.NpcGUID, NPCFlags.Repair);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(packet.NpcGUID, NPCFlags.Repair, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleRepairItemOpcode - {0} not found or you can not interact with him.", packet.NpcGUID.ToString());
|
||||
@@ -457,7 +457,7 @@ namespace Game
|
||||
|
||||
public void SendListInventory(ObjectGuid vendorGuid)
|
||||
{
|
||||
Creature vendor = GetPlayer().GetNPCIfCanInteractWith(vendorGuid, NPCFlags.Vendor);
|
||||
Creature vendor = GetPlayer().GetNPCIfCanInteractWith(vendorGuid, NPCFlags.Vendor, NPCFlags2.None);
|
||||
if (vendor == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: SendListInventory - {0} not found or you can not interact with him.", vendorGuid.ToString());
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace Game
|
||||
if (unit)
|
||||
{
|
||||
response.Allow = true;
|
||||
response.Timestamp = unit.GetUInt32Value(UnitFields.PetNameTimestamp);
|
||||
response.Timestamp = unit.m_unitData.PetNameTimestamp;
|
||||
response.Name = unit.GetName();
|
||||
|
||||
Pet pet = unit.ToPet();
|
||||
@@ -445,7 +445,7 @@ namespace Game
|
||||
// stable master case
|
||||
else
|
||||
{
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.StableMaster))
|
||||
if (!GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.StableMaster, NPCFlags2.None))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Stablemaster {0} not found or you can't interact with him.", guid.ToString());
|
||||
return false;
|
||||
@@ -526,7 +526,7 @@ namespace Game
|
||||
|
||||
Pet pet = ObjectAccessor.GetPet(GetPlayer(), petguid);
|
||||
// check it!
|
||||
if (!pet || !pet.IsPet() || pet.ToPet().getPetType() != PetType.Hunter || !pet.HasByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PetFlags, UnitPetFlags.CanBeRenamed) ||
|
||||
if (!pet || !pet.IsPet() || pet.ToPet().getPetType() != PetType.Hunter || !pet.HasPetFlag(UnitPetFlags.CanBeRenamed) ||
|
||||
pet.GetOwnerGUID() != GetPlayer().GetGUID() || pet.GetCharmInfo() == null)
|
||||
return;
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace Game
|
||||
|
||||
pet.SetName(name);
|
||||
pet.SetGroupUpdateFlag(GroupUpdatePetFlags.Name);
|
||||
pet.RemoveByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PetFlags, UnitPetFlags.CanBeRenamed);
|
||||
pet.RemovePetFlag(UnitPetFlags.CanBeRenamed);
|
||||
|
||||
PreparedStatement stmt;
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
@@ -573,7 +573,7 @@ namespace Game
|
||||
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
pet.SetUInt32Value(UnitFields.PetNameTimestamp, (uint)Time.UnixTime); // cast can't be helped
|
||||
pet.SetPetNameTimestamp((uint)Time.UnixTime); // cast can't be helped
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.PetAbandon)]
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Game
|
||||
void HandlePetitionBuy(PetitionBuy packet)
|
||||
{
|
||||
// prevent cheating
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Petitioner);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.Unit, NPCFlags.Petitioner, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandlePetitionBuyOpcode - {0} not found or you can't interact with him.", packet.Unit.ToString());
|
||||
@@ -88,9 +88,7 @@ namespace Game
|
||||
if (!charter)
|
||||
return;
|
||||
|
||||
charter.SetUInt32Value(ItemFields.Enchantment, (uint)charter.GetGUID().GetCounter());
|
||||
// ITEM_FIELD_ENCHANTMENT_1_1 is guild/arenateam id
|
||||
// ITEM_FIELD_ENCHANTMENT_1_1+1 is current signatures count (showed on item)
|
||||
charter.SetPetitionId((uint)charter.GetGUID().GetCounter());
|
||||
charter.SetState(ItemUpdateState.Changed, GetPlayer());
|
||||
GetPlayer().SendNewItem(charter, 1, true, false);
|
||||
|
||||
@@ -249,7 +247,7 @@ namespace Game
|
||||
}
|
||||
|
||||
ObjectGuid ownerGuid = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0));
|
||||
//ulong signs = result.Read<ulong>(1);
|
||||
ulong signs = result.Read<ulong>(1);
|
||||
|
||||
if (ownerGuid == GetPlayer().GetGUID())
|
||||
return;
|
||||
@@ -306,6 +304,13 @@ namespace Game
|
||||
// close at signer side
|
||||
SendPacket(signResult);
|
||||
|
||||
Item item = _player.GetItemByGuid(packet.PetitionGUID);
|
||||
if (item != null)
|
||||
{
|
||||
item.SetPetitionNumSignatures((uint)signs);
|
||||
item.SetState(ItemUpdateState.Changed, _player);
|
||||
}
|
||||
|
||||
// update for owner if online
|
||||
Player owner = Global.ObjAccessor.FindPlayer(ownerGuid);
|
||||
if (owner)
|
||||
@@ -503,7 +508,7 @@ namespace Game
|
||||
|
||||
public void SendPetitionShowList(ObjectGuid guid)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Petitioner);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(guid, NPCFlags.Petitioner, NPCFlags2.None);
|
||||
if (!creature)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandlePetitionShowListOpcode - {0} not found or you can't interact with him.", guid.ToString());
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.QuestGiverHello)]
|
||||
void HandleQuestgiverHello(QuestGiverHello packet)
|
||||
{
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.QuestGiverGUID, NPCFlags.QuestGiver);
|
||||
Creature creature = GetPlayer().GetNPCIfCanInteractWith(packet.QuestGiverGUID, NPCFlags.QuestGiver, NPCFlags2.None);
|
||||
if (creature == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleQuestgiverHello - {0} not found or you can't interact with him.", packet.QuestGiverGUID.ToString());
|
||||
@@ -700,7 +700,7 @@ namespace Game
|
||||
List<ItemPosCount> dest = new List<ItemPosCount>();
|
||||
if (_player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.Id, (uint)item.Quantity) == InventoryResult.Ok)
|
||||
{
|
||||
Item newItem = _player.StoreNewItem(dest, item.Id, true, ItemEnchantment.GenerateItemRandomPropertyId(item.Id), null, 0, item.BonusListIDs);
|
||||
Item newItem = _player.StoreNewItem(dest, item.Id, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(item.Id), null, 0, item.BonusListIDs);
|
||||
_player.SendNewItem(newItem, (uint)item.Quantity, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ConfirmRespecWipe)]
|
||||
void HandleConfirmRespecWipe(ConfirmRespecWipe confirmRespecWipe)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(confirmRespecWipe.RespecMaster, NPCFlags.Trainer);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(confirmRespecWipe.RespecMaster, NPCFlags.Trainer, NPCFlags2.None);
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTalentWipeConfirm - {0} not found or you can't interact with him.", confirmRespecWipe.RespecMaster.ToString());
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// Verify that the bag is an actual bag or wrapped item that can be used "normally"
|
||||
if (!proto.GetFlags().HasAnyFlag(ItemFlags.HasLoot) && !item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))
|
||||
if (!proto.GetFlags().HasAnyFlag(ItemFlags.HasLoot) && !item.HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
{
|
||||
player.SendEquipError(InventoryResult.ClientLockedOut, item);
|
||||
Log.outError(LogFilter.Network, "Possible hacking attempt: Player {0} [guid: {1}] tried to open item [guid: {2}, entry: {3}] which is not openable!",
|
||||
@@ -177,7 +177,7 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
if (item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))// wrapped?
|
||||
if (item.HasItemFlag(ItemFieldFlags.Wrapped))// wrapped?
|
||||
{
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GIFT_BY_ITEM);
|
||||
stmt.AddValue(0, item.GetGUID().GetCounter());
|
||||
@@ -188,9 +188,9 @@ namespace Game
|
||||
uint entry = result.Read<uint>(0);
|
||||
uint flags = result.Read<uint>(1);
|
||||
|
||||
item.SetUInt64Value(ItemFields.GiftCreator, 0);
|
||||
item.SetGiftCreator(ObjectGuid.Empty);
|
||||
item.SetEntry(entry);
|
||||
item.SetUInt32Value(ItemFields.Flags, flags);
|
||||
item.SetItemFlags((ItemFieldFlags)flags);
|
||||
item.SetState(ItemUpdateState.Changed, player);
|
||||
}
|
||||
else
|
||||
@@ -450,7 +450,7 @@ namespace Game
|
||||
if (_player.HasAuraType(AuraType.PreventResurrection))
|
||||
return; // silent return, client should display error by itself and not send this opcode
|
||||
|
||||
var selfResSpells = _player.GetDynamicValues(ActivePlayerDynamicFields.SelfResSpells);
|
||||
List<uint> selfResSpells = _player.m_activePlayerData.SelfResSpells;
|
||||
if (!selfResSpells.Contains(selfRes.SpellId))
|
||||
return;
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace Game
|
||||
if (spellInfo != null)
|
||||
_player.CastSpell(_player, spellInfo, false, null);
|
||||
|
||||
_player.RemoveDynamicValue(ActivePlayerDynamicFields.SelfResSpells, selfRes.SpellId);
|
||||
_player.RemoveSelfResSpell(selfRes.SpellId);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.SpellClick)]
|
||||
@@ -497,23 +497,23 @@ namespace Game
|
||||
Player player = creator.ToPlayer();
|
||||
if (player)
|
||||
{
|
||||
MirrorImageComponentedData data = new MirrorImageComponentedData();
|
||||
data.UnitGUID = guid;
|
||||
data.DisplayID = (int)creator.GetDisplayId();
|
||||
data.RaceID = (byte)creator.GetRace();
|
||||
data.Gender = (byte)creator.GetGender();
|
||||
data.ClassID = (byte)creator.GetClass();
|
||||
MirrorImageComponentedData mirrorImageComponentedData = new MirrorImageComponentedData();
|
||||
mirrorImageComponentedData.UnitGUID = guid;
|
||||
mirrorImageComponentedData.DisplayID = (int)creator.GetDisplayId();
|
||||
mirrorImageComponentedData.RaceID = (byte)creator.GetRace();
|
||||
mirrorImageComponentedData.Gender = (byte)creator.GetGender();
|
||||
mirrorImageComponentedData.ClassID = (byte)creator.GetClass();
|
||||
|
||||
Guild guild = player.GetGuild();
|
||||
|
||||
data.SkinColor = player.GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetSkinId);
|
||||
data.FaceVariation = player.GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetFaceId);
|
||||
data.HairVariation = player.GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetHairStyleId);
|
||||
data.HairColor = player.GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetHairColorId);
|
||||
data.BeardVariation = player.GetByteValue(PlayerFields.Bytes2, PlayerFieldOffsets.Bytes2OffsetFacialStyle);
|
||||
mirrorImageComponentedData.SkinColor = player.m_playerData.SkinID;
|
||||
mirrorImageComponentedData.FaceVariation = player.m_playerData.FaceID;
|
||||
mirrorImageComponentedData.HairVariation = player.m_playerData.HairStyleID;
|
||||
mirrorImageComponentedData.HairColor = player.m_playerData.HairColorID;
|
||||
mirrorImageComponentedData.BeardVariation = player.m_playerData.FacialHairStyleID;
|
||||
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
|
||||
data.CustomDisplay[i] = player.GetByteValue(PlayerFields.Bytes2, (byte)(PlayerFieldOffsets.Bytes2OffsetCustomDisplayOption + i));
|
||||
data.GuildGUID = (guild ? guild.GetGUID() : ObjectGuid.Empty);
|
||||
mirrorImageComponentedData.CustomDisplay[i] = player.m_playerData.CustomDisplayOption[i];
|
||||
mirrorImageComponentedData.GuildGUID = (guild ? guild.GetGUID() : ObjectGuid.Empty);
|
||||
|
||||
byte[] itemSlots =
|
||||
{
|
||||
@@ -535,18 +535,15 @@ namespace Game
|
||||
{
|
||||
uint itemDisplayId;
|
||||
Item item = player.GetItemByPos(InventorySlots.Bag0, slot);
|
||||
if ((slot == EquipmentSlot.Head && player.HasFlag(PlayerFields.Flags, PlayerFlags.HideHelm)) ||
|
||||
(slot == EquipmentSlot.Cloak && player.HasFlag(PlayerFields.Flags, PlayerFlags.HideCloak)))
|
||||
itemDisplayId = 0;
|
||||
else if (item)
|
||||
if (item != null)
|
||||
itemDisplayId = item.GetDisplayId(player);
|
||||
else
|
||||
itemDisplayId = 0;
|
||||
|
||||
data.ItemDisplayID.Add((int)itemDisplayId);
|
||||
mirrorImageComponentedData.ItemDisplayID.Add((int)itemDisplayId);
|
||||
}
|
||||
|
||||
SendPacket(data);
|
||||
SendPacket(mirrorImageComponentedData);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.EnableTaxiNode, Processing = PacketProcessing.ThreadSafe)]
|
||||
void HandleEnableTaxiNodeOpcode(EnableTaxiNode enableTaxiNode)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(enableTaxiNode.Unit, NPCFlags.FlightMaster);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(enableTaxiNode.Unit, NPCFlags.FlightMaster, NPCFlags2.None);
|
||||
if (unit)
|
||||
SendLearnNewTaxiNode(unit);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace Game
|
||||
void HandleTaxiQueryAvailableNodes(TaxiQueryAvailableNodes taxiQueryAvailableNodes)
|
||||
{
|
||||
// cheating checks
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(taxiQueryAvailableNodes.Unit, NPCFlags.FlightMaster);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(taxiQueryAvailableNodes.Unit, NPCFlags.FlightMaster, NPCFlags2.None);
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTaxiQueryAvailableNodes - {0} not found or you can't interact with him.", taxiQueryAvailableNodes.Unit.ToString());
|
||||
@@ -169,7 +169,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ActivateTaxi, Processing = PacketProcessing.ThreadSafe)]
|
||||
void HandleActivateTaxi(ActivateTaxi activateTaxi)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(activateTaxi.Vendor, NPCFlags.FlightMaster);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(activateTaxi.Vendor, NPCFlags.FlightMaster, NPCFlags2.None);
|
||||
if (unit == null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleActivateTaxiOpcode - {0} not found or you can't interact with it.", activateTaxi.Vendor.ToString());
|
||||
|
||||
@@ -61,21 +61,21 @@ namespace Game
|
||||
tradeItem.Slot = i;
|
||||
tradeItem.Item = new ItemInstance(item);
|
||||
tradeItem.StackCount = (int)item.GetCount();
|
||||
tradeItem.GiftCreator = item.GetGuidValue(ItemFields.GiftCreator);
|
||||
if (!item.HasFlag(ItemFields.Flags, ItemFieldFlags.Wrapped))
|
||||
tradeItem.GiftCreator = item.GetGiftCreator();
|
||||
if (!item.HasItemFlag(ItemFieldFlags.Wrapped))
|
||||
{
|
||||
tradeItem.Unwrapped.HasValue = true;
|
||||
TradeUpdated.UnwrappedTradeItem unwrappedItem = tradeItem.Unwrapped.Value;
|
||||
unwrappedItem.EnchantID = (int)item.GetEnchantmentId(EnchantmentSlot.Perm);
|
||||
unwrappedItem.OnUseEnchantmentID = (int)item.GetEnchantmentId(EnchantmentSlot.Use);
|
||||
unwrappedItem.Creator = item.GetGuidValue(ItemFields.Creator);
|
||||
unwrappedItem.Creator = item.GetCreator();
|
||||
unwrappedItem.Charges = item.GetSpellCharges();
|
||||
unwrappedItem.Lock = item.GetTemplate().GetLockID() != 0 && !item.HasFlag(ItemFields.Flags, ItemFieldFlags.Unlocked);
|
||||
unwrappedItem.MaxDurability = item.GetUInt32Value(ItemFields.MaxDurability);
|
||||
unwrappedItem.Durability = item.GetUInt32Value(ItemFields.Durability);
|
||||
unwrappedItem.Lock = item.GetTemplate().GetLockID() != 0 && !item.HasItemFlag(ItemFieldFlags.Unlocked);
|
||||
unwrappedItem.MaxDurability = item.m_itemData.MaxDurability;
|
||||
unwrappedItem.Durability = item.m_itemData.Durability;
|
||||
|
||||
byte g = 0;
|
||||
foreach (ItemDynamicFieldGems gemData in item.GetGems())
|
||||
foreach (SocketedGem gemData in item.m_itemData.Gems)
|
||||
{
|
||||
if (gemData.ItemId != 0)
|
||||
{
|
||||
@@ -124,8 +124,8 @@ namespace Game
|
||||
}
|
||||
|
||||
// adjust time (depends on /played)
|
||||
if (myItems[i].HasFlag(ItemFields.Flags, ItemFieldFlags.BopTradeable))
|
||||
myItems[i].SetUInt32Value(ItemFields.CreatePlayedTime, trader.GetTotalPlayedTime() - (GetPlayer().GetTotalPlayedTime() - myItems[i].GetUInt32Value(ItemFields.CreatePlayedTime)));
|
||||
if (myItems[i].HasItemFlag(ItemFieldFlags.BopTradeable))
|
||||
myItems[i].SetCreatePlayedTime(trader.GetTotalPlayedTime() - (GetPlayer().GetTotalPlayedTime() - myItems[i].m_itemData.CreatePlayedTime));
|
||||
// store
|
||||
trader.MoveItemToInventory(traderDst, myItems[i], true, true);
|
||||
}
|
||||
@@ -143,8 +143,8 @@ namespace Game
|
||||
|
||||
|
||||
// adjust time (depends on /played)
|
||||
if (hisItems[i].HasFlag(ItemFields.Flags, ItemFieldFlags.BopTradeable))
|
||||
hisItems[i].SetUInt32Value(ItemFields.CreatePlayedTime, GetPlayer().GetTotalPlayedTime() - (trader.GetTotalPlayedTime() - hisItems[i].GetUInt32Value(ItemFields.CreatePlayedTime)));
|
||||
if (hisItems[i].HasItemFlag(ItemFieldFlags.BopTradeable))
|
||||
hisItems[i].SetCreatePlayedTime(GetPlayer().GetTotalPlayedTime() - (trader.GetTotalPlayedTime() - hisItems[i].m_itemData.CreatePlayedTime));
|
||||
// store
|
||||
GetPlayer().MoveItemToInventory(playerDst, hisItems[i], true, true);
|
||||
}
|
||||
@@ -453,12 +453,12 @@ namespace Game
|
||||
{
|
||||
if (myItems[i])
|
||||
{
|
||||
myItems[i].SetGuidValue(ItemFields.GiftCreator, GetPlayer().GetGUID());
|
||||
myItems[i].SetGiftCreator(GetPlayer().GetGUID());
|
||||
GetPlayer().MoveItemFromInventory(myItems[i].GetBagSlot(), myItems[i].GetSlot(), true);
|
||||
}
|
||||
if (hisItems[i])
|
||||
{
|
||||
hisItems[i].SetGuidValue(ItemFields.GiftCreator, trader.GetGUID());
|
||||
hisItems[i].SetGiftCreator(trader.GetGUID());
|
||||
trader.MoveItemFromInventory(hisItems[i].GetBagSlot(), hisItems[i].GetSlot(), true);
|
||||
}
|
||||
}
|
||||
@@ -650,8 +650,8 @@ namespace Game
|
||||
}
|
||||
|
||||
if ((pOther.GetTeam() != GetPlayer().GetTeam() ||
|
||||
pOther.HasFlag(PlayerFields.FlagsEx, PlayerFlagsEx.MercenaryMode) ||
|
||||
GetPlayer().HasFlag(PlayerFields.FlagsEx, PlayerFlagsEx.MercenaryMode)) &&
|
||||
pOther.HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ||
|
||||
GetPlayer().HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode)) &&
|
||||
(!WorldConfig.GetBoolValue(WorldCfg.AllowTwoSideTrade) &&
|
||||
!HasPermission(RBACPermissions.AllowTwoSideTrade)))
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game
|
||||
Player player = GetPlayer();
|
||||
|
||||
// Validate
|
||||
if (!player.GetNPCIfCanInteractWith(transmogrifyItems.Npc, NPCFlags.Transmogrifier))
|
||||
if (!player.GetNPCIfCanInteractWith(transmogrifyItems.Npc, NPCFlags.Transmogrifier, NPCFlags2.None))
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Unit (GUID: {0}) not found or player can't interact with it.", transmogrifyItems.ToString());
|
||||
return;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.UnlockVoidStorage)]
|
||||
void HandleVoidStorageUnlock(UnlockVoidStorage unlockVoidStorage)
|
||||
{
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(unlockVoidStorage.Npc, NPCFlags.VaultKeeper);
|
||||
Creature unit = GetPlayer().GetNPCIfCanInteractWith(unlockVoidStorage.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageUnlock - {0} not found or player can't interact with it.", unlockVoidStorage.Npc.ToString());
|
||||
@@ -55,7 +55,7 @@ namespace Game
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(queryVoidStorage.Npc, NPCFlags.Transmogrifier | NPCFlags.VaultKeeper);
|
||||
Creature unit = player.GetNPCIfCanInteractWith(queryVoidStorage.Npc, NPCFlags.Transmogrifier | NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageQuery - {0} not found or player can't interact with it.", queryVoidStorage.Npc.ToString());
|
||||
@@ -94,7 +94,7 @@ namespace Game
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(voidStorageTransfer.Npc, NPCFlags.VaultKeeper);
|
||||
Creature unit = player.GetNPCIfCanInteractWith(voidStorageTransfer.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidStorageTransfer - {0} not found or player can't interact with it.", voidStorageTransfer.Npc.ToString());
|
||||
@@ -155,14 +155,14 @@ namespace Game
|
||||
continue;
|
||||
}
|
||||
|
||||
VoidStorageItem itemVS = new VoidStorageItem(Global.ObjectMgr.GenerateVoidStorageItemId(), item.GetEntry(), item.GetGuidValue(ItemFields.Creator),
|
||||
item.GetItemRandomEnchantmentId(), item.GetItemSuffixFactor(), item.GetModifier(ItemModifier.UpgradeId),
|
||||
VoidStorageItem itemVS = new VoidStorageItem(Global.ObjectMgr.GenerateVoidStorageItemId(), item.GetEntry(), item.GetCreator(),
|
||||
item.GetItemRandomBonusListId(), item.GetModifier(ItemModifier.UpgradeId),
|
||||
item.GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), item.GetModifier(ItemModifier.ArtifactKnowledgeLevel),
|
||||
(byte)item.GetUInt32Value(ItemFields.Context), item.GetDynamicValues(ItemDynamicFields.BonusListIds));
|
||||
(byte)item.m_itemData.Context, item.m_itemData.BonusListIDs);
|
||||
|
||||
VoidItem voidItem;
|
||||
voidItem.Guid = ObjectGuid.Create(HighGuid.Item, itemVS.ItemId);
|
||||
voidItem.Creator = item.GetGuidValue(ItemFields.Creator);
|
||||
voidItem.Creator = item.GetCreator();
|
||||
voidItem.Item = new ItemInstance(itemVS);
|
||||
voidItem.Slot = _player.AddVoidStorageItem(itemVS);
|
||||
|
||||
@@ -195,9 +195,8 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = player.StoreNewItem(dest, itemVS.ItemEntry, true, itemVS.ItemRandomPropertyId, null, itemVS.Context, itemVS.BonusListIDs);
|
||||
item.SetUInt32Value(ItemFields.PropertySeed, itemVS.ItemSuffixFactor);
|
||||
item.SetGuidValue(ItemFields.Creator, itemVS.CreatorGuid);
|
||||
Item item = player.StoreNewItem(dest, itemVS.ItemEntry, true, itemVS.RandomBonusListId, null, itemVS.Context, itemVS.BonusListIDs);
|
||||
item.SetCreator(itemVS.CreatorGuid);
|
||||
item.SetModifier(ItemModifier.UpgradeId, itemVS.ItemUpgradeId);
|
||||
item.SetBinding(true);
|
||||
GetCollectionMgr().AddItemAppearance(item);
|
||||
@@ -216,7 +215,7 @@ namespace Game
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
|
||||
Creature unit = player.GetNPCIfCanInteractWith(swapVoidItem.Npc, NPCFlags.VaultKeeper);
|
||||
Creature unit = player.GetNPCIfCanInteractWith(swapVoidItem.Npc, NPCFlags.VaultKeeper, NPCFlags2.None);
|
||||
if (!unit)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WORLD: HandleVoidSwapItem - {0} not found or player can't interact with it.", swapVoidItem.Npc.ToString());
|
||||
|
||||
Reference in New Issue
Block a user