Example #1
0
        public void GiveGold(ItemDropManager itemDropManager, int amount = 0)
        {
            int num;

            if (ChestType == 1)
            {
                num = CDGMath.RandomInt((int)BronzeChestGoldRange.X, (int)BronzeChestGoldRange.Y) * 10;
            }
            else if (ChestType == 2 || ChestType == 4)
            {
                num = CDGMath.RandomInt((int)SilverChestGoldRange.X, (int)SilverChestGoldRange.Y) * 10;
            }
            else
            {
                num = CDGMath.RandomInt((int)GoldChestGoldRange.X, (int)GoldChestGoldRange.Y) * 10;
            }
            num += (int)Math.Floor(GoldIncreasePerLevel * Level * 10f);
            if (amount != 0)
            {
                num = amount;
            }
            var num2 = num / 500;

            num -= num2 * 500;
            var num3 = num / 100;

            num -= num3 * 100;
            var num4 = num / 10;
            var num5 = 0f;

            for (var i = 0; i < num2; i++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 11, 500);
                num5 += 0.1f;
            }
            num5 = 0f;
            for (var j = 0; j < num3; j++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 10, 100);
                num5 += 0.1f;
            }
            num5 = 0f;
            for (var k = 0; k < num4; k++)
            {
                Tween.To(this, num5, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem",
                                               new Vector2(Position.X, Position.Y - Height / 2), 1, 10);
                num5 += 0.1f;
            }
        }
Example #2
0
 public void GivePrint(ItemDropManager manager, PlayerObj player)
 {
     if (Game.PlayerStats.TotalBlueprintsFound >= 75)
     {
         if (ChestType == 3)
         {
             GiveStatDrop(manager, player, 1, 0);
             return;
         }
         GiveGold(manager);
     }
     else
     {
         var getBlueprintArray = Game.PlayerStats.GetBlueprintArray;
         var list = new List <Vector2>();
         var num  = 0;
         foreach (var current in getBlueprintArray)
         {
             var num2  = 0;
             var array = current;
             for (var i = 0; i < array.Length; i++)
             {
                 if (array[i] == 0)
                 {
                     var equipmentData = Game.EquipmentSystem.GetEquipmentData(num, num2);
                     if (Level >= equipmentData.LevelRequirement &&
                         ChestType >= equipmentData.ChestColourRequirement)
                     {
                         list.Add(new Vector2(num, num2));
                     }
                 }
                 num2++;
             }
             num++;
         }
         if (list.Count > 0)
         {
             var vector = list[CDGMath.RandomInt(0, list.Count - 1)];
             Game.PlayerStats.GetBlueprintArray[(int)vector.X][(int)vector.Y] = 1;
             var list2 = new List <object>();
             list2.Add(new Vector2(X, Y - 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("Unlocked item index ", vector.X, " of type ", vector.Y));
             return;
         }
         GiveGold(manager);
     }
 }
Example #3
0
 public override void OpenChest(ItemDropManager itemDropManager, PlayerObj player)
 {
     if (State == 1 && !IsOpen && !IsLocked)
     {
         GoToFrame(2);
         SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Chest_Open_Large");
         if (Game.PlayerStats.TotalRunesFound >= 55)
         {
             GiveStatDrop(itemDropManager, m_player, 1, 0);
             player.AttachedLevel.RefreshMapChestIcons();
             return;
         }
         var getRuneArray = Game.PlayerStats.GetRuneArray;
         var list         = new List <Vector2>();
         var num          = 0;
         foreach (var current in getRuneArray)
         {
             var num2  = 0;
             var array = current;
             for (var i = 0; i < array.Length; i++)
             {
                 if (array[i] == 0)
                 {
                     list.Add(new Vector2(num, num2));
                 }
                 num2++;
             }
             num++;
         }
         if (list.Count > 0)
         {
             var vector = list[CDGMath.RandomInt(0, list.Count - 1)];
             Game.PlayerStats.GetRuneArray[(int)vector.X][(int)vector.Y] = 1;
             var list2 = new List <object>();
             list2.Add(new Vector2(X, Y - 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("Unlocked item index ", vector.X, " of type ", vector.Y));
         }
         else
         {
             GiveGold(itemDropManager);
         }
         player.AttachedLevel.RefreshMapChestIcons();
     }
 }
Example #4
0
 public virtual void OpenChest(ItemDropManager itemDropManager, PlayerObj player)
 {
     if (!this.IsOpen && !this.IsLocked)
     {
         SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Chest_Open_Large");
         base.GoToFrame(2);
         if (this.IsEmpty)
         {
             return;
         }
         if (this.ChestType == 3)
         {
             GameUtil.UnlockAchievement("LOVE_OF_GOLD");
         }
         if (this.ForcedItemType == 0)
         {
             int num = CDGMath.RandomInt(1, 100);
             int num2 = 0;
             int[] array;
             if (this.ChestType == 1)
             {
                 array = GameEV.BRONZECHEST_ITEMDROP_CHANCE;
             }
             else if (this.ChestType == 2)
             {
                 array = GameEV.SILVERCHEST_ITEMDROP_CHANCE;
             }
             else
             {
                 array = GameEV.GOLDCHEST_ITEMDROP_CHANCE;
             }
             int num3 = 0;
             for (int i = 0; i < array.Length; i++)
             {
                 num3 += array[i];
                 if (num <= num3)
                 {
                     num2 = i;
                     break;
                 }
             }
             if (num2 == 0)
             {
                 this.GiveGold(itemDropManager, 0);
             }
             else if (num2 == 1)
             {
                 this.GiveStatDrop(itemDropManager, player, 1, 0);
             }
             else
             {
                 this.GivePrint(itemDropManager, player);
             }
         }
         else
         {
             switch (this.ForcedItemType)
             {
             case 1:
             case 10:
             case 11:
                 this.GiveGold(itemDropManager, (int)this.ForcedAmount);
                 break;
             case 4:
             case 5:
             case 6:
             case 7:
             case 8:
             case 9:
                 this.GiveStatDrop(itemDropManager, player, 1, this.ForcedItemType);
                 break;
             case 12:
             case 13:
                 this.GivePrint(itemDropManager, player);
                 break;
             case 14:
                 this.GiveStatDrop(itemDropManager, player, 3, 0);
                 break;
             case 15:
             case 16:
             case 17:
             case 18:
             case 19:
                 this.GiveStatDrop(itemDropManager, player, 1, this.ForcedItemType);
                 break;
             }
         }
         player.AttachedLevel.RefreshMapChestIcons();
     }
 }
Example #5
0
 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();
 }
Example #6
0
 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;
     }
 }
Example #7
0
 public void GiveGold(ItemDropManager itemDropManager, int amount = 0)
 {
     int num;
     if (this.ChestType == 1)
     {
         num = CDGMath.RandomInt((int)this.BronzeChestGoldRange.X, (int)this.BronzeChestGoldRange.Y) * 10;
     }
     else if (this.ChestType == 2 || this.ChestType == 4)
     {
         num = CDGMath.RandomInt((int)this.SilverChestGoldRange.X, (int)this.SilverChestGoldRange.Y) * 10;
     }
     else
     {
         num = CDGMath.RandomInt((int)this.GoldChestGoldRange.X, (int)this.GoldChestGoldRange.Y) * 10;
     }
     num += (int)Math.Floor((double)(this.GoldIncreasePerLevel * (float)this.Level * 10f));
     if (amount != 0)
     {
         num = amount;
     }
     int num2 = num / 500;
     num -= num2 * 500;
     int num3 = num / 100;
     num -= num3 * 100;
     int num4 = num / 10;
     float num5 = 0f;
     for (int i = 0; i < num2; i++)
     {
         Tween.To(this, num5, new Easing(Linear.EaseNone), new string[0]);
         Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem", new object[]
         {
             new Vector2(base.Position.X, base.Position.Y - (float)(this.Height / 2)),
             11,
             500
         });
         num5 += 0.1f;
     }
     num5 = 0f;
     for (int j = 0; j < num3; j++)
     {
         Tween.To(this, num5, new Easing(Linear.EaseNone), new string[0]);
         Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem", new object[]
         {
             new Vector2(base.Position.X, base.Position.Y - (float)(this.Height / 2)),
             10,
             100
         });
         num5 += 0.1f;
     }
     num5 = 0f;
     for (int k = 0; k < num4; k++)
     {
         Tween.To(this, num5, new Easing(Linear.EaseNone), new string[0]);
         Tween.AddEndHandlerToLastTween(itemDropManager, "DropItem", new object[]
         {
             new Vector2(base.Position.X, base.Position.Y - (float)(this.Height / 2)),
             1,
             10
         });
         num5 += 0.1f;
     }
 }
Example #8
0
 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();
     }
 }
Example #9
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         Console.WriteLine("Disposing Procedural Level Screen");
         Tween.StopAll(false);
         this.m_currentRoom = null;
         this.DisposeRTs();
         foreach (RoomObj current in this.m_roomList)
         {
             current.Dispose();
         }
         this.m_roomList.Clear();
         this.m_roomList = null;
         this.m_enemyStartPositions.Clear();
         this.m_enemyStartPositions = null;
         this.m_tempEnemyStartPositions.Clear();
         this.m_tempEnemyStartPositions = null;
         this.m_textManager.Dispose();
         this.m_textManager = null;
         this.m_physicsManager = null;
         this.m_projectileManager.Dispose();
         this.m_projectileManager = null;
         this.m_itemDropManager.Dispose();
         this.m_itemDropManager = null;
         this.m_currentRoom = null;
         this.m_miniMapDisplay.Dispose();
         this.m_miniMapDisplay = null;
         this.m_mapBG.Dispose();
         this.m_mapBG = null;
         this.m_inputMap.Dispose();
         this.m_inputMap = null;
         this.m_lastEnemyHit = null;
         this.m_playerHUD.Dispose();
         this.m_playerHUD = null;
         this.m_player = null;
         this.m_enemyHUD.Dispose();
         this.m_enemyHUD = null;
         this.m_impactEffectPool.Dispose();
         this.m_impactEffectPool = null;
         this.m_blackBorder1.Dispose();
         this.m_blackBorder1 = null;
         this.m_blackBorder2.Dispose();
         this.m_blackBorder2 = null;
         this.m_chestList.Clear();
         this.m_chestList = null;
         this.m_projectileIconPool.Dispose();
         this.m_projectileIconPool = null;
         this.m_objKilledPlayer = null;
         this.m_dungeonLight.Dispose();
         this.m_dungeonLight = null;
         this.m_traitAura.Dispose();
         this.m_traitAura = null;
         this.m_killedEnemyObjList.Clear();
         this.m_killedEnemyObjList = null;
         this.m_roomEnteringTitle.Dispose();
         this.m_roomEnteringTitle = null;
         this.m_roomTitle.Dispose();
         this.m_roomTitle = null;
         this.m_creditsText.Dispose();
         this.m_creditsText = null;
         this.m_creditsTitleText.Dispose();
         this.m_creditsTitleText = null;
         Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length);
         Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length);
         this.m_creditsTextTitleList = null;
         this.m_creditsTextList = null;
         this.m_filmGrain.Dispose();
         this.m_filmGrain = null;
         this.m_objectivePlate.Dispose();
         this.m_objectivePlate = null;
         this.m_objectivePlateTween = null;
         this.m_sky.Dispose();
         this.m_sky = null;
         this.m_whiteBG.Dispose();
         this.m_whiteBG = null;
         this.m_compassBG.Dispose();
         this.m_compassBG = null;
         this.m_compass.Dispose();
         this.m_compass = null;
         if (this.m_compassDoor != null)
         {
             this.m_compassDoor.Dispose();
         }
         this.m_compassDoor = null;
         this.m_castleBorderTexture.Dispose();
         this.m_gardenBorderTexture.Dispose();
         this.m_towerBorderTexture.Dispose();
         this.m_dungeonBorderTexture.Dispose();
         this.m_neoBorderTexture.Dispose();
         this.m_castleBorderTexture = null;
         this.m_gardenBorderTexture = null;
         this.m_towerBorderTexture = null;
         this.m_dungeonBorderTexture = null;
         this.DebugTextObj.Dispose();
         this.DebugTextObj = null;
         base.Dispose();
     }
 }
Example #10
0
 public override void LoadContent()
 {
     this.DebugTextObj = new TextObj(Game.JunicodeFont);
     this.DebugTextObj.FontSize = 26f;
     this.DebugTextObj.Align = Types.TextAlign.Centre;
     this.DebugTextObj.Text = "";
     this.DebugTextObj.ForceDraw = true;
     this.m_projectileIconPool = new ProjectileIconPool(200, this.m_projectileManager, base.ScreenManager as RCScreenManager);
     this.m_projectileIconPool.Initialize();
     this.m_textManager.Initialize();
     this.m_impactEffectPool.Initialize();
     this.m_physicsManager = (base.ScreenManager.Game as Game).PhysicsManager;
     this.m_physicsManager.SetGravity(0f, 1830f);
     this.m_projectileManager.Initialize();
     this.m_physicsManager.Initialize(base.ScreenManager.Camera);
     this.m_itemDropManager = new ItemDropManager(600, this.m_physicsManager);
     this.m_itemDropManager.Initialize();
     this.m_playerHUD = new PlayerHUDObj();
     this.m_playerHUD.SetPosition(new Vector2(20f, 40f));
     this.m_enemyHUD = new EnemyHUDObj();
     this.m_enemyHUD.Position = new Vector2((float)(660 - this.m_enemyHUD.Width / 2), 20f);
     this.m_miniMapDisplay.SetPlayer(this.m_player);
     this.m_miniMapDisplay.InitializeAlphaMap(new Rectangle(1070, 50, 200, 100), base.Camera);
     this.InitializeAllRooms(true);
     this.InitializeEnemies();
     this.InitializeChests(true);
     this.InitializeRenderTargets();
     this.m_mapBG = new SpriteObj("MinimapBG_Sprite");
     this.m_mapBG.Position = new Vector2(1070f, 50f);
     this.m_mapBG.ForceDraw = true;
     this.UpdateCamera();
     this.m_borderSize = 100;
     this.m_blackBorder1 = new SpriteObj("Blank_Sprite");
     this.m_blackBorder1.TextureColor = Color.Black;
     this.m_blackBorder1.Scale = new Vector2(1340f / (float)this.m_blackBorder1.Width, (float)(this.m_borderSize / this.m_blackBorder1.Height));
     this.m_blackBorder2 = new SpriteObj("Blank_Sprite");
     this.m_blackBorder2.TextureColor = Color.Black;
     this.m_blackBorder2.Scale = new Vector2(1340f / (float)this.m_blackBorder2.Width, (float)(this.m_borderSize / this.m_blackBorder2.Height));
     this.m_blackBorder1.ForceDraw = true;
     this.m_blackBorder2.ForceDraw = true;
     this.m_blackBorder1.Y = (float)(-(float)this.m_borderSize);
     this.m_blackBorder2.Y = 720f;
     this.m_dungeonLight = new SpriteObj("LightSource_Sprite");
     this.m_dungeonLight.ForceDraw = true;
     this.m_dungeonLight.Scale = new Vector2(12f, 12f);
     this.m_traitAura = new SpriteObj("LightSource_Sprite");
     this.m_traitAura.ForceDraw = true;
     this.m_objectivePlate = new ObjContainer("DialogBox_Character");
     this.m_objectivePlate.ForceDraw = true;
     TextObj textObj = new TextObj(Game.JunicodeFont);
     textObj.Position = new Vector2(-400f, -60f);
     textObj.OverrideParentScale = true;
     textObj.FontSize = 10f;
     textObj.Text = "Fairy Chest Objective:";
     textObj.TextureColor = Color.Red;
     textObj.OutlineWidth = 2;
     this.m_objectivePlate.AddChild(textObj);
     TextObj textObj2 = new TextObj(Game.JunicodeFont);
     textObj2.OverrideParentScale = true;
     textObj2.Position = new Vector2(textObj.X, textObj.Y + 40f);
     textObj2.ForceDraw = true;
     textObj2.FontSize = 9f;
     textObj2.Text = "Reach the chest in 15 seconds:";
     textObj2.WordWrap(250);
     textObj2.OutlineWidth = 2;
     this.m_objectivePlate.AddChild(textObj2);
     TextObj textObj3 = new TextObj(Game.JunicodeFont);
     textObj3.OverrideParentScale = true;
     textObj3.Position = new Vector2(textObj2.X, textObj2.Y + 35f);
     textObj3.ForceDraw = true;
     textObj3.FontSize = 9f;
     textObj3.Text = "Time Remaining:";
     textObj3.WordWrap(250);
     textObj3.OutlineWidth = 2;
     this.m_objectivePlate.AddChild(textObj3);
     this.m_objectivePlate.Scale = new Vector2(250f / (float)this.m_objectivePlate.GetChildAt(0).Width, 130f / (float)this.m_objectivePlate.GetChildAt(0).Height);
     this.m_objectivePlate.Position = new Vector2(1470f, 250f);
     SpriteObj spriteObj = new SpriteObj("Blank_Sprite");
     spriteObj.TextureColor = Color.Red;
     spriteObj.Position = new Vector2(textObj2.X, textObj2.Y + 20f);
     spriteObj.ForceDraw = true;
     spriteObj.OverrideParentScale = true;
     spriteObj.ScaleY = 0.5f;
     this.m_objectivePlate.AddChild(spriteObj);
     SpriteObj spriteObj2 = new SpriteObj("Blank_Sprite");
     spriteObj2.TextureColor = Color.Red;
     spriteObj2.Position = new Vector2(textObj2.X, spriteObj.Y + 35f);
     spriteObj2.ForceDraw = true;
     spriteObj2.OverrideParentScale = true;
     spriteObj2.ScaleY = 0.5f;
     this.m_objectivePlate.AddChild(spriteObj2);
     base.LoadContent();
     this.m_sky = new SkyObj(this);
     this.m_sky.LoadContent(base.Camera);
     this.m_whiteBG = new SpriteObj("Blank_Sprite");
     this.m_whiteBG.Opacity = 0f;
     this.m_whiteBG.Scale = new Vector2(1320f / (float)this.m_whiteBG.Width, 720f / (float)this.m_whiteBG.Height);
     this.m_filmGrain = new SpriteObj("FilmGrain_Sprite");
     this.m_filmGrain.ForceDraw = true;
     this.m_filmGrain.Scale = new Vector2(2.015f, 2.05f);
     this.m_filmGrain.X -= 5f;
     this.m_filmGrain.Y -= 5f;
     this.m_filmGrain.PlayAnimation(true);
     this.m_filmGrain.AnimationDelay = 0.0333333351f;
     this.m_compassBG = new SpriteObj("CompassBG_Sprite");
     this.m_compassBG.ForceDraw = true;
     this.m_compassBG.Position = new Vector2(660f, 90f);
     this.m_compassBG.Scale = Vector2.Zero;
     this.m_compass = new SpriteObj("Compass_Sprite");
     this.m_compass.Position = this.m_compassBG.Position;
     this.m_compass.ForceDraw = true;
     this.m_compass.Scale = Vector2.Zero;
     this.InitializeCreditsText();
 }
Example #11
0
        public virtual void OpenChest(ItemDropManager itemDropManager, PlayerObj player)
        {
            if (!IsOpen && !IsLocked)
            {
                SoundManager.Play3DSound(this, Game.ScreenManager.Player, "Chest_Open_Large");
                GoToFrame(2);
                if (IsEmpty)
                {
                    return;
                }
                if (ChestType == 3)
                {
                    GameUtil.UnlockAchievement("LOVE_OF_GOLD");
                }
                if (ForcedItemType == 0)
                {
                    var   num  = CDGMath.RandomInt(1, 100);
                    var   num2 = 0;
                    int[] array;
                    if (ChestType == 1)
                    {
                        array = GameEV.BRONZECHEST_ITEMDROP_CHANCE;
                    }
                    else if (ChestType == 2)
                    {
                        array = GameEV.SILVERCHEST_ITEMDROP_CHANCE;
                    }
                    else
                    {
                        array = GameEV.GOLDCHEST_ITEMDROP_CHANCE;
                    }
                    var num3 = 0;
                    for (var i = 0; i < array.Length; i++)
                    {
                        num3 += array[i];
                        if (num <= num3)
                        {
                            num2 = i;
                            break;
                        }
                    }
                    if (num2 == 0)
                    {
                        GiveGold(itemDropManager);
                    }
                    else if (num2 == 1)
                    {
                        GiveStatDrop(itemDropManager, player, 1, 0);
                    }
                    else
                    {
                        GivePrint(itemDropManager, player);
                    }
                }
                else
                {
                    switch (ForcedItemType)
                    {
                    case 1:
                    case 10:
                    case 11:
                        GiveGold(itemDropManager, (int)ForcedAmount);
                        break;

                    case 4:
                    case 5:
                    case 6:
                    case 7:
                    case 8:
                    case 9:
                        GiveStatDrop(itemDropManager, player, 1, ForcedItemType);
                        break;

                    case 12:
                    case 13:
                        GivePrint(itemDropManager, player);
                        break;

                    case 14:
                        GiveStatDrop(itemDropManager, player, 3, 0);
                        break;

                    case 15:
                    case 16:
                    case 17:
                    case 18:
                    case 19:
                        GiveStatDrop(itemDropManager, player, 1, ForcedItemType);
                        break;
                    }
                }
                player.AttachedLevel.RefreshMapChestIcons();
            }
        }
Example #12
0
        public void GiveStatDrop(ItemDropManager manager, PlayerObj player, int numDrops, int statDropType)
        {
            var array = new int[numDrops];

            for (var i = 0; i < numDrops; i++)
            {
                if (statDropType == 0)
                {
                    var num  = CDGMath.RandomInt(1, 100);
                    var num2 = 0;
                    var 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;
                        }
                        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;
                }
            }
            var list = new List <object>();

            list.Add(new Vector2(X, Y - 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(array[0], 0f));
            if (numDrops > 1)
            {
                list.Add(new Vector2(array[1], array[2]));
            }
            player.AttachedLevel.UpdatePlayerHUD();
            (player.AttachedLevel.ScreenManager as RCScreenManager).DisplayScreen(12, true, list);
            player.RunGetItemAnimation();
        }