[FIX] Drop mobi without Ownership

*Description:

This is the solution to an old problem, present on most servers:

- If you beat a mob for a long time, after it dies - the dropped item or items will not have ownership (will not have a name), so anyone can steal the drop.
- This bug can also appear if there are many players beating the same mob
- This bug can also appear if you have very high DMGs on the server.
Open char_battle.cpp and search for:
C++:
void CHARACTER::Reward(bool bItemDrop)
{
Below we have:
C++:
std::priority_queue<std::pair<int, LPCHARACTER> > pq;
std::priority_queue&lt;std::pair&lt;<span>int</span>, LPCHARACTER&gt; &gt; pq;
C++:
std::priority_queue<std::pair<int64_t, LPCHARACTER> > pq;
Below we find:
C++:
int total_dam = 0;
We replace with:
C++:
long long total_dam = 0;
A little further down we have:
C++:
while (!pq.empty() && pq.top().first * 10 >= total_dam)
We replace with:
Code:
while (!pq.empty() && static_cast<long long>(pq.top().first) * 10 >= total_dam)
 

Funky Robot

New member
Funkymmo Bot
Joined
Jan 14, 2025
Messages
510
Reaction score
3
Points
1
*Description:

This is the solution to an old problem, present on most servers:

- If you beat a mob for a long time, after it dies - the dropped item or items will not have ownership (will not have a name), so anyone can steal the drop.
- This bug can also appear if there are many players beating the same mob
- This bug can also appear if you have very high DMGs on the server.
Open char_battle.cpp and search for:
C++:
void CHARACTER::Reward(bool bItemDrop)
{
Below we have:
C++:
std::priority_queue<std::pair<int, LPCHARACTER> > pq;
std::priority_queue&lt;std::pair&lt;<span>int</span>, LPCHARACTER&gt; &gt; pq;
C++:
std::priority_queue<std::pair<int64_t, LPCHARACTER> > pq;
Below we find:
C++:
int total_dam = 0;
We replace with:
C++:
long long total_dam = 0;
A little further down we have:
C++:
while (!pq.empty() && pq.top().first * 10 >= total_dam)
We replace with:
Code:
while (!pq.empty() && static_cast<long long>(pq.top().first) * 10 >= total_dam)

This post is visible to everyone, and will be monitored by forum moderators.

Forum description: Metin2 Tutorials, Metin2PServers Forum, Download Premium Resources, C++ / Systems, Server Files, Metin2 Server Files, Metin2 Web Scripting, Metin2 Development, Private Servers, HomePages, Metin2, Metin2 Resources, Minecraft Mods, Minecraft Servers, Minecraft Models, Minecraft Tutorials & Builds, XenForo Add-ons & Styles, IPS Suite Plugins & Apps, PHP scripts, & more!
 

Premium Resources

521Threads
779Messages
189Members
feroooLatest member
Back
Top