Jump to content

Lineage 2 GF AI Decompiler


Recommended Posts

I think there is no point to be so pathetic. I'm trying to help you to complete this big work finally, since you've made it public, and probably you want it to be as much usable as it could be.

 

Have to remove your smile mod, since it's done for all cases, instead of doing it properly, where it's needed. But let's skip it finally.

 

I don't know which diff you are using, and don't want to know, but it's obvious that this diff is not right.

 

Ors are missed in about 20 classes (corpse_of_kurtz 1 of them)

 

image.thumb.png.d766045fc82ba21a21591c0da2396e37.png

 

More complicated case fairy_mymyu

image.thumb.png.0cf4bb1a4cba64aec10871763cbe01b0.png

 

image.thumb.png.2ab4c73e7de97d043718ba6eaa60b5ae.png

Empty parameers here and in quest_0503_imperial_gravekeeper , rodd

 

image.thumb.png.095b382c5c26269ccf994009b36f7de3.png

class party_leader_ag_casting_curse : party_leader_casting_curse

parameter_define_begin

parameter_define_end

 

 

Edited by MasterToma
Link to comment
Share on other sites

Const pushing looks like in wrong place (tor)

image.thumb.png.41e926900d1e38d167215ed89fd40f04.png

 

tutorial_quest_npc

original:

	push_const 4194304
	push_const 2097152
	bit_or
	push_const 8388608
	bit_or
	not
	bit_and
	assign

recompiled

	push_const 4194304
	not
    bit_and
	push_const 2097152
	bit_or
	push_const 8388608
	bit_or
	assign

 

Edited by MasterToma
Link to comment
Share on other sites

Great!

 

1. I've decompiled C1 ai.obj from leaked CHN server using @verbrannt's decompiler (branch c1-support)

2. Compiled back ai.nasc without any changes, using my C1 AI compiler

3. Splited compiled AI classes from original ai.obj and recompiled ai_decompiled.obj in separate files

4. Compared 2 directories (with ignore L\d* and fetch_i\s*//\s*(npc_)class_id

 

Here is result https://ibb.co/jSNsBy

 

Original obj code

1. extra jump is present in 10 files. This jump jumps to next line, so it's completely useless. Don't know, why compiler generates it

2. empty parameters in 4 classes (selected ones on picture) are present in original obj and missed after recompilation. This also could be ignored

class party_leader_ag_casting_curse : party_leader_casting_curse
parameter_define_begin
parameter_define_end
...

 

So, I could say, it's first decompiler for ai.obj, which works (I mean it) at least for C1. But in general, code syntax wasn't changed much in NAS language (I've checked compiler from C4 - only diagnostics were improved and few minor generator changes, but lexer/parser are the same).

 

 

 

Link to comment
Share on other sites

I would like to request minor (is it?) improvement.

 

There are a lot of cases, where strings are present inside decompiled NAS file. E.g.

	TelPosList Position = {
		{"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0}
	};

But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj

 

So, this should be like this

	TelPosList Position = {
		{1000003; -80749; 149834; -3043; 18000; 0}
	};

It allowed NCSoft to do script language-agnostic.

 

Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe

 

Edited by MasterToma
Link to comment
Share on other sites

9 hours ago, MasterToma said:

I would like to request minor (is it?) improvement.

 

There are a lot of cases, where strings are present inside decompiled NAS file. E.g.


	TelPosList Position = {
		{"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0}
	};

But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj

 

So, this should be like this


	TelPosList Position = {
		{1000003; -80749; 149834; -3043; 18000; 0}
	};

It allowed NCSoft to do script language-agnostic.

 

Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe

 

I've added issue for this. Result should have comment with original string like this:

 

{1000003; -80749; 149834; 0} // 1000003 - 古鲁丁城镇

Edited by verbrannt
  • Upvote 1
Link to comment
Share on other sites

New release: https://github.com/madyanov/nasc-decompiler/releases/tag/v1.5

 

  • Fixed broken precedence & associativity (thx @master-toma for feedback)
  • Recompiled AI now almost the same as original AI (at least C1, thx @master-toma for feedback)
  • GF AI now decompiles without errors (no ignored classes)
  • C1 datapack by @master-toma
  • GD datapack updates by @ChaosPaladin
  • Datapack format changes (enums.json -> pch.json, manual_pch.txt now parsed automatically)
  • AI chronicles now detected automatically
  • Added --output, --ignore & --config options
  • --chronicle option renamed to --chronicles

 

Decompiled AI examples: MEGA
Your feedback & PRs are welcome.

Edited by verbrannt
Link to comment
Share on other sites

46 minutes ago, zconll said:

Thanks you for the new update, for c1 support we have download c1-support  branch from repository?

 

Yeah, wrong release title :) C1 support now only in c1-support branch.

Link to comment
Share on other sites

Thank you, I see on decompiled code something weird, i use options "--chronicles=c1 --tree=0 --utf16le=1", as can you see show some KR/JP string on beginning all classes after "default_npc" class. This don't happen if use default encoded utf8 " --utf16le=0".

Quote

class default_npc {
parameter:
    int DesirePqSize = 50;
    int FavorListSize = 30;
    float IdleDesire_DecayRatio = 0.0;
    float MoveAround_DecayRatio = 0.0;
    float DoNothing_DecayRatio = 0.0;
    float Attack_DecayRatio = 0.0;
    float Chase_DecayRatio = 0.0;
    float Flee_DecayRatio = 0.0;
    float GetItem_DecayRatio = 0.0;
    float Follow_DecayRatio = 0.0;
    float Decaying_DecayRatio = 0.0;
    float MoveToWayPoint_DecayRatio = 0.0;
    float UseSkill_DecayRatio = 0.0;
    float MoveTo_DecayRatio = 0.0;
    float EffectAction_DecayRatio = 0.0;
    float IdleDesire_BoostValue = 0.0;
    float MoveAround_BoostValue = 0.0;
    float DoNothing_BoostValue = 0.0;
    float Attack_BoostValue = 0.0;
    float Chase_BoostValue = 0.0;
    float Flee_BoostValue = 0.0;
    float GetItem_BoostValue = 0.0;
    float Follow_BoostValue = 0.0;
    float Decaying_BoostValue = 0.0;
    float MoveToWayPoint_BoostValue = 0.0;
    float UseSkill_BoostValue = 0.0;
    float MoveTo_BoostValue = 0.0;
    float EffectAction_BoostValue = 0.0;
    
handler:
    EventHandler NO_DESIRE() {
    }

    EventHandler TALK_SELECTED(talker) {
        ShowPage(talker, "noquest.htm");
    }
}
挊氀愀猀猀 挀椀琀椀稀攀渀 㨀 搀攀昀愀甀氀琀开渀瀀挀 笀਀瀀愀爀愀洀攀琀攀爀㨀਀ऀ猀琀爀椀渀最 昀渀䠀椀 㴀 ∀挀栀椀⸀栀琀洀∀㬀਀ऀ਀栀愀渀搀氀攀爀㨀਀ऀ䔀瘀攀渀琀䠀愀渀搀氀攀爀 吀䄀䰀䬀䔀䐀⠀琀愀氀欀攀爀⤀ 笀਀ऀऀ匀栀漀眀倀愀最攀⠀琀愀氀欀攀爀Ⰰ 昀渀䠀椀⤀㬀਀ऀ紀਀紀਀਀class ticket_inspector : citizen {
}
挊氀愀猀猀 渀瀀挀开攀氀搀攀爀 㨀 挀椀琀椀稀攀渀 笀਀紀਀਀class ruler : citizen {
}

 

Link to comment
Share on other sites

12 minutes ago, zconll said:

Thank you, I see on decompiled code something weird, i use options "--chronicles=c1 --tree=0 --utf16le=1", as can you see show some KR/JP string on beginning all classes after "default_npc" class. This don't happen if use default encoded utf8 " --utf16le=0".

 

Fixed.

Link to comment
Share on other sites

On 7/18/2018 at 3:12 PM, MasterToma said:

I would like to request minor (is it?) improvement.

 

There are a lot of cases, where strings are present inside decompiled NAS file. E.g.


	TelPosList Position = {
		{"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0}
	};

But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj

 

So, this should be like this


	TelPosList Position = {
		{1000003; -80749; 149834; -3043; 18000; 0}
	};

It allowed NCSoft to do script language-agnostic.

 

Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe

 

 

After I've impletented this, I found, that compiler (GF by @eressea) doesn't work properly with {int, int, int, int} syntax of TelPosList property.
I've got many errors during compilation:
 

[d:\vss\globalbranch\work\overseas\ct2_final_0109\program\server\l2npc\fstring.h][112] Can't allocate buffer for fstring


Compiler allocates buffer only for first 38 strings, any next string in OBJ file is empty.
NASC that I'm trying to compile: https://mega.nz/#!WeA1WQKQ!2UxWCjQ8x6Y1IBFlJ7nvj8oIYQM6tKyESGleUmaOPhs

 

 

Edited by verbrannt
Link to comment
Share on other sites

14 hours ago, verbrannt said:

 

After I've impletented this, I found, that compiler (GF by @eressea) doesn't work properly with {int, int, int, int} syntax of TelPosList property.
I've got many errors during compilation:
 


[d:\vss\globalbranch\work\overseas\ct2_final_0109\program\server\l2npc\fstring.h][112] Can't allocate buffer for fstring


Compiler allocates buffer only for first 38 strings, any next string in OBJ file is empty.
NASC that I'm trying to compile: https://mega.nz/#!WeA1WQKQ!2UxWCjQ8x6Y1IBFlJ7nvj8oIYQM6tKyESGleUmaOPhs

 

 

 

Fixed - download http://download.l2shrine.com/MyExt64.dll

I'm getting errors about undefined variable talker - it's missing in handler arguments so compiler doesn't see it - first error I get for your AI is

07/22/2018 12:07:04.931, ERROR(780692) : Undeclared variable [talker]

Can you fix it somehow? :)
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

    • Instead of using encedc on it, try renaming it to "Icon.u" instead of "Icon.utx", and put it in your System folder. If it still crashes, the problem might be with your unrealed.
    • How's the project doing? Is there any news? It really interesting 🤔
    • thx for answer, i tried and woks encrypting, but i still having crashes 😞 i changed the icon in skillgrp.dat from "icon.skill0003" to "Myicons.misil" as i saved the file before endec and nothing. this is the report i got
    • New Season coming May 2024! First post updated      Website: L2Kain.net  Discord: https://discord.gg/l2kain  Wiki: https://info.kain.ws/   Important Dates   Server Start: TBD  Open Beta Test: 10th of May 2024!   Basic Information     Briefly about the concept of the server! We decided to move away from the standard Mid-Rate server concept and keep the mechanics of our beloved Lineage 2 that everyone loves! Massive battles for epic bosses, battles for profitable farming locations, resource spoilage and equipment crafting, daily instances, a balanced economy and much more. This server is build as a Craft-PvP concept. The goal is to gather players with a variety of preferences in the game and make a high-quality and interesting server with alternative character development options. We are well aware that "grinding" is an integral part of the game, but we diluted the boring and the same type of farming with interesting solutions and non-standard mechanics!   We have prepared a new High Five x25 on Modern Client for you. This server will be another step in the development of the platform and the project as a whole! Your appeals to those. support was not ignored, which means the new server will be even better than the previous one!      ⭐ Promotions and Bonuses for new players!     ⭐ Events and Giveaways daily!   ⭐ Rewards for Voting!   ℹ️ Server Rates Learn more about server rates! Server rates are configured in such a way that farming is best rewarded. Adena, drops, quests, various rewards and prices in the game store are well balanced among themselves!   Basic Server Rates:  ⭐ Experience & Skill Points - x25  ⭐ Adena Drop - x15 & Fixed Chance 66%  ⭐ Drop Rates - x10  ⭐ Spoil Rates - x10   Crafting keys, recipes drop & spoil with fixed amount from 2 to 3 and increased chances on all locations and quests  related to farm them.  ⭐ Quest Rates - x5  ⭐ Fortresses & Sieges - x5  ⭐ Raid Bosses & Epic Bosses - x1  ⭐ Weight Limit - x10      Connect with Us:  Discord: https://discord.gg/l2kain  Facebook: https://www.facebook.com/KainLineage2  TikTok: https://www.tiktok.com/@l2kain.net  YouTube: https://www.youtube.com/@Lineage2Kain
  • Topics

×
×
  • Create New...