Guest User

Untitled

a guest
Jun 21st, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. using System;
  2. using Server;
  3. using Server.Items;
  4. using Server.Spells;
  5. using Server.Mobiles;
  6.  
  7. namespace Server.Misc
  8. {
  9. public class RegenRates
  10. {
  11. [CallPriority(10)]
  12. public static void Configure()
  13. {
  14. Mobile.DefaultHitsRate = TimeSpan.FromSeconds(11.0);
  15. Mobile.DefaultStamRate = TimeSpan.FromSeconds(5.0);
  16. Mobile.DefaultManaRate = TimeSpan.FromSeconds(2.0);
  17.  
  18. Mobile.StamRegenRateHandler = new RegenRateHandler(Mobile_StaminaRegenRate);
  19. Mobile.HitsRegenRateHandler = new RegenRateHandler(Mobile_HitsRegenRate);
  20. }
  21.  
  22. private static TimeSpan Mobile_StaminaRegenRate(Mobile from)
  23. {
  24. if (from is BaseMount)
  25. return TimeSpan.FromSeconds(2.5);
  26. else
  27. return Mobile.DefaultStamRate;
  28. }
  29.  
  30. private static TimeSpan Mobile_HitsRegenRate(Mobile from)
  31. {
  32. double scale = 1.0 - (from.Hunger / 40.0);
  33. if (scale < 0.5)
  34. scale = 0.5;
  35. else if (scale > 1.0)
  36. scale = 1.0;
  37. return TimeSpan.FromSeconds(Mobile.DefaultHitsRate.TotalSeconds * scale);
  38. }
  39.  
  40. /*private static TimeSpan Mobile_ManaRegenRate( Mobile from )
  41. {
  42. if ( from.Skills == null )
  43. return Mobile.DefaultManaRate;
  44.  
  45. if ( !from.Meditating )
  46. CheckBonusSkill( from, from.Mana, from.ManaMax, SkillName.Meditation );
  47.  
  48. double rate;
  49. double armorPenalty = GetArmorOffset( from );
  50. double medPoints = (from.Int + from.Skills[SkillName.Meditation].Value) * 0.5;
  51.  
  52. if ( medPoints <= 0 )
  53. rate = 7.0;
  54. else if ( medPoints <= 100 )
  55. rate = 7.0 - (239*medPoints/2400) + (19*medPoints*medPoints/48000);
  56. else if ( medPoints < 120 )
  57. rate = 1.0;
  58. else
  59. rate = 0.75;
  60.  
  61. rate += armorPenalty;
  62.  
  63. if ( from.Meditating )
  64. rate *= 0.5;
  65.  
  66. if ( rate < 0.5 )
  67. rate = 0.5;
  68. else if ( rate > 7.0 )
  69. rate = 7.0;
  70.  
  71.  
  72. return TimeSpan.FromSeconds( rate );
  73. }*/
  74. }
  75. }
Add Comment
Please, Sign In to add comment