Script Function: Q4M1

From Ultima Online: The Second Age
Revision as of 14:36, 12 October 2018 by Grimoric (talk | contribs) (Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> Q4M1(<span style="color:#0000FF">obj</span> this, <span style="color:#0000FF">obj</span>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 function void Q4M1(obj this, obj target, int mod)
 {
   if (!Q50K(this, target))
   {
     return ();
   }
   loc Q4VS = getLocation(this);
   loc Q60S = getLocation(target);
   int Q603 = getDistanceInTiles(Q4VS, Q60S);
   list memoryNotoriety;
   list memoryRecent;
   if (hasObjVar(this, "memoryNotoriety"))
   {
     getObjListVar(memoryNotoriety, this, "memoryNotoriety");
   }
   if (hasObjVar(this, "memoryRecent"))
   {
     getObjListVar(memoryRecent, this, "memoryRecent");
   }
   int Q4OW;
   if (!getCompileFlag(0x01))
   {
     Q4OW = getNotoriety(target) + mod;
   }
   else
   {
     Q4OW = getFame(target) + mod;
   }
   if (Q4OW < 0x00)
   {
     Q4OW = 0x00 - Q4OW;
   }
   list Q61Q;
   list Q63D;
   int Q45N;
   int Q61D;
   obj Q5ZK;
   list Q5H1;
   setItem(Q5H1, target, 0x00);
   setItem(Q5H1, Q4OW, 0x01);
   setItem(Q5H1, 0x00, 0x02);
   obj Q5H0;
   int Q55T = numInList(memoryNotoriety);
   if (0x00)
   {
     debugMessage("Updating memory of famous folks.");
   }
   for(int i = 0x00; i < Q55T; i++)
   {
     copyList(Q61Q, memoryNotoriety[i]);
     Q5ZK = Q61Q[0x00];
     Q5H0 = Q5H1[0x00];
     if (Q5ZK == Q5H0)
     {
       removeItem(memoryNotoriety, i);
       Q55T--;
       if (0x00)
       {
         debugMessage("Found this guy in notoriety memory, erasing.");
       }
       break;
     }
   }
   for(i = 0x00; i < Q55T; i++)
   {
     copyList(Q61Q, memoryNotoriety[i]);
     Q45N = Q61Q[0x02];
     Q61D = Q61Q[0x01];
     Q5ZK = Q61Q[0x00];
     Q45N++;
     setItem(Q61Q, Q45N, 0x02);
     setItem(memoryNotoriety, Q61Q, i);
     if ((Q61D - Q45N) <= Q4OW)
     {
       appendToList(Q63D, i);
       if (0x00)
       {
         debugMessage("Found someone to forget.");
       }
     }
   }
   if (numInList(Q63D) != 0x00)
   {
     int Q548 = 0x00;
     int Q549 = 0x0F;
     int Q61T;
     for(i = 0x00; i < numInList(Q63D); i++)
     {
       Q61T = Q63D[i];
       copyList(Q61Q, memoryNotoriety[Q61T]);
       Q45N = Q61Q[0x02];
       Q61D = Q61Q[0x01];
       if (Q61D < Q549)
       {
         Q548 = i;
         Q549 = Q61D;
       }
     }
     int Q60R = Q63D[Q548];
     removeItem(memoryNotoriety, Q60R);
     if (0x00)
     {
       debugMessage("Removing a forgettable person.");
     }
     appendToList(memoryNotoriety, Q5H1);
   }
   else
   {
     if (numInList(memoryNotoriety) < 0x0A)
     {
       appendToList(memoryNotoriety, Q5H1);
     }
   }
   setObjVar(this, "memoryNotoriety", memoryNotoriety);
   return ();
 }