Script Function: Q64F

From Ultima Online: The Second Age
Revision as of 17:01, 7 October 2018 by Grimoric (talk | contribs) (Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">obj</span> Q64F(<span style="color:#0000FF">obj</span> user, <span style="color:#0000FF">obj</span> o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 function obj Q64F(obj user, obj owner, int Q63R)
 {
   list goldOwnerList;
   list goldQuantityList;
   getObjListVar(goldOwnerList, this, <span style="color:#800000">"goldOwnerList"</span>);
   getObjListVar(goldQuantityList, this, <span style="color:#800000">"goldQuantityList"</span>);
   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(<span style="color:#800000">"Tried to transfer "</span> + Q5EB + <span style="color:#800000">" gold from vendor with only "</span> + Q63T + <span style="color:#800000">" gold."</span>);
           Q5EB = Q63T;
           clearList(goldOwnerList);
           clearList(goldQuantityList);
         }
         Q5BT = createNoResObjectIn(0x0EED, getBackpack(user));
         transferGeneric(Q5BT, gold, Q5EB);
         break;
       }
     }
   }
   setObjVar(this, <span style="color:#800000">"goldOwnerList"</span>, goldOwnerList);
   setObjVar(this, <span style="color:#800000">"goldQuantityList"</span>, goldQuantityList);
   return (Q5BT);
 }