Script: Packanimal

From Ultima Online: The Second Age
Jump to: navigation, search
inherits sk_table;
function obj Q4SE(obj Q68D)
{
  obj Q491 = getBackpack(Q68D);
  if (Q491 == NULL())
  {
    Q491 = createGlobalObjectIn(0x0E75, Q68D);
    if (!isValid(Q491))
    {
      return (NULL());
    }
    if (!equipObj(Q491, Q68D, 0x15))
    {
      deleteObject(Q491);
      return (NULL());
    }
  }
  return (Q491);
}
function int Q4ZV(obj Q5HY, obj pet)
{
  list Q48U;
  if (!hasObjListVar(pet, "myBoss"))
  {
    return (0x00);
  }
  getObjListVar(Q48U, pet, "myBoss");
  if (!isInList(Q48U, Q5HY))
  {
    return (0x00);
  }
  if (!hasObjVar(pet, "myLoyalty"))
  {
    return (0x00);
  }
  int myLoyalty = getObjVar(pet, "myLoyalty");
  if (myLoyalty < 0x01)
  {
    return (0x00);
  }
  return (0x01);
}
trigger use
{
  int Q4Q1;
  obj Q491 = Q4SE(this);
  if (Q491 == NULL())
  {
    return (0x00);
  }
  if (isDead(user))
  {
    return (0x00);
  }
  if (isEditing(user) || Q4ZV(user, this))
  {
    Q4Q1 = openContainer(user, Q491);
  }
  else
  {
    if (testSkill(user, 0x1C))
    {
      Q4Q1 = openContainer(user, Q491);
    }
    else
    {
      ebarkTo(user, user, "You fail to peek into the animal's pack.");
    }
  }
  return (0x00);
}
function int Q4V0(obj Q57P)
{
  if (isDead(Q57P))
  {
    return (0x00);
  }
  if (isEditing(Q57P) || Q4ZV(Q57P, this))
  {
    return (0x01);
  }
  return (0x00);
}
trigger objaccess(0x05)
{
  return (!Q4V0(user))
}
trigger objaccess(0x07)
{
  return (!Q4V0(user))
}
trigger objaccess(0x08)
{
  if (usedon == this)
  {
    return (0x01);
  }
  if (isContainer(usedon) && Q4V0(user))
  {
    int Q4Q1 = openContainer(user, usedon);
  }
  return (0x00);
}
trigger give
{
  obj Q491 = Q4SE(this);
  if (Q491 == NULL())
  {
    return (0x00);
  }
  if (!canHold(Q491, givenobj))
  {
    if (!isEditing(giver))
    {
      return (0x00);
    }
  }
  if (isEditing(giver) || Q4ZV(giver, this))
  {
    int Q52Q = putObjContainer(givenobj, Q491);
    return (0x01);
  }
  return (0x00);
}