• 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!

Stop loosing Backback OR Items upon death?

Nevalopo

Demigod
Joined
Jul 21, 2008
Messages
5,165
Reaction score
68
Location
Sweden, Landskrona
Stop loosing Backback OR Items upon death?
I did some research and i cant find any way to do it in lua. So.. It has to be source. Anyone know how to make the players stop dropping items or backpacks when they login? This is what i found in the source code. Player.cpp

Code:
bool Player::onDeath()
{
	Item* preventLoss = NULL;
	Item* preventDrop = NULL;
	if(getZone() == ZONE_PVP)
	{
		setDropLoot(LOOT_DROP_NONE);
		setLossSkill(false);
	}
	else if(skull < SKULL_RED && g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED)
	{
		for(uint8_t i = SLOT_FIRST; ((skillLoss || lootDrop == LOOT_DROP_FULL) && i < SLOT_LAST); ++i)
		{
			if(Item* item = getInventoryItem((slots_t)i))
			{
				const ItemType& it = Item::items[item->getID()];
				if(lootDrop == LOOT_DROP_FULL && it.abilities.preventDrop)
				{
					setDropLoot(LOOT_DROP_PREVENT);
					preventDrop = item;
				}

				if(skillLoss && !preventLoss && it.abilities.preventLoss)
					preventLoss = item;
			}
		}
	}

	if(!Creature::onDeath())
	{
		if(preventDrop)
			setDropLoot(LOOT_DROP_FULL);

		return false;
	}

	if(preventLoss)
	{
		setLossSkill(false);
		if(preventLoss->getCharges() > 1) //weird, but transform failed to remove for some hosters
			g_game.transformItem(preventLoss, preventLoss->getID(), std::max(0, ((int32_t)preventLoss->getCharges() - 1)));
		else
			g_game.internalRemoveItem(NULL, preventDrop);
	}

	if(preventDrop && preventDrop != preventLoss)
	{
		if(preventDrop->getCharges() > 1) //weird, but transform failed to remove for some hosters
			g_game.transformItem(preventDrop, preventDrop->getID(), std::max(0, ((int32_t)preventDrop->getCharges() - 1)));
		else
			g_game.internalRemoveItem(NULL, preventDrop);
	}

has to be something there.. right? If anyone can point out what to remove/edit i will be happy :) Thankz
 

Similar threads

Back
Top