Jump to content

block drop on a map


Recommended Posts

  • Premium

A simple code that you can configure in the vector to add the maps where you do not want any boss or mob to drop their items.

 

service.h

#define ENABLE_BLOCK_DROP_MAP

utils.h

search:

extern void set_global_time(time_t t);

add:

#ifdef ENABLE_BLOCK_DROP_MAP
	extern bool is_drop_item(int map_index);
#endif

utils.cpp

add:

#ifdef ENABLE_BLOCK_DROP_MAP
bool is_drop_item(int map_index){
	vector<int> DropMap {41}; // -- add index the map (41 == jinno map)
	
	//dungeon
	for (int i=180000; i<190000; i++) DropMap.push_back(i);
	
	return std::find(DropMap.begin(), DropMap.end(), map_index) != DropMap.end();
}
#endif

char_battle.cpp

search:
				else if (IsRevive() == true)
				{
					Reward(false);
				}
				else
				{
					Reward(true); // Drops gold, item, etc..
				}
replace:

				else if (IsRevive() == true)
				{
					Reward(false);
				}
				else
				{
#ifdef ENABLE_BLOCK_DROP_MAP
					if (is_drop_item(GetMapIndex())){
						Reward(false);}
					else
					{
						Reward(true);
					}
				}
#else
					Reward(true);
				}
#endif

 

  • Metin2 Dev 1
Link to comment
Share on other sites

  • Premium
Posted (edited)

image.png?ex=65afc54b&is=659d504b&hm=8ae

What's this supposed to be?

Edited by Metin2 Dev International
Core X - External 2 Internal

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

Your code has some really bad practice, inserting 10000 rows in that vector for every call to function make unecessary lag (use if (x >=xr && y <= yr)), however your code should look more like this

#ifdef ENABLE_BLOCK_DROP_MAP
                    if (is_drop_item(GetMapIndex())){
                        Reward(false);}
                    else
                    {
                        Reward(true);
                    }
                }
#else
                    Reward(true);
                }
#endif



to 

#ifdef ENABLE_BLOCK_DROP_MAP

                    bool bIsRewardItem = is_drop_item(GetDungeon() ? (GetDungeon()->GetMapIndex() / 10000) : GetMapIndex());
                    Reward(!bIsRewardItem);

#else
                    Reward(true);
                }
#endif

and

bool is_drop_item(int map_index)
{
    const std::unordered_set<int> DropMap{41};
    return DropMap.find(map_index) != DropMap.end();
}

(Didn't tested but should work)

Take it as an advice, hf.

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.