Skip to content

Instantly share code, notes, and snippets.

@vanasis
vanasis / Result.cs
Created May 3, 2024 08:54 — forked from m-jovanovic/Result.cs
Result type
public class Result
{
protected internal Result(bool isSuccess, Error error)
{
if (isSuccess && error != Error.None)
{
throw new InvalidOperationException();
}
if (!isSuccess && error == Error.None)
@vanasis
vanasis / ReplaceYeKe.sql
Created April 23, 2024 08:23 — forked from Hameds/ReplaceYeKe.sql
Replace Arabic ي & ك in SQL Server Database with Persian characters
use [DATABASE_NAME];
DECLARE @Table NVARCHAR(MAX)
DECLARE @Col NVARCHAR(MAX)
DECLARE Table_Cursor CURSOR
FOR
--پيدا کردن تمام فيلدهاي متني تمام جداول ديتابيس جاري
SELECT a.name, --table
b.name --col
FROM sysobjects a,
syscolumns b
@vanasis
vanasis / Ref.cs
Created October 1, 2023 21:03 — forked from svermeulen/Ref.cs
C# class to wrap convert value types to reference types by wrapping them in a reference type
public class Ref<T> where T: struct
{
T _value;
public Ref(T value)
{
_value = value;
}
public T Value
@vanasis
vanasis / iranian-phone-numbers-regex.md
Created July 17, 2023 05:31 — forked from MoienTajik/iranian-phone-numbers-regex.md
Regex For Iranian Mobile Phone Numbers

Regex For Iranian Phone Numbers

This regex supports all kinds of Iranian mobile phone numbers :

^(\+98|0)?9\d{9}$


Regex Visualized

@vanasis
vanasis / whisper.cpp
Last active August 29, 2015 14:25 — forked from Lillecarl/whisper.cpp
void SendWhisper(std::string message, std::string name = "")
{
CGObject_C *pPlayer = s_objMgr.GetObjectPtr(s_objMgr.GetActivePlayerGuid(), TYPEMASK_PLAYER);
if (!pPlayer)
return;
uint32 lang = 0;
switch (pPlayer->GetValue<uint64>(UNIT_FIELD_FACTIONTEMPLATE))
@vanasis
vanasis / something4.cpp
Last active August 29, 2015 14:25 — forked from Lillecarl/something4.cpp
I DIDNT MAKE THIS!
#include "ScriptPCH.h"
uint32 auras[] = { 48162, 48074, 48170, 43223, 36880, 467, 48469 };
class duel_reset : public PlayerScript
{
public:
duel_reset() : PlayerScript("duel_reset") { }
void RevivePlayer(Player* pPlayer)
@vanasis
vanasis / something3.cpp
Last active August 29, 2015 14:25 — forked from Lillecarl/something3.cpp
I DIDNT MAKE THIS!
#include "Player.h"
#include "ScriptPCH.h"
class afk_protection : public PlayerScript
{
public:
afk_protection() : PlayerScript("afk_protection") { }
bool isAFK(Player* player)
{
class spell_gen_prestige : public SpellScriptLoader
{
public:
spell_gen_prestige() : SpellScriptLoader("spell_gen_prestige") {}
class spell_gen_prestige_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_prestige_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
@vanasis
vanasis / gist:786db79b88f86fc3f780
Last active August 29, 2015 14:25
BY AOKROMESZ
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index cc23036..73360ce 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -117,6 +117,7 @@ void LoadDisables()
case DISABLE_TYPE_QUEST:
break;
case DISABLE_TYPE_MAP:
+ case DISABLE_TYPE_LFG_MAP:
{
@vanasis
vanasis / asdf.cpp
Last active August 29, 2015 14:25
see line 11 to 27
void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
{
uint8 type = (bg->isArena() ? 1 : 0);
// last check on 2.4.1
data->Initialize(MSG_PVP_LOG_DATA, (1 + 1 + 4 + 40 * bg->GetPlayerScoresSize()));
*data << uint8(type); // type (battleground=0/arena=1)
if (type) // arena
{
// it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H