public void postDeserializeInitialization() { if (this.isDebugItemInstance()) { GameLogic.Item item = new GameLogic.Item(); item.Id = "DEBUG_ITEM_INSTANCE_ID"; item.Rarity = 0; item.Type = ItemType.Weapon; item.SpriteId = "sprite_weapon001"; item.Name = "Longsword"; item.postDeserializeInitialization(); this.Item = item; } else { this.Item = GameLogic.Binder.ItemResources.getResource(this.ItemId); if (this.Item == null) { Debug.LogError("Item not found: " + this.ItemId); } } if (string.IsNullOrEmpty(this.DropVersion)) { this.DropVersion = ConfigApp.BundleVersion; } }
public static ItemInstance Create(GameLogic.Item item, Player player, [Optional, DefaultParameterValue(-1)] int startRank) { int num; if (startRank > -1) { num = startRank; } else { bool flag; num = Mathf.Clamp((player.ActiveCharacter.getHighestItemLevelPlusRankEquippedOrInInventory(item.Type, out flag) + UnityEngine.Random.Range(ConfigMeta.ITEM_START_RANK_OFFSET_MIN, ConfigMeta.ITEM_START_RANK_OFFSET_MAX + 1)) - 1, 0, 0x7fffffff); } return(new ItemInstance(item.Id, 1, num, App.Binder.ConfigMeta.ItemUnlockFloor(player.getLastCompletedFloor(false) + 1), player)); }
public ItemInstance(string itemId, int level, int rank, int unlockFloor, Player player) { this.ItemId = string.Empty; this.Perks = new PerkContainer(); this.DropVersion = string.Empty; this.ItemId = itemId; this.Level = level; this.Rank = rank; this.UnlockFloor = unlockFloor; this.DropVersion = ConfigApp.BundleVersion; GameLogic.Item item = GameLogic.Binder.ItemResources.getResource(this.ItemId); ItemType itemType = item.Type; int rarity = item.Rarity; int num2 = ConfigPerks.NUM_RANDOM_PERKS_PER_ITEM_RARITY[rarity]; for (int i = 0; i < num2; i++) { this.Perks.PerkInstances.Add(ConfigPerks.RollNewRandomItemPerkInstance(itemType, this.Perks, player)); } this.postDeserializeInitialization(); }