Exemple #1
0
bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Unit* owner)
{
    SetMap(cPos.GetMap());

    Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;

    if (!CreateFromProto(guidlow, cinfo, team))
        return false;

    // special model selection case for totems
    if (owner->GetTypeId() == TYPEID_PLAYER)
    {
        if (uint32 modelid_race = sObjectMgr.GetModelForRace(GetNativeDisplayId(), owner->getRaceMask()))
            SetDisplayId(modelid_race);
    }

    cPos.SelectFinalPoint(this);

    // totem must be at same Z in case swimming caster and etc.
    if (fabs(cPos.m_pos.z - owner->GetPositionZ()) > 5.0f)
        cPos.m_pos.z = owner->GetPositionZ();

    if (!cPos.Relocate(this))
        return false;

    // 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 (InstanceData* iData = GetMap()->GetInstanceData())
        iData->OnCreatureCreate(this);

    LoadCreatureAddon(false);

    return true;
}
bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name, int32 Time)
{
    // Lookup GameobjectInfo
    if (!CreateFromProto(EntryID, 0, 0, 0, 0, 0))
        return false;

    // Override these flags to avoid mistakes in proto
    SetFlags(40);
    SetAnimProgress(100);

    //Maybe this would be the perfect way, so there would be no extra checks in Object.cpp:
    //but these fields seems to change often and between server flavours (ArcEmu, Aspire, name another one) - by: VLack aka. VLsoft
    if (pInfo)
        pInfo->Type = GAMEOBJECT_TYPE_TRANSPORT;
    else
        LOG_ERROR("Transporter id[%i] name[%s] - can't set GAMEOBJECT_TYPE - it will behave badly!", EntryID, Name);

    m_overrides = GAMEOBJECT_INFVIS | GAMEOBJECT_ONMOVEWIDE; //Make it forever visible on the same map

    // Set period
    m_period = Time;

    // Generate waypoints
    if (!GenerateWaypoints())
        return false;

    // Set position
    SetMapId(m_WayPoints[0].mapid);
    SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0);
    SetLevel(m_period);
    // Add to world
    AddToWorld();

    return true;
}
Exemple #3
0
bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name, int32 Time)
{
	// Lookup GameobjectInfo
	if(!CreateFromProto(EntryID,0,0,0,0,0))
		return false;
	
	// Override these flags to avoid mistakes in proto
	SetUInt32Value(GAMEOBJECT_FLAGS,40);
	SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	
	
	// Set period
	m_period = Time;

	// Generate waypoints
	if(!GenerateWaypoints())
		return false;

	// Set position
	SetMapId(m_WayPoints[0].mapid);
	SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0);

	// Add to world
	AddToWorld();

	return true;
}
bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, Unit* owner)
{
    SetMap(cPos.GetMap());

    Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;

    if (!CreateFromProto(guidlow, cinfo, team))
        { return false; }

    cPos.SelectFinalPoint(this);

    // totem must be at same Z in case swimming caster and etc.
    if (fabs(cPos.m_pos.z - owner->GetPositionZ()) > 5.0f)
        { cPos.m_pos.z = owner->GetPositionZ(); }

    if (!cPos.Relocate(this))
        { return false; }

    // 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 (InstanceData* iData = GetMap()->GetInstanceData())
        { iData->OnCreatureCreate(this); }

    LoadCreatureAddon(false);

    return true;
}
Exemple #5
0
bool GameObject::Load(GOSpawn *spawn)
{
	if(!CreateFromProto(spawn->entry,0,spawn->x,spawn->y,spawn->z,spawn->facing))
		return false;

	spawnid = spawn->id;
	m_spawn = spawn;
	SetFloatValue(GAMEOBJECT_ROTATION,spawn->o);
	SetFloatValue(GAMEOBJECT_ROTATION_01 ,spawn->o1);
	SetFloatValue(GAMEOBJECT_ROTATION_02 ,spawn->o2);
	SetFloatValue(GAMEOBJECT_ROTATION_03 ,spawn->o3);
	SetUInt32Value(GAMEOBJECT_FLAGS,spawn->flags);
//	SetUInt32Value(GAMEOBJECT_LEVEL,spawn->level);
	SetUInt32Value(GAMEOBJECT_STATE,spawn->state);	
	if(spawn->faction)
	{
		SetUInt32Value(GAMEOBJECT_FACTION,spawn->faction);
		m_faction = sFactionTmpStore.LookupEntry(spawn->faction);
		if(m_faction)
			m_factionDBC = sFactionStore.LookupEntry(m_faction->Faction);
	}
	SetFloatValue(OBJECT_FIELD_SCALE_X,spawn->scale);
	_LoadQuests();
	CALL_GO_SCRIPT_EVENT(this, OnCreate)();
	CALL_GO_SCRIPT_EVENT(this, OnSpawn)();

	InitAI();

	_LoadQuests();
	return true;
}
bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name)
{
	// Lookup GameobjectInfo
	if(!CreateFromProto(EntryID,0,0,0,0,0))
		return false;
	
	SetUInt32Value(GAMEOBJECT_FLAGS,40);
	SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);

	//Maybe this would be the perfect way, so there would be no extra checks in Object.cpp:
	SetByte( GAMEOBJECT_BYTES_1, 0, GAMEOBJECT_TYPE_TRANSPORT );
	//but these fields seems to change often and between server flavours (ArcEmu, Aspire, name another one) - by: VLack aka. VLsoft
	if( pInfo )
		pInfo->Type = GAMEOBJECT_TYPE_TRANSPORT;
	else
		sLog.outString("Transporter id[%i] name[%s] - can't set GAMEOBJECT_TYPE - it will behave badly!",EntryID,Name);

	// Generate waypoints
	if(!GenerateWaypoints())
		return false;

	// Set position
	SetMapId(m_WayPoints[0].mapid);
	SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0);

	SetUInt32Value(GAMEOBJECT_LEVEL, m_period); // ITS OVER 9000!!!!! No, really, it is.

	// Add to world
	AddToWorld();

	return true;
}
Exemple #7
0
bool GameObject::Load(GOSpawn *spawn)
{
	if(!CreateFromProto(spawn->entry,0,spawn->x,spawn->y,spawn->z,spawn->facing,spawn->orientation1,spawn->orientation2,spawn->orientation3,spawn->orientation4))
		return false;

	m_phaseMode = spawn->phase;
	m_spawn = spawn;
	SetUInt32Value(GAMEOBJECT_FLAGS,spawn->flags);
	SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_STATE, spawn->state);
	if(spawn->faction)
	{
		SetUInt32Value(GAMEOBJECT_FACTION,spawn->faction);
		m_faction = dbcFactionTemplate.LookupEntry(spawn->faction);
		if(m_faction)
			m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction);
	}
	SetFloatValue(OBJECT_FIELD_SCALE_X,spawn->scale);

	if( spawn->flags & GO_FLAG_IN_USE || spawn->flags & GO_FLAG_LOCKED )
		SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_ANIMPROGRESS, 100);

	CALL_GO_SCRIPT_EVENT(TO_GAMEOBJECT(this), OnCreate)();

	_LoadQuests();
	return true;
}
Exemple #8
0
bool Creature::Create (uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 Entry)
{
    respawn_cord[0] = x;
    respawn_cord[1] = y;
    respawn_cord[2] = z;
    SetMapId(mapid);
    Relocate(x,y,z);

    if(!IsPositionValid())
    {
        sLog.outError("ERROR: Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",guidlow,Entry,x,y);
        return false;
    }

    SetOrientation(ang);
    //oX = x;     oY = y;    dX = x;    dY = y;    m_moveTime = 0;    m_startMove = 0;
    return  CreateFromProto(guidlow, Entry);
}
Exemple #9
0
bool Transporter::Create(uint32 entry, int32 Time)
{
    auto gameobject_info = sMySQLStore.getGameObjectProperties(entry);
    if (gameobject_info == nullptr)
    {
        LOG_ERROR("Failed to create Transporter with go entry %u. Invalid gameobject!", entry);
        return false;
    }

    // Create transport
    float x, y, z, o;
    uint32 mapid;
    x = m_WayPoints[0].x;
    y = m_WayPoints[0].y;
    z = m_WayPoints[0].z;
    mapid = m_WayPoints[0].mapid;
    o = m_WayPoints[0].o;

    if (!CreateFromProto(entry, mapid, x, y, z, o))
        return false;

    // Override these flags to avoid mistakes in proto
    setFlags(GO_FLAG_TRANSPORT | GO_FLAG_NEVER_DESPAWN);
    setAnimationProgress(255);

    setOType(GAMEOBJECT_TYPE_MO_TRANSPORT);

    m_overrides = GAMEOBJECT_INFVIS | GAMEOBJECT_ONMOVEWIDE;

    m_period = Time;

    // Set position
    SetMapId(mapid);
    SetPosition(x, y, z, o);
    setLevel(m_period);

    return true;
}
bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name)
{
    // Try to spawn the Gameobject, no need for locations.
    if(!CreateFromProto(EntryID,0,0.0f,0.0f,0.0f,0.0f))
        return false;

    SetUInt32Value(GAMEOBJECT_FLAGS,40);
    SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);

    // Generate waypoints
    if(!GenerateWaypoints())
        return false;

    // Set position
    SetMapId(m_WayPoints[0].mapid);
    SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0);

    SetUInt32Value(GAMEOBJECT_LEVEL, m_period); // ITS OVER 9000!!!!! No, really, it is.

    // Add to world
    AddToWorld();

    return true;
}