Jump to content

Recommended Posts

Posted (edited)

How does it work and how to contribute

 

First and foremost let me make something clear.

 

This is a project under GPLv2. ANY changes or modifications you make to the software need to be made public under the same license for everyone to see.

 

The main reason i made this opensource is so people can jump in and help out in exchange of using it for free.

 

An example would be the follow: If you adapt the code for l2j high five, you MUST by law make it public.

Any violations will be reported and offenders will need to deal with the legal issues.

 

 

Now that i have that out of the way let me talk you through the workflow.

 

This is what a full request from the user looks like

  1. The user does an action on the site.
  2. The request is send to the website and it is being validated for authenticity.
  3. If it is valid then the website is sending an encrypted request to the server api.
  4. The server api is validating the request and does the action.
  5. It then replies to the website and the site outputs the action result to the user.

 

Website side

 

The requests are in the Requests folder in the web project.

 

Every request extends the L2Request abstract class.

Here is what this class looks like:

xklFP2U.png

 

See here that the requests have an API key (which you will need to change) and a request id.

The request id is used by the server api to figure out how it should process the request.

Any extra properties should be added to the extended class.

 

In order to create a new request you need to extend L2Request and give it a request id.

Here is an example.

4ogxfcd.png

 

As you can see the buy item request has some properies as well as a request id which can be seen in the base(9).

This is all you need to do to create a website request for the server.

 

Now if this request needs to return something more that a confirmation message (ie some data) then you also have to create a response class that extends L2Response.

 

BuyItemRequest doesn't need a special response so it just answers with a L2Response.

This is what the response model looks like:

zW501fQ.png

 

I only have two response codes for now. 200 for status ok and 500 for any error (planning to extend that)

 

 

When the request is send from the website to the server it is being serialized to a json string and encrypted with AES256.

Because the encryption is symmetric it is very important that you change any encryption keys provided by default.

 

In order to send the request to the server you need to create a method signature in the IRequestService interface.

It must look like this:

ykdKfft.png

 

All requests MUST return Task<L2Reponse> in the interface signature. If it needs to return something that extends response then we cast it.

 

Here you can see the implementation of the request functionality:

go3OWJW.png

 

Requests have an extension method named SendPostRequest<T>. T is generic and is replaced by extended responses if needed.

The extension method will serialize he model send the request and return the gameserver response object.

Notice here that the method need to be async as we will await it. Async programming offers better performance in C# if done right.

 

Here is how the buy item endpoint looks like on the site.

SJu6jJ3.png

 

Some key things:

The HttpPost attribute shows that this endpoint accepts post requests.

The Route attribute shows the url path of the request.

async Task allows for asynchronous handling of the request.

[FromBody] means that the framework will map the Form Body to a model automatically.

return Content returns a string. However i am currently replacing them with return Json to return an object for flexible responses.

 

The rest is pretty straightforward.

 

This is how the jquery code looks like for this request:

WQpUJxc.png

 

 

Server API side

 

The server is accepting requests from the site.

The requests are registered in the L2ACPRequests enum on the com.elfocrash.l2acp package.

 

Here it is:

gj9ZcHs.png

 

They are being turned into an array and using the request id we map them and kick off the processing process.

 

All the requests in the server api extend L2ACPRequests (name inconsistency i know)

Overriding the setContent method allows for getting values from the json object.

Here is how:

ZCjlgXe.png

 

Note here that if it is a string, a int or a whatever you need to get it accordingly.

Also note here that you NEED to have the same pascal case then you do get.("Something") as the model was serialized on the website.

 

Responses extend the L2ACPResponse model class.

You only need to extend it and now send it as it is if you need to return data other than a success message.

 

Here is what an extended response looks like:

eiQINDq.png

 

Note the property naming. They MUST be pascal case as they will be mapped to a website model dynamically and C# is using pascal case.

 

 

This is the main idea around how L2ACP works.

If you have any more questions please let me know.

Keep in mind i was prototyping a lot making this so many things are not final but the workflow is.

 

Star and fork the projects on GitHub.

https://github.com/Elfocrash/L2ACP-Web

https://github.com/Elfocrash/L2ACP-api

 

Thanks.

Edited by .Elfocrash
  • Like 2
  • Upvote 4

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

    • Hello Dexters! https://lineage2dex.com    This is pre-announcing of NEW season server, so we want to share some key points of it. Full details with road map, patch notes we will announce a bit latter Opening September 27 at 19:00 (UTC +3) Open Beta Test from September 23 What’s New This Season?, This is just a short preview of the most exciting changes and updates. A patch note with balance change will be posted later in this thread – one topic with all patchnotes history from 2022 year EXP/SP x25 - Over the past few seasons, our servers were drifting closer to a mid-rate style. And hard to call it now pure PVP server. That’s why we’ve reduced EXP/SP rates from x50 to x25 – making progression smoother, more balanced, and more in line with the mid-rate identity., Improved Olympiad matchmaking – opponents will be matched by strength, making feeding much harder., K/D stats for CC – track your real impact!, New In-Game Shop Interface - no more running to NPCs for supplies – buy everything directly from the interface. NPC Astarte will now only handle services like WH, sales, LS insertion, etc., Balance Adjustments - small but important tweaks for a smoother PvP experience (details in patch notes)., Replica Instance System Reworked - upgrading replicas now requires not only fragments but also real jewellery from B to S grades. You can choose from 3 instance types: PvP Instance – biggest rewards (everyone spawns together for mass PvP)., CC Instance – private instance for your CC., Party Instance – private instance for your party., , Dino Island Returns - back by popular demand: Dark Zone (PvP) and Light Zone (PvE)., Newbie Pass Questline - available at character creation – helps you get familiar with the server and make start progression faster., Clan members taxation system, Full announce - read on forum, https://forum.lineage2dex.com/threads/16723/ (edited)   We’re excited to show you how the Newbie Path will look on the Seasonal Server and share a few details about it. The Newbie Path is designed to help new players on Dex adapt more easily on project. While it won’t reveal the full content of the game, it will greatly assist during the early stages of your journey. But it’s not just for newcomers! Even veteran players will find it useful — completing Newbie Path steps will grant you small progression boosts and extra rewards(exp boosts, some gear, potions etc). Definitely worth using! You’ll be able to test the full Newbie Path system yourself during the Open Beta, launching on September 23rd!
    • 📢 [OFFICIAL ANNOUNCEMENT] 🔥 Lineage 2 Interlude x10 Craft-PvP 🔥 🎮 Grand Opening — September 19 @ 19:00 [UTC +2] 🧪 Open Beta — September 15 @ 19:00 [UTC +2]    🌐 Full server description - https://lineage2.ms/en/wiki 💥 Why Interlude x10 Craft-PvP? ✅ GM Shop up to B-Grade + Full Buffs — get straight to action, no pointless grinding. ✅ Unique Geodata & Geopathfinding Engine — smooth, tactical, and truly next-gen. ✅ Two Client Options — play in Classic or Interlude style. ✅ No Pay-to-Win — donations don’t break the balance. ✅ 1+1 Mode Enabled — max 2 windows, only 1 active = no box armies. ✅ Bot-Free Zone — advanced protection + non-intrusive popup captchas. ✅ No GM Interference — fair, competitive PvP environment. ✅ No Wipes — your progress is safe. ✅ Truly International — global reach, not just CIS players. 🛡 2nd Season. Stronger, Smarter, Updated. 🎯 Pure Craft-PvP. 🌍 Real Competition. 📅 Mark your calendars. Tell your clan. Invite your friends. Let’s make this season legendary. 💪 https://discord.gg/lineage2ms
    • As far as I know, L2Gold stated (unofficially) that closed for legal reasons. Although, my estimation is that it had reached such low popularity (believe me I know, I played till the last day), so they closed it because of that. As for "other" copies or w/e. I believe that everyone has the right to do what they think is best.  I have to say, I find your claims a bit exaggerating. Many servers have done a good job at recreating such a server. There are actually leaked files of C4 L2Gold (L2OFF) so many owners started working from there (L2Gold.cc (old Avellan), L2Gold.in, L2Gold.co etc.) There are other owners that took the idea 1 step further, adapting L2Gold in higher Chronicles and started working on a brand-new style with old features along. @Trance @Brado @To4kA (those are some of the owners that I can think of right now). I think you should re-think your opinions and don't judge them all together. Many of the servers you've mentioned has actually done a decent job and tried to take the brand, one step further. The argument here is that everyone should do what they want. Community will judge if it's good or bad.
    • Let’s start from the beginning. The original L2Gold.cc server shut down in 2013. Since that time, the real and authentic L2 Gold Rush has not existed, and the reasons for its closure remain unknown. From what I know, after that moment many copies started to appear – people who had no real idea how to recreate the original server simply began releasing imitations under different names such as gold.in, gold.net, gold.org, gold.us, and so on. Am I wrong?
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock