public static Models.ItemSet Load(Models.ItemSet set, GomObjectData obj) { if (obj == null) { return(set); } if (set == null) { return(null); } set.Id = (ulong)obj.ValueOrDefault <long>("itmSetBonusDisplayName", 0); set.NameId = (int)obj.ValueOrDefault <long>("itmSetBonusDisplayName", 0); set.Name = strTable.GetText(NameOffset + set.NameId, "ItemSet." + set.Id); set.Count = (int)obj.ValueOrDefault <long>("itmSetBonusItemCount", 0); Dictionary <object, object> setItems = obj.ValueOrDefault <Dictionary <object, object> >("itmSetBonusSetItems", null); set.SetItems = new List <ItemSetItem>(); foreach (var itm_itm in setItems) { ulong itmId = (ulong)itm_itm.Key; ulong primaryItemId = (ulong)itm_itm.Value; var itm = ItemLoader.Load(itmId); var pItm = ItemLoader.Load(primaryItemId); var setItm = new ItemSetItem(); setItm.Item = itm; setItm.PrimaryItem = pItm; setItm.ItemSet = set; set.SetItems.Add(setItm); } //List<object> primaryItems = obj.itmSetBonusPrimaryItems; //set.PrimaryItems = new List<Item>(); //foreach (ulong itemNodeId in primaryItems) //{ // var itm = ItemLoader.Load(itemNodeId); // set.PrimaryItems.Add(itm); //} Dictionary <object, object> bonusAbilities = obj.ValueOrDefault <Dictionary <object, object> >("itmSetBonusBonuses", null); set.Abilities = new List <ItemSetAbility>(); foreach (var cnt_abl in bonusAbilities) { int cnt = (int)(long)cnt_abl.Key; ulong ablNodeId = (ulong)cnt_abl.Value; var abl = AbilityLoader.Load(ablNodeId); ItemSetAbility setAbl = new ItemSetAbility(); setAbl.Ability = abl; setAbl.ItemCount = cnt; setAbl.ItemSet = set; set.Abilities.Add(setAbl); } return(set); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Conventions.Remove <OneToManyCascadeDeleteConvention>(); Effect.OnModelCreating(modelBuilder); ItemFormula.OnModelCreating(modelBuilder); ItemSetItem.OnModelCreating(modelBuilder); }