bool spawnSecondPartDynamis(CInstance* instance){ DSP_DEBUG_BREAK_IF(instance==NULL); //get ids from DB const int8* fmtQuery = "SELECT monsterId \ FROM bcnm_instance \ WHERE bcnmId = %u AND instanceNumber = 2"; int32 ret = Sql_Query(SqlHandle, fmtQuery, instance->getID()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnSecondPartDynamis : SQL error - Cannot find any monster IDs for Dynamis %i \n", instance->getID(), instance->getInstanceNumber()); } else{ while(Sql_NextRow(SqlHandle) == SQL_SUCCESS){ uint32 mobid = Sql_GetUIntData(SqlHandle,0); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != NULL) { if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE || PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN) { PMob->PBattleAI->SetLastActionTime(0); PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN); PMob->m_instanceID = instance->getInstanceNumber(); ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,instance->getID(),instance->getInstanceNumber()); instance->addEnemy(PMob, CONDITION_SPAWNED_AT_START & CONDITION_WIN_REQUIREMENT); } else { ShowDebug(CL_CYAN"spawnSecondPartDynamis: <%s> (%u) is alredy spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { ShowDebug("spawnSecondPartDynamis: mob %u not found\n", mobid); } } return true; } return false; }
bool spawnSecondPartDynamis(CBattlefield* battlefield) { DSP_DEBUG_BREAK_IF(battlefield == nullptr); //get ids from DB const int8* fmtQuery = "SELECT monsterId \ FROM bcnm_battlefield \ WHERE bcnmId = %u AND battlefieldNumber = 2"; int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnSecondPartDynamis : SQL error - Cannot find any monster IDs for Dynamis %i \n", battlefield->getID(), battlefield->getBattlefieldNumber()); } else { while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) { uint32 mobid = Sql_GetUIntData(SqlHandle, 0); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != nullptr) { if (!PMob->PAI->IsSpawned()) { PMob->Spawn(); PMob->m_battlefieldID = battlefield->getBattlefieldNumber(); ShowDebug("Spawned %s (%u) id %i inst %i \n", PMob->GetName(), PMob->id, battlefield->getID(), battlefield->getBattlefieldNumber()); battlefield->addEnemy(PMob, CONDITION_SPAWNED_AT_START & CONDITION_WIN_REQUIREMENT); } else { ShowDebug(CL_CYAN"spawnSecondPartDynamis: <%s> (%u) is already spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { ShowDebug("spawnSecondPartDynamis: mob %u not found\n", mobid); } } return true; } return false; }
/*************************************************************** Spawns monsters for the given BCNMID/Instance number by looking at bcnm_instance table for mob ids then spawning them and adding them to the monster list for the given instance. ****************************************************************/ bool spawnMonstersForBcnm(CInstance* instance){ DSP_DEBUG_BREAK_IF(instance==NULL); //get ids from DB const int8* fmtQuery = "SELECT monsterId, conditions \ FROM bcnm_instance \ WHERE bcnmId = %u AND instanceNumber = %u"; int32 ret = Sql_Query(SqlHandle, fmtQuery, instance->getID(), instance->getInstanceNumber()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnMonstersForBcnm : SQL error - Cannot find any monster IDs for BCNMID %i Instance %i \n", instance->getID(), instance->getInstanceNumber()); } else{ while(Sql_NextRow(SqlHandle) == SQL_SUCCESS){ uint32 mobid = Sql_GetUIntData(SqlHandle,0); uint8 condition = Sql_GetUIntData(SqlHandle,1); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != NULL) { PMob->m_instanceID = instance->getInstanceNumber(); PMob->m_bcnmID = instance->getID(); if (condition & CONDITION_SPAWNED_AT_START) { // This condition is needed for some mob at dynamis, else he don't pop if(PMob->PBattleAI->GetCurrentAction() == ACTION_FADE_OUT){ PMob->PBattleAI->SetLastActionTime(0); PMob->PBattleAI->SetCurrentAction(ACTION_NONE); } if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE || PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN) { PMob->PBattleAI->SetLastActionTime(0); PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN); if(strcmp(PMob->GetName(),"Maat")==0){ mobutils::SetupMaat(PMob, (JOBTYPE)instance->getPlayerMainJob()); PMob->m_DropID = 4485; //Give Maat his stealable Warp Scroll // disable players subjob instance->disableSubJob(); // disallow subjob, this will enable for later instance->m_RuleMask &= ~(1 << RULES_ALLOW_SUBJOBS); } //ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,instance->getID(),instance->getInstanceNumber()); instance->addEnemy(PMob, condition); } else { ShowDebug(CL_CYAN"SpawnMobForBcnm: <%s> (%u) is alredy spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { instance->addEnemy(PMob, condition); } } else { ShowDebug("SpawnMobForBcnm: mob %u not found\n", mobid); } } return true; } return false; }
/*************************************************************** Spawns monsters for the given BCNMID/Battlefield number by looking at bcnm_battlefield table for mob ids then spawning them and adding them to the monster list for the given battlefield. ****************************************************************/ bool spawnMonstersForBcnm(CBattlefield* battlefield) { DSP_DEBUG_BREAK_IF(battlefield == nullptr); //get ids from DB const int8* fmtQuery = "SELECT monsterId, conditions \ FROM bcnm_battlefield \ WHERE bcnmId = %u AND battlefieldNumber = %u"; int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID(), battlefield->getBattlefieldNumber()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnMonstersForBcnm : SQL error - Cannot find any monster IDs for BCNMID %i Battlefield %i \n", battlefield->getID(), battlefield->getBattlefieldNumber()); } else { while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) { uint32 mobid = Sql_GetUIntData(SqlHandle, 0); uint8 condition = Sql_GetUIntData(SqlHandle, 1); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != nullptr) { PMob->m_battlefieldID = battlefield->getBattlefieldNumber(); PMob->m_bcnmID = battlefield->getID(); if (condition & CONDITION_SPAWNED_AT_START) { if (!PMob->PAI->IsSpawned()) { PMob->Spawn(); if (strcmp(PMob->GetName(), "Maat") == 0) { mobutils::InitializeMaat(PMob, (JOBTYPE)battlefield->getPlayerMainJob()); // disable players subjob battlefield->disableSubJob(); // disallow subjob, this will enable for later battlefield->m_RuleMask &= ~(1 << RULES_ALLOW_SUBJOBS); } //ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,battlefield->getID(),battlefield->getBattlefieldNumber()); battlefield->addEnemy(PMob, condition); } else { ShowDebug(CL_CYAN"SpawnMobForBcnm: <%s> (%u) is already spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { battlefield->addEnemy(PMob, condition); } } else { ShowDebug("SpawnMobForBcnm: mob %u not found\n", mobid); } } return true; } return false; }