public async Task NpcAction(NpcCommandAction commandAction) { var result = await DoCommand(async() => { var playerId = _account.PlayerId; var command = new NpcActionCommand(playerId, commandAction.NpcId, commandAction.Action.ScriptId, commandAction.Action.CommandId, commandAction.Action.Name, commandAction.Action.Message); await _bus.SendCommand(command); }); }
public void ReadStoryFormFile() { Command command = new Command(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(story.text); XmlNodeList storyElementList = xmlDoc.SelectSingleNode("/Story").ChildNodes; foreach (XmlNode _storyElement in storyElementList) { StoryElement storyElement = new StoryElement(); XmlNode conditionListNode = _storyElement.SelectSingleNode("ConditionList"); XmlNode TaskNode = _storyElement.SelectSingleNode("Task"); XmlNode dialogListNode = _storyElement.SelectSingleNode("DialogList"); XmlNode npcActionListNode = _storyElement.SelectSingleNode("NpcActionList"); if (conditionListNode != null) { List <Condition> ConditionList; ConditionList = ReadConditionList(conditionListNode); ConditionCommand conditionCommand = new ConditionCommand(ConditionList); storyElement.commandList.Add(conditionCommand); } if (dialogListNode != null) { List <Dialog> DialogList; DialogList = ReadDialogList(dialogListNode); DialogCommand dialogCommand = new DialogCommand(DialogList); storyElement.commandList.Add(dialogCommand); } if (npcActionListNode != null) { List <NpcAction> NpcActionList; NpcActionList = ReadNpcActionList(npcActionListNode); NpcActionCommand npcActionCommand = new NpcActionCommand(NpcActionList); storyElement.commandList.Add(npcActionCommand); } if (TaskNode != null) { Task task; task = ReadTask(TaskNode); TaskCommand taskCommand = new TaskCommand(task); storyElement.commandList.Add(taskCommand); } storyList.Add(storyElement); } }