Jump to content
  • 0

Add new bonus to item_attr table -> bonus to be added via change/add bonus items


astroNOT
Go to solution Solved by Owsap,

Question

  • VIP
Posted (edited)

Hello, 

I've added strong against metins/bosses, and now, I am trying to add em to item_attr.

The goal is to make what is a bonus that I can add manually to an item, to be "addable" by add/change bonus items, if that makes sense?

Now I do not know what that implies, any ideas/suggestions would be much apreciated!

PS. I did try to add a new row in the table with APPLY_ATTBONUS_METIN, no luck tho.

Thanks

Edited by astroNOT
  • Love 1
Link to post

2 answers to this question

Recommended Posts

  • 2
  • VIP
  • Solution
Posted (edited)

Here is a rather "complete" tutorial and I hope you understand.

First, let's start with the Server Source.

Server Source

Spoiler
/// 1. @ game/char.cpp
// Search @ void CHARACTER::PointChange
	default:
		sys_err("CHARACTER::PointChange: %s: unknown point change type %d", GetName(), type);
		return;

// Add above
	case POINT_MY_NEW_BONUS:
		SetPoint(type, GetPoint(type) + amount);
		val = GetPoint(type);
		break;

/// 2. @ game/char.cpp
// Search
	default:
		sys_err("Unknown apply type %d name %s", bApplyType, GetName());
		break;

// Add above
	case APPLY_MY_NEW_BONUS:
		PointChange(aApplyInfo[bApplyType].bPointType, iVal);
		break;

/// 3. @ game/char.h
// Search @ enum EPointTypes
	//POINT_MAX_NUM = 255 common/length.h

// Add above
	POINT_MY_NEW_BONUS,

/// 4. @ game/constants.cpp
// Extend aApplyInfo[MAX_APPLY_NUM] with
	{ POINT_MY_NEW_BONUS, }, // APPLY_MY_NEW_BONUS

// Example
	{ POINT_RESIST_PENETRATE, }, // APPLY_ANTI_PENETRATE_PCT, 91
	{ POINT_MY_NEW_BONUS, }, // APPLY_MY_NEW_BONUS
};

/// 5. @ game/constants.cpp
// Search @ TValueName c_aApplyTypeNames[] =
	{ NULL, 0 }

// Add above
	{ "MY_NEW_BONUS", APPLY_MY_NEW_BONUS },

/// 6. Example
/*
* Now it all depends on what you want to do with this bonus.
* I will give you an example of how this bonus could be applied for Metin Stones.
*/
/// @ game/battle.cpp
// Search @ int CalcAttBonus
		iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_MONSTER)) / 100;

// Add below
		if (pkVictim->IsStone())
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_MY_NEW_BONUS)) / 100;

/// 7. @ db/ProtoReader.cpp
// Search @ get_Item_ApplyType_Value and extend arApplyType[] with
		"APPLY_MY_NEW_BONUS",

// Example
		"APPLY_ANTI_PENETRATE_PCT",
		"APPLY_MY_NEW_BONUS",
	};

 

We can do the MySQL part now since we have finished with the server part.
MySQL

Spoiler
/*
* Search @ Database (Use Navicat, it's a great piece of software.)
*	player.item_attr
*
* 1. Edit / Design table.
*
* 2. Extended the "apply" row "Values" with "MY_NEW_BONUS".
*
* 3. Save table.
*
* 4. Open player.item_attr table and add the new bonus type.
*
*	apply			prob	lv1	lv2	lv3	lv4	lv5	weapon	body ...
*	MY_NEW_BONUS	1		2	4	6	10	15	0		0	 ...
*
* 5. You can also do the same procedure above for the item_attr_rare (this table is for the 6/7 bonus)
*
*/

 

Now let's move on to the Client Source.
Client Source

Spoiler
/// 1. @ GameLib/ItemData.h
// Search @ enum EApplyTypes
		MAX_APPLY_NUM = 255,

// Add above
		APPLY_MY_NEW_BONUS,

/// 2. @ UserInterface/Packet.h
// Search @ enum EPointTypes
	// 클라이언트 포인트
	POINT_MIN_WEP = 200,

// Add above
	POINT_MY_NEW_BONUS,

/// 3. @ UserInterface/PythonItemModule.cpp
// Search
	PyModule_AddIntConstant(poModule, "APPLY_PENETRATE_PCT", CItemData::APPLY_PENETRATE_PCT);

// Add below
	PyModule_AddIntConstant(poModule, "APPLY_MY_NEW_BONUS", CItemData::APPLY_MY_NEW_BONUS);

/// 4. @ UserInterface/PythonPlayerModule.cpp
// Search
	PyModule_AddIntConstant(poModule, "POINT_PENETRATE_PCT", POINT_PENETRATE_PCT);

// Add below
	PyModule_AddIntConstant(poModule, "POINT_MY_NEW_BONUS", POINT_MY_NEW_BONUS);

 

Let's not forget our special tool, DumpProto.
DumpProto

Spoiler
/// 1. @ dump_proto/ItemCSVReader.cpp
// Search @ int get_Item_ApplyType_Value and extend arApplyType[] with
		"APPLY_MY_NEW_BONUS",

// Example
		"APPLY_ANTI_PENETRATE_PCT",
		"APPLY_MY_NEW_BONUS",
	};

 

Last but not least your client needs to read the new bonus type.

Client Root

Spoiler
''' 1. @ root/uiToolTip.py '''
# Search @ class ItemToolTip
	AFFECT_DICT = {

# Extend with
		item.APPLY_MY_NEW_BONUS : localeInfo.TOOLTIP_APPLY_MY_NEW_BONUS,

 

And finally, your bonus needs a name.

Client Locale

Spoiler
-- 1. @ locale/x/locale_game.txt
-- Add inside
TOOLTIP_APPLY_MY_NEW_BONUS	TOOLTIP_APPLY_ATTBONUS_WARRIOR	My New Bonus +%d%%	SA

 

⚠ Following the order of the points and apply types are very important, make sure every modification is in order since an incorent order may read another bonus.

 

Sincerely, Owasp.

Edited by Owsap
  • Love 1
  • Love 2
Link to post
  • 1
  • VIP

It is actually done through item_attr table. First you need to update apply enum and make sure bonuses are in the same order as in enum EApplyTypes in lenght.h. Then you can go and add a new row in the table and edit bonus' properties.

  • Love 1
Link to post

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
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.



  • Activity

    1. 18

      GRAPHIC & ANIMATION & CODE | Pixarts - Game Development Studio

    2. 3

      Mob HP Bug

    3. 3

      Mob HP Bug

    4. 0

      【Winz2】 ★ 【55-120】 ★ 【21: 05.2021】 ★ ✅ TR SUNUCU! ✅ ★ 【Açıkbeta 19 Mayıs】 ★

    5. 4

      [Learn] Server side

    6. 4

      [Learn] Server side

    7. 3

      Mob HP Bug

    8. 3

      Drop problem - level limit

    9. 11

      Ancient2 - Oldschool server (international).

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