MineInfo.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Drawing;
  2. namespace Server.MirDatabase
  3. {
  4. public class MineSet
  5. {
  6. public string Name = string.Empty;
  7. public byte SpotRegenRate = 5;
  8. public byte MaxStones = 80;
  9. public byte HitRate = 25;
  10. public byte DropRate = 10;
  11. public byte TotalSlots = 100;
  12. public List<MineDrop> Drops = new List<MineDrop>();
  13. private bool DropsSet = false;
  14. public MineSet(byte mineType = 0)
  15. {
  16. switch (mineType)
  17. {
  18. case 1:
  19. TotalSlots = 120;
  20. Drops.Add(new MineDrop() { ItemName = "GoldOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  21. Drops.Add(new MineDrop() { ItemName = "SilverOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  22. Drops.Add(new MineDrop() { ItemName = "CopperOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  23. Drops.Add(new MineDrop() { ItemName = "BlackIronOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  24. break;
  25. case 2:
  26. TotalSlots = 100;
  27. Drops.Add(new MineDrop() { ItemName = "PlatinumOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  28. Drops.Add(new MineDrop() { ItemName = "RubyOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  29. Drops.Add(new MineDrop() { ItemName = "NephriteOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  30. Drops.Add(new MineDrop() { ItemName = "AmethystOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 });
  31. break;
  32. }
  33. }
  34. public void SetDrops(List<ItemInfo> items)
  35. {
  36. if (DropsSet) return;
  37. for (int i = 0; i < Drops.Count; i++)
  38. {
  39. for (int j = 0; j < items.Count; j++)
  40. {
  41. ItemInfo info = items[j];
  42. if (String.Compare(info.Name.Replace(" ", ""), Drops[i].ItemName, StringComparison.OrdinalIgnoreCase) != 0) continue;
  43. Drops[i].Item = info;
  44. break;
  45. }
  46. }
  47. DropsSet = true;
  48. }
  49. }
  50. public class MineSpot
  51. {
  52. public byte StonesLeft = 0;
  53. public long LastRegenTick = 0;
  54. public MineSet Mine;
  55. }
  56. public class MineDrop
  57. {
  58. public string ItemName;
  59. public ItemInfo Item;
  60. public byte MinSlot = 0;
  61. public byte MaxSlot = 0;
  62. public byte MinDura = 1;
  63. public byte MaxDura = 1;
  64. public byte BonusChance = 0;
  65. public byte MaxBonusDura = 1;
  66. }
  67. public class MineZone
  68. {
  69. public byte Mine;
  70. public Point Location;
  71. public ushort Size;
  72. public MineZone()
  73. {
  74. }
  75. public MineZone(BinaryReader reader)
  76. {
  77. Location = new Point(reader.ReadInt32(), reader.ReadInt32());
  78. Size = reader.ReadUInt16();
  79. Mine = reader.ReadByte();
  80. }
  81. public void Save(BinaryWriter writer)
  82. {
  83. writer.Write(Location.X);
  84. writer.Write(Location.Y);
  85. writer.Write(Size);
  86. writer.Write(Mine);
  87. }
  88. public override string ToString()
  89. {
  90. return string.Format("Mine: {0}- {1}", Functions.PointToString(Location), Mine);
  91. }
  92. }
  93. }