当前位置: 首页>>代码示例>>C++>>正文


C++ ItemInst::IsAttuned方法代码示例

本文整理汇总了C++中ItemInst::IsAttuned方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemInst::IsAttuned方法的具体用法?C++ ItemInst::IsAttuned怎么用?C++ ItemInst::IsAttuned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemInst的用法示例。


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

示例1: ExportEventVariables

void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID event, uint32 objid, const char * data,
        NPC* npcmob, ItemInst* iteminst, Mob* mob, uint32 extradata, std::vector<EQEmu::Any> *extra_pointers)
{
    switch (event) {
    case EVENT_SAY: {
        if(npcmob && mob) {
            npcmob->DoQuestPause(mob);
        }

        ExportVar(package_name.c_str(), "data", objid);
        ExportVar(package_name.c_str(), "text", data);
        ExportVar(package_name.c_str(), "langid", extradata);
        break;
    }

    case EVENT_TRADE: {
        if(extra_pointers) {
            size_t sz = extra_pointers->size();
            for(size_t i = 0; i < sz; ++i) {
                ItemInst *inst = EQEmu::any_cast<ItemInst*>(extra_pointers->at(i));

                std::string var_name = "item";
                var_name += std::to_string(i + 1);

                if(inst) {
                    ExportVar(package_name.c_str(), var_name.c_str(), inst->GetItem()->ID);

                    std::string temp_var_name = var_name;
                    temp_var_name += "_charges";
                    ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->GetCharges());

                    temp_var_name = var_name;
                    temp_var_name += "_attuned";
                    ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->IsAttuned());
                } else {
                    ExportVar(package_name.c_str(), var_name.c_str(), 0);

                    std::string temp_var_name = var_name;
                    temp_var_name += "_charges";
                    ExportVar(package_name.c_str(), temp_var_name.c_str(), 0);

                    temp_var_name = var_name;
                    temp_var_name += "_attuned";
                    ExportVar(package_name.c_str(), temp_var_name.c_str(), 0);
                }
            }
        }

        ExportVar(package_name.c_str(), "copper", GetVar("copper." + std::string(itoa(objid))).c_str());
        ExportVar(package_name.c_str(), "silver", GetVar("silver." + std::string(itoa(objid))).c_str());
        ExportVar(package_name.c_str(), "gold", GetVar("gold." + std::string(itoa(objid))).c_str());
        ExportVar(package_name.c_str(), "platinum", GetVar("platinum." + std::string(itoa(objid))).c_str());
        std::string hashname = package_name + std::string("::itemcount");
        perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
        perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item1};").c_str());
        perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item2};").c_str());
        perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item3};").c_str());
        perl->eval(std::string("++$").append(hashname).append("{$").append(package_name).append("::item4};").c_str());
        break;
    }

    case EVENT_WAYPOINT_ARRIVE:
    case EVENT_WAYPOINT_DEPART: {
        ExportVar(package_name.c_str(), "wp", data);
        break;
    }

    case EVENT_HP: {
        if (extradata == 1) {
            ExportVar(package_name.c_str(), "hpevent", "-1");
            ExportVar(package_name.c_str(), "inchpevent", data);
        }
        else
        {
            ExportVar(package_name.c_str(), "hpevent", data);
            ExportVar(package_name.c_str(), "inchpevent", "-1");
        }
        break;
    }

    case EVENT_TIMER: {
        ExportVar(package_name.c_str(), "timer", data);
        break;
    }

    case EVENT_SIGNAL: {
        ExportVar(package_name.c_str(), "signal", data);
        break;
    }

    case EVENT_NPC_SLAY: {
        ExportVar(package_name.c_str(), "killed", mob->GetNPCTypeID());
        break;
    }

    case EVENT_COMBAT: {
        ExportVar(package_name.c_str(), "combat_state", data);
        break;
    }

//.........这里部分代码省略.........
开发者ID:AthrogatePEQ,项目名称:Server,代码行数:101,代码来源:embparser.cpp

示例2: HandleCombine

// Perform tradeskill combine
void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo)
{
	if (!user || !in_combine) {
		Log.Out(Logs::General, Logs::Error, "Client or NewCombine_Struct not set in Object::HandleCombine");
		return;
	}

	Inventory& user_inv = user->GetInv();
	PlayerProfile_Struct& user_pp = user->GetPP();
	ItemInst* container = nullptr;
	ItemInst* inst = nullptr;
	uint8 c_type = 0xE8;
	uint32 some_id = 0;
	bool worldcontainer=false;

	if (in_combine->container_slot == legacy::SLOT_TRADESKILL) {
		if(!worldo) {
			user->Message(13, "Error: Server is not aware of the tradeskill container you are attempting to use");
			return;
		}
		c_type = worldo->m_type;
		inst = worldo->m_inst;
		worldcontainer=true;
	}
	else {
		inst = user_inv.GetItem(in_combine->container_slot);
		if (inst) {
			const Item_Struct* item = inst->GetItem();
			if (item && inst->IsType(ItemClassContainer)) {
				c_type = item->BagType;
				some_id = item->ID;
			}
		}
	}

	if (!inst || !inst->IsType(ItemClassContainer)) {
		user->Message(13, "Error: Server does not recognize specified tradeskill container");
		return;
	}

	container = inst;
	if (container->GetItem() && container->GetItem()->BagType == BagTypeTransformationmold) {
		const ItemInst* inst = container->GetItem(0);
		bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation);
		if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) {
			const Item_Struct* new_weapon = inst->GetItem();
			user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true);
			container->Clear();
			user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2));
			user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name);
			if (RuleB(Inventory, DeleteTransformationMold))
				user->DeleteItemInInventory(in_combine->container_slot, 0, true);
		}
		else if (inst) {
			user->Message_StringID(4, TRANSFORM_FAILED, inst->GetItem()->Name);
		}
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
		user->QueuePacket(outapp);
		safe_delete(outapp);
		return;
	}

	if (container->GetItem() && container->GetItem()->BagType == BagTypeDetransformationmold) {
		const ItemInst* inst = container->GetItem(0);
		if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) {
			const Item_Struct* new_weapon = inst->GetItem();
			user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true);
			container->Clear();
			user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, 0, 0);
			user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name);
		}
		else if (inst) {
			user->Message_StringID(4, DETRANSFORM_FAILED, inst->GetItem()->Name);
		}
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
		user->QueuePacket(outapp);
		safe_delete(outapp);
		return;
	}

	DBTradeskillRecipe_Struct spec;
	if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) {
		user->Message_StringID(MT_Emote,TRADESKILL_NOCOMBINE);
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
		user->QueuePacket(outapp);
		safe_delete(outapp);
		return;
	}

	// Character hasn't learnt the recipe yet.
	// must_learn:
	// bit 1 (0x01): recipe can't be experimented
	// bit 2 (0x02): can try to experiment but not useable for auto-combine until learnt
	// bit 5 (0x10): no learn message, use unlisted flag to prevent it showing up on search
	// bit 6 (0x20): unlisted recipe flag
	if ((spec.must_learn&0xF) == 1 && !spec.has_learnt) {
		// Made up message for the client. Just giving a DNC is the other option.
		user->Message(4, "You need to learn how to combine these first.");
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
//.........这里部分代码省略.........
开发者ID:rencro,项目名称:Server,代码行数:101,代码来源:tradeskills.cpp


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