public static function create(Dolumar_Underworld_Models_Mission $mission, $global = 0) { $db = Neuron_DB_Database::getInstance(); $global = $global ? '1' : '0'; $id = $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tunderworld_missions\n\t\t\tSET\n\t\t\t\tum_map = '{$db->escape($mission->getMapName())}',\n\t\t\t\tum_mission = '{$db->escape($mission->getObjectiveName())}',\n\t\t\t\tum_global = '{$global}'\n\t\t"); $mission->setId($id); return $mission; }
/** * Return "logger" mission id and create if not defined */ private static function getMissionId(Dolumar_Underworld_Models_Mission $mission) { $db = Neuron_DB_Database::getInstance(); $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tul_m_id\n\t\t\tFROM\n\t\t\t\tunderworld_log_mission\n\t\t\tWHERE\n\t\t\t\tum_id = {$mission->getId()}\n\t\t"); if (count($data) > 0) { $id = $data[0]['ul_m_id']; } else { $id = $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tunderworld_log_mission\n\t\t\t\tSET\n\t\t\t\t\tum_id = {$mission->getId()},\n\t\t\t\t\tul_m_map = '{$db->escape($mission->getMapName())}'\n\t\t\t"); } return $id; }