Script Function: Q5SF

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q5SF(obj Q4H5, obj user, obj Q5AO, int bank)
 {
   loc Q4VS = getLocation(user);
   list Q51X = 0x100E, 0x100F, 0x1010, 0x1013;
   int num = random(0x00, (numInList(Q51X) - 0x01));
   int Q51W = Q51X[num];
   obj Q47G = NULL();
   if (bank)
   {
     fixBank(user);
     Q47G = getItemAtSlot(user, 0x1D);
     if (Q47G == NULL())
     {
       Q47G = getBackpack(user);
       bank = 0x00;
     }
   }
   else
   {
     Q47G = getBackpack(user);
   }
   obj key = NULL();
   if (Q47G == NULL())
   {
     key = createGlobalObjectAt(Q51W, Q4VS);
     barkTo(user, user, "A ship's key is now at my feet.");
   }
   else
   {
     key = createGlobalObjectIn(Q51W, Q47G);
     if (bank)
     {
       barkTo(user, user, "A ship's key is now in my safety deposit box.");
     }
     else
     {
       barkTo(user, user, "A ship's key is now in my backpack.");
     }
   }
   if (key == NULL())
   {
     barkTo(user, user, "Ack, a key could not be created!");
     return (0x00);
   }
   attachScript(key, "key");
   attachScript(key, "shipkey");
   list Q5Z5;
   if (hasObjVar(Q5AO, "myhousedoors"))
   {
     getObjListVar(Q5Z5, Q5AO, "myhousedoors");
   }
   obj Q5AB;
   int Q55T = numInList(Q5Z5);
   for(int Q4EJ = 0x00; Q4EJ < Q55T; Q4EJ++)
   {
     Q5AB = Q5Z5[Q4EJ];
     Q45B(Q5AB, key);
   }
   return (0x01);
 }