Skip to content

Instantly share code, notes, and snippets.

View xiaoxiao921's full-sized avatar

Quentin xiaoxiao921

  • France
  • 18:24 (UTC +02:00)
View GitHub Profile
@xiaoxiao921
xiaoxiao921 / template.cpp
Last active July 1, 2023 16:12
Some C++ Templates
template<typename T>
concept _is_pointer_ = requires(T a)
{
*a;
};
#pragma once
#include "lua/sol.hpp"
namespace lua::native
@xiaoxiao921
xiaoxiao921 / wren_template.hpp
Created October 15, 2022 13:46
C++ Template
#define WREN_ADD_FOREIGN_FUNC(fn) wren_add_foreign_func<&fn>(#fn)
static std::unordered_map<void*, void(*)()> native_func_to_wren_handler;
template <typename Signature, Signature signature>
struct wren_foreign_func;
template <typename ReturnType, typename... Args, ReturnType(*function_pointer)(Args...)>
struct wren_foreign_func<ReturnType(*)(Args...), function_pointer>
{
Awake method of your mod
RoR2Application.onLoad += Thing;
// Code partially taken from https://github.com/PassivePicasso/ThunderKit/blob/master/Editor/Addressable/Tools/AddressableBrowser.cs
private void Thing()
{
var assetlazy = Addressables.LoadAssetAsync<UnityEngine.Object>("RoR2/Base/Huntress/Skins.Huntress.Alt1.asset").WaitForCompletion();
//Logger.LogError(assetlazy);
using BepInEx;
using RoR2;
using System;
using System.Text;
public static void Parse()
{
var stringBuilder = new StringBuilder();
stringBuilder.Append("{| class=\"wikitable\"" + Environment.NewLine +
"|+ Items" + Environment.NewLine +
@xiaoxiao921
xiaoxiao921 / Parser.cs
Last active November 9, 2021 11:22
Parser And Format MediaWiki For ObjectDB For Valheim
internal static void Dump(this ObjectDB objectDB)
{
var consumablesTable = new StringBuilder();
consumablesTable.Append("{| class=\"wikitable\"" + Environment.NewLine +
"|+ Consumables" + Environment.NewLine +
"! Index" + Environment.NewLine +
"! Prefab Name" + Environment.NewLine +
"! Token Name" + Environment.NewLine +
"! Localized Name" + Environment.NewLine +
"! Max Stack Size" + Environment.NewLine +
@xiaoxiao921
xiaoxiao921 / print_files_paths.py
Created August 26, 2020 13:12
Print paths of all files in subdirectories
import pathlib
import os
import sys
with open('paths.txt', 'w') as f:
sys.stdout = f
directory = os.path.dirname(os.path.realpath(__file__))
for filepath in pathlib.Path(directory).glob('**/*'):
path = filepath.absolute().as_posix()[89:]
if not path.endswith("meta"):
@xiaoxiao921
xiaoxiao921 / Parser.cs
Last active August 13, 2020 23:27
Parser And Format MediaWiki For Items and Equipments ID For RoR2
var stringBuilder = new StringBuilder();
stringBuilder.Append("{| class=\"wikitable\"" + Environment.NewLine +
"|+ Items" + Environment.NewLine +
"! Index" + Environment.NewLine +
"! Code Name" + Environment.NewLine +
"! Real Name" + Environment.NewLine +
"! Tier" + Environment.NewLine +
"! Tags" + Environment.NewLine +
"|-" + Environment.NewLine + Environment.NewLine);