bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data) { SetMapId(map->GetId()); SetInstanceId(map->GetInstanceId()); SetPhaseMask(phaseMask,false); CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry); if(!cinfo) { sLog.outErrorDb("Creature entry %u does not exist.", Entry); return false; } Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE); if(!UpdateEntry(Entry, team, data)) return false; if(!vehicleId) { CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo) return false; vehicleId = cainfo->vehicle_id; } if(!SetVehicleId(vehicleId)) return false; LoadCreaturesAddon(); m_regenHealth = false; m_creation_time = getMSTime(); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); //RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); //Notify the map's instance data. //Only works if you create the object in it, not if it is moves to that map. //Normally non-players do not teleport to other maps. if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData()) { ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this); } return true; }
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data) { SetMap(map); SetPhaseMask(phaseMask,false); CreatureInfo const *cinfo = sObjectMgr.GetCreatureTemplate(Entry); if(!cinfo) { sLog.outErrorDb("Creature entry %u does not exist.", Entry); return false; } Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE); if(!UpdateEntry(Entry, team, data)) return false; if(!vehicleId) { CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo) return false; vehicleId = cainfo->vehicle_id; } if(!SetVehicleId(vehicleId)) return false; LoadCreaturesAddon(); m_regenHealth = false; m_creation_time = getMSTime(); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); //RemoveMonsterMoveFlag(MONSTER_MOVE_WALK); //Notify the map's instance data. //Only works if you create the object in it, not if it is moves to that map. //Normally non-players do not teleport to other maps. if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData()) { ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this); } if(m_vehicleInfo->m_powerType == POWER_TYPE_STEAM) { setPowerType(POWER_ENERGY); SetMaxPower(POWER_ENERGY, 100); SetPower(POWER_ENERGY, 100); } else if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) { setPowerType(POWER_ENERGY); SetMaxPower(POWER_ENERGY, 50); SetPower(POWER_ENERGY, 50); } else { for (uint32 i = 0; i < MAX_VEHICLE_SPELLS; ++i) { if(!GetVehicleData()->v_spells[i]) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(GetVehicleData()->v_spells[i]); if(!spellInfo) continue; if(spellInfo->powerType == POWER_MANA) break; if(spellInfo->powerType == POWER_ENERGY) { setPowerType(POWER_ENERGY); SetMaxPower(POWER_ENERGY, 100); SetPower(POWER_ENERGY, 100); break; } } } SetHealth(GetMaxHealth()); InstallAllAccessories(); return true; }