Jump to content

Recommended Posts

Posted

Hello mates,

here we back again with a new guide, in this tutorial we will go beyond the rules (not forums rules lol), it could be useful for someone, useless for someone else, but .. i like to share things with you mates xD.

Oh God someone shut me up to cut this off and get started ….

It’s Really boring, don’t you think so ?

Well Lineage is getting old, same play style, same aspects, it needs a little refreshment, or maybe a rebirth, people keeps changing servers wishing for something to entertain them, so why not adapt few things from other games ?, actually let’s be more straight and honest LETS STEAL SOME IDEAS :D, but hold on for a second … there are some talented people already adapted some styles and armors and weapons …. etc, and some adapted some events or stuff…. why not you ? you can also adapt things it’s not that hard or impossible if we just thought out of the box .

In my opinion i’ll categorize adapting into two categories :

1. Client Adaption : Armors, Effects, Weapons, Interfaces …. etc . and i will not talk about this since it needs a good modeler and designer and i’m not 

2. Features Adaption : Like Events, Items, Play style …. etc. and this is what we will be learning, it’s just needs few things to get familiar with.

-------------------------------------------------------------------------------------------------------------

How to Get Started :

Well it’s Simple, but to get better understanding we need an example to apply what we learn on . so we gonna adapt an idea from another game in this guide.

There is a game called “Continent of Ninth Seal” , they keeps updating and adding new items and weapons every time , and one day they added a very good weapons, but some people was complaining about this, since after they got their weapons well enchanted and this is really hard to get, now they need to start over and enchant the new weapons from beginning ….. so they made a new feature which is Enchant Extraction. here is the link for the feature we gonna adapt : Transfer the Enhancement

How the Feature Works :

For example you have a weapon +16, and you need to change weapons, all you need to do is take your old weapon along with an item called “Weapon Enhancement Extraction Scroll” then go to blacksmith and put your old enhanced weapon with the scroll and you press a button, then your enhanced item will be destroyed and you will get what called “Transcendent Stone +16”, then u enhance the other weapon with this stone which will make it instantly +16 without fail.

Note : later they added update to lower the stone with 2 levels means +16 items will make +14 stone. because people started to enhance low items and when get ++++ then extract and add it to high item. also this feature made them sell very well since the Extraction Scroll is for about 7 Dollars.

-------------------------------------------------------------------------------------------------------------

The Game : 

Adapting such a feature is just a game that we gonna play together now,The Game of Thieves, we will play as thieves, oh you laughing at me now …. come on and trust me i’ll tell you how to be a good thief.

First let’s make a party and go in our mission…..

-------------------------------------------------------------------------------------------------------------

The Mission ( Prove Yourself ) :

Hello new thief .. in order to join the Adaption Mafia you have to prove yourself by Proving yourself as a skilled thief . Your first mission is :

 Our Gaming Spies confirmed that the developers of C9 is working on a new technology which will allow their players to extract their enhancements and contain the enhancement power into some kind of magic stone called “Transcendent Stone” , and with this stone they will be able to put this contained power on another weapon .. we don’t have much info about this technology .. and it is your mission to steal their papers and implement this feature to the mother of games “Lineage” ..

Our Spies was able to get into their game and was able to take 2 screenshot regarding the feature… use them wisely.

sc1.jpg

sc2.jpg

-----------------------------------------------------------------------------------------------------------------------

Oh , what we gonna do ?

“Start Small, Progress More”

It looks like tough mission, but let’s calm down and break this down into simpler steps, what this feature is about or what things that makes it :

Enhancement Panel : we already got this in our game

Extraction Panel or window : well we don’t have this too, and if we made it like an html with some bypasses it will looks so static, no real on screen interactions ….

Transcendent Stone : well we can easily create an Etc Item, but if it’s done this way we’ll have to create many of this since one for +1, another for +2, +3 …… etc . and this will so much we need a smarter way.

well what about create one Etc item and save it’s enhancement level somewhere in server or database … pfff but how players will know if it’s +12 or +10, it will has same name showing on the screen they can fool each others and sell a +1 stone as if it’s +100 stone, oh no we need another way.

Extraction Scroll : this could be the easier part all we need is to create an Etc Item

– Being able to move the enhancement from the Transcendent Stone to another weapon .

What about quit and say we can’t do this  ?  

-----------------------------------------------------------------------------------------------------------------------

Investigation :

“Use what you already have”

Before we start we need to make some investigation and see what tools we have and what we can make use of.

What things in lineage that “look like” this, this is the first thing you need to think about when you adapting anything to anything, not only Lineage but any software or system you develop, it’s like one of the basic rules in Software Development career is to use what you already have.

Extraction Panel : we need some kind of panel where player put two things, the weapon and the extraction scroll …. think, think, think ….. oh we have two things like this , Enchant panel and augment panel … i think we can use one of them

Transcendent Stone : we need an item with dynamic name to be like ” +6 Transcendent Stone or +10 Transcendent Stone”, hmmmmmmmmmm …. let’s do some brain storming … what items that part of it’s name controlled by server not the client …. why we didn’t thought about this ???? all armors, weapons and jewels has this feature they all can have the +xx thing

Extraction Scroll : it’s just an item man, nothing easier than this … wait wait wait .. i think about something, what about making this as a special enchant scroll, so when user click on it it will automatically pop up a window to select a weapon.

Enhance Back with Transcendent Stone : well we can just make it as enhancement scroll, but ….. we said we gonna make it like armors and weapon, how it can be for example a weapon and scroll in same time .

well we need a bit of analyzing , weapon when used they get equipped, scrolls when used they get an enhancement panel …. can’t we check on Equip Request that if it’s our stone then it override the equipping procedure and instead run the enhancement procedure ?? i think we can find a way around.

 -----------------------------------------------------------------------------------------------------------------------

The Plan :

“Going random is the best way to fail”

Our plan will split on multi tasks so we can work on one by one as follow

Stage .1 : (Preparation)

– Create a new UTX File containing the icons for our two items (Transcendent Stone and Extraction Scroll)

– Add Items to Itemname-e.dat file with proper names

– Add Transcendent Stone to Armorgrp.dat as accessory or something

– Add Extraction Scroll to EtcItemgrp.dat

– Add both Items to proper XML file in server data files

– Estimate current Stage Progress and Check if all work as expected

Stage .2 : (Think out of the Box)

– Handle player’s Equip action with Transcendent Stone to be forbidden and instead open Enhancement Panel

– Handle Enhance panel acceptance for our Transcendent Stone as Enhancement Scroll instead of Armor Part

– Handle Player’s Request of Confirming Enhance Process with Transcendent Stone

– Handle Usage of Extraction item differently than enhance scroll to extract Enhancement instead of Enhancing

– Clean up and Estimate current Stage Progress to Check if all work as expected

 -----------------------------------------------------------------------------------------------------------------------

~*- Challenge Accepted -*~

 -----------------------------------------------------------------------------------------------------------------------

Stage .1 :

– Create a new UTX File containing the icons for our two items (Transcendent Stone and Extraction Scroll)

Note : there are many tutorial on this forum about this thing so we will cover it fast.

Okay boss we’re on it … at this point we will need to use the screen shots from our spies to get the icons of both and crop them on any image processor, i’ll use Photoshop, also we will need to resize them to 32 by 32 pixels, and i’ll set my crop aspects on Photoshop to be 1×1 to avoid any ratio problems

1-1.jpg

After that we do same for the other one then we resize, in Photoshop i use shortcut CTRL+ALT+I

2-1.jpg

Now we will save both of them as TGA files, i don’t have the DDS plugin installed so i’ll save as TGA, and will name them as transcendent_stone_icon.tga and enhancement_extract_scroll.tga

3-1.jpg

then will close photoshop and go to open Unreal Editor and create new UTX File, will name MxCMission, then import the two TGA files we made (Take care of what highlighted Thanks to @Sinister Smile for helping with this)

5.png

Let’s Save this file and encrypt it. I’ll use L2Ninja to Encrypt as L2 UTX file

7.png

Now we add this file to our SysTextures Folder and Task Completed

-----------------------------------------------------------------------------------------------------------

– Add Items to Itemname-e.dat file with proper names

I’ll use L2Ninja Again to edit this file (you can use any editor) and add both items with ids 85850 and 85851, just any the id you want but be unique and make sure you remember them

-----------------------------------------------------------------------------------------------------------

– Add Transcendent Stone to Armorgrp.dat as accessory or something

After some investigations i found most armor items express their type for example Baium under it’s name you will see the word “Ring” and same for most armor items except ….. Belts, so because i’m a lazy coder i’ll copy any armorgrp belt code and modify it then add it again to armorgrp.dat, i wont write it from scratch it’s so dam long mate xD

So here is the code i copied and modified with our new item id and icon, so i used id of 85851 and icon MxCMission.transcendent_stone_icon

-----------------------------------------------------------------------------------------------------------

– Add Extraction Scroll to EtcItemgrp.dat

What about doing the same, i’ll just copy anything from that file and change id and icon xD , we can adjust this later .

-----------------------------------------------------------------------------------------------------------

– Add both Items to proper XML file in server data files

Now we need to add this items to Server XML files, so i’ll create an xml in data/stats/item and will name it mission.xml, then will add the proper code of both item

<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/items.xsd">
	<item id="85851" type="Armor" name="Transcendent Stone">
		<set name="icon" val="MxCMission.transcendent_stone_icon" />
		<set name="default_action" val="EQUIP" />
		<set name="armor_type" val="LIGHT" />
		<set name="bodypart" val="waist" />
		<set name="immediate_effect" val="true" />
		<set name="crystal_count" val="30" />
		<set name="crystal_type" val="A" />
		<set name="material" val="CLOTH" />
		<set name="weight" val="440" />
		<set name="price" val="371300" />
		<set name="enchant_enabled" val="1" />
	</item>
	<item id="85850" type="EtcItem" name="Enhancement Extraction Scroll">
		<set name="icon" val="MxCMission.enhancement_extract_scoll" />
		<set name="default_action" val="SKILL_REDUCE" />
		<set name="immediate_effect" val="true" />
		<set name="material" val="PAPER" />
		<set name="weight" val="120" />
		<set name="is_oly_restricted" val="true" />
		<set name="handler" val="EnchantScrolls" />
	</item>
</list>

-----------------------------------------------------------------------------------------------------------

– Estimate current Stage Progress and Check if all work as expected

Let’s Start our server and check the items we created …. Yeaaah it’s working and even when we use the Extraction scroll it opens the Enhancement Panel … this is a great start

9.jpg

 -----------------------------------------------------------------------------------------------------------------------

~*- Stage 1 Completed with Pleasure  -*~

 -----------------------------------------------------------------------------------------------------------------------

 

Stage .2 : (Think out of the Box)

JAVA TIME ….. this where things get more exciting but it can be messy so let me tell how things working in L2J so we can have better understanding about the process.

Quote

Everytime we need to changed something, we ask our self one question .. where can i start ? or where i can find the code that handle this thing to modify it ?

I’ll give you a little Hint about how to be on the right path without keep looking on internet or asking …

Please Focus on this Part … Everything in Lineage is based on something called Packets.

Consider a Packet as an Envelop that contain a letter being send from your Game Client as player to the Game Server and vice versa From Game Server to Game Client, this letters or packets can contain a request or information like for example You wanna Equip a Weapon so you double click on it :

Game Client > Game Server : Oh ! Hey Server i want to equip a weapon that has id 9999

Game Server > Game Client : Well, it’s looks fine and allowed for me, Okay No Problem Equip It.

Game Client > Game Server : Thank you mate, i have Equiped it, can you tell me my stats after Equip

Game Server > Game Client : Yes, Sure thing . Here is your stats …………….

This Sentences between client and server is pack , and we will talk about Two Types of Packets in L2J ServerPackets and ClientPackets.

Client Packets :  Are the Packets that sent from Client to Server, which located at java/com/l2jserver/gameserver/network/clientpackets

Server Packets : Are the Packets that sent from Server to Client, which located at java/com/l2jserver/gameserver/network/serverpackets

At This two locations all the magic starts to happen, you can really explore them and see where the code starts at every in-game action for example when we right clicked on “Enhancement Extraction Scroll” it sends a Client Packets called UseItem, so server will try to process this packets and see if it’s allowed or not and what this item about, it will say “Oh i see in my XML files that this items is EnchantScroll so let’s Open Enchant Panel” , this response from server is also a packet which is ChooseInventoryItem Packet, Then Player try to put his weapon into enchant item slot but it needs a permission so it send to server a Client Packet called RequestExTryToPutEnchantTargetItem, saying “Hello i wanna select this weapon as the Target item to Enchant, is this allowed ?” , At this point we can think of this Packet Java file maybe is the one responsible for  accepting or refusing , Let’s take a look and see if something useful , yes i found something interesting in this file :

10.png

Looks like the Yellow Area is just a normal checks, Red Area is where Server Refuse an Item, Green Area is where Server Accept an Item … Try also to Explore more in the Packets Packages that i have mentioned their locations before, at least read files names, it’s very useful to know what in there. So Let’s Start

-----------------------------------------------------------------------------------------------------------

– Handle Usage of Extraction item differently than enhance scroll to extract Enhancement instead of Enhancing

I Guess you know where we can go .. Yes RequestExTryToPutEnchantTargetItem.java and we need to make it not refuse our Extraction Scroll since if we try now to add any item to enhance with this scroll it will just refuse it, since it’s refusing the scroll it self . so here is the modifications i made,  replace  :

if ( (scrollTemplate == null) || !scrollTemplate.isValid(item, null))

with this :

if ( ((scrollTemplate == null) || !scrollTemplate.isValid(item, null)) && scroll.getId() != 85850 )

and then we need to add  this after the if statement block to check if the target item is good :

//Extraction Scroll
else if (scroll.getId() == 85850)
{
	boolean validProcess = true;
	if(!item.isWeapon())
	{ 
        	activeChar.sendMessage("You Can only Extract Enhancement From a Weapon");
        	validProcess = false;
        }
	else if (item.getEnchantLevel() <= 0)
	{
        	activeChar.sendMessage("There is no Enhancement on this Item to Extract.");
        	validProcess = false;	
	}
	//Finally if it's not valid for any Reason then Fail the process
	if(!validProcess) 
	{
        	activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_SCROLL_CONDITIONS);
		activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
		activeChar.sendPacket(new ExPutEnchantTargetItemResult(0));
        	return;
	}
}

So here what we have done :

11.png

---------------------------------------------------------------------------------------------------

– Handle player’s Equip action with Transcendent Stone to be forbidden and instead open Enhancement Panel

– Handle Enhance panel acceptance for our Transcendent Stone as Enhancement Scroll instead of Armor Part

We will do those steps together so instead of equip we will send a different packet and to do this we gonna modify UseItem.java Client Packet, so after

if (item == null)
{
	return;
}

We gonna add this check if it’s our Transcendent Stone, then don’t Equip and instead start enchanting with it :

//Forbidden to Equip Transcedent Stone
if(item.getId() == 85851)
{ 
	if (activeChar.isCastingNow())
	{ return; }
	if (activeChar.isEnchanting())
	{ 
		activeChar.sendPacket(SystemMessageId.ENCHANTMENT_ALREADY_IN_PROGRESS);
		return;
	}
	activeChar.setActiveEnchantItemId(item.getObjectId());
	activeChar.sendPacket(new ChooseInventoryItem(item.getId()));
	return;
}

Well it’s should pop up the Enchant Window, but it wont accept any item since it’s not an instance of EnchantScroll so we will need to make it able to accept weapons as target items like what we did with Extraction Scroll, so let’s Modify the code of RequestExTryToPutEnchantTargetItem Packet again and do another else if, and add the item id to the main if as we did before, so again we replace :

if ( ((scrollTemplate == null) || !scrollTemplate.isValid(item, null)) && scroll.getId() != 85850 )

with

if ( ((scrollTemplate == null) || !scrollTemplate.isValid(item, null)) && scroll.getId() != 85850 && scroll.getId() != 85851)

now we need to add another Else if after the one we added before :

//Transcendent Stone
else if(scroll.getId() == 85851)
{
	if(!item.isWeapon())
	{
		activeChar.sendMessage("Transcendent Stones are available only to be used with Weapons");
		activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
		activeChar.sendPacket(new ExPutEnchantTargetItemResult(0));
		return;
	}
}

---------------------------------------------------------------------------------------

– Handle Player’s Request of Confirming Enhance Process with Transcendent Stone

When a player use an Enchant item and then he add the Target item it’s time to press Start which will send the packet RequestEnchantItem, and since it’s sent by Client then it’s in ClientPackets , so let’s look at it’s code and see what trouble we can get through when we use this fake belt Transcendent Stone as Enchant Scroll :

1st : in this part it wont work since it’s not real scroll so wont have Template :

// template for scroll
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);

// scroll not found in list
if (scrollTemplate == null)
{
	return;
}

So we need to modify the if statement to be :

if (scrollTemplate == null && scroll.getId() != 85851)

Also later down we will find this code which will make our fake scroll not work, and will cause an Null Pointer Exception Error  since it will try to validate the target item against the scrollTemplate, and actually scrollTemplate is null since this is not a scroll and we skipped this check for being null before :

// first validation check
if (!scrollTemplate.isValid(item, supportTemplate))

So we need here to do this check only if it’s not Null, since it’s not null then it’s not our fake scroll, logically, so we replace it with :

if (scrollTemplate != null &&!scrollTemplate.isValid(item, supportTemplate))

Later if we scroll down, we will see something like this :

final EnchantResultType resultType = scrollTemplate.calculateSuccess(activeChar, item, supportTemplate);
switch (resultType)

Here we will notice few things as follow :

– First it lands EnchantResultType into resultType, so we need to land something of same type incase it’s our scroll and if you Right Click on EnchantResultType and choose Go To Definition (i guess this is it in Eclipse) or as i use NetBeans it’s CTRL+B, you will find that EnchantResultType has possible 3 values as enum (ERROR, SUCCESS, FAILURE), so maybe we will need to add another value to that enum for example TRANSCENDENT to be like this :

12.png

– Second it uses scrollTemplate and it maybe null so it will cause error so we need to check if it’s null or it’s our fake enchant item, and if it’s not null we do the regular procedure and if null and it’s our fake stone then we return TRANSCENDET value that we added , in this case i’ll use Ternary Operator :

final EnchantResultType resultType = (scrollTemplate == null) ? EnchantResultType.TRANSCENDENT : scrollTemplate.calculateSuccess(activeChar, item, supportTemplate);

– Thirdly there is a switch statement which iterate through possible EnchantResultType values and we just add our new one so we need to add at the begging of the switch the case of TRANSCENDENT , which in this part the magic happens and where we will move enchant from stone to the item , but Oops we forgot a little thing, by reaching this line it means that our stone already destroyed, so we dunno about the enchant level of it, so we need to save it anywhere before this line

// attempting to destroy scroll
scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);

we will add :

int transcendentLevel = scroll.getEnchantLevel();

then we back to our switch statement and implement the enchant level replacement by adding another case at the beginning like this :

case TRANSCENDENT:
{
   if(transcendentLevel > 1 )
   {
	   item.setEnchantLevel(transcendentLevel);
	   item.updateDatabase();
	   activeChar.sendMessage("Transcendent Stone Power can be felt now on your " + item.getName());
	   activeChar.sendPacket(new EnchantResult(0, 0, 0));
   }
   else {activeChar.sendMessage("This is an Empty Stone, it's just useless to have it.");}
   break; 
}

-----------------------------------------------------------------------------------------------

– Handle Usage of Extraction item differently than enhance scroll to extract Enhancement instead of Enhancing

In this case we gonna do same of what we did with Transcendent Stone, so again we replace this :

// scroll not found in list
if (scrollTemplate == null && scroll.getId() != 85851)

with this :

if (scrollTemplate == null && scroll.getId() != 85851 && scroll.getId() != 85850)

And we add another EnchantResultType to be like this :

13.png

Then we gonna replace the resultType Ternary operator we made before with a nested ternary operator :

final EnchantResultType resultType = (scrollTemplate == null) ? (scroll.getId() == 85850) ? EnchantResultType.EXTRACTION : EnchantResultType.TRANSCENDENT : scrollTemplate.calculateSuccess(activeChar, item, supportTemplate);

Now we need EXTRACTION case into the Switch Statement  :

case EXTRACTION :
{
	L2ItemInstance stone = new L2ItemInstance(85851);
	stone.setEnchantLevel(item.getEnchantLevel());
	activeChar.getInventory().destroyItem("Extraction", item, activeChar, activeChar);
	activeChar.getInventory().addItem("Extraction", stone, activeChar, activeChar);
	activeChar.sendPacket(new EnchantResult(1, 85851, 1));
	break;
}

------------------------------------------------------------------------------------------------------

– Clean up and Estimate current Stage Progress to Check if all work as expected

Let’s Build our Server and restart it and check if it’s working

Oh it’s working !!!!!!!!

last.jpg

-----------------------------------------------------------------------------------------------------------

Notes :

- You can do it better by implementing a new Item Type, but as you can see the guide is already long so i tried to make it as simple as possible

- With same Concept of Investigation and Planning you can implement almost any feature

------------------------------------------------------------------------------------------------------------

Conclusion : 

- Investigate more and more into sources

- Have a Good Plan, never go Random

- Start small and progress more

- Don't Seek Perfection at the first time, make it work then make it work better

------------------------------------------------------------------------------------------------------------

I hope you like it and i wish it's useful to anyone, and if you have any questions or need help just let me know :)

 

 

 

  • Like 4
  • Upvote 1
Posted

Great idea, but as you mentioned people would cheat it, by enchanting low lvl items. So, in that case, you have to add grade check :)

 

Who knows, maybe I will use that idea for my server, instead of boring maintainEnchantment multisell :D

Posted
3 hours ago, SweeTs said:

Great idea, but as you mentioned people would cheat it, by enchanting low lvl items. So, in that case, you have to add grade check :)

 

Who knows, maybe I will use that idea for my server, instead of boring maintainEnchantment multisell :D

Thanks a lot, well yeah it needs some checks and validation to be on a Live Server, i was just trying to make it simple to cover the concept of adapting.

OT : i think i'm gonna work on Guides for Interlude along with HighFive since all i shared about H5, and i guess it's gonna be based on aCis, is there are any limitations regarding this ?
 

1 hour ago, PaRaNoiC* said:

best guide in maxcheaters in 2017. thanks :)

Oh thanks a lot mate, i'm glad that you like it :)

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

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.

×
×
  • Create New...