Jump to content

Prevent saving Player-Loc on map 489


Guest mrlocus

Recommended Posts

For some reason, i sometimes have characters saved on map 489. When they do login the server crashes as there is not BG existing for this map.

So i modified my sourceode a bit:

void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint32 zone,uint64 guid)
{
   std::ostringstream ss;
   ss << "UPDATE characters SET position_x='"<<x<<"',position_y='"<<y
       << "',position_z='"<<z<<"',orientation='"<<o<<"',map='"<<mapid
       << "',zone='"<<zone<<"',trans_x='0',trans_y='0',trans_z='0',"
       << "transguid='0',taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
   sLog.outDebug(ss.str().c_str());

   if ( mapid != 489 ) // do not save in WSG map
   {
   CharacterDatabase.Execute(ss.str().c_str());
   }
}

But i still get sooner or later a player saved over there. That means looking at the DB "map" field i find a 489 there. But how is this technically possible? I mean there is no other code in the mangos sourcecode which modifies the player's DB location data. have you got an idea?

I am not running any selfmade scripts or website teleporters.. whatever.

thanks in advance, mrlocus

Link to comment
Share on other sites

well just came up with another hack-fix:

on character loading just check for the map, and if it is 489 overwrite the player locs to a custom location.

at: bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )

    // prevent starting at WSG map
   if ( fields[16].GetUInt32() == 489 )
   {
       fields[16].SetValue( "1" );
       fields[13].SetValue( "-3761" );
       fields[14].SetValue( "1115" );
       fields[15].SetValue( "133" );
   }

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use