Jump to content

How To Synchronize skill_proto ( Server <> Client )


Recommended Posts

  • Forum Moderator

M2 Download Center

This is the hidden content, please
( Internal )

8ef68592c3f5627a244b93f55d67b440.png

 

As the title says, here's how you can synchronize your skill_table from client with skill_proto from server.

[1]. First of all we've to rewrite the enum part of tokens (which is used in CPythonSkill::RegisterSkillTable), that means we change the order of index-tab-line with a new order, because ymir didn't used all columns. In that way we keep the file much cleaner and just with necessary columns (9 columns instead of 27).

Spoiler
// Not used
TABLE_TOKEN_TYPE_NAME
TABLE_TOKEN_TYPE_TYPE
TABLE_TOKEN_TYPE_LEVEL_STEP
TABLE_TOKEN_TYPE_POINT_ON
TABLE_TOKEN_TYPE_MASTER_BONUS_POLY
TABLE_TOKEN_TYPE_ATTACK_GRADE_POLY
TABLE_TOKEN_TYPE_FLAG
TABLE_TOKEN_TYPE_AFFECT_FLAG
TABLE_TOKEN_TYPE_POINT_ON2
TABLE_TOKEN_TYPE_POINT_POLY2
TABLE_TOKEN_TYPE_DURATION_POLY2
TABLE_TOKEN_TYPE_AFFECT_FLAG2
TABLE_TOKEN_TYPE_PREREQUISITE_SKILL_VNUM
TABLE_TOKEN_TYPE_PREREQUISITE_SKILL_LEVEL
TABLE_TOKEN_TYPE_SKILL_TYPE
TABLE_TOKEN_TYPE_MAX_HIT
TABLE_TOKEN_TYPE_SPLASH_AROUND_DAMAGE_ADJUST_POLY
TABLE_TOKEN_TYPE_SPLASH_RANGE

 


Srcs/Client/UserInterface/PythonSkill.h

Search for the next enum:

Spoiler
		enum ESkillTableTokenType
		{
			[...]
		};

 

Replace it with:

Spoiler
#ifdef ENABLE_SKILL_TABLE_RENEW
		enum ESkillTableTokenType
		{
			TABLE_TOKEN_TYPE_VNUM,
			TABLE_TOKEN_TYPE_MAX_LEVEL,
			TABLE_TOKEN_TYPE_LEVEL_LIMIT,
			TABLE_TOKEN_TYPE_POINT_POLY,
			TABLE_TOKEN_TYPE_SP_COST_POLY,
			TABLE_TOKEN_TYPE_DURATION_POLY,
			TABLE_TOKEN_TYPE_DURATION_SP_COST_POLY,
			TABLE_TOKEN_TYPE_COOLDOWN_POLY,
			TABLE_TOKEN_TYPE_TARGET_RANGE,
			TABLE_TOKEN_TYPE_MAX_NUM,
		};
#else
		enum ESkillTableTokenType
		{
			TABLE_TOKEN_TYPE_VNUM,
			TABLE_TOKEN_TYPE_NAME,
			TABLE_TOKEN_TYPE_TYPE,
			TABLE_TOKEN_TYPE_LEVEL_STEP,
			TABLE_TOKEN_TYPE_MAX_LEVEL,
			TABLE_TOKEN_TYPE_LEVEL_LIMIT,
			TABLE_TOKEN_TYPE_POINT_ON,
			TABLE_TOKEN_TYPE_POINT_POLY,
			TABLE_TOKEN_TYPE_SP_COST_POLY,
			TABLE_TOKEN_TYPE_DURATION_POLY,
			TABLE_TOKEN_TYPE_DURATION_SP_COST_POLY,
			TABLE_TOKEN_TYPE_COOLDOWN_POLY,
			TABLE_TOKEN_TYPE_MASTER_BONUS_POLY,
			TABLE_TOKEN_TYPE_ATTACK_GRADE_POLY,
			TABLE_TOKEN_TYPE_FLAG,
			TABLE_TOKEN_TYPE_AFFECT_FLAG,
			TABLE_TOKEN_TYPE_POINT_ON2,
			TABLE_TOKEN_TYPE_POINT_POLY2,
			TABLE_TOKEN_TYPE_DURATION_POLY2,
			TABLE_TOKEN_TYPE_AFFECT_FLAG2,
			TABLE_TOKEN_TYPE_PREREQUISITE_SKILL_VNUM,
			TABLE_TOKEN_TYPE_PREREQUISITE_SKILL_LEVEL,
			TABLE_TOKEN_TYPE_SKILL_TYPE,
			TABLE_TOKEN_TYPE_MAX_HIT,
			TABLE_TOKEN_TYPE_SPLASH_AROUND_DAMAGE_ADJUST_POLY,
			TABLE_TOKEN_TYPE_TARGET_RANGE,
			TABLE_TOKEN_TYPE_SPLASH_RANGE,
			TABLE_TOKEN_TYPE_MAX_NUM,
		};
#endif

 

Srcs/Client/UserInterface/Locale_Inc.h

Spoiler
#define ENABLE_SKILL_TABLE_RENEW // Enable synchronization skill_proto -> skilltable

 

 

[2]. Compile the source client again.

[3]. Open Navicat (preferably the latest versions) and do the following things:

  • Open player table
  • Export Wizard -> Mark skill_proto -> Export to ../location/skilltable.txt
  • Export format -> *.txt
  • Unmark All fields then Unselect All
  • Select available fields: -> {'dwVnum', 'bMaxLevel', 'bLevelLimit', 'szPointPoly', 'szSPCostPoly', 'szDurationPoly', 'szDurationSPCostPoly', 'szCooldownPoly', 'dwTargetRange'}
  • Unmark: Include column titles
  • Text Qualifier: None
  • Copy the skilltable.txt from Desktop to ../locale/en/

 

HOW-TO - VIDEO (The video is just an example, please follow the tutorial from step [3])

This is the hidden content, please

 

 

Thanks to @Syreldar for the idea.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 105
  • Confused 2
  • Scream 3
  • Good 49
  • Love 11
  • Love 94
Link to comment
Share on other sites

  • Premium

When you do nothing but still get mentioned in the "Thanks to" by @VegaS™

 

0778wFT.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...
  • 7 months later...
  • 1 month later...
  • Forum Moderator
On 7/28/2021 at 2:20 PM, Hik said:

Attention, I believe the skilltable_new is wrong, I think a column is missing.

You are right, I helped some people with this problem in PM but I forgot to edit the topic.

Update: For those who know what they're doing, I did a small script that doing this faster, otherwise, use the manual method from the first post.

This is the hidden content, please

Edited by VegaS™
  • Metin2 Dev 72
  • Confused 2
  • Lmao 1
  • Good 27
  • Love 22
Link to comment
Share on other sites

  • 5 weeks later...
  • Management

If anyone gets an error like this:

Traceback (most recent call last):
  File "C:\Users\Karbust\Desktop\skill_proto.py", line 26, in <module>
    int(query['dwVnum']): '\t'.join(
TypeError: sequence item 0: expected str instance, int found

Just edit this:

Kug9k7g.png

Wrap the columnValue in str().

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 1

raw

raw

Link to comment
Share on other sites

  • 1 year later...
  • Premium

I leave this for peoples that get: 

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 5285: invalid continuation byte

 

#!/usr/bin/env python
# -*- coding: utf-8 -*-
__name__ = "Skill Proto Synchronization"
__author__ = "VegaS"
__date__ = "2020-10-14"
__version__ = "1.0"

import os
import json

# Set working directory
os.chdir(os.path.dirname(os.path.realpath(__file__)))

# Skill proto file name, exported from MySQL.
SKILL_PROTO_FILE_NAME: str = 'skill_proto.json'
SKILL_PROTO_READ_COLUMNS: set[str] = {'dwVnum', 'bMaxLevel', 'bLevelLimit', 'szPointPoly', 'szSPCostPoly', 'szDurationPoly', 'szDurationSPCostPoly', 'szCooldownPoly', 'dwTargetRange'}

# Skill table file name.
SKILL_TABLE_FILE_NAME: str = 'skilltable.txt'
SKILL_TABLE_CONTENT: dict[int, str] = {}

with open(SKILL_PROTO_FILE_NAME, encoding="utf-8", errors="replace") as jsonFile:
    skillProtoContent: dict = json.load(jsonFile)
    for query in skillProtoContent['RECORDS']:
        SKILL_TABLE_CONTENT.update({
            int(query['dwVnum']): '\t'.join(
                [str(columnValue) if isinstance(columnValue, (str, int)) else str() for columnName, columnValue in query.items() if columnName in SKILL_PROTO_READ_COLUMNS])
        })

with open(SKILL_TABLE_FILE_NAME, 'w') as skillTableFile:
    skillTableFile.write('\n'.join(list(dict(sorted(SKILL_TABLE_CONTENT.items())).values())))

 

Edited by DemOnJR
  • Love 1

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

Announcements



×
×
  • 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.