TinTin++ Configs for DiscworldMUD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
3.7 KiB

  1. #CLASS {QUOTA} {KILL};
  2. #CLASS {QUOTA} {OPEN};
  3. #unvar quota;
  4. #nop ==[ Parse 'read quota brief' output ]==;
  5. #action {^ Receipts received: A\$%1.$}
  6. {
  7. #var quota[reciepts] %1;
  8. }
  9. #action {^ Receipts received: %1p.$}
  10. {
  11. #math quota[reciepts] {%1 * 0.01};
  12. }
  13. #action {^ Min quota: A\$%1.$}
  14. {
  15. #var quota[min] %1;
  16. }
  17. #action {^ Max quota: A\$%1.$}
  18. {
  19. #var quota[max] %1;
  20. }
  21. #action {^ Amount owed: A\$%1.$}
  22. {
  23. #var quota[owed] %1;
  24. }
  25. #action {^ Amount owed: %1p.$}
  26. {
  27. #math quota[owed] {%1 * 0.01};
  28. }
  29. #action {^ Amount paid: A\$%1.$}
  30. {
  31. #var quota[paid] %1;
  32. }
  33. #action {^ Amount paid: %1p.$}
  34. {
  35. #math quota[paid] {%1 * 0.01};
  36. }
  37. #action {^ Time left: %1.$} {
  38. #regex {%1} {%d hour{s?}} {
  39. #var {quota[time][hour]} {&1};
  40. } { #var {quota[time][hour]} {0} };
  41. #regex {%1} {%d minute{s?}} {
  42. #var {quota[time][min]} {&1};
  43. } { #var {quota[time][min]} {0} };
  44. #regex {%1} {%d second{s?}} {
  45. #var {quota[time][sec]} {&1};
  46. } { #var {quota[time][sec]} {0} };
  47. #var {quota[who]} {$GMCP[charinfo][capname]};
  48. #var {quota[alert]} {on};
  49. }
  50. #tick {quota_time}
  51. {
  52. #nop If we have no quota info, do nothing;
  53. #if {!&{quota[time]}} {
  54. #return;
  55. };
  56. #nop Subtract a second, calculate new times;
  57. #math {quota[time][sec]} {$quota[time][sec] - 1};
  58. #if {$quota[time][sec] < 0} {
  59. #math {quota[time][min]} {$quota[time][min] - 1};
  60. #math {quota[time][sec]} {$quota[time][sec] + 60};
  61. #nop Update prompt;
  62. update_prompt;
  63. };
  64. #if {$quota[time][min] < 0} {
  65. #math {quota[time][hour]} {$quota[time][hour] - 1};
  66. #math {quota[time][min]} {$quota[time][min] + 60};
  67. };
  68. #if {$quota[time][hour] < 0} {
  69. #math {quota[time][hour]} {$quota[time][hour] + 12};
  70. #var {quota[reciepts]} {0};
  71. #nop Quota period is over, announce it.;
  72. #format {quota_display_line} {%c[Quota] %c*%c %s's quota has %creset%c.} {bold blue} {bold yellow} {bold blue} {$quota[who]} {bold red} {bold blue};
  73. #showme {$quota_display_line};
  74. };
  75. #nop Alert when quota is ending;
  76. #if {"$quota[alert]" == "on"} {
  77. #nop Message an hour before;
  78. #if {$quota[time][hour] == 0 && $quota[time][min] == 59 && $quota[time][sec] == 59} {
  79. #format {quota_display_line} {%c[Quota] %c*%c %s's quota flips over in %cone hour%c.} {bold blue} {bold yellow} {bold blue} {$quota[who]} {bold red} {bold blue};
  80. #echo {$quota_display_line \a};
  81. };
  82. #nop Message 30 minutes before;
  83. #if {$quota[time][hour] == 0 && $quota[time][min] == 29 && $quota[time][sec] == 59} {
  84. #format {quota_display_line} {%c[Quota] %c*%c %s's quota flips over in %chalf an hour%c.} {bold blue} {bold yellow} {bold blue} {$quota[who]} {bold red} {bold blue};
  85. #echo {$quota_display_line \a};
  86. };
  87. #nop Message 10 minutes before;
  88. #if {$quota[time][hour] == 0 && $quota[time][min] == 9 && $quota[time][sec] == 59} {
  89. #format {quota_display_line} {%c[Quota] %c*%c %s's quota flips over in %cten minutes%c.} {bold blue} {bold yellow} {bold blue} {$quota[who]} {bold red} {bold blue};
  90. #echo {$quota_display_line \a};
  91. };
  92. };
  93. } {1};
  94. #alias {quota alert %1} {
  95. #if {"%1" == "on"} {
  96. #var {quota[alert]} {on};
  97. } {
  98. #var {quota[alert]} {off};
  99. };
  100. };
  101. #function {zero_pad} {
  102. #if {%1 < 10} {
  103. #format {result} {0%d} {%0};
  104. };
  105. #else {
  106. #format {result} {%d} {%0};
  107. };
  108. #return $result;
  109. };
  110. #function {quota_time_left} {
  111. #if {$quota[time][hour] == 0 && $quota[time][min] < 60} {
  112. #format {result} {<eac> %s:%s<099>} {@zero_pad{$quota[time][hour]}} {@zero_pad{$quota[time][min]}};
  113. } {
  114. #format {result} {%s:%s<099>} {$quota[time][hour]} {@zero_pad{$quota[time][min]}};
  115. };
  116. #return $result;
  117. };
  118. #CLASS {QUOTA} {CLOSE};