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

Compiling Disable Character Save in Sources

Triggah

TrigCore
Joined
Aug 1, 2007
Messages
436
Reaction score
2
how would i disable character save in 0.3.4 pl2 sources?

i dont want exp/items/skills to save

and save = 0 in sql makes NOTHING save.
 
no i want to not save specific things, and save = 0 unsaves everything, from what i heard it can only be done in sources if i want specific things not to save
 
In iologindata.cpp at playerSave change those lines:
PHP:
if(!save || !player->isSaving())
to
PHP:
if(!player->isSaving())
PHP:
query << "`level` = " << std::max((uint32_t)1, player->getLevel()) << ", ";
to
PHP:
if(save)
    query << "`level` = " << std::max((uint32_t)1, player->getLevel()) << ", ";
PHP:
query << "`experience` = " << std::max((uint64_t)0, player->getExperience()) << ", ";
to
PHP:
if(save)
    query << "`experience` = " << std::max((uint64_t)0, player->getExperience()) << ", ";
PHP:
query << "`maglevel` = " << player->magLevel << ", ";
query << "`mana` = " << player->mana << ", ";
query << "`manamax` = " << player->manaMax << ", ";
query << "`manaspent` = " << player->manaSpent << ", ";
to
PHP:
if(save)
{
    query << "`maglevel` = " << player->magLevel << ", ";
    query << "`mana` = " << player->mana << ", ";
    query << "`manamax` = " << player->manaMax << ", ";
    query << "`manaspent` = " << player->manaSpent << ", ";
}
PHP:
query << "`cap` = " << player->getCapacity() << ", ";
to
PHP:
if(save)
    query << "`cap` = " << player->getCapacity() << ", ";
PHP:
for(int32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
{
    query.str("");
    query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i << db->getUpdateQueryLimitOperator() << ";";
    if(!db->executeQuery(query.str()))
        return false;
}
to
PHP:
if(save)
    for(int32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    {
        query.str("");
        query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i << db->getUpdateQueryLimitOperator() << ";";
        if(!db->executeQuery(query.str()))
            return false;
    }
PHP:
FROM //item saving
UNTIL //}
to
PHP:
        //item saving
        if(save)
		{
			query.str("");
			query << "DELETE FROM `player_items` WHERE `player_id` = " << player->getGUID() << ";";
			if(!db->executeQuery(query.str()))
					return false;

			ItemBlockList itemList;
			for(int32_t slotId = 1; slotId < 11; ++slotId)
			{
					if(Item* item = player->inventory[slotId])
							itemList.push_back(itemBlock(slotId, item));
			}

			query_insert.setQuery("INSERT INTO `player_items` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES ");
			if(!saveItems(player, itemList, query_insert))
					return false;

			itemList.clear();
			//save depot items
			//std::stringstream ss;
			for(DepotMap::iterator it = player->depots.begin(); it != player->depots.end(); ++it)
			{
					/*if(it->second.second)
					{
							it->second.second = false;
							ss << it->first << ",";*/
							itemList.push_back(itemBlock(it->first, it->second.first));
					//}
			}

			/*std::string s = ss.str();
			size_t size = s.length();
			if(size > 0)
			{*/
					query.str("");
					query << "DELETE FROM `player_depotitems` WHERE `player_id` = " << player->getGUID() << ";";// << " AND `pid` IN (" << s.substr(0, --size) << ")";
					if(!db->executeQuery(query.str()))
							return false;

					query_insert.setQuery("INSERT INTO `player_depotitems` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES ");
					if(!saveItems(player, itemList, query_insert))
							return false;

					itemList.clear();
			//}
		}

And edit players `save` field to 0.
It should work as you wanted :).
 
very nice, thank you

also: how would i set the killplayerexp thing, from what i heard somethign has to be done in sources to make it configurable
 
i tried it,
Code:
for(int32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
{
    query.str("");
    query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i << db->getUpdateQueryLimitOperator() << ";";
    if(!db->executeQuery(query.str()))
        return false;
}

couldnt find that, found something similar so changed it to wat u said

tried to compile and got this error

PHP:
 C:\Dev-Cpp\0.3.4pl2\iologindata.cpp In member function `bool IOLoginData::savePlayer(Player*, bool)': 
829 C:\Dev-Cpp\0.3.4pl2\iologindata.cpp 'class _Database' has no member named 'getUpdateQueryLimitOperator' 
 C:\Dev-Cpp\Makefile.win [Build Error]  [0.3.4pl2/iologindata.o] Error 1

PHP:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c 0.3.4pl2/iologindata.cpp -o 0.3.4pl2/iologindata.o -I"include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__  

0.3.4pl2/iologindata.cpp: In member function `bool IOLoginData::savePlayer(Player*, bool)':
0.3.4pl2/iologindata.cpp:829: error: 'class _Database' has no member named 'getUpdateQueryLimitOperator'

make.exe: *** [0.3.4pl2/iologindata.o] Error 1

Execution terminated
 
Ive been probably looking at 0.3.5_ sources, there is this queryUpdateLimitOperator :p

Change this line:
PHP:
query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i << db->getUpdateQueryLimitOperator() << ";";
to
PHP:
query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i;
 
if i decided to save skills what would i change this into:
Code:
 if(save)
    for(int32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    {
        query.str("");
        query << "UPDATE `player_skills` SET `value` = " << player->skills[i][SKILL_LEVEL] << ", `count` = " << player->skills[i][SKILL_TRIES] << " WHERE `player_id` = " << player->getGUID() << " AND `skillid` = " << i << db->getUpdateQueryLimitOperator() << ";";
        if(!db->executeQuery(query.str()))
            return false;
    }
 
depot doesnt save

my bad for double post

You wanted items not to save, so... :confused:.

Change again from //item saving until //}:
PHP:
        //item saving
		ItemBlockList itemList;
        if(save)
        {
            query.str("");
            query << "DELETE FROM `player_items` WHERE `player_id` = " << player->getGUID() << ";";
            if(!db->executeQuery(query.str()))
                    return false;

            for(int32_t slotId = 1; slotId < 11; ++slotId)
            {
                    if(Item* item = player->inventory[slotId])
                            itemList.push_back(itemBlock(slotId, item));
            }

            query_insert.setQuery("INSERT INTO `player_items` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES ");
            if(!saveItems(player, itemList, query_insert))
                    return false;

            itemList.clear();
		}
		
		//save depot items
		//std::stringstream ss;
		for(DepotMap::iterator it = player->depots.begin(); it != player->depots.end(); ++it)
		{
				/*if(it->second.second)
				{
						it->second.second = false;
						ss << it->first << ",";*/
						itemList.push_back(itemBlock(it->first, it->second.first));
				//}
		}

		/*std::string s = ss.str();
		size_t size = s.length();
		if(size > 0)
		{*/
				query.str("");
				query << "DELETE FROM `player_depotitems` WHERE `player_id` = " << player->getGUID() << ";";// << " AND `pid` IN (" << s.substr(0, --size) << ")";
				if(!db->executeQuery(query.str()))
						return false;

				query_insert.setQuery("INSERT INTO `player_depotitems` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES ");
				if(!saveItems(player, itemList, query_insert))
						return false;

				itemList.clear();
		//}

Write back if it does work -.^
 
i wanted items on u not to save, but depot to still save

tried your new code
Code:
      Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\0.3.4pl2\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\0.3.4pl2\Makefile.win" all
g++.exe -c iologindata.cpp -o iologindata.o -I"include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__  

iologindata.cpp:899: error: expected constructor, destructor, or type conversion before '.' token
iologindata.cpp:900: error: expected constructor, destructor, or type conversion before '<<' token

iologindata.cpp:901: error: expected unqualified-id before "if"
iologindata.cpp:904: error: expected constructor, destructor, or type conversion before '->' token
iologindata.cpp:905: error: expected constructor, destructor, or type conversion before '.' token
iologindata.cpp:906: error: expected unqualified-id before "for"
iologindata.cpp:906: error: expected constructor, destructor, or type conversion before '!=' token
iologindata.cpp:906: error: expected unqualified-id before '++' token
iologindata.cpp:913: error: expected unqualified-id before "if"
iologindata.cpp:916: error: expected unqualified-id before "if"
iologindata.cpp:937: error: expected constructor, destructor, or type conversion before '.' token
iologindata.cpp:938: error: expected constructor, destructor, or type conversion before '<<' token
iologindata.cpp:939: error: expected unqualified-id before "if"
iologindata.cpp:942: error: expected constructor, destructor, or type conversion before '.' token
iologindata.cpp:943: error: expected unqualified-id before "for"
iologindata.cpp:943: error: expected constructor, destructor, or type conversion before '!=' token
iologindata.cpp:943: error: expected constructor, destructor, or type conversion before '++' token
iologindata.cpp:953: error: expected unqualified-id before "if"
iologindata.cpp:957: error: expected unqualified-id before "return"
iologindata.cpp:958: error: expected declaration before '}' token

make.exe: *** [iologindata.o] Error 1

Execution terminated
 
Back
Top