public void GivePrint(ItemDropManager manager, PlayerObj player) { if (Game.PlayerStats.TotalBlueprintsFound >= 75) { if (this.ChestType == 3) { this.GiveStatDrop(manager, player, 1, 0); return; } this.GiveGold(manager, 0); return; } else { List<byte[]> getBlueprintArray = Game.PlayerStats.GetBlueprintArray; List<Vector2> list = new List<Vector2>(); int num = 0; foreach (byte[] current in getBlueprintArray) { int num2 = 0; byte[] array = current; for (int i = 0; i < array.Length; i++) { if (array[i] == 0) { EquipmentData equipmentData = Game.EquipmentSystem.GetEquipmentData(num, num2); if (this.Level >= (int)equipmentData.LevelRequirement && this.ChestType >= equipmentData.ChestColourRequirement) { list.Add(new Vector2((float)num, (float)num2)); } } num2++; } num++; } if (list.Count > 0) { Vector2 vector = list[CDGMath.RandomInt(0, list.Count - 1)]; Game.PlayerStats.GetBlueprintArray[(int)vector.X][(int)vector.Y] = 1; List<object> list2 = new List<object>(); list2.Add(new Vector2(base.X, base.Y - (float)this.Height / 2f)); list2.Add(1); list2.Add(new Vector2(vector.X, vector.Y)); (player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(12, true, list2); player.RunGetItemAnimation(); Console.WriteLine(string.Concat(new object[] { "Unlocked item index ", vector.X, " of type ", vector.Y })); return; } this.GiveGold(manager, 0); return; } }
public void GiveStatDrop(ItemDropManager manager, PlayerObj player, int numDrops, int statDropType) { int[] array = new int[numDrops]; for (int i = 0; i < numDrops; i++) { if (statDropType == 0) { int num = CDGMath.RandomInt(1, 100); int num2 = 0; int j = 0; while (j < GameEV.STATDROP_CHANCE.Length) { num2 += GameEV.STATDROP_CHANCE[j]; if (num <= num2) { if (j == 0) { array[i] = 4; Game.PlayerStats.BonusStrength++; break; } if (j == 1) { array[i] = 5; Game.PlayerStats.BonusMagic++; break; } if (j == 2) { array[i] = 6; Game.PlayerStats.BonusDefense++; break; } if (j == 3) { array[i] = 7; Game.PlayerStats.BonusHealth++; break; } if (j == 4) { array[i] = 8; Game.PlayerStats.BonusMana++; break; } array[i] = 9; Game.PlayerStats.BonusWeight++; break; } else { j++; } } } else { switch (statDropType) { case 4: Game.PlayerStats.BonusStrength++; break; case 5: Game.PlayerStats.BonusMagic++; break; case 6: Game.PlayerStats.BonusDefense++; break; case 7: Game.PlayerStats.BonusHealth++; break; case 8: Game.PlayerStats.BonusMana++; break; case 9: Game.PlayerStats.BonusWeight++; break; } array[i] = statDropType; } } List<object> list = new List<object>(); list.Add(new Vector2(base.X, base.Y - (float)this.Height / 2f)); if (statDropType >= 15 && statDropType <= 19) { list.Add(7); } else if (numDrops <= 1) { list.Add(3); } else { list.Add(6); } list.Add(new Vector2((float)array[0], 0f)); if (numDrops > 1) { list.Add(new Vector2((float)array[1], (float)array[2])); } player.AttachedLevel.UpdatePlayerHUD(); (player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(12, true, list); player.RunGetItemAnimation(); }
public override void OpenChest(ItemDropManager itemDropManager, PlayerObj player) { if (this.State == 1 && !base.IsOpen && !base.IsLocked) { base.GoToFrame(2); SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Chest_Open_Large"); if (Game.PlayerStats.TotalRunesFound >= 55) { base.GiveStatDrop(itemDropManager, this.m_player, 1, 0); player.AttachedLevel.RefreshMapChestIcons(); return; } List<byte[]> getRuneArray = Game.PlayerStats.GetRuneArray; List<Vector2> list = new List<Vector2>(); int num = 0; foreach (byte[] current in getRuneArray) { int num2 = 0; byte[] array = current; for (int i = 0; i < array.Length; i++) { if (array[i] == 0) { list.Add(new Vector2((float)num, (float)num2)); } num2++; } num++; } if (list.Count > 0) { Vector2 vector = list[CDGMath.RandomInt(0, list.Count - 1)]; Game.PlayerStats.GetRuneArray[(int)vector.X][(int)vector.Y] = 1; List<object> list2 = new List<object>(); list2.Add(new Vector2(base.X, base.Y - (float)this.Height / 2f)); list2.Add(2); list2.Add(new Vector2(vector.X, vector.Y)); (player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(12, true, list2); player.RunGetItemAnimation(); Console.WriteLine(string.Concat(new object[] { "Unlocked item index ", vector.X, " of type ", vector.Y })); } else { base.GiveGold(itemDropManager, 0); } player.AttachedLevel.RefreshMapChestIcons(); } }