Script Function: Q65B

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q65B(obj user, obj usedon)
 {
   if (isAtHome(usedon))
   {
     systemMessage(user, "That scroll belongs to someone else.");
     if (hasObjVar(usedon, "inUse"))
     {
       removeObjVar(usedon, "inUse");
     }
     return (0x00);
   }
   obj Q5UJ = mobileContainsObjType(user, 0x0EFA);
   if (isValid(Q5UJ))
   {
     int Q5UP;
     int Q5LN;
     obj Q626;
     int Q5UU;
     int Q5US;
     int Q627;
     int Q4AQ = getCurMana(user);
     int Q625;
     obj Q5LO;
     int Q65R;
     list Q5BD;
     int Q5E5;
     int Q4VA;
     list Q47B;
     string Q5X2;
     loc Q66U = getLocation(user);
     getContents(Q5V0, Q5UJ);
     int Q5EA;
     Q5EA = numInList(Q5V0);
     sortList(Q5V0, 0x04);
     for(Q5UP = 0x00; Q5UP < Q5EA; Q5UP++)
     {
       Q626 = Q5V0[Q5UP];
       Q5UU = Q4T2(Q626);
       Q5US = Q42S(Q626);
       Q627 = Q4SX(Q5US);
       if (!Q4A8(Q62D, Q5US))
       {
         Q5UP++;
         continue;
       }
       if (Q4AQ < Q627)
       {
         Q5UP++;
         continue;
       }
       Q5X2 = Q4T0(Q5UU);
       switch (Q5US)
       {
       case 0x01
         appendToList(Q4PF, Q5UU + 0x2080);
         appendToList(Q4PF, Q5X2);
         break;
       case 0x02
         appendToList(Q5QM, Q5UU + 0x2080);
         appendToList(Q5QM, Q5X2);
         break;
       case 0x03
         appendToList(Q61M, Q5UU + 0x2080);
         appendToList(Q61M, Q5X2);
         break;
       case 0x04
         appendToList(Q4QW, Q5UU + 0x2080);
         appendToList(Q4QW, Q5X2);
         break;
       case 0x05
         appendToList(Q4P4, Q5UU + 0x2080);
         appendToList(Q4P4, Q5X2);
         break;
       case 0x06
         appendToList(Q5T7, Q5UU + 0x2080);
         appendToList(Q5T7, Q5X2);
         break;
       case 0x07
         appendToList(Q5RM, Q5UU + 0x2080);
         appendToList(Q5RM, Q5X2);
         break;
       case 0x08
         appendToList(Q4NI, Q5UU + 0x2080);
         appendToList(Q4NI, Q5X2);
         break;
       default
         break;
       }
     }
     list Q4D8;
     if (numInList(Q4PF) > 0x00)
     {
       appendToList(Q4D8, 0x20C0);
       appendToList(Q4D8, "First Circle");
     }
     if (numInList(Q5QM) > 0x00)
     {
       appendToList(Q4D8, 0x20C1);
       appendToList(Q4D8, "Second Circle");
     }
     if (numInList(Q61M) > 0x00)
     {
       appendToList(Q4D8, 0x20C2);
       appendToList(Q4D8, "Third Circle");
     }
     if (numInList(Q4QW) > 0x00)
     {
       appendToList(Q4D8, 0x20C3);
       appendToList(Q4D8, "Fourth Circle");
     }
     if (numInList(Q4P4) > 0x00)
     {
       appendToList(Q4D8, 0x20C4);
       appendToList(Q4D8, "Fifth Circle");
     }
     if (numInList(Q5T7) > 0x00)
     {
       appendToList(Q4D8, 0x20C5);
       appendToList(Q4D8, "Sixth Circle");
     }
     if (numInList(Q5RM) > 0x00)
     {
       appendToList(Q4D8, 0x20C6);
       appendToList(Q4D8, "Seventh Circle");
     }
     if (numInList(Q4NI) > 0x00)
     {
       appendToList(Q4D8, 0x20C7);
       appendToList(Q4D8, "Eighth Circle");
     }
   }
   else
   {
     systemMessage(user, "You don't have a spellbook.");
     if (hasObjVar(usedon, "inUse"))
     {
       removeObjVar(usedon, "inUse");
     }
     return (0x00);
   }
   if (numInList(Q4D8) > 0x00)
   {
     selectType(Q62D, this, 0x1C, "Choose a circle.", Q4D8);
     return (0x01);
   }
   else
   {
     systemMessage(user, "You can't inscribe any spells.");
     if (hasObjVar(usedon, "inUse"))
     {
       removeObjVar(usedon, "inUse");
     }
     return (0x00);
   }
   return (0x01);
 }