Jump to content
  • 0

About SC_ITEMBOOST


Jayz

Question


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

How can I make SC_ITEMBOOST not be effective for a specific item or mob id, for example for Knife_/1202 or Poring/1002, so that even if SC_ITEMBOOST is used, it will still retain its original drop rate?

if (sd->sc.getSCE(SC_ITEMBOOST))
                drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
Edited by Jayz
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  7
  • Reputation:   5
  • Joined:  03/09/23
  • Last Seen:  

22 hours ago, Jayz said:

How can I make SC_ITEMBOOST not be effective for a specific item or mob id, for example for Knife_/1202 or Poring/1002, so that even if SC_ITEMBOOST is used, it will still retain its original drop rate?

if (sd->sc.getSCE(SC_ITEMBOOST))
                drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
if (sd->sc.getSCE(SC_ITEMBOOST)) {

    // List of item IDs and mob IDs to exclude
    int excluded_item_ids[] = {1202}; // Knife_ = 1202
    int excluded_mob_ids[] = {1002}; // Poring = 1002

    // Check if the current item_id and mob_id are not in the excluded lists
    bool is_excluded_item = false;
    bool is_excluded_mob = false;
    
    for(int i = 0; i < sizeof(excluded_item_ids)/sizeof(excluded_item_ids[0]); i++) {
        if(item_id == excluded_item_ids[i]) {
            is_excluded_item = true;
            break;
        }
    }

    for(int i = 0; i < sizeof(excluded_mob_ids)/sizeof(excluded_mob_ids[0]); i++) {
        if(mob_id == excluded_mob_ids[i]) {
            is_excluded_mob = true;
            break;
        }
    }

    // Only apply the SC_ITEMBOOST if the item and mob aren't in the excluded lists
    if(!is_excluded_item && !is_excluded_mob) {
        drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
    }
}

You can test this or at least get an idea to follow

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

29 minutes ago, Lincoln Binda said:
if (sd->sc.getSCE(SC_ITEMBOOST)) {

    // List of item IDs and mob IDs to exclude
    int excluded_item_ids[] = {1202}; // Knife_ = 1202
    int excluded_mob_ids[] = {1002}; // Poring = 1002

    // Check if the current item_id and mob_id are not in the excluded lists
    bool is_excluded_item = false;
    bool is_excluded_mob = false;
    
    for(int i = 0; i < sizeof(excluded_item_ids)/sizeof(excluded_item_ids[0]); i++) {
        if(item_id == excluded_item_ids[i]) {
            is_excluded_item = true;
            break;
        }
    }

    for(int i = 0; i < sizeof(excluded_mob_ids)/sizeof(excluded_mob_ids[0]); i++) {
        if(mob_id == excluded_mob_ids[i]) {
            is_excluded_mob = true;
            break;
        }
    }

    // Only apply the SC_ITEMBOOST if the item and mob aren't in the excluded lists
    if(!is_excluded_item && !is_excluded_mob) {
        drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
    }
}

You can test this or at least get an idea to follow

I see now i understand the logic,, btw about the mob_id and item_id have error undeclared identifier how to declare this identifier? for adding int mob_id;  ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  7
  • Reputation:   5
  • Joined:  03/09/23
  • Last Seen:  

8 minutes ago, Jayz said:

I see now i understand the logic,, btw about the mob_id and item_id have error undeclared identifier how to declare this identifier? for adding int mob_id;  ?

For mob_id:

If you're in a context where a monster is being handled (like in the drop function), you might have access to a mob_data structure or something similar, from which you can get the monster ID. It might look something like this:
 

int mob_id = md->class_;

'md' is a commonly used abbreviation for mob_data in rAthena source code.

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

14 minutes ago, Lincoln Binda said:

For mob_id:

If you're in a context where a monster is being handled (like in the drop function), you might have access to a mob_data structure or something similar, from which you can get the monster ID. It might look something like this:
 

int mob_id = md->class_;

'md' is a commonly used abbreviation for mob_data in rAthena source code.

I use md->mob_id and i think its working fine,, but my problem now when i use @mi 1002 the mapserver is crash,

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

4 minutes ago, Jayz said:

I use md->mob_id and i think its working fine,, but my problem now when i use @mi 1002 the mapserver is crash,

I found the issue about @mobinfo but i use the excluded_item_ids since both are same concept and it work, when i use @whodrops 1202 the Knife rate will not affected on SC_ITEMBOOST but when i use @mi the Knife is affected by SC_ITEMBOOST all i can say is its working we need to find the logic on @mi command thanks

 

image.png.ff6cc93767d275a5fe2af1d1ba581e4b.png

image.png.ff559beb5ed0bb7b6837de7555320c3e.png

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  7
  • Reputation:   5
  • Joined:  03/09/23
  • Last Seen:  

4 minutes ago, Jayz said:

I found the issue about @mobinfo but i use the excluded_item_ids since both are same concept and it work, when i use @whodrops 1202 the Knife rate will not affected on SC_ITEMBOOST but when i use @mi the Knife is affected by SC_ITEMBOOST all i can say is its working we need to find the logic on @mi command thanks

 

image.png.ff6cc93767d275a5fe2af1d1ba581e4b.png

image.png.ff559beb5ed0bb7b6837de7555320c3e.png

 

It's late for me, it's almost 3 am here, anyway it's an interesting setup, tomorrow I'll test it to eliminate the conflicts

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

1 minute ago, Lincoln Binda said:

It's late for me, it's almost 3 am here, anyway it's an interesting setup, tomorrow I'll test it to eliminate the conflicts

Okay thank you for the idea ill try to my end to find the conflicts and i will wait your's because im newbie on src starting learning

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  896
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

Go to atcommand.cpp and search for mi/ monsterinfo. Do ur changes and problem was solved.

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  7
  • Reputation:   5
  • Joined:  03/09/23
  • Last Seen:  

3 hours ago, Jayz said:

Okay thank you for the idea ill try to my end to find the conflicts and i will wait your's because im newbie on src starting learning

Let the necessary changes
in the 'mob.cpp' file:

change it:
 

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md)

 

to:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md, int nameid)



still in the same file, in the same function, change this:

if (sd->sc.getSCE(SC_ITEMBOOST))
				drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;


to:

if (sd->sc.getSCE(SC_ITEMBOOST)) {

				int mob_id = mob->id;
				int item_id = nameid;
				
				int excluded_item_ids[] = {1202}; // Knife_ = 1202
				int excluded_mob_ids[] = {1002}; // Poring = 1002

				bool is_excluded_item = false;
				bool is_excluded_mob = false;
				
				for(int i = 0; i < sizeof(excluded_item_ids)/sizeof(excluded_item_ids[0]); i++) {
					if(item_id == excluded_item_ids[i]) {
						is_excluded_item = true;
						break;
					}
				}

				for(int i = 0; i < sizeof(excluded_mob_ids)/sizeof(excluded_mob_ids[0]); i++) {
					if(mob_id == excluded_mob_ids[i]) {
						is_excluded_mob = true;
						break;
					}
				}

				// Only apply the SC_ITEMBOOST if the item and mob aren't in the excluded lists
				if(!is_excluded_item && !is_excluded_mob) {
					drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
				}
			}



inside the loop "for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {"
Change it:

drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier, md);


to:

drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier, md, md->db->dropitem[i].nameid);




in archive 'mob.hpp' change it:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md = nullptr);


to:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md, int nameid);




and finally in the 'atcommand.cpp' file, change it:

int droprate = mob_getdroprate( &sd->bl, mob, mob->dropitem[i].rate, drop_modifier );


to:

int droprate = mob_getdroprate( &sd->bl, mob, mob->dropitem[i].rate, drop_modifier, nullptr, mob->dropitem[i].nameid );



I had to use a breakpoint in visual studio to find out that the md->mob_id was null and that's why the @mi command was closing the map-server.

soon I realized that inside the function there is already mob data just by accessing the 'mob->id'.

the item_id conflict I solved by adding a new parameter, consequently it is mandatory to change the parameters for the other calls, maybe there is a better way to access the item_id but this way works great for me.

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

2 hours ago, Lincoln Binda said:

Let the necessary changes
in the 'mob.cpp' file:

change it:
 

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md)

 

to:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md, int nameid)



still in the same file, in the same function, change this:

if (sd->sc.getSCE(SC_ITEMBOOST))
				drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;


to:

if (sd->sc.getSCE(SC_ITEMBOOST)) {

				int mob_id = mob->id;
				int item_id = nameid;
				
				int excluded_item_ids[] = {1202}; // Knife_ = 1202
				int excluded_mob_ids[] = {1002}; // Poring = 1002

				bool is_excluded_item = false;
				bool is_excluded_mob = false;
				
				for(int i = 0; i < sizeof(excluded_item_ids)/sizeof(excluded_item_ids[0]); i++) {
					if(item_id == excluded_item_ids[i]) {
						is_excluded_item = true;
						break;
					}
				}

				for(int i = 0; i < sizeof(excluded_mob_ids)/sizeof(excluded_mob_ids[0]); i++) {
					if(mob_id == excluded_mob_ids[i]) {
						is_excluded_mob = true;
						break;
					}
				}

				// Only apply the SC_ITEMBOOST if the item and mob aren't in the excluded lists
				if(!is_excluded_item && !is_excluded_mob) {
					drop_rate_bonus += sd->sc.getSCE(SC_ITEMBOOST)->val1;
				}
			}



inside the loop "for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {"
Change it:

drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier, md);


to:

drop_rate = mob_getdroprate(src, md->db, md->db->dropitem[i].rate, drop_modifier, md, md->db->dropitem[i].nameid);




in archive 'mob.hpp' change it:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md = nullptr);


to:

int mob_getdroprate(struct block_list *src, std::shared_ptr<s_mob_db> mob, int base_rate, int drop_modifier, mob_data* md, int nameid);




and finally in the 'atcommand.cpp' file, change it:

int droprate = mob_getdroprate( &sd->bl, mob, mob->dropitem[i].rate, drop_modifier );


to:

int droprate = mob_getdroprate( &sd->bl, mob, mob->dropitem[i].rate, drop_modifier, nullptr, mob->dropitem[i].nameid );



I had to use a breakpoint in visual studio to find out that the md->mob_id was null and that's why the @mi command was closing the map-server.

soon I realized that inside the function there is already mob data just by accessing the 'mob->id'.

the item_id conflict I solved by adding a new parameter, consequently it is mandatory to change the parameters for the other calls, maybe there is a better way to access the item_id but this way works great for me.

It really work thank you for your effort, now im reading the change and analyze it so next time i can do it by myself btw i start learning first the breakpoint in visual studio so if i had map crash error i easily detected,

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

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