Script Function: Q62R

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q62R(obj Q62O, int Q5WD)
 {
   string Q5N7;
   string Q63B;
   obj ship = getMultiSlaveId(Q62O);
   if (ship == NULL())
   {
     bark(Q62O, "Blimey, I have no ship!");
     return (0x00);
   }
   if ((!isValid(Q55D)) || (!isMap(Q55D)))
   {
     bark(Q62O, "I have seen no map, sir.");
     Q55D = NULL();
     return (0x00);
   }
   if (getDistanceInTiles(getLocation(Q55D), getLocation(Q62O)) > 0x0F)
   {
     bark(Q62O, "The map is too far away from me, sir.");
     Q55D = NULL();
     return (0x00);
   }
   loc Q5B8;
   if (!getMapPoint(Q5B8, Q55D, Q5BA))
   {
     Q5N7 = "Nav point ";
     Q63B = Q5BA + 0x01;
     concat(Q5N7, Q63B);
     concat(Q5N7, " is invalid, sir.");
     bark(Q62O, Q5N7);
     Q5BA = (0x00 - 0x01);
     return (0x00);
   }
   loc Q5SL = getLocation(ship);
   if (getDistanceInTiles(Q5SL, Q5B8) <= Q5SC)
   {
     if (Q5WD)
     {
       Q5N7 = "We have arrived at nav ";
       Q63B = Q5BA + 0x01;
       concat(Q5N7, Q63B);
       concat(Q5N7, ", sir.");
       bark(Q62O, Q5N7);
       Q5BA++;
       int Q5FV = Q630(Q62O);
       return (0x00);
     }
     Q5BA++;
     if (!getMapPoint(Q5B8, Q55D, Q5BA))
     {
       Q5BA = (0x00 - 0x01);
       bark(Q62O, "The course is completed, sir.");
       Q5FV = Q630(Q62O);
       return (0x00);
     }
     Q5N7 = "Heading to nav point ";
     Q63B = Q5BA + 0x01;
     concat(Q5N7, Q63B);
     concat(Q5N7, ", sir.");
     bark(Q62O, Q5N7);
   }
   int Q5B7 = getDirectionInternal(Q5SL, Q5B8);
   int Q5SG = getObjVar(ship, "myshipdir");
   Q5SG = Q5SG * 0x02;
   int Q4IA = Q62P(Q5B7, Q5SG);
   int Q4DW = 0x00;
   if ((Q4IA > 0x01) || (Q4IA < (0x00 - 0x01)))
   {
     if (Q4IA < 0x00)
     {
       Q4DW = 0x09;
     }
     else
     {
       Q4DW = 0x08;
     }
   }
   else
   {
     if (Q4IA == 0x01)
     {
       Q4DW = 0x01;
     }
     else
     {
       if (Q4IA == (0x00 - 0x01))
       {
         Q4DW = 0x07;
       }
       else
       {
         Q4DW = 0x00;
       }
     }
   }
   return (Q62Q(Q62O, Q4DW, 0x01));
 }