Script Function: Q5UO

From Ultima Online: The Second Age
Jump to: navigation, search
 function void Q5UO(obj Q5DM)
 {
   obj target = getFirstVisableTargetInRange(Q5DM, 0x09);
   if (target == NULL())
   {
     return ();
   }
   loc there = getLocation(target);
   int Q4WB = getCurHP(Q5DM);
   Q559 = getCurMana(Q5DM);
   int intelligence = getIntelligence(Q5DM);
   if (!hasObjVar(this, "spellCastersLevel"))
   {
     return ();
   }
   Q4AP = getObjVar(Q5DM, "spellCastersLevel");
   int Q4Y4;
   if (!getCompileFlag(0x01))
   {
     Q4Y4 = getNotoriety(Q5DM);
   }
   else
   {
     Q4Y4 = getKarmaLevel(Q5DM);
   }
   int Q5UN;
   int Q5X7;
   int Q4OE;
   int Q4AY;
   int targetType;
   int Q5MQ;
   int Q4GM;
   int neutral;
   int good;
   int heal;
   if (Q42X <= Q4WB)
   {
     Q5X7 = 0x01;
   }
   if (Q42V <= Q4WB)
   {
     if (Q4WB < Q42X)
     {
       Q5X7 = 0x02;
     }
   }
   if (Q42U <= Q4WB)
   {
     if (Q4WB < Q42V)
     {
       Q5X7 = 0x03;
     }
   }
   else
   {
     Q5X7 = 0x04;
   }
   string Q4XE = Q42X;
   string Q4XD = Q42V;
   string Q4XC = Q42U;
   string Q4UO = Q4WB;
   string Q5VH = Q5X7;
   Q4OE = 0x00;
   switch (Q5X7)
   {
   case 0x01
     Q4GM = 0x00;
     break;
   case 0x02
     Q4GM = 0x37;
     neutral = 0x28;
     good = 0x1C;
     heal = 0x03;
     break;
   case 0x03
     Q4GM = 0x50;
     neutral = 0x46;
     good = 0x3C;
     heal = 0x0F;
     break;
   case 0x04
     Q4GM = 0x5F;
     neutral = 0x5A;
     good = 0x55;
     heal = 0x0F;
     break;
   case 0x05
     Q4GM = 0x64;
     neutral = 0x64;
     good = 0x55;
     heal = 0x0F;
     break;
   default
     break;
   }
   list Q4OC = 0x1F4A, 0x03, 0x0A, 0x1F5A, 0x02, 0x1A, 0x1F3E, 0x03, 0x06, 0x1F47, 0x03, 0x0A, 0x1F40, 0x03, 0x06, 0x1F2E, 0x03, 0x02, 0x1F30, 0x03, 0x02, 0x1F34, 0x03, 0x02;
   list Q4GL = 0x1F5F, 0x03, 0x34, 0x1F57, 0x03, 0x1A, 0x1F56, 0x03, 0x1A, 0x1F52, 0x03, 0x10, 0x1F4A, 0x03, 0x0A, 0x1F3E, 0x03, 0x06, 0x1F38, 0x03, 0x04, 0x1F32, 0x03, 0x02;
   list Q5BK = 0x1F61, 0x03, 0x34, 0x1F50, 0x01, 0x10, 0x1F4B, 0x02, 0x0A;
   list Q4U0 = 0x1F3D, 0x01, 0x06, 0x1F3B, 0x01, 0x04, 0x1F3C, 0x01, 0x04, 0x1F36, 0x01, 0x04, 0x1F35, 0x01, 0x04;
   list Q4VN = 0x1F49, 0x01, 0x0A, 0x1F31, 0x01, 0x02;
   list Q4O6 = 0x1F58, 0x01, 0x1A;
   string Q47Q = Q559;
   if (Q559 < 0x02)
   {
     int Q4AZ = random(0x01, 0x64);
     if (Q4AZ < 0x23)
     {
       attack(this, target);
       return ();
     }
     else
     {
       return ();
     }
   }
   Q4AY = random(0x00, 0x64);
   if (Q4GM <= Q4AY)
   {
     if (Q4Y4 < 0x00)
     {
       Q4OE = Q4AK();
       if (Q4OE < 0x08)
       {
         Q5UX = Q4OC[Q4OE * 0x03];
         targetType = Q4OC[(Q4OE * 0x03) + 0x01];
         Q5MQ = Q4OC[(Q4OE * 0x03) + 0x02];
       }
       else
       {
         Q4OE = (Q4OE - 0x08);
         Q5UX = Q4GL[Q4OE * 0x03];
         targetType = Q4GL[(Q4OE * 0x03) + 0x01];
         Q5MQ = Q4GL[(Q4OE * 0x03) + 0x02];
       }
     }
     else
     {
       Q4OE = (Q4AI() - 0x08);
       Q5UX = Q4GL[Q4OE * 0x03];
       targetType = Q4GL[(Q4OE * 0x03) + 0x01];
       Q5MQ = Q4GL[(Q4OE * 0x03) + 0x02];
     }
   }
   if (neutral <= Q4AY)
   {
     if (Q4AY < Q4GM)
     {
       Q4OE = (Q4AN() - 0x10);
       if (Q4OE == (0x00 - 0x10))
       {
         Q5UO(this);
         return ();
       }
       Q5UX = Q5BK[Q4OE * 0x03];
       targetType = Q5BK[(Q4OE * 0x03) + 0x01];
       Q5MQ = Q5BK[(Q4OE * 0x03) + 0x02];
     }
   }
   if (good <= Q4AY)
   {
     if (Q4AY < neutral)
     {
       Q4OE = (Q4AL() - 0x13);
       if (Q4OE == (0x00 - 0x13))
       {
         Q5UO(this);
         return ();
       }
       Q5UX = Q4U0[Q4OE * 0x03];
       targetType = Q4U0[(Q4OE * 0x03) + 0x01];
       Q5MQ = Q4U0[(Q4OE * 0x03) + 0x02];
     }
   }
   if (heal <= Q4AY)
   {
     if (Q4AY < good)
     {
       Q4OE = (Q4AM() - 0x18);
       Q5UX = Q4VN[Q4OE * 0x03];
       targetType = Q4VN[(Q4OE * 0x03) + 0x01];
       Q5MQ = Q4VN[(Q4OE * 0x03) + 0x02];
     }
   }
   else
   {
     Q4OE = (Q4AJ() - 0x1A);
     if (Q4OE == (0x00 - 0x1A))
     {
       Q5UO(this);
       return ();
     }
     Q5UX = Q4O6[Q4OE * 0x03];
     targetType = Q4O6[(Q4OE * 0x03) + 0x01];
     Q5MQ = Q4O6[(Q4OE * 0x03) + 0x02];
   }
   obj scroll = createGlobalObjectIn(Q5UX, Q5DM);
   if (scroll == NULL())
   {
     return ();
   }
   obj Q4GD;
   loc Q4GE;
   if (Q5YA(Q5DM, Q5MQ) == 0x00)
   {
     deleteObject(scroll);
     list Q5DR;
     shortcallback(this, 0x01, 0x48);
     return ();
   }
   setObjVar(scroll, "user", Q5DM);
   string Q65H = targetType;
   switch (targetType)
   {
   case 0x01
     Q4GD = Q5DM;
     setObjVar(scroll, "target", Q4GD);
     break;
   case 0x02
     Q4GD = target;
     setObjVar(scroll, "target", Q4GD);
     break;
   case 0x03
     Q4GD = target;
     setObjVar(scroll, "target", Q4GD);
     break;
   default
   }
   shortcallback(scroll, 0x00, 0x49);
   callback(Q5DM, 0x03, 0x48);
   return ();
 }