Skip to content

Instantly share code, notes, and snippets.

@Diyagi
Created January 29, 2022 23:02
Show Gist options
  • Save Diyagi/ed691caafca2eb6487df0f9f97e596e2 to your computer and use it in GitHub Desktop.
Save Diyagi/ed691caafca2eb6487df0f9f97e596e2 to your computer and use it in GitHub Desktop.
Quest Targets (more like objectives) debug for Monster Hunter Rise
local QuestManager = sdk.get_managed_singleton("snow.QuestManager");
---------------| *Daclaring* variables for later initialization |--------------------
local getQuestTargetTotalBossEmNum = nil
local getQuestTargetTotalTgtNum = nil
local getQuestTargetTotalCount = nil
local getMainTargetListForUI = nil
local getMainTargetListForUI_Type = nil
local getMainTargetListForUI_Count = nil
local targets = {}
---------------| Create an instance of String to be used in getQuestTargetName function |--------------------
local targetName = sdk.create_instance("System.String") -- SDK dont like when we put this in any type of loop
---------------| Method to update the data of the targets |--------------------
local function updateQuestTargetData()
getQuestTargetTotalBossEmNum = QuestManager:call("getQuestTargetTotalBossEmNum");
getQuestTargetTotalTgtNum = QuestManager:call("getQuestTargetTotalTgtNum");
getQuestTargetTotalCount = QuestManager:call("getQuestTargetTotalCount");
getMainTargetListForUI = QuestManager:call("getMainTargetListForUI", true);
getMainTargetListForUI_Type = getMainTargetListForUI:call("ToString");
getMainTargetListForUI_Count = getMainTargetListForUI:call("get_Count");
local target = {};
targets = {}
for i = 0, getMainTargetListForUI_Count-1, 1 do
local targetData = getMainTargetListForUI:call("get_Item", i);
target = {};
targetData:call("getQuestTargetName", sdk.to_ptr(targetName))
target.field_Type = targetData:get_field("Type"); -- Type of mission (like Hunt or Capture)
target.field_Flag = targetData:get_field("Flag"); -- Idk
target.field_TgtNum = targetData:get_field("TgtNum"); -- Number of targets, for mission that has like, 2 Diablos as targets
target.field_Count = targetData:get_field("Count"); -- Counts how many have we slain/captured
target.field_ID = targetData:get_field("ID"); -- ID of the monster, from snow.enemy.EnemyDef.EmTypes ?
target.method_isNone = targetData:call("isNone"); -- Idk
target.method_getTargetIDType = targetData:call("getTargetIDType"); -- Idk
target.method_getQuestTargetName = targetName:call("ToString") -- Monster Name
target.method_isSuccess = targetData:call("isSuccess"); -- Returns true if we completed the objective
target.method_isFailed = targetData:call("isFailed"); -- Probably returns true if we fail the objective
target.method_isEnd = targetData:call("isEnd"); -- Returns true during the countdown to return from quest
target.method_isDisableCnt = targetData:call("isDisableCnt"); -- idk
target.method_isHide = targetData:call("isHide"); -- idk
target.method_isAchieved = targetData:call("isAchieved"); -- idk
target.method_isFixSubTarget = targetData:call("isFixSubTarget"); -- idk
target.method_isDisableHud = targetData:call("isDisableHud"); -- idk
target.method_isCheckmark = targetData:call("isCheckmark"); -- idk
target.method_isDispProgressChat = targetData:call("isDispProgressChat"); -- idk
targets[i] = target;
end
end
local function drawTargetsData()
local targetsCollection = targets;
for k, target in pairs(targetsCollection) do
if imgui.tree_node(target.method_getQuestTargetName) then
imgui.spacing()
if imgui.tree_node_str_id("field" .. k, "Fields") then
imgui.text(string.format(" Type: %d", target.field_Type))
imgui.text(string.format(" Flag: %d", target.field_Flag))
imgui.text(string.format(" TgtNum: %d", target.field_TgtNum))
imgui.text(string.format(" Count: %d", target.field_Count))
imgui.text(string.format(" ID: %d", target.field_ID))
imgui.tree_pop();
end
imgui.spacing()
if imgui.tree_node_str_id("methods" .. k, "Methods") then
imgui.text(string.format(" isNone: %s", tostring(target.method_isNone)))
imgui.text(string.format(" getTargetIDType: %d", target.method_getTargetIDType))
imgui.text(string.format(" getQuestTargetName: %s", target.method_getQuestTargetName))
imgui.text(string.format(" isSuccess: %s", tostring(target.method_isSuccess)))
imgui.text(string.format(" isFailed: %s", tostring(target.method_isFailed)))
imgui.text(string.format(" isEnd: %s", tostring(target.method_isEnd)))
imgui.text(string.format(" isDisableCnt: %s", tostring(target.method_isDisableCnt)))
imgui.text(string.format(" isHide: %s", tostring(target.method_isHide)))
imgui.text(string.format(" isAchived: %s", tostring(target.method_isAchieved)))
imgui.text(string.format(" isFixSubTarget: %s", tostring(target.method_isFixSubTarget)))
imgui.text(string.format(" isDisableHud: %s", tostring(target.method_isDisableHud)))
imgui.text(string.format(" isCheckmark: %s", tostring(target.method_isCheckmark)))
imgui.text(string.format(" isDispProgressChat: %s", tostring(target.method_isDispProgressChat)))
imgui.spacing()
imgui.tree_pop();
end
imgui.tree_pop();
end
end
end
local menu_open = false
local frames = 30
re.on_frame(function()
if (menu_open) then
if (frames > 30) then
updateQuestTargetData();
frames = 0
end
frames = frames + 1
menu_open = imgui.begin_window('Quest Target Data', menu_open, ImGuiWindowFlags_AlwaysAutoResize)
imgui.text(string.format("getQuestTargetTotalBossEmNum: %d", getQuestTargetTotalBossEmNum));
imgui.text(string.format("getQuestTargetTotalTgtNum: %d", getQuestTargetTotalTgtNum));
imgui.text(string.format("getQuestTargetTotalCount: %d", getQuestTargetTotalCount));
imgui.spacing()
imgui.text(string.format("getMainTargetListForUI Type: %s", getMainTargetListForUI_Type));
imgui.text(string.format("getMainTargetListForUI Count: %d", getMainTargetListForUI_Count));
imgui.spacing()
drawTargetsData();
imgui.end_window()
end
end)
re.on_draw_ui(function()
imgui.begin_group();
if imgui.button('Toggle Data') then
menu_open = not menu_open
end
imgui.end_group();
end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment