public static void ApplyMemoryFunc(TrigItem trigItem) { //0x58A364 + Player × 4 + Unit ID × 48 long player = (int)trigItem.args[0].VALUE; long unit = (int)trigItem.args[3].VALUE; uint offset = (uint)(0x58A364 + player * 4 + unit * 48); if ((0x58A364 <= offset) & (offset < 0x58CE24)) { return; } trigItem.args[0].VALUE = offset; trigItem.args.RemoveAt(3); if (trigItem.name == "SetDeaths") { trigItem.type = 57; trigItem.triggerDefine = Global.WindowTool.triggerManger.Actions[58]; trigItem.args[0].argDefine = trigItem.triggerDefine.argDefines[0]; trigItem.args[0].ARGTYPE = TriggerManger.ArgType.OFFSET; trigItem.name = "SetMemory"; } else if (trigItem.name == "Deaths") { trigItem.type = 24; trigItem.triggerDefine = Global.WindowTool.triggerManger.Actions[25]; trigItem.args[0].argDefine = trigItem.triggerDefine.argDefines[0]; trigItem.args[0].ARGTYPE = TriggerManger.ArgType.OFFSET; trigItem.name = "Memory"; } }
private void RefreshItem(TrigItem trigItem) { TrigArgs.Children.Clear(); TriggerManger.TriggerDefine td = trigItem.triggerDefine; string summary = td.SUMMARY; for (int i = 0; i < td.argDefines.Count; i++) { string argname = "[" + td.argDefines[i].argname + "]"; summary = summary.Replace(argname, "☻$" + i + "☻"); } string[] block = summary.Split('☻'); for (int i = 0; i < block.Length; i++) { if (block[i].Length == 0) { continue; } if (block[i][0] == '$') { string argcheck = block[i].Substring(1); int argnum; if (int.TryParse(argcheck, out argnum)) { Button button = new Button(); button.Style = (Style)Application.Current.Resources["MaterialDesignOutlinedButton"]; button.Content = trigItem.args[argnum].GetValue; button.Tag = trigItem.args[argnum]; button.Click += ArgEditBtn; TrigArgs.Children.Add(button); continue; } } TextBlock textBlock = new TextBlock(); textBlock.Text = block[i]; textBlock.VerticalAlignment = VerticalAlignment.Center; TrigArgs.Children.Add(textBlock); } }
public static string GetTEPMemoryText(TrigItem trigItem) { if (trigItem.args[4].VALUE == 17235) { return(trigItem.name + "X(" + trigItem.args[0].GetCode + ", " + trigItem.args[1].GetCode + ", " + trigItem.args[2].GetCode + ", " + trigItem.args[3].GetCode + ")"); } else { return(trigItem.name + "(" + trigItem.args[0].GetCode + ", " + trigItem.args[1].GetCode + ", " + trigItem.args[2].GetCode + ")"); } }
private void ItemTypeOkay() { if (SelectTrigitem == null) { if (TrigItemTypeListBox.SelectedIndex == -1) { SnackbarMessage.Enqueue("타입을 선택하세요."); return; } } if (TrigItemTypeListBox.SelectedIndex != -1) { if (CopyedSelectTrigitem == null) { CopyedSelectTrigitem = new TrigItem(mapEditor.mapdata); if (!IsTrigger) { CopyedSelectTrigitem.IsTrigger = false; CopyedSelectTrigitem.IsAction = true; } } ListBoxItem listitem = (ListBoxItem)TrigItemTypeListBox.SelectedItem; CopyedSelectTrigitem.Init((TriggerManger.TriggerDefine)listitem.Tag); RefreshItem(CopyedSelectTrigitem); } ActionName.Text = CopyedSelectTrigitem.name; IsOpen = false; ItemTypeSelecter.Visibility = Visibility.Collapsed; }
private void OpenTrigItemEditWindow(TrigItem trigItem, bool IsAction = false) { ItemEditPage.Visibility = Visibility.Visible; EditOpenStroyBoard.Begin(this); ItemTypeSelecter.Visibility = Visibility.Collapsed; SelectTrigitem = trigItem; if (SelectTrigitem == null) { IsNewTrigEdit = true; OpenTypeSelecter(SelectTrigitem, IsAction); } else { ActionName.Text = SelectTrigitem.triggerDefine.NAME; IsNewTrigEdit = false; CopyedSelectTrigitem = SelectTrigitem.Clone(); RefreshItem(CopyedSelectTrigitem); } TrigEditWindowOpen = true; }
public TrigItem GetTrigItem(LuaInterface.LuaTable t) { bool IsAction = true; int type = (int)(double)t[1]; List <object> args = new List <object>(); for (int c = 2; c <= t.Values.Count - 1; c++) { args.Add(t[c]); } TrigItem trigItem = new TrigItem(mapData); TriggerDefine td = null; switch ((string)t["type"]) { case "Briefing": td = Global.WindowTool.triggerManger.BrifngActions[type]; break; case "Condition": IsAction = false; td = Global.WindowTool.triggerManger.Conditions[type]; break; case "Action": td = Global.WindowTool.triggerManger.Actions[type]; break; } trigItem.triggerDefine = td; trigItem.IsAction = IsAction; trigItem.IsTrigger = IsTrigger; trigItem.name = td.NAME; trigItem.type = td.TYPE; if (td.argDefines.Count != args.Count) { throw new Exception(td.NAME + "은 인자수가 " + td.argDefines.Count + "개 입니다. 하지만 " + args.Count + "개의 인자가 들어왔습니다."); } for (int i = 0; i < td.argDefines.Count; i++) { TriggerDefine.ArgDefine ad = td.argDefines[i]; Arg arg = new Arg(mapData); arg.argDefine = ad; arg.ARGTYPE = ad.argtype; arg.IsInit = false; switch (ad.argtype) { case ArgType.STRING: case ArgType.WAV: arg.STRING.String = (string)args[i]; break; case ArgType.LOCATION: arg.LOCATION = (LocationData)args[i]; break; case ArgType.UPRP: arg.UPRP = (CUPRP)args[i]; break; default: arg.VALUE = (long)(double)args[i]; break; } trigItem.args.Add(arg); } return(trigItem); }
public void Triggerinterpreter(LuaInterface.LuaTable t) { CTrigger cTrigger = new CTrigger(mapData, IsTrigger); if (t["players"] != null) { LuaInterface.LuaTable players = (LuaInterface.LuaTable)t["players"]; for (int i = 1; i <= players.Values.Count; i++) { double v = (double)Lua.GetFunction("ParsePlayer").Call(players[i])[0]; int pnum = (int)v; cTrigger.playerlist[pnum] = 1; } } if (t["flag"] != null) { LuaInterface.LuaTable flags = (LuaInterface.LuaTable)t["flag"]; ushort flag = 0; for (int i = 1; i <= flags.Values.Count; i++) { double v = (double)Lua.GetFunction("ParseTrigFlag").Call(flags[i])[0]; int flagv = (int)v; flag += (ushort)(0b1 << flagv); } cTrigger.exeflag = flag; } if (t["conditions"] != null) { LuaInterface.LuaTable conds = (LuaInterface.LuaTable)t["conditions"]; for (int i = 1; i <= conds.Values.Count; i++) { LuaInterface.LuaTable con = (LuaInterface.LuaTable)conds[i]; bool tEnable = true; if (con["Disable"] != null) { con = (LuaInterface.LuaTable)con["item"]; tEnable = false; } TrigItem trigItem = GetTrigItem(con); if (trigItem == null) { continue; } trigItem.IsEnable = tEnable; cTrigger.conditions.Add(trigItem); } } if (t["actions"] != null) { LuaInterface.LuaTable acts = (LuaInterface.LuaTable)t["actions"]; for (int i = 1; i <= acts.Values.Count; i++) { LuaInterface.LuaTable act = (LuaInterface.LuaTable)acts[i]; bool tEnable = true; if (act["Disable"] != null) { act = (LuaInterface.LuaTable)act["item"]; tEnable = false; } TrigItem trigItem = GetTrigItem(act); if (trigItem == null) { continue; } trigItem.IsEnable = tEnable; cTrigger.actions.Add(trigItem); } } Triggers.Add(cTrigger); }
private void OpenTypeSelecter(TrigItem trigItem, bool IsAction = false) { if (trigItem != null) { ActionName.Text = trigItem.name; IsAction = trigItem.IsAction; } else { ActionName.Text = ""; } CloseValueSelecter(); TrigItemTypeListBox.Items.Clear(); List <TriggerManger.TriggerDefine> tlist; if (IsTrigger) { if (IsAction) { tlist = tm.Actions; } else { tlist = tm.Conditions; } } else { tlist = tm.BrifngActions; } foreach (TriggerManger.TriggerDefine item in tlist) { if (item == null) { continue; } ListBoxItem listBoxItem = new ListBoxItem(); listBoxItem.Tag = item; listBoxItem.Content = item.NAME + "\n" + item.SUMMARY; TrigItemTypeListBox.Items.Add(listBoxItem); } TrigItemTypeListBox.Items.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Ascending)); SelectTrigitem = trigItem; IsOpen = true; ItemTypeSelecter.Visibility = Visibility.Visible; TrigItemTypeListBox.Focus(); }
public RAWTRIGMBRF(CTrigger cTrigger) { for (int c = 0; c < 16; c++) { RawCondition condition = new RawCondition(); if (cTrigger.conditions.Count > c) { TrigItem trigItem = cTrigger.conditions[c]; if (trigItem.type == 24) { long offset = trigItem.args[0].VALUE; long player = (offset - 0x58A364) / 4; long unitid = 0; long modifier = trigItem.args[1].VALUE; long value = trigItem.args[2].VALUE; long mask = trigItem.args[3].VALUE; long maskuse = trigItem.args[4].VALUE; condition.values[1] = player; condition.values[3] = unitid; condition.values[2] = value; condition.values[4] = modifier; condition.values[0] = mask; condition.values[8] = maskuse; condition.valueSet(); condition.condtype = (byte)15; } else { for (int i = 0; i < trigItem.args.Count; i++) { int pos = trigItem.args[i].argDefine.pos; condition.values[pos] = trigItem.args[i].GetCHKValue; } condition.valueSet(); condition.condtype = (byte)trigItem.type; } condition.flags = (byte)trigItem.triggerDefine.FLAG; if (!trigItem.IsEnable) { condition.flags += 2; } } conditions[c] = condition; } for (int a = 0; a < 64; a++) { RawAction action = new RawAction(); if (cTrigger.actions.Count > a) { TrigItem trigItem = cTrigger.actions[a]; if (trigItem.type == 58) { long offset = trigItem.args[0].VALUE; long player = (offset - 0x58A364) / 4; long unitid = 0; long modifier = trigItem.args[1].VALUE; long value = trigItem.args[2].VALUE; long mask = trigItem.args[3].VALUE; long maskuse = trigItem.args[4].VALUE; action.values[4] = player; action.values[6] = unitid; action.values[5] = value; action.values[8] = modifier; action.values[0] = mask; action.values[10] = maskuse; action.valueSet(); action.acttype = (byte)45; } else { for (int i = 0; i < trigItem.args.Count; i++) { int pos = trigItem.args[i].argDefine.pos; action.values[pos] = trigItem.args[i].GetCHKValue; } action.valueSet(); action.acttype = (byte)trigItem.type; } action.flags = (byte)trigItem.triggerDefine.FLAG; if (!trigItem.IsEnable) { action.flags += 2; } } actions[a] = action; } exeflag = cTrigger.exeflag; playerlist = cTrigger.playerlist; trigindex = 0; }