/// <summary> /// Finishes the item setup, adds it to the item databases, adds an encounter trackable /// blah, blah, blah /// </summary> public static void SetupItem(PickupObject item, string shortDesc, string longDesc, string idPool) { try { item.encounterTrackable = null; ETGMod.Databases.Items.SetupItem(item, item.name); SpriteBuilder.AddToAmmonomicon(item.sprite.GetCurrentSpriteDef()); item.encounterTrackable.journalData.AmmonomiconSprite = item.sprite.GetCurrentSpriteDef().name; item.SetName(item.name); item.SetShortDescription(shortDesc); item.SetLongDescription(longDesc); if (item is PlayerItem) { (item as PlayerItem).consumable = false; } Gungeon.Game.Items.Add(idPool + ":" + item.name.ToLower().Replace(" ", "_"), item); ETGMod.Databases.Items.Add(item); } catch (Exception e) { ETGModConsole.Log(e.Message); ETGModConsole.Log(e.StackTrace); } }
//FIXME NewGun<> causing issues (MonoMod) /* * public Gun NewGun<T>(string gunName, string gunNameShort = null) where T : GunBehaviour { * Gun gun = NewGun(gunName, gunNameShort); * gun.gameObject.AddComponent<T>(); * return gun; * } * public Gun NewGun<T>(string gunName, Gun baseGun, string gunNameShort = null) where T : GunBehaviour { * Gun gun = NewGun(gunName, baseGun, gunNameShort); * gun.gameObject.AddComponent<T>(); * return gun; * } */ public void SetupItem(PickupObject item, string name) { if (item.encounterTrackable == null) { item.encounterTrackable = item.gameObject.AddComponent <EncounterTrackable>(); } if (item.encounterTrackable.journalData == null) { item.encounterTrackable.journalData = new JournalEntry(); } item.encounterTrackable.EncounterGuid = item.name; item.encounterTrackable.prerequisites = new DungeonPrerequisite[0]; item.encounterTrackable.journalData.SuppressKnownState = true; string keyName = "#" + item.name.Replace(" ", "").ToUpperInvariant(); item.encounterTrackable.journalData.PrimaryDisplayName = keyName + "_ENCNAME"; item.encounterTrackable.journalData.NotificationPanelDescription = keyName + "_SHORTDESC"; item.encounterTrackable.journalData.AmmonomiconFullEntry = keyName + "_LONGDESC"; item.encounterTrackable.journalData.AmmonomiconSprite = item.name.Replace(' ', '_') + "_idle_001"; item.SetName(name); }