Example #1
0
	void H86Project::Add_VDevList(vector<pair<string, string> >& vdevList){
		try{
			xml_node<>* node=m_doc->first_node("Hard86Project");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return;
			}
			xml_node<>* test=node->first_node("VDevs");
			if(!test){
				node->append_node(m_doc->allocate_node(node_element, "VDevs"));
				node=node->last_node();
			}
			else{
				node=test;
			}
			for(vector<pair<string, string> >::iterator it=vdevList.begin();
				it!=vdevList.end();
				++it){

				node->append_node(m_doc->allocate_node(node_element, "VDev"));
				xml_node<> *appendedNode=node->last_node();
				appendedNode->append_attribute(m_doc->allocate_attribute("name", m_doc->allocate_string(it->first.c_str())));
				appendedNode->append_attribute(m_doc->allocate_attribute("path", m_doc->allocate_string(it->second.c_str())));

			}
		}
		catch(rapidxml::parse_error e){
			OUT_DEBUG("RapidXML parse error encountered");
			return;
		}
	}
bool CCollideInterface::ActivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	ASSERT(m_mapLocks[mapId] != NULL);
	if( !CollisionMgr )
		return false;

	// acquire write lock
	m_mapLocks[mapId]->m_lock.AcquireWriteLock();
	if( m_mapLocks[mapId]->m_tileLoadCount[tileX][tileY] == 0 )
	{
		if(CollisionMgr->loadMap(sWorld.vMapPath.c_str(), mapId, tileX, tileY))
			OUT_DEBUG("Loading VMap [%u/%u] successful", tileX, tileY);
		else
		{
			OUT_DEBUG("Loading VMap [%u/%u] unsuccessful", tileX, tileY);
			m_mapLocks[mapId]->m_lock.ReleaseWriteLock();
			return false;
		}
	}

	// increment count
	m_mapLocks[mapId]->m_tileLoadCount[tileX][tileY]++;

	// release lock
	m_mapLocks[mapId]->m_lock.ReleaseWriteLock();
	return true;
}
Example #3
0
	void H86Project::Add_BPList(vector<pair<uint16, uint16> >& bpList){
		try{
			xml_node<>* node=m_doc->first_node("Hard86Project");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return;
			}
			xml_node<>* test=node->first_node("BPList");
			if(!test){
				node->append_node(m_doc->allocate_node(node_element, "BPList"));
				node=node->last_node();
			}
			else{
				node=test;
			}
			for(vector<pair<uint16, uint16> >::iterator it=bpList.begin();
				it!=bpList.end();
				++it){

				node->append_node(m_doc->allocate_node(node_element, "BP"));
				xml_node<> *appendedNode=node->last_node();
				appendedNode->append_attribute(m_doc->allocate_attribute("seg", m_doc->allocate_string(ext_itoa(it->first, 16).c_str())));
				appendedNode->append_attribute(m_doc->allocate_attribute("addr", m_doc->allocate_string(ext_itoa(it->second, 16).c_str())));

			}
		}
		catch(rapidxml::parse_error e){
			OUT_DEBUG("RapidXML parse error encountered");
			return;
		}
	}
Example #4
0
void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
{
	DEBUG_LOG( "WORLD"," Received CMSG_QUESTGIVER_HELLO." );
	CHECK_INWORLD_RETURN;

	uint64 guid;
	recv_data >> guid;

	Creature* qst_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));

	if (!qst_giver)
	{
		OUT_DEBUG("WORLD: Invalid questgiver GUID.");
		return;
	}

	if (!qst_giver->isQuestGiver())
	{
		OUT_DEBUG("WORLD: Creature is not a questgiver.");
		return;
	}

	if(qst_giver->GetAIInterface()) // NPC Stops moving for 3 minutes
		qst_giver->GetAIInterface()->StopMovement(180000);

	//qst_giver->Emote(EMOTE_ONESHOT_TALK); // this doesnt work
	sQuestMgr.OnActivateQuestGiver(qst_giver, GetPlayer());
}
Example #5
0
	// Manipulation functions
	pair<uint16, uint16> H86Project::Get_LoadSegAddr(){
		try{
			xml_node<>* node=m_doc->first_node("Hard86Project");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return make_pair(0, 0);
			}
			node=node->first_node("Variables");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return make_pair(0, 0);
			}
			node=node->first_node("LoadSegAddr");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return make_pair(0, 0);
			}
			xml_attribute<> *seg, *addr;
			seg=node->first_attribute("seg");
			addr=node->first_attribute("addr");
			return make_pair(strtol(seg->value(), NULL, 16), strtol(addr->value(), NULL, 16));
		}
		catch(rapidxml::parse_error e){
			OUT_DEBUG("RapidXML parse error encountered");
			return make_pair(0, 0);
		}
	}
Example #6
0
bool AddonMgr::IsAddonBanned(std::string name, uint32 crc)
{
	std::map<std::string,AddonEntry*>::iterator i = KnownAddons.find(name);
	if(i != KnownAddons.end())
	{
		if(i->second->banned)
		{
			OUT_DEBUG("Addon %s is banned.", name.c_str());
			return true;
		}
	}
	else
	{
		// New addon. It'll be saved to db at server shutdown.
		AddonEntry *ent = new AddonEntry;
		ent->name = name;
		ent->crc = crc;
		ent->banned = false;	// by default.. we can change this I guess..
		ent->isNew = true;
		ent->showinlist = (crc == 0x4C1C776D ? false : true);

		OUT_DEBUG("Discovered new addon %s sent by client.", name.c_str());

		KnownAddons[ent->name] = ent;
	}

	return false;
}
Example #7
0
	vector<pair<string, string> > H86Project::Get_VDevList(){
		vector<pair<string, string> > vdevList(0);

		try{
			xml_node<>* node=m_doc->first_node("Hard86Project");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return vector<pair<string, string> >(0);
			}
			node=node->first_node("VDevs");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return vector<pair<string, string> >(0);
			}
			node=node->first_node();
			while(node){
				xml_attribute<> *name, *path;
				name=node->first_attribute("name");
				path=node->first_attribute("path");
				vdevList.push_back(make_pair(string(name->value()), string(path->value())));

				node=node->next_sibling();
			}
			return vdevList;
		}
		catch(rapidxml::parse_error e){
			OUT_DEBUG("RapidXML parse error encountered");
			return vector<pair<string, string> >(0);
		}
	}
Example #8
0
	vector<pair<uint16, uint16> > H86Project::Get_BPList(){
		vector<pair<uint16, uint16> > bpList(0);

		try{
			xml_node<>* node=m_doc->first_node("Hard86Project");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return vector<pair<uint16, uint16> >(0);
			}
			node=node->first_node("BPList");
			if(!node){
				OUT_DEBUG("RapidXML failed to locate node");
				return vector<pair<uint16, uint16> >(0);
			}
			node=node->first_node();
			while(node){
				xml_attribute<> *name, *path;
				name=node->first_attribute("seg");
				path=node->first_attribute("addr");
				bpList.push_back(make_pair((uint16)strtol(name->value(), NULL, 16), (uint16)strtol(path->value(), NULL, 16)));

				node=node->next_sibling();
			}
			return bpList;
		}
		catch(rapidxml::parse_error e){
			OUT_DEBUG("RapidXML parse error encountered");
			return vector<pair<uint16, uint16> >(0);
		}
	}
void CallBack_TextStatusReport(u8 fo,u8 msg_ref, u8* phone_num, QlSysTimer* scts, QlSysTimer* dt, u8 st)
{
    OUT_DEBUG(debug_buffer,"\r\nCB_TextStatusReport: fo=%d,msg_ref=%d,phone_num=%s,st=%d\r\n",
                                                fo,msg_ref,phone_num,st);
    OUT_DEBUG(debug_buffer,"scts=20%d-%d-%d %d:%d:%d\r\n",
                                                scts->year,scts->month,scts->day,scts->hour,scts->minute,scts->second);
    OUT_DEBUG(debug_buffer,"dt=20%d-%d-%d %d:%d:%d\r\n",
                                                scts->year,scts->month,scts->day,scts->hour,scts->minute,scts->second);
}
void CallBack_getipbyname(u8 contexid, bool result, s32 error, u8 num_entry, u8 *entry_address)
{
    u8 i;
    OUT_DEBUG(textBuf,"CallBack_getipbyname(contexid=%d, result=%d,error=%d,num_entry=%d)\r\n",contexid, result,error,num_entry);
    for(i=0;i<num_entry;i++)
    {
        entry_address += (i*4);
        OUT_DEBUG(textBuf,"entry=%d, ip=%d.%d.%d.%d\r\n",i,entry_address[0],entry_address[1],entry_address[2],entry_address[3]);
    }
}
void CallBack_network_actived(u8 contexid)
{
    s8 ret;
    u8 ip_addr[4];
    
    OUT_DEBUG(textBuf,"CallBack_network_actived(contexid=%d)\r\n",contexid);

    ret = Ql_GetLocalIpAddress(contexid, ip_addr);
    OUT_DEBUG(textBuf,"Ql_GetLocalIpAddress(contexid=%d)=%d, ip=%d.%d.%d.%d\r\n",contexid, ret,ip_addr[0],ip_addr[1],ip_addr[2],ip_addr[3]);
}
Example #12
0
/**
 * @author Petr Djakow
 */
void Utils::signalIgnore(const int signum)
{
	#ifdef _GNU_SOURCE
		if(sigignore(signum) == -1)
			FATAL_ERROR(("sigignore(%d)", signum));
		OUT_DEBUG(("Signal '%s' will be ignored", strsignal(signum)));
	#else
		set_signal_handler(signum, SIG_IGN);
		OUT_DEBUG(("Signal '%d' will be ignored", signum));
	#endif
}
Example #13
0
void LogonCommClientSocket::CompressAndSend(ByteBuffer & uncompressed)
{
	// I still got no idea where this came from :p
	size_t destsize = uncompressed.size() + uncompressed.size()/10 + 16;

	// w000t w000t kat000t for gzipped packets
	WorldPacket data(RCMSG_ACCOUNT_CHARACTER_MAPPING_REPLY, destsize + 4);
	data.resize(destsize + 4);

	z_stream stream;
	stream.zalloc = 0;
	stream.zfree  = 0;
	stream.opaque = 0;

	if(deflateInit(&stream, 1) != Z_OK)
	{
		OUT_DEBUG("deflateInit failed.");
		return;
	}

	// set up stream pointers
	stream.next_out  = (Bytef*)((uint8*)data.contents())+4;
	stream.avail_out = (uInt)destsize;
	stream.next_in   = (Bytef*)uncompressed.contents();
	stream.avail_in  = (uInt)uncompressed.size();

	// call the actual process
	if(deflate(&stream, Z_NO_FLUSH) != Z_OK ||
		stream.avail_in != 0)
	{
		OUT_DEBUG("deflate failed.");
		return;
	}

	// finish the deflate
	if(deflate(&stream, Z_FINISH) != Z_STREAM_END)
	{
		OUT_DEBUG("deflate failed: did not end stream");
		return;
	}

	// finish up
	if(deflateEnd(&stream) != Z_OK)
	{
		OUT_DEBUG("deflateEnd failed.");
		return;
	}

	*(uint32*)data.contents() = (uint32)uncompressed.size();
	data.resize(stream.total_out + 4);
	SendPacket(&data);
}
Example #14
0
void GameObject::UseFishingNode(Player* player)
{
	sEventMgr.RemoveEvents( this );
	if( GetUInt32Value( GAMEOBJECT_FLAGS ) != 32 ) // Clicking on the bobber before something is hooked
	{
		player->GetSession()->OutPacket( SMSG_FISH_NOT_HOOKED );
		EndFishing( player, true );
		return;
	}

	FishingZoneEntry *entry = NULL;

	uint32 zone = player->GetAreaID();
	if(zone != 0)
	{
		entry = FishingZoneStorage.LookupEntry( zone );
		if( entry == NULL ) // No fishing information found for area, log an error
		{
			OUT_DEBUG( "ERROR: Fishing area information for area %d not found!", zone );
		}
	}
	if(zone == 0 || entry == NULL)
	{
		zone = player->GetZoneId();
		entry = FishingZoneStorage.LookupEntry( zone );
		if( entry == NULL ) // No fishing information found for area, log an error
		{
			OUT_DEBUG( "ERROR: Fishing zone information for zone %d not found!", zone );
			EndFishing( player, true );
			return;
		}
	}

	uint32 maxskill = entry->MaxSkill;
	uint32 minskill = entry->MinSkill;

	if( player->_GetSkillLineCurrent( SKILL_FISHING, false ) < maxskill )	
		player->_AdvanceSkillLine( SKILL_FISHING, float2int32( 1.0f * sWorld.getRate( RATE_SKILLRATE ) ) );

	// Open loot on success, otherwise FISH_ESCAPED.
	if( Rand(((player->_GetSkillLineCurrent( SKILL_FISHING, true ) - minskill) * 100) / maxskill) )
	{
		lootmgr.FillFishingLoot( &m_loot, zone );
		player->SendLoot( GetGUID(), LOOT_FISHING );
		EndFishing( player, false );
	}
	else // Failed
	{
		player->GetSession()->OutPacket( SMSG_FISH_ESCAPED );
		EndFishing( player, true );
	}
}
Example #15
0
void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
{
	DEBUG_LOG( "WORLD"," Received CMSG_QUESTGIVER_STATUS_QUERY." );

	CHECK_INWORLD_RETURN;

	uint64 guid;
	WorldPacket data(SMSG_QUESTGIVER_STATUS, 9);
	Object* qst_giver = NULLOBJ;

	recv_data >> guid;
	uint32 guidtype = GET_TYPE_FROM_GUID(guid);
	if(guidtype == HIGHGUID_TYPE_CREATURE)
	{
		Creature* quest_giver = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
		if(quest_giver)
			qst_giver = quest_giver;
		else
			return;

		if (!quest_giver->isQuestGiver())
		{
			OUT_DEBUG("WORLD: Creature is not a questgiver.");
			return;
		}
	}
	else if(guidtype==HIGHGUID_TYPE_ITEM)
	{
		Item* quest_giver = GetPlayer()->GetItemInterface()->GetItemByGUID(guid);
		if(quest_giver)
			qst_giver = TO_OBJECT(quest_giver);
		else
			return;
	}
	else if(guidtype==HIGHGUID_TYPE_GAMEOBJECT)
	{
		GameObject* quest_giver = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(guid));
		if(quest_giver)
			qst_giver = TO_OBJECT(quest_giver);
		else
			return;
	}

	if (!qst_giver)
	{
		OUT_DEBUG("WORLD: Invalid questgiver GUID "I64FMT".", guid);
		return;
	}

	data << guid << sQuestMgr.CalcStatus(qst_giver, GetPlayer());
	SendPacket( &data );
}
void CallBack_socket_write(u8 contexid, s8 sock, bool result, s32 error)
{
    s32 ret;
    s32 i;
    OUT_DEBUG(textBuf,"CallBack_socket_write(contexid=%d,sock=%d,result=%d,error=%d)\r\n",contexid,sock,result,error);
    //now , here , you can continue use Ql_SocketSend to send data 

    for(i=0;i<2;i++)
    {
        if(socketonly[i] == sock)
        {
            break;
        }
    }

    if(i>=2)
    {
        OUT_DEBUG(textBuf,"unknown socket\r\n");
        return;
    }
    
    while(send_dataLen[i] > 0)
    {
        ret = Ql_SocketSend(sock, data_p + send_dataLen[i] ,dataLen[i] - send_dataLen[i]);
        OUT_DEBUG(textBuf,"Ql_SocketSend(socket=%d,dataLen=%d)=%d\r\n",socketonly[i],dataLen[i],ret);
        if(ret == (dataLen[i] - send_dataLen[i]))
        {
            //send compelete
            send_dataLen[i] = 0;
            break;
        }
        else if((ret < 0) && (ret == -2)) 
        {
            //you must wait next CallBack_socket_write, then send data;                                                    
            break;
        }
        else if(ret < 0)
        {
            //error , Ql_SocketClose
            Ql_SocketClose(sock); //you can close this socket
            socketonly[i] = 0xFF;
            send_dataLen[i]  = 0;
            break;
        }
        else if(ret <= dataLen[i])
        {
            send_dataLen[i] += ret;
            //continue send
        }
    }

}
void CallBack_PDUStatusReport(u16 length, u8* pdu_string)
{
    OUT_DEBUG(debug_buffer,"\r\nCB_PDUStatusReport: length=%d\r\n",length);    
    if(length)
    {
        int i;
        for(i=0;i<length;i++)
        {
            OUT_DEBUG(debug_buffer,"%02X",pdu_string[i]);
        }
        OUT_DEBUG(debug_buffer,"\r\n");
    }
}
Example #18
0
bool Master::_StartDB()
{
	string hostname, username, password, database;
	int port = 0;
	// Configure Main Database

	bool result = Config.ClusterConfig.GetString( "WorldDatabase", "Username", &username );
	Config.ClusterConfig.GetString( "WorldDatabase", "Password", &password );
	result = !result ? result : Config.ClusterConfig.GetString( "WorldDatabase", "Hostname", &hostname );
	result = !result ? result : Config.ClusterConfig.GetString( "WorldDatabase", "Name", &database );
	result = !result ? result : Config.ClusterConfig.GetInt( "WorldDatabase", "Port", &port );
	Database_World = Database::Create();

	if(result == false)
	{
		OUT_DEBUG( "SQL: One or more parameters were missing from WorldDatabase directive." );
		return false;
	}

	// Initialize it
	if( !WorldDatabase.Initialize(hostname.c_str(), (unsigned int)port, username.c_str(),
		password.c_str(), database.c_str(), Config.ClusterConfig.GetIntDefault( "WorldDatabase", "ConnectionCount", 5 ), 16384 ) )
	{
		OUT_DEBUG( "SQL: Main database initialization failed. Exiting." );
		return false;
	}

	result = Config.ClusterConfig.GetString( "CharacterDatabase", "Username", &username );
	Config.ClusterConfig.GetString( "CharacterDatabase", "Password", &password );
	result = !result ? result : Config.ClusterConfig.GetString( "CharacterDatabase", "Hostname", &hostname );
	result = !result ? result : Config.ClusterConfig.GetString( "CharacterDatabase", "Name", &database );
	result = !result ? result : Config.ClusterConfig.GetInt( "CharacterDatabase", "Port", &port );
	Database_Character = Database::Create();

	if(result == false)
	{
		OUT_DEBUG( "SQL: One or more parameters were missing from Database directive." );
		return false;
	}

	// Initialize it
	if( !CharacterDatabase.Initialize( hostname.c_str(), (unsigned int)port, username.c_str(),
		password.c_str(), database.c_str(), Config.ClusterConfig.GetIntDefault( "CharacterDatabase", "ConnectionCount", 5 ), 16384 ) )
	{
		OUT_DEBUG( "sql: Main database initialization failed. Exiting." );
		return false;
	}

	return true;
}
void CallBack_NewFlashPDUSMS(u16 length, u8* pdu_string)
{
    OUT_DEBUG(debug_buffer,"\r\nCB_NewFlashPDUSMS: length=%d\r\n",length);
    
    if(pdu_string)
    {
        int i;
        for(i=0;i<length;i++)
        {
            OUT_DEBUG(debug_buffer,"%02X",pdu_string[i]);
        }
        OUT_DEBUG(debug_buffer,"\r\n");
    }
}
Example #20
0
void Vehicle::Load(CreatureProto * proto_, uint32 mode, float x, float y, float z, float o /* = 0.0f */)
{
	proto = proto_;
	if(!proto)
		return;

	if(proto->vehicle_entry != -1)
	{
		m_vehicleEntry = proto->vehicle_entry;
	}
	else
	{
		m_vehicleEntry = 124;
		if(sLog.IsOutDevelopement())
			printf("Attempted to create vehicle %u with invalid vehicle_entry, defaulting to 124, check your creature_proto table.\n", proto->Id);
		else
			OUT_DEBUG("Attempted to create vehicle %u with invalid vehicle_entry, defaulting to 124, check your creature_proto table.", proto->Id);
	}

	m_maxPassengers = 0;
	m_seatSlotMax = 0;
	VehicleEntry * ve = dbcVehicle.LookupEntry( m_vehicleEntry );
	if(!ve)
	{
		if(sLog.IsOutDevelopement())
			printf("Attempted to create non-existant vehicle %u.\n", GetVehicleEntry());
		else
			OUT_DEBUG("Attempted to create non-existant vehicle %u.", GetVehicleEntry());
		return;
	}

	for( uint32 i = 0; i < 8; i++ )
	{
		if( ve->m_seatID[i] )
		{
			m_vehicleSeats[i] = dbcVehicleSeat.LookupEntry( ve->m_seatID[i] );
			m_seatSlotMax = i+1;

			if(m_vehicleSeats[i]->IsUsable())
			{
				seatisusable[i] = true;
				++m_maxPassengers;
			}
		}
	}

	Initialised = true;

	Creature::Load(proto_, mode, x, y, z, o);
}
Example #21
0
bool Vehicle::Load(CreatureSpawn *spawn, uint32 mode, MapInfo *info)
{
	proto = CreatureProtoStorage.LookupEntry(spawn->entry);
	if(!proto)
		return false;

	if(proto->vehicle_entry != -1)
	{
		m_vehicleEntry = proto->vehicle_entry;
	}
	else
	{
		m_vehicleEntry = 124;
		if(sLog.IsOutDevelopement())
			printf("Attempted to create vehicle %u with invalid vehicle_entry, defaulting to 124, check your creature_proto table.\n", proto->Id);
		else
			OUT_DEBUG("Attempted to create vehicle %u with invalid vehicle_entry, defaulting to 124, check your creature_proto table.", proto->Id);
	}

	m_maxPassengers = 0;
	m_seatSlotMax = 0;
	VehicleEntry * ve = dbcVehicle.LookupEntry( m_vehicleEntry );
	if(!ve)
	{
		if(sLog.IsOutDevelopement())
			printf("Attempted to create non-existant vehicle %u.\n", GetVehicleEntry());
		else
			OUT_DEBUG("Attempted to create non-existant vehicle %u.", GetVehicleEntry());
		return false;
	}

	for( uint32 i = 0; i < 8; i++ )
	{
		if( ve->m_seatID[i] )
		{
			m_vehicleSeats[i] = dbcVehicleSeat.LookupEntry( ve->m_seatID[i] );
			m_seatSlotMax = i + 1;

			if(m_vehicleSeats[i]->IsUsable())
			{
				seatisusable[i] = true;
				++m_maxPassengers;
			}
		}
	}
	Initialised = true;

	return Creature::Load(spawn, mode, info);
}
Example #22
0
void WorldSession::HandleQuestgiverCancelOpcode(WorldPacket& recvPacket)
{
	WorldPacket data(SMSG_GOSSIP_COMPLETE, 0);
	SendPacket(&data);

	OUT_DEBUG("WORLD: Sent SMSG_GOSSIP_COMPLETE");
}
Example #23
0
void WorldSocket::_HandleAuthSession(WorldPacket* recvPacket)
{
	std::string account;
	uint32 unk2, unk3;
	_latency = getMSTime() - _latency;

	try
	{
		*recvPacket >> mClientBuild;
		*recvPacket >> unk2;
		*recvPacket >> account;
		*recvPacket >> unk3;
		*recvPacket >> mClientSeed;
	}
	catch(ByteBuffer::error &)
	{
		OUT_DEBUG("Incomplete copy of AUTH_SESSION Received.");
		return;
	}

	// Send out a request for this account.
	mRequestID = sLogonCommHandler.ClientConnected(account, this);
	
	if(mRequestID == 0xFFFFFFFF)
	{
		Disconnect();
		return;
	}

	// shitty hash !
	m_fullAccountName = new string( account );

	// Set the authentication packet 
    pAuthenticationPacket = recvPacket;
}
void CallBack_network_deactived(u8 contexid, s32 error_cause, s32 error)
{
    OUT_DEBUG(textBuf,"CallBack_network_deactived(contexid=%d,error_cause=%d, error=%d)\r\n",contexid,error_cause,error);
    if(socketonly[0] >= 0)
    {
        Ql_SocketClose(socketonly[0]);
        socketonly[0] = 0xFF;
        send_dataLen[0]  = 0;
    }
    if(socketonly[1] >= 0)
    {
        Ql_SocketClose(socketonly[1]);
        socketonly[1] = 0xFF;
        send_dataLen[1]  = 0;
    }

    if(udponly[0] >= 0)
    {
        Ql_SocketClose(udponly[0]);
        udponly[0] = 0xFF;
        send_dataLen[0]  = 0;
    }
    if(udponly[1] >= 0)
    {
        Ql_SocketClose(udponly[1]);
        udponly[1] = 0xFF;
        send_dataLen[1]  = 0;
    }
    
}
Example #25
0
bool AddonMgr::ShouldShowInList(std::string name)
{
	std::map<std::string,AddonEntry*>::iterator i = KnownAddons.find(name);
	if(i != KnownAddons.end())
	{
		if(i->second->showinlist)
			return true;
		else
			return false;
	}
	else
	{
		// New addon. It'll be saved to db at server shutdown.		
		AddonEntry *ent = new AddonEntry;
		ent->name = name;
		ent->crc = 0;
		ent->banned = false;	// by default.. we can change this I guess..
		ent->isNew = true;
		ent->showinlist = true;

		OUT_DEBUG("Discovered new addon %s sent by client.", name.c_str());

		KnownAddons[ent->name] = ent;
	}

	return true;
}
void CallBack_ReadTextSMS(bool result, s16 cause,u16 index, u8 status, QlSMSTextMsg* sms)
{
    OUT_DEBUG(debug_buffer,"\r\nCB_ReadTextSMS: result=%d,cause=%d,index=%d,status=%d\r\n",
                                                    result,cause,index,status);
    if(result)
    {
        if(sms)
        {
            int i;
            OUT_DEBUG(debug_buffer,"phone_num=\"%s\",num_type=%d,chset=%d\r\n",
                                                        sms->phone_num,sms->num_type,sms->chset);
            if(sms->scts.year != 0)
            {
                OUT_DEBUG(debug_buffer,"scts=20%d-%d-%d %d:%d:%d\r\n",
                                                            sms->scts.year,sms->scts.month,sms->scts.day,sms->scts.hour,sms->scts.minute,sms->scts.second);     
            }
            
            if(sms->udh_len)
            {
                for(i=0;i<sms->udh_len;i++)
                {
                    OUT_DEBUG(debug_buffer,"%02X", sms->data_len);
                }
                OUT_DEBUG(debug_buffer,"\r\n");
            }
            
            if(sms->data)
            {
                s16 ret;
                Ql_SMS_DCS_ToCSCS(sms,CSCS_CHSET_GSM);
                OUT_DEBUG(debug_buffer,"data_len=%d\r",sms->data_len); 
                for(i=0;i<sms->data_len;i++)
                {
                    if(QL_SMS_CHSET_GSM == sms->chset)
                    {
                        OUT_DEBUG(debug_buffer,"%c",(sms->data)[i]);
                    }
                    else
                    {
                        OUT_DEBUG(debug_buffer,"%02X",(sms->data)[i]);
                    }
                }   
                OUT_DEBUG(debug_buffer,"\r\n");
//you can send message right now
/* 
                ret = Ql_SendTextSMS(sms->phone_num, sms->data_len, sms->data);
                OUT_DEBUG(debug_buffer, "\r\nQl_SendTextSMS(phone_num=\"%s\")=%d\r\n",sms->phone_num,ret);
*/
            }
        }
    }
}
void CallBack_ReadPDUSMS(bool result, s16 cause,u16 index, u8 status, u8* data, u16 length)
{
    OUT_DEBUG(debug_buffer,"\r\nCB_ReadPDUSMS: result=%d,cause=%d,index=%d,status=%d,length=%d\r\n",
                                                    result,cause,index,status,length);
    if(result)
    {
        if(length)
        {
            int i;
            for(i=0;i<length;i++)
            {
                OUT_DEBUG(debug_buffer,"%02X",data[i]);
            }
            OUT_DEBUG(debug_buffer,"\r\n");
        }
    }
}
Example #28
0
	Settings::Settings() : m_appIni(m_appIniPath)
	{
		// Check for INI parsing error
		if(m_appIni.ParseError()){
			OUT_DEBUG("INI parser reported parse error");
		}
		ProcessINI();
	}
void ClusterInterface::HandleCreateInstance(WorldPacket & pck)
{
	uint32 mapid, instanceid;
	pck >> mapid >> instanceid;
	OUT_DEBUG("ClusterInterface", "Creating Instance %u on Map %u", instanceid, mapid);
	Map * pMap = sWorldCreator.GetMap(mapid);
	pMap->CreateMapMgrInstance(instanceid);
}
Example #30
0
void Vehicle::AddPassenger(Unit* pPassenger, int8 requestedseat /*= -1*/, bool force /*= false*/)
{
	if(!m_maxPassengers || !m_seatSlotMax)
		return; // Slave vehicle.

	if(pPassenger->GetVehicle())
		pPassenger->GetVehicle()->RemovePassenger(pPassenger);

	OUT_DEBUG("AddPassenger: Max Vehicle Slot: %u, Max Passengers: %u\n", m_seatSlotMax, m_maxPassengers);

	if(requestedseat > -1)
	{
		if(force)
		{
			if(m_vehicleSeats[requestedseat]) // Slot available?
			{
				if(pPassenger->IsPlayer() && seatisusable[requestedseat] == false)
					return;

				if(m_passengers[requestedseat])
					RemovePassenger(m_passengers[requestedseat]);

				_AddToSlot(pPassenger, requestedseat);
				return;
			}
		}
		else
		{
			if(!m_passengers[requestedseat] && m_vehicleSeats[requestedseat] && seatisusable[requestedseat] == true) // Slot available?
			{
				_AddToSlot(pPassenger, requestedseat );
				return;
			}
		}
	}
	else
	{	// Find us a slot!
		for(uint8 i = 0; i < m_seatSlotMax; i++)
		{
			if(pPassenger->IsPlayer())
			{
				if(!m_passengers[i] && m_vehicleSeats[i] && (seatisusable[i] == true)) // Found a slot
				{
					_AddToSlot(pPassenger, i );
					return;
				}
			}
			else
			{
				if(!m_passengers[i] && m_vehicleSeats[i])
				{
					_AddToSlot(pPassenger, i );
					return;
				}
			}
		}
	}
}