本文整理汇总了C++中QuestInterface::LoadItemScript方法的典型用法代码示例。如果您正苦于以下问题:C++ QuestInterface::LoadItemScript方法的具体用法?C++ QuestInterface::LoadItemScript怎么用?C++ QuestInterface::LoadItemScript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuestInterface
的用法示例。
在下文中一共展示了QuestInterface::LoadItemScript方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ItemHasQuestSub
bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
std::string item_script;
if(itm->GetItem()->ScriptFileID != 0) {
item_script = "script_";
item_script += std::to_string(static_cast<long long>(itm->GetItem()->ScriptFileID));
} else if(strlen(itm->GetItem()->CharmFile) > 0) {
item_script = itm->GetItem()->CharmFile;
} else {
item_script = std::to_string(static_cast<long long>(itm->GetID()));
}
uint32 item_id = itm->GetID();
std::map<uint32, uint32>::iterator iter = _item_quest_status.find(item_id);
if(iter != _item_quest_status.end()) {
//loaded or failed to load
if(iter->second != QuestFailedToLoad) {
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
return qiter->second->ItemHasQuestSub(itm, evt);
}
} else {
std::string filename;
QuestInterface *qi = GetQIByItemQuest(item_script, filename);
if(qi) {
_item_quest_status[item_id] = qi->GetIdentifier();
qi->LoadItemScript(filename, itm);
return qi->ItemHasQuestSub(itm, evt);
} else {
_item_quest_status[item_id] = QuestFailedToLoad;
}
}
return false;
}
示例2: EventItem
int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data,
std::vector<EQEmu::Any> *extra_pointers) {
// needs pointer validation check on 'item' argument
std::string item_script;
if(item->GetItem()->ScriptFileID != 0) {
item_script = "script_";
item_script += std::to_string(item->GetItem()->ScriptFileID);
} else if(strlen(item->GetItem()->CharmFile) > 0) {
item_script = item->GetItem()->CharmFile;
} else {
item_script = std::to_string(item->GetID());
}
uint32 item_id = item->GetID();
std::map<uint32, uint32>::iterator iter = _item_quest_status.find(item_id);
if(iter != _item_quest_status.end()) {
//loaded or failed to load
if(iter->second != QuestFailedToLoad) {
std::map<uint32, QuestInterface*>::iterator qiter = _interfaces.find(iter->second);
int ret = DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
int i = qiter->second->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
if(i != 0) {
ret = i;
}
return ret;
}
return DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
} else {
std::string filename;
QuestInterface *qi = GetQIByItemQuest(item_script, filename);
if(qi) {
_item_quest_status[item_id] = qi->GetIdentifier();
qi->LoadItemScript(filename, item);
int ret = DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
int i = qi->EventItem(evt, client, item, mob, data, extra_data, extra_pointers);
if(i != 0) {
ret = i;
}
return ret;
} else {
_item_quest_status[item_id] = QuestFailedToLoad;
return DispatchEventItem(evt, client, item, mob, data, extra_data, extra_pointers);
}
}
return 0;
}