Adding Blackguards

Scripts and support for your favorite MUD client.
Afu
Sojourner
Posts: 83
Joined: Sun Oct 01, 2017 3:58 pm

Adding Blackguards

Postby Afu » Wed Jan 31, 2018 4:27 pm

separating this because its important..

replace the script named "CheckMask"

Code: Select all

-------------------------------------------------
--         Put your Lua functions here.        --
--                                             --
-- Note that you can also use external Scripts --
-------------------------------------------------

-- The checkMask function returns true/false if a character is a member of a set of classes.

-- checkMask(xmask, xname)
--    xmask - name of the mask to use
-- xname - name to check, or nil (whoami)
-- Returns true if xname's class is a member of the set

-- Example: Adud is a warrior

-- if checkMask("rogue", "Adud") then
--      display("This won't happen because Adud isn't a rogue")
-- end

-- Not including a character name means the character logged in will be used

-- Example: Nyyrazzilyss (an illithid) is currently logged in

-- if checkMask("psi") then
--      display("Nyyrazzilyss is a psi")
-- end

   masks = {
      classes = { "War", "Blk", "Pal", "UNK", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      noPsi = { "War", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      nopriest = { "War", "Blk", "Pal", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      nocleric = { "War", "Blk", "Pal", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      psi = { "Psi" },
      enc = { "Enc" },
      war = { "War" },
      cle = { "Cle" },
      sha = { "Sha" },
      rog = { "Rog" },
      ill = { "Ill" },
      inv = { "Inv" },
      dru = { "Dru" },
      bar = { "Bar" },
      ctr = { "Ctr" },
      ran = { "Ran" },
      ele = { "Ele" },
      pal = { "Pal" },
      blk = { "Blk" },
      lic = { "Lic" },
      nec = { "Nec" },
      dire = { "Dir" },
      all = { "War", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      self = { "Enc", "Sha" },
      petrescue = { "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec" },
      traintanks = {"War", "Pal", "Blk", "Ran", "Dir", "Bar", "Ctr"},
      warrior = {"War", "Pal", "Blk"},
      fighter = {"War", "Pal", "Blk", "Ran", "Dir" },
      kicker = {"War", "Blk"},
      hitter = { "Rog", "Dir", "Ran", "Blk", "Pal" },
      hitterToRescue = { "Rog", "Dir", "Ran" },
      singer = {"Bar", "Ctr"},
      autobless = {"Bar", "Ctr"},
      autohide = {"Psi", "Rog", "Ran"},
      hitterSinger = { "Rog", "Dir", "Ran", "Blk", "Pal", "Bar", "Ctr"},
      displace = { "Cle", "Dru", "Sha", "Ctr", "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" },
      rightWindow = {"UNK", "War", "Blk", "Pal", "Bar", "Ctr", "Dir", "Ran", "Rog"},
      caster = {"Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha" },
      mage = {"Enc", "Inv", "Lic", "Nec", "Ill", "Ele" },
      casterGlobe= {"Enc", "Nec", "Lic"},
      casterSinger = {"Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha", "Bar", "Ctr" },
      casterPsi = {"Psi", "Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha" },
      casterPsiSinger = {"Psi", "Dru", "Enc", "Inv", "Lic", "Nec", "Ill", "Ele", "Cle", "Sha", "Bar", "Ctr" },
      statHitter = {"War", "Pal", "Blk", "Ran", "Dir", "Bar", "Ctr", "Rog" },
      priest = {"Sha", "Dru", "Ctr", "Cle" },
      pray = {"Sha", "Dru", "Cle", "Blk", "Dir" },
      nonPriestCaster = { "Blk", "Dir" },
      rogue = {"Rog", "Bar", "Ctr"},
      petRescue = { "Psi", "Cle", "Enc", "Dru", "Lic", "Sha", "Inv", "Ill", "Ele",    "Nec", "Bar", "Ctr", "Rog", "Ran" },
      haster = { "Enc", "Nec", "Ele", "Lic" },
      summonmount = { "Blk", "Dir"},
      mountedCombat = { "Blk", "Dir"},
      tiavit = { "Sha", "Enc", "Ill", "Bar", "Ele", "Rog", "Nec", "Psi"},
      missile = { "Sha", "Ele", "Dir", "Enc", "Nec", "Inv", "Lic", "Ill", "Dru", "Ran" },
      hlarea = { "Cle", "Blk", "Pal", "Sha", "Ele", "Dir", "Enc", "Nec", "Inv", "Lic", "Ill", "Dru", "Ran" },
      ffire = { "Enc", "Ill", "Inv", "Dru", "Sha"},
      stoner = { "Sha", "Ele", "Enc" },
      venomer = { "Rog", "Blk" },
      dmgundead = { "Cle", "Nec", "Lic", "Pal"},
      necros = { "Lic", "Nec" }
         }

function checkMask(xmask, xname)
   local classname

   if xname == nil then
      xname = whoami()
   end

   classname = whoclass(xname) or "UNK"

   if masks[xmask] == nil then
      echoDebug("<red>[Error: mask " .. xmask .. " does not exist]\n")
      return
   end

   if table.contains( masks[xmask], classname ) then
      return(true)
   end

   return(false)
end


and then InitNyylib

Code: Select all

-------------------------------------------------
--         Put your Lua functions here.        --
--                                             --
-- Note that you can also use external Scripts --
-------------------------------------------------

NyyLIB = NyyLIB or {}

automem = automem or 0
   
function initNyyLIB()

   echo("\n\n\n")

   cecho([[<green>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO]])
   cecho("<green>THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE")
   cecho("<green>AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,")
   cecho("<green>TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN")
   cecho("<green>THE SOFTWARE.")

   echo("\n\n\n")

   cecho("<red>[Initializing NyyLIB...]\n")

   expandAlias("@version", false)

   NyyLIB.homedir = getMudletHomeDir() .. "\\" .. NyyLIB.version .. "\\"

   local WindowWidth, WindowHeight = getMainWindowSize()

   splashwindow = Geyser.Label:new({name="splash", x="10%", y="10%", width="50%", height="75%"})
   splashwindow:setStyleSheet([[border-image: url(]] .. mainpath("splash.png") .. [[)]])
   tempTimer(6, [[splashwindow:hide()]] )

   NyyLIB.areaTable = {}

   -- load list of all area names on the mud
   for line in io.lines(mainpath("arealist.txt")) do
      local areainfo = string.split(line, "   ")

      local areaid = areainfo[1]:trim()
      local areaname = areainfo[2]

      NyyLIB.areaTable[tonumber(areaid)] = areaname
   end

   -- loading charData table
   charData:load()

   NyyLIB.buttonarray = {}
   NyyLIB.leftbuttonarray = {}

   NyyLIB.deadpeople = NyyLIB.deadpeople or {}

   NyyLIB.initgui = false
   NyyLIB.ticktimer = 60

   if charData:get("style", true) then
      setStyle()
   end

   NyyLIB.classes = { "War", "UNK", "Blk", "Pal", "Cle", "Dru", "Sha", "Ctr",
     "Bar", "Enc", "Psi", "Inv", "Lic", "Ill", "Ele", "Nec", "Rog", "Dir", "Ran" }

   NyyLIB.fullclasslist = { {"Rogue", "Rog"},
                        {"Cleric", "Cle"},
                        {"Paladin", "Pal"},
                        {"Shaman", "Sha"},
                        {"Illusionist", "Ill"},
                        {"Ranger", "Ran"},
                        {"Lich", "Lic"},
                        {"Blackguard", "Blk"},
                        {"Necromancer", "Nec"},
                        {"Battlechanter", "Ctr"},
                        {"Invoker", "Inv"},
                        {"Enchanter", "Enc"},
                        {"Druid", "Dru"},
                        {"Warrior", "War"},
                        {"Elementalist", "Ele"},
                        {"Dire Raider", "Dir"},
                        {"Bard", "Bar"},
                        {"Psionicist", "Psi"}
                     }

   NyyLIB.fullracelist = { {"Human", "M"},
                           {"Barbarian", "M"},
                           {"Drow Elf", "M"},
                           {"Moon Elf", "M"},
                           {"Half-Elf", "M"},
                           {"Shield Dwarf", "M"},
                           {"Half-Orc", "M"},
                           {"Duergar", "M"},
                           {"Duergar Dwarf", "M"},
                           {"Gnome", "S"},
                           {"Halfling", "S"},
                           {"Ogre", "L"},
                           {"Troll", "M"},
                           {"Illithid", "M"},
                           {"Orc", "M"},
                           {"Yuan-Ti", "M"}
                        }

   NyyLIB.reversedirs   =   {
                     n   = "s",
                     e   = "w",
                     s   = "n",
                     w   = "e",
                     u   = "d",
                     d   = "u",
                    north = "south",
                    east = "west",
                    south = "north",
                    west = "east",
                    up = "down",
                    down = "up"
                     }

   NyyLIB.fulldirs = {
                           n = "north",
                           e = "east",
                           s = "south",
                           w = "west",
                           u = "up",
                           d = "down"
                        }


   NyyLIB.statuschar=""


   NyyLIB.damagelevels = { "Excellent", "Few Scratches", "Small Wounds", "Few Wounds", "nasty wounds", "Pretty Hurt", "Awful" }

   NyyLIB.torescue=""

   NyyLIB.psilag="none"

   loadwholist()

   opendb()

   createconsumabledb()
   
   demonnicOnStart()

   setBorder()

   -- enable mapper

   mudlet = mudlet or {}; mudlet.mapper_script = true
   expandAlias("@map init", false)

   -- only load mapfile if loaded map is < 35000 rooms i.e. not mudlet loaded mapfile

   if map:countRooms() < 35000 then
      map:loadMap()
   end

   NyyLIB.initcompleted = true

   registerAnonymousEventHandler("sysWindowResizeEvent", "GUIScripts")
   registerAnonymousEventHandler("newRoomEvent", "newRoomEvent")

   expandAlias("@stats reset", false)

   cecho ("<red>[NyyLIB initialized.]\n")
   echo("Account name: ")
end

function initFullData()
   echoDebug("<red>[initFullData called]\n")

   disableTrigger("scribenext")
   
   charData:init(whoami(), {}, true)

   charData:init("memcount", 0)
   charData:init("groupwindow", "split")
   charData:init("iconbar", "bottom")

   charData:init("statname", "unset")

   if NyyLIB.initgui == false then
      if NyyLIB.mapwindow == nil then
         cecho("<red>[error: mapwindow is nil]\n")
      else
         map:hide()
      end

      if whoami() == nil then
         cecho("<red>[error: whoami() is nil]\n")
      end

      if whoclass(whoami()) == nil then
         cecho("<red>[error: whoclass(whoami) is nil]\n")
      end

      local nx
      local label

      for nx=1, 20, 1 do
         label=findlabel("button" .. nx)

         if label ~= nil then
            label:hide()
         end
      end

      NyyLIB.buttonarray = {}

      initgui()

      -- call class initialization script (buttons)

      initClass()

      -- call custom initaliziation script 'initCustom()' if it exists

      if _G["initCustom"] ~= nil then
         _G["initCustom"]()
      else
         echoDebug("\n<red>[Custom script initCustom() does not exist]\n")
      end

      NyyLIB.initgui = true
   end
end

-- class initialization script (buttons)

function initClass()
   local fnInit="init" .. string.gsub(whoclass(whoami()), "-", "_")

   if _G[fnInit] ~= nil then
      _G[fnInit]()
   else
      echoDebug("\n<red>[Class script " .. fnInit .. " does not exist]\n")
   end
end

you will need http://sqlitebrowser.org/ for this part
gotta also do an insert into classes db

Code: Select all

INSERT INTO "classes" VALUES('Blackguard','Blk','Fighter','ANTI-WARRIOR');
Last edited by Afu on Mon Feb 19, 2018 4:29 am, edited 3 times in total.
Afu
Sojourner
Posts: 83
Joined: Sun Oct 01, 2017 3:58 pm

Re: Adding Blackguards

Postby Afu » Fri Feb 02, 2018 2:49 pm

First draft of a blkguard prompt

i dont have any on/off
i just tic my stuff out, like a jerk

triggers:
substring: You are using:
substring: <primary weapon>

Code: Select all

charData:set("twohanded", false)
cecho("<cyan> set onehanded")


substring: <wielding twohanded>

Code: Select all

charData:set("twohanded", true)
cecho("<cyan> set twohand")


luacode

Code: Select all

-------------------------------------------------
--         Put your Lua functions here.        --
--                                             --
-- Note that you can also use external Scripts --
-------------------------------------------------
function initBlk()
   addbutton("poisonRogue", 7, 30)

   powerAliases:addButtons()
end

function SpellsBlk()
   -- if fighting and no other spells cast damage spells
   if powerAliases:castDamage() then
      return
   end
end

function procPromptBlk()

  if not inCombat() or not Standing() or getCooldown() then
     return
   end
  --if timer:get("gcool") then
      --cecho("\n<cyan>*waiting*\n")
   -- return
  --end

   local hp=prompt:get("hp")
   local maxhp=prompt:get("maxhp")
   local percent=hp/maxhp
 
 
  if percent < .8 then
     if not timer:get("shadow_heal") and slotTwo() then
       mud:send("SH")
       timer:set("shadow_heal", 15)  -- Heal for 108 hit points
       gCool()
       cecho("\n<cyan>*shadow_heal*\n")
       return
    end
  end
   
  if percent < .6 then
    if not timer:get("soul_touch") then
      mud:send("SOT")
      timer:set("soul_touch", 6*61)   -- 1h or 2h vamp heal Deal 270 negative damage                           Mod: +270           
       gCool()
      cecho("\n<cyan>*soul_touch*\n")
      return
   end
  end

   if charData:get("level") >= 40 then
     if percent < .8 then
       if not timer:get("aura_of_death") and slotFive() then
         mud:send("AD")
         timer:set("aura_of_death", 95)  -- Heal for 108 hit points
         gCool()
         cecho("\n<cyan>*aura_of_death*\n")
         return
      end
    end
   end
   
   if twoHanded() then
    if charData:get("level") >= 5  then
       if not Bashed() and not timer:get("dominating_smite") then -- autobash
        mud:send("SS")
        timer:set("shattering_smite", 15)    -- 1h bash Strike with all weapons for 128% (Weapon, Shield, One handed) Mod: +28%   
         gCool()
        cecho("\n<cyan>*shattering_smite*\n")
        return
      end
      end
  else
--Shattering Smite                    Melee                Level 5
    if charData:get("level") >= 5  then
      if not Bashed() and not timer:get("dominating_smite") then -- autobash
        mud:send("DS")
        timer:set("dominating_smite", 15)
         gCool()
        cecho("\n<cyan>*dominating_smite*\n")
        return
      end
      end
   end
  -- handle heals first
   -- cuz im selfish
  if twoHanded() then
  -- handle bashes second
   -- cuz im not stupid

    if not Bashed() and not timer:get("dominating_smite") then -- autobash
      mud:send("SS")
      timer:set("shattering_smite", 15)    -- 1h bash Strike with all weapons for 128% (Weapon, Shield, One handed) Mod: +28%   
        gCool()
      cecho("\n<cyan>*shattering_smite*\n")
      return
    end
      --end            
      if charData:get("level") >= 30 then
        if not timer:get("scourge_of_agony") and slotFour() then
           mud:send("soa")
           timer:set("scourge_of_agony", 69) -- Deal offensive level 12 negative damage
         gCool()
           cecho("\n<cyan>*scourge_of_agony*\n")
           return
        end      
      end
      if charData:get("level") >= 30 then
      if not timer:get("uncontrolled_fury") and not timer:get("gcool") then
          mud:send("UF")
        timer:set("uncontrolled_fury", 45) -- 2h damage   Strike with all weapons for 331% (Weapon, Two handed) Radius: Large   
         gCool()
        cecho("\n<cyan>*uncontrolled_fury*\n")
           return
        end
      end
      if charData:get("level") >= 25 then
      if not timer:get("spirit_harrow") and not timer:get("gcool") then
          mud:send("SPH")
        timer:set("spirit_harrow", 40)  -- 2h Strike with all weapons for 254% (Weapon, Two handed) Radius: Medium Mod: +154%         
         gCool()
        cecho("\n<cyan>*spirit_harrow*\n")
           return
        end
      end
      if charData:get("level") >= 5  then
      if not timer:get("shattering_smite") and not timer:get("gcool") then
          mud:send("SS")
        timer:set("shattering_smite", 15) -- 2h bash Strike with all weapons for 408% (Weapon, Two handed) Mod: +308%       
         gCool()
        cecho("\n<cyan>*shattering_smite*\n")
           return
        end
      end
    if not timer:get("baleful_challenge") and not timer:get("gcool") then
        mud:send("BC")
      timer:set("baleful_challenge", 69)  -- 1h or 2h Taunt the target for 20 seconds                    Radius: Medium   
       gCool()
      cecho("\n<cyan>*baleful_challenge*\n")
         return
      end
    if not timer:get("vengeance_strike") and not timer:get("gcool") then
        mud:send("VS")
      timer:set("vengeance_strike", 15)   -- 1h or 2h Strike with all weapons for 254% (Weapon, Two handed) Radius: Small Mod: +154%   
        gCool()
      cecho("\n<cyan>*vengeance_strike*\n")
         return
      end
    if not timer:get("dread_smite") and not timer:get("gcool") then
        mud:send("DRS")
      timer:set("dread_smite", 6*60)  -- 1h or 2h Strike with all weapons for 562% (Weapon)          Mod: +462%         
        gCool()
      cecho("\n<cyan>*dread_smite*\n")
         return
    end      
      if not timer:get("corrupt_weapon") and slotThree() then
         mud:send("cw")
         timer:set("corrupt_weapon", 25)
        gCool()
         cecho("\n<cyan>*corrupt_weapon*\n")
         return
      end
      --end
     if charData:get("level") >= 30 then
        if not timer:get("scourge_of_agony") and slotFour() then
           mud:send("soa")
           timer:set("scourge_of_agony", 69)
         gCool()
           cecho("\n<cyan>*scourge_of_agony*\n")
           return
        end
      end
  else  -- One Handed
  -- handle bashes second
   -- cuz im not stupid
     if charData:get("level") >= 5  then
      if not Bashed() and not timer:get("dominating_smite") then -- autobash
        mud:send("DS")
        timer:set("dominating_smite", 15)
         gCool()
        cecho("\n<cyan>*dominating_smite*\n")
        return
      end
      end

      if charData:get("level") >= 15 and  percent < .9 then
        if not timer:get("dark_majesty") then
           mud:send("dm")
           timer:set("dark_majesty", 15)
         gCool()
         cecho("\n<cyan>*dark_majesty*\n")
           return
        end      
      end

      if percent < .9 then
         if not timer:get("plundering_smite") then
            mud:send("PS")
            timer:set("plundering_smite", 15)
         gCool()
            cecho("\n<cyan>*plundering_smite*\n")
            return
         end
      end         
      --end
      if charData:get("level") >= 30 then
        if not timer:get("scourge_of_agony") and slotFour() then
           mud:send("soa")
           timer:set("scourge_of_agony", 69) -- Deal offensive level 12 negative damage
         gCool()
           cecho("\n<cyan>*scourge_of_agony*\n")
           return
        end            
      end
      if not timer:get("dread_smite") then
         mud:send("DRS")
         timer:set("dread_smite", 5*61)
       gCool()
         cecho("\n<cyan>*dread_smite*\n")
         return
      end
      if charData:get("level") >= 30 then
        if not timer:get("frenzying_smite") then
           mud:send("fs")
           timer:set("frenzying_smite", 45)  -- 1h damage Strike with all weapons for 254% (Weapon, Shield, One handed) Mod: +154%
         gCool()
           cecho("\n<cyan>*frenzying_smite*\n")
           return
        end   
      end
   end
   if not timer:get("corrupt_weapon") and slotThree() then
     mud:send("cw")
      timer:set("corrupt_weapon", 30) -- Add melee power damage, combat hit, combat message trigger effect for 20 seconds
    gCool()
      cecho("\n<cyan>*corrupt_weapon*\n")
      return
   end   
end
Afu
Sojourner
Posts: 83
Joined: Sun Oct 01, 2017 3:58 pm

Re: Adding Blackguards

Postby Afu » Sun Feb 11, 2018 10:16 pm

macros


Code: Select all

-------------------------------------------------
--         Put your Lua functions here.        --
--                                             --
-- Note that you can also use external Scripts --
-------------------------------------------------
function Standing()
  if prompt:get("position") ~= "std" then
     return(false)
   else
     return(true)
  end
end

function Bashed()
  if prompt:get("enemyposition") ~= "std" then
     return(true)
   else
     return(false)
  end
end

function Tanking()
  if prompt:get("tank") ~= "" and prompt:get("tank") ~= whoami() then
    return(false)
  else
    return(true)
  end
end

function twoHanded()
  if charData:get("twohanded") then
     return(true)
   else
     return(false)
   end
end

function timerset(timer,time)
  timer:set(timer,time)
end

function slotOne()
  if spell:getSlot(1) > 0 then
    return(true)
  end
  return(false)
end

function slotTwo()
  if spell:getSlot(2) > 0 and charData:get("level") >= 10 then
    return(true)
  end
  return(false)
end

function slotThree()
  if spell:getSlot(3) > 0 and charData:get("level") >= 20 then
    return(true)
  end
  return(false)
end

function slotFour()
  if spell:getSlot(4) > 0 and charData:get("level") >= 30 then
    return(true)
  end
  return(false)
end

function slotFive()
  if spell:getSlot(5) > 0 and charData:get("level") >= 40 then
    return(true)
  end
  return(false)
end

function gCool()
  -- global cooldown
   timer:set("gcool", 5)
end

function getCooldown()
  return(tonumber(timer:get("gcool")))
end

function doTurnin()
  charData:set("needs_turnin", true)
   tempTimer(60, [[NextTrainStop()]])   
   mud:send("enter tower")
   cecho("\n<cyan>Waiting 60 seconds for turnin to complete\n")
   mud:send("gcmd waiting 60 seconds for turnin to complete")
end

function Turnin()
  return(charData:get("needs_turnin"))
end

function doneTurnin()
  charData:set("needs_turnin", false)
end

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 2 guests