Jayz Posted August 11, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Share Posted August 11, 2023 (edited) 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 August 11, 2023 by Jayz Quote Link to comment Share on other sites More sharing options...
0 Lincoln Binda Posted August 12, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 7 Reputation: 5 Joined: 03/09/23 Last Seen: January 13 Share Posted August 12, 2023 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 1 Quote Link to comment Share on other sites More sharing options...
0 Jayz Posted August 12, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Author Share Posted August 12, 2023 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; ? Quote Link to comment Share on other sites More sharing options...
0 Lincoln Binda Posted August 12, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 7 Reputation: 5 Joined: 03/09/23 Last Seen: January 13 Share Posted August 12, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
0 Jayz Posted August 12, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Author Share Posted August 12, 2023 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, Quote Link to comment Share on other sites More sharing options...
0 Jayz Posted August 12, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Author Share Posted August 12, 2023 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 1 Quote Link to comment Share on other sites More sharing options...
0 Lincoln Binda Posted August 12, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 7 Reputation: 5 Joined: 03/09/23 Last Seen: January 13 Share Posted August 12, 2023 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 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 Quote Link to comment Share on other sites More sharing options...
0 Jayz Posted August 12, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Author Share Posted August 12, 2023 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 Quote Link to comment Share on other sites More sharing options...
0 Rynbef Posted August 12, 2023 Group: Forum Moderator Topic Count: 48 Topics Per Day: 0.01 Content Count: 941 Reputation: 125 Joined: 05/23/12 Last Seen: 4 hours ago Share Posted August 12, 2023 Go to atcommand.cpp and search for mi/ monsterinfo. Do ur changes and problem was solved. Rynbef~ Quote Link to comment Share on other sites More sharing options...
0 Lincoln Binda Posted August 12, 2023 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 7 Reputation: 5 Joined: 03/09/23 Last Seen: January 13 Share Posted August 12, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
0 Jayz Posted August 12, 2023 Group: Members Topic Count: 59 Topics Per Day: 0.01 Content Count: 407 Reputation: 55 Joined: 07/24/12 Last Seen: October 22, 2024 Author Share Posted August 12, 2023 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, 1 Quote Link to comment Share on other sites More sharing options...
Question
Jayz
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?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.