Skip to content

Instantly share code, notes, and snippets.

View Naios's full-sized avatar

Denis Blank Naios

  • Germany
View GitHub Profile
==7472== Helgrind, a thread error detector
==7472== Copyright (C) 2007-2013, and GNU GPL'd, by OpenWorks LLP et al.
==7472== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==7472== Command: build/continue_test
==7472== Parent PID: 7471
==7472==
==7472== ---Thread-Announcement------------------------------------------
==7472==
==7472== Thread #1 is the program's root thread
==7472==
@Naios
Naios / TaskSchedulerExamples.md
Last active September 4, 2019 12:08
Task Scheduler usage examples

TaskScheduler guide for TrinityCore Scripting

The TaskScheduler was introduced in commit TrinityCore/TrinityCore@da77a90 and TrinityCore/TrinityCore@151a0f5 as a better alternative to eventmap.

It is adapted to the current needs of scripting which means scheduling of event between a random range, schedulling with readable std::chrono constants, repeating of events and more.

See this script for a short usage example

Basic Usage

@Naios
Naios / functional_unwrap.hpp
Last active July 31, 2023 01:53
C++ functional argument unwrap traits. Extracts argument and return types of functions, std:.function and std::tuple's
/*
* Copyright (C) 2015 Naios <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
struct Fluent
{
template <typename T>
using Callback = std::function<void(T)>;
template <typename T>
Fluent& doSomething(Callback<T> const& t)
{
return *this;
}
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 0fa500c..caa162f 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -23,6 +23,7 @@
#include "Errors.h"
#include "ByteConverter.h"
#include "Util.h"
+#include "Common.h"
@Naios
Naios / Archive.h
Created April 25, 2015 20:37
Archive of code pieces
//! Returns an optional created from the given value.
template <typename T>
inline typename std::enable_if<!std::is_rvalue_reference<T>::value, Optional<T>>::type
make_optional(typename std::decay<T>::type const& value)
{
return Optional<T>(value);
}
//! Returns an optional created from the given moved value.
template <typename T>
language: cpp
compiler:
- gcc
- clang
git:
depth: 1
before_install:
@Naios
Naios / trinitycore.cppcheck
Created March 11, 2015 10:16
Cppcheck project file for TrinityCore
<?xml version="1.0" encoding="UTF-8"?>
<project version="1">
<includedir>
<dir name="TrinityCore/dep/"/>
</includedir>
<paths>
<dir name="TrinityCore/src/server/"/>
</paths>
<exclude>
<path name="boost/"/>
@Naios
Naios / WIdeQuestTemplate.md
Last active August 29, 2015 14:16
WIde Quest Template example

###Code:###

final ServerStorage<QuestTemplate> questTemplate = requestServerStorage("world", "quest_template");
final QuestTemplate riseOfTheSilithid = questTemplate.request(ServerStorageKeys.ofQuestTemplate(32)).get();

System.out.println("\n (Creature Template):\n");

questTemplate.getChangeTracker().setScope("q1", "Edit quest Rise of the Silithid\nonly mages allowed\nand set prev and next quest");
riseOfTheSilithid.prevQuestId().set(28);
riseOfTheSilithid.nextQuestId().set(32);

###Code:###

System.out.println("\nShort Example:\n");
final ServerStorage<CreatureTemplate> creatureTemplate = requestServerStorage("world", "creature_template");
final CreatureTemplate maloriak = creatureTemplate.request(ServerStorageKeys.ofCreatureTemplate(41378)).get();
 
creatureTemplate.getChangeTracker().setScope("1", "Some flag changes \n and comment tests");
maloriak.unit_flags().removeFlag(UnitFlags.UNIT_FLAG_DISARMED);
maloriak.unit_flags().addFlag(UnitFlags.UNIT_FLAG_IMMUNE_TO_NPC);