本文整理汇总了C++中AddWaypoint函数的典型用法代码示例。如果您正苦于以下问题:C++ AddWaypoint函数的具体用法?C++ AddWaypoint怎么用?C++ AddWaypoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddWaypoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartEvent
void StartEvent(Player* pPlayer)
{
if (!pPlayer)
return;
if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i = 0; i < 41; ++i)
{
AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]);
}
PlayerGUID = pPlayer->GetGUID();
Start(true,false,PlayerGUID);
}
return;
}
示例2: StartEvent
void StartEvent(Player* player)
{
if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i = 0; i < 41; ++i)
{
AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]);
}
PlayerGUID = player->GetGUID();
Start(true, false, PlayerGUID);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
return;
}
示例3: DofNaralexAI
explicit DofNaralexAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
Mutanus = nullptr;
for (uint8 i = 1; i < 39; ++i)
{
AddWaypoint(CreateWaypoint(i, 0, Movement::WP_MOVE_TYPE_RUN, ToNaralex[i]));
}
SetWaypointMoveType(Movement::WP_MOVEMENT_SCRIPT_NONE);
// Awakening Spell
Awakening = addAISpell(6271, 0.0f, TARGET_SELF);
Awakening->addEmote("Step back and be ready!, I'll try to Awake Naralex", CHAT_MSG_MONSTER_SAY, 0);
SpawnTimer = 0;
}
示例4: TiXmlElement
GpxRootElement::GpxRootElement(const wxString &creator, GpxMetadataElement *metadata, ListOfGpxWpts *waypoints, ListOfGpxRoutes *routes, ListOfGpxTracks *tracks, GpxExtensionsElement *extensions) : TiXmlElement("gpx")
{
my_extensions = NULL;
my_metadata = NULL;
first_waypoint = NULL;
last_waypoint = NULL;
first_route = NULL;
last_route = NULL;
first_track = NULL;
last_track = NULL;
SetAttribute ( "version", "1.1" );
SetAttribute ( "creator", creator.ToUTF8() );
SetAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
SetAttribute( "xmlns", "http://www.topografix.com/GPX/1/1" );
SetAttribute( "xmlns:gpxx", "http://www.garmin.com/xmlschemas/GpxExtensions/v3" );
SetAttribute( "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" );
SetMetadata(metadata);
if (waypoints) {
wxListOfGpxWptsNode *waypoint = waypoints->GetFirst();
while (waypoint)
{
AddWaypoint(waypoint->GetData());
waypoint = waypoint->GetNext();
}
}
if (routes) {
wxListOfGpxRoutesNode *route = routes->GetFirst();
while (route)
{
AddRoute(route->GetData());
route = route->GetNext();
}
}
if (tracks) {
wxListOfGpxTracksNode *track = tracks->GetFirst();
while (track)
{
AddTrack(track->GetData());
track = track->GetNext();
}
}
SetExtensions(extensions);
}
示例5: The_Plains_Vision
The_Plains_Vision(Creature* pCreature) : MoonScriptCreatureAI(pCreature)
{
auto area = _unit->GetArea();
switch (area->id)
{
case 222: // Mulgore
{
WPCount = 23;
WayPoints = WaypointPlainVision;
_unit->GetAIInterface()->SetAllowedToEnterCombat(false);
}
break;
}
for (int i = 1; i <= WPCount; ++i)
{
AddWaypoint(CreateWaypoint(i, 0, WayPoints[i].addition, WayPoints[i]));
}
}
示例6: FindOrAddWaypoint
int FindOrAddWaypoint(WAYPOINT *read_waypoint, bool look_for_airfield) {
read_waypoint->Name[NAME_SIZE-1] = 0; // prevent overrun if data is bogus
int waypoint_index=-1;
// Search for waypoint having same name AND same lat/lon/flags.
// If we are searching for airfield, search for waypoint having same name and
// lat/lon within 1km , and having flags set as airfieldsolid or grass.
// We dont look at anything else for matching.
if (look_for_airfield)
waypoint_index = FindMatchingAirfield(read_waypoint);
else
waypoint_index = FindMatchingWaypoint(read_waypoint);
if (waypoint_index == -1) { // waypoint not found, so add it!
WAYPOINT new_waypoint = {};
//
// Note: we dont save task waypoints inside WP files!
// SO WE DONT NEED TO USE COMMENTS and DETAILS. They are useless.
//
memcpy(&new_waypoint, read_waypoint, sizeof(WAYPOINT));
// this is needed for avoid freeing twice ...
// ownership of allocated memory is transferred from "read_waypoint" to "new_waypoint"
read_waypoint->Comment = NULL;
#if TASK_DETAILS
read_waypoint->Details = NULL;
#else
new_waypoint.Details = NULL;
#endif
new_waypoint.FileNum=-1; // HERE WE SET THE FLAG FOR "DO NOT SAVE TO WAYPOINT FILE"
if(AddWaypoint(new_waypoint)) {
waypoint_index = WayPointList.size() -1;
}
}
return waypoint_index;
}
示例7: UpdateAI
void UpdateAI(uint32 diff)
{
if (instance && instance->GetData(DATA_MAIN_EVENT_PHASE) != IN_PROGRESS)
me->CastStop();
npc_escortAI::UpdateAI(diff);
if (!bHasGotMovingPoints)
{
bHasGotMovingPoints = true;
switch (uiBoss)
{
case 1:
for (int i=0;i<3;i++)
AddWaypoint(i, SaboteurFinalPos1[i][0], SaboteurFinalPos1[i][1], SaboteurFinalPos1[i][2], 0);
me->SetHomePosition(SaboteurFinalPos1[2][0], SaboteurFinalPos1[2][1], SaboteurFinalPos1[2][2], 4.762346f);
break;
case 2:
for (int i=0;i<3;i++)
AddWaypoint(i, SaboteurFinalPos2[i][0], SaboteurFinalPos2[i][1], SaboteurFinalPos2[i][2], 0);
me->SetHomePosition(SaboteurFinalPos2[2][0], SaboteurFinalPos2[2][1], SaboteurFinalPos2[2][2], 1.862674f);
break;
case 3:
for (int i=0;i<2;i++)
AddWaypoint(i, SaboteurFinalPos3[i][0], SaboteurFinalPos3[i][1], SaboteurFinalPos3[i][2], 0);
me->SetHomePosition(SaboteurFinalPos3[1][0], SaboteurFinalPos3[1][1], SaboteurFinalPos3[1][2], 5.500638f);
break;
case 4:
AddWaypoint(0, SaboteurFinalPos4[0], SaboteurFinalPos4[1], SaboteurFinalPos4[2], 0);
me->SetHomePosition(SaboteurFinalPos4[0], SaboteurFinalPos4[1], SaboteurFinalPos4[2], 3.991108f);
break;
case 5:
AddWaypoint(0, SaboteurFinalPos5[0], SaboteurFinalPos5[1], SaboteurFinalPos5[2], 0);
me->SetHomePosition(SaboteurFinalPos5[0], SaboteurFinalPos5[1], SaboteurFinalPos5[2], 1.100841f);
break;
case 6:
for (int i=0;i<5;i++)
AddWaypoint(i, SaboteurFinalPos6[i][0], SaboteurFinalPos6[i][1], SaboteurFinalPos6[i][2], 0);
me->SetHomePosition(SaboteurFinalPos6[4][0], SaboteurFinalPos6[4][1], SaboteurFinalPos6[4][2], 0.983031f);
break;
}
SetDespawnAtEnd(false);
Start(true, true);
}
}
示例8: SetData
void SetData(uint32 uiType, uint32 uiData)
{
switch(uiType)
{
case 1:
AddWaypoint(0, 746.45f, 647.03f, 411.57f);
AddWaypoint(1, 771.434f, 642.606f, 411.9f);
AddWaypoint(2, 779.807f, 617.535f, 411.716f);
AddWaypoint(3, 771.098f, 594.635f, 411.625f);
AddWaypoint(4, 746.887f, 583.425f, 411.668f);
AddWaypoint(5, 715.176f, 583.782f, 412.394f);
AddWaypoint(6, 720.719f, 591.141f, 411.737f);
uiWaypointPath = 1;
break;
case 2:
AddWaypoint(0, 746.45f, 647.03f, 411.57f);
AddWaypoint(1, 771.434f, 642.606f, 411.9f);
AddWaypoint(2, 779.807f, 617.535f, 411.716f);
AddWaypoint(3, 771.098f, 594.635f, 411.625f);
AddWaypoint(4, 746.887f, 583.425f, 411.668f);
AddWaypoint(5, 746.16f, 571.678f, 412.389f);
AddWaypoint(6, 746.887f, 583.425f, 411.668f);
uiWaypointPath = 2;
break;
case 3:
AddWaypoint(0, 746.45f, 647.03f, 411.57f);
AddWaypoint(1, 771.434f, 642.606f, 411.9f);
AddWaypoint(2, 779.807f, 617.535f, 411.716f);
AddWaypoint(3, 771.098f, 594.635f, 411.625f);
AddWaypoint(4, 777.759f, 584.577f, 412.393f);
AddWaypoint(5, 772.48f, 592.99f, 411.68f);
uiWaypointPath = 3;
break;
}
if (uiType <= 3)
Start(false, true, 0, NULL);
}
示例9: StartEscort
void StartEscort (Player* player, uint8 Parts)
{
Part = Parts;
switch (Parts)
{
case 1:
AddWaypoint(0, 2230.91, 118.765, 82.2947, 2000),
AddWaypoint(1, 2230.33, 114.980, 82.2946, 0);
AddWaypoint(2, 2233.36, 111.057, 82.2996, 0);
AddWaypoint(3, 2231.17, 108.486, 82.6624, 0);
AddWaypoint(4, 2220.22, 114.605, 89.4264, 0);
AddWaypoint(5, 2215.23, 115.990, 89.4549, 0);
AddWaypoint(6, 2207.97, 105.351, 89.4549, 0);
AddWaypoint(7, 2202.53, 106.922, 89.4549, 0);
AddWaypoint(8, 2192.26, 112.618, 89.4549, 2000);
AddWaypoint(9, 2182.96, 117.850, 89.4548, 2000);
AddWaypoint(10, 2182.11, 120.328, 89.4548, 5000);
AddWaypoint(11, 2182.11, 120.329, 89.4548, 5000);
AddWaypoint(12, 2182.11, 120.330, 89.4548, 3000);
AddWaypoint(13, 2189.44, 113.922, 89.4549, 0);
AddWaypoint(14, 2195.63, 110.584, 89.4549, 0);
AddWaypoint(15, 2201.09, 115.115, 89.4549, 0);
AddWaypoint(16, 2204.34, 121.036, 89.4355, 0);
AddWaypoint(17, 2208.66, 129.127, 87.9560, 0);
AddWaypoint(18, 2193.09, 137.940, 88.2164, 0);
AddWaypoint(19, 2173.39, 149.064, 87.9227, 0);
AddWaypoint(20, 2164.25, 137.965, 85.0595, 0);
AddWaypoint(21, 2149.31, 125.645, 77.0858, 0);
AddWaypoint(22, 2142.78, 127.173, 75.5954, 0);
AddWaypoint(23, 2139.28, 133.952, 73.6386, 0);
AddWaypoint(24, 2139.54, 155.235, 67.1269, 0);
AddWaypoint(25, 2145.38, 167.551, 64.8974, 0);
AddWaypoint(26, 2134.28, 175.304, 67.9446, 0);
AddWaypoint(27, 2118.08, 187.387, 68.8141, 0);
AddWaypoint(28, 2105.88, 195.461, 65.1854, 0);
AddWaypoint(29, 2096.77, 196.939, 65.2117, 0);
AddWaypoint(30, 2083.90, 209.395, 64.8736, 0);
AddWaypoint(31, 2063.40, 229.509, 64.4883, 25000);
AddWaypoint(32, 2063.40, 229.510, 64.4883, 0);
AddWaypoint(33, 2063.40, 229.512, 64.4883, 0);
((npc_escortAI*)(me->AI()))->SetClearWaypoints(true);
((npc_escortAI*)(me->AI()))->SetDespawnAtEnd(false);
((npc_escortAI*)(me->AI()))->SetDespawnAtFar(false);
Start(true, true, player->GetGUID());
break;
case 2:
AddWaypoint(0, 2046.70, 251.941, 62.7851, 4000);
AddWaypoint(1, 2046.70, 251.942, 62.7851, 3000);
AddWaypoint(2, 2011.77, 278.478, 65.3388, 0);
AddWaypoint(3, 2005.08, 289.676, 66.1179, 0);
AddWaypoint(4, 2033.11, 337.450, 66.0948, 0);
AddWaypoint(5, 2070.30, 416.208, 66.0893, 0);
AddWaypoint(6, 2086.76, 469.768, 65.9182, 0);
AddWaypoint(7, 2101.70, 497.955, 61.7881, 0);
AddWaypoint(8, 2133.39, 530.933, 55.3700, 0);
AddWaypoint(9, 2157.91, 559.635, 48.5157, 0);
AddWaypoint(10, 2167.34, 586.191, 42.4394, 0);
AddWaypoint(11, 2174.17, 637.643, 33.9002, 0);
AddWaypoint(12, 2179.31, 656.053, 34.723, 0);
AddWaypoint(13, 2183.65, 670.941, 34.0318, 0);
AddWaypoint(14, 2201.50, 668.616, 36.1236, 0);
AddWaypoint(15, 2221.56, 652.747, 36.6153, 0);
AddWaypoint(16, 2238.97, 640.125, 37.2214, 0);
AddWaypoint(17, 2251.17, 620.574, 40.1473, 0);
AddWaypoint(18, 2261.98, 595.303, 41.4117, 0);
AddWaypoint(19, 2278.67, 560.172, 38.9090, 0);
AddWaypoint(20, 2336.72, 528.327, 40.9369, 0);
AddWaypoint(21, 2381.04, 519.612, 37.7312, 0);
AddWaypoint(22, 2412.20, 515.425, 39.2068, 0);
AddWaypoint(23, 2452.39, 516.174, 42.9387, 0);
AddWaypoint(24, 2467.38, 539.389, 47.4992, 0);
AddWaypoint(25, 2470.70, 554.333, 46.6668, 0);
AddWaypoint(26, 2478.07, 575.321, 55.4549, 0);
AddWaypoint(27, 2480.00, 585.408, 56.6921, 0);
AddWaypoint(28, 2482.67, 608.817, 55.6643, 0);
AddWaypoint(29, 2485.62, 626.061, 58.0132, 2000);
AddWaypoint(30, 2486.91, 626.356, 58.0761, 2000);
AddWaypoint(31, 2486.91, 626.357, 58.0761, 0);
((npc_escortAI*)(me->AI()))->SetClearWaypoints(true);
((npc_escortAI*)(me->AI()))->SetDespawnAtEnd(false);
((npc_escortAI*)(me->AI()))->SetDespawnAtFar(false);
Start(true, false, player->GetGUID());
break;
case 3:
AddWaypoint(0, 2488.58, 660.940, 57.3913, 0);
AddWaypoint(1, 2502.56, 686.059, 55.6252, 0);
AddWaypoint(2, 2502.08, 694.360, 55.5083, 0);
AddWaypoint(3, 2491.46, 694.321, 55.7163, 0);
AddWaypoint(4, 2491.10, 703.300, 55.7630, 0);
AddWaypoint(5, 2485.64, 702.992, 55.7917, 0);
AddWaypoint(6, 2479.63, 696.521, 55.7901, 0);
AddWaypoint(7, 2476.24, 696.204, 55.8093, 0);
AddWaypoint(8, 2475.39, 695.983, 55.8146, 0);
AddWaypoint(9, 2477.75, 694.473, 55.7945, 0);
AddWaypoint(10, 2481.27, 697.747, 55.7910, 0);
AddWaypoint(11, 2486.31, 703.131, 55.7861, 0);
AddWaypoint(12, 2490.76, 703.511, 55.7662, 0);
AddWaypoint(13, 2491.30, 694.792, 55.7195, 0);
AddWaypoint(14, 2502.08, 694.360, 55.5083, 0);
//.........这里部分代码省略.........
示例10: InitWaypoint
void InitWaypoint()
{
AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000);
AddWaypoint(2, 2341.812012, -5900.484863, 102.619743);
AddWaypoint(3, 2306.561279, -5901.738281, 91.792419);
AddWaypoint(4, 2300.098389, -5912.618652, 86.014885);
AddWaypoint(5, 2294.142090, -5927.274414, 75.316849);
AddWaypoint(6, 2286.984375, -5944.955566, 63.714966);
AddWaypoint(7, 2280.001709, -5961.186035, 54.228283);
AddWaypoint(8, 2259.389648, -5974.197754, 42.359348);
AddWaypoint(9, 2242.882812, -5984.642578, 32.827850);
AddWaypoint(10, 2217.265625, -6028.959473, 7.675705);
AddWaypoint(11, 2202.595947, -6061.325684, 5.882018);
AddWaypoint(12, 2188.974609, -6080.866699, 3.370027);
if (urand(0,1))
{
AddWaypoint(13, 2176.483887, -6110.407227, 1.855181);
AddWaypoint(14, 2172.516602, -6146.752441, 1.074235);
AddWaypoint(15, 2138.918457, -6158.920898, 1.342926);
AddWaypoint(16, 2129.866699, -6174.107910, 4.380779);
AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000);
}
else
{
AddWaypoint(13, 2184.190186, -6166.447266, 0.968877);
AddWaypoint(14, 2234.265625, -6163.741211, 0.916021);
AddWaypoint(15, 2268.071777, -6158.750977, 1.822252);
AddWaypoint(16, 2270.028320, -6176.505859, 6.340538);
AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000);
}
}
示例11: WP_command
void WP_command( int argc )
{
char cmd_command[1024];
if( argc < 3)
return;
trap_CmdArgv( 2, cmd_command, sizeof( cmd_command ) );
if(!strcmp(cmd_command, "add"))
{
waypoint_t wp;
if( argc < 7 )
return;
memset(&wp, 0 ,sizeof(wp));
trap_CmdArgv( 3, cmd_command, sizeof( cmd_command ) );
wp.index = atoi( cmd_command );
trap_CmdArgv( 4, cmd_command, sizeof( cmd_command ) );
wp.origin[0] = atof( cmd_command );
trap_CmdArgv( 5, cmd_command, sizeof( cmd_command ) );
wp.origin[1] = atof( cmd_command );
trap_CmdArgv( 6, cmd_command, sizeof( cmd_command ) );
wp.origin[2] = atof( cmd_command );
wp.teams = 15 ;// (1<<0)+(1<<1)+(1<<2)+(1<<3);
if( argc > 7 )
{
trap_CmdArgv( 7, cmd_command, sizeof( cmd_command ) );
wp.flags = atoi( cmd_command );
}
if( argc > 8 )
{
trap_CmdArgv( 8, cmd_command, sizeof( cmd_command ) );
wp.teams = atoi( cmd_command );
}
if( argc > 9 )
{
trap_CmdArgv( 9, cmd_command, sizeof( cmd_command ) );
wp.radius = atof( cmd_command );
}
AddWaypoint(&wp);
return;
}
if(!strcmp(cmd_command, "link"))
{
wp_link_t link;
int i1,i2;
if( argc < 5 )
return;
memset(&link, 0 ,sizeof(link));
trap_CmdArgv( 3, cmd_command, sizeof( cmd_command ) );
i1 = atoi( cmd_command );
trap_CmdArgv( 4, cmd_command, sizeof( cmd_command ) );
i2 = atoi( cmd_command );
link.teams = 15;
if( argc > 5 )
{
trap_CmdArgv( 5, cmd_command, sizeof( cmd_command ) );
link.flags = atoi( cmd_command );
}
if( argc > 6 )
{
trap_CmdArgv( 6, cmd_command, sizeof( cmd_command ) );
link.teams = atoi( cmd_command );
}
if( argc > 7 )
{
trap_CmdArgv( 7, cmd_command, sizeof( cmd_command ) );
link.req_velocity = atof( cmd_command );
}
AddLink( i1, i2, &link);
return;
}
if(!strcmp(cmd_command, "dlink"))
{
wp_link_t link;
int i1,i2;
if( argc < 5 )
return;
memset(&link, 0 ,sizeof(link));
trap_CmdArgv( 3, cmd_command, sizeof( cmd_command ) );
i1 = atoi( cmd_command );
trap_CmdArgv( 4, cmd_command, sizeof( cmd_command ) );
i2 = atoi( cmd_command );
link.teams = 15;
if( argc > 5 )
{
trap_CmdArgv( 5, cmd_command, sizeof( cmd_command ) );
link.flags = atoi( cmd_command );
}
if( argc > 6 )
//.........这里部分代码省略.........
示例12: Visit
void
Visit(const Waypoint& way_point)
{
AddWaypoint(way_point, false);
}
示例13: UpdateAI
void UpdateAI(const uint32 diff)
{
if (IsEvent)
{
//Must update npc_escortAI
npc_escortAI::UpdateAI(diff);
if(!go)
{
go = true;
if(pInstance)
{
AddWaypoint(0, 5492.91, -2404.61, 1462.63);
AddWaypoint(1, 5531.76, -2460.87, 1469.55);
AddWaypoint(2, 5554.58, -2514.66, 1476.12);
AddWaypoint(3, 5554.16, -2567.23, 1479.90);
AddWaypoint(4, 5540.67, -2625.99, 1480.89);
AddWaypoint(5, 5508.16, -2659.2, 1480.15);
AddWaypoint(6, 5489.62, -2704.05, 1482.18);
AddWaypoint(7, 5457.04, -2726.26, 1485.10);
Start(false, true);
SetDespawnAtEnd(false);
}
}
}
//Return since we have no target
if (!UpdateVictim() )
return;
if(CheckTimer < diff)
{
DoZoneInCombat();
m_creature->SetSpeed(MOVE_RUN, 3.0);
CheckTimer = 3000;
}
else
CheckTimer -= diff;
if(CleaveTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
CleaveTimer = urand(6000, 21000);
}
else
CleaveTimer -= diff;
if(WarStompTimer < diff)
{
DoCast(m_creature, SPELL_WARSTOMP);
WarStompTimer = urand(15000, 25000);
}
else
WarStompTimer -= diff;
if(CrippleTimer < diff)
{
if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 1, 20, true))
DoCast(target, SPELL_CRIPPLE);
CrippleTimer = urand(10000, 12000);
}
else
CrippleTimer -= diff;
if(MarkTimer < diff)
{
m_creature->CastSpell(m_creature, SPELL_MARK, false);
MarkTimerBase -= 5000;
if(MarkTimerBase <= 5500)
MarkTimerBase = 10500;
MarkTimer = MarkTimerBase;
switch(rand()%3)
{
case 0:
DoPlaySoundToSet(m_creature, SOUND_MARK1);
DoYell(SAY_MARK1, LANG_UNIVERSAL, NULL);
break;
case 1:
DoPlaySoundToSet(m_creature, SOUND_MARK2);
DoYell(SAY_MARK2, LANG_UNIVERSAL, NULL);
break;
}
}
else
MarkTimer -= diff;
DoMeleeAttackIfReady();
}
示例14: WriteWithChecksum
bool
EWDevice::DeclareInner(const struct Declaration &declaration,
OperationEnvironment &env)
{
char sTmp[72];
ewDecelTpIndex = 0;
if (!TryConnect(env))
return false;
// send SetPilotInfo
WriteWithChecksum(port, "#SPI");
env.Sleep(50);
char sPilot[13], sGliderType[9], sGliderID[9];
convert_string(sPilot, sizeof(sPilot), declaration.pilot_name);
convert_string(sGliderType, sizeof(sGliderType), declaration.aircraft_type);
convert_string(sGliderID, sizeof(sGliderID), declaration.aircraft_registration);
// build string (field 4-5 are GPS info, no idea what to write)
sprintf(sTmp, "%-12s%-8s%-8s%-12s%-12s%-6s\r", sPilot, sGliderType, sGliderID,
"" /* GPS Model */, "" /* GPS Serial No. */, "" /* Flight Date */
/* format unknown, left blank (GPS has a RTC) */);
port.Write(sTmp);
if (!port.ExpectString("OK\r", env))
return false;
/*
sprintf(sTmp, "#SUI%02d", 0); // send pilot name
WriteWithChecksum(port, sTmp);
env.Sleep(50);
port.Write(PilotsName);
port.Write('\r');
if (!port.ExpectString("OK\r"))
return false;
sprintf(sTmp, "#SUI%02d", 1); // send type of aircraft
WriteWithChecksum(port, sTmp);
env.Sleep(50);
port.Write(Class);
port.Write('\r');
if (!port.ExpectString("OK\r"))
nDeclErrorCode = 1;
sprintf(sTmp, "#SUI%02d", 2); // send aircraft ID
WriteWithChecksum(port, sTmp);
env.Sleep(50);
port.Write(ID);
port.Write('\r');
if (!port.ExpectString("OK\r"))
return false;
*/
// clear all 6 TP's
for (int i = 0; i < 6; i++) {
sprintf(sTmp, "#CTP%02d", i);
WriteWithChecksum(port, sTmp);
if (!port.ExpectString("OK\r", env))
return false;
}
for (unsigned j = 0; j < declaration.Size(); ++j)
if (!AddWaypoint(declaration.GetWaypoint(j), env))
return false;
return true;
}
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
if (IsEvent)
{
//Must update npc_escortAI
npc_escortAI::UpdateAI(diff);
if (!go)
{
go = true;
if (instance)
{
AddWaypoint(0, 5492.91f, -2404.61f, 1462.63f);
AddWaypoint(1, 5531.76f, -2460.87f, 1469.55f);
AddWaypoint(2, 5554.58f, -2514.66f, 1476.12f);
AddWaypoint(3, 5554.16f, -2567.23f, 1479.90f);
AddWaypoint(4, 5540.67f, -2625.99f, 1480.89f);
AddWaypoint(5, 5508.16f, -2659.2f, 1480.15f);
AddWaypoint(6, 5489.62f, -2704.05f, 1482.18f);
AddWaypoint(7, 5457.04f, -2726.26f, 1485.10f);
Start(false, true);
SetDespawnAtEnd(false);
}
}
}
//Return since we have no target
if (!UpdateVictim())
return;
if (CleaveTimer <= diff)
{
DoCast(me, SPELL_CLEAVE);
CleaveTimer = 6000+rand()%15000;
} else CleaveTimer -= diff;
if (WarStompTimer <= diff)
{
DoCast(me, SPELL_WARSTOMP);
WarStompTimer = 60000;
} else WarStompTimer -= diff;
if (MarkTimer <= diff)
{
DoCastAOE(SPELL_MARK);
MarkTimerBase -= 5000;
if (MarkTimerBase < 5500)
MarkTimerBase = 5500;
MarkTimer = MarkTimerBase;
switch (urand(0, 2))
{
case 0:
DoPlaySoundToSet(me, SOUND_MARK1);
me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, 0);
break;
case 1:
DoPlaySoundToSet(me, SOUND_MARK2);
me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, 0);
break;
}
} else MarkTimer -= diff;
DoMeleeAttackIfReady();
}