void GenerateLegacyItems(item_template item) { item_legacy_data d = new item_legacy_data(); d.Prototype = item.entry; d.Comment = item.name; item_template n1 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n1, EntityState.Added); n1.entry = WorldWorker.GenerateNextItemEntry(); n1.Flags |= 8; d.Rank1 = n1.entry; item_upgrade_data u1 = GetUpgradeData(item, item.entry, n1.entry, 1); WorldWorker.SaveItemTemplate(n1); WorldWorker.SaveItemUpgradeData(u1); item_template n2 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n2, EntityState.Added); n2.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n2, Math.Pow(1.15, 1)); d.Rank2 = n2.entry; item_upgrade_data u2 = GetUpgradeData(item, n1.entry, n2.entry, 2); WorldWorker.SaveItemTemplate(n2); WorldWorker.SaveItemUpgradeData(u2); item_template n3 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n3, EntityState.Added); n3.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n3, Math.Pow(1.15, 2)); d.Rank3 = n3.entry; item_upgrade_data u3 = GetUpgradeData(item, n2.entry, n3.entry, 3); WorldWorker.SaveItemTemplate(n3); WorldWorker.SaveItemUpgradeData(u3); item_template n4 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n4, EntityState.Added); n4.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n4, Math.Pow(1.15, 3)); d.Rank4 = n4.entry; item_upgrade_data u4 = GetUpgradeData(item, n3.entry, n4.entry, 4); WorldWorker.SaveItemTemplate(n4); WorldWorker.SaveItemUpgradeData(u4); item_template n5 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n5, EntityState.Added); n5.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n5, Math.Pow(1.15, 4)); d.Rank5 = n5.entry; item_upgrade_data u5 = GetUpgradeData(item, n4.entry, n5.entry, 5); WorldWorker.SaveItemTemplate(n5); WorldWorker.SaveItemUpgradeData(u5); item_template n6 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n6, EntityState.Added); n6.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n6, Math.Pow(1.15, 5)); d.Rank6 = n6.entry; item_upgrade_data u6 = GetUpgradeData(item, n5.entry, n6.entry, 6); WorldWorker.SaveItemTemplate(n6); WorldWorker.SaveItemUpgradeData(u6); item_template n7 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n7, EntityState.Added); n7.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n7, Math.Pow(1.15, 6)); d.Rank7 = n7.entry; item_upgrade_data u7 = GetUpgradeData(item, n6.entry, n7.entry, 7); WorldWorker.SaveItemTemplate(n7); WorldWorker.SaveItemUpgradeData(u7); item_template n8 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n8, EntityState.Added); n8.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n8, Math.Pow(1.15, 7)); d.Rank8 = n8.entry; item_upgrade_data u8 = GetUpgradeData(item, n7.entry, n8.entry, 8); WorldWorker.SaveItemTemplate(n8); WorldWorker.SaveItemUpgradeData(u8); item_template n9 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n9, EntityState.Added); n9.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n9, Math.Pow(1.15, 8)); d.Rank9 = n9.entry; item_upgrade_data u9 = GetUpgradeData(item, n8.entry, n9.entry, 9); WorldWorker.SaveItemTemplate(n9); WorldWorker.SaveItemUpgradeData(u9); item_template n10 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n10, EntityState.Added); n10.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n10, Math.Pow(1.15, 9)); d.Rank10 = n10.entry; item_upgrade_data u10 = GetUpgradeData(item, n9.entry, n10.entry, 10); WorldWorker.SaveItemTemplate(n10); WorldWorker.SaveItemUpgradeData(u10); item_template n11 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n11, EntityState.Added); n11.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n11, Math.Pow(1.15, 10)); d.Rank11 = n11.entry; item_upgrade_data u11 = GetUpgradeData(item, n10.entry, n11.entry, 11); WorldWorker.SaveItemTemplate(n11); WorldWorker.SaveItemUpgradeData(u11); item_template n12 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n12, EntityState.Added); n12.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n12, Math.Pow(1.15, 11)); d.Rank12 = n12.entry; item_upgrade_data u12 = GetUpgradeData(item, n11.entry, n12.entry, 12); WorldWorker.SaveItemTemplate(n12); WorldWorker.SaveItemUpgradeData(u12); item_template n13 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n13, EntityState.Added); n13.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n13, Math.Pow(1.15, 12)); d.Rank13 = n13.entry; item_upgrade_data u13 = GetUpgradeData(item, n12.entry, n13.entry, 13); WorldWorker.SaveItemTemplate(n13); WorldWorker.SaveItemUpgradeData(u13); item_template n14 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n14, EntityState.Added); n14.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n14, Math.Pow(1.15, 13)); d.Rank14 = n14.entry; item_upgrade_data u14 = GetUpgradeData(item, n13.entry, n14.entry, 14); WorldWorker.SaveItemTemplate(n14); WorldWorker.SaveItemUpgradeData(u14); item_template n15 = WorldWorker.GetItemTemplate(item.entry); WorldWorker.SetEntityState(n15, EntityState.Added); n15.entry = WorldWorker.GenerateNextItemEntry(); ModItemWithFactor(n15, Math.Pow(1.15, 14)); d.Rank15 = n15.entry; item_upgrade_data u15 = GetUpgradeData(item, n14.entry, n15.entry, 15); WorldWorker.SaveItemTemplate(n15); WorldWorker.SaveItemUpgradeData(u15); WorldWorker.SaveItemLegacyData(d); }
public static void SaveItemLegacyData(item_legacy_data data) { DB.LEGACY.item_legacy_data.Add(data); DB.LEGACY.SaveChanges(); DB.Refresh(); }