Skip to content

Instantly share code, notes, and snippets.

@jd28
jd28 / test.md
Last active May 24, 2020 03:53
std::function test
#include <functional>
#include <iostream>

struct Test {
    int i;
    Test() = default;
    Test(const Test& other) : i{other.i} {
        std::cout << "   Copy" << std::endl;
 }
#include "API/Types.hpp"
#include "Maybe.hpp"
#include "Services/Events/Events.hpp"
#include "Services/Services.hpp"
#include "Services/Hooks/Hooks.hpp"
#include "Utils.hpp"
namespace NWNXLib::Services::Scripting
{
// Define your races and your FE feats, make these for each custom race replacing MYRACE
// with a more descriptive name.
#define RACIAL_TYPE_MYRACE <index into the race 2da>
#define FEAT_FAVORED_ENEMEY_MYRACE <index into the feat 2da>
int Hook_GetFavoredEnemyBonus(CNWSCreatureStats *attacker, CNWSCreature *defender) {
uint16_t race = defender->cs_stats->cs_race;
int feat = -1;
switch(race) {
@jd28
jd28 / 2damerger
Last active August 29, 2015 14:13
2da merger bat
@setlocal EnableDelayedExpansion
@set files=
@FOR %%X IN (examples\2dilate\samples\*.2da) DO @set files=!files! %%X
@2dilate -o myoutputdir examples\2dilate\2dx %files%
@jd28
jd28 / hak_to_csv.py
Created January 28, 2014 20:21
dump hak file list to csv
#!/usr/bin/env python
from pynwn.file.erf import Erf
import os
import hashlib
hak_dir = '.'
cep_hak_list = ['cep2_top_v24.hak',
'cep2_custom.hak',
@jd28
jd28 / raise.ls
Last active December 20, 2015 11:08
Raise placeables, waypoints, items by 5m.
#Replace your module here... make a backup first.
%mod = 'test.mod';
# Change this to whatever the tileset prefix.
$tileset_filter = "ttr01";
#Amount to raise objects.
$raise = 5.0;
# List to hold the git files.
@jd28
jd28 / nwserver_query.py
Created December 11, 2012 20:52
Python 2.7 NWN Server query.
import socket
host = "<IP>" #Server IP
port = 5121 #Server Port
query = "\xFE\xFD\x00\xE0\xEB\x2D\x0E\x14\x01\x0B\x01\x05\x08\x0A\x33\x34\x35\x13\x04\x36\x37\x38\x39\x14\x3A\x3B\x3C\x3D\x00\x00"
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.sendto(query, (host, port))