Jump to content

Recommended Posts

Posted

Hello

 

From time to time I like to pick one of the things that are being sold but are really easy to code and I like to code them real quick and share them.

Today's share is L2Warland's server-side Autofarm feature.

 

How it works

 

You set a few skills on the 10th shortcut skill bar

Each section represents a skill type

DanYtk4.png

 

  • Skill usage is prioritised (Feel free to change the order to whatever works for you)
    • Chance
    • Low life
    • Self skills
    • Attacks
  • You can toggle it or turn it on and of with voice commands .farm, .farmon, .farmoff
  • If HP or MP pots are present they will be used after the configurable thresholds are met
  • They will only target monsters that they can move to in order to attack
  • Players will automatically auto attack if the "Attack" action is on any bar. If not they will only use skills
  • Spoiler classes will spoil and sweeper
  • Self spells will be used if the effect is not present and the cooldown is not reached
  • Self spells will trigger toggle skills

 

I tested just the basics and it looks like it's working fine. If you find any issues please report them.

 

Video preview:

 

Coded for aCis 382

Source code: https://gist.github.com/Elfocrash/2afaa14089dfba2d2199c9d22f06d0d5

 

Disclaimer: This shares absolutely no code with the Autobots engine

 

Thanks, Elfo

  • Like 8
  • Thanks 2
  • Upvote 6
  • Downvote 1
Posted

I have the impression that you are not uploading this code to do us the favor of getting to know us, you just want to improve your password in the audience... I don't have you for such a good person Because what you have donated here is all in your interest

  • Like 1
Posted
5 hours ago, ShinichiYao said:

Nice share! Anyway to disable user action while autofarm is on such as mouse click move action use etc?

You could add the isAutoFarming check in the actions related packets and return. However, in case the autofarming gets stuck because of getodata or targeting I think it is a good idea to not block user actions while farming.

Posted

stop at teleport is missing, also l2off auto combat changes target if it hits "cannot see target" few times in row (due to idle monsters movements mid-casting, non LOS mobs are skipped there too) which is nice addition, simple ignoring of target if hp didnt change for set timeout would be good enough.

 

But yeah, another feature taken from classic client, instead of using classic client in the first place xD

Posted

l2off does LOS check only on target, then keeps using skils until target is dead.

I meant using classic client for beloved F1 interlude gameplay, not necessarily using anything else of classic

  • 2 months later...
Posted (edited)

Excellent mod, thanks for sharing !!
I should emphasize that I am a newbie to java development.
I have the following errors:

https://subefotos.com/ver/?fe6483091f3fb07495243e420548e312o.jpg

https://subefotos.com/ver/?b22846297d4afa6f2cd4b8282fb36280o.jpg

I would appreciate your help .. And sorry for my bad English. rev acis 382.

Edited by massedev
Posted (edited)

Dear Elfocrash, you are the MVP of MXC L2j development, if not on whole L2j

I remember seeing your work waaaay back like 10 years ago when I got into L2j myself

Huge thumbs up and thanks!

Edited by Griunvaldas
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • we all love you very much Guytis💖 🤗
    • W/e u smoke there, i want aswell... life has been cruel all this time! Maybe it will help me
    • I would like to take this opportunity to publicly apologize to the following people:   @Acacia, @Victory, @Splicho, @ShadowNetwork, @l2gold2025, @SkyLord, @maneco, @F4sh10n, @Maxtor, @Celestine, @911reg, @Nightw0lf. @UnknownSoldier   If at any point my words, actions, or posts offended you, I sincerely apologize. I recognize that in the past there were moments of tension and unnecessary conflict, but today I want to leave all of that behind. From now on, I choose not to hold any grudges against anyone and to let go of everything that happened — from both sides. The path I want to follow in this community is one of collaboration, mutual respect, and growth. Thank you to those who are still contributing and sharing. Sincerely,   Guytis
    • I found a dev , I will edit this post and start tomorrow as to build a 100 percent retail l2 Pride volos style like the old times   Features: Chronicle: Interlude  Xp:999 Sp:999 Adena:999 Start level : 80   Fast farming system : up to 3 hours for S grade equipment and up.to 5 days for later added 2 armor and weapon sets   Buff time 59mins all Full Npc buffer,  I will have buffers but with no heal close by for all areas  Reasonably priced Gm Shop, Gatekeeper, Free noblesse On death you dont lose sny materials and such except for very few if you P.k.   CP,hp,mp potion for 200 each   all players go from.No grade gear to S grade  with each different part of weapon , armor set,jewels,dyes,tattoos having different stats and such   Unique system of skills and little tweaks,     All classes of heroes have a fighting chance each with a different purpose and character..     All skills and deffus work for 70% chance of success and up  but for 4 to 7 sec each.   Many different areas of xp,sp and farm, 2 3 different farm pvp areas and all changing some. Days of the week, Also 2 party farm and pvp areas will be added.     All mini raid bosses and bosses have an hour respawn time.   As for special bosses  All have 1 hour almost  respawn time except for , Valakas and antharas with 3 hours.   And lastly  , 5 different events will be available for a good reward 5 times a day.  
    • Чтобы скачать файлы с сайта Akumu, вы можете использовать этот код на Node.js. Понадобятся два пакета: axios и cheerio.   это медленно, но делает свою работу   P.S. пропускает файл, если он присутствует и не изменен   const axios = require("axios"); const cheerio = require("cheerio"); const fs = require("fs/promises"); const path = require("path"); const BASE_URL = "http://akumu.ru/lineage2/L2NA/P746/"; const OUTPUT_DIR = "./downloaded"; async function delay(ms) { return new Promise((res) => setTimeout(res, ms)); } async function downloadFile(url, filepath) { // Skip download if file already exists and was not modified today try { const stat = await fs.stat(filepath); const mtime = stat.mtime; const today = new Date(); if ( mtime.getFullYear() === today.getFullYear() && mtime.getMonth() === today.getMonth() && mtime.getDate() === today.getDate() ) { // File was modified today, do not skip } else { console.log(`File exists, skipping: ${filepath}`); return false; // Indicate skipped } } catch (e) { // File does not exist, proceed to download } const writer = await fs.open(filepath, "w"); const response = await axios({ url, method: "GET", responseType: "stream" }); const totalLength = parseInt(response.headers['content-length'], 10); let downloadedLength = 0; let lastLogged = Date.now(); let lastDownloaded = 0; const lastModified = response.headers["last-modified"]; const mtime = lastModified ? new Date(lastModified) : new Date(); return new Promise((resolve, reject) => { const stream = writer.createWriteStream(); response.data.on('data', (chunk) => { downloadedLength += chunk.length; const now = Date.now(); if (now - lastLogged > 1000 || downloadedLength === totalLength) { const percent = totalLength ? ((downloadedLength / totalLength) * 100).toFixed(2) : 'N/A'; const speed = ((downloadedLength - lastDownloaded) / ((now - lastLogged) / 1000)) / 1024; // KB/s process.stdout.write(`\rDownloading ${path.basename(filepath)}: ${percent}% (${(downloadedLength/1024).toFixed(1)} KB/${totalLength ? (totalLength/1024).toFixed(1) : '?'} KB) ${(speed).toFixed(1)} KB/s `); lastLogged = now; lastDownloaded = downloadedLength; } }); response.data.pipe(stream); response.data.on("end", async () => { await writer.close(); process.stdout.write("\n"); // Set mtime and atime try { await fs.utimes(filepath, mtime, mtime); } catch (e) { console.warn( `Failed to set file timestamp for ${filepath}:`, e.message ); } resolve(true); // Indicate downloaded }); response.data.on("error", async (err) => { await writer.close(); reject(err); }); }); } async function crawlAndDownload(url, localPath) { console.log("Visiting:", url); // Ensure local path exists await fs.mkdir(localPath, { recursive: true }); const { data } = await axios.get(url); const $ = cheerio.load(data); const links = $("tbody a") .toArray() .map((el) => $(el).attr("href")) .filter((href) => href && href !== "../"); for (const href of links) { const fullUrl = new URL(href, url).href; const decodedHref = decodeURIComponent(href); const targetPath = path.join(localPath, decodedHref); if (href.endsWith("/")) { // It's a folder, recurse normally await crawlAndDownload(fullUrl, targetPath); } else { // It's a file, retry download indefinitely on failure while (true) { try { console.log("Downloading file:", fullUrl); const downloaded = await downloadFile(fullUrl, targetPath); if (downloaded) { await delay(1000); // Delay only if file was downloaded } break; // Success or skipped, exit retry loop } catch (err) { console.error( `Failed to download ${fullUrl}, retrying... Error: ${err.message}` ); // Optionally wait before retrying to be gentle on server await delay(3000); } } } } } crawlAndDownload(BASE_URL, OUTPUT_DIR) .then(() => console.log("Done!")) .catch((err) => console.error("Error:", err));
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock