Updated to 7.3.5.25996 (Db2 files not updated)

This commit is contained in:
hondacrx
2018-02-19 10:32:16 -05:00
parent 0ab432f8c0
commit 0a3dfaba37
43 changed files with 1584 additions and 1425 deletions
+49 -44
View File
@@ -2370,8 +2370,8 @@ namespace Game.Entities
SetUInt32Value(UnitFields.Level, result.Read<uint>(6));
SetXP(result.Read<uint>(7));
_LoadIntoDataField(result.Read<string>(65), (int)PlayerFields.ExploredZones1, PlayerConst.ExploredZonesSize);
_LoadIntoDataField(result.Read<string>(66), (int)PlayerFields.KnownTitles, PlayerConst.KnowTitlesSize * 2);
_LoadIntoDataField(result.Read<string>(66), (int)PlayerFields.ExploredZones1, PlayerConst.ExploredZonesSize);
_LoadIntoDataField(result.Read<string>(67), (int)PlayerFields.KnownTitles, PlayerConst.KnowTitlesSize * 2);
SetObjectScale(1.0f);
SetFloatValue(UnitFields.HoverHeight, 1.0f);
@@ -2397,12 +2397,13 @@ namespace Game.Entities
SetByteValue(PlayerFields.Bytes2, PlayerFieldOffsets.Bytes2OffsetFacialStyle, result.Read<byte>(13));
for (byte i = 0; i < PlayerConst.CustomDisplaySize; ++i)
SetByteValue(PlayerFields.Bytes2, (byte)(PlayerFieldOffsets.Bytes2OffsetCustomDisplayOption + i), customDisplay[i]);
SetBankBagSlotCount(result.Read<byte>(17));
SetInventorySlotCount(result.Read<byte>(17));
SetBankBagSlotCount(result.Read<byte>(18));
SetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender, (byte)gender);
SetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetInebriation, result.Read<byte>(54));
SetUInt32Value(PlayerFields.Flags, result.Read<uint>(19));
SetUInt32Value(PlayerFields.FlagsEx, result.Read<uint>(20));
SetInt32Value(PlayerFields.WatchedFactionIndex, (int)result.Read<uint>(53));
SetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetInebriation, result.Read<byte>(55));
SetUInt32Value(PlayerFields.Flags, result.Read<uint>(20));
SetUInt32Value(PlayerFields.FlagsEx, result.Read<uint>(21));
SetInt32Value(PlayerFields.WatchedFactionIndex, (int)result.Read<uint>(54));
if (!ValidateAppearance((Race)result.Read<byte>(3), (Class)result.Read<byte>(4), (Gender)gender,
GetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetHairStyleId),
@@ -2416,9 +2417,9 @@ namespace Game.Entities
}
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
SetByteValue(PlayerFields.FieldBytes, PlayerFieldOffsets.FieldBytesOffsetActionBarToggles, result.Read<byte>(67));
SetByteValue(PlayerFields.FieldBytes, PlayerFieldOffsets.FieldBytesOffsetActionBarToggles, result.Read<byte>(68));
m_fishingSteps = result.Read<byte>(71);
m_fishingSteps = result.Read<byte>(72);
InitDisplayIds();
@@ -2442,20 +2443,20 @@ namespace Game.Entities
InitPrimaryProfessions(); // to max set before any spell loaded
// init saved position, and fix it later if problematic
ulong transLowGUID = result.Read<ulong>(40);
ulong transLowGUID = result.Read<ulong>(41);
Relocate(result.Read<float>(21), result.Read<float>(22), result.Read<float>(23), result.Read<float>(25));
Relocate(result.Read<float>(22), result.Read<float>(23), result.Read<float>(24), result.Read<float>(26));
uint mapId = result.Read<uint>(24);
uint instanceId = result.Read<uint>(62);
uint mapId = result.Read<uint>(25);
uint instanceId = result.Read<uint>(63);
var RelocateToHomebind = new Action(() => { mapId = homebind.GetMapId(); instanceId = 0; Relocate(homebind); });
SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID((Difficulty)result.Read<byte>(48)));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(69)));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(70)));
SetDungeonDifficultyID(CheckLoadedDungeonDifficultyID((Difficulty)result.Read<byte>(49)));
SetRaidDifficultyID(CheckLoadedRaidDifficultyID((Difficulty)result.Read<byte>(70)));
SetLegacyRaidDifficultyID(CheckLoadedLegacyRaidDifficultyID((Difficulty)result.Read<byte>(71)));
string taxi_nodes = result.Read<string>(47);
string taxi_nodes = result.Read<string>(48);
_LoadGroup(holder.GetResult(PlayerLoginQueryLoad.Group));
@@ -2479,9 +2480,9 @@ namespace Game.Entities
}
_LoadCurrency(holder.GetResult(PlayerLoginQueryLoad.Currency));
SetUInt32Value(PlayerFields.LifetimeHonorableKills, result.Read<uint>(49));
SetUInt16Value(PlayerFields.Kills, 0, result.Read<ushort>(50));
SetUInt16Value(PlayerFields.Kills, 1, result.Read<ushort>(51));
SetUInt32Value(PlayerFields.LifetimeHonorableKills, result.Read<uint>(50));
SetUInt16Value(PlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetTodayKills, result.Read<ushort>(51));
SetUInt16Value(PlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetYesterdayKills, result.Read<ushort>(52));
_LoadBoundInstances(holder.GetResult(PlayerLoginQueryLoad.BoundInstances));
_LoadInstanceTimeRestrictions(holder.GetResult(PlayerLoginQueryLoad.InstanceLockTimes));
@@ -2559,10 +2560,10 @@ namespace Game.Entities
if (transport)
{
float x = result.Read<float>(36);
float y = result.Read<float>(37);
float z = result.Read<float>(38);
float o = result.Read<float>(39);
float x = result.Read<float>(37);
float y = result.Read<float>(38);
float z = result.Read<float>(39);
float o = result.Read<float>(40);
m_movementInfo.transport.pos = new Position(x, y, z, o);
transport.CalculatePassengerPosition(ref x, ref y, ref z, ref o);
@@ -2757,7 +2758,7 @@ namespace Game.Entities
SaveRecallPosition();
long now = Time.UnixTime;
long logoutTime = result.Read<int>(31);
long logoutTime = result.Read<int>(32);
// since last logout (in seconds)
uint time_diff = (uint)(now - logoutTime);
@@ -2770,32 +2771,32 @@ namespace Game.Entities
SetDrunkValue(newDrunkValue);
m_cinematic = result.Read<byte>(27);
m_PlayedTimeTotal = result.Read<uint>(28);
m_PlayedTimeLevel = result.Read<uint>(29);
m_cinematic = result.Read<byte>(28);
m_PlayedTimeTotal = result.Read<uint>(29);
m_PlayedTimeLevel = result.Read<uint>(30);
SetTalentResetCost(result.Read<uint>(33));
SetTalentResetTime(result.Read<uint>(34));
SetTalentResetCost(result.Read<uint>(34));
SetTalentResetTime(result.Read<uint>(35));
m_taxi.LoadTaxiMask(result.Read<string>(26)); // must be before InitTaxiNodesForLevel
m_taxi.LoadTaxiMask(result.Read<string>(27)); // must be before InitTaxiNodesForLevel
PlayerExtraFlags extraflags = (PlayerExtraFlags)result.Read<uint>(41);
PlayerExtraFlags extraflags = (PlayerExtraFlags)result.Read<uint>(42);
m_stableSlots = result.Read<byte>(42);
m_stableSlots = result.Read<byte>(43);
if (m_stableSlots > 4)
{
Log.outError(LogFilter.Player, "Player can have not more {0} stable slots, but have in DB {1}", 4, m_stableSlots);
m_stableSlots = 4;
}
atLoginFlags = (AtLoginFlags)result.Read<uint>(43);
atLoginFlags = (AtLoginFlags)result.Read<uint>(44);
// Honor system
// Update Honor kills data
m_lastHonorUpdateTime = logoutTime;
UpdateHonorFields();
m_deathExpireTime = result.Read<uint>(46);
m_deathExpireTime = result.Read<uint>(47);
if (m_deathExpireTime > now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep)
m_deathExpireTime = now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep - 1;
@@ -2826,19 +2827,19 @@ namespace Game.Entities
InitRunes();
// rest bonus can only be calculated after InitStatsForLevel()
_restMgr.LoadRestBonus(RestTypes.XP, (PlayerRestState)result.Read<byte>(18), result.Read<float>(30));
_restMgr.LoadRestBonus(RestTypes.XP, (PlayerRestState)result.Read<byte>(19), result.Read<float>(31));
// load skills after InitStatsForLevel because it triggering aura apply also
_LoadSkills(holder.GetResult(PlayerLoginQueryLoad.Skills));
UpdateSkillsForLevel();
SetPrimarySpecialization(result.Read<uint>(35));
SetActiveTalentGroup(result.Read<byte>(63));
SetPrimarySpecialization(result.Read<uint>(36));
SetActiveTalentGroup(result.Read<byte>(64));
ChrSpecializationRecord primarySpec = CliDB.ChrSpecializationStorage.LookupByKey(GetPrimarySpecialization());
if (primarySpec == null || primarySpec.ClassID != (byte)GetClass() || GetActiveTalentGroup() >= PlayerConst.MaxSpecializations)
ResetTalentSpecialization();
uint lootSpecId = result.Read<byte>(64);
uint lootSpecId = result.Read<byte>(65);
ChrSpecializationRecord chrSpec = CliDB.ChrSpecializationStorage.LookupByKey(lootSpecId);
if (chrSpec != null)
{
@@ -2900,7 +2901,7 @@ namespace Game.Entities
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
uint curTitle = result.Read<uint>(52);
uint curTitle = result.Read<uint>(53);
if (curTitle != 0 && !HasTitle(curTitle))
curTitle = 0;
@@ -2923,7 +2924,7 @@ namespace Game.Entities
UpdateAllStats();
// restore remembered power/health values (but not more max values)
uint savedHealth = result.Read<uint>(55);
uint savedHealth = result.Read<uint>(56);
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
int loadedPowers = 0;
for (PowerType i = 0; i < PowerType.Max; ++i)
@@ -3014,7 +3015,7 @@ namespace Game.Entities
}
// RaF stuff.
m_grantableLevels = result.Read<byte>(68);
m_grantableLevels = result.Read<byte>(69);
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
SetFlag(ObjectFields.DynamicFlags, UnitDynFlags.ReferAFriend);
@@ -3036,9 +3037,9 @@ namespace Game.Entities
holder.GetResult(PlayerLoginQueryLoad.GarrisonFollowerAbilities)))
_garrison = garrison;
_InitHonorLevelOnLoadFromDB(result.Read<uint>(72), result.Read<uint>(73), result.Read<uint>(74));
_InitHonorLevelOnLoadFromDB(result.Read<uint>(73), result.Read<uint>(74), result.Read<uint>(75));
_restMgr.LoadRestBonus(RestTypes.Honor, (PlayerRestState)result.Read<byte>(75), result.Read<float>(76));
_restMgr.LoadRestBonus(RestTypes.Honor, (PlayerRestState)result.Read<byte>(76), result.Read<float>(77));
if (time_diff > 0)
{
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
@@ -3100,6 +3101,7 @@ namespace Game.Entities
stmt.AddValue(index++, GetByteValue(PlayerFields.Bytes2, PlayerFieldOffsets.Bytes2OffsetFacialStyle));
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
stmt.AddValue(index++, GetByteValue(PlayerFields.Bytes2, (byte)(PlayerFieldOffsets.Bytes2OffsetCustomDisplayOption + i)));
stmt.AddValue(index++, GetInventorySlotCount());
stmt.AddValue(index++, GetBankBagSlotCount());
stmt.AddValue(index++, (byte)GetUInt32Value(PlayerFields.RestInfo + PlayerFieldOffsets.RestStateXp));
stmt.AddValue(index++, GetUInt32Value(PlayerFields.Flags));
@@ -3211,6 +3213,7 @@ namespace Game.Entities
stmt.AddValue(index++, GetByteValue(PlayerFields.FieldBytes, PlayerFieldOffsets.FieldBytesOffsetActionBarToggles));
stmt.AddValue(index++, m_grantableLevels);
stmt.AddValue(index++, Global.WorldMgr.GetRealm().Build);
}
else
{
@@ -3231,6 +3234,7 @@ namespace Game.Entities
for (int i = 0; i < PlayerConst.CustomDisplaySize; ++i)
stmt.AddValue(index++, GetByteValue(PlayerFields.Bytes2, (byte)(
PlayerFieldOffsets.Bytes2OffsetCustomDisplayOption + i)));
stmt.AddValue(index++, GetInventorySlotCount());
stmt.AddValue(index++, GetBankBagSlotCount());
stmt.AddValue(index++, (byte)GetUInt32Value(PlayerFields.RestInfo + PlayerFieldOffsets.RestStateXp));
stmt.AddValue(index++, GetUInt32Value(PlayerFields.Flags));
@@ -3365,6 +3369,7 @@ namespace Game.Entities
stmt.AddValue(index++, GetPrestigeLevel());
stmt.AddValue(index++, (byte)GetUInt32Value(PlayerFields.RestInfo + PlayerFieldOffsets.RestStateHonor));
stmt.AddValue(index++, _restMgr.GetRestBonus(RestTypes.Honor));
stmt.AddValue(index++, Global.WorldMgr.GetRealm().Build);
// Index
stmt.AddValue(index, GetGUID().GetCounter());
+86 -23
View File
@@ -274,7 +274,8 @@ namespace Game.Entities
if (inventory)
{
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -326,7 +327,8 @@ namespace Game.Entities
if (inventory)
{
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -388,7 +390,8 @@ namespace Game.Entities
{
uint TotalCost = 0;
// equipped, backpack, bags itself
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; i++)
TotalCost += DurabilityRepair((ushort)((InventorySlots.Bag0 << 8) | i), cost, discountMod, guildBank);
// items in inventory bags
@@ -556,6 +559,7 @@ namespace Game.Entities
}
// not specific slot or have space for partly store only in specific slot
byte inventoryEnd = (byte)(InventorySlots.ItemStart + GetInventorySlotCount());
// in specific bag
if (bag != ItemConst.NullBag)
@@ -597,7 +601,7 @@ namespace Game.Entities
return InventoryResult.ItemMaxCount;
}
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, InventorySlots.ItemEnd, dest, pProto, ref count, true, pItem, bag, slot);
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, inventoryEnd, dest, pProto, ref count, true, pItem, bag, slot);
if (res != InventoryResult.Ok)
{
no_space_count = count + no_similar_count;
@@ -678,7 +682,7 @@ namespace Game.Entities
}
}
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, InventorySlots.ItemEnd, dest, pProto, ref count, false, pItem, bag, slot);
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, inventoryEnd, dest, pProto, ref count, false, pItem, bag, slot);
if (res != InventoryResult.Ok)
{
no_space_count = count + no_similar_count;
@@ -754,7 +758,7 @@ namespace Game.Entities
return InventoryResult.ItemMaxCount;
}
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, InventorySlots.ItemEnd, dest, pProto, ref count, true, pItem, bag, slot);
res = CanStoreItem_InInventorySlots(InventorySlots.ItemStart, inventoryEnd, dest, pProto, ref count, true, pItem, bag, slot);
if (res != InventoryResult.Ok)
{
no_space_count = count + no_similar_count;
@@ -917,7 +921,8 @@ namespace Game.Entities
uint[] inventoryCounts = new uint[InventorySlots.ItemEnd - InventorySlots.ItemStart];
uint[][] bagCounts = new uint[InventorySlots.BagEnd - InventorySlots.BagStart][];
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
item2 = GetItemByPos(InventorySlots.Bag0, i);
if (item2 && !item2.IsInTrade())
@@ -974,7 +979,7 @@ namespace Game.Entities
// search stack for merge to
if (pProto.GetMaxStackSize() != 1)
{
for (byte t = InventorySlots.ItemStart; t < InventorySlots.ItemEnd; ++t)
for (byte t = InventorySlots.ItemStart; t < inventoryEnd; ++t)
{
item2 = GetItemByPos(InventorySlots.Bag0, t);
if (item2 && item2.CanBeMergedPartlyWith(pProto) == InventoryResult.Ok && inventoryCounts[t - InventorySlots.ItemStart] + item.GetCount() <= pProto.GetMaxStackSize())
@@ -1043,7 +1048,7 @@ namespace Game.Entities
// search free slot
b_found = false;
for (int t = InventorySlots.ItemStart; t < InventorySlots.ItemEnd; ++t)
for (int t = InventorySlots.ItemStart; t < inventoryEnd; ++t)
{
if (inventoryCounts[t - InventorySlots.ItemStart] == 0)
{
@@ -1538,7 +1543,8 @@ namespace Game.Entities
}
}
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -2682,7 +2688,8 @@ namespace Game.Entities
}
public Item GetItemByGuid(ObjectGuid guid)
{
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -2744,7 +2751,8 @@ namespace Game.Entities
public uint GetItemCount(uint item, bool inBankAlso = false, Item skipItem = null)
{
uint count = 0;
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -2761,7 +2769,7 @@ namespace Game.Entities
if (skipItem != null && skipItem.GetTemplate().GetGemProperties() != 0)
{
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; ++i)
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -2874,7 +2882,8 @@ namespace Game.Entities
public Item GetItemByEntry(uint entry)
{
// in inventory
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -2919,7 +2928,8 @@ namespace Game.Entities
{
List<Item> itemList = new List<Item>();
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
{
Item item = GetItemByPos(InventorySlots.Bag0, i);
if (item != null)
@@ -2974,7 +2984,8 @@ namespace Game.Entities
public bool HasItemCount(uint item, uint count = 1, bool inBankAlso = false)
{
uint tempcount = 0;
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null && pItem.GetEntry() == item && !pItem.IsInTrade())
@@ -3083,7 +3094,7 @@ namespace Game.Entities
return true;
// backpack slots
if (slot >= InventorySlots.ItemStart && slot < InventorySlots.ItemEnd)
if (slot >= InventorySlots.ItemStart && slot < InventorySlots.ItemStart + GetInventorySlotCount())
return true;
// bank main slots
@@ -3115,7 +3126,8 @@ namespace Game.Entities
public Item GetChildItemByGuid(ObjectGuid guid)
{
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem)
@@ -3136,7 +3148,8 @@ namespace Game.Entities
uint GetItemCountWithLimitCategory(uint limitCategory, Item skipItem)
{
uint count = 0;
for (byte i = EquipmentSlot.Start; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem)
@@ -3220,7 +3233,8 @@ namespace Game.Entities
Log.outDebug(LogFilter.Player, "STORAGE: DestroyConjuredItems");
// in inventory
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem)
@@ -3260,7 +3274,8 @@ namespace Game.Entities
Log.outDebug(LogFilter.Player, "STORAGE: DestroyZoneLimitedItem in map {0} and area {1}", GetMapId(), new_zone);
// in inventory
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem)
@@ -3873,7 +3888,8 @@ namespace Game.Entities
public bool HasItemTotemCategory(uint TotemCategory)
{
for (byte i = EquipmentSlot.Start; i < EquipmentSlot.End; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = EquipmentSlot.Start; i < inventoryEnd; ++i)
{
Item item = GetUseableItemByPos(InventorySlots.Bag0, i);
if (item && Global.DB2Mgr.IsTotemCategoryCompatibleWith(item.GetTemplate().GetTotemCategory(), TotemCategory))
@@ -5701,7 +5717,8 @@ namespace Game.Entities
uint remcount = 0;
// in inventory
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
{
Item item = GetItemByPos(InventorySlots.Bag0, i);
if (item != null)
@@ -5973,6 +5990,52 @@ namespace Game.Entities
}
}
public byte GetInventorySlotCount() { return GetByteValue(PlayerFields.Bytes2, PlayerFieldOffsets.FieldBytes2OffsetNumBackpackSlots); }
public void SetInventorySlotCount(byte slots)
{
//ASSERT(slots <= (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START));
if (slots < GetInventorySlotCount())
{
List<Item> unstorableItems = new List<Item>();
for (byte slot = (byte)(InventorySlots.ItemStart + slots); slot < InventorySlots.ItemEnd; ++slot)
{
Item unstorableItem = GetItemByPos(InventorySlots.Bag0, slot);
if (unstorableItem)
unstorableItems.Add(unstorableItem);
}
if (!unstorableItems.Empty())
{
int fullBatches = unstorableItems.Count / SharedConst.MaxMailItems;
int remainder = unstorableItems.Count % SharedConst.MaxMailItems;
SQLTransaction trans = new SQLTransaction();
var sendItemsBatch = new Action<int, int>((batchNumber, batchSize) =>
{
MailDraft draft = new MailDraft(Global.ObjectMgr.GetCypherString(CypherStrings.NotEquippedItem), "There were problems with equipping item(s).");
for (int j = 0; j < batchSize; ++j)
draft.AddItem(unstorableItems[batchNumber * SharedConst.MaxMailItems + j]);
draft.SendMailTo(trans, this, new MailSender(this, MailStationery.Gm), MailCheckMask.Copied);
});
for (int batch = 0; batch < fullBatches; ++batch)
sendItemsBatch(batch, SharedConst.MaxMailItems);
if (remainder != 0)
sendItemsBatch(fullBatches, remainder);
DB.Characters.CommitTransaction(trans);
SendPacket(new CharacterInventoryOverflowWarning());
}
}
SetByteValue(PlayerFields.FieldBytes2, PlayerFieldOffsets.FieldBytes2OffsetNumBackpackSlots, slots);
}
public byte GetBankBagSlotCount() { return GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetBankBagSlots); }
public void SetBankBagSlotCount(byte count) { SetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetBankBagSlots, count); }
+8 -2
View File
@@ -211,7 +211,13 @@ namespace Game.Entities
return false;
}
public int GetQuestLevel(Quest quest) { return quest != null && (quest.Level > 0) ? quest.Level : (int)getLevel(); }
public uint GetQuestLevel(Quest quest)
{
if (quest == null)
return getLevel();
return (uint)(quest.Level > 0 ? quest.Level : Math.Min((int)getLevel(), quest.MaxScalingLevel));
}
public bool IsQuestRewarded(uint quest_id)
{
@@ -1372,7 +1378,7 @@ namespace Game.Entities
public bool SatisfyQuestRace(Quest qInfo, bool msg)
{
int reqraces = qInfo.AllowableRaces;
long reqraces = qInfo.AllowableRaces;
if (reqraces == -1)
return true;
+17 -19
View File
@@ -224,33 +224,30 @@ namespace Game.Entities
return GetUInt16Value(PlayerFields.SkillLineTempBonus + field, offset);
}
public uint GetResurrectionSpellId()
void InitializeSelfResurrectionSpells()
{
// search priceless resurrection possibilities
uint prio = 0;
uint spell_id = 0;
ClearDynamicValue(PlayerDynamicFields.SelfResSpells);
uint[] spells = new uint[3];
var dummyAuras = GetAuraEffectsByType(AuraType.Dummy);
foreach (var eff in dummyAuras)
foreach (var auraEffect in dummyAuras)
{
// Soulstone Resurrection // prio: 3 (max, non death persistent)
if (prio < 2 && eff.GetSpellInfo().SpellFamilyName == SpellFamilyNames.Warlock && eff.GetSpellInfo().SpellFamilyFlags[1].HasAnyFlag(0x1000000u))
{
spell_id = 3026;
prio = 3;
}
if (auraEffect.GetSpellInfo().SpellFamilyName == SpellFamilyNames.Warlock && auraEffect.GetSpellInfo().SpellFamilyFlags[1].HasAnyFlag(0x1000000u))
spells[0] = 3026;
// Twisting Nether // prio: 2 (max)
else if (eff.GetId() == 23701 && RandomHelper.randChance(10))
{
prio = 2;
spell_id = 23700;
}
else if (auraEffect.GetId() == 23701 && RandomHelper.randChance(10))
spells[1] = 23700;
}
// Reincarnation (passive spell) // prio: 1
if (prio < 1 && HasSpell(20608) && !GetSpellHistory().HasCooldown(21169))
spell_id = 21169;
if (HasSpell(20608) && !GetSpellHistory().HasCooldown(21169))
spells[2] = 21169;
return spell_id;
foreach (uint selfResSpell in spells)
if (selfResSpell != 0)
AddDynamicValue(PlayerDynamicFields.SelfResSpells, selfResSpell);
}
public void PetSpellInitialize()
@@ -1027,7 +1024,8 @@ namespace Game.Entities
// remove enchants from inventory items
// NOTE: no need to remove these from stats, since these aren't equipped
// in inventory
for (byte i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; ++i)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; ++i)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem)
+19 -23
View File
@@ -231,6 +231,7 @@ namespace Game.Entities
SetUInt32Value(PlayerFields.RestInfo + PlayerFieldOffsets.RestStateHonor, (uint)PlayerRestState.NotRAFLinked);
SetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetGender, (byte)createInfo.Sex);
SetByteValue(PlayerFields.Bytes4, PlayerFieldOffsets.Bytes4OffsetArenaFaction, 0);
SetInventorySlotCount(InventorySlots.DefaultSize);
SetGuidValue(ObjectFields.Data, ObjectGuid.Empty);
SetUInt32Value(PlayerFields.GuildRank, 0);
@@ -409,7 +410,8 @@ namespace Game.Entities
// bags and main-hand weapon must equipped at this moment
// now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon)
for (var i = InventorySlots.ItemStart; i < InventorySlots.ItemEnd; i++)
int inventoryEnd = InventorySlots.ItemStart + GetInventorySlotCount();
for (byte i = InventorySlots.ItemStart; i < inventoryEnd; i++)
{
Item pItem = GetItemByPos(InventorySlots.Bag0, i);
if (pItem != null)
@@ -744,13 +746,11 @@ namespace Game.Entities
public override void setDeathState(DeathState s)
{
uint ressSpellId = 0;
bool cur = IsAlive();
bool oldIsAlive = IsAlive();
if (s == DeathState.JustDied)
{
if (!cur)
if (!oldIsAlive)
{
Log.outError(LogFilter.Player, "Player.setDeathState: Attempted to kill a dead player '{0}' ({1})", GetName(), GetGUID().ToString());
return;
@@ -766,12 +766,8 @@ namespace Game.Entities
//FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
RemovePet(null, PetSaveMode.NotInSlot, true);
// save value before aura remove in Unit::setDeathState
ressSpellId = GetUInt32Value(PlayerFields.SelfResSpell);
InitializeSelfResurrectionSpells();
// passive spell
if (ressSpellId == 0)
ressSpellId = GetResurrectionSpellId();
UpdateCriteria(CriteriaTypes.DeathAtMap, 1);
UpdateCriteria(CriteriaTypes.Death, 1);
UpdateCriteria(CriteriaTypes.DeathInDungeon, 1);
@@ -782,13 +778,9 @@ namespace Game.Entities
base.setDeathState(s);
// restore resurrection spell id for player after aura remove
if (s == DeathState.JustDied && cur && ressSpellId != 0)
SetUInt32Value(PlayerFields.SelfResSpell, ressSpellId);
if (IsAlive() && !cur)
if (IsAlive() && !oldIsAlive)
//clear aura case after resurrection by another way (spells will be applied before next death)
SetUInt32Value(PlayerFields.SelfResSpell, 0);
ClearDynamicValue(PlayerDynamicFields.SelfResSpells);
}
public override void DestroyForPlayer(Player target)
@@ -1667,15 +1659,15 @@ namespace Game.Entities
continue;
if (quest.IsDaily())
rep = CalculateReputationGain(ReputationSource.DailyQuest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
rep = CalculateReputationGain(ReputationSource.DailyQuest, GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
else if (quest.IsWeekly())
rep = CalculateReputationGain(ReputationSource.WeeklyQuest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
rep = CalculateReputationGain(ReputationSource.WeeklyQuest, GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
else if (quest.IsMonthly())
rep = CalculateReputationGain(ReputationSource.MonthlyQuest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
rep = CalculateReputationGain(ReputationSource.MonthlyQuest, GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
else if (quest.IsRepeatable())
rep = CalculateReputationGain(ReputationSource.RepeatableQuest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
rep = CalculateReputationGain(ReputationSource.RepeatableQuest, GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
else
rep = CalculateReputationGain(ReputationSource.Quest, (uint)GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
rep = CalculateReputationGain(ReputationSource.Quest, GetQuestLevel(quest), rep, (int)quest.RewardFactionId[i], noQuestBonus);
bool noSpillover = Convert.ToBoolean(quest.RewardReputationMask & (1 << i));
GetReputationMgr().ModifyReputation(factionEntry, rep, noSpillover);
@@ -5003,11 +4995,13 @@ namespace Game.Entities
DisplayPlayerChoice displayPlayerChoice = new DisplayPlayerChoice();
displayPlayerChoice.SenderGUID = sender;
displayPlayerChoice.ChoiceID = choiceId;
displayPlayerChoice.UiTextureKitID = playerChoice.UiTextureKitId;
displayPlayerChoice.Question = playerChoice.Question;
if (playerChoiceLocale != null)
ObjectManager.GetLocaleString(playerChoiceLocale.Question, locale, ref displayPlayerChoice.Question);
displayPlayerChoice.CloseChoiceFrame = false;
displayPlayerChoice.HideWarboardHeader = playerChoice.HideWarboardHeader;
for (var i = 0; i < playerChoice.Responses.Count; ++i)
{
@@ -5900,7 +5894,9 @@ namespace Game.Entities
RemoveByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PvpFlag, (UnitBytes2Flags.FFAPvp | UnitBytes2Flags.Sanctuary));
// restore if need some important flags
SetUInt32Value(PlayerFields.FieldBytes2, 0); // flags empty by default
SetByteValue(PlayerFields.FieldBytes2, PlayerFieldOffsets.FieldBytes2OffsetIgnorePowerRegenPredictionMask, 0);
SetByteValue(PlayerFields.FieldBytes2, PlayerFieldOffsets.FieldBytes2OffsetAuraVision, 0);
SetByteValue(PlayerFields.FieldBytes2, 3, 0);
if (reapplyMods) // reapply stats values only on .reset stats (level) command
_ApplyAllStatBonuses();
@@ -6512,7 +6508,7 @@ namespace Game.Entities
packet.Reason = victim ? PlayerLogXPReason.Kill : PlayerLogXPReason.NoKill;
packet.Amount = (int)xp;
packet.GroupBonus = group_rate;
packet.ReferAFriend = recruitAFriend;
packet.ReferAFriendBonusType = (byte)(recruitAFriend ? 1 : 0);
SendPacket(packet);
uint curXP = GetUInt32Value(PlayerFields.Xp);