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

[7.4] Avesta

Try that function:

Code:
void Player::dropLoot(Container* corpse)
{
	if(!corpse){             
		return;
	}	

	uint32_t itemLoss = lossPercent[LOSS_ITEMS];
#ifdef __SKULLSYSTEM__
	if(getSkull() == SKULL_RED){
		itemLoss = 100;
	}
#endif
	if(!lootDrop){
		itemLoss = 0;
	}

	if(itemLoss > 0){
		for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
			Item* item = inventory[i];
			if(item && ((item->getContainer()) || ((uint32_t)random_range(1, 100)) <= itemLoss)){
				g_game.internalMoveItem(this, corpse, INDEX_WHEREEVER, item, item->getItemCount(), 0);
			}
		}
	}
	else if (itemLoss == 0) {
		for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
			Item* item = inventory[i];
			if (item && Item::items[item->getID()].abilities.preventItemLoss != 0) {
				g_game.internalRemoveItem(item);
			}
		}
	}
}
 
Try that function:

Code:
void Player::dropLoot(Container* corpse)
{
    if(!corpse){             
        return;
    }    

    uint32_t itemLoss = lossPercent[LOSS_ITEMS];
#ifdef __SKULLSYSTEM__
    if(getSkull() == SKULL_RED){
        itemLoss = 100;
    }
#endif
    if(!lootDrop){
        itemLoss = 0;
    }

    if(itemLoss > 0){
        for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
            Item* item = inventory[i];
            if(item && ((item->getContainer()) || ((uint32_t)random_range(1, 100)) <= itemLoss)){
                g_game.internalMoveItem(this, corpse, INDEX_WHEREEVER, item, item->getItemCount(), 0);
            }
        }
    }
    else if (itemLoss == 0) {
        for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){
            Item* item = inventory[i];
            if (item && Item::items[item->getID()].abilities.preventItemLoss != 0) {
                g_game.internalRemoveItem(item);
            }
        }
    }
}

No dude stop posting the same code, use this one instead it's checked and it works 100%.

http://otland.net/f18/7-4-avesta-39366/index20.html#post1716902
 
No dude stop posting the same code, use this one instead it's checked and it works 100%.

http://otland.net/f18/7-4-avesta-39366/index20.html#post1716902

Just changed that line:
Code:
if (item && Item::items[item->getID()].abilities.preventLoss != 0) {

For that:
Code:
if (item && Item::items[item->getID()].abilities.preventItemLoss != 0) {

The diff is abilities.preventLoss for that abilities.prevenItemLoss

And I'm not using that sources, mine is based in OTServ_SVN 0.6.3 (Avesta), and it works 100%
 
Anyone got the Avesta 7.4 fix for double hit by creatures?
There is no fix anywhere ;)

Oh yea, I preffer useing another AAC then Nicaw for Avesta, its easy to hack via Shell file, theres a bug somewhere ;)
 
@Acubens

Yes, both are necessary!

- - - Updated - - -

Anyone got the Avesta 7.4 fix for double hit by creatures?
There is no fix anywhere ;)

Oh yea, I preffer useing another AAC then Nicaw for Avesta, its easy to hack via Shell file, theres a bug somewhere ;)

Check it --> http://otland.net/f35/monsters-double-hit-176613/
 
That aint a fix, it will remove the first attack by creatures..
Causeing a bug by fixing one, aint a fix :p

Thanks anyway ;)

Yours,
Last World
 
Anyone knows a way to make it possible to buy packpacks of runes/fluids/other items? (via NPC)
 
Someone can help me with this error. I want to compile on linux.
Code:
++ -DHAVE_CONFIG_H -I.    -I/usr/include/libxml2  -I/usr/include/lua5.1    -D__USE_MYSQL__     -D__PROTOCOL_76__ -D_THREAD_SAFE -D_REENTRANT -Wall -g -O2 -MT databasemysql.o -MD -MP -MF .deps/databasemysql.Tpo -c -o databasemysql.o databasemysql.cpp
mv -f .deps/databasemysql.Tpo .deps/databasemysql.Po
g++ -DHAVE_CONFIG_H -I.    -I/usr/include/libxml2  -I/usr/include/lua5.1    -D__USE_MYSQL__     -D__PROTOCOL_76__ -D_THREAD_SAFE -D_REENTRANT -Wall -g -O2 -MT account.o -MD -MP -MF .deps/account.Tpo -c -o account.o account.cpp
mv -f .deps/account.Tpo .deps/account.Po
g++ -DHAVE_CONFIG_H -I.    -I/usr/include/libxml2  -I/usr/include/lua5.1    -D__USE_MYSQL__     -D__PROTOCOL_76__ -D_THREAD_SAFE -D_REENTRANT -Wall -g -O2 -MT container.o -MD -MP -MF .deps/container.Tpo -c -o container.o container.cpp
In file included from cylinder.h:25,
                 from container.h:25,
                 from container.cpp:22:
thing.h: In member function ‘virtual std::string Thing::getXRayDescription() const’:
thing.h:121: error: aggregate ‘std::stringstream ret’ has incomplete type and cannot be defined
make[1]: *** [container.o] Błąd 1
 
I have a slight problem, I want to update the player online status onLogin and onLogout, but I don't know the syntax to execute SQL queries via creatureScripts. Anyone know?
 
In ioplayer.cpp:

After this function
Code:
void IOPlayer::loadItems(ItemMap& itemMap, DBResult* result)

Add this:
Code:
void IOPlayer::updateLoginInfo(Player* player)
{
	Database* db = Database::instance();
	DBQuery query;

	query << "UPDATE `players` SET `status` = 1"
			<< " WHERE `id` = " << player->getGUID();

	db->executeQuery(query.str());
}

void IOPlayer::updateLogoutInfo(Player* player)
{
	Database* db = Database::instance();
	DBQuery query;

	query << "UPDATE `players` SET `status` = 0"
			<< " WHERE `id` = " << player->getGUID();

	db->executeQuery(query.str());
}

bool IOPlayer::cleanOnlineInfo()
{
	Database* db = Database::instance();
	DBQuery query;
	return db->executeQuery("UPDATE `players` SET `status` = 0");
}

In ioplayer.h

After this:
Code:
uint32_t getAccessByName(std::string name);

Add this:

Code:
void updateLoginInfo(Player* player);
void updateLogoutInfo(Player* player);
bool cleanOnlineInfo();

------------------------------------------------------------------

Now in protocolgame.cpp

In function:
Code:
bool ProtocolGame::login(const std::string& name)

After this:
Code:
player->lastLoginSaved = std::max(time(NULL), player->lastLoginSaved + 1);

Add this:
Code:
IOPlayer::instance()->updateLoginInfo(player);

Now in function
Code:
bool ProtocolGame::connect(uint32_t playerId)

After this:
Code:
player->lastip = player->getIP();

Add this:
Code:
IOPlayer::instance()->updateLoginInfo(player);

------------------------------------------------------------------

Now in player.cpp

In function void Player::eek:nCreatureDisappear(const Creature* creature, uint32_t stackpos, bool isLogout)

After this:
Code:
g_chat.removeUserFromAllChannels(this);

Add this:
Code:
IOPlayer::instance()->updateLogoutInfo(this);

------------------------------------------------------------------

Now in otserv.cpp

After this:
Code:
#include "status.h"

Add this:
Code:
#include "ioplayer.h"

Now search for that line:
Code:
std::cout << ":: Worldtype: " << asUpperCaseString(worldType) << std::endl;

And after that line, add this:
Code:
std::cout << ":: Cleaning online players info... " << std::flush;
if(!IOPlayer::instance()->cleanOnlineInfo()){
std::stringstream errormsg;
errormsg << "Unable to execute query for cleaning online status!";
ErrorMessage(errormsg.str().c_str());
exit(-1);
}
std::cout << "[done]" << std::endl;

/\
/\
/\

This will set all players status to 0 = player offline in website

Hope you enjoyed!

- - - Updated - - -

But if you want it in LUA, you'll need that function:
http://otland.net/f35/mysqlquery-otserv-57412/

In login.lua, add this:
Lua:
mysqlQuery("UPDATE `players` SET `status` = '1' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")

In logout.lua or die.lua
Lua:
mysqlQuery("UPDATE `players` SET `status` = '0' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")
 
Wow, that's insanely fast and detailed. Which method do you recommend? Source editing or just via lua? Any pros/cons with those?
Thanks a lot dude. Never expected that kind of an answer. Rep++
 
Back
Top