Jump to content
  • 0

AI.OBJ Editor Gracia Epilogue


Question

8 answers to this question

Recommended Posts

  • 0
Posted
On 12/5/2018 at 12:38 AM, rteshima said:

The decompiler could execute it and modify the files that I wanted, but the compiler does not work for me.

 

You need one single NASC source file in UTF-16LE encoding, then it should work fine. If you're using split and/or UTF-8 options in decompiler, you'll have to write some script that will join and recode that into one single UTF-16LE file (in correct order).

  • 0
Posted
On 12/7/2018 at 4:58 PM, rteshima said:

uhh so complicated: / .. It might be that I'm not working because they are advext files?

 

I replied you in mail but as someone else might need it, I'll copy my response here as well:

 

 

Hi, it should run on Win Vista and newer and the single input NASC file has to be UTF-16LE.

 

I personally use split AI structure which looks like this

 

C:/l2/ai-src/default_npc.nasc

C:/l2/ai-src/default_npc/citizen.nasc

C:/l2/ai-src/default_npc/citizen/merchant.nasc

C:/l2/ai-src/default_npc/citizen/merchant/bandor.nasc

...

 

all these files are in UTF-8 without BOM (Byte Order Mask)

 

I also have NASC there:

 

C:/l2/nasc/compile.bat

C:/l2/nasc/l2npc/l2npc.exe

...

 

I join it, recode it to UTF-16LE and compile it with C:/l2/make.py:

 

#!/usr/bin/env python

# (C) 2017 L2Shrine.com

# Usage:
#
# If you need just some classes, run "make.py" and let it compile everything that's not up to date
# If you need to compile whole ai to get full ai.obj for server, run "make.py all"

from os import walk, stat, getcwd, system, mkdir, unlink
from codecs import open
from sys import stderr, argv
from glob import glob

makeAll = False
if len(argv) == 1:
    pass
elif len(argv) == 2:
    if argv[1] == "all":
        makeAll = True
    else:
        print >> stderr, "Usage: %s [all]" % (argv[0], )
        raise SystemExit(1)
else:
    print >> stderr, "Usage: %s [all]" % (argv[0], )
    raise SystemExit(1)

if makeAll:
    aiFilename = "ai"
else:
    aiFilename = "tmp"

cwd = getcwd()

def createPath(s):
    if s.startswith(u"\\\\?\\"):
        return s.replace("/", "\\")
    return u"\\\\?\\%s\\%s" % (cwd, s.replace("/", "\\"), )

files = []

for path, dirnames, filenames in walk(createPath("ai-src")):
    for i in filenames:
        srcPath = createPath("%s/%s" % (path, i, ))
        objPath = createPath("%s/%s" % (path[:len(cwd)+4] + path[len(cwd)+4:].replace("\\ai-src", "\\ai", 1), i.replace(".nasc", ".txt"), ))
        statSrc = stat(srcPath)
        try:
            if makeAll: raise Exception()
            statObj = stat(objPath)
        except:
            statObj = None
        if statObj == None or max(statSrc.st_ctime, statSrc.st_mtime) >= max(statObj.st_ctime, statObj.st_mtime):
            files.append(srcPath)

if not files:
    print "Everything up to date"
    raise SystemExit(0)

try:
    unlink("%s.obj" % (aiFilename, ))
except:
    pass
fw = open("%s.nasc" % (aiFilename, ), "w", "utf-16le")

required = set(files)
written = set()

if not makeAll:
    print >> stderr, "Going to compile:"

for i in files:
    if not makeAll:
        print >> stderr, "    %s" % (i.replace("\\", "/").split("/")[-1], )
    parts = i[len(createPath("ai-src/")):].replace("\\", "/").split("/")
    for j in xrange(len(parts)):
        if j != len(parts) - 1:
            filename = createPath("ai-src/%s.nasc" % ("/".join(parts[:j+1]), ))
        else:
            filename = createPath("ai-src/%s" % ("/".join(parts[:j+1]), ))

        if filename not in written:
            fw.write(open(filename).read())
            written.add(filename)

fw.close()

print >> stderr, "Compiling %d sources..." % (len(files), )

result = system("cd nasc && compile.bat ..\\%s.nasc" % (aiFilename, ))

err = glob("nasc/l2npc/log/err/*-01-npc*.log")
if err and len(open(err[0], "r").read()) > 0 or result > 0:
    print >> stderr, "Compilation failed"
    raise SystemExit(1)

curClass = None
fw = None
classes = [{}, {}]
outputDir = "ai"
for line in open("%s.obj" % (aiFilename, ), "r", "utf-16le"):
    line = line.strip("\n").strip("\r")
    if line.startswith("class"):
        if curClass == None:
            lineSplit = line.split()
            curClass = lineSplit[2]
            path = []
            if lineSplit[4] != "(null)":
                classes[int(lineSplit[1])][curClass] = lineSplit[4]
                parent = lineSplit[4]
                while True:
                    path.append(parent)
                    parent = classes[int(lineSplit[1])].get(parent)
                    if parent == None:
                        break
            path.append(outputDir)
            path.reverse()
            try:
                mkdir(createPath("/".join(path)))
            except WindowsError, e:
                if e.winerror != 183:
                    raise
            path.append(curClass)
            srcFilename = u"%s.nasc" % (createPath("/".join(path)), )
            srcFilename = srcFilename[:len(cwd)+4] + srcFilename[len(cwd)+4:].replace("%s\\" % (outputDir, ), "ai-src\\", 1)
            if srcFilename in required:
                filename = "%s.txt" % (createPath("/".join(path)), )
                fw = open(filename, "w")
        else:
            curClass = None

    if fw != None:
        print >> fw, line

    if curClass == None and fw != None:
        fw.close()
        fw = None

if not makeAll:
    #unlink("%s.nasc" % (aiFilename, )) # uncomment this if you don't need single NASC file
    #unlink("%s.obj" % (aiFilename, )) # uncomment this if you don't need ai.obj file
    pass

print >> stderr, "Done!"

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • so whitch plan is it? because in here is one price and in ur websit is another...
    • Ты настолько смешон, что создал специально для этого левый аккаунт?)))  ты не стоишь даже капли с моего члена что бы я ради тебя писал что-то на анг)  Человек видимо облажался с запуском, слил бабки в помойку теперь с горящей жопой бегает по форуму и не знает кого обвинить))))) перечитай что я тебе написал, мне насрать на тебя на твой сервер и на то что ты там выложил)  это все дерьмо неактуально уже давно, скажу тебе если твоя тупая голова это не поняла, АКТУАЛЬНОЕ НИКТО НЕ ПРОДАЕТ, потому что любая продажа это = шара, все что продается ЭТО ОТЪЕЗЖЕННОЕ ГОВНО которое не нужно хозяину, старое как твои обвисшие от гнева сиськи    
    • L2 HARMONY - BANNERS & ICONS       L2 COLD - NPC ANIMATED BANNER
    • LA ERA DE EINHASAD - Lineage 2 en Castellano Lineage II Crónica 4: Vástagos del Destino x5 - Main Class - Full Craft ───────────────────────────── La diosa Einhasad ha despertado... Una nueva era comienza para los verdaderos aventureros. Un mundo completamente traducido al español, fiel al Lineage II original, creado para una comunidad hispanohablante unida por la nostalgia y la pasión. ───────────────────────────── APERTURA OFICIAL: 14 de NOVIEMBRE - 20:00hs (GMT-3) ───────────────────────────── INFORMACIÓN PRINCIPAL Rates: x5 Tipo: Main Class Sistema: Full Craft Idioma: 100% Español (traducción completa del juego) Comunidad hispanohablante Balance original con mínimas modificaciones Buffer Offline, los jugadores pueden crear sus tiendas de buffs Progresión de crónicas cada 4 meses aprox. Economía estable - Sin Pay to Win - No venta de items/adena por donación Comunidad de 1.000 personas Anterior versión x1 duro casi 3 años con 952 IPs distintas de pico ───────────────────────────── CARACTERÍSTICAS DESTACADAS Experiencia fiel al Lineage II clásico, sin alteraciones invasivas Interfaz, diálogos y objetos completamente en español Ventana de comunidad con servicios personalizados y comercio por Monedas de Oro Olimpiadas, Épicos y Asedios originales Recompensas por votación, Eventos TVT con 3 arenas diferentes. Participan todos sin importar el nivel, pero dentro de la arena solo se atacan por rango cercano Soporte activo y presencia constante del administrador Tickets de soporte con atención rápida en Discord ante cualquier problema ───────────────────────────── ENLACES OFICIALES Website: La Era de Einhasad Discord: https://discord.com/invite/A6PtCCN2SF ───────────────────────────── Una comunidad unida por el idioma, la pasión y la nostalgia. Redescubrí Aden… en tu propio idioma. Bienvenido a La Era de Einhasad.  
  • 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