Jump to content

[Charms] Item's effect to work while in inventory


Pillows

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   2
  • Joined:  08/12/12
  • Last Seen:  

All credit goes to digitalhamster, fixed by ~AnnieRuru~.

Reposting for personal reasons since Ea has been offline and I happen to have saved a web cache of the pages.
The topic is old, so you have to manually add the modifications. Plus, the spacings didn't copy out too well.

The modification works through the item's bonus script in your item_db/db2. Charm's effect don't work if you do not add type (12/etc.), job, upper, and gender in itemdb/db2. Charms will only work with items having type = 12/? on item_db/db2, so your other items won't be affected by this, just the ones you choose.

Make sure type is set according to your mmo.h.
For example:

+++ common/mmo.h (working copy)
@@ -175,6 +175,7 @@
IT_UNKNOWN2,//9
IT_AMMO, //10
IT_DELAYCONSUME,//11
+ IT_CHARM,
IT_CASH = 18,

Looking at IT_CHARM, type is set to 12.

Item stacking

Add this if you want to enable item IDs to stack. It will treat each item as a separate item, in its own item slot. Example: Apple (5) will be in different items slots in your inventory and its effects will stack with each other when the code below is added.

Same item effects on different item IDs will stack regardless of enabling/disabling this modification.

 

Add this if you want items to stack:

 

Go to itemdb.c:

/*==========================================
 * Returns if given item's type is stackable.
 *------------------------------------------*/
int itemdb_isstackable(int nameid)
{
  int type=itemdb_type(nameid);
  switch(type) {
	  case IT_WEAPON:
	  case IT_ARMOR:
	  case IT_PETEGG:
	  case IT_PETARMOR:
+         case IT_CHARM:
		  return 0;

And again, right below it:

/*==========================================
 * Alternate version of itemdb_isstackable
 *------------------------------------------*/
int itemdb_isstackable2(struct item_data *data)
{
  nullpo_retr(0, data);
  switch(data->type) {
	  case IT_WEAPON:
	  case IT_ARMOR:
	  case IT_PETEGG:
	  case IT_PETARMOR:
+         case IT_CHARM:
		  return 0;

Fixed version:
Src for Renewal (manually add): Charms.txt

Edited Annie's fix for older eA revisions: eA_Charms.txt

 

Don't try to update this as a .diff, just a suggestion.

Edited by Pillows
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  333
  • Reputation:   67
  • Joined:  09/05/12
  • Last Seen:  

thanks for this, i was looking for complete src mods for this charm system but i wasn't able to find one because eA was already down.

 

Tested and worked perfectly!

You just forget to add the correct item_db script so anyone can use this.

#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

But still, not working in Gunslinger & Ninja

I wish someone will provide fix for Gunslinger & Ninja problem in Charms Mod

Edited by GodKnows Jhomz
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   2
  • Joined:  08/12/12
  • Last Seen:  

thanks for this, i was looking for complete src mods for this charm system but i wasn't able to find one because eA was already down.

 

Tested and worked perfectly!

You just forget to add the correct item_db script so anyone can use this.

#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

But still, not working in Gunslinger & Ninja

I wish someone will provide fix for Gunslinger & Ninja problem in Charms Mod

Oh, I never noticed. I have no idea why the original modification left out those classes.

I came up with a fix, let me know if there's any more problems.

 

Replace (status.c):

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && ( 1 << sd->class_ & MAPID_BASEMASK ) & sd->inventory_data[i]->class_base[ sd->class_ & JOBL_2_1? 1: sd->class_ & JOBL_2_2? 2:0 ] && ( 1 << ( sd->class_ & JOBL_UPPER? 1: sd->class_ & JOBL_BABY? 2:0 ) ) & sd->inventory_data[i]->class_upper ) {

With this:

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && sd->inventory_data[i]->class_upper ) {

Updated original post!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  333
  • Reputation:   67
  • Joined:  09/05/12
  • Last Seen:  

 

thanks for this, i was looking for complete src mods for this charm system but i wasn't able to find one because eA was already down.

 

Tested and worked perfectly!

You just forget to add the correct item_db script so anyone can use this.

#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

But still, not working in Gunslinger & Ninja

I wish someone will provide fix for Gunslinger & Ninja problem in Charms Mod

Oh, I never noticed. I have no idea why the original modification left out those classes.

I came up with a fix, let me know if there's any more problems.

 

Replace (status.c):

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && ( 1 << sd->class_ & MAPID_BASEMASK ) & sd->inventory_data[i]->class_base[ sd->class_ & JOBL_2_1? 1: sd->class_ & JOBL_2_2? 2:0 ] && ( 1 << ( sd->class_ & JOBL_UPPER? 1: sd->class_ & JOBL_BABY? 2:0 ) ) & sd->inventory_data[i]->class_upper ) {

With this:

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && sd->inventory_data[i]->class_upper ) {

Updated original post!

 

Thanks for this !

But already fixed mine by getting my old src code for status.c file.

this is the codes that I get somewhere here in rA or in eA forum.

 

From :

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && ( 1 << sd->class_ & MAPID_BASEMASK ) & sd->inventory_data[i]->class_base[ sd->class_ & JOBL_2_1? 1: sd->class_ & JOBL_2_2? 2:0 ] && ( 1 << ( sd->class_ & JOBL_UPPER? 1: sd->class_ & JOBL_BABY? 2:0 ) ) & sd->inventory_data[i]->class_upper ) {

To :

if ( sd->inventory_data[i]->script && 0 < sd->status.base_level && sd->inventory_data[i]->class_upper ) {
run_script( sd->inventory_data[i]->script, 0, sd->bl.id, 0 );
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   2
  • Joined:  08/12/12
  • Last Seen:  

 

 

thanks for this, i was looking for complete src mods for this charm system but i wasn't able to find one because eA was already down.

 

Tested and worked perfectly!

You just forget to add the correct item_db script so anyone can use this.

#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

But still, not working in Gunslinger & Ninja

I wish someone will provide fix for Gunslinger & Ninja problem in Charms Mod

Oh, I never noticed. I have no idea why the original modification left out those classes.

I came up with a fix, let me know if there's any more problems.

 

Replace (status.c):

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && ( 1 << sd->class_ & MAPID_BASEMASK ) & sd->inventory_data[i]->class_base[ sd->class_ & JOBL_2_1? 1: sd->class_ & JOBL_2_2? 2:0 ] && ( 1 << ( sd->class_ & JOBL_UPPER? 1: sd->class_ & JOBL_BABY? 2:0 ) ) & sd->inventory_data[i]->class_upper ) {

With this:

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && sd->inventory_data[i]->class_upper ) {

Updated original post!

 

Thanks for this !

But already fixed mine by getting my old src code for status.c file.

this is the codes that I get somewhere here in rA or in eA forum.

 

From :

if ( sd->inventory_data[i]->script && sd->inventory_data[i]->elv <= sd->status.base_level && ( 1 << sd->class_ & MAPID_BASEMASK ) & sd->inventory_data[i]->class_base[ sd->class_ & JOBL_2_1? 1: sd->class_ & JOBL_2_2? 2:0 ] && ( 1 << ( sd->class_ & JOBL_UPPER? 1: sd->class_ & JOBL_BABY? 2:0 ) ) & sd->inventory_data[i]->class_upper ) {

To :

if ( sd->inventory_data[i]->script && 0 < sd->status.base_level && sd->inventory_data[i]->class_upper ) {
run_script( sd->inventory_data[i]->script, 0, sd->bl.id, 0 );

 

That's the same line of code.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  333
  • Reputation:   67
  • Joined:  09/05/12
  • Last Seen:  

Oh didn't notice that, coz in my code it has the level requirement. and I set it to 0 so anyone can use it.
Btw thanks for the release and fix.

Link to comment
Share on other sites

  • 4 years later...

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   23
  • Joined:  04/28/12
  • Last Seen:  

I have updated this patch. See below.

 

Link to comment
Share on other sites

  • 10 months later...

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  148
  • Reputation:   21
  • Joined:  11/12/18
  • Last Seen:  

On 4/5/2019 at 6:53 PM, iwillnot said:

I have updated this patch. See below.

 

image.thumb.png.2f3f9b08ae6226a40b04bfa927d4516a.png
can you help me with this error??

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

On 2/25/2020 at 2:08 AM, Forshaken said:

image.thumb.png.2f3f9b08ae6226a40b04bfa927d4516a.png
can you help me with this error??

can i have the link of the patch?

can someone update this ? thanks !

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  148
  • Reputation:   21
  • Joined:  11/12/18
  • Last Seen:  

1 hour ago, Takuyakii said:

can i have the link of the patch?

can someone update this ? thanks !

Fixed

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

1 minute ago, Forshaken said:

Fixed

How? can you comment here how ? and can you paste the code herE?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  148
  • Reputation:   21
  • Joined:  11/12/18
  • Last Seen:  

14 hours ago, Takuyakii said:

How? can you comment here how ? and can you paste the code herE?

Do you got my previous error?

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Forshaken said:

Do you got my previous error?

 

Nope, btw i found the patch file that im requesting , thanks and solved.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  62
  • Reputation:   2
  • Joined:  01/16/12
  • Last Seen:  

how to fixed this ?

image.png

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  491
  • Reputation:   19
  • Joined:  11/19/11
  • Last Seen:  

any solution for this ?

thx

error.jpg

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  70
  • Reputation:   21
  • Joined:  11/08/15
  • Last Seen:  

I change this:

map/pc.cpp

--- map/pc.c (revision 14843)
+++ map/pc.c (working copy)
@@ -3444,6 +3444,7 @@
	clif_updatestatus(sd,SP_WEIGHT);
	//Auto-equip
	if(data->flag.autoequip) pc_equipitem(sd, i, data->equip);
+	if(data->type == IT_CHARM) status_calc_pc(sd,0);//dh
	return 0;

To:

if (id->type == IT_CHARM) status_calc_pc(sd, SCO_NONE); //dh

Now the next part:

@@ -3470,6 +3473,8 @@
	if(!(type&2))
		clif_updatestatus(sd,SP_WEIGHT);

+	if(mem == IT_CHARM) status_calc_pc(sd,0);//dh
+
return 0;

To:

if(mem == IT_CHARM) status_calc_pc(sd, SCO_NONE);//dh

 

map/itemdb.cpp

	id->type = atoi(str[3]);

-	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_DELAYCONSUME && id->type < IT_CASH ) || id->type >= IT_MAX )
+	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_CHARM && id->type < IT_CASH ) || id->type >= IT_MAX )
	{// catch invalid item types
		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %d. IT_ETC will be used.\n", id->type, nameid);
		id->type = IT_ETC;

TO:

if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_SHADOWGEAR && id->type < IT_CASH && id->type > IT_CHARM ) ||  id->type >= IT_MAX  )

I don't know about this part but... still working. 

 

db/import/itemdb.txt

#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

TO:

30050,Charm,Charm,13,6,,0,,,,,0xFFFFFFFF,15,2,,,1,,,{bonus bStr,2; },{},{}

Change to your ID.

 

image.png.e9727dfb5a4c5f5d6a5c8b968e0f1b92.png

  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  491
  • Reputation:   19
  • Joined:  11/19/11
  • Last Seen:  

7 hours ago, Scanty said:

I change this:

map/pc.cpp


--- map/pc.c (revision 14843)
+++ map/pc.c (working copy)
@@ -3444,6 +3444,7 @@
	clif_updatestatus(sd,SP_WEIGHT);
	//Auto-equip
	if(data->flag.autoequip) pc_equipitem(sd, i, data->equip);
+	if(data->type == IT_CHARM) status_calc_pc(sd,0);//dh
	return 0;

To:


if (id->type == IT_CHARM) status_calc_pc(sd, SCO_NONE); //dh

Now the next part:


@@ -3470,6 +3473,8 @@
	if(!(type&2))
		clif_updatestatus(sd,SP_WEIGHT);

+	if(mem == IT_CHARM) status_calc_pc(sd,0);//dh
+
return 0;

To:


if(mem == IT_CHARM) status_calc_pc(sd, SCO_NONE);//dh

 

map/itemdb.cpp


	id->type = atoi(str[3]);

-	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_DELAYCONSUME && id->type < IT_CASH ) || id->type >= IT_MAX )
+	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_CHARM && id->type < IT_CASH ) || id->type >= IT_MAX )
	{// catch invalid item types
		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %d. IT_ETC will be used.\n", id->type, nameid);
		id->type = IT_ETC;

TO:


if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_SHADOWGEAR && id->type < IT_CASH && id->type > IT_CHARM ) ||  id->type >= IT_MAX  )

I don't know about this part but... still working. 

 

db/import/itemdb.txt


#####,Charm,Charm,12,50,,0,,,,,0xFFFFFFFF,15,2,,,60,,,{ bonus bAllStats,100; },{},{}

TO:


30050,Charm,Charm,13,6,,0,,,,,0xFFFFFFFF,15,2,,,1,,,{bonus bStr,2; },{},{}

Change to your ID.

 

image.png.e9727dfb5a4c5f5d6a5c8b968e0f1b92.png

thx work like a charm ?

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  16
  • Reputation:   0
  • Joined:  10/07/20
  • Last Seen:  

how to make 5 of charm will only work in inventory then if have 6 only 5 will work

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  92
  • Reputation:   4
  • Joined:  06/21/15
  • Last Seen:  

Hello can anyone help? 

[Warning]: Item 40315 (Lucky Charm of Strength) is an equipment with no equip-field! Making it an etc item.
 

png-transparent-paper-parchment-scroll-others-orange-parchment-scroll.png

Link to comment
Share on other sites

  • 8 months later...

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.01
  • Content Count:  44
  • Reputation:   1
  • Joined:  04/15/20
  • Last Seen:  

does this work on latest rathena who uses itemdb.yml isntead of text ? im getting the error on the item 

"IInvalid item equip location as it has no equip location, defaulting to IT_ETC"

Link to comment
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...