Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. //----- (000000000077CE20) ----------------------------------------------------
  3. char __fastcall CMoveToTargetAction::SetMoving(CMoveToTargetAction *this)
  4. {
  5.   __int64 ThreadID; // rbx
  6.   __int64 m_nID; // rdi
  7.   CCreature *Shuttle; // rsi
  8.   CWorldObject *WorldObject; // rax
  9.   CWorldObject *v6; // r15
  10.   char v7; // r13
  11.   __m128d v8; // xmm6
  12.   CWorld *v9; // rbx
  13.   unsigned int v10; // edi
  14.   CGeoData *v11; // rax
  15.   int m_nDistance; // ebx
  16.   CCreatureController *v13; // rax
  17.   const FVector *TargetDestination; // rax
  18.   char v15; // di
  19.   int *v16; // r13
  20.   FVector *v17; // r12
  21.   FVector *v18; // rax
  22.   unsigned int nInstantZoneID; // ebx
  23.   double v20; // xmm0_8
  24.   char v21; // al
  25.   int *v22; // rax
  26.   bool v23; // zf
  27.   CCreature_vtbl *v24; // rax
  28.   CCreatureController *v25; // rax
  29.   FVector *v26; // rdx
  30.   int v27; // ebx
  31.   CCreatureController *v28; // rax
  32.   long double v29; // xmm2_8
  33.   long double v30; // xmm1_8
  34.   FVector *p_v; // rdx
  35.   CCreatureController *v32; // rax
  36.   long double v33; // xmm2_8
  37.   long double v34; // xmm1_8
  38.   FVector *v35; // rdx
  39.   __int64 m_nTick; // rdx
  40.   __m128d v37; // xmm6
  41.   long double v38; // xmm0_8
  42.   CWorld *v39; // rax
  43.   int z; // ebx
  44.   CGeoData *v41; // rax
  45.   int Ground; // eax
  46.   int v43; // ebx
  47.   CCreatureController *v44; // rax
  48.   CCreatureController *v45; // rax
  49.   FVector *v46; // r12
  50.   FVector *v47; // rax
  51.   double v48; // xmm0_8
  52.   unsigned __int32 v49; // ebx
  53.   int *v50; // rcx
  54.   CCreature_vtbl *v51; // rax
  55.   CCreatureController *v52; // rax
  56.   FVector *v53; // rdx
  57.   int v54; // ebx
  58.   CCreatureController *v55; // rax
  59.   CCreatureController *v56; // rax
  60.   long double v57; // xmm2_8
  61.   long double v58; // xmm1_8
  62.   CWorldObject_vtbl *v59; // rax
  63.   CCreature *v60; // rax
  64.   FVector *PassingPosOnSight; // rax
  65.   PathFindResult v62; // eax
  66.   FVector *v63; // rbx
  67.   FVector *v64; // rax
  68.   CSharedCreatureData *m_data; // rax
  69.   _BOOL8 v66; // rdx
  70.   CCreature *v67; // rbx
  71.   int *p_m_nTick; // r12
  72.   FVector *p_m_vMidDest; // r15
  73.   FVector *v70; // rax
  74.   unsigned int v71; // ebx
  75.   double v72; // xmm0_8
  76.   int *v73; // rcx
  77.   int *v74; // rax
  78.   CCreatureController *v75; // rcx
  79.   FVector *p_result; // r8
  80.   long double v77; // xmm2_8
  81.   long double v78; // xmm1_8
  82.   int v79; // ebx
  83.   CCreatureController *v80; // rax
  84.   FVector vFrom; // [rsp+50h] [rbp-B0h] BYREF
  85.   FVector result; // [rsp+68h] [rbp-98h] BYREF
  86.   FAngle a[2]; // [rsp+80h] [rbp-80h] BYREF
  87.   FAngle v85; // [rsp+88h] [rbp-78h] BYREF
  88.   FAngle v86[2]; // [rsp+90h] [rbp-70h] BYREF
  89.   FVector v87; // [rsp+98h] [rbp-68h] BYREF
  90.   int v88; // [rsp+D4h] [rbp-2Ch] BYREF
  91.   __int64 v89; // [rsp+E0h] [rbp-20h]
  92.   __int128 v90; // [rsp+E8h] [rbp-18h]
  93.   FVector v91; // [rsp+F8h] [rbp-8h] BYREF
  94.   int v92; // [rsp+114h] [rbp+14h] BYREF
  95.   __int64 v93; // [rsp+120h] [rbp+20h]
  96.   __int128 v94; // [rsp+128h] [rbp+28h]
  97.   FVector v95; // [rsp+138h] [rbp+38h] BYREF
  98.   FVector v; // [rsp+150h] [rbp+50h] BYREF
  99.   FVector v97; // [rsp+168h] [rbp+68h] BYREF
  100.   FVector v98; // [rsp+180h] [rbp+80h] BYREF
  101.   FVector v99; // [rsp+198h] [rbp+98h] BYREF
  102.   __int64 v100[3]; // [rsp+1B0h] [rbp+B0h] BYREF
  103.   __int64 v101[3]; // [rsp+1C8h] [rbp+C8h] BYREF
  104.   FVector v102; // [rsp+1E0h] [rbp+E0h] BYREF
  105.   __int64 v103; // [rsp+1F8h] [rbp+F8h]
  106.   JOB *v104; // [rsp+200h] [rbp+100h]
  107.   FVector v105; // [rsp+208h] [rbp+108h] BYREF
  108.   FVector v106; // [rsp+220h] [rbp+120h] BYREF
  109.   FVector v107; // [rsp+238h] [rbp+138h] BYREF
  110.   FVector v108; // [rsp+250h] [rbp+150h] BYREF
  111.   FVector v109; // [rsp+268h] [rbp+168h] BYREF
  112.   FVector v110; // [rsp+280h] [rbp+180h] BYREF
  113.   FVector v111; // [rsp+298h] [rbp+198h] BYREF
  114.   FVector v112; // [rsp+2B0h] [rbp+1B0h] BYREF
  115.   FVector v113; // [rsp+2C8h] [rbp+1C8h] BYREF
  116.   FVector v114; // [rsp+2E0h] [rbp+1E0h] BYREF
  117.   int v115; // [rsp+300h] [rbp+200h]
  118.   char v116[2048]; // [rsp+308h] [rbp+208h] BYREF
  119.   int v117; // [rsp+B10h] [rbp+A10h]
  120.   char v118[2048]; // [rsp+B18h] [rbp+A18h] BYREF
  121.   bool v119; // [rsp+1398h] [rbp+1298h] BYREF
  122.   PathFindResult r; // [rsp+13A0h] [rbp+12A0h] BYREF
  123.   int v121; // [rsp+13A8h] [rbp+12A8h] BYREF
  124.  
  125.   v103 = -2i64;
  126.   v104 = &JOB_NEWACTION__MOVETOTARGET_SETMOVING;
  127.   ThreadID = (int)CThreadManager::GetThreadID();
  128.   m_nID = JOB_NEWACTION__MOVETOTARGET_SETMOVING.m_nID;
  129.   g_Timer.m_EachJobBeginTimes[ThreadID]._Mypair._Myval2._Myfirst[m_nID] = GetTickCount();
  130.   Shuttle = (CCreature *)CSmartID::GetShuttle((__crt_locale_data *)&this->m_spActor);
  131.   WorldObject = CSmartID::GetWorldObject(&this->m_spTarget);
  132.   v6 = WorldObject;
  133.   *(_QWORD *)&a[0].Yaw = WorldObject;
  134.   v7 = 0;
  135.   if ( !Shuttle || !WorldObject )
  136.     goto LABEL_76;
  137.   Shuttle->ValidateMoveToTargetSpeedAndSendInfo(Shuttle);
  138.   FVector::FVector(&vFrom, &Shuttle->m_data->m_Pos);
  139.   CMoveActionBase::GetTargetPos(&result, Shuttle, v6);
  140.   v8 = (__m128d)*(unsigned __int64 *)&Shuttle->m_data->m_dParam[11];
  141.   if ( !CMoveActionBase::NeedMove(Shuttle, v6, (double)this->m_Data.m_nAcceptableDistance) )
  142.   {
  143.     if ( Shuttle->IsPC(Shuttle)
  144.       || (v9 = CWorld::Inst(),
  145.           v10 = Shuttle->GetInZoneID(Shuttle),
  146.           v11 = v9->GetGeo(v9),
  147.           CGeoData::CanSee(v11, &vFrom, &result, v10, 0)) )
  148.     {
  149.       Shuttle->m_data->m_bMoveTrouble = 0;
  150.       Shuttle->m_data->m_dwPathFindFailCount = 0;
  151.       m_nDistance = this->m_Data.m_nDistance;
  152.       v13 = Shuttle->GetController(Shuttle);
  153.       CCreatureController::ActionBroadcastMoveToTarget(v13, v6, m_nDistance);
  154. LABEL_76:
  155.       v15 = 0;
  156.       goto LABEL_77;
  157.     }
  158.   }
  159.   if ( this->m_MoveToTargetType )
  160.     TargetDestination = CMoveToTargetActionBase::GetTargetDestination(this, &v106, Shuttle, v6);
  161.   else
  162.     TargetDestination = v6->GetMeleeAttackPosition(v6, &v105, Shuttle);
  163.   FVector::operator=(&result, TargetDestination);
  164.   if ( Shuttle->IsInVehicle(Shuttle) || Shuttle->IsInAirShip(Shuttle) || Shuttle->IsInShuttle(Shuttle) )
  165.   {
  166.     v79 = this->m_Data.m_nDistance;
  167.     v80 = Shuttle->GetController(Shuttle);
  168.     CCreatureController::ActionBroadcastMoveToTarget(v80, v6, v79);
  169.     this->m_nTick = 800;
  170.     this->AddTimer(this, 800, 0, 0);
  171.     v15 = 1;
  172.     goto LABEL_77;
  173.   }
  174.   v15 = 1;
  175.   if ( Shuttle->m_data->m_moveType != CMT_FLY )
  176.   {
  177.     if ( !Shuttle->IsCameraMode(Shuttle) )
  178.     {
  179.       if ( !Shuttle->IsPC(Shuttle) )
  180.       {
  181.         v23 = !v6->IsCreature(v6);
  182.         v59 = v6->__vftable;
  183.         if ( v23 )
  184.         {
  185.           v63 = v59->GetPos(v6, &v112);
  186.           FVector::FVector(&v113, &vFrom);
  187.           v62 = (unsigned int)CPathNodeWorld::PathFind(&g_pnWorld, v64, v63, &result, 0x3E8u);
  188.           r = v62;
  189.         }
  190.         else
  191.         {
  192.           v60 = v59->CastCreature(v6);
  193.           PassingPosOnSight = CCreature::GetPassingPosOnSight(v60, &v111, &vFrom, &result, &r, Shuttle);
  194.           FVector::operator=(&result, PassingPosOnSight);
  195.           v62 = r;
  196.         }
  197.         v23 = v62 == PFR_ERROR;
  198.         m_data = Shuttle->m_data;
  199.         if ( v23 )
  200.         {
  201.           m_data->m_bMoveTrouble = 1;
  202.           ++Shuttle->m_data->m_dwPathFindFailCount;
  203.         }
  204.         else
  205.         {
  206.           m_data->m_bMoveTrouble = 0;
  207.           Shuttle->m_data->m_dwPathFindFailCount = 0;
  208.           if ( g_bMoveToLeader )
  209.           {
  210.             v67 = v6->CastCreature(v6);
  211.             if ( v67 )
  212.             {
  213.               if ( CCreature::IsValidAttackLeaderCandidate(Shuttle, v66) )
  214.               {
  215.                 CCreature::GetMyPositionFrom(Shuttle, v67);
  216.                 CCreature::SetAttackLeaderRelated(v67, Shuttle, 0i64);
  217.               }
  218.             }
  219.           }
  220.         }
  221.         p_m_nTick = &this->m_nTick;
  222.         p_m_vMidDest = &this->m_vMidDest;
  223.         FVector::FVector(&v114, &result);
  224.         CMoveActionBase::CalcMidDest(
  225.           this,
  226.           &vFrom,
  227.           v70,
  228.           v8.m128d_f64[0],
  229.           &this->m_vMidDest,
  230.           &this->m_nTick,
  231.           &this->m_bArrived,
  232.           &v119,
  233.           0,
  234.           Shuttle);
  235.         v86[0].Yaw = (int)(atan2(this->m_vMidDest.y - vFrom.y, this->m_vMidDest.x - vFrom.x)
  236.                          * 65535.0
  237.                          / 6.283185307179586);
  238.         CSharedObject::SetDir(Shuttle->m_data, v86);
  239.         if ( (g_CheckCollisionForNPCMove || Shuttle->IsPet(Shuttle)) && !Shuttle->m_data->m_bPassableDoor )
  240.         {
  241.           v71 = Shuttle->GetInZoneID(Shuttle);
  242.           v72 = Shuttle->GetCollisionRadius(Shuttle);
  243.           v7 = CWorldPlaneCollision::CheckCollision(
  244.                  &g_WorldPlaneCollision,
  245.                  &vFrom,
  246.                  &this->m_vMidDest,
  247.                  v72,
  248.                  &this->m_vMidDest,
  249.                  v71,
  250.                  0);
  251.         }
  252.         Shuttle->GetContainerIndex(Shuttle);
  253.         CContainerDB::Inst();
  254.         CContainerDB::Inst();
  255.         v117 = 0;
  256.         memset(v118, 0, sizeof(v118));
  257.         v121 = 0;
  258.         v94 = 0i64;
  259.         v93 = 0i64;
  260.         memset(&v95, 0, sizeof(v95));
  261.         v92 = 800;
  262.         FVector::operator=(&v95, p_m_vMidDest);
  263.         FVector::operator=(p_m_vMidDest, &v95);
  264.         v73 = &v92;
  265.         if ( v92 >= *p_m_nTick )
  266.           v73 = &this->m_nTick;
  267.         *p_m_nTick = *v73;
  268.         v121 = 700;
  269.         v74 = &v121;
  270.         if ( *p_m_nTick >= 700 )
  271.           v74 = &this->m_nTick;
  272.         *p_m_nTick = *v74;
  273.         v75 = Shuttle->GetController(Shuttle);
  274.         p_result = &this->m_vMidDest;
  275.         if ( !v7 )
  276.           p_result = &result;
  277.         CCreatureController::ActionBroadcastMove(v75, &vFrom, p_result);
  278.         FVector::operator=(&Shuttle->m_vMovingDest, p_m_vMidDest);
  279.         Shuttle->m_bMoving = 1;
  280.         v77 = this->m_vMidDest.z - vFrom.z;
  281.         v78 = this->m_vMidDest.y - vFrom.y;
  282.         v102.x = p_m_vMidDest->x - vFrom.x;
  283.         v102.y = v78;
  284.         v102.z = v77;
  285.         FVector::operator=(&Shuttle->m_vMovingDirection, &v102);
  286.         Shuttle->m_nMoveTick = *p_m_nTick;
  287.         Shuttle->m_nLastTick = GetTickCount();
  288.         this->m_bPathFinding = 1;
  289.         this->m_bMoving = 1;
  290.         m_nTick = (unsigned int)*p_m_nTick;
  291.         goto LABEL_28;
  292.       }
  293.       v16 = &this->m_nTick;
  294.       v46 = &this->m_vMidDest;
  295.       FVector::FVector(&v109, &result);
  296.       CMoveActionBase::CalcMidDest(
  297.         this,
  298.         &vFrom,
  299.         v47,
  300.         v8.m128d_f64[0],
  301.         &this->m_vMidDest,
  302.         &this->m_nTick,
  303.         &this->m_bArrived,
  304.         &v119,
  305.         0,
  306.         Shuttle);
  307.       v85.Yaw = (int)(atan2(this->m_vMidDest.y - vFrom.y, this->m_vMidDest.x - vFrom.x) * 65535.0 / 6.283185307179586);
  308.       CSharedObject::SetDir(Shuttle->m_data, &v85);
  309.       v49 = Shuttle->GetInZoneID(Shuttle);
  310.       v48 = Shuttle->GetCollisionRadius(Shuttle);
  311.       LOBYTE(v49) = CWorldPlaneCollision::CheckCollision(
  312.                       &g_WorldPlaneCollision,
  313.                       &vFrom,
  314.                       &this->m_vMidDest,
  315.                       v48,
  316.                       &this->m_vMidDest,
  317.                       v49,
  318.                       0);
  319.       r = v49;
  320.       Shuttle->GetContainerIndex(Shuttle);
  321.       CContainerDB::Inst();
  322.       CContainerDB::Inst();
  323.       v115 = 0;
  324.       memset(v116, 0, sizeof(v116));
  325.       v121 = 0;
  326.       if ( v119 && !(_BYTE)v49 )
  327.       {
  328.         v90 = 0i64;
  329.         v89 = 0i64;
  330.         memset(&v91, 0, sizeof(v91));
  331.         v88 = 800;
  332.         FVector::operator=(&v91, v46);
  333.         if ( !this->m_bMoving )
  334.         {
  335.           FVector::operator=(v46, &v91);
  336.           v50 = &v88;
  337.           if ( v88 >= *v16 )
  338.             v50 = &this->m_nTick;
  339.           *v16 = *v50;
  340.           v23 = !v6->IsItem(v6);
  341.           v51 = Shuttle->__vftable;
  342.           if ( v23 )
  343.           {
  344.             v54 = this->m_Data.m_nDistance;
  345.             v55 = v51->GetController(Shuttle);
  346.             CCreatureController::ActionBroadcastMoveToTarget(v55, v6, v54);
  347.             v53 = v6->GetPos(v6, &v110);
  348.           }
  349.           else
  350.           {
  351.             v52 = v51->GetController(Shuttle);
  352.             CCreatureController::ActionBroadcastMove(v52, &vFrom, &result);
  353.             v53 = &result;
  354.           }
  355.           FVector::operator=(&Shuttle->m_vMovingDest, v53);
  356.           this->m_bMoving = 1;
  357.         }
  358.         Shuttle->m_bMoving = 1;
  359.         *(double *)v100 = v91.x - vFrom.x;
  360.         *(double *)&v100[1] = v91.y - vFrom.y;
  361.         *(double *)&v100[2] = v91.z - vFrom.z;
  362.         p_v = (FVector *)v100;
  363.         goto LABEL_24;
  364.       }
  365.       v56 = Shuttle->GetController(Shuttle);
  366.       CCreatureController::ActionBroadcastMove(v56, &vFrom, v46);
  367.       FVector::operator=(&Shuttle->m_vMovingDest, v46);
  368.       v57 = this->m_vMidDest.z - vFrom.z;
  369.       v58 = this->m_vMidDest.y - vFrom.y;
  370.       *(double *)v101 = v46->x - vFrom.x;
  371.       *(long double *)&v101[1] = v58;
  372.       *(long double *)&v101[2] = v57;
  373.       v35 = (FVector *)v101;
  374. LABEL_26:
  375.       FVector::operator=(&Shuttle->m_vMovingDirection, v35);
  376.       Shuttle->m_bMoving = 1;
  377.       *v16 = 800;
  378.       goto LABEL_27;
  379.     }
  380.     v8.m128d_f64[0] = v8.m128d_f64[0] * 800.0 / 1000.0;
  381.     v37 = _mm_unpacklo_pd(v8, v8);
  382.     if ( (vFrom.y - result.y) * (vFrom.y - result.y)
  383.        + (vFrom.x - result.x) * (vFrom.x - result.x)
  384.        + (vFrom.z - result.z) * (vFrom.z - result.z) >= 10.0 )
  385.     {
  386.       v87.x = result.x - vFrom.x;
  387.       v87.y = result.y - vFrom.y;
  388.       v87.z = result.z - vFrom.z;
  389.       FVector::NormalizeCube(&v87);
  390.       *(__m128d *)&v98.x = _mm_mul_pd(*(__m128d *)&v87.x, v37);
  391.       v98.z = v87.z * v37.m128d_f64[0];
  392.       FVector::operator=(&v87, &v98);
  393.       v38 = (vFrom.y - result.y) * (vFrom.y - result.y)
  394.           + (vFrom.x - result.x) * (vFrom.x - result.x)
  395.           + (vFrom.z - result.z) * (vFrom.z - result.z);
  396.       if ( v37.m128d_f64[0] > v38 )
  397.       {
  398.         this->m_bArrived = 1;
  399.         this->m_nTick = (int)(sqrt(v38) / v37.m128d_f64[0] * 800.0);
  400.         FVector::operator=(&this->m_vMidDest, &result);
  401.         goto LABEL_37;
  402.       }
  403.       this->m_bArrived = 0;
  404.       this->m_nTick = 800;
  405.       v99.x = v87.x + vFrom.x;
  406.       v99.y = v87.y + vFrom.y;
  407.       v99.z = v87.z + vFrom.z;
  408.       FVector::operator=(&this->m_vMidDest, &v99);
  409.       if ( Shuttle->m_AreaMod.m_bIsUnderWater )
  410.         goto LABEL_37;
  411.       v39 = CWorld::Inst();
  412.       z = (int)this->m_vMidDest.z;
  413.       v41 = v39->GetGeo(v39);
  414.       Ground = CGeoData::FindGround(v41, (int)this->m_vMidDest.x, (int)this->m_vMidDest.y, (int)this->m_vMidDest.z);
  415.       if ( abs(Ground - z) >= 100 )
  416.         goto LABEL_37;
  417.     }
  418.     else
  419.     {
  420.       FVector::operator=(&this->m_vMidDest, &vFrom);
  421.       this->m_nTick = 80;
  422.     }
  423.     this->m_bArrived = 1;
  424. LABEL_37:
  425.     if ( v6->IsItem(v6) || v6->IsStaticObject(v6) )
  426.     {
  427.       if ( !this->m_bMoving )
  428.       {
  429.         v45 = Shuttle->GetController(Shuttle);
  430.         CCreatureController::ActionBroadcastMove(v45, &vFrom, &result);
  431.         FVector::operator=(&Shuttle->m_vMovingDest, &result);
  432.       }
  433.     }
  434.     else
  435.     {
  436.       v43 = this->m_Data.m_nDistance;
  437.       v44 = Shuttle->GetController(Shuttle);
  438.       CCreatureController::ActionBroadcastMoveToTarget(v44, v6, v43);
  439.     }
  440.     this->m_bMoving = 1;
  441.     m_nTick = (unsigned int)this->m_nTick;
  442.     goto LABEL_28;
  443.   }
  444.   v16 = &this->m_nTick;
  445.   v17 = &this->m_vMidDest;
  446.   FVector::FVector(&v107, &result);
  447.   CMoveActionBase::CalcMidDest(
  448.     this,
  449.     &vFrom,
  450.     v18,
  451.     v8.m128d_f64[0],
  452.     &this->m_vMidDest,
  453.     &this->m_nTick,
  454.     &this->m_bArrived,
  455.     &v119,
  456.     0,
  457.     Shuttle);
  458.   a[0].Yaw = (int)(atan2(this->m_vMidDest.y - vFrom.y, this->m_vMidDest.x - vFrom.x) * 65535.0 / 6.283185307179586);
  459.   CSharedObject::SetDir(Shuttle->m_data, a);
  460.   nInstantZoneID = Shuttle->GetInZoneID(Shuttle);
  461.   v20 = Shuttle->GetCollisionRadius(Shuttle);
  462.   v21 = CWorldPlaneCollision::CheckCollision(
  463.           &g_WorldPlaneCollision,
  464.           &vFrom,
  465.           &this->m_vMidDest,
  466.           v20,
  467.           &this->m_vMidDest,
  468.           nInstantZoneID,
  469.           0);
  470.   if ( !v119 || v21 )
  471.   {
  472.     v32 = Shuttle->GetController(Shuttle);
  473.     CCreatureController::ActionBroadcastMove(v32, &vFrom, &this->m_vMidDest);
  474.     FVector::operator=(&Shuttle->m_vMovingDest, &this->m_vMidDest);
  475.     v33 = this->m_vMidDest.z - vFrom.z;
  476.     v34 = this->m_vMidDest.y - vFrom.y;
  477.     v97.x = v17->x - vFrom.x;
  478.     v97.y = v34;
  479.     v97.z = v33;
  480.     v35 = &v97;
  481.     goto LABEL_26;
  482.   }
  483.   if ( !this->m_bMoving )
  484.   {
  485.     v22 = &this->m_nTick;
  486.     if ( *v16 > 800 )
  487.       v22 = (int *)&CMoveActionBase::MoveTick;
  488.     *v16 = *v22;
  489.     v23 = CSmartID::GetItem(&this->m_spTarget) == 0i64;
  490.     v24 = Shuttle->__vftable;
  491.     if ( v23 )
  492.     {
  493.       v27 = this->m_Data.m_nDistance;
  494.       v28 = v24->GetController(Shuttle);
  495.       CCreatureController::ActionBroadcastMoveToTarget(v28, v6, v27);
  496.       v26 = v6->GetPos(v6, &v108);
  497.     }
  498.     else
  499.     {
  500.       v25 = v24->GetController(Shuttle);
  501.       CCreatureController::ActionBroadcastMove(v25, &vFrom, &result);
  502.       v26 = &result;
  503.     }
  504.     FVector::operator=(&Shuttle->m_vMovingDest, v26);
  505.     this->m_bMoving = 1;
  506.   }
  507.   Shuttle->m_bMoving = 1;
  508.   v29 = this->m_vMidDest.z - vFrom.z;
  509.   v30 = this->m_vMidDest.y - vFrom.y;
  510.   v.x = v17->x - vFrom.x;
  511.   v.y = v30;
  512.   v.z = v29;
  513.   p_v = &v;
  514. LABEL_24:
  515.   FVector::operator=(&Shuttle->m_vMovingDirection, p_v);
  516.   Shuttle->m_nLastTick = GetTickCount();
  517.   Shuttle->m_nMoveTick = *v16;
  518. LABEL_27:
  519.   m_nTick = (unsigned int)*v16;
  520. LABEL_28:
  521.   this->AddTimer(this, m_nTick, 0, 0);
  522. LABEL_77:
  523.   CTimer::EndJob(&g_Timer, &JOB_NEWACTION__MOVETOTARGET_SETMOVING);
  524.   return v15;
  525. }
  526.  
  527. //----- (000000000077C518) ----------------------------------------------------
  528. char __fastcall CMoveAction::SetMoving(CMoveAction *this)
  529. {
  530.   __int64 ThreadID; // rbx
  531.   __int64 m_nID; // rdi
  532.   CCreature *Shuttle; // r12
  533.   char v5; // r13
  534.   char v6; // al
  535.   double v7; // xmm7_8
  536.   FVector *v8; // rax
  537.   FVector *v9; // rax
  538.   FVector *v10; // rbx
  539.   FVector *v11; // rax
  540.   int v12; // eax
  541.   FVector *v13; // rax
  542.   FVector *v14; // rbx
  543.   const FVector *v15; // rax
  544.   FVector *v16; // rax
  545.   FVector *v17; // rbx
  546.   const FVector *v18; // rax
  547.   FVector *v19; // rax
  548.   FVector *v20; // rbx
  549.   const FVector *v21; // rax
  550.   FVector *v22; // rax
  551.   FVector *p_m_vMidDest; // rdi
  552.   double v24; // xmm0_8
  553.   unsigned int nInstantZoneID; // ebx
  554.   int *p_m_nTick; // rcx
  555.   CCreature_vtbl *v27; // rax
  556.   CCreatureController *v28; // rax
  557.   FVector *p_v; // rdx
  558.   CCreatureController *v30; // rax
  559.   long double v31; // xmm2_8
  560.   long double v32; // xmm1_8
  561.   FVector vStart; // [rsp+58h] [rbp-B0h] BYREF
  562.   FAngle a[2]; // [rsp+70h] [rbp-98h] BYREF
  563.   FVector v; // [rsp+78h] [rbp-90h] BYREF
  564.   CCreature *v37; // [rsp+A0h] [rbp-68h]
  565.   int v38; // [rsp+ACh] [rbp-5Ch] BYREF
  566.   __int64 v39; // [rsp+B8h] [rbp-50h]
  567.   __int128 v40; // [rsp+C0h] [rbp-48h]
  568.   FVector v41; // [rsp+D0h] [rbp-38h] BYREF
  569.   FVector v42; // [rsp+E8h] [rbp-20h] BYREF
  570.   __int64 v43; // [rsp+100h] [rbp-8h]
  571.   JOB *v44; // [rsp+108h] [rbp+0h]
  572.   FVector v45; // [rsp+110h] [rbp+8h] BYREF
  573.   FVector v46; // [rsp+128h] [rbp+20h] BYREF
  574.   FVector v47; // [rsp+140h] [rbp+38h] BYREF
  575.   FVector v48; // [rsp+158h] [rbp+50h] BYREF
  576.   FVector v49; // [rsp+170h] [rbp+68h] BYREF
  577.   FVector v50; // [rsp+188h] [rbp+80h] BYREF
  578.   FVector v51; // [rsp+1A0h] [rbp+98h] BYREF
  579.   FVector v52; // [rsp+1B8h] [rbp+B0h] BYREF
  580.   FVector v53; // [rsp+1D0h] [rbp+C8h] BYREF
  581.   FVector v54; // [rsp+1E8h] [rbp+E0h] BYREF
  582.   int v55; // [rsp+208h] [rbp+100h]
  583.   char v56[2048]; // [rsp+210h] [rbp+108h] BYREF
  584.   char v57; // [rsp+A90h] [rbp+988h] BYREF
  585.   bool v58; // [rsp+A98h] [rbp+990h] BYREF
  586.   unsigned int v59; // [rsp+AA0h] [rbp+998h]
  587.  
  588.   v43 = -2i64;
  589.   v44 = &JOB_NEWACTION__MOVE_SETMOVING;
  590.   ThreadID = (int)CThreadManager::GetThreadID();
  591.   m_nID = JOB_NEWACTION__MOVE_SETMOVING.m_nID;
  592.   g_Timer.m_EachJobBeginTimes[ThreadID]._Mypair._Myval2._Myfirst[m_nID] = GetTickCount();
  593.   Shuttle = (CCreature *)CSmartID::GetShuttle((__crt_locale_data *)&this->m_spActor);
  594.   v37 = Shuttle;
  595.   if ( Shuttle->IsInVehicle(Shuttle) || Shuttle->IsInAirShip(Shuttle) || Shuttle->IsInShuttle(Shuttle) )
  596.   {
  597.     v6 = CMoveAction::SetMovingRelativeImpl(this);
  598.     goto LABEL_45;
  599.   }
  600.   v5 = 1;
  601.   if ( Shuttle->m_data->m_moveType == CMT_FLY )
  602.   {
  603.     v6 = CMoveAction::SetMovingFlyingImpl(this);
  604. LABEL_45:
  605.     v5 = v6;
  606.     goto LABEL_46;
  607.   }
  608.   if ( Shuttle->IsCameraMode(Shuttle) )
  609.   {
  610.     v6 = CMoveAction::SetMovingCameraModeImpl(this);
  611.     goto LABEL_45;
  612.   }
  613.   FVector::FVector(&vStart, &Shuttle->m_data->m_Pos);
  614.   v7 = Shuttle->m_data->m_dParam[11];
  615.   memset(&v, 0, sizeof(v));
  616.   v57 = 1;
  617.   if ( g_bUserPathFind && this->m_bPathFind )
  618.   {
  619.     if ( this->m_bPathFinding
  620.       && (vStart.x - this->m_vPathFindMidDest.x) * (vStart.x - this->m_vPathFindMidDest.x)
  621.        + (vStart.y - this->m_vPathFindMidDest.y) * (vStart.y - this->m_vPathFindMidDest.y) > 1.0 )
  622.     {
  623.       Shuttle->m_data->m_bMoveTrouble = 0;
  624.       Shuttle->m_data->m_dwPathFindFailCount = 0;
  625.       FVector::FVector(&v45, &this->m_vPathFindMidDest);
  626.       CMoveActionBase::CalcMidDest(
  627.         this,
  628.         &vStart,
  629.         v8,
  630.         v7,
  631.         &this->m_vMidDest,
  632.         &this->m_nTick,
  633.         &v58,
  634.         (bool *)&v57,
  635.         0,
  636.         Shuttle);
  637.     }
  638.     else
  639.     {
  640.       FVector::FVector(&v46, &this->m_vDest);
  641.       v10 = v9;
  642.       v11 = Shuttle->GetPos(Shuttle, &v47);
  643.       v12 = CPathNodeWorld::PathFind(&g_pnWorld, v11, v10, &v, 0x190u);
  644.       if ( v12 )
  645.       {
  646.         if ( v12 == 1 )
  647.         {
  648.           this->m_bPathFinding = 1;
  649.           Shuttle->m_data->m_bMoveTrouble = 0;
  650.           Shuttle->m_data->m_dwPathFindFailCount = 0;
  651.           FVector::operator=(&this->m_vPathFindMidDest, &v);
  652.           FVector::FVector(&v50, &v);
  653.           v17 = v16;
  654.           v18 = Shuttle->GetPos(Shuttle, &v51);
  655.           CMoveActionBase::CalcMidDest(
  656.             this,
  657.             v18,
  658.             v17,
  659.             v7,
  660.             &this->m_vMidDest,
  661.             &this->m_nTick,
  662.             &v58,
  663.             (bool *)&v57,
  664.             0,
  665.             Shuttle);
  666.           this->m_bResetDest = 1;
  667.         }
  668.         else if ( v12 == 2 )
  669.         {
  670.           FVector::FVector(&v52, &this->m_vDest);
  671.           v20 = v19;
  672.           v21 = Shuttle->GetPos(Shuttle, &v53);
  673.           CMoveActionBase::CalcMidDest(
  674.             this,
  675.             v21,
  676.             v20,
  677.             v7,
  678.             &this->m_vMidDest,
  679.             &this->m_nTick,
  680.             &this->m_bArrived,
  681.             (bool *)&v57,
  682.             0,
  683.             Shuttle);
  684.           *(_WORD *)&this->m_bPathFinding = 256;
  685.           Shuttle->m_data->m_bMoveTrouble = 1;
  686.           ++Shuttle->m_data->m_dwPathFindFailCount;
  687.         }
  688.       }
  689.       else
  690.       {
  691.         FVector::FVector(&v48, &this->m_vDest);
  692.         v14 = v13;
  693.         v15 = Shuttle->GetPos(Shuttle, &v49);
  694.         CMoveActionBase::CalcMidDest(
  695.           this,
  696.           v15,
  697.           v14,
  698.           v7,
  699.           &this->m_vMidDest,
  700.           &this->m_nTick,
  701.           &this->m_bArrived,
  702.           (bool *)&v57,
  703.           0,
  704.           Shuttle);
  705.         if ( this->m_bPathFinding )
  706.           this->m_bResetDest = 1;
  707.         this->m_bPathFinding = 0;
  708.         Shuttle->m_data->m_bMoveTrouble = 0;
  709.         Shuttle->m_data->m_dwPathFindFailCount = 0;
  710.       }
  711.     }
  712.   }
  713.   else
  714.   {
  715.     FVector::FVector(&v54, &this->m_vDest);
  716.     CMoveActionBase::CalcMidDest(
  717.       this,
  718.       &vStart,
  719.       v22,
  720.       v7,
  721.       &this->m_vMidDest,
  722.       &this->m_nTick,
  723.       &this->m_bArrived,
  724.       (bool *)&v57,
  725.       0,
  726.       Shuttle);
  727.   }
  728.   p_m_vMidDest = &this->m_vMidDest;
  729.   nInstantZoneID = Shuttle->GetInZoneID(Shuttle);
  730.   v24 = Shuttle->GetCollisionRadius(Shuttle);
  731.   LOBYTE(nInstantZoneID) = CWorldPlaneCollision::CheckCollision(
  732.                              &g_WorldPlaneCollision,
  733.                              &vStart,
  734.                              &this->m_vMidDest,
  735.                              v24,
  736.                              &this->m_vMidDest,
  737.                              nInstantZoneID,
  738.                              0);
  739.   v59 = nInstantZoneID;
  740.   Shuttle->GetContainerIndex(Shuttle);
  741.   CContainerDB::Inst();
  742.   CContainerDB::Inst();
  743.   v55 = 0;
  744.   memset(v56, 0, sizeof(v56));
  745.   if ( !v57 || (_BYTE)nInstantZoneID )
  746.   {
  747.     FVector::operator=(&this->m_vDest, p_m_vMidDest);
  748.     *(_WORD *)&this->m_bPathFinding = 256;
  749.     this->m_bArrived = 1;
  750.   }
  751.   v40 = 0i64;
  752.   v39 = 0i64;
  753.   memset(&v41, 0, sizeof(v41));
  754.   v38 = 800;
  755.   FVector::operator=(&v41, p_m_vMidDest);
  756.   if ( this->m_bResetDest )
  757.   {
  758.     if ( (vStart.x - this->m_vDest.x) * (vStart.x - this->m_vDest.x)
  759.        + (vStart.y - this->m_vDest.y) * (vStart.y - this->m_vDest.y)
  760.        + (vStart.z - this->m_vDest.z) * (vStart.z - this->m_vDest.z) <= 0.1 )
  761.     {
  762.       Shuttle->ActionFailed(Shuttle, 1);
  763.     }
  764.     else
  765.     {
  766.       FVector::operator=(p_m_vMidDest, &v41);
  767.       p_m_nTick = &v38;
  768.       if ( v38 >= this->m_nTick )
  769.         p_m_nTick = &this->m_nTick;
  770.       this->m_nTick = *p_m_nTick;
  771.       v27 = Shuttle->__vftable;
  772.       if ( this->m_bPathFinding )
  773.       {
  774.         v28 = v27->GetController(Shuttle);
  775.         CCreatureController::ActionBroadcastMove(v28, &vStart, &v);
  776.         p_v = &v;
  777.       }
  778.       else
  779.       {
  780.         v30 = v27->GetController(Shuttle);
  781.         CCreatureController::ActionBroadcastMove(v30, &vStart, &this->m_vDest);
  782.         p_v = &this->m_vDest;
  783.       }
  784.       FVector::operator=(&Shuttle->m_vMovingDest, p_v);
  785.     }
  786.     this->m_bResetDest = 0;
  787.   }
  788.   if ( !this->m_bPathFinding
  789.     && v7 * 800.0 / 1000.0 > sqrt(
  790.                                (this->m_vDest.x - vStart.x) * (this->m_vDest.x - vStart.x)
  791.                              + (this->m_vDest.y - vStart.y) * (this->m_vDest.y - vStart.y)
  792.                              + (this->m_vDest.z - vStart.z) * (this->m_vDest.z - vStart.z)) )
  793.   {
  794.     this->m_bArrived = 1;
  795.   }
  796.   v31 = this->m_vMidDest.z - vStart.z;
  797.   v32 = this->m_vMidDest.y - vStart.y;
  798.   v42.x = p_m_vMidDest->x - vStart.x;
  799.   v42.y = v32;
  800.   v42.z = v31;
  801.   FVector::operator=(&Shuttle->m_vMovingDirection, &v42);
  802.   if ( fabs(Shuttle->m_vMovingDirection.x) >= 0.000009999999747378752
  803.     || fabs(Shuttle->m_vMovingDirection.y) >= 0.000009999999747378752
  804.     || fabs(Shuttle->m_vMovingDirection.z) >= 0.000009999999747378752 )
  805.   {
  806.     a[0].Yaw = (int)(atan2(Shuttle->m_vMovingDirection.y, Shuttle->m_vMovingDirection.x) * 65535.0 / 6.283185307179586);
  807.     CSharedObject::SetDir(Shuttle->m_data, a);
  808.   }
  809.   Shuttle->m_bMoving = 1;
  810.   Shuttle->m_nLastTick = GetTickCount();
  811.   Shuttle->m_nMoveTick = this->m_nTick;
  812.   this->AddTimer(this, this->m_nTick, 0, 0);
  813. LABEL_46:
  814.   CTimer::EndJob(&g_Timer, &JOB_NEWACTION__MOVE_SETMOVING);
  815.   return v5;
  816. }
  817.  
  818. //----- (000000000077A128) ----------------------------------------------------
  819. void __fastcall CMoveToTargetAction::OnEnd(CMoveToTargetAction *this, bool bFinishedWell)
  820. {
  821.   __int64 ThreadID; // rbx
  822.   __int64 m_nID; // rdi
  823.   CCreature *Shuttle; // rsi
  824.   double v7; // xmm2_8
  825.   signed int v8; // edx
  826.   double *v9; // rcx
  827.   double *v10; // rax
  828.   double v11; // xmm1_8
  829.   double v12; // xmm2_8
  830.   double v13; // xmm0_8
  831.   double *m_data; // rax
  832.   long double v15; // xmm2_8
  833.   long double v16; // xmm0_8
  834.   FVector *p_vTo; // rdx
  835.   FVector *v18; // rcx
  836.   signed int v19; // eax
  837.   double *v20; // rcx
  838.   double *v21; // rax
  839.   double v22; // xmm1_8
  840.   double v23; // xmm2_8
  841.   double v24; // xmm0_8
  842.   double *v25; // rax
  843.   long double v26; // xmm2_8
  844.   long double v27; // xmm0_8
  845.   CAreaDB *v28; // rbx
  846.   CAreaDB_vtbl *v29; // rdi
  847.   unsigned int v30; // eax
  848.   CSharedCreatureData *v31; // rax
  849.   double z; // xmm2_8
  850.   CWorld *v33; // rax
  851.   CGeoData *v34; // rax
  852.   CWorld *v35; // rax
  853.   CGeoData *v36; // rax
  854.   int v37; // eax
  855.   double *v38; // rax
  856.   long double v39; // xmm0_8
  857.   CWorld *v40; // rax
  858.   CSharedCreatureData *v41; // rbx
  859.   CGeoData *v42; // rax
  860.   CSharedCreatureData *v43; // rbx
  861.   CCreatureController *v44; // rax
  862.   FVector *v45; // rax
  863.   FVector *v46; // rbx
  864.   CWorld *v47; // rax
  865.   __int64 m_nSkillId; // r8
  866.   FVector vTo; // [rsp+38h] [rbp-79h] BYREF
  867.   __int64 v50; // [rsp+50h] [rbp-61h] BYREF
  868.   double v51; // [rsp+58h] [rbp-59h] BYREF
  869.   long double v52; // [rsp+60h] [rbp-51h] BYREF
  870.   __int64 v53; // [rsp+68h] [rbp-49h] BYREF
  871.   __int64 v54[5]; // [rsp+70h] [rbp-41h] BYREF
  872.   char v55; // [rsp+98h] [rbp-19h] BYREF
  873.   FVector v56; // [rsp+B0h] [rbp-1h] BYREF
  874.   char v57; // [rsp+118h] [rbp+67h] BYREF
  875.   double v58; // [rsp+128h] [rbp+77h] BYREF
  876.   long double v59; // [rsp+130h] [rbp+7Fh] BYREF
  877.  
  878.   v54[3] = -2i64;
  879.   CMoveActionBase::OnEnd(this, bFinishedWell);
  880.   v54[4] = (__int64)&JOB_NEWACTION__MOVETOTARGET_ONEND;
  881.   ThreadID = (int)CThreadManager::GetThreadID();
  882.   m_nID = JOB_NEWACTION__MOVETOTARGET_ONEND.m_nID;
  883.   g_Timer.m_EachJobBeginTimes[ThreadID]._Mypair._Myval2._Myfirst[m_nID] = GetTickCount();
  884.   Shuttle = (CCreature *)CSmartID::GetShuttle((__crt_locale_data *)&this->m_spActor);
  885.   if ( !Shuttle->IsInVehicle(Shuttle)
  886.     && !Shuttle->IsInAirShip(Shuttle)
  887.     && !Shuttle->IsInShuttle(Shuttle)
  888.     && !Shuttle->IsCameraMode(Shuttle)
  889.     && !bFinishedWell )
  890.   {
  891.     v7 = Shuttle->m_vMovingDirection.x * Shuttle->m_vMovingDirection.x
  892.        + Shuttle->m_vMovingDirection.y * Shuttle->m_vMovingDirection.y
  893.        + Shuttle->m_vMovingDirection.z * Shuttle->m_vMovingDirection.z;
  894.     if ( Shuttle->m_data->m_moveType == CMT_FLY && v7 < 250000.0 )
  895.     {
  896.       v8 = GetTickCount() - Shuttle->m_nLastTick;
  897.       if ( v8 >= 0 )
  898.       {
  899.         if ( v8 > 800 )
  900.           v8 = 800;
  901.       }
  902.       else
  903.       {
  904.         v8 = 0;
  905.       }
  906.       if ( !Shuttle->m_nMoveTick )
  907.         Shuttle->m_nMoveTick = 1;
  908.       v58 = (double)v8 / (double)(int)Shuttle->m_nMoveTick;
  909.       v59 = DOUBLE_1_0;
  910.       v50 = 0i64;
  911.       v9 = &v58;
  912.       if ( v58 >= 1.0 )
  913.         v9 = &v59;
  914.       v10 = (double *)&v50;
  915.       if ( *v9 > 0.0 )
  916.         v10 = v9;
  917.       v11 = *v10;
  918.       v12 = *v10;
  919.       v13 = *v10;
  920.       m_data = (double *)Shuttle->m_data;
  921.       v15 = v12 * Shuttle->m_vMovingDirection.z + m_data[3];
  922.       v16 = v13 * Shuttle->m_vMovingDirection.y + m_data[2];
  923.       *(double *)v54 = v11 * Shuttle->m_vMovingDirection.x + m_data[1];
  924.       *(long double *)&v54[1] = v16;
  925.       *(long double *)&v54[2] = v15;
  926.       p_vTo = (FVector *)v54;
  927.       v18 = (FVector *)&v55;
  928. LABEL_43:
  929.       FVector::FVector(v18, p_vTo);
  930.       v46 = v45;
  931.       v47 = CWorld::Inst();
  932.       CWorld::MoveTo(v47, Shuttle, v46, 0);
  933.       goto LABEL_44;
  934.     }
  935.     if ( v7 < 90000.0 )
  936.     {
  937.       v19 = GetTickCount() - Shuttle->m_nLastTick;
  938.       if ( !Shuttle->m_nMoveTick )
  939.         Shuttle->m_nMoveTick = 1;
  940.       v51 = (double)v19 / (double)(int)Shuttle->m_nMoveTick;
  941.       v52 = DOUBLE_1_0;
  942.       v53 = 0i64;
  943.       v20 = &v51;
  944.       if ( v51 >= 1.0 )
  945.         v20 = &v52;
  946.       v21 = (double *)&v53;
  947.       if ( *v20 > 0.0 )
  948.         v21 = v20;
  949.       v22 = *v21;
  950.       v23 = *v21;
  951.       v24 = *v21;
  952.       v25 = (double *)Shuttle->m_data;
  953.       v26 = v23 * Shuttle->m_vMovingDirection.z + v25[3];
  954.       v27 = v24 * Shuttle->m_vMovingDirection.y + v25[2];
  955.       vTo.x = v22 * Shuttle->m_vMovingDirection.x + v25[1];
  956.       vTo.y = v27;
  957.       vTo.z = v26;
  958.       if ( !Shuttle->m_AreaMod.m_bIsUnderWater )
  959.       {
  960.         if ( !Shuttle->m_AreaMod.m_bIsNearUnderWater
  961.           || (v28 = Singleton<CAreaDB>::inst(),
  962.               v29 = v28->__vftable,
  963.               v30 = Shuttle->GetInZoneID(Shuttle),
  964.               !v29->IsUnderWater(v28, &vTo, (int *)&v57, v30)) )
  965.         {
  966.           Shuttle->m_bFloatingMoveMode = 0;
  967.           v31 = Shuttle->m_data;
  968.           z = v31->m_Pos.z;
  969.           if ( z <= this->m_vMidDest.z )
  970.             z = this->m_vMidDest.z;
  971.           vTo.z = z;
  972.           if ( v31->m_moveType == CMT_FLY )
  973.             goto LABEL_36;
  974.           v33 = CWorld::Inst();
  975.           v34 = v33->GetGeo(v33);
  976.           z = (double)(int)CGeoData::FindNearGround(v34, (int)vTo.x, (int)vTo.y, (int)vTo.z);
  977. LABEL_35:
  978.           vTo.z = z;
  979. LABEL_36:
  980.           v38 = (double *)Shuttle->m_data;
  981.           v39 = sqrt(
  982.                   (vTo.x - v38[1]) * (vTo.x - v38[1])
  983.                 + (vTo.y - v38[2]) * (vTo.y - v38[2])
  984.                 + (z - v38[3]) * (z - v38[3]));
  985.           v40 = CWorld::Inst();
  986.           v41 = Shuttle->m_data;
  987.           v42 = v40->GetGeo(v40);
  988.           if ( !CGeoData::MoveStraightTest(v42, &v41->m_Pos, &vTo, v39, 0, 0) )
  989.             FVector::operator=(&vTo, &Shuttle->m_data->m_Pos);
  990.           if ( Shuttle->m_SkillMod.m_nBlockMoveCount || !Shuttle->m_data->m_bCanMove || !Shuttle->m_SkillMod.m_bCanAct )
  991.           {
  992.             v43 = Shuttle->m_data;
  993.             v44 = Shuttle->GetController(Shuttle);
  994.             CCreatureController::ActionBroadcastMove(v44, &v43->m_Pos, &vTo);
  995.           }
  996.           p_vTo = &vTo;
  997.           v18 = &v56;
  998.           goto LABEL_43;
  999.         }
  1000.         Shuttle->m_bFloatingMoveMode = 1;
  1001.       }
  1002.       v35 = CWorld::Inst();
  1003.       v36 = v35->GetGeo(v35);
  1004.       v37 = CGeoData::FindNearGround(v36, (int)vTo.x, (int)vTo.y, (int)vTo.z);
  1005.       z = fmax(vTo.z, (double)v37);
  1006.       goto LABEL_35;
  1007.     }
  1008.   }
  1009. LABEL_44:
  1010.   if ( Shuttle->m_SkillMod.m_nBlockMoveCount || !Shuttle->m_data->m_bCanMove || !Shuttle->m_SkillMod.m_bCanAct )
  1011.   {
  1012.     m_nSkillId = (unsigned int)this->m_Data.m_nSkillId;
  1013.     if ( (_DWORD)m_nSkillId )
  1014.       Shuttle->OnUseSkillFinished(
  1015.         Shuttle,
  1016.         Shuttle->m_spTarget.sid,
  1017.         m_nSkillId,
  1018.         this->m_nSkillLevel,
  1019.         this->m_nSkillSubLevel,
  1020.         0);
  1021.     Shuttle->m_data->m_bMoveTrouble = 0;
  1022.   }
  1023.   Shuttle->ActionFailed(Shuttle, 0);
  1024.   if ( Shuttle->m_SkillMod.m_nBlockMoveCount || !Shuttle->m_data->m_bCanMove || !Shuttle->m_SkillMod.m_bCanAct )
  1025.   {
  1026.     Shuttle->m_data->m_bMoveTrouble = 0;
  1027.     Shuttle->m_data->m_dwPathFindFailCount = 0;
  1028.   }
  1029.   Shuttle->m_data->m_MovingStatus = MSTE_NOT_MOVING;
  1030.   Shuttle->m_bMoving = 0;
  1031.   CTimer::EndJob(&g_Timer, &JOB_NEWACTION__MOVETOTARGET_ONEND);
  1032. }
  1033. void __fastcall CMoveAction::OnEnd(CMoveAction *this, bool bFinishedWell)
  1034. {
  1035.   __int64 ThreadID; // rbx
  1036.   __int64 m_nID; // rdi
  1037.   __int64 Shuttle; // rax
  1038.   CCreature *v7; // r14
  1039.   double v8; // xmm6_8
  1040.   signed int v9; // edx
  1041.   double *v10; // rcx
  1042.   double *v11; // rax
  1043.   double v12; // xmm1_8
  1044.   double v13; // xmm2_8
  1045.   double v14; // xmm0_8
  1046.   double *m_data; // rax
  1047.   long double v16; // xmm2_8
  1048.   long double v17; // xmm0_8
  1049.   FVector *p_vTo; // rdx
  1050.   char *v19; // rcx
  1051.   signed int v20; // ebx
  1052.   double *v21; // rcx
  1053.   double *v22; // rax
  1054.   double v23; // xmm1_8
  1055.   double v24; // xmm2_8
  1056.   double v25; // xmm0_8
  1057.   double *v26; // rax
  1058.   long double v27; // xmm2_8
  1059.   long double v28; // xmm0_8
  1060.   signed int v29; // edx
  1061.   double *v30; // rcx
  1062.   double *v31; // rax
  1063.   double v32; // xmm1_8
  1064.   double v33; // xmm2_8
  1065.   double v34; // xmm0_8
  1066.   double *v35; // rax
  1067.   double z; // xmm2_8
  1068.   long double v37; // xmm0_8
  1069.   char bIsFloating; // di
  1070.   int nSurfaceHeight; // esi
  1071.   CAreaDB *v40; // rbx
  1072.   unsigned __int8 (__fastcall **p_IsUnderWater)(CAreaDB *, FVector *, char *, _QWORD); // rdi
  1073.   unsigned int v42; // eax
  1074.   CWorld *v43; // rax
  1075.   CGeoData *v44; // rax
  1076.   int v45; // eax
  1077.   CSharedCreatureData *v46; // rax
  1078.   CWorld *v47; // rax
  1079.   CGeoData *v48; // rax
  1080.   double *v49; // rax
  1081.   long double v50; // xmm0_8
  1082.   CWorld *v51; // rax
  1083.   CSharedCreatureData *v52; // rbx
  1084.   CGeoData *v53; // rax
  1085.   CSharedCreatureData *v54; // rbx
  1086.   CCreatureController *v55; // rax
  1087.   ActionType m_eInterruptActionType; // ebx
  1088.   CSharedCreatureData *v57; // rbx
  1089.   CCreatureController *v58; // rax
  1090.   FVector *v59; // rax
  1091.   FVector *v60; // rbx
  1092.   CWorld *v61; // rax
  1093.   CAreaDB *v62; // rdi
  1094.   CAreaDB_vtbl *v63; // rsi
  1095.   unsigned int v64; // ebx
  1096.   __int64 v65; // rax
  1097.   FVector vTo; // [rsp+30h] [rbp-D0h] BYREF
  1098.   long double v67; // [rsp+48h] [rbp-B8h] BYREF
  1099.   __int64 v68; // [rsp+50h] [rbp-B0h] BYREF
  1100.   double v69; // [rsp+58h] [rbp-A8h] BYREF
  1101.   long double v70; // [rsp+60h] [rbp-A0h] BYREF
  1102.   __int64 v71; // [rsp+68h] [rbp-98h] BYREF
  1103.   double v72; // [rsp+70h] [rbp-90h] BYREF
  1104.   long double v73; // [rsp+78h] [rbp-88h] BYREF
  1105.   __int64 v74; // [rsp+80h] [rbp-80h] BYREF
  1106.   __int64 v75[3]; // [rsp+88h] [rbp-78h] BYREF
  1107.   __int64 v76[5]; // [rsp+A0h] [rbp-60h] BYREF
  1108.   FVector v; // [rsp+C8h] [rbp-38h] BYREF
  1109.   char v78; // [rsp+E0h] [rbp-20h] BYREF
  1110.   char v79; // [rsp+F8h] [rbp-8h] BYREF
  1111.   FVector v80; // [rsp+110h] [rbp+10h] BYREF
  1112.   char v81; // [rsp+128h] [rbp+28h] BYREF
  1113.   char v82; // [rsp+1A0h] [rbp+A0h] BYREF
  1114.   char v83; // [rsp+1B0h] [rbp+B0h] BYREF
  1115.   double v84; // [rsp+1B8h] [rbp+B8h] BYREF
  1116.  
  1117.   v76[3] = -2i64;
  1118.   CMoveActionBase::OnEnd(this, bFinishedWell);
  1119.   v76[4] = (__int64)&JOB_NEWACTION__MOVE_ONEND;
  1120.   ThreadID = (int)CThreadManager::GetThreadID();
  1121.   m_nID = JOB_NEWACTION__MOVE_ONEND.m_nID;
  1122.   g_Timer.m_EachJobBeginTimes[ThreadID]._Mypair._Myval2._Myfirst[m_nID] = GetTickCount();
  1123.   Shuttle = CSmartID::GetShuttle((__crt_locale_data *)&this->m_spActor);
  1124.   v7 = (CCreature *)Shuttle;
  1125.   if ( !Shuttle )
  1126.   {
  1127.     CTimer::EndJob(&g_Timer, &JOB_NEWACTION__MOVE_ONEND);
  1128.     return;
  1129.   }
  1130.   if ( !(*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)Shuttle + 1024i64))(Shuttle)
  1131.     && !v7->IsInAirShip(v7)
  1132.     && !v7->IsInShuttle(v7)
  1133.     && !v7->IsCameraMode(v7) )
  1134.   {
  1135.     if ( bFinishedWell )
  1136.     {
  1137.       if ( !v7->m_AreaMod.m_bIsUnderWater )
  1138.         v7->m_bFloatingMoveMode = v7->m_AreaMod.m_bIsNearUnderWater
  1139.                                && (v62 = Singleton<CAreaDB>::inst(),
  1140.                                    v63 = v62->__vftable,
  1141.                                    v64 = v7->GetInZoneID(v7),
  1142.                                    v65 = (__int64)v7->GetPos(v7, (FVector *)&v81),
  1143.                                    v63->IsUnderWater(v62, (const FVector *)v65, (int *)&v83, v64));
  1144.       goto LABEL_75;
  1145.     }
  1146.     v8 = v7->m_vMovingDirection.x * v7->m_vMovingDirection.x
  1147.        + v7->m_vMovingDirection.y * v7->m_vMovingDirection.y
  1148.        + v7->m_vMovingDirection.z * v7->m_vMovingDirection.z;
  1149.     if ( v7->IsNPC(v7) && v7->m_data->m_moveType == CMT_FLY && v8 < 160000.0 )
  1150.     {
  1151.       v9 = GetTickCount() - v7->m_nLastTick;
  1152.       if ( v9 >= 0 )
  1153.       {
  1154.         if ( v9 > 800 )
  1155.           v9 = 800;
  1156.       }
  1157.       else
  1158.       {
  1159.         v9 = 0;
  1160.       }
  1161.       if ( !v7->m_nMoveTick )
  1162.         v7->m_nMoveTick = 1;
  1163.       v84 = (double)v9 / (double)(int)v7->m_nMoveTick;
  1164.       v67 = DOUBLE_1_0;
  1165.       v68 = 0i64;
  1166.       v10 = &v84;
  1167.       if ( v84 >= 1.0 )
  1168.         v10 = &v67;
  1169.       v11 = (double *)&v68;
  1170.       if ( *v10 > 0.0 )
  1171.         v11 = v10;
  1172.       v12 = *v11;
  1173.       v13 = *v11;
  1174.       v14 = *v11;
  1175.       m_data = (double *)v7->m_data;
  1176.       v16 = v13 * v7->m_vMovingDirection.z + m_data[3];
  1177.       v17 = v14 * v7->m_vMovingDirection.y + m_data[2];
  1178.       *(double *)v75 = v12 * v7->m_vMovingDirection.x + m_data[1];
  1179.       *(long double *)&v75[1] = v17;
  1180.       *(long double *)&v75[2] = v16;
  1181.       p_vTo = (FVector *)v75;
  1182.       v19 = &v78;
  1183. LABEL_69:
  1184.       FVector::FVector((FVector *)v19, p_vTo);
  1185.       v60 = v59;
  1186.       v61 = CWorld::Inst();
  1187.       CWorld::MoveTo(v61, v7, v60, 0);
  1188.       goto LABEL_75;
  1189.     }
  1190.     if ( v7->m_data->m_moveType == CMT_FLY && v8 < 250000.0 )
  1191.     {
  1192.       v20 = GetTickCount() - v7->m_nLastTick;
  1193.       if ( v20 >= 0 )
  1194.       {
  1195.         if ( v20 > 800 )
  1196.           v20 = 800;
  1197.       }
  1198.       else
  1199.       {
  1200.         v20 = 0;
  1201.       }
  1202.       if ( !v7->m_nMoveTick )
  1203.         v7->m_nMoveTick = 1;
  1204.       if ( v7->IsPC(v7) && v7->CastUser(v7)->m_bRestartState )
  1205.         goto LABEL_75;
  1206.       v69 = (double)v20 / (double)(int)v7->m_nMoveTick;
  1207.       v70 = DOUBLE_1_0;
  1208.       v71 = 0i64;
  1209.       v21 = &v69;
  1210.       if ( v69 >= 1.0 )
  1211.         v21 = &v70;
  1212.       v22 = (double *)&v71;
  1213.       if ( *v21 > 0.0 )
  1214.         v22 = v21;
  1215.       v23 = *v22;
  1216.       v24 = *v22;
  1217.       v25 = *v22;
  1218.       v26 = (double *)v7->m_data;
  1219.       v27 = v24 * v7->m_vMovingDirection.z + v26[3];
  1220.       v28 = v25 * v7->m_vMovingDirection.y + v26[2];
  1221.       *(double *)v76 = v23 * v7->m_vMovingDirection.x + v26[1];
  1222.       *(long double *)&v76[1] = v28;
  1223.       *(long double *)&v76[2] = v27;
  1224.       p_vTo = (FVector *)v76;
  1225.       v19 = &v79;
  1226.       goto LABEL_69;
  1227.     }
  1228.     if ( v8 >= 90000.0 )
  1229.       goto LABEL_75;
  1230.     v29 = GetTickCount() - v7->m_nLastTick;
  1231.     if ( v29 >= 0 )
  1232.     {
  1233.       if ( v29 > 800 )
  1234.         v29 = 800;
  1235.     }
  1236.     else
  1237.     {
  1238.       v29 = 0;
  1239.     }
  1240.     if ( !v7->m_nMoveTick )
  1241.       v7->m_nMoveTick = 1;
  1242.     v72 = (double)v29 / (double)(int)v7->m_nMoveTick;
  1243.     v73 = DOUBLE_1_0;
  1244.     v74 = 0i64;
  1245.     v30 = &v72;
  1246.     if ( v72 >= 1.0 )
  1247.       v30 = &v73;
  1248.     v31 = (double *)&v74;
  1249.     if ( *v30 > 0.0 )
  1250.       v31 = v30;
  1251.     v32 = *v31;
  1252.     v33 = *v31;
  1253.     v34 = *v31;
  1254.     v35 = (double *)v7->m_data;
  1255.     z = v33 * v7->m_vMovingDirection.z + v35[3];
  1256.     v37 = v34 * v7->m_vMovingDirection.y + v35[2];
  1257.     vTo.x = v32 * v7->m_vMovingDirection.x + v35[1];
  1258.     vTo.y = v37;
  1259.     vTo.z = z;
  1260.     bIsFloating = v7->m_AreaMod.m_bIsUnderWater;
  1261.     nSurfaceHeight = v7->m_AreaMod.m_nWaterSurfaceHeight;
  1262.     if ( !bIsFloating )
  1263.     {
  1264.       if ( v7->m_AreaMod.m_bIsNearUnderWater
  1265.         && (v40 = Singleton<CAreaDB>::inst(),
  1266.             p_IsUnderWater = (unsigned __int8 (__fastcall **)(CAreaDB *, FVector *, char *, _QWORD))&v40->IsUnderWater,
  1267.             v42 = v7->GetInZoneID(v7),
  1268.             (*p_IsUnderWater)(v40, &vTo, &v82, v42)) )
  1269.       {
  1270.         v7->m_bFloatingMoveMode = 1;
  1271.         bIsFloating = 1;
  1272.         v43 = CWorld::Inst();
  1273.         v44 = v43->GetGeo(v43);
  1274.         v45 = CGeoData::FindNearGround(v44, (int)vTo.x, (int)vTo.y, (int)vTo.z);
  1275.         z = fmax(vTo.z, (double)v45);
  1276.       }
  1277.       else
  1278.       {
  1279.         v7->m_bFloatingMoveMode = 0;
  1280.         bIsFloating = 0;
  1281.         nSurfaceHeight = 0;
  1282.         v46 = v7->m_data;
  1283.         z = v46->m_Pos.z;
  1284.         if ( z <= this->m_vMidDest.z )
  1285.           z = this->m_vMidDest.z;
  1286.         vTo.z = z;
  1287.         if ( v46->m_moveType == CMT_FLY )
  1288.           goto LABEL_57;
  1289.         v47 = CWorld::Inst();
  1290.         v48 = v47->GetGeo(v47);
  1291.         z = (double)(int)CGeoData::FindNearGround(v48, (int)vTo.x, (int)vTo.y, (int)vTo.z);
  1292.       }
  1293.       vTo.z = z;
  1294.     }
  1295. LABEL_57:
  1296.     v49 = (double *)v7->m_data;
  1297.     v50 = sqrt((vTo.x - v49[1]) * (vTo.x - v49[1]) + (vTo.y - v49[2]) * (vTo.y - v49[2]) + (z - v49[3]) * (z - v49[3]));
  1298.     v51 = CWorld::Inst();
  1299.     v52 = v7->m_data;
  1300.     v53 = v51->GetGeo(v51);
  1301.     if ( !CGeoData::MoveStraightTest(v53, &v52->m_Pos, &vTo, v50, bIsFloating, nSurfaceHeight) )
  1302.       FVector::operator=(&vTo, &v7->m_data->m_Pos);
  1303.     if ( v7->IsPC(v7) && v7->CastUser(v7)->m_bRestartState )
  1304.       goto LABEL_75;
  1305.     if ( v7->m_SkillMod.m_nBlockMoveCount || !v7->m_data->m_bCanMove || !v7->m_SkillMod.m_bCanAct )
  1306.     {
  1307.       v54 = v7->m_data;
  1308.       v55 = v7->GetController(v7);
  1309.       CCreatureController::ActionBroadcastMove(v55, &v54->m_Pos, &vTo);
  1310.     }
  1311.     m_eInterruptActionType = this->m_eInterruptActionType;
  1312.     if ( v7->IsPC(v7) && m_eInterruptActionType == ACT_SKILL )
  1313.     {
  1314.       v57 = v7->m_data;
  1315.       v58 = v7->GetController(v7);
  1316.       CCreatureController::ActionBroadcastMove(v58, &v57->m_Pos, &vTo);
  1317.       this->m_eInterruptActionType = ACT_MAX;
  1318.     }
  1319.     p_vTo = &vTo;
  1320.     v19 = (char *)&v80;
  1321.     goto LABEL_69;
  1322.   }
  1323. LABEL_75:
  1324.   if ( v7->m_SkillMod.m_nBlockMoveCount || !v7->m_data->m_bCanMove || !v7->m_SkillMod.m_bCanAct )
  1325.   {
  1326.     v7->m_data->m_bMoveTrouble = 0;
  1327.     v7->m_data->m_dwPathFindFailCount = 0;
  1328.   }
  1329.   v7->m_bMoving = 0;
  1330.   memset(&v, 0, sizeof(v));
  1331.   FVector::operator=(&v7->m_vMovingDirection, &v);
  1332.   v7->m_nLastTick = GetTickCount();
  1333.   v7->m_nMoveTick = 0;
  1334.   v7->m_data->m_MovingStatus = MSTE_NOT_MOVING;
  1335.   this->m_bPathFinding = 0;
  1336.   CTimer::EndJob(&g_Timer, &JOB_NEWACTION__MOVE_ONEND);
  1337. }
  1338.