Updated DB2 structs

This commit is contained in:
hondacrx
2018-02-26 13:13:54 -05:00
parent 0a3dfaba37
commit 82dca6de94
61 changed files with 2639 additions and 2517 deletions
+25 -5
View File
@@ -812,6 +812,11 @@ namespace Game.Groups
startLootRoll.Method = GetLootMethod();
r.FillPacket(startLootRoll.Item);
ItemDisenchantLootRecord disenchant = r.GetItemDisenchantLoot(p);
if (disenchant != null)
if (m_maxEnchantingLevel >= disenchant.RequiredDisenchantSkill)
startLootRoll.ValidRolls |= RollMask.Disenchant;
p.SendPacket(startLootRoll);
}
@@ -950,8 +955,6 @@ namespace Game.Groups
{
r.setLoot(loot);
r.itemSlot = itemSlot;
if (item.DisenchantID != 0 && m_maxEnchantingLevel >= item.RequiredDisenchantSkill)
r.rollTypeMask |= RollMask.Disenchant;
if (item.GetFlags2().HasAnyFlag(ItemFlags2.CanOnlyRollGreed))
r.rollTypeMask &= ~RollMask.Need;
@@ -1236,17 +1239,18 @@ namespace Game.Groups
item.is_looted = true;
roll.getLoot().NotifyItemRemoved(roll.itemSlot);
roll.getLoot().unlootedCount--;
ItemTemplate pProto = Global.ObjectMgr.GetItemTemplate(roll.itemid);
player.UpdateCriteria(CriteriaTypes.CastSpell, 13262); // Disenchant
ItemDisenchantLootRecord disenchant = roll.GetItemDisenchantLoot(player);
List<ItemPosCount> dest = new List<ItemPosCount>();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, roll.itemid, item.count);
if (msg == InventoryResult.Ok)
player.AutoStoreLoot(pProto.DisenchantID, LootStorage.Disenchant, true);
player.AutoStoreLoot(disenchant.Id, LootStorage.Disenchant, true);
else // If the player's inventory is full, send the disenchant result in a mail.
{
Loot loot = new Loot();
loot.FillLoot(pProto.DisenchantID, LootStorage.Disenchant, player, true);
loot.FillLoot(disenchant.Id, LootStorage.Disenchant, player, true);
uint max_slot = loot.GetMaxSlotInLootFor(player);
for (uint i = 0; i < max_slot; ++i)
@@ -2620,6 +2624,22 @@ namespace Game.Groups
}
}
public ItemDisenchantLootRecord GetItemDisenchantLoot(Player player)
{
LootItem lootItemInSlot = getTarget().GetItemInSlot(itemSlot);
if (lootItemInSlot != null)
{
ItemInstance itemInstance = new ItemInstance(lootItemInSlot);
BonusData bonusData = new BonusData(itemInstance);
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemid);
uint itemLevel = Item.GetItemLevel(itemTemplate, bonusData, player.getLevel(), 0, lootItemInSlot.upgradeId);
return Item.GetDisenchantLoot(itemTemplate, (uint)bonusData.Quality, itemLevel);
}
return null;
}
public uint itemid;
public ItemRandomEnchantmentId itemRandomPropId;
public uint itemRandomSuffix;