Script Function: postKillerToBB

From Ultima Online: The Second Age
Jump to: navigation, search
function void postKillerToBB(list args)
{
  debugMessage("postKillerToBB:  args=");
  printList(args);
  obj killer = args[0x00];
  int bounty = args[0x01];
  string Q522 = args[0x02];
  list postText = Q522 + ":  " + bounty + "gold.                      ";
  if (numInList(args) > 0x03)
  {
    int murderCount = oprlist(args[0x03], 0x00);
    int Q5RO = oprlist(args[0x03], 0x01);
    int Q4UT = oprlist(args[0x03], 0x02);
    int Q4UR = oprlist(args[0x03], 0x03);
    int Q5TN = oprlist(args[0x03], 0x04);
    obj Q58D = Q5K6(this, killer);
    if (Q58D == NULL())
    {
      Q58D = createNoResObjectIn(0x0EB0, this);
    }
    setObjVar(Q58D, "killer", killer);
    string Q5Y5;
    string Q5Y6;
    string Q67E;
    string Q67F;
    switch (random(0x00, 0x05))
    {
    case 0x00
    default
      Q5Y5 = "Bounty for ";
      Q5Y6 = "!";
      break;
    case 0x01
      Q5Y5 = "";
      Q5Y6 = " must die!";
      break;
    case 0x02
      Q5Y5 = "A price on ";
      Q5Y6 = "!";
      break;
    case 0x03
      Q5Y5 = "";
      Q5Y6 = " outlawed!";
      break;
    case 0x04
      Q5Y5 = "Execute ";
      Q5Y6 = "!";
      break;
    case 0x05
      Q5Y5 = "WANTED: ";
      Q5Y6 = "!";
      break;
    }
    string Q4W4;
    string Q4W6;
    string Q4VJ;
    if (Q5RO)
    {
      Q4W4 = "her";
      Q4W6 = "her";
      Q4VJ = "she";
    }
    else
    {
      Q4W4 = "him";
      Q4W6 = "his";
      Q4VJ = "he";
    }
    int Q534 = wordWrap(postText, "The foul scum known as " + Q522 + " " + Q4RY(murderCount) + "  For " + Q4VJ + " is responsible for " + murderCount + " murders.  " + Q4J2(bounty) + " of " + bounty + " gold pieces for " + Q4W6 + " head!", 0x1C);
    appendToList(postText, "  A description:");
    if (Q4UR)
    {
      appendToList(postText, "    - " + Q4RW(Q4UR) + " hair");
    }
    appendToList(postText, "    - " + Q4RX(Q4UT));
    appendToList(postText, "    - " + Q4SU(Q5TN) + " skin");
    appendToList(postText, "If you kill " + Q4W4 + ", remove the");
    appendToList(postText, "head, and give it to a guard");
    appendToList(postText, "to claim your reward.");
  }
  else
  {
    appendToList(postText, "No information available.");
  }
  setObjVar(Q58D, "postText", postText);
  setPostTime(Q58D);
  return ();
}
function void postKillerToBB(obj killer)
{
  if (!hasObjListVar(killer, "killcount"))
  {
    detachScript(this, "bounty");
    return ();
  }
  list Q51M;
  getObjListVar(Q51M, killer, "killcount");
  obj Q47Z = findClosestBBoard(getLocation(this));
  obj Q58D;
  Q58D = Q5K6(Q47Z, killer);
  if (Q58D == NULL())
  {
    Q58D = createNoResObjectIn(0x0EB0, Q47Z);
  }
  setObjVar(Q58D, "killer", killer);
  obj bank = getItemAtSlot(killer, 0x1D);
  obj Q5NR = doTakeMoney(bank, 0x0EED, 0xC350);
  if (Q5NR == NULL())
  {
    if (0x00)
    {
      bark(killer, "NULL reward!");
    }
  }
  string reward = "alas, zero";
  if (Q5NR != NULL())
  {
    int Q48S = teleport(Q5NR, getLocation(killer));
    int Q463;
    int blah = getResource(Q463, Q5NR, "gold", 0x03, 0x02);
    if (0x00)
    {
      reward = Q463;
      systemMessage(killer, "Gold resource from bank:");
      systemMessage(killer, reward);
    }
    transferResources(Q58D, Q5NR, Q463, "gold");
    if (0x00)
    {
      blah = getResource(Q463, Q5NR, "gold", 0x03, 0x02);
      reward = Q463;
      systemMessage(killer, "Gold resource on gold after transfer:");
      systemMessage(killer, reward);
    }
    blah = getResource(Q463, Q58D, "gold", 0x03, 0x02);
    if (0x00)
    {
      reward = Q463;
      systemMessage(killer, "Gold resource from board:");
      systemMessage(killer, reward);
    }
    reward = Q463;
    if (0x00)
    {
      bark(killer, "reward!");
      bark(killer, reward);
    }
    deleteObject(Q5NR);
  }
  string Q5Y5;
  string Q5Y6;
  string Q67E;
  string Q67F;
  switch (random(0x00, 0x05))
  {
  case 0x00
  default
    Q5Y5 = "Bounty for ";
    Q5Y6 = "!";
    break;
  case 0x01
    Q5Y5 = "";
    Q5Y6 = " must die!";
    break;
  case 0x02
    Q5Y5 = "A price on ";
    Q5Y6 = "!";
    break;
  case 0x03
    Q5Y5 = "";
    Q5Y6 = " outlawed!";
    break;
  case 0x04
    Q5Y5 = "Execute ";
    Q5Y6 = "!";
    break;
  case 0x05
    Q5Y5 = "WANTED: ";
    Q5Y6 = "!";
    break;
  }
  Q67E = Q51M[random(0x00, numInList(Q51M) - 0x01)];
  Q67F = Q51M[random(0x00, numInList(Q51M) - 0x01)];
  int Q600 = Q4S2(killer);
  string dead = Q600;
  list postText = Q5Y5 + getName(killer) + Q5Y6, "  The foul scum known as", getName(killer), Q4RY(killer), "For " + getHeShe(killer) + " is guilty of " + dead, "murders, among them those", "of " + Q67E + " and ", Q67F + ".", Q4J2(killer), "of " + reward + " gold pieces", "for " + getHisHer(killer) + " head!", "  A description:", "    - " + Q4RW(killer) + " hair", "    - " + Q4RX(killer), "    - " + Q4SU(killer) + " skin", "  If you kill " + getHimHer(killer) + ", bring the", "head to a guard here in this", "city to claim your reward.";
  setObjVar(Q58D, "postText", postText);
  return ();
}