// 计算图鉴系统属性加成 public void UpdateTuJianProps(GameClient client) { if (client == null) { return; } if (client.ClientData.PictureJudgeReferInfo == null || client.ClientData.PictureJudgeReferInfo.Count == 0) { return; } // 统计每个图鉴Type激活了多少个Item Dictionary <int, int> activeItemByType = new Dictionary <int, int>(); // 计算图鉴总属性 _AttrValue totalAttrValue = new _AttrValue(); // 计算激活的图鉴Item加成 foreach (var kvp in client.ClientData.PictureJudgeReferInfo) { int itemID = kvp.Key; int itemReferCnt = kvp.Value; TuJianItem item = null; if (!TuJianItems.TryGetValue(itemID, out item)) { continue; } // 本item已激活 if (itemReferCnt >= item.CostGoodsCnt) { if (!activeItemByType.ContainsKey(item.TypeID)) { activeItemByType.Add(item.TypeID, 0); } activeItemByType[item.TypeID]++; totalAttrValue.Add(item.AttrValue); if (client.ClientData.ActivedTuJianItem != null && !client.ClientData.ActivedTuJianItem.Contains(itemID)) { client.ClientData.ActivedTuJianItem.Add(itemID); } } } // 计算图鉴Type加成(只有所有子item全部激活的图鉴type) foreach (var kvp in activeItemByType) { TuJianType type = null; if (!TuJianTypes.TryGetValue(kvp.Key, out type)) { continue; } // 本图鉴type全部激活 if (kvp.Value >= type.ItemCnt) { totalAttrValue.Add(type.AttrValue); if (client.ClientData.ActivedTuJianType != null && !client.ClientData.ActivedTuJianType.Contains(kvp.Key)) { client.ClientData.ActivedTuJianType.Add(kvp.Key); } } } client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MinAttack, totalAttrValue.MinAttack); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MaxAttack, totalAttrValue.MaxAttack); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MinMAttack, totalAttrValue.MinMAttack); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MaxMAttack, totalAttrValue.MaxMAttack); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MinDefense, totalAttrValue.MinDefense); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MaxDefense, totalAttrValue.MaxDefense); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MinMDefense, totalAttrValue.MinMDefense); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MaxMDefense, totalAttrValue.MaxMDefense); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.HitV, totalAttrValue.HitV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.MaxLifeV, totalAttrValue.MaxLifeV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.TuJian, (int)ExtPropIndexes.Dodge, totalAttrValue.Dodge); }
public void UpdateTuJianProps(GameClient client) { if (client != null) { if (client.ClientData.PictureJudgeReferInfo != null && client.ClientData.PictureJudgeReferInfo.Count != 0) { Dictionary <int, int> activeItemByType = new Dictionary <int, int>(); _AttrValue totalAttrValue = new _AttrValue(); foreach (KeyValuePair <int, int> kvp in client.ClientData.PictureJudgeReferInfo) { int itemID = kvp.Key; int itemReferCnt = kvp.Value; TuJianItem item = null; if (this.TuJianItems.TryGetValue(itemID, out item)) { if (itemReferCnt >= item.CostGoodsCnt) { if (!activeItemByType.ContainsKey(item.TypeID)) { activeItemByType.Add(item.TypeID, 0); } Dictionary <int, int> dictionary; int typeID; (dictionary = activeItemByType)[typeID = item.TypeID] = dictionary[typeID] + 1; totalAttrValue.Add(item.AttrValue); if (client.ClientData.ActivedTuJianItem != null && !client.ClientData.ActivedTuJianItem.Contains(itemID)) { client.ClientData.ActivedTuJianItem.Add(itemID); } } } } foreach (KeyValuePair <int, int> kvp in activeItemByType) { TuJianType type = null; if (this.TuJianTypes.TryGetValue(kvp.Key, out type)) { if (kvp.Value >= type.ItemCnt) { totalAttrValue.Add(type.AttrValue); if (client.ClientData.ActivedTuJianType != null && !client.ClientData.ActivedTuJianType.Contains(kvp.Key)) { client.ClientData.ActivedTuJianType.Add(kvp.Key); } } } } client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 7, totalAttrValue.MinAttack }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 8, totalAttrValue.MaxAttack }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 9, totalAttrValue.MinMAttack }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 10, totalAttrValue.MaxMAttack }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 3, totalAttrValue.MinDefense }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 4, totalAttrValue.MaxDefense }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 5, totalAttrValue.MinMDefense }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 6, totalAttrValue.MaxMDefense }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 18, totalAttrValue.HitV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 13, totalAttrValue.MaxLifeV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 12, 19, totalAttrValue.Dodge }); } } }