Jump to content
  • 0
Sign in to follow this  
anacondaq

skill_require modification (if/else) statement.

Question

Hi, i want to make next thing.

 

As we all know we have at db/pre or re/skill_require_db.txt

With next structure:

 

SkillID,HPCost,MaxHPTrigger,SPCost,HPRateCost,SPRateCost,ZenyCost,RequiredWeapons,RequiredAmmoTypes,RequiredAmmoAmount,RequiredState,RequiredStatuses,SpiritSphereCost,RequiredItemID1,RequiredItemAmount1,RequiredItemID2,RequiredItemAmount2,RequiredItemID3,RequiredItemAmount3,RequiredItemID4,RequiredItemAmount4,RequiredItemID5,RequiredItemAmount5,RequiredItemID6,RequiredItemAmount6,RequiredItemID7,RequiredItemAmount7,RequiredItemID8,RequiredItemAmount8,RequiredItemID9,RequiredItemAmount9,RequiredItemID10,RequiredItemAmount10,RequiredEquipment

 

I need to modify that to:

SkillID,HPCost,MaxHPTrigger,SPCost,HPRateCost,SPRateCost,ZenyCost,RequiredWeapons,RequiredAmmoTypes,RequiredAmmoAmount,RequiredState,RequiredStatuses,SpiritSphereCost,RequiredItemID1:ORRequiredItemID1:ORRequiredItemID1,RequiredItemAmount1,RequiredItemID2,RequiredItemAmount2,RequiredItemID3,RequiredItemAmount3,RequiredItemID4,RequiredItemAmount4,RequiredItemID5,RequiredItemAmount5,RequiredItemID6,RequiredItemAmount6,RequiredItemID7,RequiredItemAmount7,RequiredItemID8,RequiredItemAmount8,RequiredItemID9,RequiredItemAmount9,RequiredItemID10,RequiredItemAmount10,RequiredEquipment

EDIT: (code block do not modify text in block....)

 

Original:

 

RequiredItemID1,RequiredItemAmount1 

 

I want to:

 

RequiredItemID1 : ORRequiredItemID1 : ORRequiredItemID1,RequiredItemAmount1 

If player don't have item in inventory -> player can use ANOTHER item for requirement after ":".

 

 

EXAMPLES

 

I need to modify sources & that db to next prototype:

 

Original:

 

289,0,0,1,0,0,0,99,0,0,none,0,0,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_DISPELL

 

Modified:

 

289,0,0,1,0,0,0,99,0,0,none,0,0,715:505:506,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	 //SA_DISPELL

 

What i want to get by this edit:

 

  1. IF player have itemID 715 (yellow gemstone) -> he can use spell and that item will be removed (like by default)
  2. IF player DON'T have itemID 715 map-server will be looking for player inventory for next value after ":", the next value in this example 505. So, if player Don't have 715, but have 505 -> the skill will require this item for skill.
  3. IF player don't have 715 or 505 in inventory -> server will looking for next item_id after ":", the next item is 506. So if player don't have 715 or 505 item in inventory (order is important) the skill will require and use 506 item id.
  4. IF player don't have any item of that list (715, 505, 506) in inventory -> skill will fail.
  5. Requirement Amount (715:505:506,1) is the same for all of this items.

 

 

In few words:

I want to make alternative require_db for spell in txt file which is divided by ":" (like weapon's (Spiral Pierce in renewal (it's required OR Spear or Sword))

 

 

I did found this function, and i'm get stucked.

/*** Read skill requirement from skill_require_db.txt**/static bool skill_parse_row_requiredb(char* split[], int columns, int current){// skill_id,HPCost,MaxHPTrigger,SPCost,HPRateCost,SPRateCost,ZenyCost,RequiredWeapons,RequiredAmmoTypes,RequiredAmmoAmount,RequiredState,RequiredStatuss,SpiritSphereCost,RequiredItemID1,RequiredItemAmount1,RequiredItemID2,RequiredItemAmount2,RequiredItemID3,RequiredItemAmount3,RequiredItemID4,RequiredItemAmount4,RequiredItemID5,RequiredItemAmount5,RequiredItemID6,RequiredItemAmount6,RequiredItemID7,RequiredItemAmount7,RequiredItemID8,RequiredItemAmount8,RequiredItemID9,RequiredItemAmount9,RequiredItemID10,RequiredItemAmount10    char* p;    uint16 skill_id = atoi(split[0]), idx, i;    if (!(idx = skill_get_index(skill_id))) // invalid skill id        return false;    skill_split_atoi(split[1],skill_db[idx].require.hp);    skill_split_atoi(split[2],skill_db[idx].require.mhp);    skill_split_atoi(split[3],skill_db[idx].require.sp);    skill_split_atoi(split[4],skill_db[idx].require.hp_rate);    skill_split_atoi(split[5],skill_db[idx].require.sp_rate);    skill_split_atoi(split[6],skill_db[idx].require.zeny);    //Witch weapon type are required, see doc/item_db for weapon types (View column)    p = split[7];    while (p) {        int l = atoi(p);        if( l == 99 ) { // Any weapon            skill_db[idx].require.weapon = 0;            break;        } else            skill_db[idx].require.weapon |= 1<<l;        p = strchr(p,':');        if(!p)            break;        p++;    }    //Ammo type that required, see doc/item_db for ammo types (View column)    p = split[8];    while (p) {        int l = atoi(p);        if( l == 99 ) { // Any ammo type            skill_db[idx].require.ammo = 0xFFFFFFFF;            break;        } else if( l ) // 0 stands for no requirement            skill_db[idx].require.ammo |= 1<<l;        p = strchr(p,':');        if( !p )            break;        p++;    }    skill_split_atoi(split[9],skill_db[idx].require.ammo_qty);    if( strcmpi(split[10],"hidden") == 0 ) skill_db[idx].require.state = ST_HIDDEN;    else if( strcmpi(split[10],"riding") == 0 ) skill_db[idx].require.state = ST_RIDING;    else if( strcmpi(split[10],"falcon") == 0 ) skill_db[idx].require.state = ST_FALCON;    else if( strcmpi(split[10],"cart") == 0 ) skill_db[idx].require.state = ST_CART;    else if( strcmpi(split[10],"shield") == 0 ) skill_db[idx].require.state = ST_SHIELD;    else if( strcmpi(split[10],"recover_weight_rate") == 0 ) skill_db[idx].require.state = ST_RECOV_WEIGHT_RATE;    else if( strcmpi(split[10],"move_enable") == 0 ) skill_db[idx].require.state = ST_MOVE_ENABLE;    else if( strcmpi(split[10],"water") == 0 ) skill_db[idx].require.state = ST_WATER;    else if( strcmpi(split[10],"dragon") == 0 ) skill_db[idx].require.state = ST_RIDINGDRAGON;    else if( strcmpi(split[10],"warg") == 0 ) skill_db[idx].require.state = ST_WUG;    else if( strcmpi(split[10],"ridingwarg") == 0 ) skill_db[idx].require.state = ST_RIDINGWUG;    else if( strcmpi(split[10],"mado") == 0 ) skill_db[idx].require.state = ST_MADO;    else if( strcmpi(split[10],"elementalspirit") == 0 ) skill_db[idx].require.state = ST_ELEMENTALSPIRIT;    else if( strcmpi(split[10],"peco") == 0 ) skill_db[idx].require.state = ST_PECO;    else skill_db[idx].require.state = ST_NONE;    // Unknown or no state    //Status requirements    //FIXME: Default entry should be -1/SC_ALL in skill_require_db.txt but it's 0/SC_STONE.    trim(split[11]);    if (split[11][0] != '0' || atoi(split[11])) {        int require[MAX_SKILL_STATUS_REQUIRE];        if ((skill_db[idx].require.status_count = skill_split_atoi2(split[11], require, ":", SC_STONE, ARRAYLENGTH(require)))) {            CREATE(skill_db[idx].require.status, enum sc_type, skill_db[idx].require.status_count);            for (i = 0; i < skill_db[idx].require.status_count; i++)                skill_db[idx].require.status[i] = (sc_type)require[i];        }    }    skill_split_atoi(split[12],skill_db[idx].require.spiritball);    for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++ ) {        skill_db[idx].require.itemid[i] = atoi(split[13+ 2*i]);        skill_db[idx].require.amount[i] = atoi(split[14+ 2*i]);    }    //Equipped Item requirements.    //NOTE: We don't check the item is exist or not here    trim(split[33]);    if (split[33][0] != '0' || atoi(split[33])) {        int require[MAX_SKILL_EQUIP_REQUIRE];        if ((skill_db[idx].require.eqItem_count = skill_split_atoi2(split[33], require, ":", 500, ARRAYLENGTH(require)))) {            CREATE(skill_db[idx].require.eqItem, uint16, skill_db[idx].require.eqItem_count);            for (i = 0; i < skill_db[idx].require.eqItem_count; i++)                skill_db[idx].require.eqItem[i] = require[i];        }    }    return true;}
Edited by UltraCat

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

hello, good afternoon staff.

I need it .:

 

Original:


RequiredItemID1,RequiredItemAmount1 

 

I want to:

 

RequiredItemID1 : ORRequiredItemID1 : ORRequiredItemID1,RequiredItemAmount1 

If player don't have item in inventory -> player can use ANOTHER item for requirement after ":".



This change is functional?

 

    //Status requirements    //FIXME: Default entry should be -1/SC_ALL in skill_require_db.txt but it's 0/SC_STONE.    trim(split[11]);    if (split[11][0] != '0' || atoi(split[11])) {        int require[MAX_SKILL_STATUS_REQUIRE];        if ((skill_db[idx].require.status_count = skill_split_atoi2(split[11], require, ":", SC_STONE, ARRAYLENGTH(require)))) {            CREATE(skill_db[idx].require.status, enum sc_type, skill_db[idx].require.status_count);            for (i = 0; i < skill_db[idx].require.status_count; i++)                skill_db[idx].require.status[i] = (sc_type)require[i];        }    }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.