Example #1
0
        public static void UpdateAction(UOAIBasic.Action toupdate)
        {
            ActionBuilder ab = new ActionBuilder(toupdate);

            ab.ShowDialog();
            return;
        }
Example #2
0
        public ActionBuilder(UOAIBasic.Action ofaction)
        {
            InitializeComponent();

            //fill in enum values
            foreach (ActionType at in Enum.GetValues(typeof(ActionType)))
            {
                actTypes.Items.Add(at);
            }
            foreach (UOCallibration.CallibratedFeatures cf in Enum.GetValues(typeof(UOCallibration.CallibratedFeatures)))
            {
                enumpar.Items.Add(cf);
                knownpar2.Items.Add(cf);
            }

            //update sequence list
            UpdateSequenceList();

            //update action lists
            UpdateActionLists();

            //update filter list
            UpdateFilterList();

            //fill in initial values
            InitializeFromAction(ofaction);
        }
Example #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     m_Action     = null;
     DialogResult = DialogResult.Cancel;
     Close();
 }
Example #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (m_Action != null)
     {
         m_Action.name = ActionName.Text;
         if (m_Action.name == "")
         {
             m_Action.name = "Action_" + UOAIBasic.Action.actions.Count.ToString();
         }
         m_Action.boolpar = boolpar.Checked;
         m_Action.m_type  = (ActionType)actTypes.SelectedItem;
         m_Action.seqpar  = (Sequence)seqPar.SelectedItem;
         uint.TryParse(uintpar.Text, out m_Action.uintpar);
         if (enumpar.SelectedItem != null)
         {
             m_Action.knownpar = (UOCallibration.CallibratedFeatures)enumpar.SelectedItem;
         }
         if (knownpar2.SelectedItem != null)
         {
             m_Action.knownpar2 = (UOCallibration.CallibratedFeatures)knownpar2.SelectedItem;
         }
         if (actlist.SelectedItem != null)
         {
             m_Action.actlist = (ActionList)actlist.SelectedItem;
         }
         if (ontrue.SelectedItem != null)
         {
             m_Action.ontrue = (ActionList)ontrue.SelectedItem;
         }
         if (onfalse.SelectedItem != null)
         {
             m_Action.onfalse = (ActionList)onfalse.SelectedItem;
         }
         if (filterlist.SelectedItem != null)
         {
             m_Action.tocheck = (FilterList)filterlist.SelectedItem;
         }
         m_Action.Update();
     }
     else
     {
         m_Action         = new UOAIBasic.Action(ActionName.Text == ""?"Action_" + UOAIBasic.Action.actions.Count.ToString():ActionName.Text);
         m_Action.boolpar = boolpar.Checked;
         m_Action.m_type  = (ActionType)actTypes.SelectedItem;
         m_Action.seqpar  = (Sequence)seqPar.SelectedItem;
         uint.TryParse(uintpar.Text, out m_Action.uintpar);
         if (enumpar.SelectedItem != null)
         {
             m_Action.knownpar = (UOCallibration.CallibratedFeatures)enumpar.SelectedItem;
         }
         if (knownpar2.SelectedItem != null)
         {
             m_Action.knownpar2 = (UOCallibration.CallibratedFeatures)knownpar2.SelectedItem;
         }
         if (actlist.SelectedItem != null)
         {
             m_Action.actlist = (ActionList)actlist.SelectedItem;
         }
         if (ontrue.SelectedItem != null)
         {
             m_Action.ontrue = (ActionList)ontrue.SelectedItem;
         }
         if (onfalse.SelectedItem != null)
         {
             m_Action.onfalse = (ActionList)onfalse.SelectedItem;
         }
         if (filterlist.SelectedItem != null)
         {
             m_Action.tocheck = (FilterList)filterlist.SelectedItem;
         }
     }
     DialogResult = DialogResult.OK;
     Close();
 }
Example #5
0
        private void InitializeFromAction(UOAIBasic.Action toset)
        {
            if ((m_Action = toset) == null)
            {
                return;
            }

            ActionName.Text = toset.name;
            ActionType curatype = toset.m_type;

            SetActionType(curatype);

            UpdateSequenceList();

            switch (curatype)
            {
            case ActionType.DISASM_CHUNK:
                enumpar.SelectedItem = toset.knownpar;
                break;

            case ActionType.DISASM_FUNCTION:
                enumpar.SelectedItem = toset.knownpar;
                break;

            case ActionType.FIND_SEQUENCE:
                seqPar.SelectedItem = toset.seqpar;
                break;

            case ActionType.FOLLOW_CALL:
                boolpar.Checked = toset.boolpar;
                break;

            case ActionType.JUMP_KNOWN:
                uintpar.Text = toset.uintpar.ToString();
                break;

            case ActionType.RETURN_ADDRESS:
                enumpar.SelectedItem = toset.knownpar;
                break;

            case ActionType.RETURN_DATA:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                break;

            case ActionType.RETURN_DISP:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                break;

            case ActionType.SET_BACKWARDS:
                boolpar.Checked = toset.boolpar;
                break;

            case ActionType.FUNC_FIND:
                uintpar.Text = toset.uintpar.ToString();
                break;

            case ActionType.SWITCH:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                boolpar.Checked      = toset.boolpar;
                break;

            case ActionType.CONDITIONAL:
                actlist.SelectedItem = toset.actlist;
                ontrue.SelectedItem  = toset.ontrue;
                onfalse.SelectedItem = toset.onfalse;
                break;

            case ActionType.ASSIGN_VALUE:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                break;

            case ActionType.ASSIGN_KNOWN:
                enumpar.SelectedItem   = toset.knownpar;
                knownpar2.SelectedItem = toset.knownpar2;
                break;

            case ActionType.CHECK_INSTRUCTION:
                filterlist.SelectedItem = toset.tocheck;
                break;

            case ActionType.EXECUTE_ACTIONSLIST:
                actlist.SelectedItem = toset.actlist;
                break;

            case ActionType.TRY_ACTIONLIST:
                actlist.SelectedItem = toset.actlist;
                break;

            case ActionType.FOLLOW_JMP:
                boolpar.Checked = toset.boolpar;
                break;

            case ActionType.RETURN_SCALE:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                break;

            case ActionType.RETURN_CHUNK_ADDRESS:
                enumpar.SelectedItem = toset.knownpar;
                break;

            case ActionType.RETURN_TARGETADDRESS:
                enumpar.SelectedItem = toset.knownpar;
                uintpar.Text         = toset.uintpar.ToString();
                break;

            case ActionType.FIND_LOOP:
            case ActionType.MOVE_NEXT:
            case ActionType.MOVE_PREVIOUS:
                break;
            }
        }