Difference between revisions of "Script Function: Q4Y8"

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> Q4Y8() { deleteArray|<span style="color:#FF0000;font-weight:bold">deleteArray</sp...")
 
 
Line 28: Line 28:
 
       [[Engine Function:_setArrayIntElem|<span style="color:#FF0000;font-weight:bold">setArrayIntElem</span>]](0x01, 0x03, i, wood);
 
       [[Engine Function:_setArrayIntElem|<span style="color:#FF0000;font-weight:bold">setArrayIntElem</span>]](0x01, 0x03, i, wood);
 
       [[Engine Function:_deleteObject|<span style="color:#FF0000;font-weight:bold">deleteObject</span>]](Q61Z);
 
       [[Engine Function:_deleteObject|<span style="color:#FF0000;font-weight:bold">deleteObject</span>]](Q61Z);
 +
    }
 +
    <span style="color:#0000FF">return</span> ();
 +
  }
 +
 +
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> Q4Y8()
 +
  {
 +
    <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"debugSkillInfo"</span>))
 +
    {
 +
      [[Engine Function:_deleteArray|<span style="color:#FF0000;font-weight:bold">deleteArray</span>]](0x00);
 +
    }
 +
    <span style="color:#0000FF">if</span> ([[Engine Function:_isArrayInit|<span style="color:#FF0000;font-weight:bold">isArrayInit</span>]](0x00))
 +
    {
 +
      <span style="color:#0000FF">return</span> ();
 +
    }
 +
    <span style="color:#0000FF">list</span> Q4Y9 = 0x00, 0x01, <span style="color:#800000">"COL_NAME"</span>, 0x03, 0x04, 0x05;
 +
    [[Engine Function:_initArray|<span style="color:#FF0000;font-weight:bold">initArray</span>]](0x00, 0x06, 0x3D, Q4Y9);
 +
    <span style="color:#0000FF">int</span> Q5NY = 0x00;
 +
    Q4Y9 = 0x0FAF, 0x00, <span style="color:#800000">"Repair an Item"</span>, 0x00;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x13ED, 0x36, <span style="color:#800000">"Build Armor"</span>, 0x01;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x13EC, 0x36, <span style="color:#800000">"Build Ring Armor"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x13EB, 0x13EF, 0x13F0, 0x13EC;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x13BF, 0x36, <span style="color:#800000">"Build Chain Armor"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x13BB, 0x13BE, 0x13BF;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x1415, 0x36, <span style="color:#800000">"Build Plate Armor"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x1408, 0x36, <span style="color:#800000">"Build Helmets"</span>, 0x03;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x140A, 0x140C, 0x140E, 0x1408, 0x1412;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x03, Q4Y9);
 +
    Q4Y9 = 0x1413, 0x1414, 0x1410, 0x1411, 0x1415, 0x1C04;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x1B74, 0x36, <span style="color:#800000">"Build Shields"</span>, 0x01;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x1B73, 0x1B72, 0x1B7B, 0x1B78, 0x1B74, 0x1B76;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x01, Q4Y9);
 +
    Q4Y9 = 0x0F45, 0x36, <span style="color:#800000">"Build Weapons"</span>, 0x01;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x0F61, 0x36, <span style="color:#800000">"Build Blades"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x0F51, 0x1441, 0x13FF, 0x1401, 0x13B6, 0x0F5E, 0x0F61, 0x13B9;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x13FB, 0x36, <span style="color:#800000">"Build Axes"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x0F47, 0x0F49, 0x0F45, 0x1443, 0x0F4B, 0x13FB, 0x13B0;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x0F4D, 0x36, <span style="color:#800000">"Build Pole Arms"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x1403, 0x0F62, 0x1405, 0x0F4D, 0x143F;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    Q4Y9 = 0x1407, 0x36, <span style="color:#800000">"Build Bludgeoning Weapons"</span>, 0x02;
 +
    [[Engine Function:_setArrayElems|<span style="color:#FF0000;font-weight:bold">setArrayElems</span>]](0x00, 0x00, Q5NY, Q4Y9);
 +
    Q5NY++;
 +
    Q4Y9 = 0x0F5C, 0x143B, 0x1407, 0x1439, 0x143D;
 +
    Q5NY = [[Script_Function:_Q4Y7|<span style="color:#2B91AF">Q4Y7</span>]](Q5NY, 0x02, Q4Y9);
 +
    debugMessage(<span style="color:#800000">"BlackSmithing Loaded:  Allocated Rows= "</span> + 0x3D + <span style="color:#800000">" Computed Rows:"</span> + Q5NY);
 +
    <span style="color:#0000FF">int</span> Q576 = 0x000F4240;
 +
    <span style="color:#0000FF">int</span> Q55T = 0x00;
 +
    <span style="color:#0000FF">int</span> i;
 +
    <span style="color:#0000FF">int</span> val;
 +
    <span style="color:#0000FF">int</span> Q577;
 +
    <span style="color:#0000FF">int</span> Q567;
 +
    for(i = 0x01; i < Q5NY; i++)
 +
    {
 +
      <span style="color:#0000FF">if</span> ([[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x01, i) != 0x36)
 +
      {
 +
        val = [[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x05, i);
 +
        <span style="color:#0000FF">if</span> (Q55T < val)
 +
        {
 +
          Q55T = val;
 +
          Q567 = [[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x00, i);
 +
        }
 +
        <span style="color:#0000FF">if</span> (Q576 > val)
 +
        {
 +
          Q576 = val;
 +
          Q577 = [[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x00, i);
 +
        }
 +
      }
 +
    }
 +
    debugMessage(<span style="color:#800000">"Min Value="</span> + Q576 + <span style="color:#800000">" ("</span> + Q577 + <span style="color:#800000">") Max Value="</span> + Q55T + <span style="color:#800000">" ("</span> + Q567 + <span style="color:#800000">")"</span>);
 +
    <span style="color:#0000FF">int</span> range = Q55T - Q576;
 +
    for(i = 0x01; i < Q5NY; i++)
 +
    {
 +
      <span style="color:#0000FF">if</span> ([[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x01, i) != 0x36)
 +
      {
 +
        val = [[Engine Function:_getArrayIntElem|<span style="color:#FF0000;font-weight:bold">getArrayIntElem</span>]](0x00, 0x05, i);
 +
        <span style="color:#0000FF">int</span> Q4IA = (val - Q576) * 0x03E8 / range;
 +
        [[Engine Function:_setArrayIntElem|<span style="color:#FF0000;font-weight:bold">setArrayIntElem</span>]](0x00, 0x05, i, Q4IA);
 +
      }
 
     }
 
     }
 
     <span style="color:#0000FF">return</span> ();
 
     <span style="color:#0000FF">return</span> ();
 
   }
 
   }

Latest revision as of 17:42, 12 October 2018

 function void Q4Y8()
 {
   deleteArray(0x01);
   if (isArrayInit(0x01))
   {
     return ();
   }
   list Q4DS = 0x00, "COL_NAME", 0x02, 0x03, "COL_ACTION";
   initArray(0x01, 0x05, 0x05, Q4DS);
   setArrayIntElem(0x01, 0x00, 0x00, 0x0DE1);
   setArrayIntElem(0x01, 0x02, 0x00, 0x00 - 0x03E8);
   setArrayIntElem(0x01, 0x00, 0x01, 0x1BD4);
   setArrayIntElem(0x01, 0x02, 0x01, 0x00);
   setArrayStrElem(0x01, 0x01, 0x01, "Arrow shafts using all wood");
   setArrayStrElem(0x01, 0x04, 0x01, "shafts");
   setArrayIntElem(0x01, 0x00, 0x02, 0x13B2);
   setArrayIntElem(0x01, 0x02, 0x02, 0x012C);
   setArrayIntElem(0x01, 0x00, 0x03, 0x0F4F);
   setArrayIntElem(0x01, 0x02, 0x03, 0x0258);
   setArrayIntElem(0x01, 0x00, 0x04, 0x13FD);
   setArrayIntElem(0x01, 0x02, 0x04, 0x0384);
   for(int i = 0x00; i < 0x05; i++)
   {
     int Q65M = getArrayIntElem(0x01, 0x00, i);
     obj Q61Z = createNoResObjectAt(Q65M, getLocation(this));
     int wood = 0x00;
     int Q4Q1 = getResource(wood, Q61Z, "wood", 0x03, 0x00);
     setArrayIntElem(0x01, 0x03, i, wood);
     deleteObject(Q61Z);
   }
   return ();
 }
 function void Q4Y8()
 {
   if (hasObjVar(this, "debugSkillInfo"))
   {
     deleteArray(0x00);
   }
   if (isArrayInit(0x00))
   {
     return ();
   }
   list Q4Y9 = 0x00, 0x01, "COL_NAME", 0x03, 0x04, 0x05;
   initArray(0x00, 0x06, 0x3D, Q4Y9);
   int Q5NY = 0x00;
   Q4Y9 = 0x0FAF, 0x00, "Repair an Item", 0x00;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x13ED, 0x36, "Build Armor", 0x01;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x13EC, 0x36, "Build Ring Armor", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x13EB, 0x13EF, 0x13F0, 0x13EC;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x13BF, 0x36, "Build Chain Armor", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x13BB, 0x13BE, 0x13BF;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x1415, 0x36, "Build Plate Armor", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x1408, 0x36, "Build Helmets", 0x03;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x140A, 0x140C, 0x140E, 0x1408, 0x1412;
   Q5NY = Q4Y7(Q5NY, 0x03, Q4Y9);
   Q4Y9 = 0x1413, 0x1414, 0x1410, 0x1411, 0x1415, 0x1C04;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x1B74, 0x36, "Build Shields", 0x01;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x1B73, 0x1B72, 0x1B7B, 0x1B78, 0x1B74, 0x1B76;
   Q5NY = Q4Y7(Q5NY, 0x01, Q4Y9);
   Q4Y9 = 0x0F45, 0x36, "Build Weapons", 0x01;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x0F61, 0x36, "Build Blades", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x0F51, 0x1441, 0x13FF, 0x1401, 0x13B6, 0x0F5E, 0x0F61, 0x13B9;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x13FB, 0x36, "Build Axes", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x0F47, 0x0F49, 0x0F45, 0x1443, 0x0F4B, 0x13FB, 0x13B0;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x0F4D, 0x36, "Build Pole Arms", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x1403, 0x0F62, 0x1405, 0x0F4D, 0x143F;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   Q4Y9 = 0x1407, 0x36, "Build Bludgeoning Weapons", 0x02;
   setArrayElems(0x00, 0x00, Q5NY, Q4Y9);
   Q5NY++;
   Q4Y9 = 0x0F5C, 0x143B, 0x1407, 0x1439, 0x143D;
   Q5NY = Q4Y7(Q5NY, 0x02, Q4Y9);
   debugMessage("BlackSmithing Loaded:  Allocated Rows= " + 0x3D + " Computed Rows:" + Q5NY);
   int Q576 = 0x000F4240;
   int Q55T = 0x00;
   int i;
   int val;
   int Q577;
   int Q567;
   for(i = 0x01; i < Q5NY; i++)
   {
     if (getArrayIntElem(0x00, 0x01, i) != 0x36)
     {
       val = getArrayIntElem(0x00, 0x05, i);
       if (Q55T < val)
       {
         Q55T = val;
         Q567 = getArrayIntElem(0x00, 0x00, i);
       }
       if (Q576 > val)
       {
         Q576 = val;
         Q577 = getArrayIntElem(0x00, 0x00, i);
       }
     }
   }
   debugMessage("Min Value=" + Q576 + " (" + Q577 + ") Max Value=" + Q55T + " (" + Q567 + ")");
   int range = Q55T - Q576;
   for(i = 0x01; i < Q5NY; i++)
   {
     if (getArrayIntElem(0x00, 0x01, i) != 0x36)
     {
       val = getArrayIntElem(0x00, 0x05, i);
       int Q4IA = (val - Q576) * 0x03E8 / range;
       setArrayIntElem(0x00, 0x05, i, Q4IA);
     }
   }
   return ();
 }