Skip to content

Instantly share code, notes, and snippets.

@robinsch
robinsch / .lua
Last active April 22, 2024 10:44
client events
local f = CreateFrame("Frame")
f:RegisterEvent("MY_CUSTOM_EVENT")
-- Set the OnEvent script handler
f:SetScript("OnEvent", function(self, event, ...)
if event == "MY_CUSTOM_EVENT" then
local arg1, arg2, arg3 = ...
print(event, arg1, type(arg1), arg2, type(arg2), arg3, type(arg3))
end
end)
@robinsch
robinsch / client.lua
Created April 11, 2024 14:26
lua DBC
local dbc = CreateDBC("DBFilesClient\\ZoneStory.dbc")
dbc:SetUInt("DisplayAchievementID")
dbc:SetFloat("TextCoordsX1")
dbc:SetFloat("TextCoordsX2")
dbc:SetFloat("TextCoordsY1")
dbc:SetFloat("TextCoordsY2")
dbc:Load()
-- global
zoneStory = dbc
@robinsch
robinsch / .lua
Last active April 7, 2024 16:45
AuraEffectEvent Examples
-- AuraEffectEvents
-- 53817 - spell_sha_maelstrom_weapon
local SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS = 70832
local SPELL_SHAMAN_MAELSTROM_POWER = 70831
local function OnEffectApply(event, aurEff, mode)
if (aurEff:GetBase():GetStackAmount() < aurEff:GetBase():GetSpellInfo():GetStackAmount()) then
return
end
@robinsch
robinsch / .lua
Created April 3, 2024 05:59
AuraEvent Examples
-- AuraEvents
-- 64364 - spell_pal_aura_mastery_immune
local SPELL_PALADIN_CONCENTRACTION_AURA = 19746
local function DoCheckAreaTarget(event, aura, target)
return target:HasAura(SPELL_PALADIN_CONCENTRACTION_AURA, target:GetGUID())
end
-- no examples in TrinityCore
@robinsch
robinsch / .lua
Last active April 3, 2024 06:01
SpellEvent / SpellEffectEvent Examples
-- SpellEvents
local function OnCast(event, spell, skipCheck)
SendWorldMessage("OnCast")
end
local function BeforeHit(event, spell)
SendWorldMessage("BeforeHit")
end
@robinsch
robinsch / .diff
Created March 8, 2024 21:13
Tools
---
src/tools/map_extractor/System.cpp | 42 +++------------
src/tools/vmap4_extractor/vmapexport.cpp | 68 +++---------------------
2 files changed, 14 insertions(+), 96 deletions(-)
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 6b83a7d046..038b669a2c 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -26,6 +26,7 @@
@robinsch
robinsch / .patch
Last active November 7, 2023 07:33
Mail Gold Dupe Fix
From cab67c3e9e3f481ddaa118ee503d9c23b0d8e090 Mon Sep 17 00:00:00 2001
From: robinsch <hello@robinsch.com>
Date: Tue, 7 Nov 2023 08:31:22 +0100
Subject: [PATCH] Core/Mail: Fixed sending multiple mails before async handler
has finished executing current mail process
---
src/server/game/Handlers/MailHandler.cpp | 10 +++++++++-
src/server/game/Server/WorldSession.cpp | 1 +
src/server/game/Server/WorldSession.h | 1 +
@robinsch
robinsch / 1.cpp
Last active September 12, 2023 12:51
CGUnit_C::GetModelScale
float __thiscall CGUnit_C::GetModelScale(CGUnit_C *this, CreatureDisplayInfoRec *displayInfo, CreatureModelDataRec *modelData)
{
cache = this->m_cache;
if ( cache )
familyID = cache->Family;
else
familyID = 0;
if ( familyID < g_CreatureFamilyDB.m_minID || familyID > g_CreatureFamilyDB.m_maxID )
creatureFamilyRec = 0;
else
#include <Windows.h>
#include <string>
#include <unordered_set>
#include <fstream>
static std::unordered_set<std::string> s_files;
static size_t s_basePathLength = 0;
static std::ofstream s_listfile = std::ofstream("(listfile)", std::ofstream::out | std::ofstream::trunc);
static char* (__cdecl* sub_433590_orig)(int a1, int a2, char const* fn) = (decltype(sub_433590_orig))0x00433590;
@robinsch
robinsch / .bat
Created May 22, 2023 14:43
WDBX Editor Update
SET WDBX="C:\WDBXEditor\WDBX Editor.exe"
FOR %%A IN (%*) DO %WDBX% -sqlload -f %%A -b 12340 -m 2 -c "Server=127.0.0.1;Database=database;Uid=trinity;Pwd=trinity;"