Exemple #1
0
 public function deleteNpc($gameId, $intNpcId)
 {
     Locations::deleteLocationsForObject($gameId, 'Npc', $intNpcId);
     Requirements::deleteRequirementsForRequirementObject($gameId, 'Npc', $intNpcId);
     PlayerStateChanges::deletePlayerStateChangesThatRefrenceObject($gameId, 'Npc', $intNpcId);
     Nodes::deleteNodesReferencedByObject($gameId, 'Npc', $intNpcId);
     $query = "DELETE FROM npcs WHERE npc_id = {$intNpcId} AND game_id = {$gameId}";
     $rsResult = Module::query($query);
     if (mysql_error()) {
         return new returnData(3, NULL, "SQL Error");
     }
     $hasDeletedNPC = mysql_affected_rows();
     $query = "DELETE FROM npc_conversations WHERE npc_id = {$intNpcId} AND game_id = {$gameId}";
     $rsResult = Module::query($query);
     if (mysql_error()) {
         return new returnData(3, NULL, "SQL Error");
     }
     if ($hasDeletedNPC) {
         return new returnData(0);
     } else {
         return new returnData(2, 'invalid npc id');
     }
 }