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

C++ readXMLInteger函数代码示例

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

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



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

示例1: if

bool TalkAction::configureEvent(xmlNodePtr p)
{
	std::string str;
	int intValue;
	if(readXMLString(p, "words", str)){
		commandString = str;
	}
	else{
		std::cout << "Error: [TalkAction::configureEvent] No words for TalkAction or Spell." 
			<< std::endl;
		return false;
	}

	if(readXMLString(p, "filter", str)){
		if(str == "quotation") {
			filterType = TALKACTION_MATCH_QUOTATION;
		} else if(str == "first word") {
			filterType = TALKACTION_MATCH_FIRST_WORD;
		}
	}

	if(readXMLInteger(p, "case-sensitive", intValue) || readXMLInteger(p, "sensitive", intValue)){
		caseSensitive = (intValue != 0);
	}

	if(readXMLInteger(p, "access", intValue)){
		accessLevel = intValue;
	}

	return true;
}
开发者ID:Codex-NG,项目名称:avesta74,代码行数:31,代码来源:talkaction.cpp


示例2: configureEvent

bool WeaponWand::configureEvent(xmlNodePtr p)
{
	if(!Weapon::configureEvent(p))
		return false;

	int32_t intValue;
	std::string strValue;

	if(readXMLInteger(p, "min", intValue))
		minChange = intValue;

	if(readXMLInteger(p, "max", intValue))
		maxChange = intValue;

	if(readXMLString(p, "type", strValue))
	{
		std::string tmpStrValue = asLowerCaseString(strValue);
		if(tmpStrValue == "earth")
			params.combatType = COMBAT_EARTHDAMAGE;
		else if(tmpStrValue == "ice")
			params.combatType = COMBAT_ICEDAMAGE;
		else if(tmpStrValue == "energy")
			params.combatType = COMBAT_ENERGYDAMAGE;
		else if(tmpStrValue == "fire")
			params.combatType = COMBAT_FIREDAMAGE;
		else if(tmpStrValue == "death")
			params.combatType = COMBAT_DEATHDAMAGE;
		else if(tmpStrValue == "holy")
			params.combatType = COMBAT_HOLYDAMAGE;
		else
			std::cout << "[Warning - WeaponWand::configureEvent] Type \"" << strValue << "\" does not exist." << std::endl;
	}
	return true;
}
开发者ID:CkyLua,项目名称:tfs,代码行数:34,代码来源:weapons.cpp


示例3: id

bool EffectEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;

	int32_t intValue;
	std::string strValue;
	if(!readXMLInteger(eventNode, "id", intValue))
	{
		if(!readXMLString(eventNode, "name", strValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] id (or name) tag missing for effect event." << std::endl;
			return false;
		}
		else
			m_effect = getMagicEffect(strValue);
	}
	else
		m_effect = (MagicEffect_t)intValue;

	if(!readXMLString(eventNode, "pos", strValue))
	{
		if(!readXMLInteger(eventNode, "x", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] x tag missing for effect event." << std::endl;
			return false;
		}

		m_position.x = intValue;
		if(!readXMLInteger(eventNode, "y", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] y tag missing for effect event." << std::endl;
			return false;
		}

		m_position.y = intValue;
		if(!readXMLInteger(eventNode, "z", intValue))
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] z tag missing for effect event." << std::endl;
			return false;
		}

		m_position.z = intValue;
	}
	else
	{
		IntegerVec posList = vectorAtoi(explodeString(strValue, ";"));
		if(posList.size() < 3)
		{
			std::clog << "[Error - EffectEvent::configureRaidEvent] Malformed pos tag for effect event." << std::endl;
			return false;
		}

		m_position = Position(posList[0], posList[1], posList[2]);
	}

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:58,代码来源:raids.cpp


示例4: xmlParseFile

bool Actions::loadFromXml(const std::string &_datadir)
{
	this->loaded = false;
	Action *action = NULL;

	datadir = _datadir;

	std::string filename = datadir + "actions/actions.xml";
	std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
	xmlDocPtr doc = xmlParseFile(filename.c_str());

	if (doc){
		this->loaded=true;
		xmlNodePtr root, p;
		root = xmlDocGetRootElement(doc);

		if (xmlStrcmp(root->name,(const xmlChar*) "actions")){
			xmlFreeDoc(doc);
			return false;
		}
		p = root->children;

		while (p)
		{
			const char* str = (char*)p->name;

			if (strcmp(str, "action") == 0){
				int itemid,uniqueid,actionid;
				if(readXMLInteger(p,"itemid",itemid)){
					action = loadAction(p);
					useItemMap[itemid] = action;
					action = NULL;
				}
				else if(readXMLInteger(p,"uniqueid",uniqueid)){
					action = loadAction(p);
					uniqueItemMap[uniqueid] = action;
					action = NULL;
				}
				else if(readXMLInteger(p,"actionid",actionid)){
					action = loadAction(p);
					actionItemMap[actionid] = action;
					action = NULL;
				}
				else{
					std::cout << "missing action id." << std::endl;
				}
			}
			p = p->next;
		}

		xmlFreeDoc(doc);
	}
	return this->loaded;
}
开发者ID:divinity76,项目名称:YurOTS,代码行数:54,代码来源:actions.cpp


示例5: configureRaidEvent

bool SingleSpawnEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode))
		return false;

	std::string strValue;
	if(!readXMLString(eventNode, "name", strValue))
	{
		std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] name tag missing for singlespawn event." << std::endl;
		return false;
	}

	m_monsterName = strValue;
	if(!readXMLString(eventNode, "pos", strValue))
	{
		int32_t intValue;
		if(!readXMLInteger(eventNode, "x", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] x tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.x = intValue;
		if(!readXMLInteger(eventNode, "y", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] y tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.y = intValue;
		if(!readXMLInteger(eventNode, "z", intValue))
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] z tag missing for singlespawn event." << std::endl;
			return false;
		}

		m_position.z = intValue;
	}
	else
	{
		IntegerVec posList = vectorAtoi(explodeString(strValue, ";"));
		if(posList.size() < 3)
		{
			std::clog << "[Error - SingleSpawnEvent::configureRaidEvent] Malformed pos tag for singlespawn event." << std::endl;
			return false;
		}

		m_position = Position(posList[0], posList[1], posList[2]);
	}

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:52,代码来源:raids.cpp


示例6: Group

bool Groups::parseGroupNode(xmlNodePtr p)
{
	if(xmlStrcmp(p->name, (const xmlChar*)"group"))
		return false;

	int32_t intValue;
	if(!readXMLInteger(p, "id", intValue))
	{
		std::cout << "[Warning - Groups::parseGroupNode] Missing group id." << std::endl;
		return false;
	}

	std::string strValue;
	int64_t int64Value;

	Group* group = new Group(intValue);
	if(readXMLString(p, "name", strValue))
	{
		group->setFullName(strValue);
		group->setName(asLowerCaseString(strValue));
	}

	if(readXMLInteger64(p, "flags", int64Value))
		group->setFlags(int64Value);

	if(readXMLInteger64(p, "customFlags", int64Value))
		group->setCustomFlags(int64Value);

	if(readXMLInteger(p, "access", intValue))
		group->setAccess(intValue);

	if(readXMLInteger(p, "ghostAccess", intValue))
		group->setGhostAccess(intValue);
	else
		group->setGhostAccess(group->getAccess());

	if(readXMLInteger(p, "violationReasons", intValue))
		group->setViolationReasons(intValue);

	if(readXMLInteger(p, "nameViolationFlags", intValue))
		group->setNameViolationFlags(intValue);

	if(readXMLInteger(p, "statementViolationFlags", intValue))
		group->setStatementViolationFlags(intValue);

	if(readXMLInteger(p, "depotLimit", intValue))
		group->setDepotLimit(intValue);

	if(readXMLInteger(p, "maxVips", intValue))
		group->setMaxVips(intValue);

	if(readXMLInteger(p, "outfit", intValue))
		group->setOutfit(intValue);

	groupsMap[group->getId()] = group;
	return true;
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:57,代码来源:group.cpp


示例7: explodeString

bool Item::loadItem(xmlNodePtr node, Container* parent)
{
	if(!xmlStrcmp(node->name, (const xmlChar*)"item"))
		return false;

	int32_t intValue;
	std::string strValue;

	Item* item = NULL;
	if(readXMLInteger(node, "id", intValue))
		item = Item::CreateItem(intValue);

	if(!item)
		return false;

	if(readXMLString(node, "attributes", strValue))
	{
		StringVec v, attr = explodeString(strValue, ";");
		for(StringVec::iterator it = attr.begin(); it != attr.end(); ++it)
		{
			v = explodeString((*it), ",");
			if(v.size() < 2)
				continue;

			if(atoi(v[1].c_str()) || v[1] == "0")
				item->setAttribute(v[0].c_str(), atoi(v[1].c_str()));
			else
				item->setAttribute(v[0].c_str(), v[1]);
		}
	}

	//compatibility
	if(readXMLInteger(node, "subtype", intValue) || readXMLInteger(node, "subType", intValue))
		item->setSubType(intValue);

	if(readXMLInteger(node, "actionId", intValue) || readXMLInteger(node, "actionid", intValue)
		|| readXMLInteger(node, "aid", intValue))
		item->setActionId(intValue);

	if(readXMLInteger(node, "uniqueId", intValue) || readXMLInteger(node, "uniqueid", intValue)
		|| readXMLInteger(node, "uid", intValue))
		item->setUniqueId(intValue);

	if(readXMLString(node, "text", strValue))
		item->setText(strValue);

	if(item->getContainer())
		loadContainer(node, item->getContainer());

	if(parent)
		parent->addItem(item);

	return true;
}
开发者ID:Elexonic,项目名称:otxserver,代码行数:54,代码来源:item.cpp


示例8: loadItem

bool Item::loadItem(xmlNodePtr node, Container* parent)
{
	if (xmlStrcmp(node->name, (const xmlChar*)"item") == 0)
	{
		int32_t intValue;
		std::string strValue;
		Item* item = NULL;

		if (readXMLInteger(node, "id", intValue))
		{
			item = Item::CreateItem(intValue);
		}

		if (!item)
		{
			return false;
		}

		//optional
		if (readXMLInteger(node, "subtype", intValue))
		{
			item->setSubType(intValue);
		}

		if (readXMLInteger(node, "actionid", intValue))
		{
			item->setActionId(intValue);
		}

		if (readXMLString(node, "text", strValue))
		{
			item->setText(strValue);
		}

		if (item->getContainer())
		{
			loadContainer(node, item->getContainer());
		}

		if (parent)
		{
			parent->addItem(item);
		}

		return true;
	}

	return false;
}
开发者ID:edubart,项目名称:otserv,代码行数:49,代码来源:item.cpp


示例9: parseOutfitNode

bool Outfits::parseOutfitNode(xmlNodePtr p)
{
	if(xmlStrcmp(p->name, (const xmlChar*)"outfit"))
		return false;

	int32_t intValue;
	if(!readXMLInteger(p, "id", intValue))
	{
		LOGe("[Outfits::parseOutfitNode] Missing outfit id, skipping");
		return false;
	}

	Outfit newOutfit;
	newOutfit.outfitId = intValue;

	std::string name, strValue;
	if(readXMLString(p, "default", strValue))
		newOutfit.isDefault = booleanString(strValue);

	if(!readXMLString(p, "name", strValue))
	{
		std::stringstream ss;
		ss << "Outfit #" << newOutfit.outfitId;
		ss >> name;
	}
开发者ID:novasdream,项目名称:tyano-core,代码行数:25,代码来源:outfit.cpp


示例10: setAllowFarUse

bool Action::configureEvent(xmlNodePtr p)
{
	int32_t intValue;
	if(readXMLInteger(p, "allowfaruse", intValue))
	{
		if(intValue != 0)
			setAllowFarUse(true);
	}

	if(readXMLInteger(p, "blockwalls", intValue))
	{
		if(intValue == 0)
			setCheckLineOfSight(false);
	}
	return true;
}
开发者ID:CkyLua,项目名称:tfs,代码行数:16,代码来源:actions.cpp


示例11: xmlParseMemory

Item* ProtocolAdmin::createMail(const std::string& xmlData, std::string& name, uint32_t& depotId)
{
	xmlDocPtr doc = xmlParseMemory(xmlData.c_str(), strlen(xmlData.c_str()));
	if(!doc){
		return NULL;
	}

	xmlNodePtr root = xmlDocGetRootElement(doc);

	if(xmlStrcmp(root->name,(const xmlChar*)"mail") != 0){
		return NULL;
	}

	int32_t itemId = ITEM_PARCEL;

	int32_t intValue;
	std::string strValue;

	if(readXMLString(root, "to", strValue)){
		name = strValue;
	}

	if(readXMLString(root, "town", strValue)){
		if(!Mailbox::getDepotId(strValue, depotId)){
			return NULL;
		}
	}
	else{
		//use the players default town
		if(!IOPlayer::instance()->getDefaultTown(name, depotId)){
			return NULL;
		}
	}

	if(readXMLInteger(root, "id", intValue)){
		itemId = intValue;
	}

	Item* mailItem = Item::CreateItem(itemId);
	mailItem->setParent(VirtualCylinder::virtualCylinder);

	if(Container* mailContainer = mailItem->getContainer()){
		xmlNodePtr node = root->children;
		while(node){
			if(node->type != XML_ELEMENT_NODE){
				node = node->next;
				continue;
			}

			if(!Item::loadItem(node, mailContainer)){
				delete mailContainer;
				return NULL;
			}

			node = node->next;
		}
	}

	return mailItem;
}
开发者ID:CkyLua,项目名称:OTHire,代码行数:60,代码来源:admin.cpp


示例12: configureEvent

bool WeaponDistance::configureEvent(xmlNodePtr p)
{
	if (!Weapon::configureEvent(p)) {
		return false;
	}

	const ItemType& it = Item::items[id];

	//default values
	if (it.ammoType != AMMO_NONE) {
		//hit chance on two-handed weapons is limited to 90%
		maxHitChance = 90;
	} else {
		//one-handed is set to 75%
		maxHitChance = 75;
	}

	if (it.hitChance != 0) {
		hitChance = it.hitChance;
	}

	if (it.maxHitChance != -1) {
		maxHitChance = it.maxHitChance;
	}

	if (it.breakChance != -1) {
		breakChance = it.breakChance;
	}

	if (it.ammoAction != AMMOACTION_NONE) {
		ammoAction = it.ammoAction;
	}

	int32_t intValue;

	if (readXMLInteger(p, "hitChance", intValue)) {
		std::cout << "Warning: hitChance is not longer used in weapons.xml." << std::endl;
	}

	if (readXMLInteger(p, "breakChance", intValue)) {
		std::cout << "Warning: breakChance is not longer used in weapons.xml." << std::endl;
	}

	return true;
}
开发者ID:bergvall,项目名称:forgottenserver,代码行数:45,代码来源:weapons.cpp


示例13: configureRaidEvent

bool SingleSpawnEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	if(!RaidEvent::configureRaidEvent(eventNode)){
		return false;
	}

	std::string strValue;
	int intValue;

	if(readXMLString(eventNode, "name", strValue)){
		m_monsterName = strValue;
	}
	else{
		std::cout << "[Error] Raid: name tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "x", intValue)){
		m_position.x = intValue;
	}
	else{
		std::cout << "[Error] Raid: x tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "y", intValue)){
		m_position.y = intValue;
	}
	else{
		std::cout << "[Error] Raid: y tag missing for singlespawn event." << std::endl;
		return false;
	}

	if(readXMLInteger(eventNode, "z", intValue)){
		m_position.z = intValue;
	}
	else{
		std::cout << "[Error] Raid: z tag missing for singlespawn event." << std::endl;
		return false;
	}

	return true;
}
开发者ID:ChubNtuck,项目名称:avesta74,代码行数:43,代码来源:raids.cpp


示例14: booleanString

bool RaidEvent::configureRaidEvent(xmlNodePtr eventNode)
{
	std::string strValue;
	if(readXMLString(eventNode, "ref", strValue))
		m_ref = booleanString(strValue);

	int32_t intValue;
	if(readXMLInteger(eventNode, "delay", intValue))
		m_delay = std::max((int32_t)m_delay, intValue);

	return true;
}
开发者ID:milbradt,项目名称:TFS,代码行数:12,代码来源:raids.cpp


示例15: setSubType

bool Item::unserialize(xmlNodePtr nodeItem)
{
	int intValue;
	std::string strValue;

	if(readXMLInteger(nodeItem, "id", intValue)){
		id = intValue;
	}
	else{
		return false;
	}

	if(readXMLInteger(nodeItem, "count", intValue)){
		setSubType(intValue);
	}

	if(readXMLString(nodeItem, "special_description", strValue)){
		setSpecialDescription(strValue);
	}

	if(readXMLString(nodeItem, "text", strValue)){
		setText(strValue);
	}

	if(readXMLInteger(nodeItem, "written_date", intValue)){
		setWrittenDate(intValue);
	}

	if(readXMLString(nodeItem, "writer", strValue)){
		setWriter(strValue);
	}

	if(readXMLInteger(nodeItem, "actionId", intValue)){
		setActionId(intValue);
	}

	if(readXMLInteger(nodeItem, "uniqueId", intValue)){
		setUniqueId(intValue);
	}

	if(readXMLInteger(nodeItem, "duration", intValue)){
		setDuration(intValue);
	}

	if(readXMLInteger(nodeItem, "decayState", intValue)){
		ItemDecayState_t decayState = (ItemDecayState_t)intValue;
		if(decayState != DECAYING_FALSE){
			setDecaying(DECAYING_PENDING);
		}
	}

	return true;
}
开发者ID:cp1337,项目名称:devland,代码行数:53,代码来源:item.cpp


示例16: xmlParseMemory

Item* Admin::createMail(const std::string xmlData, std::string& name)
{
	xmlDocPtr doc = xmlParseMemory(xmlData.c_str(), xmlData.length());
	if(!doc)
		return NULL;

	xmlNodePtr root = xmlDocGetRootElement(doc);
	if(xmlStrcmp(root->name,(const xmlChar*)"mail"))
		return NULL;

	int32_t intValue;
	std::string strValue;

	int32_t itemId = ITEM_PARCEL;
	if(readXMLString(root, "to", strValue))
		name = strValue;

	if(readXMLInteger(root, "id", intValue))
		itemId = intValue;

	Item* mailItem = Item::CreateItem(itemId);
	mailItem->setParent(VirtualCylinder::virtualCylinder);
	if(Container* mailContainer = mailItem->getContainer())
	{
		xmlNodePtr node = root->children;
		while(node)
		{
			if(node->type != XML_ELEMENT_NODE)
			{
				node = node->next;
				continue;
			}

			if(!Item::loadItem(node, mailContainer))
			{
				delete mailContainer;
				return NULL;
			}

			node = node->next;
		}
	}

	return mailItem;
}
开发者ID:081421,项目名称:otxserver,代码行数:45,代码来源:admin.cpp


示例17: xmlParseFile

bool Vocations::loadFromXml()
{
	std::string filename = "data/XML/vocations.xml";

	xmlDocPtr doc = xmlParseFile(filename.c_str());

	if (doc) {
		xmlNodePtr root, p;
		root = xmlDocGetRootElement(doc);

		if (xmlStrcmp(root->name, (const xmlChar*)"vocations") != 0) {
			xmlFreeDoc(doc);
			return false;
		}

		p = root->children;

		while (p) {
			std::string str;
			int32_t intVal;

			if (xmlStrcmp(p->name, (const xmlChar*)"vocation") == 0) {
				Vocation* voc = new Vocation();
				uint32_t voc_id;
				xmlNodePtr configNode;

				if (readXMLInteger(p, "id", intVal)) {
					float floatVal;

					voc_id = intVal;

					if (readXMLString(p, "name", str)) {
						voc->name = str;
					}

					if (readXMLInteger(p, "clientid", intVal)) {
						voc->clientId = intVal;
					}

					if (readXMLString(p, "description", str)) {
						voc->description = str;
					}

					if (readXMLInteger(p, "gaincap", intVal)) {
						voc->gainCap = intVal;
					}

					if (readXMLInteger(p, "gainhp", intVal)) {
						voc->gainHP = intVal;
					}

					if (readXMLInteger(p, "gainmana", intVal)) {
						voc->gainMana = intVal;
					}

					if (readXMLInteger(p, "gainhpticks", intVal)) {
						voc->gainHealthTicks = intVal;
					}

					if (readXMLInteger(p, "gainhpamount", intVal)) {
						voc->gainHealthAmount = intVal;
					}

					if (readXMLInteger(p, "gainmanaticks", intVal)) {
						voc->gainManaTicks = intVal;
					}

					if (readXMLInteger(p, "gainmanaamount", intVal)) {
						voc->gainManaAmount = intVal;
					}

					if (readXMLFloat(p, "manamultiplier", floatVal)) {
						voc->manaMultiplier = floatVal;
					}

					if (readXMLInteger(p, "attackspeed", intVal)) {
						voc->attackSpeed = intVal;
					}

					if (readXMLInteger(p, "basespeed", intVal)) {
						voc->baseSpeed = intVal;
					}

					if (readXMLInteger(p, "soulmax", intVal)) {
						voc->soulMax = intVal;
					}

					if (readXMLInteger(p, "gainsoulticks", intVal)) {
						voc->gainSoulTicks = intVal;
					}

					if (readXMLInteger(p, "fromvoc", intVal)) {
						voc->fromVocation = intVal;
					}

					configNode = p->children;

					while (configNode) {
						if (xmlStrcmp(configNode->name, (const xmlChar*)"skill") == 0) {
							uint32_t skill_id;
//.........这里部分代码省略.........
开发者ID:24312108k,项目名称:forgottenserver,代码行数:101,代码来源:vocation.cpp


示例18: if

bool MoveEvent::configureEvent(xmlNodePtr p)
{
	std::string str;
	int intValue;
	if(readXMLString(p, "event", str)){
		if(asLowerCaseString(str) == "stepin"){
			m_eventType = MOVE_EVENT_STEP_IN;
		}
		else if(asLowerCaseString(str) == "stepout"){
			m_eventType = MOVE_EVENT_STEP_OUT;
		}
		else if(asLowerCaseString(str) == "equip"){
			m_eventType = MOVE_EVENT_EQUIP;
		}
		else if(asLowerCaseString(str) == "deequip"){
			m_eventType = MOVE_EVENT_DEEQUIP;
		}
		else if(asLowerCaseString(str) == "additem"){
			m_eventType = MOVE_EVENT_ADD_ITEM;
		}
		else if(asLowerCaseString(str) == "removeitem"){
			m_eventType = MOVE_EVENT_REMOVE_ITEM;
		}
		else{
			std::cout << "Error: [MoveEvent::configureMoveEvent] No valid event name " << str << std::endl;
			return false;
		}

		if(m_eventType == MOVE_EVENT_EQUIP || m_eventType == MOVE_EVENT_DEEQUIP){
			if(readXMLString(p, "slot", str)){
				if(asLowerCaseString(str) == "head"){
					slot = SLOT_HEAD;
				}
				else if(asLowerCaseString(str) == "necklace"){
					slot = SLOT_NECKLACE;
				}
				else if(asLowerCaseString(str) == "backpack"){
					slot = SLOT_BACKPACK;
				}
				else if(asLowerCaseString(str) == "armor"){
					slot = SLOT_ARMOR;
				}
				else if(asLowerCaseString(str) == "right-hand"){
					slot = SLOT_RIGHT;
				}
				else if(asLowerCaseString(str) == "left-hand"){
					slot = SLOT_LEFT;
				}
				else if(asLowerCaseString(str) == "legs"){
					slot = SLOT_LEGS;
				}
				else if(asLowerCaseString(str) == "feet"){
					slot = SLOT_FEET;
				}
				else if(asLowerCaseString(str) == "ring"){
					slot = SLOT_RING;
				}
				else if(asLowerCaseString(str) == "ammo"){
					slot = SLOT_AMMO;
				}
				else{
					std::cout << "Warning: [MoveEvent::configureMoveEvent] " << "Unknown slot type " << str << std::endl;
				}
			}

			wieldInfo = 0;
			if(readXMLInteger(p, "lvl", intValue) || readXMLInteger(p, "level", intValue)){
	 			reqLevel = intValue;
				if(reqLevel > 0){
					wieldInfo |= WIELDINFO_LEVEL;
				}
			}
			if(readXMLInteger(p, "maglv", intValue) || readXMLInteger(p, "maglevel", intValue)){
	 			reqMagLevel = intValue;
				if(reqMagLevel > 0){
					wieldInfo |= WIELDINFO_MAGLV;
				}
			}
			if(readXMLInteger(p, "prem", intValue) || readXMLInteger(p, "premium", intValue)){
				premium = (intValue != 0);
				if(premium){
					wieldInfo |= WIELDINFO_PREMIUM;
				}
			}

			//Gather vocation information
			typedef std::list<std::string> STRING_LIST;
			STRING_LIST vocStringList;
			xmlNodePtr vocationNode = p->children;
			while(vocationNode){
				if(xmlStrcmp(vocationNode->name,(const xmlChar*)"vocation") == 0){
					if(readXMLString(vocationNode, "name", str)){
						int32_t vocationId = g_vocations.getVocationId(str);

						if(vocationId != -1){
							vocEquipMap[vocationId] = true;
							intValue = 1;
							readXMLInteger(vocationNode, "showInDescription", intValue);
							if(intValue != 0){
								toLowerCaseString(str);
//.........这里部分代码省略.........
开发者ID:WeDontGiveAF,项目名称:OOServer,代码行数:101,代码来源:movement.cpp


示例19: switch

bool MoveEvents::registerEvent(Event* event, xmlNodePtr p)
{
	MoveEvent* moveEvent = dynamic_cast<MoveEvent*>(event);
	if(!moveEvent)
		return false;

	bool success = true;
	int id;
	std::string str;

	MoveEvent_t eventType = moveEvent->getEventType();
	if(eventType == MOVE_EVENT_ADD_ITEM || eventType == MOVE_EVENT_REMOVE_ITEM){
		if(readXMLInteger(p,"tileitem",id) && id == 1){
			switch(eventType){
			case MOVE_EVENT_ADD_ITEM:
				moveEvent->setEventType(MOVE_EVENT_ADD_ITEM_ITEMTILE);
				break;
			case MOVE_EVENT_REMOVE_ITEM:
				moveEvent->setEventType(MOVE_EVENT_REMOVE_ITEM_ITEMTILE);
				break;
			default:
				break;
			}
		}
	}

	if(readXMLInteger(p,"itemid",id)){
		if(moveEvent->getEventType() == MOVE_EVENT_EQUIP){
			ItemType& it = Item::items.getItemType(id);
			it.wieldInfo = moveEvent->getWieldInfo();
			it.minReqLevel = moveEvent->getReqLevel();
			it.minReqMagicLevel = moveEvent->getReqMagLv();
			it.vocationString = moveEvent->getVocationString();
		}

		addEvent(moveEvent, id, m_itemIdMap);
	}
	else if(readXMLInteger(p,"uniqueid",id)){
		addEvent(moveEvent, id, m_uniqueIdMap);
	}
	else if(readXMLInteger(p,"actionid",id)){
		addEvent(moveEvent, id, m_actionIdMap);
	}
	else if(readXMLString(p,"pos",str)){
		std::vector<std::string> posList = explodeString(str, ";");
		if(posList.size() < 3){
			success = false;
		}
		else{
			Position pos;
			pos.x = atoi(posList[0].c_str());
			pos.y = atoi(posList[1].c_str());
			pos.z = atoi(posList[2].c_str());
			addEvent(moveEvent, pos, m_positionMap);
		}
	}
	else{
		success = false;
	}
	return success;
}
开发者ID:WeDontGiveAF,项目名称:OOServer,代码行数:61,代码来源:movement.cpp


示例20: Vocation

bool Vocations::parseVocationNode(xmlNodePtr p)
{
	std::string strValue;
	int32_t intValue;
	float floatValue;
	if(xmlStrcmp(p->name, (const xmlChar*)"vocation"))
		return false;

	if(!readXMLInteger(p, "id", intValue))
	{
		std::cout << "[Error - Vocations::parseVocationNode] Missing vocation id." << std::endl;
		return false;
	}

	Vocation* voc = new Vocation(intValue);
	if(readXMLString(p, "name", strValue))
		voc->setName(strValue);

	if(readXMLString(p, "description", strValue))
		voc->setDescription(strValue);

	if(readXMLString(p, "needpremium", strValue))
		voc->setNeedPremium(booleanString(strValue));

	if(readXMLInteger(p, "gaincap", intValue) || readXMLInteger(p, "gaincapacity", intValue))
		voc->setGainCap(intValue);

	if(readXMLInteger(p, "gainhp", intValue) || readXMLInteger(p, "gainhealth", intValue))
		voc->setGain(GAIN_HEALTH, intValue);

	if(readXMLInteger(p, "gainmana", intValue))
		voc->setGain(GAIN_MANA, intValue);

	if(readXMLInteger(p, "gainhpticks", intValue) || readXMLInteger(p, "gainhealthticks", intValue))
		voc->setGainTicks(GAIN_HEALTH, intValue);

	if(readXMLInteger(p, "gainhpamount", intValue) || readXMLInteger(p, "gainhealthamount", intValue))
		voc->setGainAmount(GAIN_HEALTH, intValue);

	if(readXMLInteger(p, "gainmanaticks", intValue))
		voc->setGainTicks(GAIN_MANA, intValue);

	if(readXMLInteger(p, "gainmanaamount", intValue))
		voc->setGainAmount(GAIN_MANA, intValue);

	if(readXMLFloat(p, "manamultiplier", floatValue))
		voc->setMultiplier(MULTIPLIER_MANA, floatValue);

	if(readXMLInteger(p, "attackspeed", intValue))
		voc->setAttackSpeed(intValue);

	if(readXMLInteger(p, "basespeed", intValue))
		voc->setBaseSpeed(intValue);

	if(readXMLInteger(p, "soulmax", intValue))
		voc->setGain(GAIN_SOUL, intValue);

	if(readXMLInteger(p, "gainsoulamount", intValue))
		voc->setGainAmount(GAIN_SOUL, intValue);

	if(readXMLInteger(p, "gainsoulticks", intValue))
		voc->setGainTicks(GAIN_SOUL, intValue);

	if(readXMLString(p, "attackable", strValue))
		voc->setAttackable(booleanString(strValue));

	if(readXMLInteger(p, "fromvoc", intValue) || readXMLInteger(p, "fromvocation", intValue))
		voc->setFromVocation(intValue);

	if(readXMLInteger(p, "lessloss", intValue))
		voc->setLessLoss(intValue);

	xmlNodePtr configNode = p->children;
	while(configNode)
	{
		if(!xmlStrcmp(configNode->name, (const xmlChar*)"skill"))
		{
			if(readXMLFloat(configNode, "fist", floatValue))
				voc->setSkillMultiplier(SKILL_FIST, floatValue);

			if(readXMLInteger(configNode, "fistBase", intValue))
				voc->setSkillBase(SKILL_FIST, intValue);

			if(readXMLFloat(configNode, "club", floatValue))
				voc->setSkillMultiplier(SKILL_CLUB, floatValue);

			if(readXMLInteger(configNode, "clubBase", intValue))
				voc->setSkillBase(SKILL_CLUB, intValue);

			if(readXMLFloat(configNode, "axe", floatValue))
				voc->setSkillMultiplier(SKILL_AXE, floatValue);

			if(readXMLInteger(configNode, "axeBase", intValue))
				voc->setSkillBase(SKILL_AXE, intValue);

			if(readXMLFloat(configNode, "sword", floatValue))
				voc->setSkillMultiplier(SKILL_SWORD, floatValue);

			if(readXMLInteger(configNode, "swordBase", intValue))
				voc->setSkillBase(SKILL_SWORD, intValue);
//.........这里部分代码省略.........
开发者ID:Fir3element,项目名称:035,代码行数:101,代码来源:vocation.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ readXMLString函数代码示例发布时间:2022-05-30
下一篇:
C++ readWord函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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