Jump to content

eressea

Legendary Member
  • Posts

    534
  • Credits

  • Joined

  • Last visited

  • Days Won

    7
  • Feedback

    0%

Posts posted by eressea

  1. if (condition)
       _var = 1;
    else
       _var = 2;

     

    This is pure evil, DON'T WRITE IT THIS WAY :) Yes, use the ternary operator or use the first (longer) way.

     

    Why? It's very simple. When someone else goes (or you go after few months) through your code and wants to add something to one of conditional branches, it could end up this way and nobody will probably notice until weird things happen:

    if (condition)
       _var = 1;
    else
       _var = 2;
       _var2 = 3;
    
    

    Of course the same applies for C/C++.

  2. Thanks you for this awesome share.

    For use your compiler i need to launch  server normally or can i compile only with l2npc and command ?

     

    if i run l2npc without command  l2npc dont load npcs only show window  with help about syntax usage

     

    Hi, you don't need have the server running (but it can run, it doesn't matter), just run (in command line):

     

    l2npc.exe file.nasc

     

    and it should compile. Just make sure you're in the right folder etc.

     

     

    Also some news, I've uploaded new version of the compiler http://download.l2shrine.com/compiler.zip and now it should be FULLY COMPATIBLE WITH ADVEXT. I've added all functions, handlers, CreatureData2 type and all new variables, so have fun :) The source is still on bitbucket https://bitbucket.org/l2shrine/extender-public

  3. I've added stubs for all new AdvExt functions: https://bitbucket.org/l2shrine/extender-public/commits/746b743bba9d2bb46bc74dc45a1317fa7129ab39

    Next step is adding stubs for new AdvExt handlers and variables, then it should compile with 100% compatibility with AdvExt! :)

     

    EDIT: Handlers added, now just those variables... It will be bit harder than handlers :)

  4. Do you have win32 knowledge? You know how to work in memory with C ? can you find the RVAs of functions with a debugger? Do you know what to look for?

     

    You need to be fluent in all above just to be a novice L2OFF extender developer

     

    I have started learning this 03/2016.

     

    I had almost zero win32 knowledge (in fact you need some 10 functions), I had little knowledge of debugging in anything else than gdb (with debug symbols; no asm, just C/C++), and my assembler skills were 20 years old (back then, it was just real mode of x86, not even 80386 protected mode and definitely not x64 asm, that was really new for me; nevertheless it's in fact less difficult than reading x86 asm because it uses just only one calling convention versus 3 different calling conventions on x86).

    Ok, I have some 15+ years of C and 10+ years of C++ but that was all MSDOS, Linux, BSD and iOS stuff :)

     

    So, lin2admin, you can learn it very fast if you're patient, inquiring and have some solid programming background.

    If you're able to write, let's say, HTTP server in C++, you'll be probable able to learn all this.

    If you're not, go start with it - write me a simple multithreaded HTTP server, it's nothing difficult and it's much easier than starting with writing extender ;)

  5. Hi everyone,

     

    I've made a brand new AI compiler for Gracia Final based servers (based on l2npc.exe)

     

    Download: http://download.l2shrine.com/compiler.zip

    Source: https://bitbucket.org/l2shrine/extender-public (the compiler is part of MyExt64 open source extender)

     

    Some basic info

    • it uses the official NASC syntax for Gracia Final, so
    • use class a : b, not class 0 a : b and define set_compiler_opt base_event_type(@NTYPE_NPC_EVENT) or set_compiler_opt base_event_type(@NTYPE_MAKER_EVENT)
    • use UTF-16LE input files
    • use myself.something, not myself::something
    • it should work the very same way as AdvExt compiler including all new functions, variables, handlers and types they've added
    • it also accepts PSTATE_, MSTATE_ ... constants
    • if you run l2npc.exe without command line parameters, it runs as a standard l2npc.exe (with MyExt64 extender)
    • if you run l2npc.exe with command line parameters, it runs as a compiler

    Enjoy!

    • Thanks 1
    • Upvote 3
  6. Tell me what you can edit the AI? Decompile and compile?

     

    You can either edit it manually in ai.obj (it's not easy but it works if you do it well) or decompile and recompile it.

    At the moment there is probably only one REALLY working decompiler made by Sauron as mentioned here http://www.maxcheaters.com/topic/203399-myext64-my-new-opensource-gracia-finalepilogue-extender/page-12?do=findComment&comment=2609299 and one working compiler that can be bought from AdvExt.

    I'm currently trying to implement the compiler too so it would be free for anyone...

  7. If you're ever bored for something to do eressea, L2NPC from GF contains the fully functioning lexer/parser for NASC compilation, just doesn't have the init procedures/constructors

     

    for compiling the hole ai.nasc you would need to do it with the built in compiler in npc.exe like someone already pointed out.

     

    Ok, I'm going to try it.

     

    I'm working with l2npc - extending it and calling code that invokes compilation instead of loading AI and spawning NPCs :)

     

    So far:

    • Allocated some space for the lexer/parser instance
    • Called constructor @ 0x5C9980 on parser instance
    • Called function @ 0x5BE2B4 on parser instance with parameter L"citizen.nasc" (prepares input file, returns true which means ok)
    • Called function @ 0x419D84 with parameter "ai.obj" (creates output file)
    • Called function @ 0x419E40 with parameters sizeof(void*), 69, 79, 2, 2, 0 (writes header)
    • NOW I'M MISSING SOMETHING HERE
    • Called function @ 0x5D7F70 on parser instance (compiles the program, returns 0 which means ok)
    • Checked UINT32 @ 0x37886C0 (error count, is 0 now)
    • Now it would have been done if I didn't miss the step I'm still missing

    ... work in progress ...

     

    If anyone has any additional info, let me know :)

     

    If I manage to make functional compiler for GF, I'll make it part of MyExt64 (so it will be open source).

  8. Ah, then good job :)

     

    I've looked into your code (thanks for added pdb file :)) and I've noticed this:

    • you should call srand only once
    • you shouldn't use just time() as parameter to srand, use something like srand(time(0) + _getpid()) or you'll generate the same password on two different machines when you run it in the same second
    • you should get the characters from one string like "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", not from 10 different "random" strings
    • you should generate the result to some std::string (just push_back those chars there until you have password long enough)

    Simply (pseudocode, not tested):

    
    #include <windows.h>
    #include <string>
    #include <stdlib.h>
    
    int main(int argc, char **argv)
    {
        srand(time(0) + _getpid()); // it would be better to obtain some more random seed - in UNIX, you should get this value from /dev/random
        std::string result;
        const std::string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        for (size_t i = 10 ; i ; --i) {
            result.push_back(chars[rand() % chars.size()]); // even this could be written better, using lowest bits isn't good for some pseudorandom generators
        }
        std::cout << "Random password: " << result << std::endl;
        return 0;
    }
    
    
    
  9. If you don't mind installing Python (btw, even if you can't code in it, it's the best available calculator)
    #!/usr/bin/env python
    
    CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    LENGTH = 10
    
    from random import seed, choice
    seed()
    print "".join([choice(CHARACTERS) for i in xrange(LENGTH)])
    
    
    

    Or maybe even better (taking length and chars from commandline arguments):

    #!/usr/bin/env python
    
    from sys import argv, stderr
    from random import seed, choice
    
    def usage():
        print >> stderr, "Usage: %s [LENGTH] [CHARACTERS]" % (argv[0], )
        raise SystemExit(1)
    
    LENGTH = 10
    CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    
    if len(argv) > 3: usage()
    
    if len(argv) == 2 and argv[1] in ["-h", "--help", "/h", "-?", "/?"]: usage()
    
    if len(argv) > 1:
        try:
            LENGTH = int(argv[1])
        except:
            usage()
    
    if len(argv) > 2:
        CHARACTERS = argv[2]
    
    seed()
    
    print "".join([choice(CHARACTERS) for i in xrange(LENGTH)])
    
    
    
  10. 
    

    30584 LineageNPC.e_guard_MOrc LineageNPCs.e_guard_MOrc_m00 4 LineageNPCsTex.e_guard_MOrc_m00_t00_b00 LineageNPCsTex.e_guard_MOrc_m00_t00_b01 LineageNPCsTex.e_guard_MOrc_m00_t00_f LineageNPCsTex.e_guard_MOrc_m00_t00_h 0 2 4416 17 1.20000005 0 3 ItemSound.fist_1 ItemSound.fist_2 ItemSound.fist_3 5 ItemSound.armor_metal_strong_2 ItemSound.armor_metal_strong_5 ItemSound.armor_metal_strong_8 ItemSound.armor_metal_alt_7 ItemSound.armor_metal_weak_5 3 ChrSound.MNpc_Giant_Dmg_1 ChrSound.MNpc_Giant_Dmg_2 ChrSound.MNpc_Giant_Dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 0 0

     

  11. Hello, weapon ids?

     

    Edit: Vapook got the weapon with id: 91 . At interlude it's fine

     

    If u wear (as char) this weapon, it's normally placed?

     

    Yes, it's 91. If you wear it, it's ok. Also Longhorn Golkonda wears it without any problem - so it seems like there's some problem with Vapook?

  12. hi i am new here and i came to learn about l2off development. I searched through the forum and guides didnt hemp match. Can you suggest a topic or somethink for me? 

     

    What do you want to learn? How to run server with extender made by someone else? How to change items, npcs, quests, ...? Or writing your own extender? What chronicle are you interested in?

×
×
  • Create New...