Script Function: Q4ET

From Ultima Online: The Second Age
Jump to: navigation, search
 function void Q4ET(obj Q5KS, int Q5D9)
 {
   if (hasObjVar(Q5KS, "questReward"))
   {
     return ();
   }
   obj reward = NULL();
   int success = 0x00;
   switch (Q5D9)
   {
   default
   case 0x00
     break;
   case 0x01
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x64, 0x01F4));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x00);
       return ();
     }
     break;
   case 0x02
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x0190, 0x0320));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x01);
       return ();
     }
     break;
   case 0x03
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x0320, 0x05DC));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x02);
       return ();
     }
     break;
   }
   if (reward != NULL())
   {
     success = putObjContainer(reward, this);
   }
   setObjVar(Q5KS, "questReward", reward);
   return ();
 }