Jump to content

Gracia Final Decompiled & Fixed Ai


Recommended Posts

Hi everyone,

 

thanks to Sauron, I was able to decompile and manually fix the whole Gracia Final AI.

 

All sources can be compiled with MyExt64 compiler and the output seems completely right :) If you find any bug/error, please let me know.

 

Download here http://download.l2shrine.com/ai.tar.bz2

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

goog work eressea, could you share your complete ai.obj compiled from script folder?

from leaked pack is different i need to know which class were add by rgb-club for work with clean ai.

Link to comment
Share on other sites

goog work eressea, could you share your complete ai.obj compiled from script folder?

from leaked pack is different i need to know which class were add by rgb-club for work with clean ai.

 

Here you go http://download.l2shrine.com/ai.obj.bz2

Link to comment
Share on other sites

  • 3 weeks later...

How to build it?

 

You can either compile just one NASC file (but you'll have to add stubs for all base classes - you need just class definition + parameters used in subclasses) or you can join the whole thing into single NASC file and compile whole AI at the time:

#!/usr/bin/env python

# join NASC AI files to single NASC file

from os import walk, getcwd
from codecs import open

cwd = getcwd()
cwd = u"\\\\?\\%s" % (cwd, )

fw = open("ai.nasc", "w", "utf-16le")

for path, dirs, files in walk("%s\\ai-src" % (cwd, )):
    for file in files:
        print file
        fw.write(open("%s\\%s" % (path, file, ), "r", "utf-8").read())

fw.close()


Link to comment
Share on other sites

 

Build here this compiler?  http://download.l2shrine.com/compiler.zip

 

Yes (or you can buy compiler from AdvExt team for $100 :troll:)

Link to comment
Share on other sites

  • 1 month later...
  • 8 months later...

please help deompiled code:

Spoiler

		

		class 1 sia_premium : citizen
		parameter_define_begin
		    int nMoneyId1 4037
		    int nAmount1 150
		    int nDuration1 604800
		    float nAdenaRate1 1.500000
		    float nItemRate1 1.500000
		    float nSpoilRate1 1.500000
		    float nExpRate1 1.500000
		    float nSpRate1 1.500000		

		    int nMoneyId2 4037
		    int nAmount2 250
		    int nDuration2 1296000
		    float nAdenaRate2 1.500000
		    float nItemRate2 1.500000
		    float nSpoilRate2 1.500000
		    float nExpRate2 1.500000
		    float nSpRate2 1.500000		

		    int nMoneyId3 4037
		    int nAmount3 450
		    int nDuration3 2592000
		    float nAdenaRate3 1.500000
		    float nItemRate3 1.500000
		    float nSpoilRate3 1.500000
		    float nExpRate3 1.500000
		    float nSpRate3 1.500000
		    string fnOk "gmshop_premium_activated.htm"
		    string fnError "gmshop_premium_error.htm"
		    string fnAll "gmshop_premium_already.htm"
		parameter_define_end
		handler 32 349    //  MENU_SELECTED
		    variable_begin
		        "talker"
		        "ask"
		        "reply"
		        "myself"
		        "_choiceN"
		        "_code"
		        "_from_choice"
		    variable_end		

		    push_event
		    push_const 160
		    add
		    fetch_i4
		    push_const 360
		    equal
		    branch_false L18
		L0
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 0
		    func_call 184680556
		    shift_sp -2
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 1
		    func_call 184680556
		    shift_sp -2
		    push_const 0.800000
		    mul
		    greater_equal
		    push_reg_sp
		    fetch_i
		    branch_true L1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 2
		    func_call 184680556
		    shift_sp -2
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 3
		    func_call 184680556
		    shift_sp -2
		    push_const 0.800000
		    mul
		    greater_equal
		    or
		L1
		    branch_false L3
		L2
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 1118
		    func_call 184680517
		    shift_sp -2
		    shift_sp -1
		    exit_handler
		L3
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_const 144
		    add
		    fetch_i4
		    push_const 0
		    equal
		    branch_false L16
		L4
		    push_event
		    push_const 164
		    add
		    fetch_i4
		    push_const 1
		    equal
		    branch_false L8
		L5
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId1
		    func_call 184680579
		    shift_sp -2
		    push_parameter nAmount1
		    greater_equal
		    branch_false L7
		L6
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId1
		    push_parameter nAmount1
		    func_call 184746114
		    shift_sp -3
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nAdenaRate1
		    push_parameter nItemRate1
		    push_parameter nSpoilRate1
		    push_parameter nExpRate1
		    push_parameter nSpRate1
		    push_parameter nDuration1
		    func_call 185008561
		    shift_sp -7
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnOk
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L7
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnError
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L8
		    push_event
		    push_const 164
		    add
		    fetch_i4
		    push_const 2
		    equal
		    branch_false L12
		L9
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId2
		    func_call 184680579
		    shift_sp -2
		    push_parameter nAmount2
		    greater_equal
		    branch_false L11
		L10
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId2
		    push_parameter nAmount2
		    func_call 184746114
		    shift_sp -3
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nAdenaRate2
		    push_parameter nItemRate2
		    push_parameter nSpoilRate2
		    push_parameter nExpRate2
		    push_parameter nSpRate2
		    push_parameter nDuration2
		    func_call 185008561
		    shift_sp -7
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnOk
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L11
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnError
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L12
		    push_event
		    push_const 164
		    add
		    fetch_i4
		    push_const 3
		    equal
		    branch_false L17
		L13
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId3
		    func_call 184680579
		    shift_sp -2
		    push_parameter nAmount3
		    greater_equal
		    branch_false L15
		L14
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nMoneyId3
		    push_parameter nAmount3
		    func_call 184746114
		    shift_sp -3
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter nAdenaRate3
		    push_parameter nItemRate3
		    push_parameter nSpoilRate3
		    push_parameter nExpRate3
		    push_parameter nSpRate3
		    push_parameter nDuration3
		    func_call 185008561
		    shift_sp -7
		    shift_sp -1
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnOk
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L15
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnError
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		    jump L17
		L16
		    push_event
		    push_const 704
		    add
		    fetch_i
		    push_event
		    push_const 40
		    add
		    fetch_i
		    push_parameter fnAll
		    func_call 184680516
		    shift_sp -2
		    shift_sp -1
		L17
		    exit_handler
		L18
		    call_super
		handler_end		

		class_end		

 

Edited by webdes27
Link to comment
Share on other sites

Probably something like this but I can't figure out what variable is 144 on talker (CSharedCreatureData + 0x90) - you'll have to find it in your extender (it doesn't seem to be in C4 l2npc.exe):

set_compiler_opt base_event_type(@NTYPE_NPC_EVENT)

class sia_premium : citizen {
parameter:
	int nMoneyId1 = 4037;
	int nAmount1 = 150;
	int nDuration1 = 604800;
	float nAdenaRate1 = 1.500000;
	float nItemRate1 = 1.500000;
	float nSpoilRate1 = 1.500000;
	float nExpRate1 = 1.500000;
	float nSpRate1 = 1.500000;

	int nMoneyId2 = 4037;
	int nAmount2 = 250;
	int nDuration2 = 1296000;
	float nAdenaRate2 = 1.500000;
	float nItemRate2 = 1.500000;
	float nSpoilRate2 = 1.500000;
	float nExpRate2 = 1.500000;
	float nSpRate2 = 1.500000;

	int nMoneyId3 = 4037;
	int nAmount3 = 450;
	int nDuration3 = 2592000;
	float nAdenaRate3 = 1.500000;
	float nItemRate3 = 1.500000;
	float nSpoilRate3 = 1.500000;
	float nExpRate3 = 1.500000;
	float nSpRate3 = 1.500000;
	string fnOk = "gmshop_premium_activated.htm";
	string fnError = "gmshop_premium_error.htm";
	string fnAll = "gmshop_premium_already.htm";

handler:
	EventHandler MENU_SELECTED(talker, ask, reply)
	{
		if (ask == 360) {
			if (GetInventoryInfo(talker, 0) >= GetInventoryInfo(talker, 1) * 0.8
				|| GetInventoryInfo(talker, 2) >= GetInventoryInfo(talker, 3) * 0.8) {

				ShowSystemMessage(talker, 1118);
				return;
			}

			if (talker.unknown144 == 0) { // COULDN'T FIND OUT WHAT IS THIS - It's INT32 on CSharedCreatureData+0x90
				if (reply == 1) {
					if (OwnItemCount(talker, nMoneyId1) >= nAmount1) {
						DeleteItem1(talker, nMoneyId1, nAmount1)
						ChangeDynamicRates(talker, nAdenaRate1, nItemRate1,
							nSpoilRate1, nExpRate1, nSpRate1, nDuration1);
						ShowPage(talker, fnOk);
						return;
					} else {
						ShowPage(talker, fnError);
						return;
					}
				} else if (reply == 2) {
					if (OwnItemCount(talker, nMoneyId2) >= nAmount2) {
						DeleteItem1(talker, nMoneyId2, nAmount2)
						ChangeDynamicRates(talker, nAdenaRate2, nItemRate2,
							nSpoilRate2, nExpRate2, nSpRate2, nDuration2);
						ShowPage(talker, fnOk);
						return;
					} else {
						ShowPage(talker, fnError);
						return;
					}
				} else if (reply == 3) {
					if (OwnItemCount(talker, nMoneyId3) >= nAmount3) {
						DeleteItem1(talker, nMoneyId3, nAmount3)
						ChangeDynamicRates(talker, nAdenaRate3, nItemRate3,
							nSpoilRate3, nExpRate3, nSpRate3, nDuration3);
						ShowPage(talker, fnOk);
						return;
					} else {
						ShowPage(talker, fnError);
						return;
					}
				}
			} else {
				ShowPage(talker, fnAll);
			}
			return;
		}
		super();
	}
}

 

Link to comment
Share on other sites

This nasc code looks like from AdvExt. I do not know which extender you are working on, but looks like the "unknown144" is:

 

int CNPC::IsUserVip(CSharedCreatureData *c);

 

so try to replace like this:

 

if (talker.IsUserVip == 0)

 

cheers

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.
Note: Your post will require moderator approval before it will be visible.

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

    • Whatever @Tryskell said...   Unfortunately it is not 2005-2010 anymore... Most of the community from those days is "grown up" and probably does not play games anymore (or at least no MMOs). I think anything related to MMOs will be a nail in the coffin.   I understand that it is hard to let the thing you've built for years to "just die". I assume most people got into programming, so maybe you can try something in that direction. But then again, this is a very niche community.   We need to think of something to bring the people together. I think events may be really fun, but then you would probably need to add prizes n order for the people to participate.   So yea, just my 2 cents. Hopefully somebody can come up with some great idea so we can revive this place. I've already forgotten it for the last couple (5-6) years...
    • Thats an interface future. You can reach me out about this in discord: xbaus
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hoodservices https://campsite.bio/utchihaamkt
    • Both "MMO genre" AND "forums" are greatly deprecated those days. MMO genre, except very few games (TESO, WOW, BDO, FF14), is mostly "eaten" by fast paced games (aka games with 15-30min game parties, they are numerous). See Twitch best games, I doubt the top 10 are MMOs. Adding more MMOs categories, while MMOs themselves got less population, isn't a bright idea. Also, in the past, there was multiple games categories - none actually worked out, so far. Forums type were replaced by Discord, mostly. You communicate faster, you got voice, you can group up and it's already thematized (by server, by guild, by game,...)... Unfortunately, there is nothing you can do about. You already did it multiple times without success (3 or 4 times at least ?). It's not due to staff. MMO forum is just "niche" nowadays, while 20 years ago it was "dope" and the thing to do. Your main problem is MxC is a community based on "nothing". It was first cheater dedicated, then mostly L2 development dedicated,... With a mix of random things here and there. The formula is lightly-themed as "community" (that's actually why you still have some ppl posting), and in same time community never was expanded to retain ppl (notably through MxC servers - no matter the game : L2, GTA, Conan Exiles, Lost Ark, whatever else). In the end, you end with "nothing", since people comes and goes (and mostly goes, since MMO isn't a thing anymore), but both MMO genre is greatly endangered by other types of games AND forums isn't the proper way to communicate in 2024. Actually, the only use of a forums compared to Discord is to search through archives, and the main point is it's a better "showcase" than Discord (a static website would end with the same output). The proposed formula will never work, or at best will attract greedy ppl.
    • Welcome to my store :https://ultrasstore11.mysellix.io/fr/ 2015-2022 Aged Discord Account 2015 Discord Account : 50.99 $ 2016 Discord Account : 10.50 $ 2017 Discord Account :4.99 $ 2018 Discord Account : 3.99 $ 2019 Discord Account : 2.99 $ 2020 Discord Account :1.99$ 2021 Discord Account :1.50$ 2022 Discord Account :0.99$ Warranty :Lifetime Payment Methods : Crypto/ PayPal Contact Me On Discord Or Telegram Discord :@ultrasstore11 Telegram : https://t.me/ultrastore11  
  • Topics

×
×
  • Create New...