Core/Items: Implemented ItemLimitCategoryCondition.db2
This commit is contained in:
@@ -503,6 +503,10 @@ namespace Framework.Database
|
|||||||
PrepareStatement(HotfixStatements.SEL_ITEM_LIMIT_CATEGORY, "SELECT ID, Name, Quantity, Flags FROM item_limit_category ORDER BY ID DESC");
|
PrepareStatement(HotfixStatements.SEL_ITEM_LIMIT_CATEGORY, "SELECT ID, Name, Quantity, Flags FROM item_limit_category ORDER BY ID DESC");
|
||||||
PrepareStatement(HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_LOCALE, "SELECT ID, Name_lang FROM item_limit_category_locale WHERE locale = ?");
|
PrepareStatement(HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_LOCALE, "SELECT ID, Name_lang FROM item_limit_category_locale WHERE locale = ?");
|
||||||
|
|
||||||
|
// ItemLimitCategoryCondition.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_CONDITION, "SELECT ID, AddQuantity, PlayerConditionID, ParentItemLimitCategoryID " +
|
||||||
|
" FROM item_limit_category_condition ORDER BY ID DESC");
|
||||||
|
|
||||||
// ItemModifiedAppearance.db2
|
// ItemModifiedAppearance.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_ITEM_MODIFIED_APPEARANCE, "SELECT ItemID, ID, ItemAppearanceModifierID, ItemAppearanceID, OrderIndex, " +
|
PrepareStatement(HotfixStatements.SEL_ITEM_MODIFIED_APPEARANCE, "SELECT ItemID, ID, ItemAppearanceModifierID, ItemAppearanceID, OrderIndex, " +
|
||||||
"TransmogSourceTypeEnum FROM item_modified_appearance ORDER BY ID DESC");
|
"TransmogSourceTypeEnum FROM item_modified_appearance ORDER BY ID DESC");
|
||||||
@@ -1305,6 +1309,8 @@ namespace Framework.Database
|
|||||||
SEL_ITEM_LIMIT_CATEGORY,
|
SEL_ITEM_LIMIT_CATEGORY,
|
||||||
SEL_ITEM_LIMIT_CATEGORY_LOCALE,
|
SEL_ITEM_LIMIT_CATEGORY_LOCALE,
|
||||||
|
|
||||||
|
SEL_ITEM_LIMIT_CATEGORY_CONDITION,
|
||||||
|
|
||||||
SEL_ITEM_MODIFIED_APPEARANCE,
|
SEL_ITEM_MODIFIED_APPEARANCE,
|
||||||
|
|
||||||
SEL_ITEM_PRICE_BASE,
|
SEL_ITEM_PRICE_BASE,
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ namespace Game.DataStorage
|
|||||||
ItemLevelSelectorQualityStorage = DBReader.Read<ItemLevelSelectorQualityRecord>("ItemLevelSelectorQuality.db2", HotfixStatements.SEL_ITEM_LEVEL_SELECTOR_QUALITY);
|
ItemLevelSelectorQualityStorage = DBReader.Read<ItemLevelSelectorQualityRecord>("ItemLevelSelectorQuality.db2", HotfixStatements.SEL_ITEM_LEVEL_SELECTOR_QUALITY);
|
||||||
ItemLevelSelectorQualitySetStorage = DBReader.Read<ItemLevelSelectorQualitySetRecord>("ItemLevelSelectorQualitySet.db2", HotfixStatements.SEL_ITEM_LEVEL_SELECTOR_QUALITY_SET);
|
ItemLevelSelectorQualitySetStorage = DBReader.Read<ItemLevelSelectorQualitySetRecord>("ItemLevelSelectorQualitySet.db2", HotfixStatements.SEL_ITEM_LEVEL_SELECTOR_QUALITY_SET);
|
||||||
ItemLimitCategoryStorage = DBReader.Read<ItemLimitCategoryRecord>("ItemLimitCategory.db2", HotfixStatements.SEL_ITEM_LIMIT_CATEGORY, HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_LOCALE);
|
ItemLimitCategoryStorage = DBReader.Read<ItemLimitCategoryRecord>("ItemLimitCategory.db2", HotfixStatements.SEL_ITEM_LIMIT_CATEGORY, HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_LOCALE);
|
||||||
|
ItemLimitCategoryConditionStorage = DBReader.Read<ItemLimitCategoryConditionRecord>("ItemLimitCategoryCondition.db2", HotfixStatements.SEL_ITEM_LIMIT_CATEGORY_CONDITION);
|
||||||
ItemModifiedAppearanceStorage = DBReader.Read<ItemModifiedAppearanceRecord>("ItemModifiedAppearance.db2", HotfixStatements.SEL_ITEM_MODIFIED_APPEARANCE);
|
ItemModifiedAppearanceStorage = DBReader.Read<ItemModifiedAppearanceRecord>("ItemModifiedAppearance.db2", HotfixStatements.SEL_ITEM_MODIFIED_APPEARANCE);
|
||||||
ItemPriceBaseStorage = DBReader.Read<ItemPriceBaseRecord>("ItemPriceBase.db2", HotfixStatements.SEL_ITEM_PRICE_BASE);
|
ItemPriceBaseStorage = DBReader.Read<ItemPriceBaseRecord>("ItemPriceBase.db2", HotfixStatements.SEL_ITEM_PRICE_BASE);
|
||||||
ItemRandomPropertiesStorage = DBReader.Read<ItemRandomPropertiesRecord>("ItemRandomProperties.db2", HotfixStatements.SEL_ITEM_RANDOM_PROPERTIES, HotfixStatements.SEL_ITEM_RANDOM_PROPERTIES_LOCALE);
|
ItemRandomPropertiesStorage = DBReader.Read<ItemRandomPropertiesRecord>("ItemRandomProperties.db2", HotfixStatements.SEL_ITEM_RANDOM_PROPERTIES, HotfixStatements.SEL_ITEM_RANDOM_PROPERTIES_LOCALE);
|
||||||
@@ -476,6 +477,7 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<ItemLevelSelectorQualityRecord> ItemLevelSelectorQualityStorage;
|
public static DB6Storage<ItemLevelSelectorQualityRecord> ItemLevelSelectorQualityStorage;
|
||||||
public static DB6Storage<ItemLevelSelectorQualitySetRecord> ItemLevelSelectorQualitySetStorage;
|
public static DB6Storage<ItemLevelSelectorQualitySetRecord> ItemLevelSelectorQualitySetStorage;
|
||||||
public static DB6Storage<ItemLimitCategoryRecord> ItemLimitCategoryStorage;
|
public static DB6Storage<ItemLimitCategoryRecord> ItemLimitCategoryStorage;
|
||||||
|
public static DB6Storage<ItemLimitCategoryConditionRecord> ItemLimitCategoryConditionStorage;
|
||||||
public static DB6Storage<ItemModifiedAppearanceRecord> ItemModifiedAppearanceStorage;
|
public static DB6Storage<ItemModifiedAppearanceRecord> ItemModifiedAppearanceStorage;
|
||||||
public static DB6Storage<ItemPriceBaseRecord> ItemPriceBaseStorage;
|
public static DB6Storage<ItemPriceBaseRecord> ItemPriceBaseStorage;
|
||||||
public static DB6Storage<ItemRandomPropertiesRecord> ItemRandomPropertiesStorage;
|
public static DB6Storage<ItemRandomPropertiesRecord> ItemRandomPropertiesStorage;
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
CliDB.ItemCurrencyCostStorage.Clear();
|
CliDB.ItemCurrencyCostStorage.Clear();
|
||||||
|
|
||||||
|
foreach (ItemLimitCategoryConditionRecord condition in CliDB.ItemLimitCategoryConditionStorage.Values)
|
||||||
|
_itemCategoryConditions.Add((uint)condition.ParentItemLimitCategoryID, condition);
|
||||||
|
|
||||||
foreach (ItemLevelSelectorQualityRecord itemLevelSelectorQuality in CliDB.ItemLevelSelectorQualityStorage.Values)
|
foreach (ItemLevelSelectorQualityRecord itemLevelSelectorQuality in CliDB.ItemLevelSelectorQualityStorage.Values)
|
||||||
_itemLevelQualitySelectorQualities.Add(itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality);
|
_itemLevelQualitySelectorQualities.Add(itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality);
|
||||||
|
|
||||||
@@ -944,6 +947,11 @@ namespace Game.DataStorage
|
|||||||
return _itemClassByOldEnum[(int)itemClass];
|
return _itemClassByOldEnum[(int)itemClass];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ItemLimitCategoryConditionRecord> GetItemLimitCategoryConditions(uint categoryId)
|
||||||
|
{
|
||||||
|
return _itemCategoryConditions.LookupByKey(categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
public uint GetItemDisplayId(uint itemId, uint appearanceModId)
|
public uint GetItemDisplayId(uint itemId, uint appearanceModId)
|
||||||
{
|
{
|
||||||
ItemModifiedAppearanceRecord modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId);
|
ItemModifiedAppearanceRecord modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId);
|
||||||
@@ -1511,6 +1519,7 @@ namespace Game.DataStorage
|
|||||||
Dictionary<uint, ItemChildEquipmentRecord> _itemChildEquipment = new Dictionary<uint, ItemChildEquipmentRecord>();
|
Dictionary<uint, ItemChildEquipmentRecord> _itemChildEquipment = new Dictionary<uint, ItemChildEquipmentRecord>();
|
||||||
Array<ItemClassRecord> _itemClassByOldEnum = new Array<ItemClassRecord>(19);
|
Array<ItemClassRecord> _itemClassByOldEnum = new Array<ItemClassRecord>(19);
|
||||||
List<uint> _itemsWithCurrencyCost = new List<uint>();
|
List<uint> _itemsWithCurrencyCost = new List<uint>();
|
||||||
|
MultiMap<uint, ItemLimitCategoryConditionRecord> _itemCategoryConditions = new MultiMap<uint, ItemLimitCategoryConditionRecord>();
|
||||||
MultiMap<uint, ItemLevelSelectorQualityRecord> _itemLevelQualitySelectorQualities = new MultiMap<uint, ItemLevelSelectorQualityRecord>();
|
MultiMap<uint, ItemLevelSelectorQualityRecord> _itemLevelQualitySelectorQualities = new MultiMap<uint, ItemLevelSelectorQualityRecord>();
|
||||||
Dictionary<uint, ItemModifiedAppearanceRecord> _itemModifiedAppearancesByItem = new Dictionary<uint, ItemModifiedAppearanceRecord>();
|
Dictionary<uint, ItemModifiedAppearanceRecord> _itemModifiedAppearancesByItem = new Dictionary<uint, ItemModifiedAppearanceRecord>();
|
||||||
MultiMap<uint, uint> _itemToBonusTree = new MultiMap<uint, uint>();
|
MultiMap<uint, uint> _itemToBonusTree = new MultiMap<uint, uint>();
|
||||||
|
|||||||
@@ -233,6 +233,14 @@ namespace Game.DataStorage
|
|||||||
public byte Flags;
|
public byte Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class ItemLimitCategoryConditionRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public sbyte AddQuantity;
|
||||||
|
public uint PlayerConditionID;
|
||||||
|
public int ParentItemLimitCategoryID;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class ItemModifiedAppearanceRecord
|
public sealed class ItemModifiedAppearanceRecord
|
||||||
{
|
{
|
||||||
public uint ItemID;
|
public uint ItemID;
|
||||||
|
|||||||
@@ -1375,7 +1375,6 @@ namespace Game.Entities
|
|||||||
// check unique-equipped limit
|
// check unique-equipped limit
|
||||||
if (pProto.GetItemLimitCategory() != 0)
|
if (pProto.GetItemLimitCategory() != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemLimitCategoryRecord limitEntry = CliDB.ItemLimitCategoryStorage.LookupByKey(pProto.GetItemLimitCategory());
|
ItemLimitCategoryRecord limitEntry = CliDB.ItemLimitCategoryStorage.LookupByKey(pProto.GetItemLimitCategory());
|
||||||
if (limitEntry == null)
|
if (limitEntry == null)
|
||||||
{
|
{
|
||||||
@@ -1385,10 +1384,11 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (limitEntry.Flags == 0)
|
if (limitEntry.Flags == 0)
|
||||||
{
|
{
|
||||||
|
byte limitQuantity = GetItemLimitCategoryQuantity(limitEntry);
|
||||||
uint curcount = GetItemCountWithLimitCategory(pProto.GetItemLimitCategory(), pItem);
|
uint curcount = GetItemCountWithLimitCategory(pProto.GetItemLimitCategory(), pItem);
|
||||||
if (curcount + count > limitEntry.Quantity)
|
if (curcount + count > limitQuantity)
|
||||||
{
|
{
|
||||||
no_space_count = count + curcount - limitEntry.Quantity;
|
no_space_count = count + curcount - limitQuantity;
|
||||||
offendingItemId = pProto.GetId();
|
offendingItemId = pProto.GetId();
|
||||||
return InventoryResult.ItemMaxLimitCategoryCountExceededIs;
|
return InventoryResult.ItemMaxLimitCategoryCountExceededIs;
|
||||||
}
|
}
|
||||||
@@ -3221,6 +3221,20 @@ namespace Game.Entities
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
public byte GetItemLimitCategoryQuantity(ItemLimitCategoryRecord limitEntry)
|
||||||
|
{
|
||||||
|
byte limit = limitEntry.Quantity;
|
||||||
|
|
||||||
|
var limitConditions = Global.DB2Mgr.GetItemLimitCategoryConditions(limitEntry.Id);
|
||||||
|
foreach (ItemLimitCategoryConditionRecord limitCondition in limitConditions)
|
||||||
|
{
|
||||||
|
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(limitCondition.PlayerConditionID);
|
||||||
|
if (playerCondition == null || ConditionManager.IsPlayerMeetingCondition(this, playerCondition))
|
||||||
|
limit += (byte)limitCondition.AddQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
public void DestroyConjuredItems(bool update)
|
public void DestroyConjuredItems(bool update)
|
||||||
{
|
{
|
||||||
@@ -5340,14 +5354,15 @@ namespace Game.Entities
|
|||||||
return InventoryResult.NotEquippable;
|
return InventoryResult.NotEquippable;
|
||||||
|
|
||||||
// NOTE: limitEntry.mode not checked because if item have have-limit then it applied and to equip case
|
// NOTE: limitEntry.mode not checked because if item have have-limit then it applied and to equip case
|
||||||
|
byte limitQuantity = GetItemLimitCategoryQuantity(limitEntry);
|
||||||
|
|
||||||
if (limit_count > limitEntry.Quantity)
|
if (limit_count > limitQuantity)
|
||||||
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
|
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
|
||||||
|
|
||||||
// there is an equip limit on this item
|
// there is an equip limit on this item
|
||||||
if (HasItemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitEntry.Quantity - limit_count + 1, except_slot))
|
if (HasItemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitQuantity - limit_count + 1, except_slot))
|
||||||
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
|
return InventoryResult.ItemMaxLimitCategoryEquippedExceededIs;
|
||||||
else if (HasGemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitEntry.Quantity - limit_count + 1, except_slot))
|
else if (HasGemWithLimitCategoryEquipped(itemProto.GetItemLimitCategory(), limitQuantity - limit_count + 1, except_slot))
|
||||||
return InventoryResult.ItemMaxCountEquippedSocketed;
|
return InventoryResult.ItemMaxCountEquippedSocketed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -903,7 +903,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit_newcount > 0 && limit_newcount > limitEntry.Quantity)
|
if (limit_newcount > 0 && limit_newcount > _player.GetItemLimitCategoryQuantity(limitEntry))
|
||||||
{
|
{
|
||||||
GetPlayer().SendEquipError(InventoryResult.ItemUniqueEquippableSocketed, itemTarget);
|
GetPlayer().SendEquipError(InventoryResult.ItemUniqueEquippableSocketed, itemTarget);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
--
|
||||||
|
-- Table structure for table `item_limit_category_condition`
|
||||||
|
--
|
||||||
|
DROP TABLE IF EXISTS `item_limit_category_condition`;
|
||||||
|
CREATE TABLE `item_limit_category_condition` (
|
||||||
|
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`AddQuantity` tinyint(3) NOT NULL DEFAULT '0',
|
||||||
|
`PlayerConditionID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`ParentItemLimitCategoryID` int(10) NOT NULL DEFAULT '0',
|
||||||
|
`VerifiedBuild` smallint(6) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`ID`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
Reference in New Issue
Block a user