SHARE
TWEET

TUT: HEAL TEXT - utils.fos

Slowhand-VI Jan 6th, 2016 (edited) 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**<
  2.  *  Success type can be: failure, success, and critical success. Only use at First Aid.
  3.  *  The coloring of the heal above head will depends on it,
  4.  *  where critical success is the greenest and the critical failure is an ugly dark blueish green.
  5.  *  Reason type can be: First Aid, Weak healing powder, Healing powder, Stimpack, Super Stimpack, Hypo.
  6.  *  If the reason is no reason, then only the healing value is printed.
  7.  *  In the header all reasons can be disabled with setting IS_HEAL_TEXT_REASON_ENABLED to false.
  8.  */
  9. void FloatingHealText(Critter& cr, int healAmount, int reason, int successType = SKILL_CHECK_SUCCESS)
  10. {
  11.     string text;
  12.     string reasonText = "";
  13.     uint color = 0;
  14.     switch (successType)
  15.     {
  16.         case SKILL_CHECK_CRITICAL_FAILURE:
  17.         case SKILL_CHECK_FAILURE:
  18.             color = COLOR_HEAL_TEXT_FAILURE;
  19.             break;
  20.         case SKILL_CHECK_SUCCESS:
  21.             color = COLOR_HEAL_TEXT_SUCCESS;
  22.             break;
  23.         case SKILL_CHECK_CRITICAL_SUCCESS:
  24.             color = COLOR_HEAL_TEXT_CRIT_SUCCESS;
  25.             break;
  26.     }
  27.     if (IS_HEAL_TEXT_REASON_ENABLED)
  28.     {
  29.         switch (reason)
  30.         {
  31.             case HEAL_TEXT_REASON_FIRSTAID:
  32.                 reasonText = "FA";
  33.                 break;
  34.             case HEAL_TEXT_REASON_WEAKHEALINGPOWDER:
  35.                 reasonText = "WP";
  36.                 break;
  37.             case HEAL_TEXT_REASON_HEALINGPOWDER:
  38.                 reasonText = "HP";
  39.                 break;
  40.             case HEAL_TEXT_REASON_STIMPACK:
  41.                 reasonText = "ST";
  42.                 break;
  43.             case HEAL_TEXT_REASON_SUPERSTIMPACK:
  44.                 reasonText = "SS";
  45.                 break;
  46.             case HEAL_TEXT_REASON_HYPO:
  47.                 reasonText = "Hypo";
  48.                 break;
  49.             case HEAL_TEXT_REASON_NOREASON:
  50.                 reasonText = "";
  51.                 break;
  52.         }
  53.     }
  54.     else
  55.     {
  56.         reasonText = "";
  57.     }
  58.     //  Just in case critical failure hurts later.
  59.     if(healAmount >= 0)
  60.         text = "+ " + healAmount + "  " + reasonText;
  61.     else
  62.         text = "- " + healAmount + "  " + reasonText;
  63.  
  64.     MapMessageEx(FLOAT_ENFORCED, FLOAT_MODE_ALL, cr, text, cr.HexX, cr.HexY, 150, color, true, 0, 0, -40, -70);
  65.     SayEx(SAYEX_VERBOSE_ACTION, cr, text);
  66. }
  67.  
  68. void FloatingHealTextByDrugPid(Critter& cr, int healAmount, uint16 drugPid)
  69. {
  70.     int reason = -1;
  71.     switch (drugPid)
  72.     {
  73.         case PID_WEAK_HEALING_POWDER:
  74.             reason = HEAL_TEXT_REASON_WEAKHEALINGPOWDER;
  75.             break;
  76.         case PID_HEALING_POWDER:
  77.             reason = HEAL_TEXT_REASON_HEALINGPOWDER;
  78.             break;
  79.         case PID_STIMPAK:
  80.             reason = HEAL_TEXT_REASON_STIMPACK;
  81.             break;
  82.         case PID_SUPER_STIMPAK:
  83.             reason = HEAL_TEXT_REASON_SUPERSTIMPACK;
  84.             break;
  85.         case PID_HYPO:
  86.             reason = HEAL_TEXT_REASON_HYPO;
  87.             break;
  88.         default:
  89.             reason = HEAL_TEXT_REASON_NOREASON;
  90.     }
  91.     if (reason >= 0)
  92.     {
  93.         FloatingHealText(cr, healAmount, reason);
  94.     }
  95. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top