Jump to content

BlendItem refactored


Recommended Posts

This is the hidden content, please

Another Download

This is the hidden content, please

BlendItemRenewal

Completely new and fresh approach to load blend items using JSON.

Better than previous versions?

I suppose so. The source file for this version has only about 50 lines so it is very slim.

I have decided to adhere to the YMIR coding style, so there are no classes or structures.

So - how to install this „system”?

  • Make sure the compiler you are using supports (at least) C++11.
    • Install 
      This is the hidden content, please
       parser.
      • Replace blend_item.h and blend_item.cpp with the old ones, and that is it.
        • If you want hot-reloading the JSON file, you can add the cmd_gm.cpp part (recommended).

Example blend.json file content below.

{
	"50821": {
		"type": "CRITICAL_PCT",
		"value": [ 8, 10, 12, 15, 20 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"50822": {
		"type": "PENETRATE_PCT",
		"value": [ 8, 10, 12, 15, 20 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"50823": {
		"type": "ATTACK_SPEED",
		"value": [ 2, 3, 4, 5, 8 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"50824": {
		"type": "RESIST_MAGIC",
		"value": [ 8, 10, 12, 15, 20 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"50825": {
		"type": "ATT_BONUS",
		"value": [ 30, 50, 70, 90, 120 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"50826": {
		"type": "DEF_BONUS",
		"value": [ 40, 70, 100, 150, 200 ],
		"duration": [ 60, 120, 180, 300, 600 ]
	},

	"51002": {
		"type": "ENERGY",
		"value": [ 1, 3, 5, 7, 10 ],
		"duration": 1800 // It is possible to use only one duration (and value).
	}
}
  • Metin2 Dev 89
  • Eyes 4
  • Good 14
  • Love 1
  • Love 21
Link to comment
Share on other sites

12 minutes ago, filipw1 said:

Good stuff, but I've got it already for 30 minutes. You should use map instead of vector to save some time on finding the right blend data in you data pool. Nice to see people getting rid of some old and ugly code. 

You should fix all your systems to comments my topics!!! Thanks, fixed.

Edited by Thorek
  • Angry 1
  • Lmao 1
Link to comment
Share on other sites

2 minutes ago, Thorek said:

Wops, sorry - contains function comes from C++20.

Change return in CBlendItem::Find to return items.find(item) != items.end();

Thank you bro. Thanks to your help, the build was created successfully.

        "value": [ 1, 3, 5, 7, 10 ],
        "duration": [ 1800, 1800, 1800,180 1800 ]

when used in this way, the server will not boot.

        "value": [ 1, 3 ],
        "duration": [ 1800, 1800 ]

This is how the server opens.

 

How can I add more? As in blend.txt.

Link to comment
Share on other sites

40 minutes ago, BadRomani said:

Thank you bro. Thanks to your help, the build was created successfully.

        "value": [ 1, 3, 5, 7, 10 ],
        "duration": [ 1800, 1800, 1800,180 1800 ]

when used in this way, the server will not boot.

        "value": [ 1, 3 ],
        "duration": [ 1800, 1800 ]

This is how the server opens.

 

How can I add more? As in blend.txt.

After every item in JSON array, you must put a comma (except for the last one).

For example, if you have: [ 1800, 1800, 1800,180 1800 ]

Server not booting because after 180 comma wasn't found.

Edited by Thorek
Link to comment
Share on other sites

15 minutes ago, Thorek said:

After every item in JSON array, you must put a comma (except for the last one).

For example, if you have: [ 1800, 1800, 1800,180 1800 ]

Server not booting because after 180 comma wasn't found.

I made a mistake while editing 🙂 Ok, now the server is opening.

Link to comment
Share on other sites

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.