Skip to content

Instantly share code, notes, and snippets.

View NoxMortem's full-sized avatar

Kevin Streicher NoxMortem

  • Vienna
View GitHub Profile
@NoxMortem
NoxMortem / Shadowrun.js
Last active July 24, 2016 11:25
Shadowrun Roll20 Sheet by Wandler
// Github:
// By: Wandler, The Apprentice
// Contact:
var Shadowrun = Shadowrun || (function() {
'use strict';
var version = '0.0.1',
lastUpdate = 1427604268,
tableCache = {},
on("change:repeating_skillsactionmod remove:repeating_skillsactionmod",function() {
var modifiers = {};
TAS.repeating("skillsactionmod")
.fields('skillsname','modifier','active') //< specifying the fields we care about
.reduce(function(m,r){
if(!(r.skillsaction_name in m.modifiers)){
m.modifiers[r.skillsaction_name] = 0;
}else{
if(r.active === "on"){
m.modifiers[r.skillsaction_name] += r.modifier;
var copyCharacter = function(name){
var characters = findObjs({type:'character'});
var i = characters.length;
var old = _.filter(characters,function(o){return o.get('name') === name})[0];
if(old === undefined){log("Character "+name+" not found!");return;}
var nr = 0;
var c_name = name+" "+nr;
while(_.filter(characters,function(o){return o.get('name') === c_name}).length>0){
nr++;//Increment counter until we found a unique character
c_name = name+" "+nr;
var cleanUp = function(){
var attributes_of_deleted = findObjs({type:'attribute'});
var abilities_of_deleted = findObjs({type:'ability'});
//log("#Attributes after delete: "+attributes_of_deleted.length);
var count = 0;
log("LIST trash attributes");
for(var attr in attributes_of_deleted){
attr = attributes_of_deleted[attr];
var chr = findObjs({type:'character',id:attr.get('characterid')});
on("sheet:opened change:repeating_attrmodkon remove:repeating_attrmodkon",function() {
TAS.repeating("attrmodkon")
.attrs("kon_mod") //< getting the attributes for the totals
.fields('value','active') //< specifying the fields we care about
.reduce(function(m,r){
var active = r.active;
if(active == "on"){
m += parseInt(r.I.value); //< Generate a running cost
}
return m;
@NoxMortem
NoxMortem / parse.py
Created May 19, 2016 11:58
A tiny python script which parses an input file in the same folder for strings between "" or '' and searches for a prefix. Example usage: python parse.py "html.html" "attr_"
import sys
import re
import os
inputfile = sys.argv[1]
prefix = sys.argv[2]
print("Extract:"+prefix);
def lreplace(pattern, sub, string):
"""
import sys
import re
import os
prefix = sys.argv[1]
print("Extract:"+prefix);
def lreplace(pattern, sub, string):
"""
Replaces 'pattern' in 'string' with 'sub' if 'pattern' starts 'string'.
@NoxMortem
NoxMortem / css.css
Last active June 12, 2016 12:57
Kevin de Kerpel Charactersheet Hack Version 2016-06-12
/* Uploaded to GitHub 12/07 */
/* No changes, resubmit of update */
/* Light colored background */
/* Template 2 */
.sheet-rolltemplate-sr2 table {
width: 100%;
background-color: white;
border: 1px solid #000;
/* Uploaded to GitHub 12/07 */
/* No changes, resubmit of update */
/* Light colored background */
/* Template 2 */
.sheet-rolltemplate-sr2 table {
width: 100%;
background-color: white;
border: 1px solid #000;
@NoxMortem
NoxMortem / css.css
Created May 14, 2016 21:28
Modified Shadowrun 5e sheet for kevin z (roll20)
/* Uploaded to GitHub 12/07 */
/* No changes, resubmit of update */
/* Light colored background */
/* Template 2 */
.sheet-rolltemplate-sr2 table {
width: 100%;
background-color: white;
border: 1px solid #000;