Skip to content
Permalink
Browse files
Implementing Official MDEF (Renewal only yet)
* Split `DEF` field in item_db becomes `DEF:MDEF`.
* Just like `MATK` that defined in DB (not as script), `MDEF` is still giving an effect even the item is blocked in a map.

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
  • Loading branch information
cydh committed Oct 18, 2015
1 parent 587da10 commit 505a0f8ab4f30e2166cd6d44bdc5e98b5d7a4853
Showing with 17 additions and 8 deletions.
  1. +1 −1 db/re/item_db.txt
  2. +2 −0 doc/item_db.txt
  3. +2 −1 doc/script_commands.txt
  4. +2 −1 src/map/itemdb.c
  5. +1 −0 src/map/itemdb.h
  6. +4 −3 src/map/script.c
  7. +3 −0 src/map/status.c
  8. +2 −2 tools/convert_sql.pl
@@ -1,7 +1,7 @@
// Items Database
//
// Structure of Database:
// ID,AegisName,Name,Type,Buy,Sell,Weight,ATK[:MATK],DEF,Range,Slots,Job,Class,Gender,Loc,wLV,eLV[:maxLevel],Refineable,View,{ Script },{ OnEquip_Script },{ OnUnequip_Script }
// ID,AegisName,Name,Type,Buy,Sell,Weight,ATK[:MATK],DEF[:MDEF],Range,Slots,Job,Class,Gender,Loc,wLV,eLV[:maxLevel],Refineable,View,{ Script },{ OnEquip_Script },{ OnUnequip_Script }
//
// Healing Items
//=============================================================
@@ -62,6 +62,8 @@ MATK: Weapon's magic attack (Renewal only)

DEF: Armor's defense

MDEF: Armor's magic defense (Renewal only)

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

Range: Weapon's attack range
@@ -2831,7 +2831,8 @@ Valid types are:
13 - wLV
14 - SpriteID from 'db/item_avail.txt'
15 - eLVMax
16 - matk if RENEWAL is defined
16 - MATK (Renewal)
17 - MDEF (Renewal)

See the sample in 'doc/sample/getiteminfo.txt'.

@@ -1287,10 +1287,11 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
id->weight = atoi(str[6]);
#ifdef RENEWAL
itemdb_re_split_atoi(str[7],&id->atk,&id->matk);
itemdb_re_split_atoi(str[8],&id->def,&id->mdef);
#else
id->atk = atoi(str[7]);
#endif
id->def = atoi(str[8]);
#endif
id->range = atoi(str[9]);
id->slot = atoi(str[10]);

@@ -409,6 +409,7 @@ struct item_data
int elvmax; ///< Maximum level for this item
#ifdef RENEWAL
int matk;
int mdef;
#endif

int delay;
@@ -13090,7 +13090,8 @@ BUILDIN_FUNC(getitemslots)
13 wlv;
14 view id
15 eLvmax
16 matk (renewal)
16 matk (Renewal)
17 mdef (Renewal)
*------------------------------------------*/
BUILDIN_FUNC(getiteminfo)
{
@@ -13101,10 +13102,10 @@ BUILDIN_FUNC(getiteminfo)
n = script_getnum(st,3);
i_data = itemdb_exists(item_id);

if (i_data && n <= 16) {
if (i_data && n < 18) {
int *item_arr = (int*)&i_data->value_buy;
#ifndef RENEWAL
if (n == 16)
if (n > 15)
script_pushint(st,0);
else
#endif
@@ -3142,6 +3142,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
continue;

status->def += sd->inventory_data[index]->def;
#ifdef RENEWAL
status->mdef += sd->inventory_data[index]->mdef;
#endif

// Items may be equipped, their effects however are nullified.
if (opt&SCO_FIRST && sd->inventory_data[index]->equip_script && (pc_has_permission(sd,PC_PERM_USE_ALL_EQUIPMENT)
@@ -228,7 +228,7 @@ sub Main {
$db = $sTable;
$db = "item_db_re" unless($db);
$nb_columns = 22;
@str_col = (1,2,7,16,19,20,21);
@str_col = (1,2,7,8,16,19,20,21);
@str_col2 = (19,20,21);
$line_format = "([^\,]*),"x($nb_columns-3)."(\{.*\}),"x(2)."(\{.*\})"; #Last 3 columns are scripts.
$create_table =
@@ -246,7 +246,7 @@ sub Main {
`price_sell` mediumint(8) unsigned DEFAULT NULL,
`weight` smallint(5) unsigned NOT NULL DEFAULT '0',
`atk:matk` varchar(11) DEFAULT NULL,
`defence` smallint(5) unsigned DEFAULT NULL,
`defence` varchar(11) unsigned DEFAULT NULL,
`range` tinyint(2) unsigned DEFAULT NULL,
`slots` tinyint(2) unsigned DEFAULT NULL,
`equip_jobs` int(10) unsigned DEFAULT NULL,

2 comments on commit 505a0f8

@aleos89
Copy link
Contributor

@aleos89 aleos89 commented on 505a0f8 Jan 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your status on this?

@cydh
Copy link
Contributor Author

@cydh cydh commented on 505a0f8 Jan 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KIA

Please sign in to comment.