• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sqf::Parameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sqf::Parameters的典型用法代码示例。如果您正苦于以下问题:C++ Parameters类的具体用法?C++ Parameters怎么用?C++ Parameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Parameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: populateQuery

void SqlCustDataSource::populateQuery(string query, Sqf::Parameters& params, CustomDataQueue& queue)
{
	for (int i = 0; i < params.size(); i++)
	{
		query = boost::algorithm::replace_nth_copy(query, "?", i, Sqf::GetStringAny(params.at(i)));
	}

	auto custRes = getDB()->queryParams(query.c_str());

	while (custRes->fetchRow())
	{
		Sqf::Parameters custParams;

		for (int i = 0; i < custRes->numFields(); i++)
		{
			int val = custRes->at(i).getInt32();

			if (val == 0 && custRes->at(i).getString() != "0")
			{
				custParams.push_back(custRes->at(i).getString());
			}
			else
			{
				custParams.push_back(val);
			}
		}

		queue.push(custParams);
	}
}
开发者ID:IdbeHoldL,项目名称:DayZhiveEpoch,代码行数:30,代码来源:SqlDataSourceCustom.cpp


示例2: loadPlayer

Sqf::Value HiveExtApp::loadPlayer( Sqf::Parameters params )
{
	string playerId = Sqf::GetStringAny(params.at(0));
	string playerName = Sqf::GetStringAny(params.at(2));

	return _charData->fetchCharacterInitial(playerId,getServerId(),playerName);
}
开发者ID:TheTrivials,项目名称:hive,代码行数:7,代码来源:HiveExtApp.cpp


示例3: fetchObjectId

Sqf::Value SqlCharDataSource::fetchObjectId( Int64 objectIdent )
{
	Sqf::Parameters retVal;
	//get details from db
	auto charDetRes = getDB()->queryParams(
		"SELECT `ObjectID` FROM `Object_DATA` WHERE `ObjectUID`=%lld", objectIdent);

	if (charDetRes && charDetRes->fetchRow())
	{
		int objectid = 0;
		//get stuff from row	
		objectid = charDetRes->at(0).getInt32();
	
		if(objectid != 0)
		{
			retVal.push_back(string("PASS"));
			retVal.push_back(lexical_cast<string>(objectid));
		}
		else 
		{
			retVal.push_back(string("ERROR"));
		}
	}
	else
	{
		retVal.push_back(string("ERROR"));
	}

	return retVal;
}
开发者ID:IdbeHoldL,项目名称:DayZhiveEpoch,代码行数:30,代码来源:SqlCharDataSource.cpp


示例4: playerDeath

Sqf::Value HiveExtApp::playerDeath( Sqf::Parameters params )
{
	int characterId = Sqf::GetIntAny(params.at(0));
	int duration = static_cast<int>(Sqf::GetDouble(params.at(1)));
	
	return booleanReturn(_charData->killCharacter(characterId,duration));
}
开发者ID:TheTrivials,项目名称:hive,代码行数:7,代码来源:HiveExtApp.cpp


示例5: fetchAntiHackWhitelist

void SqlAntiHackDataSource::fetchAntiHackWhitelist( AntiHackQueue& queue )
{
	
	auto antiHackRes = getDB()->queryParams(
			"SELECT antihack_whitelist.playerID FROM antihack_whitelist");
	
	if (!antiHackRes)
	{
		_logger.error("Failed to fetch whitelist from database");
		return;
	}
	string banId;
	while (antiHackRes->fetchRow())
	{
		Sqf::Parameters ahParams;
		auto row = antiHackRes->fields();
		//ahParams.push_back(string("BANS"));

		try
		{
			banId = row[0].getString(); //objectId should be stringified 
			ahParams.push_back(banId);
			_logger.information("Pushed whitelists (" + lexical_cast<string>(banId) + ")");
		}
			
		catch (const bad_lexical_cast&)
		{
			_logger.error("Skipping whitelist " + lexical_cast<string>(banId) + " load because of invalid data in db");
			continue;
		}
		queue.push(ahParams);
	}
}
开发者ID:thevisad,项目名称:DayZUnleashed_Hive,代码行数:33,代码来源:SqlAntiHackDataSource.cpp


示例6: fetchAntiHackAdmins

void SqlAntiHackDataSource::fetchAntiHackAdmins(  int serverId, int adminlevel, AntiHackQueue& queue )
{

	auto antiHackRes = getDB()->queryParams(
			"SELECT antihack_admins.playerID FROM antihack_admins WHERE antihack_admins.instance = %d and antihack_admins.adminlevel = %d", serverId, adminlevel);
	
	if (!antiHackRes)
	{
		_logger.error("Failed to fetch admins from database");
		return;
	}
	string adminId;
	while (antiHackRes->fetchRow())
	{
		Sqf::Parameters ahParams;
		auto row = antiHackRes->fields();

		try
		{
			adminId = row[0].getString(); //objectId should be stringified 
			ahParams.push_back(adminId);
			_logger.information("Pushed Admin (" + lexical_cast<string>(adminId) + ")");
		}
			
		catch (const bad_lexical_cast&)
		{
			_logger.error("Skipping Admin " + lexical_cast<string>(adminId) + " load because of invalid data in db");
			continue;
		}
		queue.push(ahParams);
	}
	
}
开发者ID:thevisad,项目名称:DayZUnleashed_Hive,代码行数:33,代码来源:SqlAntiHackDataSource.cpp


示例7: populateHouses

void Database::populateHouses(std::queue<Sqf::Parameters>& queue)
{
	try
	{
		Poco::Data::Statement stmt((*activeSession));
		stmt << "select `player_id`, `unique_id`, `building_id`, `building_name`, `worldspace`, `lock`, `explosive`, `reinforcement` from `buildings` where `instance_id` = ?", use(serverID), now;
		Poco::Data::RecordSet rs(stmt);

		if (rs.columnCount() >= 1)
		{
			bool more = rs.moveFirst();
			while (more)
			{
				Sqf::Parameters objParams;
				objParams.push_back(string("HOUSE"));

				string playerID = rs[0].convert<std::string>();
				objParams.push_back(playerID);

				string uniqueID = rs[1].convert<std::string>();
				objParams.push_back(uniqueID);

				string buildingID = rs[2].convert<std::string>();
				objParams.push_back(buildingID);

				string buildingName = rs[3].convert<std::string>();
				objParams.push_back(buildingName);

				try
				{
					string worldSpace = rs[4].convert<std::string>();
					Sqf::Value worldSpaceArray = lexical_cast<Sqf::Value>(worldSpace);
					objParams.push_back(worldSpaceArray);
				}
				catch (boost::bad_lexical_cast)
				{
					console->log("Invalid Worldspace for House: " + buildingID);
				}

				string lock = rs[5].convert<std::string>();
				objParams.push_back(lock);

				bool explosive = rs[6].convert<bool>();
				objParams.push_back(explosive);

				int reinforcement = rs[7].convert<int>();
				objParams.push_back(reinforcement);

				queue.push(objParams);

				more = rs.moveNext();
			};
		};
	}
	catch (std::exception& ex)
	{
		std::cout << ex.what() << std::endl;
	};
};
开发者ID:julian167,项目名称:breakingpointmod-hiveext,代码行数:59,代码来源:Database.cpp


示例8: recordCharacterLogin

Sqf::Value HiveExtApp::recordCharacterLogin( Sqf::Parameters params )
{
	string playerId = Sqf::GetStringAny(params.at(0));
	int characterId = Sqf::GetIntAny(params.at(1));
	int action = Sqf::GetIntAny(params.at(2));
	//TODO: Get survivor ID
	return booleanReturn(_charData->recordLogEntry(playerId,0,getServerId(),action));
}
开发者ID:TheTrivials,项目名称:hive,代码行数:8,代码来源:HiveExtApp.cpp


示例9: playerInit

Sqf::Value HiveExtApp::playerInit( Sqf::Parameters params )
{
	int characterId = Sqf::GetIntAny(params.at(0));
	Sqf::Value inventory = boost::get<Sqf::Parameters>(params.at(1));
	Sqf::Value backpack = boost::get<Sqf::Parameters>(params.at(2));

	return booleanReturn(_charData->initCharacter(characterId,inventory,backpack));
}
开发者ID:TheTrivials,项目名称:hive,代码行数:8,代码来源:HiveExtApp.cpp


示例10: recordCharacterLogin

Sqf::Value HiveExtApp::recordCharacterLogin( Sqf::Parameters params )
{
	string playerId = Sqf::GetStringAny(params.at(0));
	int characterId = Sqf::GetIntAny(params.at(1));
	int action = Sqf::GetIntAny(params.at(2));

	return booleanReturn(_charData->recordLogin(playerId,characterId,action));
}
开发者ID:Notchzu,项目名称:DayZhiveEpoch,代码行数:8,代码来源:HiveExtApp.cpp


示例11: booleanReturn

Sqf::Parameters HiveExtApp::booleanReturn( bool isGood )
{
	Sqf::Parameters retVal;
	string retStatus = "PASS";
	if (!isGood)
		retStatus = "ERROR";

	retVal.push_back(retStatus);
	return retVal;
}
开发者ID:TheTrivials,项目名称:hive,代码行数:10,代码来源:HiveExtApp.cpp


示例12: objectInventory

Sqf::Value HiveExtApp::objectInventory( Sqf::Parameters params, bool byUID /*= false*/ )
{
	Int64 objectIdent = Sqf::GetBigInt(params.at(0));
	Sqf::Value inventory = boost::get<Sqf::Parameters>(params.at(1));

	if (objectIdent != 0) //all the vehicles have objectUID = 0, so it would be bad to update those
		return booleanReturn(_objData->updateObjectInventory(getServerId(),objectIdent,byUID,inventory));

	return booleanReturn(true);
}
开发者ID:TheTrivials,项目名称:hive,代码行数:10,代码来源:HiveExtApp.cpp


示例13: vehicleMoved

Sqf::Value HiveExtApp::vehicleMoved( Sqf::Parameters params )
{
	Int64 objectIdent = Sqf::GetBigInt(params.at(0));
	Sqf::Value worldspace = boost::get<Sqf::Parameters>(params.at(1));
	double fuel = Sqf::GetDouble(params.at(2));

	if (objectIdent > 0) //sometimes script sends this with object id 0, which is bad
		return booleanReturn(_objData->updateVehicleMovement(getServerId(),objectIdent,worldspace,fuel));

	return booleanReturn(true);
}
开发者ID:TheTrivials,项目名称:hive,代码行数:11,代码来源:HiveExtApp.cpp


示例14: vehicleDamaged

Sqf::Value HiveExtApp::vehicleDamaged( Sqf::Parameters params )
{
	Int64 objectIdent = Sqf::GetBigInt(params.at(0));
	Sqf::Value hitPoints = boost::get<Sqf::Parameters>(params.at(1));
	double damage = Sqf::GetDouble(params.at(2));

	if (objectIdent > 0) //sometimes script sends this with object id 0, which is bad
		return booleanReturn(_objData->updateVehicleStatus(getServerId(),objectIdent,hitPoints,damage));

	return booleanReturn(true);
}
开发者ID:TheTrivials,项目名称:hive,代码行数:11,代码来源:HiveExtApp.cpp


示例15: populateHackData

void Database::populateHackData(int requestID, std::queue<Sqf::Parameters>& queue)
{
	Poco::Data::Statement stmt((*activeSession));
	switch (requestID)
	{
		//Weapons
		case 1:
		{
			  stmt << "select `weapon` from `hack_weapons` where 1";
			  break;
		}
		//Magazines
		case 2:
		{
			  stmt << "select `magazine` from `hack_magazines` where 1";
			  break;
		}
		//Vars
		case 3:
		{
			  stmt << "select `var` from `hack_vars` where 1";
			  break;
		}
		//Scripts
		case 4:
		{
			  stmt << "select `script` from `hack_scripts` where 1";
			  break;
		}
	}

	stmt.execute();
	Poco::Data::RecordSet rs(stmt);
	if (rs.columnCount() >= 1)
	{
		bool more = rs.moveFirst();
		while (more)
		{
			Sqf::Parameters objParams;

			string str = rs[0].convert<std::string>();
			objParams.push_back(str);

			queue.push(objParams);

			more = rs.moveNext();
		};
	};
};
开发者ID:julian167,项目名称:breakingpointmod-hiveext,代码行数:49,代码来源:Database.cpp


示例16: populateTraps

void Database::populateTraps(std::queue<Sqf::Parameters>& queue)
{
	try
	{
		Poco::Data::Statement stmt((*activeSession));
		stmt << "select `unique_id`, `classname`, `worldspace` from `instance_traps` where `instance_id` = ?", use(serverID);
		stmt.execute();
		Poco::Data::RecordSet rs(stmt);

		if (rs.columnCount() >= 1)
		{
			bool more = rs.moveFirst();
			while (more)
			{
				Sqf::Parameters objParams;
				objParams.push_back(string("TRAP"));

				string uniqueID = rs[0].convert<std::string>();
				objParams.push_back(uniqueID);

				string classname = rs[1].convert<std::string>();
				objParams.push_back(classname);

				try
				{
					string worldSpace = rs[2].convert<std::string>();
					Sqf::Value worldSpaceArray = lexical_cast<Sqf::Value>(worldSpace);
					objParams.push_back(worldSpaceArray);
				}
				catch (boost::bad_lexical_cast)
				{
					console->log("Invalid Worldspace for Trap: " + uniqueID);
				}

				queue.push(objParams);

				more = rs.moveNext();
			};
		};
	}
	catch (std::exception& ex)
	{
		std::cout << ex.what() << std::endl;
	};
};
开发者ID:julian167,项目名称:breakingpointmod-hiveext,代码行数:45,代码来源:Database.cpp


示例17: populateTraderObjects

void SqlObjDataSource::populateTraderObjects( int characterId, ServerObjectsQueue& queue )
{	
	
	auto worldObjsRes = getDB()->queryParams("SELECT `id`, `item`, `qty`, `buy`, `sell`, `order`, `tid`, `afile` FROM `Traders_DATA` WHERE `tid`=%d", characterId);

	while (worldObjsRes->fetchRow())
	{
		auto row = worldObjsRes->fields();

		Sqf::Parameters objParams;
		objParams.push_back(row[0].getInt32());
		
		// `item` varchar(255) NOT NULL COMMENT '[Class Name,1 = CfgMagazines | 2 = Vehicle | 3 = Weapon]',
		// `qty` int(8) NOT NULL COMMENT 'amount in stock available to buy',
		// `buy`  varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
		// `sell`  varchar(255) NOT NULL COMMENT '[[Qty,Class,Type],]',
		// `order` int(2) NOT NULL DEFAULT '0' COMMENT '# sort order for addAction menu',
		// `tid` int(8) NOT NULL COMMENT 'Trader Menu ID',
		// `afile` varchar(64) NOT NULL DEFAULT 'trade_items',

		//get stuff from row
		objParams.push_back(lexical_cast<Sqf::Value>(row[1].getString()));  // item
		objParams.push_back(row[2].getInt32()); // qty
		objParams.push_back(lexical_cast<Sqf::Value>(row[3].getString()));  // buy
		objParams.push_back(lexical_cast<Sqf::Value>(row[4].getString()));  // sell
		objParams.push_back(row[5].getInt32()); // order
		objParams.push_back(row[6].getInt32()); // tid
		objParams.push_back(row[7].getString()); // afile

		queue.push(objParams);
	}
}
开发者ID:IdbeHoldL,项目名称:DayZhiveEpoch,代码行数:32,代码来源:SqlObjDataSource.cpp


示例18: objectDelete

Sqf::Value HiveExtApp::objectDelete( Sqf::Parameters params, bool byUID /*= false*/ )
{
	Int64 objectIdent = Sqf::GetBigInt(params.at(0));

	if (objectIdent != 0) //all the vehicles have objectUID = 0, so it would be bad to delete those
		return booleanReturn(_objData->deleteObject(getServerId(),objectIdent,byUID));

	return booleanReturn(true);
}
开发者ID:TheTrivials,项目名称:hive,代码行数:9,代码来源:HiveExtApp.cpp


示例19: killCharacter

Sqf::Value Database::killCharacter(int characterID)
{
	//Update Stats Profile
	{
		Poco::Data::Statement stmt((*activeSession));
		stmt << "update `profile` p inner join `survivor` s on s.`unique_id` = p.`unique_id` set p.`survival_attempts` = p.`survival_attempts` + 1, p.`total_survivor_kills` = p.`total_survivor_kills` + s.`survivor_kills`, p.`total_zombie_kills` = p.`total_zombie_kills` + s.`zombie_kills`, p.`total_headshots` = p.`total_headshots` + s.`headshots`, p.`total_survival_time` = p.`total_survival_time` + s.`survival_time` where s.`id` = ? and s.`is_dead` = 0", use(characterID), now;
	}

	//Kill Character
	Poco::Data::Statement stmt((*activeSession));
	stmt << "update `survivor` set `is_dead` = 1 where `id` = ?", use(characterID), now;

	//Return Success
	Sqf::Parameters retVal;
	retVal.push_back(string("PASS"));
	retVal.push_back(lexical_cast<string>(characterID));
	return retVal;

};
开发者ID:julian167,项目名称:breakingpointmod-hiveext,代码行数:19,代码来源:Database.cpp


示例20: loadTraderDetails

Sqf::Value HiveExtApp::loadTraderDetails( Sqf::Parameters params )
{
	if (_srvObjects.empty())
	{
		int characterId = Sqf::GetIntAny(params.at(0));

		_objData->populateTraderObjects(characterId, _srvObjects);

		Sqf::Parameters retVal;
		retVal.push_back(string("ObjectStreamStart"));
		retVal.push_back(static_cast<int>(_srvObjects.size()));
		return retVal;
	}
	else
	{
		Sqf::Parameters retVal = _srvObjects.front();
		_srvObjects.pop();

		return retVal;
	}
}
开发者ID:Notchzu,项目名称:DayZhiveEpoch,代码行数:21,代码来源:HiveExtApp.cpp



注:本文中的sqf::Parameters类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sql::SQLString类代码示例发布时间:2022-05-31
下一篇:
C++ sprout::valarray类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap