Difference between revisions of "Script Function: Q64F"

From Ultima Online: The Second Age
Jump to: navigation, search
(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...")
 
 
Line 3: Line 3:
 
     <span style="color:#0000FF">list</span> goldOwnerList;
 
     <span style="color:#0000FF">list</span> goldOwnerList;
 
     <span style="color:#0000FF">list</span> goldQuantityList;
 
     <span style="color:#0000FF">list</span> goldQuantityList;
     [[Engine Function:_getObjListVar|<span style="color:#FF0000;font-weight:bold">getObjListVar</span>]](goldOwnerList, this, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"goldOwnerList"</span></span>);
+
     [[Engine Function:_getObjListVar|<span style="color:#FF0000;font-weight:bold">getObjListVar</span>]](goldOwnerList, this, <span style="color:#800000">"goldOwnerList"</span>);
     [[Engine Function:_getObjListVar|<span style="color:#FF0000;font-weight:bold">getObjListVar</span>]](goldQuantityList, this, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"goldQuantityList"</span></span>);
+
     [[Engine Function:_getObjListVar|<span style="color:#FF0000;font-weight:bold">getObjListVar</span>]](goldQuantityList, this, <span style="color:#800000">"goldQuantityList"</span>);
 
     <span style="color:#0000FF">obj</span> Q5BT = [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]();
 
     <span style="color:#0000FF">obj</span> Q5BT = [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]();
 
     for(<span style="color:#0000FF">int</span> i = 0x00; 0x01; i++)
 
     for(<span style="color:#0000FF">int</span> i = 0x00; 0x01; i++)
Line 32: Line 32:
 
           <span style="color:#0000FF">if</span> (Q5EB > Q63T)
 
           <span style="color:#0000FF">if</span> (Q5EB > Q63T)
 
           {
 
           {
             debugMessage(<span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"Tried to transfer "</span></span> + Q5EB + <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">" gold from vendor with only "</span></span> + Q63T + <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">" gold."</span></span>);
+
             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;
 
             Q5EB = Q63T;
 
             [[Engine Function:_clearList|<span style="color:#FF0000;font-weight:bold">clearList</span>]](goldOwnerList);
 
             [[Engine Function:_clearList|<span style="color:#FF0000;font-weight:bold">clearList</span>]](goldOwnerList);
Line 43: Line 43:
 
       }
 
       }
 
     }
 
     }
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"goldOwnerList"</span></span>, goldOwnerList);
+
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"goldOwnerList"</span>, goldOwnerList);
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"goldQuantityList"</span></span>, goldQuantityList);
+
     [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](this, <span style="color:#800000">"goldQuantityList"</span>, goldQuantityList);
 
     <span style="color:#0000FF">return</span> (Q5BT);
 
     <span style="color:#0000FF">return</span> (Q5BT);
 
   }
 
   }

Latest revision as of 02:49, 8 October 2018

 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);
 }