Script Function: Q659

From Ultima Online: The Second Age
Jump to: navigation, search
 function int Q659(obj user)
 {
   int Q62A = getObjType(this);
   if (hasObjVar(this, "fuel"))
   {
     int fuel = getObjVar(this, "fuel");
   }
   switch (Q62A)
   {
   case 0x0A26
     setObjVar(this, "burning", 0x01);
     setType(this, 0x0B1A);
     break;
   case 0x0A27
     setObjVar(this, "burning", 0x01);
     setType(this, 0x0B1D);
     break;
   case 0x0A29
     setObjVar(this, "burning", 0x01);
     setType(this, 0x0B26);
     break;
   case 0x1853
     setObjVar(this, "burning", 0x01);
     setType(this, 0x1854);
     break;
   case 0x1857
     setObjVar(this, "burning", 0x01);
     setType(this, 0x1858);
     break;
   case 0x1849
     setObjVar(this, "burning", 0x01);
     setType(this, 0x184A);
     break;
   case 0x184D
     setObjVar(this, "burning", 0x01);
     setType(this, 0x184E);
     break;
   case 0x0A28
     int Q527;
     obj Q47F = getBackpack(user);
     obj Q5BO = requestCreateObjectAt(0x0A0F, getLocation(user));
     setObjVar(this, "fuel", 0x64);
     setObjVar(Q5BO, "burning", 0x01);
     attachscript(Q5BO, "torch");
     callback(Q5BO, 0x1E, 0x39);
     if (!isInContainer(this))
     {
       Q527 = teleport(Q5BO, getLocation(this));
       if (getQuantity(this) > 0x01)
       {
         destroyOne(this);
         if (canHold(Q47F, this))
         {
           systemMessage(user, "You put the remaining unlit candles into your backpack.");
           Q527 = putObjContainer(this, Q47F);
         }
         else
         {
           systemMessage(user, "You put the remaining unlit candles at your feet.");
           Q527 = teleport(this, getLocation(user));
         }
       }
     }
     else
     {
       destroyOne(this);
       if (getItemAtSlot(user, 0x02) != NULL())
       {
         systemMessage(user, "You cannot hold the candle, so it has been placed at your feet.");
       }
       else
       {
         Q527 = equipObj(Q5BO, user, 0x02);
         systemMessage(user, "You put the candle in your left hand.");
       }
     }
     if (getQuantity(this) == 0x01)
     {
       destroyOne(this);
     }
     break;
   case 0x0F64
   case 0x0F6B
     Q47F = getBackpack(user);
     obj Q5CB = requestCreateObjectAt(0x0A12, getLocation(user));
     setObjVar(this, "fuel", 0x64);
     setObjVar(Q5CB, "burning", 0x01);
     attachscript(Q5CB, "torch");
     callback(Q5CB, 0x1E, 0x39);
     if (!isInContainer(this))
     {
       Q527 = teleport(Q5CB, getLocation(this));
       if (getQuantity(this) > 0x01)
       {
         destroyOne(this);
         if (canHold(Q47F, this))
         {
           systemMessage(user, "You put the remaining unlit torches into your backpack.");
           Q527 = putObjContainer(this, Q47F);
         }
         else
         {
           systemMessage(user, "You put the remaining unlit torches at your feet.");
           Q527 = teleport(this, getLocation(user));
         }
       }
     }
     else
     {
       destroyOne(this);
       if (getItemAtSlot(user, 0x02) != NULL())
       {
         systemMessage(user, "You cannot hold the torch, so it has been placed at your feet.");
       }
       else
       {
         Q527 = equipObj(Q5CB, user, 0x02);
         systemMessage(user, "You put the torch in your left hand.");
       }
     }
     if (getQuantity(this) == 0x01)
     {
       destroyOne(this);
     }
     break;
   case 0x0A18
   case 0x0A1D
   case 0x0A25
     if (fuel > 0x00)
     {
       setObjVar(this, "burning", 0x01);
       callback(this, 0x1E, 0x39);
       setType(this, Q62A - 0x03);
     }
     else
     {
       systemMessage(user, "The lantern is out of fuel.");
     }
     break;
   default
     return (0x00);
     break;
   }
   sfx(getLocation(this), 0x47, 0x00);
   return (0x01);
 }