Skip to content

Instantly share code, notes, and snippets.

@DennisCorvers
DennisCorvers / accountsetup.js
Last active April 5, 2024 02:42
Melvor Idle - Fresh start account setup
// Script for base test character!
// ===============================
// List of all dungeons to complete once
// This is for progression unlocks like the passive slot.
const dungeonsToComplete = [
'melvorF:Into_the_Mist',
'melvorF:Impending_Darkness',
'melvorD:Volcanic_Cave',
'melvorF:Air_God_Dungeon',
using System;
using System.Collections.Generic;
public class Program
{
private static Random r = new Random();
public static void Main()
{
long rolls = 0;
long total = 0;
@DennisCorvers
DennisCorvers / Logger.cs
Created August 19, 2021 00:23
Lightweight logger for enabling quick drag-n-drop logging
public class Logger
{
private readonly object m_syncRoot;
private readonly string m_logFileName;
private const string timeFormat = "yyyy-MM-dd HH:mm:ss";
/// <summary>
/// The minimum <see cref="LogLevel"/> required for log messages to be logged.
/// </summary>
public LogLevel MinimumLevel
@DennisCorvers
DennisCorvers / App.cs
Created August 18, 2021 23:49
Embedded .dll load
// Loads all .dll files embedded as resources from the folder Root/Libs
// This allows for single file, portable executables
static App()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
@DennisCorvers
DennisCorvers / MathFast.cs
Created March 23, 2021 15:07
Copy of Unity Mathf with inlined functions.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine;
/// <summary>
/// A collection of common math functions.
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct MathFast
@DennisCorvers
DennisCorvers / UnsafeSocket.cs
Created March 6, 2021 01:46
Bindings using reflection directly to the underlying Socket API
.NET variant. Does NOT work in .Net Core environments.
public unsafe class UnsafeSocket : Socket
{
#region Unsafe Setup
private delegate int UnsafeSocketHandle(IntPtr socketHandle, byte* buffer, int length, SocketFlags socketFlags);
private static UnsafeSocketHandle UnsafeSend;
private static UnsafeSocketHandle UnsafeReceive;
private static MethodInfo GetHandleInfo;
@DennisCorvers
DennisCorvers / BlittableBool.cs
Created March 4, 2021 12:48
A boolean value-type that adheres to the "Unmanaged" constraint
using System;
namespace GitGists
{
[Serializable]
public struct BlittableBool : IComparable, IConvertible, IComparable<BlittableBool>, IEquatable<BlittableBool>
{
private const int True = 1;
private const int False = 0;