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


C++ Database::GetNPCType方法代码示例

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


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

示例1: CheckQuests

void Client::CheckQuests(const char* zonename, const char * message, int32 npc_id, uint16 item_id, Mob* other)
{
	bool ps = false;
	bool tt = false;
	bool ti = false;
	bool tt2 = false;
	bool ti2 = false;
	bool stt = false;
	bool std = false;
	bool td = false;
	bool sta = false;
	bool ta = false;
	bool sti = false;
	bool stf = false;
	bool tf = false;
	bool tk = false;
	bool stk = false;
	bool levelcheck = false;
	int8 fac = GetFactionLevel(GetID(),other->GetNPCTypeID(), GetRace(), GetClass(), DEITY_AGNOSTIC, other->CastToNPC()->GetPrimaryFaction(), other);
	FILE * pFile;
  long lSize;
  char * buffer;
  char filename[255];
  #ifdef WIN32
  snprintf(filename, 254, "quests\\%i.qst", npc_id);
  #else
  snprintf(filename, 254, "quests/%i.qst", npc_id);
  #endif
  adverrorinfo = 940;
  if ((pFile=fopen(filename,"rb")))
  {
		#ifdef DEBUG
		printf("Reading quests from %s\n", filename);
		#endif
  }
  else {
		#ifdef DEBUG
		printf("Error: No quests file found for %s\n", filename);
		#endif
		return;
  }
  if (pFile==NULL) exit (1);

  // obtain file size.
  fseek (pFile , 0 , SEEK_END);
  lSize = ftell (pFile);
  rewind (pFile);

  adverrorinfo = 941;
  // allocate memory to contain the whole file.
  buffer = (char*) malloc (lSize);
  if (buffer == NULL) exit (2);

  // copy the file into the buffer.
  fread (buffer,1,lSize,pFile);
  fclose(pFile);
  Seperator3 sep3(buffer);
  for(int i=0; i < 2048; ++i)
  {
//  printf("Temp: %s\n", sep3.arghz[i]);
	char * command;
	char * temp;
	temp = sep3.arghz[i];
	if (temp == NULL) return;
	Seperator sep(temp);
	Seperator4 sep4(temp);
	command = sep4.arghza[0];
	command = strupr(command);
#ifdef DEBUG
	cout<<sep.argplus[0]<<endl;
#endif
	if (!IsCommented(temp))
	{
	if (strstr(command,"END_FILE") != NULL || command == NULL)
	{
		break;
	}
	if (ti2 || tt2 || tf || td || ta) {
		char lvl[5];
		sprintf(lvl, "%i", this->GetLevel());
		strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARRACE%", GetRaceName(this->GetRace())));
		strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARLEVEL%", lvl));
		strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARCLASS%", GetEQClassName(this->GetClass(), 50)));
		char * nmessage = strreplace(sep4.arghza[1],"%CHARNAME%", this->GetName());
		nmessage[strlen(nmessage) - 1] = '\0';
		if (ti2 || tt2 || ta)
		{
			other->CastToNPC()->FaceTarget(this, true);
		}
		if ((fac == 7 || fac == 6) && (ti2 || tt2))
		{
			entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName());
			break;
		}
		else if (strstr(command,"FACTION_CHECK") != NULL) {
			int8 fac2 = atoi(sep.arg[1]);
			if ((fac2 <= 5 && fac > fac2) || (fac2 == 6 && fac == 8))
			{
				entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName());
				break;
//.........这里部分代码省略.........
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:101,代码来源:WesQuests.cpp


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