コード例 #1
0
/**
 Test if the money achievements unlock
*/
TEST(AchievementTest, TestMoneyAchievements)
{
    AchievementSystem achievements;
    std::cout << "Created Achievement System" << std::endl;

    std::cout << "Check Initial Achievement System" << std::endl;
    ASSERT_EQ(achievements.getNumUnlocked(), 0);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_MONEY, 20));
    ASSERT_EQ(achievements.getNumUnlocked(), 1);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_MONEY, 499));
    ASSERT_EQ(achievements.getNumUnlocked(), 1);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_MONEY, 500));
    ASSERT_EQ(achievements.getNumUnlocked(), 2);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_MONEY, 1000));
    ASSERT_EQ(achievements.getNumUnlocked(), 3);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_MONEY, 1100));
    ASSERT_EQ(achievements.getNumUnlocked(), 3);
}
コード例 #2
0
/**
 Test if the point achievements unlock.
*/
TEST(AchievementTest, TestPointAchievements)
{

    AchievementSystem achievements;
    std::cout << "Created Achievement System" << std::endl;

    std::cout << "Check Initial Achievement System" << std::endl;
    ASSERT_EQ(achievements.getNumUnlocked(), 0);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_POINTS, 10));
    ASSERT_EQ(achievements.getNumUnlocked(), 1);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_POINTS, 49));
    ASSERT_EQ(achievements.getNumUnlocked(), 1);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_POINTS, 50));
    ASSERT_EQ(achievements.getNumUnlocked(), 2);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_POINTS, 100));
    ASSERT_EQ(achievements.getNumUnlocked(), 3);

    std::cout << "Update Achievement System" << std::endl;
    achievements.update(GameEvent(GameEvent::TYPE_POINTS, 110));
    ASSERT_EQ(achievements.getNumUnlocked(), 3);
}
コード例 #3
0
void PhonemeEditorWidget::save()
{
    blockSignals(true);
    //TODO: gaps between phonemes have to be interpreted as silence (phoneme "x")
    //Save changes to phoneme file
    if (!m_phonemeFileName.isEmpty() && m_saveButton->isEnabled())
    {
        QFile file( QDir(GameEngine::soundResourceDirectory()).absoluteFilePath(m_phonemeFileName) );
        if (file.open(QIODevice::WriteOnly | QIODevice::Truncate))
        {
            QTextStream stream(&file);
            m_phonemeXml.save(stream, 4);
            file.flush();
            file.close();
        }
        else
        {
            QMessageBox::warning(this, tr("Error"), tr("Error opening file %1 for writing:\n\n%2").arg(m_phonemeFileName).arg(file.errorString()));
            return;
        }
    }
    m_saveButton->setEnabled(false);
    GameEngine::sendEvent(m_entityWorldID, &GameEvent(GameEvent::E_SET_PHONEMES_FILE, &GameEventData(qPrintable(m_phonemeFileName)), 0));
    blockSignals(false);
}
コード例 #4
0
void GameLogicComponent::Update()
{
  while (!m_commands.IsEmpty())
  {
    switch ( m_commands.Front().m_id )
    {
      case PlayerInput::e_moveUp:
      {
        // Set paddle speed up
        MovementData data ( m_movement.GetData( m_commands.Front().m_value ) );
        data.m_speed[1] = 2.0f;
        m_movement.SetData( m_commands.Front().m_value, data );
        break; 
      }
      case PlayerInput::e_moveDown:
      {
        // Set paddle speed down
        MovementData data ( m_movement.GetData( m_commands.Front().m_value ) );
        data.m_speed[1] = -2.0f;
        m_movement.SetData( m_commands.Front().m_value, data );
        break;
      }
      case PlayerInput::e_stopMoving:
      {
        // Set paddle speed 0
        MovementData data ( m_movement.GetData( m_commands.Front().m_value ) );
        data.m_speed[1] = 0.0f;
        m_movement.SetData( m_commands.Front().m_value, data );
        break;
      }
      default:
        break;
    }
    m_commands.Pop();
  }
  while (!m_scores.IsEmpty())
  {
    ProcessEvent( GameEvent(m_scores.Front().m_id) );
    m_scores.Pop();
  }
}
コード例 #5
0
ファイル: PhysicsComponent.cpp プロジェクト: CZdravko/Horde
void PhysicsComponent::loadFromXml(const XMLNode* description) {
	GameLog::logMessage("LOADING BULLET FROM XML");
	// Delete old physics representation
	//release();

	Matrix4f objTrans;
	m_owner->executeEvent(&GameEvent(GameEvent::E_TRANSFORMATION, &GameEventData((float*) objTrans.x, 16), this));

	Vec3f t, r, s;
	objTrans.decompose(t, r, s);

	// Parse Physics Node Configuration
	float mass = static_cast<float>(atof(description->getAttribute("mass", "0.0")));

	const char* shape = description->getAttribute("shape", "Box");
	// create collision shape based on the node configuration
	if (shape && _stricmp(shape, "Box") == 0) // Bounding Box Shape
			{
		float dimX = static_cast<float>(atof(description->getAttribute("x", "1.0")));
		float dimY = static_cast<float>(atof(description->getAttribute("y", "1.0")));
		float dimZ = static_cast<float>(atof(description->getAttribute("z", "1.0")));
		// update box settings with node scaling (TODO is this necessary if we already set the scale by using setLocalScaling?)
		//m_collisionShape = new btBoxShape(btVector3(dimX * s.x, dimY * s.y, dimZ * s.z));
		m_collisionShape = new btBoxShape(btVector3(dimX, dimY, dimZ));
	} else if (shape && _stricmp(shape, "Sphere") == 0) // Sphere Shape
			{
		float radius = static_cast<float>(atof(description->getAttribute("radius", "1.0")));
		m_collisionShape = new btSphereShape(radius);
	} else if (shape && _stricmp(shape, "Cylinder") == 0) // Cylinder Shape
			{
		float radius0 = static_cast<float>(atof(description->getAttribute("radius", "1.0")));
		float height = static_cast<float>(atof(description->getAttribute("height", "1.0")));
		m_collisionShape = new btCylinderShape(btVector3(radius0, height, radius0));
	} else // Mesh Shape
	{
		MeshData meshData;
		GameEvent meshEvent(GameEvent::E_MESH_DATA, &meshData, this);
		// get mesh data from graphics engine
		m_owner->executeEvent(&meshEvent);

		if (meshData.VertexBase && (meshData.TriangleBase32 || meshData.TriangleBase16)) {
			// Create new mesh in physics engine
			m_btTriangleMesh = new btTriangleMesh();
			int offset = 3;
			if (meshData.TriangleMode == 5) // Triangle Strip
				offset = 1;

			// copy mesh from graphics to physics
			bool index16 = false;
			if (meshData.TriangleBase16)
				index16 = true;
			for (unsigned int i = 0; i < meshData.NumTriangleIndices - 2; i += offset) {
				unsigned int index1 = index16 ? (meshData.TriangleBase16[i] - meshData.VertRStart) * 3 : (meshData.TriangleBase32[i] - meshData.VertRStart) * 3;
				unsigned int index2 = index16 ? (meshData.TriangleBase16[i + 1] - meshData.VertRStart) * 3 : (meshData.TriangleBase32[i + 1] - meshData.VertRStart) * 3;
				unsigned int index3 = index16 ? (meshData.TriangleBase16[i + 2] - meshData.VertRStart) * 3 : (meshData.TriangleBase32[i + 2] - meshData.VertRStart) * 3;
				m_btTriangleMesh->addTriangle(btVector3(meshData.VertexBase[index1], meshData.VertexBase[index1 + 1], meshData.VertexBase[index1 + 2]),
						btVector3(meshData.VertexBase[index2], meshData.VertexBase[index2 + 1], meshData.VertexBase[index2 + 2]),
						btVector3(meshData.VertexBase[index3], meshData.VertexBase[index3 + 1], meshData.VertexBase[index3 + 2]));
			}

			bool useQuantizedAabbCompression = true;

			if (mass > 0) {
				//btGImpactMeshShape* shape = new btGImpactMeshShape(m_btTriangleMesh);

				btGImpactConvexDecompositionShape* shape = new btGImpactConvexDecompositionShape(m_btTriangleMesh, btVector3(1.f, 1.f, 1.f), btScalar(0.1f), true);

				shape->updateBound();

				//btCollisionDispatcher* dispatcher = static_cast<btCollisionDispatcher *>(Physics::instance()->dispatcher());
				//btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);

				m_collisionShape = shape;

				//m_collisionShape = new btConvexTriangleMeshShape(m_btTriangleMesh);
			} else
				// BvhTriangleMesh can be used only for static objects
				m_collisionShape = new btBvhTriangleMeshShape(m_btTriangleMesh, useQuantizedAabbCompression);
		} else {
			GameLog::errorMessage("The mesh data for the physics representation couldn't be retrieved");
			return;
		}
	}

	GameLog::logMessage("PARSED SHAPE FROM XML");

	bool kinematic = _stricmp(description->getAttribute("kinematic", "false"), "true") == 0 || _stricmp(description->getAttribute("kinematic", "0"), "1") == 0;

	bool nondynamic = _stricmp(description->getAttribute("static", "false"), "true") == 0 || _stricmp(description->getAttribute("static", "0"), "1") == 0;

	bool ragdoll = _stricmp(description->getAttribute("ragdoll", "false"), "true") == 0 || _stricmp(description->getAttribute("ragdoll", "0"), "1") == 0;
	// Create initial transformation without scale
	btTransform tr;
	tr.setIdentity();
	tr.setRotation(btQuaternion(r.x, r.y, r.z));

	btMatrix3x3 rot = tr.getBasis();

	XMLNode offsetXMLNode = description->getChildNode("Offset");

	if (!offsetXMLNode.isEmpty()) {
		lX = static_cast<float>(atof(offsetXMLNode.getAttribute("lX", "0.0")));
		lY = static_cast<float>(atof(offsetXMLNode.getAttribute("lY", "0.0")));
		lZ = static_cast<float>(atof(offsetXMLNode.getAttribute("lZ", "0.0")));
	}

	btVector3 offset = btVector3(lX * s.x, lY * s.y, lZ * s.z);

	tr.setOrigin(btVector3(t.x, t.y, t.z) + rot * offset);
	// Set local scaling in collision shape because Bullet does not support scaling in the world transformation matrices
	m_collisionShape->setLocalScaling(btVector3(s.x, s.y, s.z));
	btVector3 localInertia(0, 0, 0);
	//rigidbody is dynamic if and only if mass is non zero otherwise static
	if (mass != 0)
		m_collisionShape->calculateLocalInertia(mass, localInertia);
	if (mass != 0 || kinematic)
		//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
		m_motionState = new btDefaultMotionState(tr);

	btRigidBody::btRigidBodyConstructionInfo rbInfo(mass, m_motionState, m_collisionShape, localInertia);
	rbInfo.m_startWorldTransform = tr;
	//rbInfo.m_restitution = btScalar( atof(description->getAttribute("restitution", "0")) );
	//rbInfo.m_friction = btScalar( atof(description->getAttribute("static_friction", "0.5")) );
	// Threshold for deactivation of objects (if movement is below this value the object gets deactivated)
	//rbInfo.m_angularSleepingThreshold = 0.8f;
	//rbInfo.m_linearSleepingThreshold = 0.8f;

	m_rigidBody = new btRigidBody(rbInfo);
	m_rigidBody->setUserPointer(this);
	m_rigidBody->setDeactivationTime(2.0f);

	// Add support for collision detection if mass is zero but kinematic is explicitly enabled
	if (kinematic && mass == 0 && !nondynamic) {
		m_rigidBody->setCollisionFlags(m_rigidBody->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
		m_rigidBody->setActivationState(DISABLE_DEACTIVATION);
	}
	if (nondynamic && mass == 0) {
		m_rigidBody->setCollisionFlags(m_rigidBody->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
	}

	bool isTrigger = _stricmp(description->getAttribute("solid", "true"), "false") == 0 || _stricmp(description->getAttribute("solid", "1"), "0") == 0;
	if (isTrigger) {
		setCollisionResponse(true);
	}

	GameLog::logMessage("I'm a new Physics body: %s my Motion state: %d", m_owner->id().c_str(), m_motionState);
	printf("I'm a new Physics body: %s my Motion state: %d\n", m_owner->id().c_str(), m_motionState);

	if(!ragdoll) Physics::instance()->addObject(this);

	/*Geometry Proxy*/
	XMLNode proxyXMLNode = description->getChildNode("Proxy");
	if (proxyXMLNode.isEmpty())
		return;

	m_proxy = GameModules::gameWorld()->entity(proxyXMLNode.getAttribute("name", ""));

	if (m_proxy) {
		m_proxy->addListener(GameEvent::E_SET_TRANSFORMATION, this);
		m_proxy->addListener(GameEvent::E_SET_TRANSLATION, this);
		m_proxy->addListener(GameEvent::E_SET_ROTATION, this);
		m_proxy->addListener(GameEvent::E_TRANSLATE_LOCAL, this);
		m_proxy->addListener(GameEvent::E_TRANSLATE_GLOBAL, this);
		m_proxy->addListener(GameEvent::E_ROTATE_LOCAL, this);
	} else
		printf("No PROXY FOUND with EntityID: %s\n", proxyXMLNode.getAttribute("name", ""));

	/*Adding constraints*/

	XMLNode constraintXMLNode = description->getChildNode("Constraint");
	if (constraintXMLNode.isEmpty())
		return;

	const char* constraintType = constraintXMLNode.getAttribute("type", "Hinge");
	const char* parentName = constraintXMLNode.getAttribute("parent", "");
	PhysicsComponent* parent = getParent(parentName);

	if (!parent) {
		printf("NO PARENT FOUND\n");
		return;
	}

	XMLNode transformXMLNode = constraintXMLNode.getChildNode("TransformA");
	float qX = static_cast<float>(atof(transformXMLNode.getAttribute("qx", "1.0")));
	float qY = static_cast<float>(atof(transformXMLNode.getAttribute("qy", "1.0")));
	float qZ = static_cast<float>(atof(transformXMLNode.getAttribute("qz", "1.0")));
	float qW = static_cast<float>(atof(transformXMLNode.getAttribute("qw", "1.0")));
	float vX = static_cast<float>(atof(transformXMLNode.getAttribute("vx", "1.0")));
	float vY = static_cast<float>(atof(transformXMLNode.getAttribute("vy", "1.0")));
	float vZ = static_cast<float>(atof(transformXMLNode.getAttribute("vz", "1.0")));
	btTransform transformA;
	transformA.setIdentity();
	printf("%f \t %f \t %f  \n ", qX, qY, qZ);
	transformA.getBasis().setEulerZYX(qZ, qY, qX);
//	transformA.getBasis().setEulerZYX(M_PI_2,0,0);
	transformA.setOrigin(btVector3(vX * s.x, vY * s.y, vZ * s.z));
//	printf("%f \t %f \t %f \t %s \n ", vX*s.x, vY*s.y, vZ*s.z, m_owner ? m_owner->id().c_str() : "no name");
//	btTransform transformA = btTransform(btQuaternion(qX, qY, qZ, qW), btVector3(vX*s.x, vY*s.y, vZ*s.z));

	transformXMLNode = constraintXMLNode.getChildNode("TransformB");
	qX = static_cast<float>(atof(transformXMLNode.getAttribute("qx", "1.0")));
	qY = static_cast<float>(atof(transformXMLNode.getAttribute("qy", "1.0")));
	qZ = static_cast<float>(atof(transformXMLNode.getAttribute("qz", "1.0")));
	qW = static_cast<float>(atof(transformXMLNode.getAttribute("qw", "1.0")));
	vX = static_cast<float>(atof(transformXMLNode.getAttribute("vx", "1.0")));
	vY = static_cast<float>(atof(transformXMLNode.getAttribute("vy", "1.0")));
	vZ = static_cast<float>(atof(transformXMLNode.getAttribute("vz", "1.0")));
//	btTransform transformB = btTransform(btQuaternion(qX, qY, qZ, qW), btVector3(vX*s.x, vY*s.y, vZ*s.z));
	btTransform transformB;
	transformB.setIdentity();
	transformB.getBasis().setEulerZYX(qZ, qY, qX);
//	transformB.getBasis().setEulerZYX(M_PI_2,0,0);
	transformB.setOrigin(btVector3(vX * s.x, vY * s.y, vZ * s.z));

	XMLNode limitXMLNode = constraintXMLNode.getChildNode("Limit");

	if (_stricmp(constraintType, "Hinge") == 0) {
		btHingeConstraint* parentConstraint = new btHingeConstraint(*(parent->rigidBody()), *m_rigidBody, transformA, transformB);
		float low = static_cast<float>(atof(limitXMLNode.getAttribute("low", "0.0")));
		float high = static_cast<float>(atof(limitXMLNode.getAttribute("high", "0.75")));
		float softness = static_cast<float>(atof(limitXMLNode.getAttribute("softness", "0.9")));
		float biasFactor = static_cast<float>(atof(limitXMLNode.getAttribute("biasFactor", "0.3")));
		float relaxationFactor = static_cast<float>(atof(limitXMLNode.getAttribute("relaxationFactor", "1.0")));

		parentConstraint->setLimit(low, high, softness, biasFactor, relaxationFactor);
		m_parentConstraint = parentConstraint;
	} else if (_stricmp(constraintType, "ConeTwist") == 0) {
		btConeTwistConstraint* parentConstraint = new btConeTwistConstraint(*(parent->rigidBody()), *m_rigidBody, transformA, transformB);
		float swingSpan1 = static_cast<float>(atof(limitXMLNode.getAttribute("swingSpan1", "1.0")));
		float swingSpan2 = static_cast<float>(atof(limitXMLNode.getAttribute("swingSpan2", "1.0")));
		float twistSpan = static_cast<float>(atof(limitXMLNode.getAttribute("twistSpan", "1.0")));
		float softness = static_cast<float>(atof(limitXMLNode.getAttribute("softness", "0.9")));
		float biasFactor = static_cast<float>(atof(limitXMLNode.getAttribute("biasFactor", "0.3")));
		float relaxationFactor = static_cast<float>(atof(limitXMLNode.getAttribute("relaxationFactor", "1.0")));

		parentConstraint->setLimit(swingSpan1, swingSpan2, twistSpan, softness, biasFactor, relaxationFactor);
		m_parentConstraint = parentConstraint;
	}

	if(!ragdoll) Physics::instance()->addConstraint(m_parentConstraint);

}
コード例 #6
0
ファイル: GameEventMgr.cpp プロジェクト: Lbniese/AscEmu
void GameEventMgr::LoadFromDB()
{
    // Clean event_saves from CharacterDB
    Log.Notice("GameEventMgr", "Start cleaning event_save");
    {
        const char* cleanEventSaveQuery = "DELETE FROM event_save WHERE state<>4";
        CharacterDatabase.Execute(cleanEventSaveQuery);
    }
    // Loading event_names
    {
        const char* loadAllEventsQuery = "SELECT entry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence,\
                                          length, holiday, description, world_event, announce\
                                          FROM event_names WHERE entry > 0";
        QueryResult* result = WorldDatabase.Query(loadAllEventsQuery);
        if (!result)
        {
            //mGameEvent.clear();
            Log.Error("GameEventMgr", "Query failed: %s", loadAllEventsQuery);
            return;
        }

        uint32 pCount = 0;
        do
        {
            Field* field = result->Fetch();

            EventNamesQueryResult dbResult;
            dbResult.entry = field[0].GetUInt32();
            dbResult.start_time = field[1].GetUInt32();
            dbResult.end_time = field[2].GetUInt32();
            dbResult.occurence = field[3].GetUInt32();
            dbResult.length = field[4].GetUInt32();
            dbResult.holiday_id = HolidayIds(field[5].GetUInt32());
            dbResult.description = field[6].GetString();
            dbResult.world_event = GameEventState(field[7].GetUInt8());
            dbResult.announce = field[8].GetUInt8();

            GameEvent gameEvent = GameEvent(dbResult);

            //if (gameEvent.isValid())
            //{
                mGameEvents.insert(std::make_pair(dbResult.entry, new GameEvent(dbResult)));
                Log.Debug("GameEventMgr", "%s, Entry: %u, State: %u, Holiday: %u loaded", dbResult.description.c_str(), dbResult.entry, dbResult.world_event, dbResult.holiday_id);
                ++pCount;
            //}
            //else
            //{
            //    Log.Debug("GameEventMgr", "%s game event Entry: %u isn't a world event and has length = 0, thus it can't be used.", dbResult.description.c_str(), dbResult.entry);
            //}
        } while (result->NextRow());
        delete result;
        Log.Success("GameEventMgr", "%u events loaded from table event_names", pCount);
    }
    // Loading event_saves from CharacterDB
    Log.Notice("GameEventMgr", "Start loading event_save");
    {
        const char* loadEventSaveQuery = "SELECT event_entry, state, next_start FROM event_save";
        bool success = false;
        QueryResult* result = CharacterDatabase.Query(&success, loadEventSaveQuery);

        if (!success)
        {
            Log.Error("GameEventMgr", "Query failed: %s", loadEventSaveQuery);
            return;
        }

        uint32 pCount = 0;
        if (result)
        {
            do
            {
                Field* field = result->Fetch();
                uint32 event_id = field[0].GetUInt8();

                auto gameEvent = GetEventById(event_id);
                if (gameEvent == nullptr)
                {
                    Log.Error("GameEventMgr", "Could not find event for event_save entry %u", event_id);
                    continue;
                }

                gameEvent->state = (GameEventState)(field[1].GetUInt8());
                gameEvent->nextstart = time_t(field[2].GetUInt32());

                ++pCount;

            } while (result->NextRow());
            delete result;
        }

        Log.Success("GameEventMgr", "Loaded %u saved events loaded from table event_saves", pCount);
    }
    // Loading event_creature from WorldDB
    Log.Notice("GameEventMgr", "Start loading game event creature spawns");
    {
        const char* loadEventCreatureSpawnsQuery = "SELECT event_entry, id, entry, map, position_x, position_y, position_z, \
                                                    orientation, movetype, displayid, faction, flags, bytes0, bytes1, bytes2, \
                                                    emote_state, npc_respawn_link, channel_spell, channel_target_sqlid, \
                                                    channel_target_sqlid_creature, standstate, death_state, mountdisplayid, \
                                                    slot1item, slot2item, slot3item, CanFly, phase, waypoint_group \
                                                    FROM event_creature_spawns";
        bool success = false;
        QueryResult* result = WorldDatabase.Query(&success, loadEventCreatureSpawnsQuery);
        if (!success)
        {
            Log.Error("GameEventMgr", "Query failed: %s", loadEventCreatureSpawnsQuery);
            return;
        }

        uint32 pCount = 0;
        if (result)
        {
            do
            {
                Field* field = result->Fetch();

                uint32 event_id = field[0].GetUInt32();

                auto gameEvent = GetEventById(event_id);
                if (gameEvent == nullptr)
                {
                    Log.Error("GameEventMgr", "Could not find event for event_creature_spawns entry %u", event_id);
                    continue;
                }

                EventCreatureSpawnsQueryResult dbResult;
                dbResult.event_entry = field[0].GetUInt32();
                dbResult.id = field[1].GetUInt32();
                dbResult.entry = field[2].GetUInt32();
                auto creature_info = sMySQLStore.GetCreatureInfo(dbResult.entry);
                if (creature_info == nullptr)
                {
                    Log.Error("GameEventMgr", "Could not create CreatureSpawn for invalid entry %u (missing in table creature_names)", dbResult.entry);
                    continue;
                }
                dbResult.map_id = field[3].GetUInt16();
                dbResult.position_x = field[4].GetFloat();
                dbResult.position_y = field[5].GetFloat();
                dbResult.position_z = field[6].GetFloat();
                dbResult.orientation = field[7].GetFloat();
                dbResult.movetype = field[8].GetUInt8();
                dbResult.displayid = field[9].GetUInt32();
                dbResult.faction = field[10].GetUInt32();
                dbResult.flags = field[11].GetUInt32();
                dbResult.bytes0 = field[12].GetUInt32();
                dbResult.bytes1 = field[13].GetUInt32();
                dbResult.bytes2 = field[14].GetUInt32();
                dbResult.emote_state = field[15].GetUInt16();
                dbResult.npc_respawn_link = field[16].GetUInt32();
                dbResult.channel_spell = field[17].GetUInt32();
                dbResult.channel_target_sqlid = field[18].GetUInt32();
                dbResult.channel_target_sqlid_creature = field[19].GetUInt32();
                dbResult.standstate = field[20].GetUInt8();
                dbResult.death_state = field[21].GetUInt8();
                dbResult.mountdisplayid = field[22].GetUInt32();
                dbResult.slot1item = field[23].GetUInt32();
                dbResult.slot2item = field[24].GetUInt32();
                dbResult.slot3item = field[25].GetUInt32();
                dbResult.CanFly = field[26].GetUInt16();
                dbResult.phase = field[27].GetUInt32();
                dbResult.waypoint_group = field[28].GetUInt32();

                gameEvent->npc_data.push_back(dbResult);

                ++pCount;

                //mNPCGuidList.insert(NPCGuidList::value_type(event_id, id));

            } while (result->NextRow());
            delete result;
        }
        Log.Success("GameEventMgr", "%u creature spawns for %u events from table event_creature_spawns loaded.", pCount, mGameEvents.size());
    }
    // Loading event_gameobject from WorldDB
    Log.Notice("GameEventMgr", "Start loading game event gameobject spawns");
    {
        const char* loadEventGameobjectSpawnsQuery = "SELECT event_entry, id, entry, map, position_x, position_y, \
                                                      position_z, facing, orientation1, orientation2, orientation3, \
                                                      orientation4, state, flags, faction, scale, respawnNpcLink, phase, \
                                                      overrides FROM event_gameobject_spawns";
        bool success = false;
        QueryResult* result = WorldDatabase.Query(&success, loadEventGameobjectSpawnsQuery);
        if (!success)
        {
            Log.Error("GameEventMgr", "Query failed: %s", loadEventGameobjectSpawnsQuery);
            return;
        }

        uint32 pCount = 0;
        if (result)
        {
            do
            {
                Field* field = result->Fetch();
                uint32 event_id = field[0].GetUInt32();

                auto gameEvent = GetEventById(event_id);
                if (gameEvent == nullptr)
                {
                    Log.Error("GameEventMgr", "Could not find event for event_gameobject_spawns entry %u", event_id);
                    continue;
                }

                EventGameObjectSpawnsQueryResult dbResult;
                dbResult.event_entry = field[0].GetUInt32();
                dbResult.id = field[1].GetUInt32();
                dbResult.entry = field[2].GetUInt32();
                auto gameobject_info = sMySQLStore.GetGameObjectInfo(dbResult.entry);
                if (gameobject_info == nullptr)
                {
                    Log.Error("GameEventMgr", "Could not create GameobjectSpawn for invalid entry %u (missing in table gameobject_names)", dbResult.entry);
                    continue;
                }
                dbResult.map_id = field[3].GetUInt32();
                dbResult.position_x = field[4].GetFloat();
                dbResult.position_y = field[5].GetFloat();
                dbResult.position_z = field[6].GetFloat();
                dbResult.facing = field[7].GetFloat();
                dbResult.orientation1 = field[8].GetFloat();
                dbResult.orientation2 = field[9].GetFloat();
                dbResult.orientation3 = field[10].GetFloat();
                dbResult.orientation4 = field[11].GetFloat();
                dbResult.state = field[12].GetUInt32();
                dbResult.flags = field[13].GetUInt32();
                dbResult.faction = field[14].GetUInt32();
                dbResult.scale = field[15].GetFloat();
                dbResult.stateNpcLink = field[16].GetFloat();
                dbResult.phase = field[17].GetUInt32();
                dbResult.overrides = field[18].GetUInt32();

                gameEvent->gameobject_data.push_back(dbResult);

                ++pCount;

                //mGOBGuidList.insert(GOBGuidList::value_type(event_id, id));

            } while (result->NextRow());
            delete result;
        }
        Log.Success("GameEventMgr", "%u gameobject spawns for %u events from table event_gameobject_spawns loaded.", pCount, mGameEvents.size());
    }

    StartArenaEvents();
}