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


C++ NPC::SendPosUpdate方法代码示例

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


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

示例1: unique_spawn

int16 QuestManager::unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading) {
	Mob *other = entity_list.GetMobByNpcTypeID(npc_type);
	if(other != NULL) {
		return(other->GetID());
	}


	NPCType* tmp = 0;
	if ((tmp = Database::Instance()->GetNPCType(npc_type)))
	{

		NPC* npc = new NPC(tmp, 0, x, y, z, heading);


		npc->AddLootTable();
		entity_list.AddNPC(npc,true);
		// Quag: Sleep in main thread? ICK!
		// Sleep(200);
		// Quag: check is irrelevent, it's impossible for npc to be 0 here
		// (we're in main thread, nothing else can possibly modify it)
//		if(npc != 0) {
			if(grid > 0)
			{
				// HarakiriFIXME npc->AssignWaypoints(grid);
			}
			npc->SendPosUpdate();
//		}
		return(npc->GetID());
	}
	return(0);
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:31,代码来源:questmgr.cpp

示例2: CheckQuests


//.........这里部分代码省略.........
			zone->SetGuildOwned(GuildDBID());
			zone->Repop();			
				}
			}
			ps = true;
		}
#endif
		else if (strstr(command,"SPAWN_NPC") != NULL) {
				adverrorinfo = 751;
				const NPCType* tmp = 0;
				adverrorinfo = 752;
				int16 grid = atoi(sep.arg[2]);
				int8 guildwarset = atoi(sep.arg[3]);
				if ((tmp = database.GetNPCType(atoi(sep.arg[1]))))
				{
					adverrorinfo = 753;
					NPC* npc = new NPC(tmp, 0, other->GetX(), other->GetY(), other->GetZ(), heading);
					adverrorinfo = 754;
					npc->AddLootTable();
					adverrorinfo = 755;
					entity_list.AddNPC(npc,true,true);
					adverrorinfo = 756;
					Sleep(200);
					if(npc != 0)
					{
					if(grid > 0)
						npc->AssignWaypoints(grid);
					adverrorinfo = 757;
#ifdef GUILDWARS
					if(guildwarset > 0 && guildwarset == 1 && GuildDBID() > 0)
						npc->SetGuildOwner(GuildDBID());
#endif
					adverrorinfo = 758;
					npc->SendPosUpdate();
					}
			}
			ps = true;
		}
		else if (strstr(command,"LEVEL_CHECK") != NULL) 
      { 
         int8 Level1 = atoi(sep.arg[1]); 
         int8 Level2 = atoi(sep.arg[2]); 
         int8 Levelp = this->GetLevel(); 
          
         if(Level2 == 0 || Level2 == NULL){ 
            //Min Level 
            if(Level1 > Levelp) 
            { 
               //not high enough to talk too 
               break; 
            } 
         } 
         else{ 
            //Level Range 
            if(Level1 < Levelp && Level2 < Levelp) 
            { 
               //not in the req level range 
               break; 
            } 
         } 
         levelcheck = true; 
      }
		else if (strstr(command,"CUMULATIVE_FLAG") != NULL) {
			other->flag[50] = other->flag[50] + 1;
			ps = true;
		}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:67,代码来源:WesQuests.cpp

示例3: Process


//.........这里部分代码省略.........
						// Tazadar : Make the packet for the World Serv
						ServerPacket* pack = new ServerPacket(ServerOP_BoatPL, sizeof(ServerBoat_Struct));

						ServerBoat_Struct* servBoatInfos = (ServerBoat_Struct*) pack->pBuffer;

						// Tazadar : Fill the packet
						memcpy(servBoatInfos->player_name,name,sizeof(servBoatInfos->player_name));

						// Tazadar : Send the packet
						worldserver.SendPacket(pack);

					}
				}

				break;
			}
		case ServerOP_SpawnBoat: // Tazadar (06/13/09) : We make the boat spawn before the zone in at the correct location.
			{

				SpawnBoat_Struct * bs = (SpawnBoat_Struct *) pack->pBuffer; 
				
				Mob * tmp = 0;
				
				cout << "Spawning the boat :" << bs->boatname << "at loc " << bs->x <<","<< bs->y << "," << bs->z <<" heading " << bs->heading<<endl;
				//cout << "Loading boat from DB " << endl;
				string name = bs->boatname;
				name.resize(name.length()-2);
				NPCType boat;
				bool lineroute = false;
				Database::Instance()->LoadBoatData(name.c_str(),boat,lineroute);
				NPC* npc = new NPC(&boat, 0, bs->x, bs->y, bs->z, bs->heading);
				npc->SetLineRoute(lineroute);
				entity_list.AddNPC(npc);
				npc->SendPosUpdate(false);
				
				break;
			}

		case ServerOP_BoatGoTo :  // Tazadar (06/14/09) : We make the boat move
			{
				BoatGoTo_Struct * gt = (BoatGoTo_Struct *) pack->pBuffer;
				cout << "World orders " << gt->boatname << " to go to node number " << gt->toNode << endl;
				
				Mob * tmp = entity_list.GetMob(gt->boatname);
				if(tmp && tmp->IsNPC()){
					if(tmp->CastToNPC()->IsBoat()){
						tmp->CastToNPC()->setBoatDestinationNode(gt->fromNode,gt->toNode);
					}
					else{
						cerr << "Tried to give an order to the npc "<< gt->boatname <<" which is not a boat " << endl;
					}
				}
				else{
					cerr << "Error in ServerOP_BoatGoTo boat " << gt->boatname << " does not exist"<<endl;
				}

				break;
			}
		case ServerOP_DayTime : // Kibanu - 7/30/2009 : Switch to day time for spawn data
			{
				if (ZoneLoaded)
					zone->SetTimeOfDay(true);
				break;
			}
		case ServerOP_NightTime : // Kibanu - 7/30/2009 : Switch to day time for spawn data
			{
开发者ID:cavedude00,项目名称:eqmacemu,代码行数:67,代码来源:WorldServer_Process.cpp


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