Script Function: Q64F

From Ultima Online: The Second Age
Jump to: navigation, search
 function obj Q64F(obj user, obj owner, int Q63R)
 {
   list goldOwnerList;
   list goldQuantityList;
   getObjListVar(goldOwnerList, this, "goldOwnerList");
   getObjListVar(goldQuantityList, this, "goldQuantityList");
   obj Q5BT = NULL();
   for(int i = 0x00; 0x01; i++)
   {
     if (i >= numInList(goldOwnerList))
     {
       return (Q5BT);
     }
     obj Q4FL = goldOwnerList[i];
     if (owner == Q4FL)
     {
       int Q5EB = goldQuantityList[i];
       if (Q5EB > Q63R)
       {
         setItem(goldQuantityList, Q5EB - Q63R, i);
         Q5EB = Q63R;
       }
       else
       {
         removeItem(goldOwnerList, i);
         removeItem(goldQuantityList, i);
       }
       obj gold = containsObjType(this, 0x0EED);
       if (gold != NULL())
       {
         int Q63T = getQuantity(gold);
         if (Q5EB > Q63T)
         {
           debugMessage("Tried to transfer " + Q5EB + " gold from vendor with only " + Q63T + " gold.");
           Q5EB = Q63T;
           clearList(goldOwnerList);
           clearList(goldQuantityList);
         }
         Q5BT = createNoResObjectIn(0x0EED, getBackpack(user));
         transferGeneric(Q5BT, gold, Q5EB);
         break;
       }
     }
   }
   setObjVar(this, "goldOwnerList", goldOwnerList);
   setObjVar(this, "goldQuantityList", goldQuantityList);
   return (Q5BT);
 }