Script Function: Q4WT

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