• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Fix/Patch 'Global like' bless system

ruda

Member
Joined
Jul 4, 2008
Messages
164
Reaction score
15
Location
Brazil
Well, this is the first time i tried something with C++. Since I was asking to Talaturen to add this since 0.2.7 and he didn't, I decided to do it by myself.

I tested on 0.2.7, but works fine on every 0.2+, since the function is the same.

replace all the void Player::dropLoot(Container* corpse) with this:

player.cpp
Code:
void Player::dropLoot(Container* corpse)
{
	if(corpse && lootDrop)
	{
		int16_t b = 0;
		for(int16_t i = 0; i < 5; i++)
		{
			if(hasBlessing(i))
				b++;
		}
		
		if(b < 5 || getSkull() == SKULL_RED || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED)
		{
			if(inventory[SLOT_NECKLACE] && inventory[SLOT_NECKLACE]->getID() == ITEM_AMULETOFLOSS &&
				getSkull() != SKULL_RED && g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED)
			{
				g_game.internalRemoveItem(inventory[SLOT_NECKLACE], 1);
			}
			else
			{
				int itemBlessPc[6] = {10, 7, 5, 3, 1, 0};
				int containerBlessPc[6] = {100, 70, 45, 25, 10, 0};
				
				for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i)
				{
					Item* item = inventory[i];
					if(item)
					{
						if(((item->getContainer() && random_range(1, 100) <= containerBlessPc[b]) ||
							random_range(1, 100) <= itemBlessPc[b] || getSkull() == SKULL_RED))
						{
							g_game.internalMoveItem(this, corpse, INDEX_WHEREEVER, item, item->getItemCount(), 0);
							sendRemoveInventoryItem((slots_t)i, inventory[(slots_t)i]);
						}
					}
				}
			}
		}
	}

	if(!inventory[SLOT_BACKPACK])
		__internalAddThing(SLOT_BACKPACK, Item::CreateItem(1987));
}

The itemBlessPc are the loss% from 0 bless(10%) to 5 bless(0%). The same to containerBlessPc. I guess it doesn't need the value '0' in the array, but whatever.


edit:
If you dont know how is the actual bless system, take a look at this. The red is the old system, green is the new.
itemloss.png
 
4 noobs in a row what a nice day, in 0.4 and 0.3.6 is included almost same code only mystic spirit dont have this code...
 
"I tested on 0.2.7, but works fine on every 0.2+, since the function is the same."

0.2 = 0.3.1 = 0.4? - no..
 
Back
Top