Difference between revisions of "Script: Cook"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">inherits</span> sk_table; forward <span style="color:#0000FF">void</span> <span style="color:#2B91AF">Q4E8</span>(<span style="colo...")
 
 
Line 138: Line 138:
 
       <span style="color:#0000FF">else</span>
 
       <span style="color:#0000FF">else</span>
 
       {
 
       {
         Q4TM = [[teleport|<span style="color:#FF0000;font-weight:bold">teleport</span>]](Q5CN, [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](user));
+
         Q4TM = [[Engine Function:_teleport|<span style="color:#FF0000;font-weight:bold">teleport</span>]](Q5CN, [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](user));
 
         [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](user, <span style="color:#800000">"You put the cooked food on the ground."</span>);
 
         [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](user, <span style="color:#800000">"You put the cooked food on the ground."</span>);
 
       }
 
       }

Latest revision as of 07:37, 19 October 2018

inherits sk_table;
forward void Q4E8(obj user, obj Q66M, int Q4QY, string name);
function void Q4E9(obj user, obj Q66M, int Q4QY)
{
  string name = "default";
  Q4E8(user, Q66M, Q4QY, name);
  return ();
}
function int Q4Z2(int Q66P)
{
  int Q4PD = 0x00;
  switch (Q66P)
  {
  case 0x0DE9
  case 0x0FAC
  case 0x0FB1
  case 0x19AA
  case 0x19BB
    Q4PD = 0x01;
    break;
  }
  if ((Q66P >= 0x0461) && (Q66P <= 0x0466))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x046A) && (Q66P <= 0x046F))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0475) && (Q66P <= 0x0480))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x092B) && (Q66P <= 0x0933))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0937) && (Q66P <= 0x0942))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0945) && (Q66P <= 0x0950))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0953) && (Q66P <= 0x095E))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0961) && (Q66P <= 0x096C))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x0DE3) && (Q66P <= 0x0DE8))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x12EE) && (Q66P <= 0x134D))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x197A) && (Q66P <= 0x19A9))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x19AB) && (Q66P <= 0x19B6))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x1A19) && (Q66P <= 0x1A74))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x5D7E) && (Q66P <= 0x5D93))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x343B) && (Q66P <= 0x346C))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x3547) && (Q66P <= 0x354C))
  {
    Q4PD = 0x01;
  }
  if ((Q66P >= 0x398C) && (Q66P <= 0x399F))
  {
    Q4PD = 0x01;
  }
  return (Q4PD);
}
function void Q4E8(obj user, obj Q66M, int Q4QY, string name)
{
  if (isAtHome(this))
  {
    systemMessage(user, "You can't use that, it belongs to someone else.");
    return ();
  }
  int Q66P = getObjType(Q66M);
  if (Q4Z2(Q66P))
  {
    if (!testSkill(user, 0x0D))
    {
      systemMessage(user, "You burn the food to a crisp! It's ruined.");
      destroyOne(this);
      return ();
    }
    if (name != "default")
    {
      if (hasObjVar(this, "NAME"))
      {
        removeObjVar(this, "NAME");
        setObjVar(this, "NAME", name);
      }
    }
    if (random(0x00, 0x01))
    {
      barkTo(user, user, "Looks delicious.");
    }
    else
    {
      barkTo(user, user, "Mmmm, smells good.");
    }
    obj Q47F = getBackpack(user);
    int Q4TM;
    obj Q5CN = createGlobalObjectOn(this, Q4QY);
    if (!isInContainer(this))
    {
      if (canHold(Q47F, Q5CN))
      {
        Q4TM = putObjContainer(Q5CN, Q47F);
        systemMessage(user, "You put the cooked food into your backpack.");
      }
      else
      {
        Q4TM = teleport(Q5CN, getLocation(user));
        systemMessage(user, "You put the cooked food on the ground.");
      }
    }
    destroyOne(this);
  }
  else
  {
    systemMessage(user, "You can't cook on that.");
  }
  return ();
}