/** 通过创建物品配置创建物品(可能为空) */ public ItemData createItemByCreateID(int createID) { if (createID <= 0) { return(null); } CreateItemConfig createConfig = CreateItemConfig.get(createID); ItemData data = createItem(createConfig.itemID, 1); data.isBind = createConfig.isBind; makeItemDataByCreateConfig(data, createConfig); return(data); }
/// <summary> /// 读完所有表后处理 /// </summary> public static void afterReadConfigAll() { if (_dic == null) { return; } RandomItemConfig[] values; RandomItemConfig v; for (int i = (values = _dic.getValues()).Length - 1; i >= 0; --i) { if ((v = values[i]) != null) { switch (v.type) { case RandomItemType.Single: { int itemID = v.args[0][0]; if (itemID > 0 && ItemConfig.get(itemID) == null) { Ctrl.throwError("找不到物品ID", itemID); return; } } break; case RandomItemType.AverageItem: { foreach (int[] v2 in v.args) { if (v2[0] > 0 && ItemConfig.get(v2[0]) == null) { Ctrl.throwError("找不到物品ID", v2[0]); return; } } } break; case RandomItemType.WeightItem: { foreach (int[] v2 in v.args) { if (v2[1] > 0 && ItemConfig.get(v2[1]) == null) { Ctrl.throwError("找不到物品ID", v2[1]); return; } } } break; case RandomItemType.WeightCreateItem: { foreach (int[] v2 in v.args) { if (v2[1] > 0 && CreateItemConfig.get(v2[1]) == null) { Ctrl.throwError("找不到创建物品ID", v2[1]); return; } } } break; case RandomItemType.WeightRandomItem: { foreach (int[] v2 in v.args) { if (v2[1] > 0 && RandomItemConfig.get(v2[1]) == null) { Ctrl.throwError("找不到随机物品ID", v2[1]); return; } } } break; } } } }
/** 进一步构造物品 */ protected void makeItemDataByCreateConfig(ItemData data, CreateItemConfig config) { }