Script Function: Q4Z0

From Ultima Online: The Second Age
Revision as of 01:31, 8 October 2018 by Grimoric (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 function int Q4Z0(obj t)
 {
   if (hasObjVar(t, "isLocked"))
   {
     barkTo(Q4SD(), Q4SD(), "Locked items may not be made not-for-sale.");
     return (0x01);
   }
   if (isContainer(t))
   {
     if (!isRealContainer(t))
     {
       switch (getObjType(t))
       {
       case 0x0EFA
       case 0x0E3B
         break;
       default
         return (0x01);
       }
     }
     else
     {
       list Q4E4;
       getContents(Q4E4, t);
       for(int i = numInList(Q4E4); i; i--)
       {
         if ((!hasScript(Q4E4[0x00], "vended")) || ((!hasObjVar(Q4E4[0x00], "vendedPrice"))))
         {
           if (!Q4Z0(Q4E4[0x00]))
           {
             barkTo(Q4SD(), Q4SD(), "To be not for sale, all contents of a container must be for sale.");
             return (0x00);
           }
         }
         removeItem(Q4E4, 0x00);
       }
     }
     return (0x01);
   }
   if (Q4YS(t))
   {
     return (0x01);
   }
   obj Q47J = containedBy(t);
   if (!isValid(Q47J))
   {
     bark(Q4SD(), "It's not in a container.");
     return (0x00);
   }
   if (hasObjVar(Q47J, "vendedPrice"))
   {
     return (0x01);
   }
   barkTo(Q4SD(), Q4SD(), "Only the following items may be made not-for-sale: books, containers, keyrings, and items in a for-sale container.");
   return (0x00);
 }