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.

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