Skip to content

Instantly share code, notes, and snippets.

View EvidentlyCube's full-sized avatar

Maurycy Zarzycki EvidentlyCube

View GitHub Profile
@EvidentlyCube
EvidentlyCube / Align_Center_Middle.ts
Last active August 29, 2015 14:19
Phaser augments by Retrocade.net
(function(Phaser, PIXI){
var defineFor = function(classDef){
classDef.prototype.positionCenter = function(){
this.center = Phaser.GAMES[0].width / 2;
};
classDef.prototype.positionMiddle = function(){
this.middle = Phaser.GAMES[0].height / 2;
};
classDef.prototype.positionCenterParent = function(){
if (this.parent !== null){
@EvidentlyCube
EvidentlyCube / Trimps plugin: Precise number on hover
Created August 31, 2016 08:26
Displays a tooltip with precise number when hovering over all numbers in Trimps. Warning: the numbers rendered before the plugin is loaded won't register the tooltip handlers, so for example HPs before you fight might not react.
// ==UserScript==
// @name Trimps precise number hover
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Displays a tooltip with precise number when hovering over all numbers in Trimps. Warning: the numbers rendered before the plugin is loaded won't register the tooltip handlers, so for example HPs before you fight might not react.
// @author Maurycy Zarzycki, Retrocade.net
// @match https://trimps.github.io/
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
@EvidentlyCube
EvidentlyCube / Trimps autoplay script
Created September 10, 2016 10:04
A simple autoscript for Trimps game for personal use, is not very intelligent. Press "a" to toggle on/off. In order to run it open the game page, press open developer tools (F12 in Chrome and FF), select console, now refresh the page,, wait for it to load, paste the script and press enter. It runs by default, press a in game window to toggle it …
window.isAutomaticTrimpsRunning = true;
if (typeof game !== 'undefined'){
window.game = game;
}
if (typeof window.game === 'undefined' || window.game == null){
console.error("Save and refresh the page and run the script again");
throw new Error("");
}
@EvidentlyCube
EvidentlyCube / Main.cs
Last active October 7, 2016 10:45
Rewriting TN in MonoGame #1: Setting Up the Project - Bootstrap files - related post at: http://retrocade.net/2016/10/07/rewriting-tn-in-monogame-1-setting-up-the-project/
using System;
namespace TransNeuronica
{
//#if WINDOWS || LINUX // This conditional compilation is commented out because right now not all constants are correctly defined
// and we can't add our own in a simple fashion. I'll figure it out later
public static class Program
{
[STAThread]
static void Main()
@EvidentlyCube
EvidentlyCube / hookJsdom.js
Last active April 19, 2019 12:12
Hooking JSDom for PixiJS to run correctly in Mocha
/**
* Adapted from https://github.com/rstacruz/jsdom-global
* Make sure this file is registered when running tests by adding this to the command with which you run mocha:
* -r <path>/hookJsdom.js
*/
const JSDOM = require( 'jsdom' ).JSDOM;
const jsdomOptions = {
url: 'http://localhost/'
};
@EvidentlyCube
EvidentlyCube / BufferableContainer.ts
Last active April 26, 2019 10:09
PIXI Optimized add/remove child container
import * as PIXI from 'pixi.js';
// Caution #1: it's written in TypeScript!
// Caution #2: it uses the fast element removal method (move last element into removed element's place and change array length)
// which changes the order of items in the array, so your rendering order will be affected
// Caution #3: events are not triggered
export class BufferableContainer extends PIXI.Container
{
private readonly childrenToAdd: PIXI.DisplayObject[];
@EvidentlyCube
EvidentlyCube / Pool.ts
Created April 26, 2019 08:30
A simple Pool class I used for Trans Neuronica
export class Pool<T>
{
private readonly _pool: T[];
private readonly _construct: () => T;
private readonly _autoHydrateSize: number;
private _indexInPool: number;
constructor(initialCapacity: number, construct: () => T, autoHydrateSize: number = 1)
{
this._pool = [];
@EvidentlyCube
EvidentlyCube / pre-commit
Created May 27, 2022 08:51
Pre commit hook that helps you avoid accidentally committing debug code + prevent commits to certain branches
#!/bin/bash
confirm() {
while true; do
read -p "$1 y/n " -n 1 yn < /dev/tty
case $yn in
[Yy]* ) echo ;break;;
[Nn]* ) echo ;exit 1;;
* ) echo ;echo "Please answer y or n.";;
esac
@EvidentlyCube
EvidentlyCube / Rm2k3ProtectionRemover.js
Created October 21, 2024 14:10
RPG Maker 2k3 Protection Remover in Node
/**
* AUTHOR: Maurycy Zarzycki
* WEBSITE: www.evidentlycube.com
* DESCRIPTION:
* This is a Node script that removes protection from RPG Maker 2000 and 2003
* games via RM2k3 General Utility Tool.
* It was not thoroughly tested, I used it so I could fix a very old game of mine,
* Diamentowa Przygoda, where I "accidentally" released the game with the start
* position in the wrong place.
*