Difference between revisions of "Script Function: postKillerToBB"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> postKillerToBB(<span style="color:#0000FF">obj</span> killer) { <span style="color:#00...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
<span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> postKillerToBB(<span style="color:#0000FF">list</span> args)
 +
{
 +
  debugMessage(<span style="color:#800000">"postKillerToBB:  args="</span>);
 +
  [[Engine Function:_printList|<span style="color:#FF0000;font-weight:bold">printList</span>]](args);
 +
  <span style="color:#0000FF">obj</span> killer = args[0x00];
 +
  <span style="color:#0000FF">int</span> bounty = args[0x01];
 +
  <span style="color:#0000FF">string</span> Q522 = args[0x02];
 +
  <span style="color:#0000FF">list</span> postText = Q522 + <span style="color:#800000">":  "</span> + bounty + <span style="color:#800000">"gold.                      "</span>;
 +
  <span style="color:#0000FF">if</span> ([[Engine Function:_numInList|<span style="color:#FF0000;font-weight:bold">numInList</span>]](args) > 0x03)
 +
  {
 +
    <span style="color:#0000FF">int</span> murderCount = [[Engine Function:_oprlist|<span style="color:#FF0000;font-weight:bold">oprlist</span>]](args[0x03], 0x00);
 +
    <span style="color:#0000FF">int</span> Q5RO = [[Engine Function:_oprlist|<span style="color:#FF0000;font-weight:bold">oprlist</span>]](args[0x03], 0x01);
 +
    <span style="color:#0000FF">int</span> Q4UT = [[Engine Function:_oprlist|<span style="color:#FF0000;font-weight:bold">oprlist</span>]](args[0x03], 0x02);
 +
    <span style="color:#0000FF">int</span> Q4UR = [[Engine Function:_oprlist|<span style="color:#FF0000;font-weight:bold">oprlist</span>]](args[0x03], 0x03);
 +
    <span style="color:#0000FF">int</span> Q5TN = [[Engine Function:_oprlist|<span style="color:#FF0000;font-weight:bold">oprlist</span>]](args[0x03], 0x04);
 +
    <span style="color:#0000FF">obj</span> Q58D = [[Script_Function:_Q5K6|<span style="color:#2B91AF">Q5K6</span>]](this, killer);
 +
    <span style="color:#0000FF">if</span> (Q58D == [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]())
 +
    {
 +
      Q58D = [[Engine Function:_createNoResObjectIn|<span style="color:#FF0000;font-weight:bold">createNoResObjectIn</span>]](0x0EB0, this);
 +
    }
 +
    [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q58D, <span style="color:#800000">"killer"</span>, killer);
 +
    <span style="color:#0000FF">string</span> Q5Y5;
 +
    <span style="color:#0000FF">string</span> Q5Y6;
 +
    <span style="color:#0000FF">string</span> Q67E;
 +
    <span style="color:#0000FF">string</span> Q67F;
 +
    <span style="color:#0000FF">switch</span> ([[Engine Function:_random|<span style="color:#FF0000;font-weight:bold">random</span>]](0x00, 0x05))
 +
    {
 +
    <span style="color:#0000FF">case</span> 0x00
 +
    <span style="color:#0000FF">default</span>
 +
      Q5Y5 = <span style="color:#800000">"Bounty for "</span>;
 +
      Q5Y6 = <span style="color:#800000">"!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    <span style="color:#0000FF">case</span> 0x01
 +
      Q5Y5 = <span style="color:#800000">""</span>;
 +
      Q5Y6 = <span style="color:#800000">" must die!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    <span style="color:#0000FF">case</span> 0x02
 +
      Q5Y5 = <span style="color:#800000">"A price on "</span>;
 +
      Q5Y6 = <span style="color:#800000">"!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    <span style="color:#0000FF">case</span> 0x03
 +
      Q5Y5 = <span style="color:#800000">""</span>;
 +
      Q5Y6 = <span style="color:#800000">" outlawed!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    <span style="color:#0000FF">case</span> 0x04
 +
      Q5Y5 = <span style="color:#800000">"Execute "</span>;
 +
      Q5Y6 = <span style="color:#800000">"!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    <span style="color:#0000FF">case</span> 0x05
 +
      Q5Y5 = <span style="color:#800000">"WANTED: "</span>;
 +
      Q5Y6 = <span style="color:#800000">"!"</span>;
 +
      <span style="color:#0000FF">break</span>;
 +
    }
 +
    <span style="color:#0000FF">string</span> Q4W4;
 +
    <span style="color:#0000FF">string</span> Q4W6;
 +
    <span style="color:#0000FF">string</span> Q4VJ;
 +
    <span style="color:#0000FF">if</span> (Q5RO)
 +
    {
 +
      Q4W4 = <span style="color:#800000">"her"</span>;
 +
      Q4W6 = <span style="color:#800000">"her"</span>;
 +
      Q4VJ = <span style="color:#800000">"she"</span>;
 +
    }
 +
    <span style="color:#0000FF">else</span>
 +
    {
 +
      Q4W4 = <span style="color:#800000">"him"</span>;
 +
      Q4W6 = <span style="color:#800000">"his"</span>;
 +
      Q4VJ = <span style="color:#800000">"he"</span>;
 +
    }
 +
    <span style="color:#0000FF">int</span> Q534 = [[Engine Function:_wordWrap|<span style="color:#FF0000;font-weight:bold">wordWrap</span>]](postText, <span style="color:#800000">"The foul scum known as "</span> + Q522 + <span style="color:#800000">" "</span> + [[Script_Function:_Q4RY|<span style="color:#2B91AF">Q4RY</span>]](murderCount) + <span style="color:#800000">"  For "</span> + Q4VJ + <span style="color:#800000">" is responsible for "</span> + murderCount + <span style="color:#800000">" murders.  "</span> + [[Script_Function:_Q4J2|<span style="color:#2B91AF">Q4J2</span>]](bounty) + <span style="color:#800000">" of "</span> + bounty + <span style="color:#800000">" gold pieces for "</span> + Q4W6 + <span style="color:#800000">" head!"</span>, 0x1C);
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"  A description:"</span>);
 +
    <span style="color:#0000FF">if</span> (Q4UR)
 +
    {
 +
      [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"    - "</span> + [[Script_Function:_Q4RW|<span style="color:#2B91AF">Q4RW</span>]](Q4UR) + <span style="color:#800000">" hair"</span>);
 +
    }
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"    - "</span> + [[Script_Function:_Q4RX|<span style="color:#2B91AF">Q4RX</span>]](Q4UT));
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"    - "</span> + [[Script_Function:_Q4SU|<span style="color:#2B91AF">Q4SU</span>]](Q5TN) + <span style="color:#800000">" skin"</span>);
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"If you kill "</span> + Q4W4 + <span style="color:#800000">", remove the"</span>);
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"head, and give it to a guard"</span>);
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"to claim your reward."</span>);
 +
  }
 +
  <span style="color:#0000FF">else</span>
 +
  {
 +
    [[Engine Function:_appendToList|<span style="color:#FF0000;font-weight:bold">appendToList</span>]](postText, <span style="color:#800000">"No information available."</span>);
 +
  }
 +
  [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q58D, <span style="color:#800000">"postText"</span>, postText);
 +
  [[Engine Function:_setPostTime|<span style="color:#FF0000;font-weight:bold">setPostTime</span>]](Q58D);
 +
  <span style="color:#0000FF">return</span> ();
 +
}
 +
 
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> postKillerToBB(<span style="color:#0000FF">obj</span> killer)
 
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> postKillerToBB(<span style="color:#0000FF">obj</span> killer)
 
  {
 
  {

Latest revision as of 09:17, 21 October 2018

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 ();
}