Fix in Database "atk:matk"

Status
Not open for further replies.

Shikazu

New member
Messages
74
Points
0
Age
36
Location
Germany
Github
shikazu
Hey guys,

i would suggest, that we fix something in the database (flat file & sql).

An Update which added a new field to the database ruined the database template :

Line 943/** * [RRInd] * For backwards compatibility, in Renewal mode, MATK from weapons comes from the atk slot * We use a ':' delimiter which, if not found, assumes the weapon does not provide any matk. **/void itemdb_re_split_atoi(char *str, int *atk, int *matk) {  int i, val[2];  for (i=0; i<2; i++) {    if (!str) break;    val = atoi(str);    str = strchr(str,':');    if (str)      *str++=0;  }  if( i == 0 ) {    *atk = *matk = 0;    return;//no data found  }  if( i == 1 ) {//Single Value, we assume it's the ATK    *atk = val[0];    *matk = 0;    return;  }  //We assume we have 2 values.  *atk = val[0];  *matk = val[1];  return;}

This is wasting a lot of cycle times for nothing and there could easily be a new database column that takes matk instead of appending it as string to attack..

just change the structure "item_data" in /src/map/itemdb.h

struct item_data {  uint16 nameid;  char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];    //Do not add stuff between value_buy and view_id (see how getiteminfo works)  int value_buy;  int value_sell;  int type;  int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it, -1 denotes items sold in shops only) [Lupus]  int sex;  int equip;  int weight;  int atk;  int def;  int range;...

to

struct item_data {  uint16 nameid;  char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];    //Do not add stuff between value_buy and view_id (see how getiteminfo works)  int value_buy;  int value_sell;  int type;  int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it, -1 denotes items sold in shops only) [Lupus]  int sex;  int equip;  int weight;  int atk;   int matk;  int def;  int range;...

and then the database reader (just have not much time to explain, cause its 1:16am)
default_tongue.png


If i should do that, just let me know
default_smile.png


~Shikazu

 
Last edited by a moderator:
Thank you for your suggestion,

we have been discussing the item db format for a while and should we move on with it this issue will be solved, this will be pending till we're done discussing it

 
The rationale behind this, I'm guessing, is that you'd end up with a lot of zeroes otherwise.

 
Moving to Accepted Suggestions since this has already been implemented.

 
Status
Not open for further replies.
Back
Top