Giter VIP home page Giter VIP logo

l2apf's Introduction

L2Apf

Lineage 2 C4 artificial player / framework (alpha).

You can implement desired behavior right inside entry script or use higher-level programs interface or connect actions/models/events to your neural network.

Requirements

  • Racket language (version 6 or newer).
    • Packages: srfi-lite-lib, r6rs-lib, yaml.
  • L2J Chronicle 4 server & datapack.
  • Lineage 2 Chronicle 4 installer & protocol 656 update.

Programs

Program is a potentially reusable algorithm that can be instantiated with parameters and shares state between iterations.

Iteration can be caused by a server event, custom event or timer event.

Program can be finite or not. Can be foreground or background. Only one foreground program can handle an iteration event but previous programs can be stacked on load.

Examples

Raid on Madness Beast.

Madness Beast

Scroll of Escape

Run minimalistic entry script for solo player:
racket -O 'debug@l2apf' player.scm.

Run a party of players (you are leader):
racket -O 'info@l2apf' _sdk/realm.scm config.yaml party.hunt.

player.scm
#lang racket
(require
	db/sqlite3
	"library/extension.scm"
	"system/structure.scm"
	"system/connection.scm"
	"system/event.scm"
	"system/debug.scm"
	"model/object.scm"
	"api/say.scm"
	(only-in "program/brain.scm"
		make-brain
		(brain-run! run!)
		(brain-load! load!)
		(brain-stop! stop!)
	)
	"program/idle.scm"
	"program/print.scm"
	"program/partying.scm"
	"bootstrap.scm"
)

(global-port-print-handler apf-print-handler)
(define db (sqlite3-connect #:database "apf.db" #:mode 'read-only))
(let-values (((cn wr me events) (bootstrap "localhost" 2106 "account" "password" "name" db)))
	(define br (make-brain cn (make-program-idle)))
	(load! br
		(make-program-print)
		(make-program-partying)
	)

	(do ((event (sync events) (sync events))) ((eq? (car event) 'disconnect))
		; Triggers space.
		(case-event event
			; Standard events.
			('creature-create (id) ; Unhide builder character on login.
				(when (and (= (object-id me) id) (> (ref me 'access-level) 0))
					(say cn "hide off" 'chat-channel/game-master)
				)
			)

			; Custom events.

		)

		; Programs space.
		(run! br event)
	)
)
config.yaml
host: "localhost"
password: "123456"
party:
  hunt: [doc, grumpy, happy]
  raid: [bashful, sleepy, sneezy, dopey]

* Some pieces of code may be outdated or not fully implemented but I sustain operability of core and basic flow.

Extension

You can implement missed packets/actions/events or update the project to higher server version with ease. You can even port this architecture to another game.

How to write a program

Start with:

(define (make-my-program)
	(make-program 'my-program
		(lambda (connection event state)
			; ...
		)
	)
)

Full syntax:

(define (make-my-program config-param1 . config-paramN)
	(make-program 'my-program
		(lambda (connection event state) ; Program iterator.
			; ...
		)
		#:constructor (lambda (connection) ; On load callback.
			; ...
		)
		#:destructor (lambda (connection state) ; On unload callback.
			; ...
		)
	)
)

For non-commertial use. In case of public use please indicate URL of original repo (https://github.com/EligiusSantori/L2Apf).

l2apf's People

Contributors

eligiussantori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

neo279 0xunk

l2apf's Issues

Multiple Protocol support

Hi,

I'd be interested in adding support for H5 Chronicle.

I am not really familiar with racket language but this project seems to be a lot of fun. I could simply override packets for H5, but maybe we could make it work on both H5/C4 and maybe other chronicles if needed?

Do you see a way to implement this?

Explanation about crypter.scm

Hi,

I am trying to implement a similar thing in Erlang (more bot oriented, but don't worry for a bot allowed server) and I have hard time with the crypter algorithm, I can't decrypt "in game" packet correctly. For Example in packet "CharInfo" the name is always messed up in the middle.

I have the feeling that the problem is the key increment that I get wrong. Unfortunately I cannot read Scheme that well and would like to ask you a pseudo code help about the crypter and most specifically the "update-key" function.

Regards,

Alokhan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.