public event_block[] events_blocks;// = new event_block[15];


    /// <summary>
    /// Initializes a new instance of the <see cref="event_base"/> class.
    /// </summary>
    public event_processor()
    {
        char[] scd_ark;
        char[] scd_ark_file_data;
        if (!DataLoader.ReadStreamFile(Loader.BasePath + GameWorldController.instance.SCD_Ark_File_Selected, out scd_ark_file_data))
        {
            Debug.Log(Loader.BasePath + GameWorldController.instance.SCD_Ark_File_Selected + " File not loaded");
            return;
        }

        int NoOfBlocks = (int)DataLoader.getValAtAddress(scd_ark_file_data, 0, 32);

        events_blocks = new event_block[NoOfBlocks];
        for (int BlockNo = 0; BlockNo <= events_blocks.GetUpperBound(0); BlockNo++)
        {
            long address_pointer = 6;
            int  datalen         = (int)DataLoader.getValAtAddress(scd_ark_file_data, address_pointer + (NoOfBlocks * 4 * 2) + (BlockNo * 4), 32);

            address_pointer = (BlockNo * 4) + 6;
            if ((int)DataLoader.getValAtAddress(scd_ark_file_data, address_pointer, 32) == 0)
            {
                Debug.Log("No Scd.ark data for this level");
            }
            long BlockStart = DataLoader.getValAtAddress(scd_ark_file_data, address_pointer, 32);
            int  j          = 0;
            address_pointer = 0;//Since I am at the start of a fresh array.
            scd_ark         = new char[datalen];
            for (long i = BlockStart; i < BlockStart + datalen; i++)
            {
                scd_ark[j] = scd_ark_file_data[i];
                j++;
            }

            int add_ptr = 0;

            int noOfRows = (int)DataLoader.getValAtAddress(scd_ark, 0, 8);
            if (noOfRows != 0)
            {
                //output = output + "Unknown info 1-325\n";
                events_blocks[BlockNo]             = new event_block();
                events_blocks[BlockNo].eventheader = new int[325];
                for (int i = 1; i < 324; i++)
                {
                    events_blocks[BlockNo].eventheader[i - 1] = (int)DataLoader.getValAtAddress(scd_ark, add_ptr++, 8);
                }

                add_ptr = 326;
                events_blocks[BlockNo].events = new event_base[noOfRows];//Events are cleared after firing.
                int r = 0;
                for (int i = 0; i < events_blocks[BlockNo].events.GetUpperBound(0); i++)
                {
                    //Match event type to proper classes
                    switch ((int)DataLoader.getValAtAddress(scd_ark, add_ptr + 2, 8))
                    {
                    case event_base.RowTypeCondition:
                        events_blocks[BlockNo].events[r] = new event_conditional();
                        break;

                    case event_base.RowTypeSetNPCGoal:
                        events_blocks[BlockNo].events[r] = new event_set_goal();
                        break;

                    case event_base.RowTypeSetNPCGOAL_Alt:
                        events_blocks[BlockNo].events[r] = new event_set_goal_alt();
                        break;

                    case event_base.RowTypeMoveNPC:
                        events_blocks[BlockNo].events[r] = new event_move_npc();
                        break;

                    case event_base.RowTypeKillNPC:
                        events_blocks[BlockNo].events[r] = new event_kill_npc();
                        break;

                    case event_base.RowTypeFireTriggers:
                        events_blocks[BlockNo].events[r] = new event_fire_triggers();
                        break;

                    case event_base.RowTypeScheduled:
                        events_blocks[BlockNo].events[r] = new event_scheduled();
                        break;

                    case event_base.RowTypeRemoveNPC:
                        events_blocks[BlockNo].events[r] = new event_remove_npc();
                        break;

                    case event_base.RowTypeRaceAttidude:
                        events_blocks[BlockNo].events[r] = new event_set_race_attitude();
                        break;

                    case event_base.RowTypeSetProps:
                        events_blocks[BlockNo].events[r] = new event_set_npc_props();
                        break;

                    case event_base.RowTypeKillNPCorRace:
                        events_blocks[BlockNo].events[r] = new event_kill_npc_or_race();
                        break;

                    case event_base.RowTypePlaceNPC:
                        events_blocks[BlockNo].events[r] = new event_place_npc();
                        break;

                    default:
                        events_blocks[BlockNo].events[r] = new event_base();
                        break;
                    }
                    events_blocks[BlockNo].events[r].InitRawData(BlockNo, add_ptr, scd_ark);
                    r++;
                    add_ptr += 16;
                }
            }
        }
        if (GameWorldController.instance.CreateReports)
        {
            WriteEventReport();
        }
    }
    public event_block[] events_blocks;            // = new event_block[15];


    /// <summary>
    /// Initializes a new instance of the <see cref="event_base"/> class.
    /// </summary>
    public event_processor()
    {
        char[] scd_ark;
        char[] scd_ark_file_data;
        if (!DataLoader.ReadStreamFile(Loader.BasePath + GameWorldController.instance.SCD_Ark_File_Selected, out scd_ark_file_data))
        {
            Debug.Log(Loader.BasePath + GameWorldController.instance.SCD_Ark_File_Selected + " File not loaded");
            return;
        }

        int NoOfBlocks = (int)DataLoader.getValAtAddress(scd_ark_file_data, 0, 32);

        events_blocks = new event_block[NoOfBlocks];
        for (int BlockNo = 0; BlockNo <= events_blocks.GetUpperBound(0); BlockNo++)
        {
            long address_pointer = 6;
            int  compressionFlag = (int)DataLoader.getValAtAddress(scd_ark_file_data, address_pointer + (NoOfBlocks * 4) + (BlockNo * 4), 32);
            int  datalen         = (int)DataLoader.getValAtAddress(scd_ark_file_data, address_pointer + (NoOfBlocks * 4 * 2) + (BlockNo * 4), 32);
            int  isCompressed    = (compressionFlag >> 1) & 0x01;
            long AddressOfBlockStart;
            address_pointer = (BlockNo * 4) + 6;
            if ((int)DataLoader.getValAtAddress(scd_ark_file_data, address_pointer, 32) == 0)
            {
                Debug.Log("No Scd.ark data for this level");
            }
            long BlockStart = DataLoader.getValAtAddress(scd_ark_file_data, address_pointer, 32);
            int  j          = 0;
            AddressOfBlockStart = 0;
            address_pointer     = 0;                              //Since I am at the start of a fresh array.
            scd_ark             = new char[datalen];
            for (long i = BlockStart; i < BlockStart + datalen; i++)
            {
                scd_ark[j] = scd_ark_file_data[i];
                j++;
            }

            int add_ptr = 0;

            int noOfRows = (int)DataLoader.getValAtAddress(scd_ark, 0, 8);
            if (noOfRows != 0)
            {
                //output = output + "Unknown info 1-325\n";
                events_blocks[BlockNo]             = new event_block();
                events_blocks[BlockNo].eventheader = new int[325];
                for (int i = 1; i < 324; i++)
                {
                    events_blocks[BlockNo].eventheader[i - 1] = (int)DataLoader.getValAtAddress(scd_ark, add_ptr++, 8);
                }

                add_ptr = 326;
                events_blocks[BlockNo].events = new event_base[noOfRows];                                                //Events are cleared after firing.
                int r = 0;
                for (int i = 0; i < events_blocks[BlockNo].events.GetUpperBound(0); i++)
                {
                    //Match event type to proper classes
                    switch ((int)DataLoader.getValAtAddress(scd_ark, add_ptr + 2, 8))
                    {
                    case event_base.RowTypeCondition:
                        events_blocks[BlockNo].events[r] = new event_conditional();
                        break;

                    case event_base.RowTypeSetNPCGoal:
                        events_blocks[BlockNo].events[r] = new event_set_goal();
                        break;

                    case event_base.RowTypeSetNPCGOAL_Alt:
                        events_blocks[BlockNo].events[r] = new event_set_goal_alt();
                        break;

                    case event_base.RowTypeMoveNPC:
                        events_blocks[BlockNo].events[r] = new event_move_npc();
                        break;

                    case event_base.RowTypeKillNPC:
                        events_blocks[BlockNo].events[r] = new event_kill_npc();
                        break;

                    case event_base.RowTypeFireTriggers:
                        events_blocks[BlockNo].events[r] = new event_fire_triggers();
                        break;

                    case event_base.RowTypeScheduled:
                        events_blocks[BlockNo].events[r] = new event_scheduled();
                        break;

                    case event_base.RowTypeRemoveNPC:
                        events_blocks[BlockNo].events[r] = new event_remove_npc();
                        break;

                    case event_base.RowTypeRaceAttidude:
                        events_blocks[BlockNo].events[r] = new event_set_race_attitude();
                        break;

                    case event_base.RowTypeSetProps:
                        events_blocks[BlockNo].events[r] = new event_set_npc_props();
                        break;

                    case event_base.RowTypeKillNPCorRace:
                        events_blocks[BlockNo].events[r] = new event_kill_npc_or_race();
                        break;

                    case event_base.RowTypePlaceNPC:
                        events_blocks[BlockNo].events[r] = new event_place_npc();
                        break;

                    default:
                        events_blocks[BlockNo].events[r] = new event_base();
                        break;
                    }
                    events_blocks[BlockNo].events[r].InitRawData(BlockNo, add_ptr, scd_ark);

                    //events_blocks[BlockNo].events[r]=new event_base();
                    //events_blocks[BlockNo].events[r].type = (int)DataLoader.getValAtAddress(scd_ark,add_ptr+2,8);
                    //events_blocks[BlockNo].events[r].LevelNo=(int)DataLoader.getValAtAddress(scd_ark,add_ptr+0,8);

                    /*	switch (events_blocks[BlockNo].events[r].type)
                     *      {
                     *      case event_action.RowTypeCondition:
                     *                      //events_blocks[BlockNo].event_actions[r].Enabled =  (1 == (int)DataLoader.getValAtAddress(scd_ark,add_ptr+5,8));//is this wrong
                     *                      events_blocks[BlockNo].event_actions[r].event_variable = (int)DataLoader.getValAtAddress(scd_ark,add_ptr+3,8);
                     *                      events_blocks[BlockNo].event_actions[r].event_isQuest = (1 == (int)DataLoader.getValAtAddress(scd_ark,add_ptr+4,8));
                     *                      break;
                     *      case event_action.RowTypeEvent:
                     *                      events_blocks[BlockNo].event_actions[r].EventTileX=(int)DataLoader.getValAtAddress(scd_ark,add_ptr+3,8);
                     *                      events_blocks[BlockNo].event_actions[r].EventTileY=(int)DataLoader.getValAtAddress(scd_ark,add_ptr+4,8);
                     *                      break;
                     *      case event_action.RowTypeRaceAttidude:
                     *                      events_blocks[BlockNo].event_actions[r].WhoAmIOrRace=(int)DataLoader.getValAtAddress(scd_ark,add_ptr+4,8);
                     *                      //Todo:Find out the properties to change here
                     *                      break;
                     *      default:
                     *                      break;
                     *      }*/
                    r++;
                    add_ptr += 16;
                }
            }
        }
    }