public static function deleteDialog($pack) { $pack->auth->game_id = dbconnection::queryObject("SELECT * FROM dialogs WHERE dialog_id = '{$pack->dialog_id}'")->game_id; $pack->auth->permission = "read_write"; if (!editors::authenticateGameEditor($pack->auth)) { return new return_package(6, NULL, "Failed Authentication"); } dbconnection::query("DELETE FROM dialogs WHERE dialog_id = '{$pack->dialog_id}' LIMIT 1"); //cleanup $scripts = dbconnection::queryArray("SELECT * FROM dialog_scripts WHERE dialog_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($scripts); $i++) { $pack->dialog_script_id = $scripts[$i]->dialog_script_id; dialogs::deleteDialogScript($pack); } $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE dialog_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($options); $i++) { $pack->dialog_option_id = $options[$i]->dialog_option_id; dialogs::deleteDialogOption($pack); } $options = dbconnection::queryArray("SELECT * FROM dialog_options WHERE link_type = 'EXIT_TO_DIALOG' AND link_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($options); $i++) { $pack->dialog_option_id = $options[$i]->dialog_option_id; dialogs::deleteDialogOption($pack); } $tabs = dbconnection::queryArray("SELECT * FROM tabs WHERE type = 'DIALOG' AND content_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($tabs); $i++) { $pack->tab_id = $tabs[$i]->tab_id; tabs::deleteTab($pack); } $tags = dbconnection::queryArray("SELECT * FROM object_tags WHERE object_type = 'DIALOG' AND object_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($tags); $i++) { $pack->object_tag_id = $tags[$i]->object_tag_id; tags::deleteObjectTag($pack); } $instances = dbconnection::queryArray("SELECT * FROM instances WHERE object_type = 'DIALOG' AND object_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($instances); $i++) { $pack->instance_id = $instances[$i]->instance_id; instances::deleteInstance($pack); } $factories = dbconnection::queryArray("SELECT * FROM factories WHERE object_type = 'DIALOG' AND object_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($factories); $i++) { $pack->factory_id = $factories[$i]->factory_id; factories::deleteFactory($pack); } $reqAtoms = dbconnection::queryArray("SELECT * FROM requirement_atoms WHERE requirement = 'PLAYER_VIEWED_DIALOG' AND content_id = '{$pack->dialog_id}'"); for ($i = 0; $i < count($reqAtoms); $i++) { $pack->requirement_atom_id = $reqAtoms[$i]->requirement_atom_id; requirements::deleteRequirementAtom($pack); } games::bumpGameVersion($pack); return new return_package(0); }