Script Function: Q4M7

From Ultima Online: The Second Age
Revision as of 14:39, 12 October 2018 by Grimoric (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 function int Q4M7(obj this, obj speaker, string arg)
 {
   if (!isShopkeeper(this))
   {
     return (0x01);
   }
   loc Q4VS = getLocation(this);
   loc there = getLocation(speaker);
   if (getDistanceInTiles(Q4VS, there) > 0x03)
   {
     return (0x01);
   }
   list Q51Z;
   list Q5N8;
   list Q619;
   string Q618;
   string Q51Y;
   string Q60W;
   int Q4LG;
   int i;
   int Q518;
   int Q4QI;
   Q4QI = 0x00;
   Q51Z = "buy", "trade", "commerce", "merchant", "shop", "purchase", "business", "open", "shopkeeper", "trader", "tradesman", "shopkeep";
   split(Q619, arg);
   for(i = 0x00; i < numInList(Q619); i++)
   {
     for(Q518 = 0x00; Q518 < numInList(Q51Z); Q518++)
     {
       Q51Y = Q51Z[Q518];
       Q618 = Q619[i];
       if (Q618 == Q51Y)
       {
         Q4QI == 0x01;
       }
     }
   }
   if (!Q4QI)
   {
     return (0x01);
   }
   Q4QI = 0x00;
   if (hasObjVar(this, "myJobLocation"))
   {
     loc myJobLocation = getObjVar(this, "myJobLocation");
     if (hasObjVar(this, "myHomeShop"))
     {
       string myHomeShop = getObjVar(this, "myHomeShop");
       scoreToSpace(myHomeShop);
       list Q5GR;
       split(Q5GR, myHomeShop);
       myHomeShop = Q5GR[0x00];
       if (0x00)
       {
         bark(this, myHomeShop);
       }
       string Q4GC = "";
       list Q4FM;
       if (getSmallestArea(Q4GC, getLocation(this)))
       {
         scoreToSpace(Q4GC);
         split(Q4FM, Q4GC);
         Q4GC = Q4FM[0x00];
         if (0x00)
         {
           bark(this, Q4GC);
         }
       }
       if (Q4GC == myHomeShop)
       {
         Q4QI = 0x01;
       }
     }
     if (!Q4QI)
     {
       bark(this, "I am sorry, I do not have my wares here with me. Mayhap if thou didst catch me in my shop.");
       Q4J9(this);
       return (0x00);
     }
   }
   else
   {
     bark(this, "Alas, I have no shop! I cannot do business with thee.");
     Q4J9(this);
     return (0x00);
   }
   int guildMember = 0xFF;
   int Q5SW = 0xFE;
   if (hasObjVar(this, "guildMember"))
   {
     Q5SW = getObjVar(this, "guildMember");
   }
   if (hasObjVar(speaker, "guildMember"))
   {
     guildMember = getObjVar(speaker, "guildMember");
   }
   if (Q5SW == guildMember)
   {
     bark(this, "As thou'rt of my same guild, I shall discount my wares to thee.");
     Q4J9(this);
   }
   shopKeeperOpenBusiness(this, speaker);
   setObjVar(this, "wasAskedBuy", 0x01);
   Q4J9(this);
   return (0x01);
 }
 function int Q4M7(obj this, obj speaker, string arg)
 {
   if (!isShopkeeper(this))
   {
     return (0x01);
   }
   loc Q4VS = getLocation(this);
   loc there = getLocation(speaker);
   if (getDistanceInTiles(Q4VS, there) > 0x03)
   {
     return (0x01);
   }
   list Q619;
   string Q618;
   string Q51Y;
   string Q60W;
   int Q4LG;
   int i;
   int Q518;
   int Q4QI;
   int Q4QP;
   Q4QI = 0x00;
   Q4QP = 0x00;
   split(Q619, arg);
   if (hasShopKeyword(Q619))
   {
     Q4QI = 0x01;
   }
   if (isInList(Q619, "sell"))
   {
     if (0x01)
     {
       Q4QP = 0x01;
     }
   }
   if ((!Q4QI) && (!Q4QP))
   {
     return (0x01);
   }
   if (!getCompileFlag(0x01))
   {
     if (getNotoriety(speaker) < (0x00 - 0x5A))
     {
       bark(this, "I shall not treat with scum like thee!");
       return (0x00);
     }
   }
   else
   {
     if (isMurderer(speaker))
     {
       bark(this, "I shall not treat with scum like thee!");
       return (0x00);
     }
     if (getKarmaLevel(speaker) < (0x00 - 0x04))
     {
       bark(this, "I shall not treat with scum like thee!");
       return (0x00);
     }
   }
   Q4QI = 0x00;
   if (hasObjVar(this, "myJobLocation"))
   {
     loc myJobLocation = getObjVar(this, "myJobLocation");
     if (hasObjVar(this, "myHomeShop"))
     {
       string myHomeShop = getObjVar(this, "myHomeShop");
       scoreToSpace(myHomeShop);
       list Q5GR;
       split(Q5GR, myHomeShop);
       myHomeShop = Q5GR[0x00];
       if (0x00)
       {
         bark(this, myHomeShop);
       }
       string Q4GC = "";
       list Q4FM;
       if (getSmallestArea(Q4GC, getLocation(this)))
       {
         scoreToSpace(Q4GC);
         split(Q4FM, Q4GC);
         Q4GC = Q4FM[0x00];
         if (0x00)
         {
           bark(this, Q4GC);
         }
       }
       if (Q4GC == myHomeShop)
       {
         Q4QI = 0x01;
       }
     }
     if (hasObjVar(this, "NoRegion"))
     {
       Q4QI = 0x01;
     }
     if (!Q4QI)
     {
       bark(this, "I am sorry, I do not have my wares here with me. Let us go back to my shop.");
       if (hasObjVar(this, "myJobLocation"))
       {
         loc Q5SY = getObjVar(this, "myJobLocation");
         walkTo(this, Q5SY, 0x06);
       }
       return (0x00);
     }
   }
   else
   {
     bark(this, "Alas, I have no shop! I cannot do business with thee.");
     Q4J9(this);
     return (0x00);
   }
   int guildMember = 0xFF;
   int Q5SW = 0xFE;
   if (hasObjVar(this, "guildMember"))
   {
     Q5SW = getObjVar(this, "guildMember");
   }
   if (hasObjVar(speaker, "guildMember"))
   {
     guildMember = getObjVar(speaker, "guildMember");
   }
   if (Q5SW == guildMember)
   {
     bark(this, "As thou'rt of my same guild, I shall discount my wares to thee.");
     Q4J9(this);
   }
   if (Q4QP)
   {
     shopKeeperOpenBuying(this, speaker);
   }
   else
   {
     shopKeeperOpenBusiness(this, speaker);
   }
   setObjVar(this, "wasAskedBuy", 0x01);
   Q4J9(this);
   return (0x00);
 }