bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32 time_diff) { CreatureTraveller traveller(owner); i_destinationHolder.UpdateTraveller(traveller, time_diff); if (time_diff > i_travel_timer) { owner.AddUnitMovementFlag(MOVEMENTFLAG_WALKING); // restore orientation of not moving creature at returning to home if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) { //sLog->outDebug("Entering HomeMovement::GetDestination(z, y, z)"); owner.SetOrientation(ori); WorldPacket packet; owner.BuildHeartBeatMsg(&packet); owner.SendMessageToSet(&packet, false); } owner.ClearUnitState(UNIT_STAT_EVADE); owner.LoadCreaturesAddon(true); owner.AI()->JustReachedHome(); return false; } i_travel_timer -= time_diff; return true; }
bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff) { CreatureTraveller traveller(owner); i_destinationHolder.UpdateTraveller(traveller, time_diff); if (time_diff > i_travel_timer) { owner.AddUnitMovementFlag(MOVEFLAG_WALK_MODE); // restore orientation of not moving creature at returning to home if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) { owner.SetOrientation(ori); WorldPacket packet; owner.BuildHeartBeatMsg(&packet); owner.SendMessageToSet(&packet, false); } owner.AI()->JustReachedHome(); return false; } i_travel_timer -= time_diff; return true; }
bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff) { CreatureTraveller traveller( owner); if (i_destinationHolder.UpdateTraveller(traveller, time_diff, false)) { if (!IsActive(owner)) // force stop processing (movement can move out active zone with cleanup movegens list) return true; // not expire now, but already lost } if (time_diff > i_travel_timer) { owner.AddSplineFlag(SPLINEFLAG_WALKMODE); // restore orientation of not moving creature at returning to home if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) { if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) { owner.SetOrientation(data->orientation); WorldPacket packet; owner.BuildHeartBeatMsg(&packet); owner.SendMessageToSet(&packet, false); } } owner.LoadCreatureAddon(true); owner.AI()->JustReachedHome(); return false; } i_travel_timer -= time_diff; return true; }
bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff) { CreatureTraveller traveller( owner); i_destinationHolder.UpdateTraveller(traveller, time_diff, false); if (time_diff > i_travel_timer) { owner.AddSplineFlag(SPLINEFLAG_WALKMODE); // restore orientation of not moving creature at returning to home if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) { if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) { owner.SetOrientation(data->orientation); WorldPacket packet; owner.BuildHeartBeatMsg(&packet); owner.SendMessageToSet(&packet, false); } } owner.AI()->JustReachedHome(); return false; } i_travel_timer -= time_diff; return true; }
void Vehicle::InstallAllAccessories() { if(!GetMap()) return; CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo || !cainfo->passengers) return; for (CreatureDataAddonPassengers const* cPassanger = cainfo->passengers; cPassanger->seat_idx != -1; ++cPassanger) { // Continue if seat already taken if(GetPassenger(cPassanger->seat_idx)) continue; uint32 guid = 0; bool isVehicle = false; // Set guid and check whatever it is if(cPassanger->guid != 0) guid = cPassanger->guid; else { CreatureDataAddon const* passAddon; passAddon = ObjectMgr::GetCreatureTemplateAddon(cPassanger->entry); if(passAddon && passAddon->vehicle_id != 0) isVehicle = true; else guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT); } // Create it Creature *pPassenger = new Creature; if(!isVehicle) { uint32 entry = cPassanger->entry; if(entry == 0) { CreatureData const* data = sObjectMgr.GetCreatureData(guid); if(!data) continue; entry = data->id; } if(!pPassenger->Create(guid, GetMap(), GetPhaseMask(), entry, 0)) continue; pPassenger->LoadFromDB(guid, GetMap()); pPassenger->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); GetMap()->Add(pPassenger); pPassenger->AIM_Initialize(); } else pPassenger = (Creature*)SummonVehicle(cPassanger->entry, GetPositionX(), GetPositionY(), GetPositionZ(), 0); // Enter vehicle... pPassenger->EnterVehicle(this, cPassanger->seat_idx, true); // ...and send update. Without this, client wont show this new creature/vehicle... WorldPacket data; pPassenger->BuildHeartBeatMsg(&data); pPassenger->SendMessageToSet(&data, false); } }
bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff) { CreatureTraveller traveller(owner); i_destinationHolder.UpdateTraveller(traveller, time_diff); if (time_diff > i_travel_timer) { float x, y, z; owner.GetRespawnCoord(x, y, z); float myx, myy, myz; owner.GetPosition(myx, myy, myz); if (x != myx || y != myy || z != myz) { Position travelto = owner.GetMap()->getNextPositionOnPathToLocation(myx,myy,myz,x,y,z); uint32 travel_time = i_destinationHolder.SetDestination(traveller, travelto.m_positionX, travelto.m_positionY, travelto.m_positionZ); modifyTravelTime(travel_time); return true; } owner.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); // restore orientation of not moving creature at returning to home if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) { //sLog.outDebug("Entering HomeMovement::GetDestination(z,y,z)"); owner.SetOrientation(ori); WorldPacket packet; owner.BuildHeartBeatMsg(&packet); owner.SendMessageToSet(&packet, false); } owner.clearUnitState(UNIT_STAT_EVADE); owner.AI()->JustReachedHome(); return false; } i_travel_timer -= time_diff; return true; }