public override void Calculate(ConditionEvent e)
 {
     //called when there is an event
     if(CheckCondition(tutorialScene.tutorialStep)){
         receiver.OnContinue();
     }
 }
 public void Set(ConditionEvent other)
 {
     id = other.id;
     triggerCondition = other.triggerCondition;
     onTrigger        = other.onTrigger;
     onUpdate         = other.onUpdate;
 }
示例#3
0
        /// <summary>
        /// 캐싱해둔 조건이벤트 실행
        /// </summary>
        public void Execute()
        {
            if (cntCondiEvent != null)
            {
                cntCondiEvent.UseEvent();

                // 이벤트 처리
                _defineEventTable.GetDefineEvent(cntCondiEvent.key).onEvents.Invoke();

                cntCondiEvent = null;
            }
        }
        protected override void Initialize()
        {
            _evList = new List <ConditionEvent>();

            var csvReadData = Core.CSVReader.Read(csvFile);

            foreach (var line in csvReadData)
            {
                var temp = new ConditionEvent(line["Key"].ToString(),
                                              char.Parse(line["Var"].ToString()),
                                              bool.Parse(line["EvDone"].ToString()),
                                              uint.Parse(line["Num"].ToString()),
                                              line["Condition"].ToString(),
                                              uint.Parse(line["Time"].ToString())
                                              );

                _evList.Add(temp);
            }
        }
示例#5
0
        /// <returns>True - temp의 값이 있을 때 / False - temp의 값이 없을 때 </returns>
        private bool EventTrigger(char var, uint score)
        {
            ConditionEvent temp = null;

            switch (var)
            {
            case 's':
            case 'S':
                temp = _conditionEventTable.Filter('S', score);
                break;

            case 'f':
            case 'F':
                temp = _conditionEventTable.Filter('F', score);
                break;

            case 'c':
            case 'C':
                temp = _conditionEventTable.Filter('C', score);
                break;

            case 'm':
            case 'M':
                break;

            //Note.1024 레벨추가된다네요 야발
            case 'L':
            case 'l':
                break;
            }

            if (temp != null)
            {
                // 조건이벤트를 캐싱해둔다.
                cntCondiEvent = temp;

                return(true);
            }

            return(false);
        }
 private bool CheckCondition(int step, ConditionEvent e)
 {
     //should return false when there is no condition to check
     switch(step){
     case 2:
         return e == TutorialCondition.ConditionEvent.endTurn;
     case 4: //detect that the shoot-help is open somehow
         return e == TutorialCondition.ConditionEvent.endTurn;
     case 8: //detect shoot-tower
         return (Control.cState.player[0].playerSkill.build >= 1);
     case 10:
         return (Control.cState.player[0].playerSkill.build == 0);
     case 14:
         return (Control.cState.player[0].playerSkill.silence >= 1);
     case 16:
         return e == TutorialCondition.ConditionEvent.endTurn;
     case 20:
         return e == TutorialCondition.ConditionEvent.endTurn;
     case 22:
         return e == TutorialCondition.ConditionEvent.endTurn;
     default:
         return false;
     }
 }
示例#7
0
        static Event ParseEvent(IDataReader dataReader)
        {
            Event @event;
            var   type = (EventType)dataReader.ReadByte();

            switch (type)
            {
            case EventType.Teleport:
            {
                // 1. byte is the x coordinate
                // 2. byte is the y coordinate
                // 3. byte is the character direction
                // Then 1 unknown byte
                // Then 1 byte for the transtion type (0-5)
                // Then a word for the map index
                // Then 2 unknown bytes (seem to be 00 FF)
                uint x          = dataReader.ReadByte();
                uint y          = dataReader.ReadByte();
                var  direction  = (CharacterDirection)dataReader.ReadByte();
                var  unknown1   = dataReader.ReadByte();
                var  transition = (TeleportEvent.TransitionType)dataReader.ReadByte();
                uint mapIndex   = dataReader.ReadWord();
                var  unknown2   = dataReader.ReadBytes(2);
                @event = new TeleportEvent
                {
                    MapIndex   = mapIndex,
                    X          = x,
                    Y          = y,
                    Direction  = direction,
                    Transition = transition,
                    Unknown1   = unknown1,
                    Unknown2   = unknown2,
                };
                break;
            }

            case EventType.Door:
            {
                // 1. byte is a lockpicking chance reduction (0: already open, 100: can't open via lockpicking)
                // 2. byte is the door index (used for unlock bits in savegame)
                // 3. byte is an optional text index that is shown initially (0xff = no text)
                // 4. byte is an optional text index if the door was unlocked (0xff = no text)
                // 5. byte is unknown (always 0)
                // word at position 6 is the key index if a key must unlock it
                // last word is the event index (0-based) of the event that is called when unlocking fails
                var  lockpickingChanceReduction = dataReader.ReadByte();
                var  doorIndex            = dataReader.ReadByte();
                var  textIndex            = dataReader.ReadByte();
                var  unlockTextIndex      = dataReader.ReadByte();
                var  unused               = dataReader.ReadByte();
                uint keyIndex             = dataReader.ReadWord();
                var  unlockFailEventIndex = dataReader.ReadWord();
                @event = new DoorEvent
                {
                    LockpickingChanceReduction = lockpickingChanceReduction,
                    DoorIndex              = doorIndex,
                    TextIndex              = textIndex,
                    UnlockTextIndex        = unlockTextIndex,
                    Unused                 = unused,
                    KeyIndex               = keyIndex,
                    UnlockFailedEventIndex = unlockFailEventIndex
                };
                break;
            }

            case EventType.Chest:
            {
                // 1. byte is a lockpicking chance reduction (0: already open, 100: can't open via lockpicking)
                // 2. byte are the chest flags
                // 3. byte is an optional text index (0xff = no text)
                // 4. byte is the chest index (0-based)
                // 5. byte (0 = chest, 1 = pile/removable loot or item) or "remove if empty"
                // word at position 6 is the key index if a key must unlock it
                // last word is the event index (0-based) of the event that is called when unlocking fails
                var  lockpickingChanceReduction = dataReader.ReadByte();
                var  flags                = (ChestEvent.ChestFlags)dataReader.ReadByte();
                var  textIndex            = dataReader.ReadByte();
                uint chestIndex           = dataReader.ReadByte();
                bool removeWhenEmpty      = dataReader.ReadByte() != 0;
                uint keyIndex             = dataReader.ReadWord();
                var  unlockFailEventIndex = dataReader.ReadWord();
                @event = new ChestEvent
                {
                    LockpickingChanceReduction = lockpickingChanceReduction,
                    Flags                  = flags,
                    TextIndex              = textIndex,
                    ChestIndex             = chestIndex,
                    RemoveWhenEmpty        = removeWhenEmpty,
                    KeyIndex               = keyIndex,
                    UnlockFailedEventIndex = unlockFailEventIndex
                };
                break;
            }

            case EventType.PopupText:
            {
                // event image index (0xff = no image)
                // trigger (1 = move, 2 = eye cursor, 3 = both)
                // unknown boolean
                // map text index as word
                // 4 unknown bytes
                var eventImageIndex = dataReader.ReadByte();
                var popupTrigger    = (EventTrigger)dataReader.ReadByte();
                var unknownBool     = dataReader.ReadByte() != 0;
                var textIndex       = dataReader.ReadWord();
                var unknown         = dataReader.ReadBytes(4);
                @event = new PopupTextEvent
                {
                    EventImageIndex = eventImageIndex,
                    PopupTrigger    = popupTrigger,
                    TextIndex       = textIndex,
                    UnknownBool     = unknownBool,
                    Unknown         = unknown
                };
                break;
            }

            case EventType.Spinner:
            {
                var direction = (CharacterDirection)dataReader.ReadByte();
                var unused    = dataReader.ReadBytes(8);
                @event = new SpinnerEvent
                {
                    Direction = direction,
                    Unused    = unused
                };
                break;
            }

            case EventType.Trap:
            {
                var ailment         = (TrapEvent.TrapAilment)dataReader.ReadByte();
                var target          = (TrapEvent.TrapTarget)dataReader.ReadByte();
                var affectedGenders = (GenderFlag)dataReader.ReadByte();
                var baseDamage      = dataReader.ReadByte();
                var unused          = dataReader.ReadBytes(5); // unused
                @event = new TrapEvent
                {
                    Ailment         = ailment,
                    Target          = target,
                    AffectedGenders = affectedGenders,
                    BaseDamage      = baseDamage,
                    Unused          = unused
                };
                break;
            }

            case EventType.RemoveBuffs:
            {
                byte affectedBuffs = dataReader.ReadByte();
                var  unused        = dataReader.ReadBytes(8);
                @event = new RemoveBuffsEvent
                {
                    AffectedBuff = affectedBuffs == 0 ? (ActiveSpellType?)null: (ActiveSpellType)(affectedBuffs - 1),
                    Unused       = unused
                };
                break;
            }

            case EventType.Riddlemouth:
            {
                var introTextIndex          = dataReader.ReadByte();
                var solutionTextIndex       = dataReader.ReadByte();
                var unused                  = dataReader.ReadBytes(3);
                var correctAnswerTextIndex1 = dataReader.ReadWord();
                var correctAnswerTextIndex2 = dataReader.ReadWord();
                @event = new RiddlemouthEvent
                {
                    RiddleTextIndex               = introTextIndex,
                    SolutionTextIndex             = solutionTextIndex,
                    CorrectAnswerDictionaryIndex1 = correctAnswerTextIndex1,
                    CorrectAnswerDictionaryIndex2 = correctAnswerTextIndex2,
                    Unused = unused
                };
                break;
            }

            case EventType.Award:
            {
                var awardType      = (AwardEvent.AwardType)dataReader.ReadByte();
                var awardOperation = (AwardEvent.AwardOperation)dataReader.ReadByte();
                var random         = dataReader.ReadByte() != 0;
                var awardTarget    = (AwardEvent.AwardTarget)dataReader.ReadByte();
                var unknown        = dataReader.ReadByte();
                var awardTypeValue = dataReader.ReadWord();
                var value          = dataReader.ReadWord();
                @event = new AwardEvent
                {
                    TypeOfAward    = awardType,
                    Operation      = awardOperation,
                    Random         = random,
                    Target         = awardTarget,
                    AwardTypeValue = awardTypeValue,
                    Value          = value,
                    Unknown        = unknown
                };
                break;
            }

            case EventType.ChangeTile:
            {
                var x              = dataReader.ReadByte();
                var y              = dataReader.ReadByte();
                var unknown        = dataReader.ReadBytes(3);
                var frontTileIndex = dataReader.ReadWord();     // also wall/object index in lower byte
                var mapIndex       = dataReader.ReadWord();
                @event = new ChangeTileEvent
                {
                    X = x,
                    Y = y,
                    FrontTileIndex = frontTileIndex,
                    MapIndex       = mapIndex,
                    Unknown        = unknown
                };
                break;
            }

            case EventType.StartBattle:
            {
                var unknown1          = dataReader.ReadBytes(6);
                var monsterGroupIndex = dataReader.ReadByte();
                var unknown2          = dataReader.ReadBytes(2);
                @event = new StartBattleEvent
                {
                    MonsterGroupIndex = monsterGroupIndex,
                    Unknown1          = unknown1,
                    Unknown2          = unknown2
                };
                break;
            }

            case EventType.EnterPlace:
            {
                // map text index when closed (0xff is default message)
                // place type (see PlaceType)
                // opening hour
                // closing hour
                // text index for using the place (sleep, train, buy, etc)
                // place index (1-based, word)
                // 2 unknown bytes
                var textIndexWhenClosed = dataReader.ReadByte();
                var placeType           = (PlaceType)dataReader.ReadByte();
                var openingHour         = dataReader.ReadByte();
                var closingHour         = dataReader.ReadByte();
                var usePlaceTextIndex   = dataReader.ReadByte();
                var placeIndex          = dataReader.ReadWord();
                var merchantIndex       = dataReader.ReadWord();
                @event = new EnterPlaceEvent
                {
                    ClosedTextIndex   = textIndexWhenClosed,
                    PlaceType         = placeType,
                    OpeningHour       = openingHour,
                    ClosingHour       = closingHour,
                    PlaceIndex        = placeIndex,
                    UsePlaceTextIndex = usePlaceTextIndex,
                    MerchantDataIndex = merchantIndex
                };
                break;
            }

            case EventType.Condition:
            {
                var conditionType        = (ConditionEvent.ConditionType)dataReader.ReadByte();
                var value                = dataReader.ReadByte();
                var count                = dataReader.ReadByte();
                var unknown1             = dataReader.ReadBytes(2);
                var objectIndex          = dataReader.ReadWord();
                var jumpToIfNotFulfilled = dataReader.ReadWord();
                @event = new ConditionEvent
                {
                    TypeOfCondition = conditionType,
                    ObjectIndex     = objectIndex,
                    Value           = value,
                    Count           = count,
                    Unknown1        = unknown1,
                    ContinueIfFalseWithMapEventIndex = jumpToIfNotFulfilled
                };
                break;
            }

            case EventType.Action:
            {
                var actionType  = (ActionEvent.ActionType)dataReader.ReadByte();
                var value       = dataReader.ReadByte();
                var count       = dataReader.ReadByte();
                var unknown1    = dataReader.ReadBytes(2);
                var objectIndex = dataReader.ReadWord();
                var unknown2    = dataReader.ReadBytes(2);
                @event = new ActionEvent
                {
                    TypeOfAction = actionType,
                    ObjectIndex  = objectIndex,
                    Value        = value,
                    Unknown1     = unknown1,
                    Unknown2     = unknown2
                };
                break;
            }

            case EventType.Dice100Roll:
            {
                var chance = dataReader.ReadByte();
                var unused = dataReader.ReadBytes(6);
                var jumpToIfNotFulfilled = dataReader.ReadWord();
                @event = new Dice100RollEvent
                {
                    Chance = chance,
                    Unused = unused,
                    ContinueIfFalseWithMapEventIndex = jumpToIfNotFulfilled
                };
                break;
            }

            case EventType.Conversation:
            {
                var interaction = (ConversationEvent.InteractionType)dataReader.ReadByte();
                var unused1     = dataReader.ReadBytes(4); // unused
                var value       = dataReader.ReadWord();
                var unused2     = dataReader.ReadBytes(2); // unused
                @event = new ConversationEvent
                {
                    Interaction = interaction,
                    Value       = value,
                    Unused1     = unused1,
                    Unused2     = unused2
                };
                break;
            }

            case EventType.PrintText:
            {
                var npcTextIndex = dataReader.ReadByte();
                var unused       = dataReader.ReadBytes(8); // unused
                @event = new PrintTextEvent
                {
                    NPCTextIndex = npcTextIndex,
                    Unused       = unused
                };
                break;
            }

            case EventType.Create:
            {
                var createType = (CreateEvent.CreateType)dataReader.ReadByte();
                var unused     = dataReader.ReadBytes(4);
                var amount     = dataReader.ReadWord();
                var itemIndex  = dataReader.ReadWord();
                @event = new CreateEvent
                {
                    TypeOfCreation = createType,
                    Unused         = unused,
                    Amount         = amount,
                    ItemIndex      = itemIndex
                };
                break;
            }

            case EventType.Decision:
            {
                var textIndex    = dataReader.ReadByte();
                var unknown1     = dataReader.ReadBytes(6);
                var noEventIndex = dataReader.ReadWord();
                @event = new DecisionEvent
                {
                    TextIndex    = textIndex,
                    NoEventIndex = noEventIndex,
                    Unknown1     = unknown1
                };
                break;
            }

            case EventType.ChangeMusic:
            {
                var musicIndex = dataReader.ReadWord();
                var volume     = dataReader.ReadByte();
                var unknown1   = dataReader.ReadBytes(6);
                @event = new ChangeMusicEvent
                {
                    MusicIndex = musicIndex,
                    Volume     = volume,
                    Unknown1   = unknown1
                };
                break;
            }

            case EventType.Exit:
            {
                @event = new ExitEvent
                {
                    Unused = dataReader.ReadBytes(9)
                };
                break;
            }

            case EventType.Spawn:
            {
                // byte0: x
                // byte1: y
                // byte2: travel type (see TravelType)
                // byte3-4: unused?
                // byte5-6: map index
                // byte7-8: unused?
                var x          = dataReader.ReadByte();
                var y          = dataReader.ReadByte();
                var travelType = (TravelType)dataReader.ReadByte();
                var unknown1   = dataReader.ReadBytes(2);   // unknown
                var mapIndex   = dataReader.ReadWord();
                var unknown2   = dataReader.ReadBytes(2);   // unknown
                @event = new SpawnEvent
                {
                    X          = x,
                    Y          = y,
                    TravelType = travelType,
                    Unknown1   = unknown1,
                    MapIndex   = mapIndex,
                    Unknown2   = unknown2
                };
                break;
            }

            case EventType.Interact:
            {
                @event = new InteractEvent
                {
                    Unused = dataReader.ReadBytes(9)
                };
                break;
            }

            default:
            {
                @event = new DebugEvent
                {
                    Data = dataReader.ReadBytes(9)
                };
                break;
            }
            }

            @event.Type = type;

            return(@event);
        }
    public void Parse(string condition)
    {
        // var1:object.variable condition:= var2:object.variable
        // var1:object.variable condition:= const:0.5
        // interact:INTERACTMAP
#if DEBUG_DECISION_ENGINE
        UnityEngine.Debug.Log("Condition.Parse(" + condition + ")");
#endif

        // TWO VARS
        if (condition.Contains("var1") && condition.Contains("var2"))
        {
            ConditionTestVar2 ct = new ConditionTestVar2();
            if (ct.Parse(condition) == true)
            {
#if DEBUG_DECISION_ENGINE
                ct.Debug();
#endif
                ConditionTests.Add(ct);
            }
        }
        // ONE VAR 
        else if (condition.Contains("var"))
        {
            ConditionTestVar1 ct = new ConditionTestVar1();
            if (ct.Parse(condition) == true)
            {
#if DEBUG_DECISION_ENGINE
                ct.Debug();
#endif
                ConditionTests.Add(ct);
            }
        }
        else if (condition.Contains("interact:"))
        {
            ConditionEvent ct = new ConditionEvent();
            if (ct.Parse(condition) == true)
            {
#if DEBUG_DECISION_ENGINE
                ct.Debug();
#endif
                ConditionTests.Add(ct);
            }
        }
        /*
        // LOG
        else if (condition.Contains("log"))
        {
            ConditionTestLog ct = new ConditionTestLog();
            if (ct.Parse(condition) == true)
            {
                Test.Add(ct);
            }
        }
         * */
    }
示例#9
0
 public void Add(ConditionEvent e)
 {
     conditionalEvents.AddLast(e);
 }
	public ConditionEvent( ConditionEvent _src )
	{
	}
 public static void RemoveConditionEvent(ConditionEvent pEvent)
 {
     mMediator.RemoveTriggerAction(pEvent);
 }
 /// <summary>
 /// This Wait uses Update to check condition
 /// </summary>
 public static ConditionEvent Start(ConditionEvent pScheduleEvent)
 {
     return(mMediator.WaitForCondition(pScheduleEvent));
 }
 public abstract void Calculate(ConditionEvent e);
 public ConditionEvent( ConditionEvent _src )
     : base(_src)
 {
 }
示例#15
0
        static MapEvent ParseEvent(IDataReader dataReader)
        {
            MapEvent mapEvent;
            var      type = (MapEventType)dataReader.ReadByte();

            switch (type)
            {
            case MapEventType.MapChange:
            {
                // 1. byte is the x coordinate
                // 2. byte is the y coordinate
                // Then 3 unknown bytes
                // Then a word for the map index
                // Then 2 unknown bytes (seem to be 00 FF)
                uint x         = dataReader.ReadByte();
                uint y         = dataReader.ReadByte();
                var  direction = (CharacterDirection)dataReader.ReadByte();
                var  unknown1  = dataReader.ReadBytes(2);
                uint mapIndex  = dataReader.ReadWord();
                var  unknown2  = dataReader.ReadBytes(2);
                mapEvent = new MapChangeEvent
                {
                    MapIndex  = mapIndex,
                    X         = x,
                    Y         = y,
                    Direction = direction,
                    Unknown1  = unknown1,
                    Unknown2  = unknown2
                };
                break;
            }

            case MapEventType.Chest:
            {
                // 1. byte are the lock flags
                // 2. byte is unknown (always 0 except for one chest with 20 blue discs which has 0x32 and lock flags of 0x00)
                // 3. byte is unknown (0xff for unlocked chests)
                // 4. byte is the chest index (0-based)
                // 5. byte (0 = chest, 1 = pile/removable loot or item) or "remove if empty"
                // word at position 6 is the key index if a key must unlock it
                // last word is the event index (0-based) of the event that is called when unlocking fails
                var  lockType             = (ChestMapEvent.LockFlags)dataReader.ReadByte();
                var  unknown1             = dataReader.ReadWord(); // Unknown
                uint chestIndex           = dataReader.ReadByte();
                bool removeWhenEmpty      = dataReader.ReadByte() != 0;
                uint keyIndex             = dataReader.ReadWord();
                var  unlockFailEventIndex = dataReader.ReadWord();
                mapEvent = new ChestMapEvent
                {
                    Unknown1               = unknown1,
                    Lock                   = lockType,
                    ChestIndex             = chestIndex,
                    RemoveWhenEmpty        = removeWhenEmpty,
                    KeyIndex               = keyIndex,
                    UnlockFailedEventIndex = unlockFailEventIndex
                };
                break;
            }

            case MapEventType.TextEvent:
            {
                // event image index (0xff = no image)
                // 3 unknown bytes
                // 5. byte is the map text index
                // 4 unknown bytes
                var eventImageIndex = dataReader.ReadByte();
                var unknown1        = dataReader.ReadBytes(3);
                var textIndex       = dataReader.ReadByte();
                var unknown2        = dataReader.ReadBytes(4);
                mapEvent = new TextEvent
                {
                    EventImageIndex = eventImageIndex,
                    TextIndex       = textIndex,
                    Unknown1        = unknown1,
                    Unknown2        = unknown2
                };
                break;
            }

            case MapEventType.Spinner:
            {
                var direction = (CharacterDirection)dataReader.ReadByte();
                var unknown1  = dataReader.ReadBytes(8);
                mapEvent = new SpinnerEvent
                {
                    Direction = direction,
                    Unknown1  = unknown1,
                };
                break;
            }

            case MapEventType.Damage:
            {
                var unknown1 = dataReader.ReadBytes(9);
                mapEvent = new DamageEvent
                {
                    Unknown1 = unknown1,
                };
                break;
            }

            case MapEventType.Riddlemouth:
            {
                var introTextIndex    = dataReader.ReadByte();
                var solutionTextIndex = dataReader.ReadByte();
                var unknown1          = dataReader.ReadBytes(7);
                mapEvent = new RiddlemouthEvent
                {
                    IntroTextIndex    = introTextIndex,
                    SolutionTextIndex = solutionTextIndex,
                    Unknown1          = unknown1
                };
                break;
            }

            case MapEventType.ChangePlayerAttribute:
            {
                var unknown1  = dataReader.ReadBytes(6);
                var attribute = (Attribute)dataReader.ReadByte();
                var unknown2  = dataReader.ReadByte();
                var value     = dataReader.ReadByte();

                mapEvent = new ChangePlayerAttributeEvent
                {
                    Attribute = attribute,
                    Value     = value,
                    Unknown1  = unknown1,
                    Unknown2  = unknown2
                };
                break;
            }

            case MapEventType.ChangeTile:
            {
                var x              = dataReader.ReadByte();
                var y              = dataReader.ReadByte();
                var unknown1       = dataReader.ReadBytes(3);
                var frontTileIndex = dataReader.ReadWord();
                var unknown2       = dataReader.ReadBytes(2);
                mapEvent = new ChangeTileEvent
                {
                    X = x,
                    Y = y,
                    FrontTileIndex = frontTileIndex,
                    Unknown1       = unknown1,
                    Unknown2       = unknown2
                };
                break;
            }

            case MapEventType.StartBattle:
            {
                var unknown1          = dataReader.ReadBytes(6);
                var monsterGroupIndex = dataReader.ReadByte();
                var unknown2          = dataReader.ReadBytes(2);
                mapEvent = new StartBattleEvent
                {
                    MonsterGroupIndex = monsterGroupIndex,
                    Unknown1          = unknown1,
                    Unknown2          = unknown2
                };
                break;
            }

            case MapEventType.Condition:
            {
                var conditionType        = (ConditionEvent.ConditionType)dataReader.ReadByte();  // TODO: this needs more research
                var value                = dataReader.ReadByte();
                var unknown1             = dataReader.ReadBytes(4);
                var objectIndex          = dataReader.ReadByte();
                var jumpToIfNotFulfilled = dataReader.ReadWord();
                mapEvent = new ConditionEvent
                {
                    TypeOfCondition = conditionType,
                    ObjectIndex     = objectIndex,
                    Value           = value,
                    Unknown1        = unknown1,
                    ContinueIfFalseWithMapEventIndex = jumpToIfNotFulfilled
                };
                break;
            }

            case MapEventType.Action:
            {
                var actionType  = (ActionEvent.ActionType)dataReader.ReadByte();        // TODO: this needs more research
                var value       = dataReader.ReadByte();
                var unknown1    = dataReader.ReadBytes(4);
                var objectIndex = dataReader.ReadByte();
                var unknown2    = dataReader.ReadBytes(2);
                mapEvent = new ActionEvent
                {
                    TypeOfAction = actionType,
                    ObjectIndex  = objectIndex,
                    Value        = value,
                    Unknown1     = unknown1,
                    Unknown2     = unknown2
                };
                break;
            }

            case MapEventType.Question:
            {
                var textIndex    = dataReader.ReadByte();
                var unknown1     = dataReader.ReadBytes(6);
                var noEventIndex = dataReader.ReadWord();
                mapEvent = new QuestionEvent
                {
                    TextIndex    = textIndex,
                    NoEventIndex = noEventIndex,
                    Unknown1     = unknown1
                };
                break;
            }

            case MapEventType.ChangeMusic:
            {
                var musicIndex = dataReader.ReadWord();
                var volume     = dataReader.ReadByte();
                var unknown1   = dataReader.ReadBytes(6);
                mapEvent = new ChangeMusicEvent
                {
                    MusicIndex = musicIndex,
                    Volume     = volume,
                    Unknown1   = unknown1
                };
                break;
            }

            default:
            {
                // TODO
                mapEvent = new DebugMapEvent
                {
                    Data = dataReader.ReadBytes(9)
                };
                break;
            }
            }

            mapEvent.Type = type;

            return(mapEvent);
        }