Author: Not specified Language: csharp
Description: Not specified Timestamp: 2018-01-25 15:15:38 +0000
View raw paste Reply
  1. using System;
  2. using System.Linq;
  3. using Terraria;
  4. using Terraria.DataStructures;
  5. using Terraria.ModLoader;
  6. using Terraria.ID;
  7.  
  8. namespace CritSounds
  9. {
  10.  
  11. public static class ProjTypeContainer
  12. {
  13.         public const int TypeArrow = 1;
  14.         public const int TypeThrowable = 2;
  15.         public const int TypeSpell = 3;
  16.         public const int TypeBullet = 4;
  17.         public const int TypeMelee = 5;
  18.         public const int TypeSummon = 6;
  19.         public const int TypeMisc = 7;
  20.         public const int TypeUnknown = 8;
  21. }
  22.  
  23. public class ProjCheck
  24. {
  25.        
  26. //A messy definition of all player-created projectile types.
  27. //Might be incomplete and therefore terrible.
  28.  
  29. int[] arrow = new int[] {
  30. 1, 2, 4, 5, 41, 91,
  31. 103, 117, 120, 172,
  32. 225, 278, 282,
  33. 357,
  34. 469, 474, 485, 495,
  35. 639, 640,
  36. 706, 710
  37. };
  38.  
  39. int[] throwable = new int[] {
  40. 3, 6, 19, 21, 24, 28, 29, 30, 33, 37, 48, 50, 52, 53, 54,
  41. 106, 113, 166, 183,
  42. 272,
  43. 318, 320, 330, 333, 397, 399,
  44. 370, 399,
  45. 400, 401, 402,
  46. 507, 516, 517, 519, 520, 532, 598, 599,
  47. 637
  48. };
  49.  
  50. int[] spell = new int[] {
  51. 7, 8, 15, 16, 22, 27, 34, 45, 76, 77, 78, 79, 88, 93, 94, 95,
  52. 114, 118, 119, 121, 122, 123, 124, 125, 126, 150, 151, 152, 189,
  53. 237, 238, 239, 243, 244, 245, 250, 251, 253, 254, 255, 265, 270, 280, 293, 294, 295, 296,
  54. 336, 337, 355, 359,
  55. 409, 410, 424, 425, 426, 440, 459, 461, 476, 493, 494,
  56. 510, 511, 512, 513, 521, 522, 536, 597,
  57. 617, 619, 620, 632, 633, 634, 635, 635, 659, 660,
  58. 704, 711, 713
  59. };
  60.  
  61. int[] bullet = new int[] {
  62. 14, 36, 89, 90,
  63. 104, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 158, 159, 160, 161,
  64. 207, 246, 249,
  65. 338, 339, 340, 341,
  66. 443, 498,
  67. 661
  68. };
  69.  
  70. int[] melee = new int[] {
  71. 25, 26, 35, 46, 47, 49, 57, 58, 59, 60, 61, 62, 63, 64, 66, 97,
  72. 105, 107, 116, 130, 131, 132, 153, 154, 156, 157, 173, 182,
  73. 212, 213, 214, 215, 216, 217, 218, 219, 220, 222, 223, 224, 229, 247, 248, 252, 262, 263, 271, 273, 274,
  74. 301, 304, 306, 307, 321, 335, 342, 343, 344, 367, 368, 369, 383,
  75. 404, 405, 427, 428, 429, 430, 431, 432, 445, 451, 481, 483, 484, 491, 496,
  76. 502, 503, 509, 524, 534, 541, 542, 534, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 595,
  77. 603, 604, 609, 610, 611, 512, 636, 684, 697, 698, 699,
  78. 700, 707, 708, 709
  79. };
  80.  
  81. int[] summon = new int[] {
  82. 191, 192, 193, 194, 195,
  83. 266,
  84. 308, 309, 317, 373, 374, 375, 376, 377, 378, 379, 387, 388, 389, 390, 391, 392, 393, 394, 395,
  85. 407, 408, 423, 433, 466,
  86. 533,
  87. 625, 626, 627, 628, 643, 644, 664, 666, 668, 680, 688, 689, 690, 694, 695, 696
  88. };
  89.  
  90. int[] misc = new int[] {
  91. 9, 12, 85, 23, 42, 51, 65, 68, 92, 99,
  92. 162, 163, 164, 181, 184, 190, 206, 221, 227, 240, 267, 281,
  93. 310, 354,
  94. 434, 477, 478, 479, 480,
  95. 566, 567, 568, 569, 570, 571, 587, 591
  96. };
  97.  
  98. public int ProjIDExists (int ProjectileID)
  99. {
  100.         if (ProjectileID != 0)
  101.         {
  102.                 if(arrow.Contains(ProjectileID))
  103.                 {
  104.                         return ProjTypeContainer.TypeArrow;
  105.                 }
  106.                
  107.                 if(throwable.Contains(ProjectileID))
  108.                 {
  109.                         return ProjTypeContainer.TypeThrowable;
  110.                 }
  111.                
  112.                 if(spell.Contains(ProjectileID))
  113.                 {
  114.                         return ProjTypeContainer.TypeSpell;
  115.                 }
  116.                
  117.                 if(bullet.Contains(ProjectileID))
  118.                 {
  119.                         return ProjTypeContainer.TypeBullet;
  120.                 }
  121.                
  122.                 if(melee.Contains(ProjectileID))
  123.                 {
  124.                         return ProjTypeContainer.TypeMelee;
  125.                 }
  126.                
  127.                 if(summon.Contains(ProjectileID))
  128.                 {
  129.                         return ProjTypeContainer.TypeSummon;
  130.                 }
  131.                
  132.                 if(misc.Contains(ProjectileID))
  133.                 {
  134.                         return ProjTypeContainer.TypeMisc;
  135.                 }
  136.         }
  137.         return ProjTypeContainer.TypeUnknown;
  138. }
  139.  
  140. }
  141. }
View raw paste Reply