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!"

 

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
Answer this question...

×   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

    • In my opinion, L2 is dead because the people who make servers didn’t adapt to today’s reality. People are getting older, life moves faster, there are more responsibilities, and less free time. And I’m not even talking about newcomers—how can you expect someone new to this game to learn by Googling every drop location or quest requirement? These things should’ve been integrated into the game, made accessible with just a few clicks through the interface. Instead, so much time was wasted trying to recreate retail-like features that no one asked for. Everyone hates autofarm, but why? Because admins never found a smart way to implement it. You could have made it available only in specific zones, with reduced drops, working like Adrenaline, or auto-teleporting to farm for a limited time per day—just enough to help people with limited time stay relevant in-game. There should also be zones with better drops, where active farming actually matters. Other features feel pointless—like the Life Stone system. Spamming LS to get a skill? Instead, you could create a system where you level up the skill with low chances per level, something that feels progressive and fair. Crafting should be simpler too. Right-click a recipe, and the required materials should show up right there. As for sieges, why not create daily clan war events at peak hours—one for Europeans, one for Latinos? You could spawn crystals inside or outside castles that give points and trigger PvP. Add a boss during the event that gives even more points, and let the top clan in the ranking take the castle. I could go on forever, but what’s the point? The community died because the people who had the knowledge to improve the game just took the easy way out, copying the same server formula over and over until no one could enjoy playing it anymore.
    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
    • Do You understand the fact, I won't scam anyone? Can You grasp such idea?  Second of all, if a random restaurant on Google Maps has 599 positive reviews and few negative ones with 4,8* score, do You ask Google to block it's profile and burn the place down? No? Then why the fuck You are crying about my random delays? If someone can't get a CUSTOM DESIGN on time, I refund. I'm not 16  y.o. anymore. I don't make living out of this L2 bullshit. Never did. Since 2012 I've made shit tons of projects. How many delays did I have? 12? 15? Out of hundrets of projects. Calm Your tits please. If I would actually take 4k euro and NOT deliver and NOT refund - admins can ban me. So don't compare me to Simple. And just so You know, Celestine sent me customers, so it's not like I've worked with him on his account all the time. That's another thing You won't understand. I won't waste anymore time on You and any other cunt who never was my customer but is bitching just because he has nothing better to do in his life. You don't like my work? Hove along, I don't give a shit. 
  • Topics

×
×
  • Create New...