├── .gitignore ├── README.md ├── config ├── Colors.ini ├── d2server.ini └── d2warden.ini ├── d2gs ├── 1.asm ├── 1.exe ├── ASMBAT.bat ├── D2GS.exe ├── Storm.dll ├── UberQuest.asm ├── Warden.asm ├── d2server.dll └── patch_d2server.exe ├── d2warden-pvp ├── Build.h ├── CommonStructs.h ├── D2Consts.h ├── D2DataTables.h ├── D2Handlers.cpp ├── D2Handlers.h ├── D2Patches.cpp ├── D2Patches_111B.h ├── D2Patches_113D.h ├── D2Structs_111B.h ├── D2Structs_113D.h ├── D2Stubs.cpp ├── D2Stubs.h ├── ExPointers_111B.h ├── ExPointers_113D.h ├── HashGameSeed.asm ├── LCube.cpp ├── LCube.h ├── LDamage.cpp ├── LDamage.h ├── LEvents.cpp ├── LEvents.h ├── LItems.cpp ├── LItems.h ├── LMonsters.cpp ├── LMonsters.h ├── LPackets.cpp ├── LPackets.h ├── LParty.cpp ├── LParty.h ├── LQuests.cpp ├── LQuests.h ├── LRoster.cpp ├── LRoster.h ├── LServer.cpp ├── LServer.h ├── LSpectator.cpp ├── LSpectator.h ├── LUberQuest.cpp ├── LUberQuest.h ├── LWorldEvent.cpp ├── LWorldEvent.h ├── LegacyFuncs.cpp ├── LegacyFuncs.h ├── MainLoop.cpp ├── MainLoop.h ├── Misc.cpp ├── Misc.h ├── NodesEx.cpp ├── NodesEx.h ├── Offset.cpp ├── Offset.h ├── PartyExp.cpp ├── PartyExp.h ├── RC4.cpp ├── RC4.h ├── StatDumpThread.h ├── Votekick.cpp ├── Votekick.h ├── Warden.cpp ├── Warden.h ├── WardenChecks.h ├── WardenClient.cpp ├── WardenClient.h ├── WardenInit.cpp ├── d2warden.def ├── d2warden.sln ├── d2warden.suo ├── d2warden.txt ├── d2warden.v11.suo ├── d2warden.vcproj ├── d2warden.vcproj.BARTEK.1337.user ├── d2warden.vcxproj ├── d2warden.vcxproj.filters ├── d2warden.vcxproj.user ├── global.h ├── inih │ ├── cpp │ │ ├── INIReader.cpp │ │ └── INIReader.h │ ├── ini.c │ └── ini.h ├── introtate.h ├── md5.h ├── md5c.cpp ├── stdafx.cpp └── stdafx.h └── patch_d2server ├── AssemblyInfo.cpp ├── ReadMe.txt ├── app.ico ├── app.rc ├── patch_d2server.cpp ├── patch_d2server.sln ├── patch_d2server.vcproj ├── resource.h ├── stdafx.cpp └── stdafx.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | *.pdb 15 | *.idb 16 | *.htm 17 | *.obj 18 | *.tlog 19 | *.log 20 | *.pch 21 | *.user 22 | *.opensdf 23 | *.ipch 24 | *.suo 25 | d2warden-pvp/Debug/ 26 | d2warden-pvp/D2Patches.cpp.PVS-Studio.cfg 27 | d2gs/1.map 28 | d2warden-pvp/d2warden.sdf 29 | d2warden-pvp/none 30 | d2warden-pvp/D2Patches.i 31 | d2warden-pvp/LEvents.i-66bba5db 32 | d2warden-pvp/Release/ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | D2GS 1.13d - release -------------------------------------------------------------------------------- /config/Colors.ini: -------------------------------------------------------------------------------- 1 | ; Podstawowe 2 | ; enum D2Colors 3 | ; { 4 | ; COL_WHITE = 0, 5 | ; COL_RED = 1, 6 | ; COL_LIGHTGREEN = 2, 7 | ; COL_BLUE = 3, 8 | ; COL_DARK_GOLD = 4, 9 | ; COL_GREY = 5, 10 | ; COL_BLACK = 6, 11 | ; COL_GOLD = 7, 12 | ; COL_ORANGE = 8, 13 | ; COL_YELLOW = 9, 14 | ; COL_DARKGREEN = 10, 15 | ; COL_PURPLE = 11, 16 | ; COL_GREEN = 12, 17 | ; COL_WHITE2 = 13, 18 | ; COL_BLACK2 = 14, 19 | ; COL_DARKWHITE = 15, 20 | ; }; 21 | 22 | [Colors] 23 | Zurek = 8 24 | Inter = 1 25 | MrMag-WS = 1 26 | Brutal = 0 27 | -------------------------------------------------------------------------------- /config/d2server.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/config/d2server.ini -------------------------------------------------------------------------------- /config/d2warden.ini: -------------------------------------------------------------------------------- 1 | [Warden] 2 | ;Use #reload in game to refresh config 3 | 4 | ;GS name shown at start 5 | GSName = GS Test @Win7 6 | 7 | ; Account with permissions to use special commands (Acc1,acc2,acc3,...) 8 | Admins= LOLET 9 | 10 | ; Enables specatator mode 11 | EnableSpectator = 1 12 | 13 | ; Add `Looted from` field to item stats 14 | AddKillerClass = 1 15 | 16 | ; Automatically identify the items 17 | AutoIdentify = 1 18 | 19 | ; Set minimum level to hostile 20 | HostileLevel = 2 21 | 22 | ; Disable hostile delay 23 | DisableHostileDelay = 1 24 | 25 | ; Respawn timer (secs) 26 | RespawnTimer = 6 27 | 28 | ; Allow teleport to classes 0 - ama, 1 - sorc, 2 - nec, 3 - pal, 4 - barb, 5 - dru, 6 - asn 29 | AllowTeleport=1,5,3 30 | 31 | ;Stat dump interval in seconds 32 | ResDumpInterval=0 33 | 34 | ; Allowed player count (max 64) 35 | MaxPlayers=64 36 | 37 | ;Log chat messages to file 38 | LogChat=0 39 | 40 | ; Move corpses to town after death 41 | MoveToTown=1 42 | 43 | ; Dont drop ear & gold after death 44 | DontDropEarGold=1 45 | 46 | ; Fix str/dex bug 47 | StrBugFix=1 48 | 49 | ; Allow FFA mode [Special items at vendor] (parametr -ffa) 50 | FFAMode=1 51 | 52 | ; Allow to force map id (parameter -m eg. -m17) 53 | EnableSeedChange=1 54 | 55 | ; Allow to join with without D2Ex 56 | AllowVanilla=1 57 | 58 | ; Detect polish ga trick (spamming skills with open sub-window) 59 | DetectTrick=1 60 | 61 | ; Allow #gu command 62 | AllowGU=1 63 | 64 | ; Allow Holy Boly skill 65 | AllowHB=1 66 | 67 | ; Allow whirlwind namelock 68 | AllowNLWW=0 69 | 70 | ; URL with Clans data 71 | ClanDataURL=http://realm.angrenost.org/txt/Clans.ini 72 | 73 | ; URL with newest client patch 74 | UpdateURL=http://realm.angrenost.org/files/AR-PVP-10-02-12-patch.exe 75 | 76 | ; EXP Range (number^2, originally 6400 (80 yards)) 77 | ; 12.01.2014 -> Type -1 to no limit 78 | ExpRange = 12800 79 | 80 | ; Put 0 to disable all quests 81 | AllowQuests = 1 82 | 83 | ; Enable #lvl / #level command to boost 1 lvl character to 99 lvl with all quests 84 | EnableLevelCmd = 0 85 | 86 | ; Enable classic WW 87 | EnableClassicWW = 1 88 | 89 | AllowPierceBreakImmunites = 1 90 | 91 | ; Set 0 to disable 92 | MagicPierceStat = 358 93 | 94 | ; Set 0 to disable 95 | PhysicalPierceStat = 493 96 | 97 | MaxFireRes = 90 98 | MaxColdRes = 90 99 | MaxPsnRes = 90 100 | MaxLightRes = 90 101 | MaxDmgRes = 50 102 | 103 | [World Event] 104 | ; Use WE Key on Cow Level 105 | Enabled = 0 106 | ; Current sell count (DO NOT MODIFY THIS) 107 | SellCount = 171 108 | ; DC will came when sell count reach... - use #we command to check (DO NOT MODIFY THIS) 109 | NextDC =222 110 | ; Minimal count to sell 111 | MinSell = 40 112 | ; Maximal count to sell 113 | MaxSell = 60 114 | ; Inform player about sell count every X item sold (DO NOT SET 0 !!) 115 | InfoDelay = 1 116 | ;[itemcode:itemcode2...(do not exceed 20)],[quality:quality2...],[(optionally) class id from UniqueItems.Txt / SetItems:class2... (do not exceed 20)] 117 | ; Item codes : http://diablo.antikrist.org/item-codes/ 118 | ; Other items are in Misc.txt 119 | ; Item quality: whatever, low, normal, superior, magic, set,rare, unique, crafted, tempered 120 | ; whatever = low:normal:superior:magic:set:rare:unique:crafted:tempered 121 | ; -------------------------------------------------------------------------- 122 | ; Example. Unique and set amu & rings : Trigger = amu:rin, unique:set 123 | ; Example 2. Any charm: Trigger = cm1:cm2:cm3, whatever 124 | ; Example 3. SOJ : Trigger = rin, unique, 122 125 | Trigger = amu:rin, unique:set 126 | -------------------------------------------------------------------------------- /d2gs/1.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/1.asm -------------------------------------------------------------------------------- /d2gs/1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/1.exe -------------------------------------------------------------------------------- /d2gs/ASMBAT.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | IF NOT EXIST D:\Masm32\Bin\Ml.Exe GOTO _NoMasm32 4 | 5 | IF EXIST 1.obj DEL 1.obj 6 | IF EXIST 1.asm D:\MASM32\Bin\Ml.exe /ID:\MASM32\Include /c /Zf /Zd /Zi /Fm /coff 1.asm 7 | IF EXIST Resource.rc GOTO _ExistRC 8 | IF EXIST 1.obj D:\MASM32\Bin\Link.exe /DEBUGTYPE:COFF /PDB:1.pdb /BASE:0x68020000 /SUBSYSTEM:Console /LIBPATH:D:\MASM32\Lib 1.obj 9 | GOTO _Done 10 | 11 | :_ExistRC 12 | IF NOT EXIST Resource.res D:\MASM32\Bin\Rc.exe /iD:\MASM32\Include Resource.rc 13 | IF EXIST 1.obj D:\MASM32\Bin\Link.exe /SUBSYSTEM:Windows /LIBPATH:D:\MASM32\Lib 1.obj Resource.res 14 | 15 | :_Done: 16 | REM IF EXIST 1.obj DEL 1.obj 17 | GOTO :_End 18 | 19 | :_NoMasm32 20 | ECHO Could not find "D:\Masm32\Bin\Ml.Exe". 21 | 22 | :_End 23 | 24 | PAUSE -------------------------------------------------------------------------------- /d2gs/D2GS.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/D2GS.exe -------------------------------------------------------------------------------- /d2gs/Storm.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/Storm.dll -------------------------------------------------------------------------------- /d2gs/Warden.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/Warden.asm -------------------------------------------------------------------------------- /d2gs/d2server.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/d2server.dll -------------------------------------------------------------------------------- /d2gs/patch_d2server.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2gs/patch_d2server.exe -------------------------------------------------------------------------------- /d2warden-pvp/Build.h: -------------------------------------------------------------------------------- 1 | #define __BUILDNO__ 3677 -------------------------------------------------------------------------------- /d2warden-pvp/D2Handlers.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/D2Handlers.cpp -------------------------------------------------------------------------------- /d2warden-pvp/D2Handlers.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2HANDS_H__ 21 | #define D2HANDS_H__ 22 | 23 | void GAME_EmptyExtendedMemory(Game* pGame); 24 | DWORD __stdcall LEVELS_GetActByLevelNo(DWORD nLevel); 25 | BYTE __fastcall LEVELS_GetActByLevel(Level* pLevel); 26 | BYTE __fastcall LEVELS_GetActByRoom2(int _1, Room2* pRoom2); 27 | 28 | BOOL __fastcall D2GAME_IsUnitDead(UnitAny* pUnit); 29 | void __fastcall DAMAGE_FireEnchanted(Game *pGame, UnitAny *pUnit, int a4, int a5); 30 | DWORD __fastcall OnD2ExPacket(Game* ptGame, UnitAny* ptPlayer, BYTE *ptPacket, DWORD PacketLen); 31 | BOOL __stdcall isPermStore(Game* ptGame,UnitAny* ptNPC, UnitAny* ptItem); 32 | int __fastcall OnGameEnter(ClientData* pClient, Game* ptGame, UnitAny* ptPlayer); 33 | Room1* __stdcall D2GAME_PortalCrashFix(Act* ptAct, int LevelNo, int Unk0, int* xPos, int* yPos, int UnitAlign); 34 | 35 | void __fastcall OnMonsterDeath(UnitAny* ptKiller, UnitAny * ptVictim, Game * ptGame); 36 | void __fastcall OnNPCHeal(UnitAny* pUnit); 37 | int __fastcall ReparseChat(Game* pGame, UnitAny *pUnit, BYTE *ThePacket, int PacketLen); 38 | BOOL __fastcall OnChat(UnitAny* pUnit,BYTE *ThePacket); 39 | DWORD __fastcall SetDRCap(Attack *pAttack); 40 | void __stdcall OnLastHit(UnitAny* ptKiller, UnitAny * ptVictim, Damage * ptDamage); 41 | Act* __stdcall OnActLoad(DWORD ActNumber, DWORD InitSeed, DWORD Unk0, Game *pGame, DWORD DiffLvl, D2PoolManager* pMemPool, DWORD TownLevelId, DWORD Func1, DWORD Func2); 42 | void __fastcall OnManaLeech(UnitAny* pAttacker, UnitAny *pDefender,DWORD ManaToLeech); 43 | void __fastcall OnLifeLeech(UnitAny* pAttacker, UnitAny *pDefender,DWORD LifeToLeech); 44 | BOOL __fastcall OnReceivePacket (BYTE * ThePacket, PacketData * pClient); 45 | DWORD __stdcall OnPacketSend(DWORD unk1,DWORD ClientID,unsigned char *ThePacket,DWORD PacketLen); 46 | 47 | int __fastcall d2warden_0X68Handler(PacketData *pPacket); 48 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/D2Patches_111B.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2PATCHES_H__ 21 | #define D2PATCHES_H__ 22 | 23 | // -- Warden checks end 24 | 25 | 26 | #define D2GAME_ON_DEBUG_PACKET 0xE836C 27 | 28 | #define D2GAME_CLIENT_PACKET_WRAPPER_NEW 0x703B5 29 | 30 | #define D2GAME_MONSTERSPAWN_I 0x6F551 // mby crash 31 | 32 | #define D2GAME_LASTHITINTERCEPT 0x7D66D 33 | #define D2GAME_ONDAMAGECREATION 0x99130 34 | #define D2NET_CLIENT_PACKET_WRAPPER 0x62AD 35 | #define D2GAME_D2EX_CONNECT 0x2C1E0 36 | #define D2GAME_ACT_LOAD 0x617B5 37 | #define D2GAME_MOVE_PLAYER_CORPSE_TO_TOWN 0x42DAB 38 | #define D2GAME_HOSTILE_WP_DELAY 0xF2F67 39 | #define D2GAME_HOSTILE_BUTTON_DELAY 0xF2F2D 40 | #define D2GAME_GOLD_DROP_ON_DEATH 0x7F560 41 | #define D2GAME_EAR_DROP_ON_DEATH 0xD26C3 42 | #define D2GAME_FINDUNIT_FIX 0xBEF80 43 | #define D2GAME_PLAYER_MODE_INTERCEPT 0x41972 44 | #define D2GAME_STRDEX_BUG_FIX 0x2D34F 45 | #define D2GAME_CHAT_WRAPPER 0x2E670 46 | #define D2GAME_NPC_SLOW_MISSILE_HEAL 0x90171 47 | #define D2GAME_RESSURECT_FIX 0x32048 48 | #define D2GAME_ROSTER_WRAPPER 0x43067 49 | #define D2GAME_ON_MONSTER_DEATH 0x7E326 50 | #define D2GAME_NULL_ORIGINAL_SC_0X66 0x89680 51 | #define D2GAME_GAME_DESTROY_WRAPPER 0xE7A1A 52 | #define D2GAME_ADD_CLIENTTOGAME_WRAPPER 0xC6A32 53 | #define D2GAME_PLAYER_EVENTS_WRAPPER 0x2DC90 54 | #define D2GAME_0X66_WARDEN_PACKET_WRAPPER 0x2BE20 55 | #define D2GAME_0X05_WRAPPER 0x2F230 56 | #define D2GAME_0X0C_WRAPPER 0x2F1B0 57 | #define D2GAME_0X08_WRAPPER 0x2F580 58 | #define D2GAME_0X0F_WRAPPER 0x2F420 59 | #define D2GAME_0X06_WRAPPER 0x2F660 60 | #define D2GAME_0X07_WRAPPER 0x2F5E0 61 | #define D2GAME_0X09_WRAPPER 0x2F910 62 | #define D2GAME_0X0A_WRAPPER 0x2F8B0 63 | #define D2GAME_0X0D_WRAPPER 0x2F500 64 | #define D2GAME_0X0E_WRAPPER 0x2F480 65 | #define D2GAME_0X10_WRAPPER 0x2F850 66 | #define D2GAME_0X11_WRAPPER 0x2F7F0 67 | #define D2GAME_0X41_WRAPPER 0x31F60 68 | #define D2GAME_0X03_WRAPPER 0x2EEE0 69 | #define D2GAME_LOCK_HACK_WRAPPER 0xE6F00 70 | #define D2GAME_PERM_STORE_STUB_I 0x909EF 71 | #define D2GAME_PERM_STORE_STUB_II 0x928FC 72 | #define D2GAME_ITEM_COST_STUB 0x913CA 73 | #define D2CLIENT_EXTEND_GAME_STRUCT 0x2589 74 | #define D2COMMON_EXTEND_PLAYERDATA_STRUCT_I 0x5BFC9 75 | #define D2COMMON_EXTEND_PLAYERDATA_STRUCT_II 0x5BFDA 76 | #define D2GAME_PARTY_SHARE_FIX_PREPARE 0x7E248 77 | #define D2GAME_PARTY_SHARE_FIX 0x7E24A 78 | #define D2GAME_EXP_INCREASE_FIX 0xBD5B7 79 | #define D2GAME_EXP_INCREASE_FIX_2 0xBD310 80 | #define D2GAME_MAX_PLAYERS_CHANGE 0x7EBF0 81 | #define D2GAME_DECRESAE_CORPSE_NUMBER 0x424E6 82 | #define D2GAME_NULL_IRON_MAIDEN 0xFBF5C + 8 83 | #define D2GAME_NULL_LOWER_RESIST 0xFBF5C + 20 84 | #define D2GAME_COWS_DROP_FIX 0xD156A 85 | #define D2GAME_COW_LEVEL_QUEST_OVERRIDE 0x368C2 86 | #define D2GAME_RESPEC 0x4BC83 87 | #define D2GAME_FIRE_ENCHANTED_FIX 0xEBD50 88 | #define D2COMMON_COLOUR_ITEM_INTERCEPT_IV 0x41B6D 89 | #define D2COMMON_COLOUR_ITEM_INTERCEPT_V 0x418DC 90 | #define D2GAME_TRESURE_CLASS_CREATE_HNDLR 0xD159B 91 | #define FOG_MEM_ALLOC_OVERRIDE 0x1D380 92 | #define FOG_MEM_FREE_OVERRIDE 0x1CEE0 93 | #define FOG_MEM_REALLOC_OVERRIDE 0x1DBF0 94 | #define D2GAME_NODESEX_AI_TEMP_FIX 0x2341D 95 | #define D2GAME_NODESEX_BAAL_AI 0x2A790 96 | #define D2GAME_NODESEX_DIABLO_AI 0x80AA0 97 | #define D2GAME_NODESEX_ALLOC_16PLAYERS_NODES 0xEDF00 98 | #define D2GAME_NODESEX_FREE_16PLAYERS_NODES 0xEDD70 99 | #define D2GAME_NODESEX_FREE_CHILD_OF_16PLAYERS_NODES 0xEDC90 100 | #define D2GAME_NODESEX_GET_UNIT_NODE 0xEDC50 101 | #define D2GAME_NODESEX_SET_UNIT_NODE_AS_PARENT_MONSTERS 0xEDDE0 102 | #define D2GAME_NODESEX_SET_UNIT_NODE_AS_PARENT_PLAYERS 0xEDE70 103 | #define D2GAME_NODESEX_FREE_ALL_NODES 0xEDFC0 104 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_I 0xC2BCB 105 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_II 0xC2BD1 106 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_III 0xD2E05 107 | #define D2GAME_GAMEENTER_CHECK_NUMBER_OF_PLAYERS 0x70285 108 | #define D2GAME_GAMEENTER_CHECK_NUMBER_OF_PLAYERS_II 0xC5273 109 | #define D2GAME_NODESEX_FIX_TREASURE_CLASS_DROP 0xD20AB 110 | #define D2GAME_NODESEX_FIX_TREASURE_CLASS_DROP_II 0xD20B1 111 | #define D2GAME_NODESEX_CREATE_UNITANY_CHANGE_NEUTRAL_NODE 0xC0B05 112 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_I_F1 0x266B4 113 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_II_F2 0x26F19 114 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_III_F3 0x2936F 115 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_IV_F4 0x29B69 116 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATECORPSE_I 0x425DD 117 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_PLAYER_EVENT_CONTROLLER 0x8327B 118 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_I 0x13FD3 119 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_II 0x14193 120 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_III_F2 0x143F3 121 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IV_F3 0x1482B 122 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_V_F3 0x14A9B 123 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VI_F4_HUGE_ONE 0x14E44 124 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VII_F4_HUGE_ONE 0x150E3 125 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VIII_F5_SMALL_ONE 0x1531C 126 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IX_F6 0x1571F 127 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_X_MOVED_ONE_F6 0x15AAF 128 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XI_F7 0x15E37 129 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XII_F8 0x160F0 130 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIII_F9 0x163E8 131 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIV_F10 0x16592 132 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XV_F11 0x168A6 133 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVI_F12 0x16A38 134 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVII_F13 0x1741A 135 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPORTAL_I 0x31A7B 136 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVIII_F14 0x539B7 137 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIX_F15 0x54443 138 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XX_F16 0x548D2 139 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXI_F17 0xA806F 140 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXII_F17 0xA81DF 141 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXIII_F18 0xAF348 142 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXIV_F19 0xB03BF 143 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXV_F20 0xBA802 144 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXVI_F20 0xBA94D 145 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXVII_F21 0xBABF8 146 | #define D2GAME_NODESEX_CHANGE_PLAYERS_NODES_FROM_8 0x22C78 147 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE 0x22C9C 148 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEMONSTER_I_F1 0x94056 149 | #define D2GAME_NODESEX_REMOVEMONSTERCORPSE_CHANGE_ITERATION_TO_16 0x23D0A 150 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_MONSTERS_SKILL_NECRO 0xCC7DB 151 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_17_SAME_FUNC_AS_ABOVE 0xCC836 152 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES17_SAME_FUNC_AS_ABOVE_I 0xCC7EE 153 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES17_SAME_FUNC_AS_ABOVE_II 0xCC824 154 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_MONSTERS 0x834D1 155 | #define D2GAME_NODESEX_CHANGE_ITERATION_TO_16_SAME_FUNC_AS_ABOVE 0x8353C 156 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES16_SAME_FUNC_AS_ABOVE_I 0x834F4 157 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES16_SAME_FUNC_AS_ABOVE_II 0x8352A 158 | #define D2GAME_NODESEX_CHANGE_ITERATION_TO_16 0xC2D8A 159 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_16 0x23417 160 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_17 0x2342E 161 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IB 0x8E714 162 | 163 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/D2Patches_113D.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2PATCHES_H__ 21 | #define D2PATCHES_H__ 22 | 23 | #define D2GAME_PARSE_CREATE_PACKETS 0xBFEEE 24 | #define D2GAME_GAME_LOOP 0xC0049 25 | 26 | #define D2GAME_ON_DEBUG_PACKET 0xBFF2C 27 | 28 | #define D2GAME_DISABLE_ROOM_CACHE 0xC0008 29 | 30 | #define D2GAME_TIMER_EXPAND 0xC07A7 31 | 32 | #define D2GAME_QUESTINIT_I 0xBE401 33 | #define D2GAME_QUESTINIT_II 0xBE0F9 34 | 35 | #define D2GAME_GOLDTRANS_I 0x734E3 36 | #define D2GAME_GOLDTRANS_II 0x73624 37 | #define D2GAME_GOLDTRANS_III 0x73766 38 | #define D2COMMON_REPAIR_I 0x48C50 39 | #define D2COMMON_REPAIR_II 0x717A8 40 | 41 | #define D2GAME_ADDGOLD_I 0x73982 42 | #define D2GAME_ADDGOLD_II 0x739B1 43 | 44 | #define D2COMMON_GETBANKGOLDLIMIT_J -11025 45 | 46 | #define D2GAME_ISDEADOVERRIDE 0x6D410 47 | #define D2GAME_CLIENT_PACKET_WRAPPER_NEW 0xD53C5 48 | 49 | #define D2GAME_HOSTILELVL_I 0xF2DD4 50 | #define D2GAME_HOSTILELVL_II 0xF2DBD 51 | #define D2GAME_HOSTILELVL_III 0xF2E15 52 | #define D2GAME_HOSTILELVL_IV 0xF2D2C 53 | 54 | #define D2GAME_MONSTERSPAWN_I 0x1A3C0 55 | 56 | #define D2GAME_LASTHITINTERCEPT 0x8BEAD // k 57 | #define D2GAME_ONDAMAGECREATION 0x41BF0 // k 58 | #define D2NET_CLIENT_PACKET_WRAPPER 0x73AD // k 59 | #define D2GAME_D2EX_CONNECT 0x66EA0 // k 60 | #define D2GAME_ACT_LOAD 0x5D485 // k 61 | #define D2GAME_MOVE_PLAYER_CORPSE_TO_TOWN 0x93BCB //0x7418B // k 62 | #define D2GAME_HOSTILE_WP_DELAY 0xF2E67 // k 63 | #define D2GAME_HOSTILE_BUTTON_DELAY 0xF2E2D // k 64 | #define D2GAME_GOLD_DROP_ON_DEATH 0x9A6C0 // k 65 | #define D2GAME_EAR_DROP_ON_DEATH 0xE0143 // k 66 | #define D2GAME_FINDUNIT_FIX 0x6DC40 // k 67 | #define D2GAME_PLAYER_MODE_INTERCEPT 0x922C2 //k 68 | #define D2GAME_STRDEX_BUG_FIX 0x682CF //k 69 | #define D2GAME_CHAT_WRAPPER 0x69300 //k 70 | #define D2GAME_NPC_SLOW_MISSILE_HEAL 0x70B81 //k 71 | #define D2GAME_RESSURECT_FIX 0x6CCB8 // k 72 | #define D2GAME_ROSTER_WRAPPER 0x93DC7 // k 73 | #define D2GAME_ON_MONSTER_DEATH 0x8A976 // k 74 | #define D2GAME_NULL_ORIGINAL_SC_0X66 0x14F60 //k 75 | #define D2GAME_GAME_DESTROY_WRAPPER 0xBEA8A //k 76 | #define D2GAME_ADD_CLIENTTOGAME_WRAPPER 0xE7548 //k 77 | #define D2GAME_PLAYER_EVENTS_WRAPPER 0x68950 //k 78 | #define D2GAME_0X66_WARDEN_PACKET_WRAPPER 0x66AE0 //k 79 | #define D2GAME_0X05_WRAPPER 0x69D00 //k 80 | #define D2GAME_0X0C_WRAPPER 0x69C80 //k 81 | #define D2GAME_0X08_WRAPPER 0x6A280 //k 82 | #define D2GAME_0X0F_WRAPPER 0x6A120 //k 83 | #define D2GAME_0X06_WRAPPER 0x6A360 //k 84 | #define D2GAME_0X07_WRAPPER 0x6A2E0 //k 85 | #define D2GAME_0X09_WRAPPER 0x6A500 //k 86 | #define D2GAME_0X0A_WRAPPER 0x6A4A0 //k 87 | #define D2GAME_0X0D_WRAPPER 0x6A200 //k 88 | #define D2GAME_0X0E_WRAPPER 0x6A180 //k 89 | #define D2GAME_0X10_WRAPPER 0x6A440 //k 90 | #define D2GAME_0X11_WRAPPER 0x6A3E0 //k 91 | #define D2GAME_0X41_WRAPPER 0x6CBD0 //k 92 | #define D2GAME_0X03_WRAPPER 0x69790 //k 93 | #define D2GAME_LOCK_HACK_WRAPPER 0xBEF50 // k 94 | #define D2GAME_PERM_STORE_STUB_I 0x731EF // k 95 | #define D2GAME_PERM_STORE_STUB_II 0x72C8C // k 96 | #define D2GAME_ITEM_COST_STUB 0x733DA // k 97 | #define D2CLIENT_EXTEND_GAME_STRUCT 0x2469 // k 98 | #define D2COMMON_EXTEND_PLAYERDATA_STRUCT_I 0x170D9 // k 99 | #define D2COMMON_EXTEND_PLAYERDATA_STRUCT_II 0x170EA // k 100 | #define D2GAME_PARTY_SHARE_FIX_PREPARE 0x8A898 // k 101 | #define D2GAME_PARTY_SHARE_FIX 0x8A89A // k 102 | #define D2GAME_EXP_INCREASE_FIX 0x7DF97 // k 103 | #define D2GAME_EXP_INCREASE_FIX_2 0x7DCF0 // k 104 | #define D2GAME_MAX_PLAYERS_CHANGE 0x99810 // k 105 | #define D2GAME_DECRESAE_CORPSE_NUMBER 0x93666 // k 106 | #define D2GAME_NULL_IRON_MAIDEN 0xFB620 + 8 // k 107 | #define D2GAME_NULL_LOWER_RESIST 0xFB620 + 20 // k 108 | #define D2GAME_COWS_DROP_FIX 0xE36CA // k 109 | #define D2GAME_COW_LEVEL_QUEST_OVERRIDE 0x95492 // k 110 | #define D2GAME_RESPEC 0x4BC83 // STILL 1.11b 111 | #define D2GAME_FIRE_ENCHANTED_FIX 0xCF300 // k 112 | #define D2COMMON_COLOUR_ITEM_INTERCEPT_IV 0x3ADCD // k 113 | #define D2COMMON_COLOUR_ITEM_INTERCEPT_V 0x3AC6C // k 114 | #define D2GAME_TRESURE_CLASS_CREATE_HNDLR 0xE36FB // k 115 | #define FOG_MEM_ALLOC_OVERRIDE 0x1D380 // unused but 1.11b 116 | #define FOG_MEM_FREE_OVERRIDE 0x1CEE0 // unused but 1.11b 117 | #define FOG_MEM_REALLOC_OVERRIDE 0x1DBF0 // unused but 1.11b 118 | #define D2GAME_NODESEX_AI_TEMP_FIX 0x5981C // k 119 | #define D2GAME_NODESEX_BAAL_AI 0xC7420 //k 120 | #define D2GAME_NODESEX_DIABLO_AI 0x2CCE0 //k 121 | #define D2GAME_NODESEX_ALLOC_16PLAYERS_NODES 0xF07E0 // k 122 | #define D2GAME_NODESEX_FREE_16PLAYERS_NODES 0xF0650 // k 123 | #define D2GAME_NODESEX_FREE_CHILD_OF_16PLAYERS_NODES 0xF0570 // k 124 | #define D2GAME_NODESEX_GET_UNIT_NODE 0xF0530 // k 125 | #define D2GAME_NODESEX_SET_UNIT_NODE_AS_PARENT_MONSTERS 0xF06C0 // k 126 | #define D2GAME_NODESEX_SET_UNIT_NODE_AS_PARENT_PLAYERS 0xF0750 // k 127 | #define D2GAME_NODESEX_FREE_ALL_NODES 0xF08A0 // k 128 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_I 0xB1F7B // k 129 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_II 0xB1F81 // k 130 | #define D2GAME_NODESEX_CHANGE_NODE_OFFSET_III 0x49515 // k 131 | #define D2GAME_GAMEENTER_CHECK_NUMBER_OF_PLAYERS 0xD5295 // k 132 | #define D2GAME_GAMEENTER_CHECK_NUMBER_OF_PLAYERS_II 0xE5D53 // k 133 | #define D2GAME_NODESEX_FIX_TREASURE_CLASS_DROP 0xE417B // k 134 | #define D2GAME_NODESEX_FIX_TREASURE_CLASS_DROP_II 0xE4181 // k 135 | #define D2GAME_NODESEX_CREATE_UNITANY_CHANGE_NEUTRAL_NODE 0x6FF35 // k 136 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_I_F1 0x3ADF4 // k 137 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_II_F2 0x3B599 // k 138 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_III_F3 0x26A7F // k 139 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPLAYER_IV_F4 0x26FD9 // k 140 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATECORPSE_I 0x9375C // k 141 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_I 0x8DF43 // k 142 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_II 0x8E103 // k 143 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_III_F2 0x8E363 // k 144 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IV_F3 0x8E79B // k 145 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_V_F3 0x8EA0B // k 146 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VI_F4_HUGE_ONE 0x8EDB4 // k 147 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VII_F4_HUGE_ONE 0x8F053 // k 148 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_VIII_F5_SMALL_ONE 0x8F28C // k 149 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IX_F6 0x8F68F // k 150 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_X_MOVED_ONE_F6 0x8FA1F // k 151 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XI_F7 0x8FDBB // k 152 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XII_F8 0x9009B // k 153 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIII_F9 0x90388 // k 154 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIV_F10 0x90532 // k 155 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XV_F11 0x90846 // k 156 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVI_F12 0x909D8 // k 157 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVII_F13 0x913DA //k 158 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEPORTAL_I 0x6C8EB // k 159 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XVIII_F14 0x23867 // k 160 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XIX_F15 0x23D53 // k 161 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XX_F16 0x23B22 // k 162 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXI_F17 0xEBA7F // k 163 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXII_F17 0xEBBEF // k 164 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXIII_F18 0x81AC8 // k 165 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXIV_F19 0x8271F // k 166 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXV_F20 0x65C12 // k 167 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXVI_F20 0x65D5D // k 168 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_XXVII_F21 0x65A18 // k 169 | #define D2GAME_NODESEX_CHANGE_PLAYERS_NODES_FROM_8 0x59118 // k 170 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE 0x5913C // k 171 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEMONSTER_I_F1 0x74846 // k 172 | #define D2GAME_NODESEX_REMOVEMONSTERCORPSE_CHANGE_ITERATION_TO_16 0x5A0D5 // k 173 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_MONSTERS_SKILL_NECRO 0xD6B6B // k 174 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_17_SAME_FUNC_AS_ABOVE 0xD6BC6 // k <- confuse 175 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES17_SAME_FUNC_AS_ABOVE_I 0xD6B7E // k 176 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES17_SAME_FUNC_AS_ABOVE_II 0xD6BB4 // k 177 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_MONSTERS 0x31041 // k its NPCBARB ai function 178 | #define D2GAME_NODESEX_CHANGE_ITERATION_TO_16_SAME_FUNC_AS_ABOVE 0x310AC // k 179 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES16_SAME_FUNC_AS_ABOVE_I 0x31064 // k 180 | #define D2GAME_NODESEX_CHANGE_OFFSET_TO_NEWNODES16_SAME_FUNC_AS_ABOVE_II 0x3109A // k 181 | #define D2GAME_NODESEX_CHANGE_ITERATION_TO_16 0xB213A // k 182 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_16 0x59816 // k 183 | #define D2GAME_NODESEX_CHANGE_MONSTER_NODE_TO_17 0x5982D // k 184 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_CREATEOBJECT_IB 0 // unused in 1.13d 185 | // Missing ones 186 | #define D2GAME_NODESEX_CHANGE_WUSSIE_AI_NODE_TO_16 0x30DF2 187 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_PLAYER_EVENT_CONTROLLER 0x30DEB // k it for Wussie too 188 | #define D2GAME_NODESEX_CHANGE_BONEWALL_NODE_TO_17 0x491F9 189 | #define D2GAME_NODESEX_CHANGE_ROGUE_SCOUT_SPAWN_NODE_TO_16 0xD45F2 190 | #define D2GAME_NODESEX_CHANGE_ATTRACT_NODE_TO_17 0xD6D0E 191 | #define D2GAME_NODESEX_CHANGE_BONEPRISON_NODE_TO_17 0xD8CC3 192 | #define D2GAME_NODESEX_CHANGE_BONEWALL_NODE_TO_17_SKILL 0xD8EC8 193 | 194 | // One more missing... 195 | #define D2GAME_NODESEX_CHANGE_NEUTRAL_NODE_ITEM_CREATE_SUB 0xE3267 196 | // And one more 197 | #define D2GAME_NODESEX_CHANGE_ITERATION_TO_16_MISSING_I 0x496B2 // k 198 | 199 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/D2Stubs.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __D2STUBS__H_ 21 | #define __D2STUBS__H_ 22 | 23 | namespace D2Stubs 24 | { 25 | void D2GAME_TestCrash_STUB(); 26 | void UBERQUEST_SpawnMonsters_STUB(); 27 | BYTE __fastcall GetActByLevelNo_STUB1(DWORD nLevel); 28 | BYTE __fastcall GetActByLevelNo_STUB2(DWORD nLevel); 29 | 30 | void D2GAME_OnCustomFunc_STUB(); 31 | int __stdcall D2COMMON_GetMercCost(UnitAny* pPlayer); 32 | void D2COMMON_GetItemCost_STUB(); 33 | void __fastcall OnDebugPacketReceive_STUB(); 34 | void __fastcall D2GAME_IsUnitDead_STUB(); 35 | void __stdcall D2GAME_OnPacketReceive_STUB(); 36 | void __fastcall D2GAME_OnCreateDamage_STUB(); 37 | void __fastcall D2GAME_LastHitIntercept_STUB(); 38 | void __fastcall D2GAME_OnJoinGame_STUB(); 39 | 40 | void __fastcall D2GAME_OnEventSend_STUB(); 41 | void __fastcall D2GAME_LogHack_STUB(); 42 | void __fastcall D2GAME_SendKillsNULL_STUB(); 43 | void __fastcall D2GAME_OnUseItem_STUB(); 44 | void __fastcall D2GAME_OnMonsterDeath_STUB(); 45 | void __fastcall D2GAME_PartyExp_STUB(); 46 | void __fastcall D2GAME_FreeNodes_STUB(Game *ptGame); 47 | void __stdcall D2GAME_SetNodeParented_STUB(UnitNode* ptNode); 48 | void __stdcall D2GAME_SetUnitsNode_STUB(UnitAny* ptUnit, UnitNode* ptNode); 49 | void __fastcall D2GAME_FreeNode_STUB(Game *ptGame, UnitAny *ptUnit); 50 | void __fastcall D2GAME_FreeChildNode_STUB(Game *ptGame, UnitAny *ptUnit); 51 | void __stdcall D2GAME_AssignNode_STUB(int dwZero); 52 | BOOL __fastcall D2GAME_PermStore_STUB(); 53 | void __fastcall D2GAME_GameEnter_STUB(); 54 | void __fastcall D2GAME_GameDestroy_STUB(); 55 | void __fastcall D2GAME_DeathMsg_STUB(UnitAny* ptKiller, void * BitMask, Game * ptGame); 56 | int __stdcall D2GAME_Ressurect_STUB(); 57 | void __fastcall D2GAME_NPCHeal_STUB(); 58 | void __fastcall D2GAME_Chat_STUB(); 59 | int __fastcall D2GAME_SendStatToOther_STUB(); 60 | void __fastcall D2NET_ReceivePacket_STUB(); 61 | DWORD __fastcall D2GAME_SetDRCap_STUB(); 62 | void __fastcall D2GAME_OnManaLeech_STUB(); 63 | void __fastcall D2GAME_OnLifeLeech_STUB(); 64 | void __fastcall D2GAME_OnPlayerModeChange_I(); 65 | UnitAny* __fastcall D2GAME_FindUnit_STUB(); 66 | void __fastcall D2GAME_AddStat_STUB(int nStat, UnitAny *pUnit, int nValue); 67 | BOOL __fastcall D2GAME_GoldTransaction_STUB(UnitAny *pPlayer, int nCost); 68 | } 69 | 70 | // -- ASM SUBS -- 71 | namespace D2ASMFuncs 72 | { 73 | void __stdcall D2GAME_UpdateRoomUnits(Game* pGame); 74 | void __fastcall D2GAME_RemovePets(Game* pGame, UnitAny* pPlayer); 75 | void __stdcall D2GAME_BroadcastLeavingEvent(ClientData *ptClient, Game *ptGame, BYTE MsgType); 76 | void __fastcall D2GAME_SetPlayerUnitModeTarget(Game *pGame, UnitAny *pUnit, Skill *pSkill, int nMode, int UnitType, int UnitId, int bAllowReEnter); 77 | void __fastcall D2GAME_UpdateClientInventory(ClientData* pClient, UnitAny* pPlayer); 78 | void __fastcall D2GAME_DeleteTimer(Game* pGame, Timer* pTimer); 79 | void __fastcall D2GAME_DeleteTimers(Game* pGame, UnitAny* pUnit); 80 | char __fastcall D2GAME_MoveItems(Game* pGame, UnitAny* pSource, UnitAny* pDest); 81 | int __fastcall D2GAME_RestoreItems(Game *pGame, BYTE *pSaveBuffer,UnitAny *pPlayer, int nItemSize, int nBufferMax, BOOL bUnk, int *BufferLen); 82 | void __fastcall D2GAME_AddGold(UnitAny* pPlayer, Game *pGame, int nGold); 83 | void __fastcall D2GAME_UpdateQuantity(UnitAny* pPlayer); 84 | void __fastcall D2GAME_UpdateItemQuantity(UnitAny* pPlayer, UnitAny* pItem); 85 | void __fastcall D2GAME_RemoveBonuses(Game* pGame, UnitAny* pPlayer); 86 | int __fastcall D2GAME_SaveItems(BYTE *pBuffer, BOOL _2, Game *ptGame, UnitAny *ptUnit, Inventory *pInv, int nMaxSize, BOOL bInTrade, BOOL bQuit, BOOL bUnk); 87 | void __fastcall D2GAME_StopSequence(UnitAny* pUnit); 88 | void __fastcall D2GAME_RemoveBuffs(Game* pGame, UnitAny* pUnit); 89 | void __fastcall D2GAME_ResetTimers(Game* pGame, UnitAny* pUnit); 90 | void __fastcall D2GAME_RemoveInteraction(Game* pGame, UnitAny* pUnit); 91 | void __fastcall D2GAME_CastSkill(UnitAny *ptUnit, Skill *ptSkill, Game *pGame, int xPos, int yPos); 92 | int __fastcall D2GAME_CastSkillOnUnit(UnitAny *ptUnit, Skill *ptSkill, Game *pGame, DWORD UnitType, DWORD UnitId, BOOL bRepeat); 93 | UnitAny* __fastcall D2GAME_SpawnMonsterInCurrentRoom(int MIdx, int a2, Game *ptGame, Room1 *pRoom, int xPos, int yPos, int a9, int a1); 94 | StatList* __fastcall D2GAME_CreateAuraStatList(CurseStateParam *pCurse); 95 | void __fastcall D2GAME_RemoveItem(Game* pGame, UnitAny* pUnit, UnitAny* pItem); 96 | void __stdcall D2GAME_UpdateBonuses(UnitAny *pUnit); 97 | void __fastcall D2GAME_SetSkills(int SkillId, UnitAny* pUnit, int SkillLvl, int a4); 98 | void __stdcall D2GAME_Send0x21_UpdateSkills(ClientData* pClient, int SkillId, UnitAny* pUnit, BYTE a3, BYTE a4); 99 | void __fastcall D2GAME_LevelAwards(UnitAny *pUnit, Game* pGame); 100 | int __stdcall D2GAME_GetExpGained(int PlayerExp, UnitAny *pPlayer, int PlayerLvl, Game *pGame, int MonLvl); 101 | void __fastcall D2GAME_ForEachInParty(UnitAny *pMonster, Game *pGame, void (__fastcall *pCallBack)(Game *pGame, UnitAny *pPartyMember, void *pData), void *pData); 102 | void __fastcall D2GAME_ForEach(Game *pGame, void (__fastcall *pCallBack)(Game *, UnitAny*, void *), void *pData); 103 | int __fastcall D2GAME_NodesUnk(UnitAny* pUnit1, int _1, UnitAny* pUnit2); 104 | int __fastcall D2GAME_GetDistanceFromXY(UnitAny* pUnit, int aX, int aY); 105 | UnitAny* __fastcall D2GAME_DupeItem(Game* ptGame, UnitAny* ptItem, BOOL bInitUnit); 106 | int __fastcall D2GAME_DeleteItem(Game* ptGame, UnitAny* ptItem); 107 | void __fastcall D2GAME_UpdateClient(WORD ItemFormat, UnitAny *ptItem, ClientData *pClient, BYTE SomeBool, int StatNo, int StatValue); 108 | void __fastcall D2GAME_DropItem(UnitAny* ptItem, Room1* ptRoom, Game* ptGame, UnitAny* ptOwner, int xPos, int yPos); 109 | UnitAny* __stdcall D2GAME_CreateItem(int iLvl, int a2, int a3, UnitAny* pOwner, int ItemIdx, Game* ptGame, int InitMode, int iQuality, BOOL Personalize, int LoSeed, int HiSeed); 110 | Room1* __fastcall D2GAME_FindFreeCoords(D2POINT* Desired, Room1* ptRoom, D2POINT* Output, BOOL Unk); 111 | Room1* __fastcall D2GAME_CheckXYOccupy(Room1* ptRoom, int xPos, int yPos); 112 | int __fastcall D2GAME_isUnitInRange(Game *pGame, DWORD UnitId, DWORD UnitType, UnitAny *pUnit, int Range); 113 | void __fastcall D2GAME_CreatePlayer(Game* ptGame, ClientData* ptClient, int Unk, UnitAny** out); 114 | short __fastcall D2GAME_GetPartyID(UnitAny* ptUnit); 115 | int __stdcall D2COMMON_GetUnitX(Path* ptPath); 116 | int __stdcall D2COMMON_GetUnitY(Path* ptPath); 117 | void __fastcall D2GAME_MoveUnitToLevelId(UnitAny *ptUnit, int LevelId, Game *ptGame); 118 | int __fastcall D2GAME_TeleportUnit(int pX, int pY, Room1 *pRoom1, Game *pGame, UnitAny *pUnit); 119 | Game* __fastcall D2GAME_GetGameByClientID(DWORD ClientID); 120 | void __fastcall D2GAME_LeaveCriticalSection(Game* pGame); 121 | DWORD __fastcall D2GAME_Send0XAEPacket(void *ptPlayer,DWORD Length,DWORD *Packet); 122 | UnitAny* __stdcall D2GAME_FindUnit(Game* ptGame, DWORD dwUnitId, BYTE dwUnitType); 123 | DWORD __fastcall D2GAME_SendPacket(ClientData *pClientData, BYTE *aPacket,int aLen); 124 | } 125 | 126 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/HashGameSeed.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/HashGameSeed.asm -------------------------------------------------------------------------------- /d2warden-pvp/LCube.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LCube.h" 22 | #include "LQuests.h" 23 | #include "LUberQuest.h" 24 | 25 | /* 26 | Wrapper in D2Game.0x6FCB70FC 27 | */ 28 | DWORD __stdcall CUBE_OnCustomFunc(Game* pGame, UnitAny* pPlayer, CubeOutputItem *pCubeOutput) 29 | { 30 | if (pCubeOutput->Type == CUBEOUTPUT_PORTAL) { // Portal 31 | if (pCubeOutput->nLevel >= (*D2Vars.D2COMMON_sgptDataTables)->dwLevelsRecs) // Invalid level has set 32 | return FALSE; 33 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pPlayer); 34 | ASSERT(pRoom) 35 | 36 | if (pCubeOutput->nAct != pRoom->pAct->dwAct) { 37 | QUESTS_UpdateUnit(pPlayer, 19, pPlayer); 38 | return FALSE; 39 | } 40 | 41 | return QUESTS_OpenPortal(pGame, pPlayer, pCubeOutput->nLevel); 42 | } 43 | else if (pCubeOutput->Type == CUBEOUTPUT_COWPORTAL) { 44 | return QUESTS_CowLevelOpenPortal(pGame, pPlayer); 45 | } 46 | else if (pCubeOutput->Type == CUBEOUTPUT_UBERQUEST) { // Uber quest key portals 47 | if (!UBERQUEST_OpenPandemoniumPortal(pGame, pPlayer)) { 48 | QUESTS_UpdateUnit(pPlayer, 19, pPlayer); 49 | return FALSE; 50 | } 51 | return TRUE; 52 | } 53 | else if (pCubeOutput->Type == CUBEOUTPUT_UBERQUEST_FINAL) { // Uber quest tristram 54 | if(!UBERQUEST_OpenPandemoniumFinalPortal(pGame, pPlayer)) { 55 | QUESTS_UpdateUnit(pPlayer, 19, pPlayer); 56 | return FALSE; 57 | } 58 | return TRUE; 59 | } 60 | return -1; // Invalid function 61 | } 62 | 63 | -------------------------------------------------------------------------------- /d2warden-pvp/LCube.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2015 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef LCUBE_H__ 21 | #define LCUBE_H__ 22 | 23 | 24 | enum CubeOutputTypes { 25 | CUBEOUTPUT_USETYPE = -1, 26 | CUBEOUTPUT_USEITEM = -2, 27 | CUBEOUTPUT_ITEMTYPE = -3, 28 | CUBEOUTPUT_ITEM = -4, 29 | CUBEOUTPUT_PORTAL = 1, 30 | CUBEOUTPUT_UBERQUEST, 31 | CUBEOUTPUT_UBERQUEST_FINAL, 32 | CUBEOUTPUT_COWPORTAL, 33 | }; 34 | 35 | 36 | enum CubeMainOpCodes { 37 | CUBEMAIN_OP_DAYOFMONTH = 1, // DayOfMonth is less than Param or greater than value 38 | CUBEMAIN_OP_DAYOFWEEK = 2, // DayOfWeek != value(1 = Sunday, ...) 39 | CUBEMAIN_OP_STAT_HIGHER = 3, 40 | CUBEMAIN_OP_STAT_LOWER = 4, 41 | CUBEMAIN_OP_STAT_EQ = 5, 42 | CUBEMAIN_OP_STAT_NOT_EQ = 6, 43 | // ... 44 | }; 45 | 46 | DWORD __stdcall CUBE_OnCustomFunc(Game* pGame, UnitAny* pPlayer, CubeOutputItem *pCubeOutput); 47 | 48 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LDamage.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LDamage.h" 22 | #include "Warden.h" 23 | 24 | 25 | 26 | /** 27 | signed int __usercall sub_6FCA87B0(ResRecord *pRecord, Attack *pAttack) 28 | @param pAttack Damage structure 29 | @param pRecord current calculated resistance type 30 | @return a resist penalty 31 | */ 32 | signed int __stdcall DAMAGE_ApplyResistPenalty(Attack* pAttack, ResRecord *pRecord) 33 | { 34 | DWORD nStat; 35 | int nPenalty; 36 | DWORD nPierceStat; 37 | DWORD nBaseStat; 38 | DWORD nMaxResStat; 39 | int nMaxResVal; 40 | 41 | nStat = pRecord->nBaseStat; 42 | nPenalty = 0; 43 | if (nStat != -1) 44 | nPenalty = D2Funcs.D2COMMON_GetStatSigned(pAttack->pDefender, nStat, 0); 45 | nPierceStat = pRecord->nPierceStat; 46 | if (nPierceStat != -1 && (nPenalty < 100 || !pAttack->dwDefenderType)) 47 | { 48 | int nPierceVal = D2Funcs.D2COMMON_GetStatSigned(pAttack->pAttacker, nPierceStat, 0); 49 | if (nPierceVal) 50 | nPenalty -= nPierceVal; 51 | } 52 | if (pAttack->dwDefenderType == UNIT_PLAYER) 53 | { 54 | nBaseStat = pRecord->nBaseStat; 55 | if (nBaseStat != STAT_DAMAGEREDUCTION) 56 | { 57 | if (nBaseStat != STAT_MAGICRESIST) 58 | { 59 | if (pAttack->pGame->bExpansion) 60 | { 61 | nPenalty += pAttack->pDifficultyLevelsTxt->ResistPenalty; 62 | } 63 | else // Handle classic 64 | { 65 | if (pAttack->pGame->DifficultyLevel == DIFF_NIGHTMARE) 66 | { 67 | nPenalty -= 20; 68 | } 69 | else 70 | { 71 | if (pAttack->pGame->DifficultyLevel == DIFF_HELL) 72 | nPenalty -= 50; 73 | } 74 | } 75 | } 76 | } 77 | } 78 | if (nPenalty > 0) 79 | { 80 | if (pAttack->dwDefenderType == UNIT_PLAYER) 81 | { 82 | nMaxResStat = pRecord->nMaxResStat; 83 | nMaxResVal = 75; 84 | if (nMaxResStat == -1) 85 | { 86 | if (pRecord->nBaseStat == STAT_DAMAGEREDUCTION) 87 | nMaxResVal = Warden::getInstance().wcfgMaxDmgRes; 88 | } 89 | else 90 | { 91 | nMaxResVal = D2Funcs.D2COMMON_GetStatSigned(pAttack->pDefender, nMaxResStat, 0) + 75; 92 | int maxCap = 95; 93 | switch (nMaxResStat) 94 | { 95 | case STAT_MAXFIRERESIST: maxCap = Warden::getInstance().wcfgMaxFireRes; break; 96 | case STAT_MAXCOLDRESIST: maxCap = Warden::getInstance().wcfgMaxColdRes; break; 97 | case STAT_MAXPOISONRESIST: maxCap = Warden::getInstance().wcfgMaxPsnRes; break; 98 | case STAT_MAXLIGHTNINGRESIST: maxCap = Warden::getInstance().wcfgMaxLightRes; break; 99 | } 100 | if (nMaxResVal >= maxCap) 101 | nMaxResVal = maxCap; 102 | } 103 | if (nPenalty <= -100) 104 | nPenalty = -100; 105 | if (nPenalty >= nMaxResVal) 106 | nPenalty = nMaxResVal; 107 | } 108 | if (pRecord->nBaseStat == STAT_DAMAGEREDUCTION && D2Funcs.D2COMMON_GetUnitState(pAttack->pAttacker, sanctuary)) 109 | { 110 | if (D2Funcs.D2COMMON_IsMonsterUndead(pAttack->pDefender)) 111 | nPenalty = 0; 112 | } 113 | } 114 | else 115 | { 116 | if (nPenalty <= -100) 117 | return -100; 118 | } 119 | return nPenalty; 120 | } 121 | 122 | 123 | /** 124 | Patch location: D2GAME.0x89187 125 | */ 126 | void __declspec(naked) DAMAGE_AppylResistPenalty_STUB() 127 | { 128 | __asm { 129 | 130 | push ebx 131 | push edi 132 | 133 | call DAMAGE_ApplyResistPenalty 134 | 135 | ret 136 | } 137 | } -------------------------------------------------------------------------------- /d2warden-pvp/LDamage.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2015 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef LDMG_H__ 21 | #define LDMG_H__ 22 | 23 | void DAMAGE_AppylResistPenalty_STUB(); 24 | 25 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LEvents.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/LEvents.cpp -------------------------------------------------------------------------------- /d2warden-pvp/LEvents.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef LEVENTS_H__ 21 | #define LEVENTS_H__ 22 | 23 | void __stdcall OnBroadcastEvent(Game* pGame, EventPacket * pEvent); 24 | void __stdcall OnDeath(UnitAny* ptKiller, UnitAny * ptVictim, Game * ptGame); 25 | void __stdcall OnCreateCorpse(Game *pGame, UnitAny *pUnit, int xPos, int yPos, Room1 *pRoom); 26 | 27 | void DoRoundEndStuff(Game* pGame, UnitAny* pUnit); 28 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LItems.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2LITEMS_H__ 21 | #define D2LITEMS_H__ 22 | 23 | bool FG_WaitForMySQLServer(unsigned int msTimeout); 24 | void FG_ConnectToSQL(std::string szServer, std::string szUser, std::string szPass, std::string szDatabase); 25 | 26 | BOOL __fastcall ITEMS_BuyItem(UnitAny *pPlayer, int nCost); 27 | void __fastcall ITEMS_RollbackStat(int nStat, UnitAny *pUnit, int nValue); 28 | int __stdcall GetGoldBankLimit(UnitAny *pUnit); 29 | signed int GetStatSigned(UnitAny *pUnit, int nStat, int nLayer); 30 | int __stdcall ITEMS_OnStatFetch(UnitAny *pUnit, int nStat, WORD nLayer); 31 | int __stdcall ITEMS_GetItemCost(UnitAny *pPlayer, UnitAny *ptItem, int DiffLvl, QuestFlags *pQuestFlags, int NpcClassId, int InvPage); 32 | 33 | //-------- don't break it accidently 34 | UnitAny* 35 | #ifdef VER_111B 36 | __stdcall 37 | #else 38 | __fastcall 39 | #endif 40 | ITEMS_AddKillerId(Game *pGame, PresetItem *srCreateItem, int a5); 41 | //----------- 42 | void CreateFFAItems(UnitAny* pUnit); 43 | bool ParseItemsCmds(UnitAny* pUnit, char* str, char *t); 44 | 45 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LMonsters.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LMonsters.h" 22 | 23 | 24 | UnitAny* __fastcall OnMonsterSpawn(PresetMonster * pSetup) 25 | { 26 | UnitAny* pMonster = D2Funcs.D2GAME_SpawnPresetMonster(pSetup); 27 | if (pMonster) 28 | { 29 | DEBUGMSG("Created monster %d on [%d, %d]!", pMonster->dwClassId, D2Funcs.D2GAME_GetUnitX(pMonster), D2Funcs.D2GAME_GetUnitY(pMonster)) 30 | } 31 | return pMonster; 32 | } 33 | 34 | bool ParseMonCmds(UnitAny* pUnit, char* str, char *t) 35 | { 36 | int ClientID = pUnit->pPlayerData->pClientData->ClientID; 37 | 38 | 39 | if (_stricmp(str, "#mspawntest") == 0) 40 | { 41 | if (!isAnAdmin(pUnit->pPlayerData->pClientData->AccountName)) return TRUE; 42 | DWORD nMonsters = (*D2Vars.D2COMMON_sgptDataTables)->dwMonStatsRecs; 43 | 44 | str = strtok_s(NULL, " ", &t); 45 | if (!str) { 46 | SendMsgToClient(pUnit->pPlayerData->pClientData, "Type monster index 0-%d", nMonsters); 47 | return false; 48 | } 49 | 50 | DWORD monIdx = atoi(str); 51 | if (!str) { 52 | SendMsgToClient(pUnit->pPlayerData->pClientData, "Type monster index 0-%d", nMonsters); 53 | return false; 54 | } 55 | 56 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pUnit); 57 | if (pRoom) { 58 | DWORD xPos = pUnit->pPath->xPos; 59 | DWORD yPos = pUnit->pPath->yPos; 60 | 61 | CoordsInfo* pCoords = D2Funcs.D2COMMON_GetCoordsInfo(pRoom, xPos, yPos); 62 | if (D2Funcs.D2GAME_FindMonsterRoom(pUnit->pGame, pRoom, pCoords, monIdx, &xPos, &yPos, FALSE)) { 63 | 64 | if (D2Funcs.D2GAME_SpawnMonster(monIdx, 1, pUnit->pGame, pRoom, xPos, yPos, -1, 0)) 65 | { 66 | SendMsgToClient(pUnit->pPlayerData->pClientData, "Done!"); 67 | } 68 | } 69 | else 70 | { 71 | SendMsgToClient(pUnit->pPlayerData->pClientData, "D2GAME_FindMonsterRoom() failed!"); 72 | } 73 | } 74 | 75 | return false; 76 | } 77 | if(_stricmp(str,"#mspawn")==0) 78 | { 79 | WardenClient_i ptCurrentClient = Warden::getInstance().findClientById(ClientID); 80 | if (ptCurrentClient == Warden::getInstance().getInvalidClient()) return TRUE; 81 | 82 | if (!isAnAdmin(ptCurrentClient->AccountName)) { return TRUE; } 83 | 84 | 85 | str = strtok_s(NULL," ",&t); 86 | if(!str) { SendMsgToClient(pUnit->pPlayerData->pClientData,"Type number 0-733"); return false;} 87 | int No = atoi(str); 88 | if(No>733) { SendMsgToClient(pUnit->pPlayerData->pClientData,"Type number 0-733"); return false;} 89 | 90 | int count = 1; 91 | WardenClient_i psUnit = ptCurrentClient; 92 | 93 | Room1* aRoom = pUnit->pPath->pRoom1; 94 | int xPos = pUnit->pPath->xPos; 95 | int yPos = pUnit->pPath->yPos; 96 | 97 | str = strtok_s(NULL," ",&t); 98 | if(str) 99 | { 100 | count = atoi(str); 101 | str = strtok_s(NULL," ",&t); 102 | if(str) 103 | { 104 | WardenClient_i psUnit = Warden::getInstance().findClientByName(str); 105 | if (psUnit != Warden::getInstance().getInvalidClient()) 106 | { 107 | SendMsgToClient(pUnit->pPlayerData->pClientData,"Spawning monster on %s", psUnit->CharName); 108 | aRoom = psUnit->ptPlayer->pPath->pRoom1; 109 | xPos = psUnit->ptPlayer->pPath->xPos; 110 | yPos = psUnit->ptPlayer->pPath->yPos; 111 | } 112 | } 113 | } 114 | 115 | 116 | D2POINT Pos = { xPos, yPos }; 117 | D2POINT Out = { 0, 0 }; 118 | 119 | UnitAny* ptMonster = 0; 120 | 121 | for(int z= 0; zpPlayerData->pClientData,"FindFreeCoords failed!"); break;} 128 | 129 | ptMonster = D2Funcs.D2GAME_SpawnMonster(No,1,psUnit->ptPlayer->pGame,aRoom,Out.x,Out.y,-1,0); 130 | if(ptMonster) break; 131 | 132 | if(i % 2) Pos.x = Out.x + (rand() % 4); else Pos.x = Out.x - (rand() % 4); 133 | if(i % 2) Pos.y = Out.y + (rand() % 4); else Pos.y = Out.y - (rand() % 4); 134 | } 135 | if(!ptMonster) {SendMsgToClient(pUnit->pPlayerData->pClientData,"Error limit exceeded!"); break;} 136 | 137 | SendMsgToClient(pUnit->pPlayerData->pClientData,"#%d Monster spawned, HP = %d",z+1, D2Funcs.D2COMMON_GetUnitMaxLife(ptMonster) >> 8); 138 | } 139 | 140 | return false; 141 | } 142 | 143 | return true; 144 | } -------------------------------------------------------------------------------- /d2warden-pvp/LMonsters.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2LMOBS_H__ 21 | #define D2LMOBS_H__ 22 | 23 | UnitAny* __fastcall OnMonsterSpawn(PresetMonster * pSetup); 24 | bool ParseMonCmds(UnitAny* pUnit, char* str, char *t); 25 | 26 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LPackets.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __LPACKETS_H__ 21 | #define __LPACKETS_H__ 22 | 23 | void __stdcall OnCreatePacketReceive(PacketData* pPacket); 24 | int __stdcall OnPacketReceive(BYTE *pPacket, UnitAny *pUnit, Game *pGame, int nPacketLen); 25 | void __stdcall OnDebugPacketReceive(PacketData* pPacket); 26 | 27 | 28 | DWORD __fastcall OnRunToLocation(Game* ptGame, UnitAny* ptPlayer, SkillPacket *ptPacket, DWORD PacketLen); 29 | DWORD __fastcall OnClickLocation(Game* ptGame, UnitAny* ptPlayer, SkillPacket *ptPacket, DWORD PacketLen); 30 | DWORD __fastcall OnClickUnit(Game* ptGame, UnitAny* ptPlayer, SkillTargetPacket *ptPacket, DWORD PacketLen); 31 | 32 | DWORD __fastcall OnResurrect(Game *pGame, UnitAny *pPlayer, BYTE *aPacket, DWORD PacketSize); 33 | 34 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LParty.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LParty.h" 22 | #include "LSpectator.h" 23 | 24 | #include "process.h" 25 | 26 | /* 27 | Wrapper for 0x5E 28 | */ 29 | DWORD __fastcall OnPartyRelationChange(Game* pGame, UnitAny* pPlayer, BYTE *pPacket, int nLen) 30 | { 31 | px5e * p = (px5e*)pPacket; 32 | 33 | DEBUGMSG("Entered %s, Button %d", __FUNCTION__, p->nButton) 34 | 35 | if (nLen != 6) 36 | return 3; 37 | 38 | ASSERT(pGame) 39 | Arena* pArena = pGame->pArenaControl; 40 | ASSERT(pArena); 41 | 42 | if (pArena->ArenaFlags & 0x10000) 43 | return 3; 44 | 45 | if (p->nButton > 10) 46 | return 2; 47 | 48 | UnitAny* pDestUnit = D2ASMFuncs::D2GAME_FindUnit(pGame, p->dwUnitId, UNIT_PLAYER); 49 | if (!pDestUnit) 50 | return 3; 51 | 52 | typedef void* (__fastcall * fnPartyButtons_t)(Game*, UnitAny* pRequester, UnitAny* pDestUnit, int state, int* result); 53 | fnPartyButtons_t* fnPartyButtons = (fnPartyButtons_t*)D2Vars.D2GAME_PartyButtonCallbacks; 54 | 55 | if (p->nButton < 10) 56 | { 57 | if (fnPartyButtons[p->nButton]) 58 | fnPartyButtons[p->nButton](pGame, pPlayer, pDestUnit, 0, 0); 59 | } 60 | else if (p->nButton == PB_SPECATE) 61 | { 62 | return SPECTATOR_OnClickSpecate(pGame, pPlayer, pDestUnit); 63 | } 64 | return 0; 65 | } -------------------------------------------------------------------------------- /d2warden-pvp/LParty.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __LPARTY_H__ 21 | #define __LPARTY_H__ 22 | 23 | DWORD __fastcall OnPartyRelationChange(Game* pGame, UnitAny* pPlayer, BYTE *pPacket, int nLen); 24 | 25 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LQuests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/LQuests.cpp -------------------------------------------------------------------------------- /d2warden-pvp/LQuests.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __LQUESTS_H__ 21 | #define __LQUESTS_H__ 22 | 23 | int __fastcall DYES_Prepare(Game *pGame, UnitAny *pUnit, UnitAny *pScroll, UnitAny *ptItem, int a5, int a6, int SkillId); 24 | int __fastcall DYES_Colorize(Game *pGame, UnitAny *pUnit, UnitAny *pScroll, UnitAny *ptItem, int a5, int a6, int SkillId); 25 | BYTE * __stdcall DYES_DrawItem(UnitAny *ptPlayer, UnitAny* ptItem, BYTE* out, BOOL a4); 26 | 27 | void QUESTS_UpdateUnit(UnitAny* pUnit, WORD UpdateType, UnitAny*pUpdateUnit); 28 | BOOL __stdcall QUESTS_CowLevelOpenPortal(Game *pGame, UnitAny *pUnit); 29 | BOOL __stdcall QUESTS_OpenPortal(Game *pGame, UnitAny *pUnit, DWORD LevelId); 30 | bool __stdcall QUESTS_OnUseItem(Game* pGame, UnitAny* pUnit, UnitAny* pItem, DWORD dwItemCode); 31 | 32 | 33 | void __stdcall QUEST_AllocQuestControl(Game *pGame); 34 | 35 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LRoster.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | 22 | #include "LRoster.h" 23 | #include "LEvents.h" 24 | #include "LSpectator.h" 25 | 26 | void __stdcall OnCreateDamage(UnitAny* pDefender, Damage* pDamage, UnitAny* pMissile) 27 | { 28 | if(!pDefender) return; 29 | if(pDefender->dwType != UNIT_PLAYER) return; 30 | if(!pDefender->pPlayerData) return; 31 | if(!pMissile) return; 32 | pDefender->pPlayerData->LastHitSkillId = D2Funcs.D2COMMON_GetMissileSkillId(pMissile); 33 | 34 | } 35 | 36 | void COMBAT_Free(Game* pGame, UnitAny* pUnit) 37 | { 38 | Combat* pCombat = pUnit->ptCombat; 39 | if (!pCombat) 40 | return; 41 | 42 | Combat * pDiffCombat = 0; 43 | Combat * pNext; 44 | do 45 | { 46 | pNext = pCombat->ptNext; 47 | if ( pCombat->dwAttackerType != pUnit->dwType || pCombat->dwAttackerId != pUnit->dwUnitId ) 48 | { 49 | pDiffCombat = pCombat; 50 | } 51 | else 52 | { 53 | if ( pDiffCombat ) 54 | pDiffCombat->ptNext = pNext; 55 | else 56 | pUnit->ptCombat = pNext; 57 | D2Funcs.FOG_FreeServerMemory(pGame->pMemPool, pCombat, __FILE__, __LINE__, 0); 58 | } 59 | pCombat = pNext; 60 | } 61 | while ( pNext ); 62 | } 63 | 64 | Combat* COMBAT_Find(UnitAny* pAttacker, UnitAny* pDefender) 65 | { 66 | if(!pAttacker || !pDefender) return 0; 67 | for(Combat* pCombat = pDefender->ptCombat; pCombat; pCombat = pCombat->ptNext) 68 | { 69 | if(pCombat->dwAttackerId == pAttacker->dwUnitId && pCombat->dwAttackerType == pAttacker->dwType) 70 | return pCombat; 71 | } 72 | return 0; 73 | } 74 | 75 | void __fastcall PLAYERMODES_0_Death(Game *pGame, UnitAny *pVictim, int nMode, UnitAny *pKiller) //_6FC62F20 76 | { 77 | ASSERT(pGame) 78 | 79 | if(pVictim) { 80 | if(!D2Funcs.D2COMMON_isInShapeForm(pVictim) || !(pVictim->dwType == UNIT_PLAYER && pVictim->dwClassId == 5)) 81 | { 82 | COMBAT_Free(pGame,pVictim); 83 | D2Funcs.D2COMMON_ChangeCurrentMode(pVictim, PLAYER_MODE_DEATH); 84 | 85 | ClientData* pClient = 0; 86 | if(pVictim->dwType == UNIT_PLAYER) 87 | pClient = pVictim->pPlayerData->pClientData; 88 | 89 | if(pClient) 90 | pClient->PlayerStatus |= 8; 91 | 92 | D2ASMFuncs::D2GAME_StopSequence(pVictim); 93 | D2ASMFuncs::D2GAME_RemoveBuffs(pGame, pVictim); 94 | D2ASMFuncs::D2GAME_DeleteTimers(pGame, pVictim); 95 | D2ASMFuncs::D2GAME_ResetTimers(pGame, pVictim); 96 | 97 | if(pKiller) 98 | { 99 | OnDeath(pKiller, pVictim, pGame); 100 | } 101 | 102 | if(!D2Funcs.D2COMMON_GetUnitState(pVictim,playerbody)) 103 | pVictim->dwFlags &= ~(UNITFLAG_SELECTABLE|UNITFLAG_OPERATED); 104 | 105 | D2ASMFuncs::D2GAME_RemoveInteraction(pGame, pVictim); 106 | return; 107 | } 108 | 109 | if(!pVictim->pInventory || !D2Funcs.D2COMMON_GetCursorItem(pVictim->pInventory)) 110 | { 111 | int eMode = PLAYER_MODE_STAND_OUTTOWN; 112 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pVictim); 113 | if (pRoom && D2Funcs.D2COMMON_isRoomInTown(pRoom)) 114 | eMode = PLAYER_MODE_STAND_INTOWN; 115 | 116 | D2ASMFuncs::D2GAME_DeleteTimers(pGame, pVictim); 117 | COMBAT_Free(pGame,pVictim); 118 | D2Funcs.D2COMMON_ChangeCurrentMode(pVictim,eMode); 119 | D2Funcs.D2COMMON_SetCurrentSkill(pVictim, 0); 120 | } 121 | } 122 | } 123 | 124 | void __fastcall OnGameDestroy(Game* ptGame) 125 | { 126 | DEBUGMSG("Closing game %s", ptGame->GameName); 127 | LRoster::Clear(ptGame); 128 | 129 | ptGame->pSpectators->clear(); 130 | delete ptGame->pSpectators; 131 | } 132 | 133 | /* 134 | Sends a roster of all players to given client [ptClient] 135 | */ 136 | void LRoster::SyncClient(Game *ptGame, ClientData* ptClient) 137 | { 138 | if(!ptGame || !ptClient) 139 | return; 140 | if(!(ptClient->InitStatus & 4)) 141 | return; 142 | 143 | for(ClientData * pClientList = ptGame->pClientList; pClientList; pClientList = pClientList->ptPrevious) 144 | { 145 | if(pClientList->InitStatus & 4) { 146 | LRosterData * pRoster = LRoster::Find(ptGame,pClientList->CharName); 147 | if(!pRoster) continue; 148 | 149 | RosterPacket pVKInfo = {0x66,pClientList->pPlayerUnit->dwUnitId,(BYTE)1,(BYTE)pRoster->Kills}; 150 | RosterPacket pVDInfo = {0x66,pClientList->pPlayerUnit->dwUnitId,(BYTE)2,(BYTE)pRoster->Deaths}; 151 | RosterPacket pVAInfo = {0x66,pClientList->pPlayerUnit->dwUnitId,(BYTE)3,(BYTE)pRoster->Assists}; 152 | RosterPacket pVGInfo = { 0x66, pClientList->pPlayerUnit->dwUnitId, (BYTE)4, (BYTE)pRoster->Giveups }; 153 | 154 | D2ASMFuncs::D2GAME_SendPacket(ptClient, (BYTE*)&pVKInfo,7); 155 | D2ASMFuncs::D2GAME_SendPacket(ptClient, (BYTE*)&pVDInfo,7); 156 | D2ASMFuncs::D2GAME_SendPacket(ptClient, (BYTE*)&pVAInfo, 7); 157 | D2ASMFuncs::D2GAME_SendPacket(ptClient, (BYTE*)&pVGInfo, 7); 158 | } 159 | } 160 | } 161 | 162 | /* 163 | Sends a roster of a player with [UnitId] to all clients 164 | */ 165 | void LRoster::SyncClient(Game *ptGame, DWORD UnitId, LRosterData* pRoster) 166 | { 167 | if(!ptGame || !pRoster) return; 168 | RosterPacket pVKInfo = {0x66,UnitId,(BYTE)1,(BYTE)pRoster->Kills}; 169 | RosterPacket pVDInfo = {0x66,UnitId,(BYTE)2,(BYTE)pRoster->Deaths}; 170 | RosterPacket pVAInfo = { 0x66, UnitId, (BYTE)3, (BYTE)pRoster->Assists }; 171 | RosterPacket pVGInfo = { 0x66, UnitId, (BYTE)4, (BYTE)pRoster->Giveups }; 172 | //TODO:Assysty 173 | 174 | for(ClientData * pClientList = ptGame->pClientList; pClientList; pClientList = pClientList->ptPrevious) 175 | { 176 | if(pClientList->InitStatus & 4) { 177 | D2ASMFuncs::D2GAME_SendPacket(pClientList,(BYTE*)&pVKInfo,7); 178 | D2ASMFuncs::D2GAME_SendPacket(pClientList,(BYTE*)&pVDInfo,7); 179 | D2ASMFuncs::D2GAME_SendPacket(pClientList, (BYTE*)&pVAInfo, 7); 180 | D2ASMFuncs::D2GAME_SendPacket(pClientList, (BYTE*)&pVGInfo, 7); 181 | } 182 | } 183 | } 184 | 185 | /* 186 | Sends a runaway roster of a player with [UnitId] to all clients 187 | */ 188 | void LRoster::SyncClientRunaways(Game *ptGame, DWORD UnitId, LRosterData* pRoster) 189 | { 190 | if (!ptGame || !pRoster) return; 191 | RosterPacket pVGInfo = { 0x66, UnitId, (BYTE)4, (BYTE)pRoster->Giveups }; 192 | 193 | for (ClientData * pClientList = ptGame->pClientList; pClientList; pClientList = pClientList->ptPrevious) 194 | { 195 | if (pClientList->InitStatus & 4) 196 | D2ASMFuncs::D2GAME_SendPacket(pClientList, (BYTE*)&pVGInfo, 7); 197 | } 198 | } 199 | 200 | LRosterData * LRoster::Find(Game * ptGame, char* szName) 201 | { 202 | for(LRosterData * LR = ptGame->pLRosterData; LR; LR = LR->ptNext) 203 | { 204 | if(_stricmp(LR->szName,szName)==0) return LR; 205 | } 206 | return 0; 207 | } 208 | 209 | void LRoster::UpdateRoster(Game* ptGame, char * szName, BYTE Type) 210 | { 211 | if(!ptGame) return; 212 | 213 | LRosterData *Player = LRoster::Find(ptGame,szName); 214 | if(!Player) 215 | { 216 | Player = (LRosterData*) D2Funcs.FOG_AllocServerMemory(ptGame->pMemPool, sizeof(LRosterData), __FILE__, __LINE__, NULL); 217 | memset(Player,0,sizeof(LRosterData)); 218 | Player->ptNext = ptGame->pLRosterData; 219 | ptGame->pLRosterData=Player; 220 | strcpy_s(Player->szName,16,szName); 221 | } 222 | switch(Type) 223 | { 224 | case 4: {++Player->Giveups; break; } 225 | case 3: {++Player->Assists; break;} 226 | case 2: {++Player->Deaths; break;} 227 | case 1: {++Player->Kills;break;} 228 | } 229 | } 230 | 231 | void LRoster::Clear(Game * ptGame) 232 | { 233 | LRosterData * LR = ptGame->pLRosterData; 234 | while(LR) 235 | { 236 | LRosterData * Next = LR->ptNext; 237 | D2Funcs.FOG_FreeServerMemory(ptGame->pMemPool, LR, __FILE__, __LINE__, NULL); 238 | LR = Next; 239 | } 240 | ptGame->pLRosterData = 0; 241 | } -------------------------------------------------------------------------------- /d2warden-pvp/LRoster.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef LRosterData_H__ 21 | #define LRosterData_H__ 22 | 23 | void __stdcall OnCreateDamage(UnitAny* pDefender, Damage* pDamage, UnitAny* pMissile); 24 | void __fastcall OnGameDestroy(Game* ptGame); 25 | void __fastcall PLAYERMODES_0_Death(Game *pGame, UnitAny *pVictim, int nMode, UnitAny *pKiller); 26 | void COMBAT_Free(Game* pGame, UnitAny* pUnit); 27 | 28 | namespace LRoster 29 | { 30 | void SyncClientRunaways(Game *ptGame, DWORD UnitId, LRosterData* pRoster); 31 | void SyncClient(Game *ptGame, ClientData* ptClient); 32 | void SyncClient(Game *ptGame, DWORD UnitId, LRosterData* pRoster); 33 | LRosterData* Find(Game * ptGame, char* szName); 34 | void UpdateRoster(Game * ptGame,char * szName, BYTE Type); 35 | void Clear(Game * ptGame); 36 | } 37 | 38 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LServer.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LServer.h" 22 | 23 | 24 | namespace LServer { 25 | 26 | 27 | /* 28 | Patch no 18 <- not needed 29 | Patch location: D2GAME.0xD53C6 30 | Original code: call ParseIncomingPacket_6FC873A0 31 | New code: call D2GS_OnPacketRecv_STUB 32 | */ 33 | /* 34 | Patch no 19 <- not needed 35 | Patch location D2GAME.0xBFEEF 36 | Original code: call GAME_ParseCreatePackets_6FCF53E0 37 | New code: call D2GS_ParseCreatePackets_STUB 38 | */ 39 | 40 | 41 | } -------------------------------------------------------------------------------- /d2warden-pvp/LServer.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __LSERVER_H__ 21 | #define __LSERVER_H__ 22 | 23 | 24 | namespace LServer { 25 | 26 | void D2GS_OnPacketRecv_STUB(); 27 | 28 | }; 29 | 30 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LSpectator.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LSpectator.h" 22 | 23 | #include "LRoster.h" 24 | #include "LPackets.h" 25 | 26 | /* 27 | Updates position on every player that observes WatchedPlayer 28 | */ 29 | void SPECTATOR_UpdatePositions(Game* pGame, UnitAny* pWatchedPlayer, WORD xPos, WORD yPos) 30 | { 31 | WORD UnitX = D2Funcs.D2GAME_GetUnitX(pWatchedPlayer); 32 | WORD UnitY = D2Funcs.D2GAME_GetUnitY(pWatchedPlayer); 33 | 34 | for (auto &obs : *pGame->pSpectators) { 35 | if (obs.UnitId != pWatchedPlayer->dwUnitId) 36 | continue; 37 | UnitAny * pWatcher = D2ASMFuncs::D2GAME_FindUnit(pGame, obs.ObservatorId, UNIT_PLAYER); 38 | if (!pWatcher) continue; 39 | 40 | Room1* aRoom = D2Funcs.D2COMMON_GetUnitRoom(pWatchedPlayer); 41 | Room1* mRoom = D2Funcs.D2COMMON_GetUnitRoom(pWatcher); 42 | if (!mRoom || !aRoom) continue; 43 | 44 | //POINT Pos = { (xPos + UnitX) / 2, (yPos + UnitY) / 2 }; 45 | D2POINT Pos = { xPos, yPos }; 46 | D2POINT Out = { 0, 0 }; 47 | 48 | aRoom = D2ASMFuncs::D2GAME_FindFreeCoords(&Pos, aRoom, &Out, 0); 49 | if (aRoom && Out.x && Out.y) 50 | { 51 | int mX = D2Funcs.D2COMMON_GetPathX(pWatcher->pPath); 52 | int mY = D2Funcs.D2COMMON_GetPathY(pWatcher->pPath); 53 | if (aRoom == mRoom) 54 | { 55 | int aRange = ((Pos.x - mX)*(Pos.x - mX)) + ((Pos.y - mY)*(Pos.y - mY)); 56 | if (aRange > (25 * 25)) 57 | { 58 | DEBUGMSG("[SPEC] Moving w/o Room to [%d,%d], range = %d", Out.x, Out.y, aRange) 59 | D2ASMFuncs::D2GAME_TeleportUnit(Out.x, Out.y, 0, pGame, pWatcher); 60 | } 61 | } 62 | else 63 | { 64 | int aRange = ((Pos.x - mX)*(Pos.x - mX)) + ((Pos.y - mY)*(Pos.y - mY)); 65 | if (aRange > (25 * 25)) 66 | { 67 | DEBUGMSG("[SPEC] Moving with Room to [%d,%d]", Out.x, Out.y) 68 | D2ASMFuncs::D2GAME_TeleportUnit(Out.x, Out.y, aRoom, pGame, pWatcher); 69 | } 70 | } 71 | } 72 | } 73 | } 74 | 75 | 76 | void SPECTATOR_ResetUnitState(UnitAny *pWatcher) 77 | { 78 | DEBUGMSG("Cleaning the specer") 79 | pWatcher->dwFlags |= UNITFLAG_SELECTABLE; 80 | pWatcher->dwFlags &= ~(UNITFLAG_DEATHVANISH | UNITFLAG_DEAD | UNITFLAG_NEUTRAL); 81 | D2Funcs.D2COMMON_SetGfxState(pWatcher, D2EX_SPECTATOR_STATE, 0); 82 | D2Funcs.D2COMMON_SetGfxState(pWatcher, D2States::uninterruptable, 0); 83 | pWatcher->pPath->dwCollisionFlag = 0x1C09; 84 | pWatcher->pPath->_5[0] = 1; 85 | pWatcher->pPath->_5[1] = 128; 86 | D2Funcs.D2COMMON_SetStat(pWatcher, STAT_HP, D2Funcs.D2COMMON_GetStatSigned(pWatcher, STAT_MAXHP, 0), 0); // Restore hp 87 | int aLevel = D2Funcs.D2COMMON_GetTownLevel(pWatcher->dwAct); 88 | int aCurrLevel = D2Funcs.D2COMMON_GetLevelNoByRoom(pWatcher->pPath->pRoom1); 89 | if (aCurrLevel != aLevel) 90 | D2ASMFuncs::D2GAME_MoveUnitToLevelId(pWatcher, aLevel, pWatcher->pGame); 91 | 92 | ExEventSpecatorEnd msg; 93 | msg.P_A6 = 0xA6; 94 | msg.MsgType = EXEVENT_SPECTATOR_END; 95 | msg.PacketLen = sizeof(ExEventSpecatorEnd); 96 | D2ASMFuncs::D2GAME_SendPacket(pWatcher->pPlayerData->pClientData, (BYTE*)&msg, sizeof(ExEventSpecatorEnd)); 97 | pWatcher->pPlayerData->isSpecing = 0; 98 | } 99 | 100 | /* 101 | Removes pWatcher from LSpectator targets or requesters 102 | */ 103 | void SPECTATOR_RemoveFromQueue(Game* pGame, DWORD QuitterId) 104 | { 105 | for (auto &obs : *pGame->pSpectators) { 106 | if (obs.UnitId != QuitterId && obs.ObservatorId != QuitterId) 107 | continue; 108 | 109 | DEBUGMSG("Looking for unit 0x%x", obs.ObservatorId) 110 | UnitAny *pWatcher = D2ASMFuncs::D2GAME_FindUnit(pGame, obs.ObservatorId, UNIT_PLAYER); 111 | if (pWatcher) 112 | SPECTATOR_ResetUnitState(pWatcher); 113 | 114 | } 115 | pGame->pSpectators->remove_if([&](PlayerObservation const & obs){ 116 | if (obs.ObservatorId == QuitterId || obs.UnitId == QuitterId) 117 | DEBUGMSG("Removing %d", QuitterId); 118 | 119 | return obs.ObservatorId == QuitterId || obs.UnitId == QuitterId; 120 | }); 121 | 122 | } 123 | 124 | DWORD SPECTATOR_OnClickSpecate(Game *pGame, UnitAny* pWatcher, UnitAny* pUnit) 125 | { 126 | if (pWatcher->pPlayerData->isSpecing && pWatcher == pUnit) 127 | { 128 | SPECTATOR_RemoveFromQueue(pGame, pWatcher->dwUnitId); 129 | return MSG_OK; 130 | } 131 | 132 | if (pWatcher->pPlayerData->isSpecing) 133 | { 134 | SendMsgToClient(pWatcher->pPlayerData->pClientData, "You already are watching someone!"); 135 | return MSG_OK; 136 | } 137 | 138 | if (pUnit->pPlayerData->isSpecing) 139 | { 140 | SendMsgToClient(pWatcher->pPlayerData->pClientData, "You cannot watch a spectator!"); 141 | return MSG_OK; 142 | } 143 | 144 | if (pWatcher->dwUnitId == pUnit->dwUnitId) 145 | { 146 | SendMsgToClient(pWatcher->pPlayerData->pClientData, "You cannot watch yourself!"); 147 | return MSG_ERROR; 148 | } 149 | if (pUnit->dwMode == PLAYER_MODE_DEAD || pUnit->dwMode == PLAYER_MODE_DEATH || pWatcher->dwMode == PLAYER_MODE_DEAD || pWatcher->dwMode == PLAYER_MODE_DEATH) 150 | { 151 | SendMsgToClient(pWatcher->pPlayerData->pClientData, "You cannot watch a dead player or being a dead!"); 152 | return MSG_OK; 153 | } 154 | 155 | PlayerObservation obs = { pWatcher->dwUnitId, pUnit->dwUnitId }; 156 | pGame->pSpectators->emplace_back(obs); 157 | 158 | pWatcher->pPlayerData->isSpecing = 1; 159 | 160 | COMBAT_Free(pGame, pWatcher); 161 | 162 | D2ASMFuncs::D2GAME_RemovePets(pGame, pWatcher); 163 | D2ASMFuncs::D2GAME_StopSequence(pWatcher); 164 | D2ASMFuncs::D2GAME_RemoveBuffs(pGame, pWatcher); 165 | D2ASMFuncs::D2GAME_DeleteTimers(pGame, pWatcher); 166 | D2ASMFuncs::D2GAME_ResetTimers(pGame, pWatcher); 167 | D2ASMFuncs::D2GAME_RemoveInteraction(pGame, pWatcher); 168 | 169 | D2Funcs.D2COMMON_SetGfxState(pWatcher, D2States::uninterruptable, 1); 170 | D2Funcs.D2COMMON_SetGfxState(pWatcher, D2EX_SPECTATOR_STATE, 1); 171 | 172 | pWatcher->dwFlags &= ~(UNITFLAG_SELECTABLE); 173 | pWatcher->dwFlags |= (UNITFLAG_NEUTRAL); 174 | pWatcher->pPath->dwCollisionFlag = 0; 175 | pWatcher->pPath->_5[0] = 0; 176 | pWatcher->pPath->_5[1] = 0; 177 | //pWatcher->dwFlags2 |= (0x00040000 | 0x00010000); 178 | //D2Funcs.D2COMMON_ChangeCurrentMode(pWatcher, PLAYER_MODE_DEATH); 179 | 180 | //D2Funcs.D2GAME_KillPlayer(pGame, pWatcher, PLAYER_MODE_DEAD, 0); 181 | ExEventSpecatorStart msg; 182 | msg.P_A6 = 0xA6; 183 | msg.MsgType = EXEVENT_SPECTATOR_START; 184 | msg.PacketLen = sizeof(ExEventSpecatorStart); 185 | msg.UnitId = pUnit->dwUnitId; 186 | D2ASMFuncs::D2GAME_SendPacket(pWatcher->pPlayerData->pClientData, (BYTE*)&msg, sizeof(ExEventSpecatorStart)); 187 | 188 | return MSG_OK; 189 | } 190 | 191 | -------------------------------------------------------------------------------- /d2warden-pvp/LSpectator.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef SPECTATOR_H__ 21 | #define SPECTATOR_H__ 22 | 23 | DWORD SPECTATOR_OnClickSpecate(Game *pGame, UnitAny* pWatcher, UnitAny* pUnit); 24 | void SPECTATOR_RemoveFromQueue(Game* pGame, DWORD QuitterId); 25 | void SPECTATOR_UpdatePositions(Game* pGame, UnitAny* pWatchedPlayer, WORD xPos, WORD yPos); 26 | 27 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LUberQuest.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2015 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LUberQuest.h" 22 | #include "LQuests.h" 23 | 24 | #include 25 | 26 | using namespace std; 27 | 28 | DWORD GetXYRange(DWORD x1, DWORD y1, DWORD x2, DWORD y2) 29 | { 30 | return (DWORD)sqrt((double)((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))); 31 | } 32 | 33 | 34 | void __stdcall UBERQUEST_SpawnMonsters(Game* pGame) 35 | { 36 | if (!pGame->bUberQuestFlags.bOpenedLilithPortal && !pGame->bUberQuestFlags.bOpenedDurielPortal && 37 | !pGame->bUberQuestFlags.bOpenedIzualPortal && !pGame->bUberQuestFlags.bOpenedTristramPortal) { 38 | D2ASMFuncs::D2GAME_UpdateRoomUnits(pGame); 39 | return; 40 | } 41 | if (pGame->bUberQuestFlags.bSpawnedLilith && pGame->bUberQuestFlags.bSpawnedDuriel && pGame->bUberQuestFlags.bSpawnedIzual 42 | && pGame->bUberQuestFlags.bSpawnedDiablo && pGame->bUberQuestFlags.bSpawnedMephisto && pGame->bUberQuestFlags.bSpawnedBaal) { 43 | D2ASMFuncs::D2GAME_UpdateRoomUnits(pGame); 44 | return; 45 | } 46 | 47 | Act* pAct = pGame->pDrlgAct[D2ACT_V]; 48 | static D2POINT hSpawnDuriel = { 0, 0 }; 49 | if (pAct) { 50 | for (Room1* pRoom = pAct->pRoom1; pRoom; pRoom = pRoom->pRoomNext) { 51 | if (!(pRoom->nUnknown & 1)) 52 | continue; 53 | int lvl = D2Funcs.D2COMMON_GetLevelNoByRoom(pRoom); 54 | switch (lvl) { 55 | case PANDEMONIUM_RUN_1: 56 | { 57 | if (!pGame->bUberQuestFlags.bSpawnedLilith) { 58 | 59 | for (PresetUnit* p = pRoom->pRoom2->pPreset; p; p = p->pPresetNext) { 60 | 61 | if (p->dwType == UNIT_OBJECT && p->dwClassId == OBJ_SPARKLYCHEST) { // Spawn Lilith near Golden Chest automap blob 62 | DWORD xPos; 63 | DWORD yPos; 64 | 65 | CoordsInfo* pCoords = D2Funcs.D2COMMON_GetCoordsInfo(pRoom, pRoom->hCoords.dwXStart + p->dwPosX, pRoom->hCoords.dwYStart + p->dwPosY); 66 | if (D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, pCoords, UBERANDARIEL, &xPos, &yPos, FALSE)) { 67 | 68 | if (D2Funcs.D2GAME_SpawnMonster(UBERANDARIEL, 1, pGame, pRoom, xPos, yPos, -1, 0)) { 69 | pGame->bUberQuestFlags.bSpawnedLilith = true; 70 | DEBUGMSG("Spawned Uber Andy!") 71 | } 72 | } 73 | break; 74 | } 75 | 76 | } 77 | } 78 | break; 79 | } 80 | case PANDEMONIUM_RUN_2: 81 | { 82 | if (!pGame->bUberQuestFlags.bSpawnedDuriel) { 83 | for (PresetUnit* p = pRoom->pRoom2->pPreset; p; p = p->pPresetNext) { 84 | 85 | if (!hSpawnDuriel.x && p->dwType == UNIT_OBJECT && p->dwClassId == OBJ_WAYPOINT_VALLEYWAYPOINT) { // Spawn Duriel near Waypoint, but not on it 86 | hSpawnDuriel.x = pRoom->hCoords.dwXStart + p->dwPosX; 87 | hSpawnDuriel.y = pRoom->hCoords.dwYStart + p->dwPosY; 88 | continue; 89 | } 90 | } 91 | if (hSpawnDuriel.x && hSpawnDuriel.y && (GetXYRange(hSpawnDuriel.x, hSpawnDuriel.y, pRoom->hCoords.dwXStart, pRoom->hCoords.dwYStart) > 50)) 92 | { 93 | DWORD xPos; 94 | DWORD yPos; 95 | 96 | CoordsInfo* pCoords = D2Funcs.D2COMMON_GetCoordsInfo(pRoom, (pRoom->hCoords.dwXStart + pRoom->hCoords.dwYSize / 2), (pRoom->hCoords.dwYStart + pRoom->hCoords.dwYSize) / 2); 97 | if (D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, pCoords, UBERDURIEL, &xPos, &yPos, FALSE)) { 98 | 99 | if (D2Funcs.D2GAME_SpawnMonster(UBERDURIEL, 1, pGame, pRoom, xPos, yPos, -1, 0)) { 100 | pGame->bUberQuestFlags.bSpawnedDuriel = true; 101 | DEBUGMSG("Spawned Uber Duriel!") 102 | } 103 | } 104 | break; 105 | } 106 | 107 | 108 | } 109 | break; 110 | } 111 | case PANDEMONIUM_RUN_3: 112 | { 113 | if (!pGame->bUberQuestFlags.bSpawnedIzual) { 114 | for (PresetUnit* p = pRoom->pRoom2->pPreset; p; p = p->pPresetNext) { 115 | 116 | if (p->dwType == UNIT_OBJECT && p->dwClassId == OBJ_SPARKLYCHEST) { // Spawn Izual near Golden Chest automap blob 117 | DWORD xPos; 118 | DWORD yPos; 119 | 120 | CoordsInfo* pCoords = D2Funcs.D2COMMON_GetCoordsInfo(pRoom, pRoom->hCoords.dwXStart + p->dwPosX, pRoom->hCoords.dwYStart + p->dwPosY); 121 | if (D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, pCoords, UBERIZUAL, &xPos, &yPos, FALSE)) { 122 | 123 | if (D2Funcs.D2GAME_SpawnMonster(UBERIZUAL, 1, pGame, pRoom, xPos, yPos, -1, 0)) { 124 | pGame->bUberQuestFlags.bSpawnedIzual = true; 125 | DEBUGMSG("Spawned Uber Izual!") 126 | } 127 | } 128 | break; 129 | } 130 | 131 | } 132 | } 133 | break; 134 | } 135 | case UBER_TRISTRAM: 136 | { 137 | if (!pGame->bUberQuestFlags.bSpawnedBaal) { 138 | D2POINT Out = { 0, 0 }; 139 | BOOL found = D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, 0, UBERBAAL, (DWORD*)&Out.x, (DWORD*)&Out.y, 1); 140 | if (!found) 141 | continue; 142 | 143 | 144 | if (D2Funcs.D2GAME_SpawnMonster(UBERBAAL, 1, pGame, pRoom, Out.x, Out.y, -1, 0)) { 145 | pGame->bUberQuestFlags.bSpawnedBaal = true; 146 | DEBUGMSG("Spawned Uber Baal!") 147 | } 148 | else continue; 149 | } 150 | if (!pGame->bUberQuestFlags.bSpawnedMephisto) { 151 | D2POINT Out = { 0, 0 }; 152 | BOOL found = D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, 0, UBERMEPHISTO, (DWORD*)&Out.x, (DWORD*)&Out.y, 1); 153 | if (!found) 154 | continue; 155 | 156 | 157 | if (D2Funcs.D2GAME_SpawnMonster(UBERMEPHISTO, 1, pGame, pRoom, Out.x, Out.y, -1, 0)) { 158 | pGame->bUberQuestFlags.bSpawnedMephisto = true; 159 | DEBUGMSG("Spawned Uber Meph!") 160 | } 161 | else continue; 162 | } 163 | if (!pGame->bUberQuestFlags.bSpawnedDiablo) { 164 | D2POINT Out = { 0, 0 }; 165 | BOOL found = D2Funcs.D2GAME_FindMonsterRoom(pGame, pRoom, 0, UBERDIABLO, (DWORD*)&Out.x, (DWORD*)&Out.y, 1); 166 | if (!found) 167 | continue; 168 | 169 | 170 | if (D2Funcs.D2GAME_SpawnMonster(UBERDIABLO, 1, pGame, pRoom, Out.x, Out.y, -1, 0)) { 171 | pGame->bUberQuestFlags.bSpawnedDiablo = true; 172 | DEBUGMSG("Spawned Uber D2!") 173 | } 174 | else continue; 175 | } 176 | break; 177 | } 178 | } 179 | } 180 | } 181 | 182 | D2ASMFuncs::D2GAME_UpdateRoomUnits(pGame); 183 | } 184 | 185 | BOOL UBERQUEST_OpenPandemoniumPortal(Game *pGame, UnitAny *pPlayer) 186 | { 187 | if (pGame->DifficultyLevel != DIFF_HELL) // Open only in hell 188 | return FALSE; 189 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pPlayer); 190 | if (pRoom) 191 | { 192 | DWORD aLvl = D2Funcs.D2COMMON_GetLevelNoByRoom(pRoom); 193 | if (aLvl != HARROGATH) 194 | return FALSE; 195 | 196 | vector quest_levels; 197 | if (!pGame->bUberQuestFlags.bOpenedLilithPortal) 198 | quest_levels.push_back(PANDEMONIUM_RUN_1); 199 | if (!pGame->bUberQuestFlags.bOpenedDurielPortal) 200 | quest_levels.push_back(PANDEMONIUM_RUN_2); 201 | if (!pGame->bUberQuestFlags.bOpenedIzualPortal) 202 | quest_levels.push_back(PANDEMONIUM_RUN_3); 203 | 204 | if (quest_levels.size() == 0) 205 | return FALSE; 206 | 207 | DWORD levelToSpawn = quest_levels[rand() % quest_levels.size()]; 208 | 209 | if (!QUESTS_OpenPortal(pGame, pPlayer, levelToSpawn)) 210 | return FALSE; 211 | 212 | 213 | if (levelToSpawn == PANDEMONIUM_RUN_1) { 214 | pGame->bUberQuestFlags.bOpenedLilithPortal = TRUE; 215 | } 216 | else if (levelToSpawn == PANDEMONIUM_RUN_2) 217 | pGame->bUberQuestFlags.bOpenedDurielPortal = TRUE; 218 | else if (levelToSpawn == PANDEMONIUM_RUN_3) 219 | pGame->bUberQuestFlags.bOpenedIzualPortal = TRUE; 220 | 221 | 222 | if (levelToSpawn) 223 | 224 | return TRUE; 225 | } 226 | 227 | return FALSE; 228 | } 229 | 230 | BOOL UBERQUEST_OpenPandemoniumFinalPortal(Game *pGame, UnitAny *pPlayer) 231 | { 232 | if (pGame->DifficultyLevel != DIFF_HELL || pGame->bUberQuestFlags.bOpenedTristramPortal) // Open only in hell 233 | return FALSE; 234 | 235 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pPlayer); 236 | if (pRoom) 237 | { 238 | DWORD aLvl = D2Funcs.D2COMMON_GetLevelNoByRoom(pRoom); 239 | if (aLvl != HARROGATH) 240 | return FALSE; 241 | 242 | if (!QUESTS_OpenPortal(pGame, pPlayer, UBER_TRISTRAM)) 243 | return FALSE; 244 | 245 | pGame->bUberQuestFlags.bOpenedTristramPortal = TRUE; 246 | return TRUE; 247 | } 248 | return FALSE; 249 | } 250 | 251 | -------------------------------------------------------------------------------- /d2warden-pvp/LUberQuest.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2015 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef LUBERQUEST_H__ 21 | #define LUBERQUEST_H__ 22 | 23 | void __stdcall UBERQUEST_SpawnMonsters(Game* pGame); 24 | BOOL UBERQUEST_OpenPandemoniumPortal(Game *pGame, UnitAny *pPlayer); 25 | BOOL UBERQUEST_OpenPandemoniumFinalPortal(Game *pGame, UnitAny *pPlayer); 26 | 27 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/LWorldEvent.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | 22 | #include "LWorldEvent.h" 23 | #include "Warden.h" 24 | #include "LQuests.h" 25 | 26 | 27 | bool WE_isKey(UnitAny* ptItem) 28 | { 29 | 30 | DWORD iCode = D2Funcs.D2COMMON_GetItemCode(ptItem); 31 | 32 | for(int i = 0; i<20; i++) 33 | { 34 | if(Warden::getInstance().WItem.ItemCode[i] == 0) return false; 35 | 36 | //Log("ICode %s",TransCode(WItem.ItemCode[i])); 37 | if (iCode == Warden::getInstance().WItem.ItemCode[i]) 38 | { 39 | for(int q = 0; q<7; q++) 40 | { 41 | if (Warden::getInstance().WItem.ItemQuality[q] == -1) break; 42 | // Log("IQuality %d",WItem.ItemQuality[q]); 43 | if (Warden::getInstance().WItem.ItemQuality[q] == 0) 44 | { 45 | Warden::getInstance().SellCount++; 46 | WE_UpdateCounter(Warden::getInstance().SellCount); 47 | if (Warden::getInstance().SellCount % Warden::getInstance().InfoDelay == 0) 48 | WE_Inform(ptItem->pGame); 49 | 50 | return true; 51 | } 52 | for(int x = 0; x<20 ; x++) 53 | { 54 | // Log("Idx %d",WItem.FileIdx[x]); 55 | if (ptItem->pItemData->QualityNo == Warden::getInstance().WItem.ItemQuality[q] && Warden::getInstance().WItem.FileIdx[x] == -1) 56 | { 57 | Warden::getInstance().SellCount++; 58 | WE_UpdateCounter(Warden::getInstance().SellCount); 59 | if (Warden::getInstance().SellCount % Warden::getInstance().InfoDelay == 0) 60 | WE_Inform(ptItem->pGame); 61 | 62 | return true; 63 | } 64 | if (Warden::getInstance().WItem.FileIdx[x] == -1) 65 | break; 66 | if (ptItem->pItemData->QualityNo == Warden::getInstance().WItem.ItemQuality[q] && Warden::getInstance().WItem.FileIdx[x] == ptItem->pItemData->FileIndex) 67 | { 68 | Warden::getInstance().SellCount++; 69 | WE_UpdateCounter(Warden::getInstance().SellCount); 70 | if (Warden::getInstance().SellCount % Warden::getInstance().InfoDelay == 0) 71 | WE_Inform(ptItem->pGame); 72 | 73 | return true; 74 | } 75 | } 76 | } 77 | 78 | } 79 | } 80 | return false; 81 | 82 | } 83 | 84 | void WE_GenerateNextDC() 85 | { 86 | static boost::mt19937 rng; 87 | rng.seed(static_cast (std::time(0))); 88 | boost::uniform_int dist(Warden::getInstance().MinSell, Warden::getInstance().MaxSell); 89 | boost::variate_generator>random(rng, dist); 90 | 91 | int NxtDC = Warden::getInstance().NextDC + random(); 92 | 93 | std::ostringstream str; 94 | str << NxtDC; 95 | Warden::getInstance().NextDC = NxtDC; 96 | WritePrivateProfileString("World Event", "NextDC", str.str().c_str(), Warden::getInstance().wcfgConfigFile.c_str()); 97 | } 98 | 99 | void WE_CreateDCKey(UnitAny* pUnit) 100 | { 101 | PresetItem sets; 102 | memset(&sets,0,sizeof(sets)); 103 | int Idx; 104 | D2Funcs.D2COMMON_GetItemIdx(' kew',&Idx); 105 | 106 | sets.pOwner=pUnit; 107 | sets.wItemFormat=pUnit->pGame->ItemFormat; 108 | sets.pGame=pUnit->pGame; 109 | sets.iMode=ITEM_MODE_ON_CURSOR; 110 | sets.iQuality=ITEM_QUALITY_NORMAL; 111 | sets.iIdx=Idx; 112 | sets.dwItemFlags.bIdentified=1; 113 | sets.wCreateFlags=1; 114 | sets.iLvl=99; 115 | UnitAny* ptItem = D2Funcs.D2GAME_CreateItemEx(pUnit->pGame,&sets,0); 116 | 117 | if(ptItem) 118 | { 119 | D2POINT Pos = {pUnit->pPath->xPos,pUnit->pPath->yPos}; 120 | D2POINT Out = {0,0}; 121 | Room1* aRoom = D2ASMFuncs::D2GAME_FindFreeCoords(&Pos,pUnit->pPath->pRoom1,&Out,1); 122 | if(!aRoom) return; 123 | D2ASMFuncs::D2GAME_DropItem(ptItem,aRoom,pUnit->pGame,pUnit,Out.x,Out.y); 124 | BroadcastEventMsg(pUnit->pGame,COL_RED,"The World Event Key has been crafted"); 125 | } 126 | } 127 | 128 | int __fastcall WE_Spawn(Game *pGame, UnitAny *pUnit, UnitAny *pScroll, UnitAny *ptItem, int a5, int a6, int SkillId) 129 | { 130 | if(pGame->bSpawnedClone) 131 | { 132 | QUESTS_UpdateUnit(pUnit,20,pUnit); 133 | return 0; 134 | } 135 | 136 | Room1* pRoom = D2Funcs.D2COMMON_GetUnitRoom(pUnit); 137 | 138 | if(pRoom) 139 | { 140 | int aLvl = D2Funcs.D2COMMON_GetLevelNoByRoom(pRoom); 141 | if(aLvl==39) 142 | { 143 | 144 | D2POINT Pos = { pUnit->pPath->xPos, pUnit->pPath->yPos }; 145 | D2POINT Out = { 0, 0 }; 146 | Room1* aRoom = D2ASMFuncs::D2GAME_FindFreeCoords(&Pos,pUnit->pPath->pRoom1,&Out,1); 147 | 148 | if(aRoom) 149 | { 150 | UnitAny* ptMonster = D2Funcs.D2GAME_SpawnMonster(333,1,pGame,aRoom,Out.x,Out.y,-1,0); 151 | if(ptMonster) 152 | { 153 | 154 | pGame->bSpawnedClone = TRUE; 155 | WE_Inform2(pGame); 156 | return 1; 157 | } 158 | } 159 | } 160 | } 161 | 162 | QUESTS_UpdateUnit(pUnit,20,pUnit); 163 | return 0; 164 | } 165 | 166 | void WE_UpdateCounter(int Value) 167 | { 168 | std::ostringstream str; 169 | str << Value; 170 | WritePrivateProfileString("World Event", "SellCount", str.str().c_str(), Warden::getInstance().wcfgConfigFile.c_str()); 171 | } 172 | 173 | 174 | void WE_Inform(Game* ptGame) 175 | { 176 | 177 | EventPacket aPacket; 178 | memset(&aPacket,0,40); 179 | aPacket.P_5A=0x5A; 180 | aPacket.Color=9; 181 | aPacket.MsgType=17; 182 | *(DWORD*)&aPacket.Param1 = Warden::getInstance().SellCount; 183 | 184 | BroadcastPacket(ptGame,(BYTE*)&aPacket, 40); 185 | } 186 | 187 | void WE_Inform2(Game* ptGame) 188 | { 189 | 190 | EventPacket aPacket; 191 | memset(&aPacket,0,40); 192 | aPacket.P_5A=0x5A; 193 | aPacket.Color=9; 194 | aPacket.MsgType=18; 195 | 196 | BroadcastPacket(ptGame,(BYTE*)&aPacket,40); 197 | } 198 | -------------------------------------------------------------------------------- /d2warden-pvp/LWorldEvent.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2WE_H__ 21 | #define D2WE_H__ 22 | 23 | bool WE_isKey(UnitAny* ptItem); 24 | void WE_UpdateCounter(int Value); 25 | void WE_GenerateNextDC(); 26 | void WE_CreateDCKey(UnitAny* pUnit); 27 | void WE_Inform(Game* ptGame); 28 | void WE_Inform2(Game* ptGame); 29 | int __fastcall WE_Spawn(Game *pGame, UnitAny *pUnit, UnitAny *pScroll, UnitAny *ptItem, int a5, int a6, int SkillId); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /d2warden-pvp/LegacyFuncs.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "LegacyFuncs.h" 22 | 23 | GameInfo* GetGameInfo(short serverToken) 24 | { 25 | if (serverToken >= 1026) { 26 | Log("Invalid game id: %d", serverToken); 27 | return NULL; 28 | } 29 | 30 | return &D2Vars.D2SERVER_GameInfo[serverToken]; 31 | } 32 | -------------------------------------------------------------------------------- /d2warden-pvp/LegacyFuncs.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __LEGACY_FUNCS_H__ 21 | #define __LEGACY_FUNCS_H__ 22 | 23 | GameInfo* GetGameInfo(short serverToken); 24 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/MainLoop.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://bitbucket.org/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2008 marsgod 6 | * 2011-2015 Bartosz Jankowski 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * ========================================================== */ 20 | 21 | 22 | #include "stdafx.h" 23 | 24 | 25 | /** 26 | Executed after all standard events are parsed 27 | Warning: The server is now inside the critical section (pGame->pLock) ! 28 | */ 29 | void __stdcall MainLoop(Game *pGame) 30 | { 31 | if (!Warden::getInstance().empty()) 32 | Warden::getInstance().loop(pGame); 33 | } 34 | 35 | void __declspec(naked) MainLoop_ASM() 36 | { 37 | __asm 38 | { 39 | 40 | push esi // pGame 41 | 42 | call MainLoop 43 | 44 | pop edi 45 | pop ebx 46 | pop esi 47 | retn 48 | } 49 | } -------------------------------------------------------------------------------- /d2warden-pvp/MainLoop.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://bitbucket.org/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2008 marsgod 6 | * 2011-2015 Bartosz Jankowski 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | 22 | void MainLoop_ASM(); -------------------------------------------------------------------------------- /d2warden-pvp/Misc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/Misc.cpp -------------------------------------------------------------------------------- /d2warden-pvp/Misc.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef __WARDENMISC_H_ 21 | #define __WARDENMISC_H_ 22 | 23 | 24 | const char* UnitTypeToStr(DWORD type); 25 | DWORD GetEIP(); 26 | short CalculateDistance(short x1, short y1, short x2, short y2); 27 | void ClearSayGoFlag(Game* pGame); 28 | void ClearCanAttackFlag(Game* pGame); 29 | void ClearIsPlayingFlag(Game* pGame); 30 | bool isAnAdmin(std::string szAcc); 31 | BOOL isItemBelongToUnit(UnitAny* ptUnit, DWORD iCode); 32 | BOOL isItemBelongToUnit(UnitAny* ptUnit, DWORD iCode, ItemQuality iQuality); 33 | UnitAny* FindUnitByClassId(Game* pGame, DWORD UnitType, DWORD dwClassId); 34 | ClientData* FindClientDataByName(Game* pGame, char* szName); 35 | ClientData* FindClientDataById(Game* pGame, DWORD ClientID); 36 | int TransQuality(std::string str); 37 | BYTE GetColorNameByAcc(std::string szAcc); 38 | DWORD TransCode(const char* ptCode); 39 | const char* TransCode(DWORD dwCode); 40 | void KickPlayer(ClientData* pClient); 41 | void KickPlayer(DWORD ClientID); 42 | void BootPlayer(DWORD ClientID, BootReason dwReason); 43 | 44 | void UpdateStats(UnitAny* ptUnit, int StatNo, int StatValue); 45 | void BroadcastMsg(Game* pGame,char *Msg...); 46 | void BroadcastEventMsgEx(Game* pGame, int Color, std::string EngMsg, std::string PolMsg); 47 | void BroadcastExEvent(Game* pGame, int Color, DWORD UnitId, int nCell, std::string szPath); 48 | void SendExEvent(ClientData* pClient, int Color, int Sound, int Font, short X, short Y, std::string polMsg, std::string engMsg); 49 | void SendExEvent(ClientData* pClient, ExEventOption op, DWORD value); 50 | void BroadcastExEvent(Game* pGame, int Color, int Sound, int Font, short X, short Y, std::string polMsg, std::string engMsg); 51 | void BroadcastEventMsg(Game* pGame, int Color, char *Msg...); 52 | void BroadcastPacket(Game* pGame, BYTE * aPacket, int aLen); 53 | 54 | BOOL WriteDword(DWORD* lpAddr, DWORD lpBuffer); 55 | BOOL WriteBytes(void* lpAddr, void* lpBuffer, DWORD dwLen); 56 | void PatchGS(BYTE bInst, DWORD pAddr, DWORD pFunc, DWORD dwLen,char* Type); 57 | void UpdatePlayerXY(UnitAny* ptUnit); 58 | void AltUpdatePlayerXY(UnitAny* ptUnit); 59 | void SendPlayerFlag(UnitAny* ptUnit, BYTE FlagID); 60 | void SendMsgToClient(ClientData* ptClient,char *Msg...); 61 | void SendEventToClient(DWORD ClientID,BYTE Col,BYTE MsgType,char * Char1, char * Char2, DWORD P1, BYTE P2); 62 | std::string ConvertSkill(WORD SkillID); 63 | char * ConvertLevel(int LevelId); 64 | char * ConvertClass(int ClassId); 65 | int isGoodSkill(WORD SkillID); 66 | bool isMeleeSkill(int SkillID); 67 | bool isSafeSkill(WORD SkillId); 68 | void upcase(char * q); 69 | void lowcase(char * q); 70 | 71 | void Debug(const char * szFunction, char *format, ...); 72 | void DebugNoEnter(const char * szFunction, char *format, ...); 73 | void DebugFinishEnter(char *format, ...); 74 | 75 | void Log(char *format,...); 76 | void LogToFile(char *FileName, bool PutTime, char *format,...); 77 | void LogError(unsigned char log_level_in,char *format,...); 78 | void LogMsg(char * GameName, char *format,...); 79 | int GetHexValue(char c); 80 | unsigned char Convert2HEX(unsigned char *tt); 81 | DWORD Convert2DWORD(char *tt); 82 | int GetHexSpan(const char* string); 83 | int ConvertHexStringToBytes(const char* string, unsigned char* bytes, int length); 84 | int ConvertBytesToHexString(const unsigned char* bytes, int dataSize, char* string, int stringSize, char delimiter); 85 | int CalculateTextDumpSize(int size); 86 | int DumpDataAsText(unsigned char* bytesIn, int sizeIn, char* dataOut, int sizeOut); 87 | int removespace(char *str,int len); 88 | void trimspaces(char *str); 89 | void WideToChar(CHAR* Dest, const WCHAR* Source); 90 | 91 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/NodesEx.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2NODES_H__ 21 | #define D2NODES_H__ 22 | 23 | void __fastcall NODES_Free(Game *ptGame); 24 | void __fastcall NODES_AddAsParentNode(Game *ptGame, UnitAny *ptUnit, UnitNode *ptNode, int NodeIdx); 25 | void __fastcall NODES_SetUnitNode(Game *ptGame, UnitAny *ptUnit, UnitNode* ptNode, int NodeIdx); 26 | UnitNode *__fastcall NODES_GetUnitNode(UnitAny *ptUnit, Game *ptGame); 27 | void __fastcall NODES_AssignNode(Game *ptGame, UnitAny *ptUnit, UnitNode* pChild); 28 | void __fastcall NODES_FreeChildNode(Game *ptGame, UnitAny *ptUnit); 29 | void __fastcall NODES_FreeUnitNode(Game* ptGame, UnitAny* ptUnit); 30 | UnitAny *__stdcall NODES_BaalCheck(Game *ptGame, UnitAny *ptUnit, int *xPos, int *yPos, int aZero, int (__fastcall *pfnCallback)(UnitAny*, UnitAny*)); //0x6FC4A790 31 | UnitAny *__stdcall NODES_NormalCheck(Game *ptGame, UnitAny *ptUnit, int *xPos, int *yPos, int aZero, int (__fastcall *pfnCallback)(UnitAny*, UnitAny*)); //0x6FC4A790 32 | 33 | 34 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/Offset.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "Offset.h" 22 | 23 | const static char *dlls[] = { "D2Client.DLL", "D2Common.DLL", "D2Gfx.DLL", "D2Lang.DLL", 24 | "D2Win.DLL", "D2Net.DLL", "D2Game.DLL", "D2Launch.DLL", "Fog.DLL", "BNClient.DLL", 25 | "Storm.DLL", "D2Cmp.DLL", "D2Multi.DLL", "D2Sound.DLL", "D2Gdi.dll", "D2DDraw.dll", "D2Direct3D.dll", 26 | "D2Glide.dll", "d2server.dll" }; 27 | 28 | DWORD GetDllOffset(const char *dll, int offset) 29 | { 30 | HMODULE hmod = GetModuleHandle(dll); 31 | if (!hmod) 32 | hmod = LoadLibrary(dll); 33 | if (!hmod) return 0; 34 | if (offset < 0) 35 | return (DWORD)GetProcAddress(hmod, (LPCSTR)(-offset)); 36 | 37 | return ((DWORD)hmod)+offset; 38 | } 39 | 40 | DWORD GetDllOffset(int num) 41 | { 42 | return GetDllOffset(dlls[num&0xff], num>>8); 43 | } 44 | -------------------------------------------------------------------------------- /d2warden-pvp/Offset.h: -------------------------------------------------------------------------------- 1 | #ifndef _OFFSETS_H 2 | #define _OFFSETS_H 3 | 4 | DWORD GetDllOffset(int num); 5 | DWORD GetDllOffset(const char *dll, int offset); 6 | 7 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/PartyExp.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | #include "PartyExp.h" 22 | 23 | 24 | //int __fastcall EXPERIENCE_CalculateDecay(int nAttackerLevel, int nDefenderLevel) 25 | //{ 26 | // if(nAttackerLevel == nDefenderLevel || nAttackerLevel == 1) 27 | // return 100; 28 | // 29 | // int nDifferance = nAttackerLevel - nDefenderLevel; 30 | // if(nDifferance < EXPERIENCE_DECAY_START) 31 | // return 100; 32 | // 33 | // return (nDifferance > 100 / EXPERIENCE_DECAY_AMOUNT) ? 0 : 100 - (nDifferance * EXPERIENCE_DECAY_AMOUNT); 34 | //} 35 | // 36 | //DWORD __fastcall EXPERIENCE_Calculate(Game* pGame, UnitAny* pAttacker, int nAttackerLevel, int nDefenderLevel, DWORD dwExp) 37 | //{ 38 | // if(pGame == NULL || pAttacker == NULL || nAttackerLevel < 1 || nDefenderLevel < 1 || dwExp == 0) 39 | // return EXPERIENCE_MIN_GAIN; 40 | // 41 | // if(nAttackerLevel >= PLAYERS_GetMaxLevel(pAttacker)) 42 | // return EXPERIENCE_MIN_GAIN; 43 | // 44 | // int nRatio = PLAYERS_GetExperienceRatio(pAttacker,nAttackerLevel); 45 | // dwExp = INLINE_ApplyPercent(dwExp,100,EXPERIENCE_CalculateDecay(nAttackerLevel,nDefenderLevel)); 46 | // return EXPERIENCE_Normalize((dwExp * nRatio) / 1024); 47 | //} 48 | 49 | 50 | 51 | SubParty* GetSubPartyById(Game *pGame, short PartyId) 52 | { 53 | if(!pGame || PartyId == -1) return 0; 54 | 55 | Party * pParty = pGame->pPartyControl; 56 | if(!pParty) return 0; 57 | 58 | for(SubParty* pSub = pParty->ptLastParty; pSub; pSub = pSub->ptPrev) 59 | { 60 | if(pSub->PartyId == PartyId) return pSub; 61 | } 62 | return 0; 63 | } 64 | 65 | int __fastcall EXPFormula(int nPlayers) 66 | { 67 | return 50 * (nPlayers - 1); 68 | } 69 | 70 | int __fastcall HPFormula(int nPlayers) 71 | { 72 | return 50 * ((nPlayers > 16 ? 16 : nPlayers) - 1); 73 | } 74 | 75 | __declspec(naked) int nPlayersFormula() 76 | { 77 | __asm 78 | { 79 | push ecx 80 | mov ecx, eax 81 | 82 | call EXPFormula 83 | 84 | pop ecx 85 | ret 86 | } 87 | } 88 | 89 | __declspec(naked) int HpGainFormula() 90 | { 91 | __asm 92 | { 93 | push ecx 94 | mov ecx, eax 95 | 96 | call HPFormula 97 | 98 | pop ecx 99 | ret 100 | } 101 | } 102 | 103 | void __fastcall ExpCallback(Game *pGame, UnitAny *pPartyMember, PartyExp *pnPartyExp) 104 | { 105 | if(pPartyMember && !((pPartyMember->dwFlags) & 0x00010000)) 106 | if((pPartyMember->dwType == UNIT_MONSTER && pPartyMember->dwMode != NPC_MODE_DEATH && pPartyMember->dwMode != NPC_MODE_DEAD) || 107 | (pPartyMember->dwType == UNIT_PLAYER && pPartyMember->dwMode != PLAYER_MODE_DEATH && pPartyMember->dwMode != PLAYER_MODE_DEAD)) 108 | { 109 | 110 | UnitAny* pMonster = pnPartyExp->pMonster; 111 | int mX = D2Funcs.D2GAME_GetUnitX(pMonster); 112 | int mY = D2Funcs.D2GAME_GetUnitY(pMonster); 113 | 114 | int pX = D2Funcs.D2GAME_GetUnitX(pPartyMember); 115 | int pY = D2Funcs.D2GAME_GetUnitY(pPartyMember); 116 | 117 | if (GetRange(pX, pY, mX, mY)> Warden::getInstance().wcfgExpRange && Warden::getInstance().wcfgExpRange != -1) return; 118 | 119 | int nMembers = pnPartyExp->nMembers; 120 | if (nMembers > Warden::getInstance().wcfgMaxPlayers) 121 | { 122 | D2ERROR("nMember>wcfgMaxPlayers") 123 | } 124 | pnPartyExp->pPartyMembers[nMembers] = pPartyMember; 125 | pnPartyExp->PartyLevels[nMembers] = D2Funcs.D2COMMON_GetStatSigned(pPartyMember,STAT_LEVEL,0); 126 | pnPartyExp->LvlSum += pnPartyExp->PartyLevels[nMembers]; 127 | pnPartyExp->nMembers++; 128 | return; 129 | } 130 | 131 | 132 | } 133 | 134 | 135 | void AddExp(Game *pGame, UnitAny* pMember, int ExpGained, int ExpLvl) 136 | { 137 | int CurrentExp = D2Funcs.D2COMMON_GetBaseStatSigned(pMember, STAT_EXP,0); 138 | unsigned int NewExp = ExpGained + CurrentExp; 139 | int MaxLvl = D2Funcs.D2COMMON_GetMaxCLvl(pMember->dwClassId); 140 | unsigned int MaxExp = D2Funcs.D2COMMON_GetExpToAchiveLvl(pMember->dwClassId, MaxLvl - 1); 141 | 142 | if ( NewExp > MaxExp ) NewExp = MaxExp; 143 | D2Funcs.D2COMMON_SetStat(pMember, 0x1D, ExpGained, 0); // LAST EXP 144 | D2Funcs.D2COMMON_SetStat(pMember, STAT_EXP, NewExp, 0); 145 | if ( ExpLvl != D2Funcs.D2COMMON_GetNextCLvl(pMember->dwClassId, NewExp) ) 146 | { 147 | D2ASMFuncs::D2GAME_LevelAwards(pMember, pGame); 148 | D2Funcs.D2GAME_ExecuteEvent(pGame, 12, 0, 0); 149 | } 150 | } 151 | 152 | void __stdcall ExpShare_NEW(UnitAny *pPlayer, Game *pGame, UnitAny *pMonster, int PlayerLvl, int MonsterLvl, int PlayerExp) 153 | { 154 | PartyExp hPartyExp = { 0 }; 155 | 156 | hPartyExp.pMonster = pMonster; 157 | D2ASMFuncs::D2GAME_ForEachInParty(pPlayer, pGame, (void(__fastcall*)(Game*, UnitAny*, void*))&ExpCallback, &hPartyExp); 158 | if(hPartyExp.nMembers > 0) 159 | { 160 | if(hPartyExp.LvlSum > 0) 161 | { 162 | if(hPartyExp.nMembers == 1) 163 | { 164 | int ExpGained = D2ASMFuncs::D2GAME_GetExpGained(PlayerExp, pPlayer, PlayerLvl, pGame, MonsterLvl); 165 | AddExp(pGame,pPlayer,ExpGained,PlayerLvl); 166 | // SendMsgToClient(pPlayer->pPlayerData->pClientData,"ALONE: %s, EXP: %d",pPlayer->pPlayerData->szName,PlayerExp); 167 | } 168 | else 169 | { 170 | 171 | float PExp = float((abs((((int)hPartyExp.nMembers - 1) * PlayerExp))) + PlayerExp) / float(hPartyExp.LvlSum); 172 | 173 | for(int i = 0; i<(signed int)hPartyExp.nMembers; ++i) 174 | { 175 | int PLvl = hPartyExp.PartyLevels[i]; 176 | int nGain = int(float(PLvl) * PExp); 177 | UnitAny* pMember = hPartyExp.pPartyMembers[i]; 178 | 179 | int ExpGained = D2ASMFuncs::D2GAME_GetExpGained(nGain, pMember, PLvl, pGame, MonsterLvl); 180 | AddExp(pGame,pMember,ExpGained,PLvl); 181 | //SendMsgToClient(pPlayer->pPlayerData->pClientData,"SHARE: %s, EXP: %d,Party EXP %d",pPlayer->pPlayerData->szName,PlayerExp, nGain); 182 | } 183 | } 184 | } 185 | } 186 | 187 | } 188 | 189 | //void __stdcall ExpShare(UnitAny *pPlayer, Game *pGame, UnitAny *pMonster, int PlayerLvl, int MonsterLvl, int PlayerExp) 190 | //{ 191 | // if(!pPlayer || !pGame || !pMonster) return; 192 | // if(pPlayer->dwType) return; 193 | // Room1 * aRoom = D2Funcs.D2COMMON_GetUnitRoom(pPlayer); 194 | // if(!aRoom) return; 195 | // int LevelNo = D2Funcs.D2COMMON_GetLevelNoByRoom(aRoom); 196 | // short TeamId = D2Funcs.D2GAME_GetPartyID(pPlayer,pGame); 197 | // 198 | // int mX = D2Funcs.D2GAME_GetUnitX(pMonster); 199 | // int mY = D2Funcs.D2GAME_GetUnitY(pMonster); 200 | // 201 | // if(TeamId!=-1) 202 | // { 203 | // int LevelSum = 0; 204 | // int nMembers = 0; 205 | // SubParty * pParty = GetSubPartyById(pGame,TeamId); 206 | // if(!pParty) return; 207 | // for(PartyMembers * i = pParty->ptMembers; i; i = i->ptNext) 208 | // { 209 | // UnitAny * pMember = D2ASMFuncs::D2GAME_FindUnit(pGame,i->dwUnitId,0); 210 | // if(!pMember) continue; 211 | // nMembers++; 212 | // LevelSum+= D2Funcs.D2COMMON_GetStatSigned(pMember,STAT_LEVEL,0); 213 | // } 214 | // 215 | // if(nMembers == 0) return; 216 | // if(LevelSum == 0) return; 217 | // 218 | // for(PartyMembers * i = pParty->ptMembers; i; i = i->ptNext) 219 | // { 220 | // UnitAny * pMember = D2ASMFuncs::D2GAME_FindUnit(pGame,i->dwUnitId,0); 221 | // if(!pMember) continue; 222 | // Room1 * aPartyRoom = D2Funcs.D2COMMON_GetUnitRoom(pMember); 223 | // if(!aPartyRoom) continue; 224 | // int PartyLevelNo = D2Funcs.D2COMMON_GetLevelNoByRoom(aPartyRoom); 225 | // if(PartyLevelNo != LevelNo) continue; 226 | // 227 | // int pX = D2Funcs.D2GAME_GetUnitX(pMember); 228 | // int pY = D2Funcs.D2GAME_GetUnitY(pMember); 229 | // if(GetRange(pX,pY,mX,mY)>wcfgExpRange) continue; //Nasz zasieg expa 230 | // if(pMember->dwMode && pMember->dwMode!=PLAYER_MODE_DEAD) 231 | // { 232 | // int ExpLvl = D2Funcs.D2COMMON_GetStatSigned(pMember,STAT_LEVEL,0); 233 | // double PExp = (double)(PlayerExp + 89 * PlayerExp * (nMembers - 1)) / 256; 234 | // PExp = PExp / (double)LevelSum; 235 | // int ExpGained = D2Funcs.D2GAME_GetExpGained(PlayerExp+(int)(PExp * ExpLvl),pMember,ExpLvl,pGame,MonsterLvl); // Tu moze byc crash 236 | // // Log("TEAM: PlayerExp = %d PExp = %f, LevelSum = %d, nMem = %d, Pexp* ExpLvl = %d, ExpGained = %d",PlayerExp,PExp,LevelSum,nMembers,(int)(PExp*ExpLvl),ExpGained); 237 | // 238 | // int CurrentExp = D2Funcs.D2COMMON_GetBaseStatSigned(pMember, STAT_EXP,0); 239 | // unsigned int NewExp = ExpGained + CurrentExp; 240 | // int MaxLvl = D2Funcs.D2COMMON_GetMaxCLvl(pMember->dwClassId); 241 | // unsigned int MaxExp = D2Funcs.D2COMMON_GetExpToAchiveLvl(pMember->dwClassId, MaxLvl - 1); 242 | // 243 | // // Log("CurrentExp =%d, NewExp = %d, MaxLvl =%d, MaxExp =%u",CurrentExp,NewExp,MaxLvl,MaxExp); 244 | // if ( NewExp > MaxExp ) NewExp = MaxExp; 245 | // D2Funcs.D2COMMON_SetStat(pMember, 0x1D, ExpGained, 0); // LAST EXP 246 | // D2Funcs.D2COMMON_SetStat(pMember, STAT_EXP, NewExp, 0); 247 | // if ( ExpLvl != D2Funcs.D2COMMON_GetNextCLvl(pMember->dwClassId, NewExp) ) 248 | // { 249 | // D2Funcs.D2GAME_LevelAwards(pMember, pGame); 250 | // D2Funcs.D2GAME_ExecuteEvent(pGame, 12, 0, 0); 251 | // } 252 | // 253 | // } 254 | // 255 | // } 256 | // } 257 | // else 258 | // { 259 | // int ExpGained = D2Funcs.D2GAME_GetExpGained(PlayerExp, pPlayer,D2Funcs.D2COMMON_GetStatSigned(pPlayer,STAT_LEVEL,0),pGame,MonsterLvl); // Tu moze byc crash 260 | // 261 | // int CurrentExp = D2Funcs.D2COMMON_GetBaseStatSigned(pPlayer, STAT_EXP,0); 262 | // unsigned int NewExp = ExpGained + CurrentExp; 263 | // int MaxLvl = D2Funcs.D2COMMON_GetMaxCLvl(pPlayer->dwClassId); 264 | // unsigned int NextLvlExp = D2Funcs.D2COMMON_GetExpToAchiveLvl(pPlayer->dwClassId, MaxLvl - 1); 265 | // 266 | // if ( NewExp > NextLvlExp ) NewExp = NextLvlExp; 267 | // D2Funcs.D2COMMON_SetStat(pPlayer, 0x1D, ExpGained, 0); // LAST EXP 268 | // D2Funcs.D2COMMON_SetStat(pPlayer, STAT_EXP, NewExp, 0); 269 | // if ( PlayerLvl != D2Funcs.D2COMMON_GetNextCLvl(pPlayer->dwClassId, NewExp) ) 270 | // { 271 | // D2Funcs.D2GAME_LevelAwards(pPlayer, pGame); 272 | // D2Funcs.D2GAME_ExecuteEvent(pGame, 12, 0, 0); 273 | // } 274 | // } 275 | // 276 | //} -------------------------------------------------------------------------------- /d2warden-pvp/PartyExp.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef D2PARTYEXP_H__ 21 | #define D2PARTYEXP_H__ 22 | 23 | int HpGainFormula(); 24 | int nPlayersFormula(); 25 | int __inline GetRange(int X1, int Y1, int X2, int Y2) { return ((X1-X2)*(X1-X2) + (Y1-Y2)*(Y1-Y2)); } 26 | SubParty* GetSubPartyById(Game *pGame, short PartyId); 27 | void __fastcall ExpCallback(Game *pGame, UnitAny *pPartyMember, PartyExp *pnPartyExp); // oryginalna funkcja 0x6FC9A280 28 | void __stdcall ExpShare(UnitAny *pPlayer, Game *pGame, UnitAny *pMonster, int PlayerLvl, int MonsterLvl, int PlayerExp); // orginalna funkcja 0x6FC9DFD0 29 | void __stdcall ExpShare_NEW(UnitAny *pPlayer, Game *pGame, UnitAny *pMonster, int PlayerLvl, int MonsterLvl, int PlayerExp); 30 | 31 | // 32 | // 33 | //void __userpurge sub_6FC9DDB0(UnitAny *pPlayer, UnitAny *pePlayer, Game *pGame, Game *peGame, int PlayerLvl, int ExpGained) 34 | //{ 35 | // UnitAny *ppPlayer; // esi@1 36 | // int NextLvlExp; // eax@3 37 | // int v8; // ebx@3 38 | // int v9; // ebp@3 39 | // int NewExp; // edi@3 40 | // int CurrentExp; // eax@3 41 | // int v12; // eax@3 42 | // double v13; // st7@6 43 | // int v14; // ST2C_4@6 44 | // int v15; // [sp+2Ch] [bp-10h]@5 45 | // 46 | // ppPlayer = pPlayer; 47 | // if ( pPlayer ) 48 | // { 49 | // if ( !pPlayer->dwType ) 50 | // { 51 | // CurrentExp = D2Common_GetBaseStatSigned_10550(pPlayer, STAT_EXPERIENCE, 0); 52 | // v8 = ppPlayer->dwClassId; 53 | // v9 = CurrentExp; 54 | // NewExp = ExpGained + CurrentExp; 55 | // v12 = D2Common_GetMaxLvl_11123(ppPlayer->dwClassId); 56 | // NextLvlExp = D2Common_GetExpToAchiveLvl_10152(v8, v12 - 1); 57 | // if ( NewExp > (unsigned int)NextLvlExp ) 58 | // NewExp = NextLvlExp; 59 | // D2Common_SetStat_10590(ppPlayer, STAT_LASTEXP, NewExp - v9, 0); 60 | // D2Common_SetStat_10590(ppPlayer, STAT_EXPERIENCE, NewExp, 0); 61 | // if ( PlayerLvl != D2Common_GetNextCLvl_10988(v8, NewExp) ) 62 | // { 63 | // sub_6FC99540(ppPlayer, v13, (int)peGame, v15); 64 | // ExcecuteEvent(peGame, 12, 0, 0, v14); 65 | // } 66 | // } 67 | // } 68 | //} 69 | 70 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/RC4.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the ARC4 algorithm 3 | * 4 | * Copyright (C) 2001-2003 Christophe Devine 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | #include "stdafx.h" 21 | #include "RC4.h" 22 | 23 | void rc4_setup( unsigned char *s, unsigned char *key, int length ) 24 | { 25 | int i; 26 | unsigned char *m, a, j, k; 27 | 28 | s[0] = 0; 29 | s[1] = 0; 30 | m = &s[2]; 31 | 32 | for( i = 0; i < 256; i++ ) 33 | { 34 | m[i] = (unsigned char)i; 35 | } 36 | 37 | j = k = 0; 38 | 39 | for( i = 0; i < 256; i++ ) 40 | { 41 | a = m[i]; 42 | j = (unsigned char) ( j + a + key[k] ); 43 | m[i] = m[j]; m[j] = a; 44 | if( ++k >= length ) k = 0; 45 | } 46 | } 47 | 48 | void rc4_crypt( unsigned char *s, unsigned char *data, int length ) 49 | { 50 | int i; 51 | unsigned char x, y, *m, a, b; 52 | 53 | x = s[0]; 54 | y = s[1]; 55 | m = &s[2]; 56 | 57 | for( i = 0; i < length; i++ ) 58 | { 59 | x = (unsigned char) ( x + 1 ); a = m[x]; 60 | y = (unsigned char) ( y + a ); 61 | m[x] = b = m[y]; 62 | m[y] = a; 63 | data[i] ^= m[(unsigned char) ( a + b )]; 64 | } 65 | 66 | s[0] = x; 67 | s[1] = y; 68 | } -------------------------------------------------------------------------------- /d2warden-pvp/RC4.h: -------------------------------------------------------------------------------- 1 | #ifndef _RC4_H 2 | #define _RC4_H 3 | 4 | /* 5 | struct rc4_state 6 | { 7 | unsigned char x, y, m[256]; 8 | }; 9 | */ 10 | 11 | void rc4_setup( unsigned char *s, unsigned char *key, int length ); 12 | void rc4_crypt( unsigned char *s, unsigned char *data, int length ); 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /d2warden-pvp/StatDumpThread.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #ifndef STATDUMP_H__ 21 | #define STATDUMP_H__ 22 | 23 | unsigned __stdcall StatThread(void* Params); 24 | 25 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/Votekick.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/Votekick.cpp -------------------------------------------------------------------------------- /d2warden-pvp/Votekick.h: -------------------------------------------------------------------------------- 1 | #ifndef VOTEKICK_H__ 2 | #define VOTEKICK_H__ 3 | 4 | #include "D2Structs.h" 5 | 6 | DWORD WINAPI VoteThread(void* Params); 7 | 8 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/Warden.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://bitbucket.org/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2008 marsgod 6 | * 2011-2015 Bartosz Jankowski 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef __WARDEN_H__ 22 | #define __WARDEN_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "WardenClient.h" 28 | #include "inih\cpp\INIReader.h" 29 | 30 | using namespace std; 31 | 32 | enum WardenStatus 33 | { 34 | WARDEN_START = 0, 35 | WARDEN_CHECK_CLIENT_HAS_MOD_OR_NOT, 36 | WARDEN_DOWNLOAD_MOD, 37 | WARDEN_ERROR_RESPONSE, 38 | WARDEN_WAITING_DOWNLOAD_END, 39 | WARDEN_SEND_REQUEST, 40 | WARDEN_RECEIVE_CHECK, 41 | WARDEN_NOTHING, 42 | }; 43 | 44 | class Warden 45 | { 46 | public: 47 | Warden(); 48 | ~Warden(); 49 | 50 | 51 | static Warden& getInstance() 52 | { 53 | static Warden warden; 54 | return warden; 55 | } 56 | 57 | DWORD uploadModule(DWORD ClientID, unsigned char *RC4_KEY, DWORD MOD_Position); 58 | void loadConfig(); 59 | void loop(Game* pGame); 60 | void reloadClans(); 61 | 62 | 63 | WardenClient_i findClientByName(string szName); 64 | WardenClient_i findClientByName(Game* pGame, string szName); 65 | WardenClient_i findClientByAcc(string szAcc); 66 | WardenClient_i findClientById(DWORD clientId); 67 | 68 | bool empty() { return clients.empty(); } 69 | bool isInited() { return init_succed; } 70 | 71 | WardenClient_i getInvalidClient() { return clients.end(); } 72 | DWORD getUpTime() { return uptime; } 73 | DWORD getClientCount() { return clients.size(); } 74 | 75 | DWORD __fastcall onWardenPacketReceive(Game *pGame, UnitAny *pPlayer, BYTE *pPacket, DWORD nSize); 76 | DWORD __fastcall onJoinGame(PacketData *pPacket); 77 | void onRemoveClient(WardenClient_i client); 78 | 79 | //configuration 80 | DWORD wcfgDumpInterval; 81 | DWORD wcfgExpRange; 82 | DWORD wcfgRespawnTimer; 83 | DWORD wcfgMagicPierceStat; 84 | DWORD wcfgPhysPierceStat; 85 | DWORD wcfgMaxFireRes; 86 | DWORD wcfgMaxColdRes; 87 | DWORD wcfgMaxPsnRes; 88 | DWORD wcfgMaxLightRes; 89 | DWORD wcfgMaxDmgRes; 90 | 91 | BYTE wcfgMaxPlayers; 92 | BYTE wcfgD2EXVersion; 93 | BYTE wcfgSpectator; 94 | BYTE wcfgAddKillerClass; 95 | BYTE wcfgAutoIdentify; 96 | BYTE wcfgHostileLevel; 97 | BYTE wcfgAllowLoggin; 98 | BYTE wcfgAllowTourMode; 99 | BYTE wcfgAllowVanilla; 100 | BYTE wcfgAllowGU; 101 | BYTE wcfgAllowHB; 102 | BYTE wcfgDisableHostileDelay; 103 | BYTE wcfgMoveToTown; 104 | BYTE wcfgDropEarGold; 105 | BYTE wcfgStrBugFix; 106 | BYTE wcfgFFAMode; 107 | BYTE wcfgEnableSeed; 108 | BYTE wcfgAllowD2Ex; 109 | BYTE wcfgAllowNLWW; 110 | BYTE wcfgDetectTrick; 111 | BYTE wcfgDisableRepairCost; 112 | BYTE wcfgAllowQuests; 113 | BYTE wcfgEnableWE; 114 | BYTE wcfgEnableLevelCmd; 115 | BYTE wcfgClassicWW; 116 | BYTE wcfgAllowPierceBreakImmunites; 117 | 118 | string wcfgDatabase; 119 | string wcfgDBUser; 120 | string wcfgDBPass; 121 | string wcfgConfigFile; 122 | string wcfgUpdateURL; 123 | string wcfgGSName; 124 | INIReader wcfgClans; 125 | bool clansAvailable; 126 | list wcfgAdmins; 127 | BYTE wcfgTeleChars[7]; 128 | 129 | // keeps the highest dmg amount 130 | int DmgRekord; 131 | 132 | map> threadMap; 133 | 134 | unsigned char AE_Packet00[40]; 135 | 136 | // World Event related 137 | int SellCount; 138 | int NextDC; 139 | int MinSell; 140 | int MaxSell; 141 | int InfoDelay; 142 | WEItem WItem; 143 | 144 | private: 145 | 146 | void patchD2(); 147 | 148 | char* getStatusMessage(WardenStatus status); 149 | 150 | boost::mt19937 rng; 151 | boost::uniform_int dist; 152 | boost::variate_generator> random; 153 | bool init_succed; 154 | DWORD uptime; 155 | bool enabled; 156 | 157 | DWORD moduleLength; 158 | BYTE *moduleEncrypted; 159 | 160 | list clients; 161 | 162 | Warden(const Warden&) = delete; 163 | Warden& operator=(const Warden&) = delete; 164 | }; 165 | 166 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/WardenChecks.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2014 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | // -- Warden checks 21 | 22 | #ifndef __WARDENCHECKS_H__ 23 | #define __WARDENCHECKS_H__ 24 | 25 | #ifdef VER_111B 26 | 27 | #define D2CLIENT_MOUSEXY 0x11B414 28 | #define D2CLIENT_UIVAR 0x1040C0 29 | #define BNCLIENT_REDVEX 0x1D330 30 | #define D2CLIENT_TMC 0x341404 31 | #define D2CLIENT_STING 0x521D1 32 | #define D2CLIENT_WTFPK 0x66DC5 33 | #define D2CLIENT_ONPACKETRCV 0xBDFB1 34 | #define D2COMMON_SKILLSTXT 0xA1328 35 | #define D2CLIENT_GAMELOOP 0x32B40 36 | 37 | #elif defined VER_113D 38 | 39 | #define D2CLIENT_MOUSEXY 0x11C94C 40 | #define D2CLIENT_UIVAR 0x11C890 41 | #define BNCLIENT_REDVEX 0x1EEF8 42 | #define D2CLIENT_TMC 0 43 | #define D2CLIENT_STING 0 44 | #define D2CLIENT_WTFPK 0 45 | #define D2CLIENT_ONPACKETRCV 0 46 | #define D2COMMON_SKILLSTXT 0 47 | #define D2CLIENT_GAMELOOP 0 48 | 49 | #endif 50 | 51 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/WardenClient.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://bitbucket.org/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2008 marsgod 6 | * 2011-2015 Bartosz Jankowski 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #include "stdafx.h" 22 | #include "WardenClient.h" 23 | #include "LSpectator.h" 24 | #include "RC4.h" 25 | 26 | 27 | extern "C" void __fastcall HashGameSeed(unsigned char *pt_0XAE_RC4_KEY, unsigned char *pt_0X66_RC4_KEY, unsigned char * TheGameSeed, unsigned int TheLength); 28 | extern "C" void __fastcall Double_MD5(DWORD *Mod_Length, DWORD unk, unsigned char *ptResult); 29 | 30 | WardenClient::WardenClient(DWORD ClientId, DWORD sessionKey) 31 | { 32 | DEBUGMSG("Creating a WardenClient: %d", ClientId) 33 | ClientID = ClientId; 34 | 35 | unsigned char temp0x66[16], temp0xAE[16]; 36 | 37 | *(DWORD*)&SessionKey = sessionKey; 38 | 39 | HashGameSeed(temp0xAE, temp0x66, SessionKey, 4); 40 | rc4_setup(RC4_KEY_0XAE, temp0xAE, 16); 41 | rc4_setup(RC4_KEY_0X66, temp0x66, 16); 42 | 43 | 44 | ErrorCount = 0; 45 | ptPlayer = 0; 46 | 47 | ptGame = 0; 48 | ptClientData = 0; 49 | 50 | ClientLogonTime = 0; 51 | NextCheckTime = GetTickCount() + 10000; 52 | 53 | WardenStatus = WARDEN_START; 54 | CheckCounter = 0; 55 | LocaleId = 0; 56 | NewPatch = 0; 57 | DebugTrick = 0; 58 | 59 | wardenPacket = { 0 }; 60 | 61 | MOD_Position = 0; 62 | 63 | 64 | MouseXPosition = -1; 65 | MouseYPosition = -1; 66 | 67 | memset(UIModes, 0, 16); 68 | UIModesTime = 0; 69 | 70 | AnimData = 0; 71 | AnimData2 = 0; 72 | 73 | ptSkillsTxt = 0; 74 | 75 | TMCDetected = 0; 76 | StingDetected = 0; 77 | WtfDetected = 0; 78 | RCVDetected = 0; 79 | GMDetected = 0; 80 | LPDetected = 0; 81 | WardenBlocked = 0; 82 | RedVexDetected = 0; 83 | DupeDetected = 0; 84 | 85 | VerCode = 0; 86 | bNeedUpdate = false; 87 | ready = false; 88 | } 89 | 90 | void WardenClient::setup(Game* pGame, ClientData* pClient) 91 | { 92 | ASSERT(pGame); 93 | ASSERT(pClient); 94 | 95 | ClientID = pClient->ClientID; 96 | 97 | ClientLogonTime = GetTickCount(); 98 | NextCheckTime = ClientLogonTime + 500; 99 | AccountName = pClient->AccountName; 100 | CharName = pClient->CharName; 101 | ptClientData = pClient; 102 | ptGame = pGame; 103 | ptPlayer = pClient->pPlayerUnit; 104 | UnitID = ptPlayer->dwUnitId; 105 | ready = true; 106 | 107 | DEBUGMSG("Setup finished for %s!", pClient->CharName); 108 | } 109 | 110 | void WardenClient::removePacket() 111 | { 112 | wardenPacket.PacketLen = 0; 113 | wardenPacket.ReceiveTime = 0; 114 | wardenPacket.ClientID = 0; 115 | memset(wardenPacket.ThePacket, 0, 512); 116 | } 117 | 118 | 119 | void WardenClient::request(char* DllName1, DWORD Addr, char* DllName2, DWORD Addr2) 120 | { 121 | //BYTE Pack[] = {0x02,0x0C,'D','2','C','l','i','e','n','t','.','d','l','l',0x0c,'D','2','C','l','i','e','n','t','.','d','l','l',0x00,0xec,0x01,0xFF,0xFF,0xFF,0xFF,0x04,0xec,0x02,0xFF,0xFF,0xFF,0xFF,0x04,0xd9}; 122 | unsigned char WardenCMD2_local[100] = { 0 }; 123 | //DEBUGMSG("Sending Warden request...") 124 | BYTE s1 = strlen(DllName1); 125 | BYTE s2 = strlen(DllName2); 126 | WORD PacketSize = s1 + s2 + 19; 127 | BYTE * Packet = new BYTE[PacketSize]; 128 | Packet[0] = 0x02; 129 | Packet[1] = s1; 130 | memcpy(&Packet[2], DllName1, s1); 131 | Packet[2 + s1] = s2; 132 | memcpy(&Packet[3 + s1], DllName2, s2); 133 | 134 | Packet[3 + s1 + s2] = 0x00; 135 | Packet[4 + s1 + s2] = 0xEC; 136 | Packet[5 + s1 + s2] = 0x01; 137 | *(DWORD*)&Packet[6 + s1 + s2] = Addr; 138 | Packet[10 + s1 + s2] = 0x04; 139 | Packet[11 + s1 + s2] = 0xEC; 140 | Packet[12 + s1 + s2] = 0x02; 141 | *(DWORD*)&Packet[13 + s1 + s2] = Addr2; 142 | Packet[17 + s1 + s2] = 0x04; 143 | Packet[18 + s1 + s2] = 0xD9; 144 | WardenCMD2_local[0] = 0xAE; 145 | *(WORD*)&WardenCMD2_local[1] = PacketSize; 146 | memcpy(&WardenCMD2_local[3], Packet, PacketSize); 147 | rc4_crypt(RC4_KEY_0XAE, &WardenCMD2_local[3], PacketSize); 148 | D2Funcs.D2NET_SendPacket(0, ClientID, WardenCMD2_local, PacketSize + 3); 149 | 150 | delete[] Packet; 151 | } 152 | 153 | 154 | void WardenClient::request(char* DllName1, DWORD Addr, BYTE nBytes1, char* DllName2, DWORD Addr2, BYTE nBytes2) 155 | { 156 | //BYTE Pack[] = {0x02,0x0C,'D','2','C','l','i','e','n','t','.','d','l','l',0x0c,'D','2','C','l','i','e','n','t','.','d','l','l',0x00,0xec,0x01,0xFF,0xFF,0xFF,0xFF,0x04,0xec,0x02,0xFF,0xFF,0xFF,0xFF,0x04,0xd9}; 157 | unsigned char WardenCMD2_local[100] = { 0 }; 158 | //DEBUGMSG("Sending Warden request...") 159 | BYTE s1 = strlen(DllName1); 160 | BYTE s2 = strlen(DllName2); 161 | WORD PacketSize = s1 + s2 + 19; 162 | BYTE * Packet = new BYTE[PacketSize]; 163 | Packet[0] = 0x02; 164 | Packet[1] = s1; 165 | memcpy(&Packet[2], DllName1, s1); 166 | Packet[2 + s1] = s2; 167 | memcpy(&Packet[3 + s1], DllName2, s2); 168 | 169 | Packet[3 + s1 + s2] = 0x00; 170 | Packet[4 + s1 + s2] = 0xEC; 171 | Packet[5 + s1 + s2] = 0x01; 172 | *(DWORD*)&Packet[6 + s1 + s2] = Addr; 173 | Packet[10 + s1 + s2] = nBytes1; 174 | Packet[11 + s1 + s2] = 0xEC; 175 | Packet[12 + s1 + s2] = 0x02; 176 | *(DWORD*)&Packet[13 + s1 + s2] = Addr2; 177 | Packet[17 + s1 + s2] = nBytes2; 178 | Packet[18 + s1 + s2] = 0xD9; 179 | WardenCMD2_local[0] = 0xAE; 180 | *(WORD*)&WardenCMD2_local[1] = PacketSize; 181 | memcpy(&WardenCMD2_local[3], Packet, PacketSize); 182 | rc4_crypt(RC4_KEY_0XAE, &WardenCMD2_local[3], PacketSize); 183 | D2Funcs.D2NET_SendPacket(0, ClientID, WardenCMD2_local, PacketSize + 3); 184 | 185 | delete[] Packet; 186 | } 187 | 188 | 189 | void WardenClient::request(char* DllName1, DWORD Addr, BYTE Bytes) 190 | { 191 | //DEBUGMSG("Sending Warden request...") 192 | unsigned char WardenCMD2_local[100] = { 0 }; 193 | //02 0c 62 6E 63 6C 69 65 6E 74 2E 64 6C 6C 00 ec 01 30 D3 01 00 04 d9 194 | BYTE s1 = strlen(DllName1); 195 | WORD PacketSize = s1 + 11; 196 | BYTE * Packet = new BYTE[PacketSize]; 197 | Packet[0] = 0x02; 198 | Packet[1] = s1; 199 | memcpy(&Packet[2], DllName1, s1); 200 | 201 | Packet[2 + s1] = 0x00; 202 | Packet[3 + s1] = 0xEC; 203 | Packet[4 + s1] = 0x01; 204 | *(DWORD*)&Packet[5 + s1] = Addr; 205 | Packet[9 + s1] = Bytes; 206 | Packet[10 + s1] = 0xD9; 207 | WardenCMD2_local[0] = 0xAE; 208 | *(WORD*)&WardenCMD2_local[1] = PacketSize; 209 | memcpy(&WardenCMD2_local[3], Packet, PacketSize); 210 | rc4_crypt(RC4_KEY_0XAE, &WardenCMD2_local[3], PacketSize); 211 | D2Funcs.D2NET_SendPacket(0, ClientID, WardenCMD2_local, PacketSize + 3); 212 | 213 | delete[] Packet; 214 | } 215 | 216 | void WardenClient::request(DWORD Addr, BYTE Bytes) 217 | { 218 | unsigned char WardenCMD2_local[100] = { 0 }; 219 | WORD PacketSize = 10; 220 | BYTE Packet[10]; 221 | Packet[0] = 0x02; 222 | Packet[1] = 0x00; 223 | Packet[2] = 0xEC; 224 | Packet[3] = 0x00; 225 | *(DWORD*)&Packet[4] = Addr; 226 | Packet[8] = Bytes; 227 | Packet[9] = 0xD9; 228 | WardenCMD2_local[0] = 0xAE; 229 | *(WORD*)&WardenCMD2_local[1] = PacketSize; 230 | memcpy(&WardenCMD2_local[3], Packet, PacketSize); 231 | rc4_crypt(RC4_KEY_0XAE, &WardenCMD2_local[3], PacketSize); 232 | D2Funcs.D2NET_SendPacket(0, ClientID, WardenCMD2_local, PacketSize + 3); 233 | } 234 | 235 | WardenClient::~WardenClient() 236 | { 237 | DEBUGMSG("Removing a WardenClient") 238 | removePacket(); 239 | 240 | if (ready) // Remove to prevent crash, dunno why i put check there for a player status 241 | { 242 | DEBUGMSG("Removing quitter (0x%x) from spec tree", UnitID) 243 | SPECTATOR_RemoveFromQueue(ptGame, UnitID); 244 | } 245 | } -------------------------------------------------------------------------------- /d2warden-pvp/WardenClient.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://bitbucket.org/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2008 marsgod 6 | * 2011-2015 Bartosz Jankowski 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef __WARDENCLIENT_H__ 22 | #define __WARDENCLIENT_H__ 23 | 24 | #include 25 | #include 26 | #include "CommonStructs.h" 27 | #include "Windows.h" 28 | #include 29 | 30 | enum WardenStatus; 31 | 32 | struct WardenPacket 33 | { 34 | //#ifdef _DEBUG 35 | DWORD SendTime; 36 | DWORD ReceiveTime; 37 | //#endif 38 | DWORD ClientID; 39 | DWORD PacketLen; 40 | BYTE ThePacket[512]; 41 | }; 42 | 43 | class WardenClient 44 | { 45 | public: 46 | WardenClient(DWORD ClientId, DWORD sessionKey); 47 | WardenClient& operator=(const WardenClient&) = default; 48 | WardenClient(const WardenClient&) = default; 49 | ~WardenClient(); 50 | void setup(Game* pGame, ClientData* pClient); 51 | void removePacket(); 52 | 53 | //Memory request funcs 54 | void request(char* DllName1, DWORD Addr, char* DllName2, DWORD Addr2); 55 | void request(char* DllName1, DWORD Addr, BYTE nBytes1, char* DllName2, DWORD Addr2, BYTE nBytes2); 56 | void request(char* DllName1, DWORD Addr, BYTE Bytes); 57 | void request(DWORD Addr, BYTE Bytes); 58 | 59 | DWORD ClientID; 60 | DWORD UnitID; 61 | 62 | UnitAny* ptPlayer; 63 | Game* ptGame; 64 | ClientData* ptClientData; 65 | 66 | unsigned char SessionKey[16]; 67 | 68 | std::string CharName; 69 | std::string AccountName; 70 | std::string MyIp; 71 | 72 | DWORD ClientLogonTime; 73 | DWORD NextCheckTime; 74 | 75 | WardenStatus WardenStatus; 76 | DWORD ErrorCount; 77 | BYTE CheckCounter; 78 | BYTE LocaleId; 79 | BYTE NewPatch; 80 | BYTE DebugTrick; 81 | 82 | WardenPacket wardenPacket; 83 | DWORD MOD_Position; 84 | 85 | unsigned char RC4_KEY_0X66[258]; 86 | unsigned char RC4_KEY_0XAE[258]; 87 | 88 | signed short MouseXPosition; 89 | signed short MouseYPosition; 90 | 91 | DWORD UIModes[16]; 92 | DWORD UIModesTime; 93 | 94 | DWORD AnimData; 95 | DWORD AnimData2; 96 | 97 | DWORD ptSkillsTxt; 98 | 99 | BYTE TMCDetected; 100 | BYTE StingDetected; 101 | BYTE WtfDetected; 102 | BYTE RCVDetected; 103 | BYTE GMDetected; 104 | BYTE LPDetected; 105 | BYTE WardenBlocked; 106 | BYTE RedVexDetected; 107 | BYTE DupeDetected; 108 | 109 | BYTE VerCode; 110 | bool bNeedUpdate; 111 | bool ready; 112 | 113 | private: 114 | WardenClient() = delete; 115 | }; 116 | 117 | typedef std::list::iterator WardenClient_i; 118 | 119 | #endif -------------------------------------------------------------------------------- /d2warden-pvp/WardenInit.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | 22 | #define __DEFINE_EXPTRS 23 | #ifdef VER_113D 24 | #include "ExPointers_113D.h" 25 | #else 26 | #include "ExPointers_111B.h" 27 | #endif 28 | 29 | #include "LWorldEvent.h" 30 | 31 | BOOL __stdcall WardenPreInit() 32 | { 33 | SetupD2Vars(); 34 | SetupD2Pointers(); 35 | SetupD2Funcs(); 36 | 37 | 38 | if (!Warden::getInstance().isInited()) 39 | { 40 | Log("Error during initialization. Stopping..."); 41 | return FALSE; 42 | } 43 | 44 | if (!Warden::getInstance().NextDC) 45 | WE_GenerateNextDC(); 46 | 47 | Log("Warden initialized successfully."); 48 | 49 | return TRUE; 50 | } 51 | 52 | 53 | DWORD WINAPI DllMain(HMODULE hModule, int dwReason, void* lpReserved) 54 | { 55 | switch (dwReason) 56 | { 57 | case DLL_PROCESS_ATTACH: 58 | { 59 | 60 | if(!WardenPreInit()) 61 | { 62 | Log("Failed to init the Warden :("); 63 | return FALSE; 64 | } 65 | 66 | } 67 | break; 68 | case DLL_PROCESS_DETACH: 69 | { 70 | Log("Server shutting down"); 71 | } 72 | break; 73 | } 74 | return TRUE; 75 | } -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.def: -------------------------------------------------------------------------------- 1 | LIBRARY d2warden 2 | EXPORTS 3 | -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2warden", "d2warden.vcxproj", "{6BA6C55D-299E-439C-ACCA-0FBC3927D690}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug without service start|Win32 = Debug without service start|Win32 11 | Debug|Win32 = Debug|Win32 12 | Release|Win32 = Release|Win32 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Debug without service start|Win32.ActiveCfg = Debug without service start|Win32 16 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Debug without service start|Win32.Build.0 = Debug without service start|Win32 17 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Debug|Win32.Build.0 = Debug|Win32 19 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Release|Win32.ActiveCfg = Release|Win32 20 | {6BA6C55D-299E-439C-ACCA-0FBC3927D690}.Release|Win32.Build.0 = Release|Win32 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/d2warden.suo -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/d2warden.txt -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/d2warden-pvp/d2warden.v11.suo -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 27 | 30 | 33 | 36 | 39 | 42 | 55 | 58 | 61 | 64 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 99 | 100 | 109 | 112 | 115 | 118 | 121 | 124 | 148 | 151 | 154 | 157 | 176 | 179 | 182 | 185 | 188 | 191 | 194 | 198 | 199 | 200 | 201 | 202 | 203 | 208 | 211 | 212 | 215 | 216 | 219 | 220 | 223 | 224 | 227 | 228 | 231 | 234 | 240 | 241 | 244 | 250 | 251 | 252 | 255 | 256 | 259 | 260 | 263 | 264 | 267 | 268 | 271 | 272 | 275 | 276 | 279 | 280 | 283 | 284 | 287 | 288 | 289 | 294 | 297 | 298 | 301 | 302 | 305 | 306 | 309 | 310 | 313 | 314 | 317 | 318 | 321 | 322 | 325 | 326 | 329 | 330 | 333 | 334 | 337 | 338 | 341 | 342 | 345 | 346 | 349 | 350 | 353 | 354 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.vcproj.BARTEK.1337.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {91308a65-7f47-49ad-95f9-5ecb52b0e5e0} 14 | 15 | 16 | {c0c82f45-ce46-44e4-af32-1dc38d8ac574} 17 | 18 | 19 | {0a05c524-2c3c-47b9-8538-efe7c9a9c06a} 20 | 21 | 22 | {4b3a83e3-de42-40c0-b448-624e68f3cf2d} 23 | 24 | 25 | {67b27390-9bd7-441c-a841-d4d5731d843f} 26 | 27 | 28 | {d1fddb50-99c3-49bd-a71a-3fa65463718a} 29 | 30 | 31 | {09fd842c-4c3a-4f27-ada6-1350d26f2a4f} 32 | 33 | 34 | {f9933e56-ab82-46ef-830c-e4b0674d4682} 35 | 36 | 37 | {45f963ff-b898-4159-8b51-8c0da251d11c} 38 | 39 | 40 | {4c71baf8-1eda-40fc-81f2-8044c323f9a3} 41 | 42 | 43 | {60e0b5f4-5626-41af-a103-2815e56ca6c9} 44 | 45 | 46 | {390447ff-de8e-430e-8ef5-4caf7c2f0111} 47 | 48 | 49 | {40f43865-6e13-46a9-a788-892a33610804} 50 | 51 | 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files\ModuLes 61 | 62 | 63 | Source Files\ModuLes 64 | 65 | 66 | Source Files\ModuLes 67 | 68 | 69 | Source Files\ModuLes 70 | 71 | 72 | Source Files\ModuLes 73 | 74 | 75 | Source Files\ModuLes 76 | 77 | 78 | Source Files\EngineFixes 79 | 80 | 81 | Source Files\EngineFixes 82 | 83 | 84 | Source Files\Misc 85 | 86 | 87 | Source Files\Misc 88 | 89 | 90 | Source Files\Misc 91 | 92 | 93 | Source Files\ModuLes 94 | 95 | 96 | Source Files 97 | 98 | 99 | Source Files 100 | 101 | 102 | Source Files\Misc 103 | 104 | 105 | Source Files\ModuLes 106 | 107 | 108 | Source Files\ModuLes 109 | 110 | 111 | Source Files\ModuLes 112 | 113 | 114 | Source Files\ModuLes 115 | 116 | 117 | Source Files 118 | 119 | 120 | Source Files 121 | 122 | 123 | Source Files 124 | 125 | 126 | Source Files 127 | 128 | 129 | Source Files\ModuLes 130 | 131 | 132 | Source Files\Server 133 | 134 | 135 | _LIBS\inih 136 | 137 | 138 | _LIBS\inih 139 | 140 | 141 | Source Files\ModuLes 142 | 143 | 144 | 145 | 146 | Header Files 147 | 148 | 149 | Header Files 150 | 151 | 152 | Header Files 153 | 154 | 155 | _BUILD 156 | 157 | 158 | Header Files 159 | 160 | 161 | Header Files\ModuLes 162 | 163 | 164 | Header Files\ModuLes 165 | 166 | 167 | Header Files\ModuLes 168 | 169 | 170 | Header Files\ModuLes 171 | 172 | 173 | Header Files\ModuLes 174 | 175 | 176 | Header Files\ModuLes 177 | 178 | 179 | Header Files\EngineFixes 180 | 181 | 182 | Header Files\EngineFixes 183 | 184 | 185 | Header Files\Misc 186 | 187 | 188 | Header Files\Misc 189 | 190 | 191 | Header Files\Misc 192 | 193 | 194 | Header Files\Misc 195 | 196 | 197 | Header Files\Misc 198 | 199 | 200 | Header Files\ModuLes 201 | 202 | 203 | Header Files 204 | 205 | 206 | Header Files 207 | 208 | 209 | Header Files\Misc 210 | 211 | 212 | Header Files 213 | 214 | 215 | Header Files\1.11b 216 | 217 | 218 | Header Files\1.11b 219 | 220 | 221 | Header Files\1.13d 222 | 223 | 224 | Header Files\1.13d 225 | 226 | 227 | Header Files\1.13d 228 | 229 | 230 | Header Files\1.11b 231 | 232 | 233 | Header Files 234 | 235 | 236 | Header Files\ModuLes 237 | 238 | 239 | Header Files\ModuLes 240 | 241 | 242 | Header Files\ModuLes 243 | 244 | 245 | Header Files\ModuLes 246 | 247 | 248 | Header Files 249 | 250 | 251 | Header Files 252 | 253 | 254 | Header Files 255 | 256 | 257 | Header Files 258 | 259 | 260 | Header Files\Server 261 | 262 | 263 | _LIBS\inih 264 | 265 | 266 | _LIBS\inih 267 | 268 | 269 | Header Files\ModuLes 270 | 271 | 272 | 273 | 274 | Source Files 275 | 276 | 277 | 278 | 279 | _BUILD 280 | 281 | 282 | -------------------------------------------------------------------------------- /d2warden-pvp/d2warden.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | D:\Inne\D2 Stuff\D2GS\D2GS.exe 5 | 6 | 7 | D:\Inne\D2 Stuff\D2GS\D2GS.exe 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | D:\Inne\D2 Stuff\D2GS\ 18 | 19 | 20 | D:\Inne\D2 Stuff\D2GS\ 21 | 22 | 23 | false 24 | WindowsLocalDebugger 25 | NativeOnly 26 | 27 | 28 | true 29 | WindowsLocalDebugger 30 | 31 | 32 | D:\Inne\D2 Stuff\D2GS\D2GS.exe 33 | D:\Inne\D2 Stuff\D2GS\ 34 | true 35 | WindowsLocalDebugger 36 | 37 | 38 | false 39 | 40 | -------------------------------------------------------------------------------- /d2warden-pvp/global.h: -------------------------------------------------------------------------------- 1 | /* GLOBAL.H - RSAREF types and constants 2 | 3 | /* Copyright (C) RSA Laboratories, a division of RSA Data Security, 4 | Inc., created 1991. All rights reserved. 5 | */ 6 | 7 | #ifndef _GLOBAL_H_ 8 | #define _GLOBAL_H_ 1 9 | 10 | /* PROTOTYPES should be set to one if and only if the compiler supports 11 | function argument prototyping. 12 | The following makes PROTOTYPES default to 1 if it has not already been 13 | defined as 0 with C compiler flags. 14 | */ 15 | #ifndef PROTOTYPES 16 | #define PROTOTYPES 1 17 | #endif 18 | 19 | /* POINTER defines a generic pointer type */ 20 | typedef unsigned char *POINTER; 21 | 22 | /* UINT2 defines a two byte word */ 23 | typedef unsigned short int UINT2; 24 | 25 | /* UINT4 defines a four byte word */ 26 | typedef unsigned long int UINT4; 27 | 28 | #ifndef NULL_PTR 29 | #define NULL_PTR ((POINTER)0) 30 | #endif 31 | 32 | #ifndef UNUSED_ARG 33 | #define UNUSED_ARG(x) x = *(&x); 34 | #endif 35 | 36 | /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. 37 | If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it 38 | returns an empty list. 39 | */ 40 | #if PROTOTYPES 41 | #define PROTO_LIST(list) list 42 | #else 43 | #define PROTO_LIST(list) () 44 | #endif 45 | 46 | #endif /* end _GLOBAL_H_ */ 47 | -------------------------------------------------------------------------------- /d2warden-pvp/inih/cpp/INIReader.cpp: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 4 | // Go to the project home page for more info: 5 | // 6 | // https://github.com/benhoyt/inih 7 | 8 | #include 9 | #include 10 | #include 11 | #include "..\ini.h" 12 | #include "INIReader.h" 13 | 14 | using std::string; 15 | 16 | INIReader::INIReader(string filename) 17 | { 18 | _error = ini_parse(filename.c_str(), ValueHandler, this); 19 | } 20 | 21 | int INIReader::ParseError() 22 | { 23 | return _error; 24 | } 25 | 26 | string INIReader::Get(string section, string name, string default_value) 27 | { 28 | string key = MakeKey(section, name); 29 | return _values.count(key) ? _values[key] : default_value; 30 | } 31 | 32 | long INIReader::GetInteger(string section, string name, long default_value) 33 | { 34 | string valstr = Get(section, name, ""); 35 | const char* value = valstr.c_str(); 36 | char* end; 37 | // This parses "1234" (decimal) and also "0x4D2" (hex) 38 | long n = strtol(value, &end, 0); 39 | return end > value ? n : default_value; 40 | } 41 | 42 | double INIReader::GetReal(string section, string name, double default_value) 43 | { 44 | string valstr = Get(section, name, ""); 45 | const char* value = valstr.c_str(); 46 | char* end; 47 | double n = strtod(value, &end); 48 | return end > value ? n : default_value; 49 | } 50 | 51 | bool INIReader::GetBoolean(string section, string name, bool default_value) 52 | { 53 | string valstr = Get(section, name, ""); 54 | // Convert to lower case to make string comparisons case-insensitive 55 | std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower); 56 | if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1") 57 | return true; 58 | else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0") 59 | return false; 60 | else 61 | return default_value; 62 | } 63 | 64 | string INIReader::MakeKey(string section, string name) 65 | { 66 | string key = section + "=" + name; 67 | // Convert to lower case to make section/name lookups case-insensitive 68 | std::transform(key.begin(), key.end(), key.begin(), ::tolower); 69 | return key; 70 | } 71 | 72 | int INIReader::ValueHandler(void* user, const char* section, const char* name, 73 | const char* value) 74 | { 75 | INIReader* reader = (INIReader*)user; 76 | string key = MakeKey(section, name); 77 | if (reader->_values[key].size() > 0) 78 | reader->_values[key] += "\n"; 79 | reader->_values[key] += value; 80 | return 1; 81 | } 82 | -------------------------------------------------------------------------------- /d2warden-pvp/inih/cpp/INIReader.h: -------------------------------------------------------------------------------- 1 | // Read an INI file into easy-to-access name/value pairs. 2 | 3 | // inih and INIReader are released under the New BSD license (see LICENSE.txt). 4 | // Go to the project home page for more info: 5 | // 6 | // https://github.com/benhoyt/inih 7 | 8 | #ifndef __INIREADER_H__ 9 | #define __INIREADER_H__ 10 | 11 | #include 12 | #include 13 | 14 | // Read an INI file into easy-to-access name/value pairs. (Note that I've gone 15 | // for simplicity here rather than speed, but it should be pretty decent.) 16 | class INIReader 17 | { 18 | public: 19 | // Construct INIReader and parse given filename. See ini.h for more info 20 | // about the parsing. 21 | INIReader(std::string filename); 22 | 23 | // Return the result of ini_parse(), i.e., 0 on success, line number of 24 | // first error on parse error, or -1 on file open error. 25 | int ParseError(); 26 | 27 | // Get a string value from INI file, returning default_value if not found. 28 | std::string Get(std::string section, std::string name, 29 | std::string default_value); 30 | 31 | // Get an integer (long) value from INI file, returning default_value if 32 | // not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). 33 | long GetInteger(std::string section, std::string name, long default_value); 34 | 35 | // Get a real (floating point double) value from INI file, returning 36 | // default_value if not found or not a valid floating point value 37 | // according to strtod(). 38 | double GetReal(std::string section, std::string name, double default_value); 39 | 40 | // Get a boolean value from INI file, returning default_value if not found or if 41 | // not a valid true/false value. Valid true values are "true", "yes", "on", "1", 42 | // and valid false values are "false", "no", "off", "0" (not case sensitive). 43 | bool GetBoolean(std::string section, std::string name, bool default_value); 44 | 45 | private: 46 | int _error; 47 | std::map _values; 48 | static std::string MakeKey(std::string section, std::string name); 49 | static int ValueHandler(void* user, const char* section, const char* name, 50 | const char* value); 51 | }; 52 | 53 | #endif // __INIREADER_H__ 54 | -------------------------------------------------------------------------------- /d2warden-pvp/inih/ini.c: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 4 | home page for more info: 5 | 6 | https://github.com/benhoyt/inih 7 | 8 | */ 9 | 10 | #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) 11 | #define _CRT_SECURE_NO_WARNINGS 12 | #endif 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include "ini.h" 19 | 20 | #if !INI_USE_STACK 21 | #include 22 | #endif 23 | 24 | #define MAX_SECTION 50 25 | #define MAX_NAME 50 26 | 27 | /* Strip whitespace chars off end of given string, in place. Return s. */ 28 | static char* rstrip(char* s) 29 | { 30 | char* p = s + strlen(s); 31 | while (p > s && isspace((unsigned char)(*--p))) 32 | *p = '\0'; 33 | return s; 34 | } 35 | 36 | /* Return pointer to first non-whitespace char in given string. */ 37 | static char* lskip(const char* s) 38 | { 39 | while (*s && isspace((unsigned char)(*s))) 40 | s++; 41 | return (char*)s; 42 | } 43 | 44 | /* Return pointer to first char (of chars) or inline comment in given string, 45 | or pointer to null at end of string if neither found. Inline comment must 46 | be prefixed by a whitespace character to register as a comment. */ 47 | static char* find_chars_or_comment(const char* s, const char* chars) 48 | { 49 | #if INI_ALLOW_INLINE_COMMENTS 50 | int was_space = 0; 51 | while (*s && (!chars || !strchr(chars, *s)) && 52 | !(was_space && strchr(INI_INLINE_COMMENT_PREFIXES, *s))) { 53 | was_space = isspace((unsigned char)(*s)); 54 | s++; 55 | } 56 | #else 57 | while (*s && (!chars || !strchr(chars, *s))) { 58 | s++; 59 | } 60 | #endif 61 | return (char*)s; 62 | } 63 | 64 | /* Version of strncpy that ensures dest (size bytes) is null-terminated. */ 65 | static char* strncpy0(char* dest, const char* src, size_t size) 66 | { 67 | strncpy(dest, src, size); 68 | dest[size - 1] = '\0'; 69 | return dest; 70 | } 71 | 72 | /* See documentation in header file. */ 73 | int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 74 | void* user) 75 | { 76 | /* Uses a fair bit of stack (use heap instead if you need to) */ 77 | #if INI_USE_STACK 78 | char line[INI_MAX_LINE]; 79 | #else 80 | char* line; 81 | #endif 82 | char section[MAX_SECTION] = ""; 83 | char prev_name[MAX_NAME] = ""; 84 | 85 | char* start; 86 | char* end; 87 | char* name; 88 | char* value; 89 | int lineno = 0; 90 | int error = 0; 91 | 92 | #if !INI_USE_STACK 93 | line = (char*)malloc(INI_MAX_LINE); 94 | if (!line) { 95 | return -2; 96 | } 97 | #endif 98 | 99 | /* Scan through stream line by line */ 100 | while (reader(line, INI_MAX_LINE, stream) != NULL) { 101 | lineno++; 102 | 103 | start = line; 104 | #if INI_ALLOW_BOM 105 | if (lineno == 1 && (unsigned char)start[0] == 0xEF && 106 | (unsigned char)start[1] == 0xBB && 107 | (unsigned char)start[2] == 0xBF) { 108 | start += 3; 109 | } 110 | #endif 111 | start = lskip(rstrip(start)); 112 | 113 | if (*start == ';' || *start == '#') { 114 | /* Per Python configparser, allow both ; and # comments at the 115 | start of a line */ 116 | } 117 | #if INI_ALLOW_MULTILINE 118 | else if (*prev_name && *start && start > line) { 119 | /* Non-blank line with leading whitespace, treat as continuation 120 | of previous name's value (as per Python configparser). */ 121 | if (!handler(user, section, prev_name, start) && !error) 122 | error = lineno; 123 | } 124 | #endif 125 | else if (*start == '[') { 126 | /* A "[section]" line */ 127 | end = find_chars_or_comment(start + 1, "]"); 128 | if (*end == ']') { 129 | *end = '\0'; 130 | strncpy0(section, start + 1, sizeof(section)); 131 | *prev_name = '\0'; 132 | } 133 | else if (!error) { 134 | /* No ']' found on section line */ 135 | error = lineno; 136 | } 137 | } 138 | else if (*start) { 139 | /* Not a comment, must be a name[=:]value pair */ 140 | end = find_chars_or_comment(start, "=:"); 141 | if (*end == '=' || *end == ':') { 142 | *end = '\0'; 143 | name = rstrip(start); 144 | value = lskip(end + 1); 145 | #if INI_ALLOW_INLINE_COMMENTS 146 | end = find_chars_or_comment(value, NULL); 147 | if (*end) 148 | *end = '\0'; 149 | #endif 150 | rstrip(value); 151 | 152 | /* Valid name[=:]value pair found, call handler */ 153 | strncpy0(prev_name, name, sizeof(prev_name)); 154 | if (!handler(user, section, name, value) && !error) 155 | error = lineno; 156 | } 157 | else if (!error) { 158 | /* No '=' or ':' found on name[=:]value line */ 159 | error = lineno; 160 | } 161 | } 162 | 163 | #if INI_STOP_ON_FIRST_ERROR 164 | if (error) 165 | break; 166 | #endif 167 | } 168 | 169 | #if !INI_USE_STACK 170 | free(line); 171 | #endif 172 | 173 | return error; 174 | } 175 | 176 | /* See documentation in header file. */ 177 | int ini_parse_file(FILE* file, ini_handler handler, void* user) 178 | { 179 | return ini_parse_stream((ini_reader)fgets, file, handler, user); 180 | } 181 | 182 | /* See documentation in header file. */ 183 | int ini_parse(const char* filename, ini_handler handler, void* user) 184 | { 185 | FILE* file; 186 | int error; 187 | 188 | file = fopen(filename, "r"); 189 | if (!file) 190 | return -1; 191 | error = ini_parse_file(file, handler, user); 192 | fclose(file); 193 | return error; 194 | } 195 | -------------------------------------------------------------------------------- /d2warden-pvp/inih/ini.h: -------------------------------------------------------------------------------- 1 | /* inih -- simple .INI file parser 2 | 3 | inih is released under the New BSD license (see LICENSE.txt). Go to the project 4 | home page for more info: 5 | 6 | https://github.com/benhoyt/inih 7 | 8 | */ 9 | 10 | #ifndef __INI_H__ 11 | #define __INI_H__ 12 | 13 | /* Make this header file easier to include in C++ code */ 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #include 19 | 20 | /* Typedef for prototype of handler function. */ 21 | typedef int (*ini_handler)(void* user, const char* section, 22 | const char* name, const char* value); 23 | 24 | /* Typedef for prototype of fgets-style reader function. */ 25 | typedef char* (*ini_reader)(char* str, int num, void* stream); 26 | 27 | /* Parse given INI-style file. May have [section]s, name=value pairs 28 | (whitespace stripped), and comments starting with ';' (semicolon). Section 29 | is "" if name=value pair parsed before any section heading. name:value 30 | pairs are also supported as a concession to Python's configparser. 31 | 32 | For each name=value pair parsed, call handler function with given user 33 | pointer as well as section, name, and value (data only valid for duration 34 | of handler call). Handler should return nonzero on success, zero on error. 35 | 36 | Returns 0 on success, line number of first error on parse error (doesn't 37 | stop on first error), -1 on file open error, or -2 on memory allocation 38 | error (only when INI_USE_STACK is zero). 39 | */ 40 | int ini_parse(const char* filename, ini_handler handler, void* user); 41 | 42 | /* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't 43 | close the file when it's finished -- the caller must do that. */ 44 | int ini_parse_file(FILE* file, ini_handler handler, void* user); 45 | 46 | /* Same as ini_parse(), but takes an ini_reader function pointer instead of 47 | filename. Used for implementing custom or string-based I/O. */ 48 | int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler, 49 | void* user); 50 | 51 | /* Nonzero to allow multi-line value parsing, in the style of Python's 52 | configparser. If allowed, ini_parse() will call the handler with the same 53 | name for each subsequent line parsed. */ 54 | #ifndef INI_ALLOW_MULTILINE 55 | #define INI_ALLOW_MULTILINE 1 56 | #endif 57 | 58 | /* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of 59 | the file. See http://code.google.com/p/inih/issues/detail?id=21 */ 60 | #ifndef INI_ALLOW_BOM 61 | #define INI_ALLOW_BOM 1 62 | #endif 63 | 64 | /* Nonzero to allow inline comments (with valid inline comment characters 65 | specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match 66 | Python 3.2+ configparser behaviour. */ 67 | #ifndef INI_ALLOW_INLINE_COMMENTS 68 | #define INI_ALLOW_INLINE_COMMENTS 1 69 | #endif 70 | #ifndef INI_INLINE_COMMENT_PREFIXES 71 | #define INI_INLINE_COMMENT_PREFIXES ";" 72 | #endif 73 | 74 | /* Nonzero to use stack, zero to use heap (malloc/free). */ 75 | #ifndef INI_USE_STACK 76 | #define INI_USE_STACK 1 77 | #endif 78 | 79 | /* Stop parsing on first error (default is to keep parsing). */ 80 | #ifndef INI_STOP_ON_FIRST_ERROR 81 | #define INI_STOP_ON_FIRST_ERROR 0 82 | #endif 83 | 84 | /* Maximum line length for any line in INI file. */ 85 | #ifndef INI_MAX_LINE 86 | #define INI_MAX_LINE 200 87 | #endif 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif /* __INI_H__ */ 94 | -------------------------------------------------------------------------------- /d2warden-pvp/introtate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu) 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | 20 | /*****/ 21 | 22 | /* 23 | * ROTL(x,n,w) rotates "w" bit wide value "x" by "n" bits to the left 24 | * 25 | * The expression passed in as x must have a type at least as wide as w. 26 | * The type should probably be unsigned for this to be guaranteed to work 27 | * properly. If n or w is signed and larger than x remember that the 28 | * promotion rules would promote x to be of the same (signed) type. 29 | * 30 | * Unfortunately C doesn't have rotate operations and they can be difficult 31 | * to implement when handling rotates by zero, negative numbers, or numbers 32 | * greater or equal to the bit width of the number. This is because ANSI/ISO 33 | * C makes weak guarantees about the left and right shift operators. We 34 | * would like to not depend on word size, endianness, or how negative 35 | * integers are represented. Unfortunately only some of those goals may be 36 | * achieved. As for optimization, a really good compiler might be able to 37 | * recognize what we are doing and turn it into a single machine instruction. 38 | */ 39 | 40 | /* valid for 00 */ 41 | /*#define ROTL(x,n,w) (((x)<<(n)) | ((x)>>((w)-(n))))*/ 42 | 43 | /* valid for 0<=n0 */ 44 | /*#define ROTL(x,n,w) (((x)<<(n)) | ((x)>>(((-(n))&(w-1)))))*/ 45 | 46 | /* valid for 0<=n and w>0 , depends on 2's complement */ 47 | #define ROTL(x,n,w) (((x)<<((n)&(w-1))) | ((x)>>(((-(n))&(w-1))))) 48 | 49 | /* valid for 0<=n and w>0 , uses three mods and an ugly conditional */ 50 | /* FIXME: and also a bug because it doesn't work on PPC */ 51 | /*#define ROTL(x,n,w) (((n)%(w)) ? (((x)<<((n)%(w))) | ((x)>>((w)-((n)%(w))))) : (x))*/ 52 | 53 | #define ROTL32(x,n) ROTL(x,n,32) 54 | #define ROTL16(x,n) ROTL(x,n,16) 55 | 56 | -------------------------------------------------------------------------------- /d2warden-pvp/md5.h: -------------------------------------------------------------------------------- 1 | /* MD5.H - header file for MD5C.C 2 | */ 3 | 4 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 5 | rights reserved. 6 | 7 | License to copy and use this software is granted provided that it 8 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest 9 | Algorithm" in all material mentioning or referencing this software 10 | or this function. 11 | 12 | License is also granted to make and use derivative works provided 13 | that such works are identified as "derived from the RSA Data 14 | Security, Inc. MD5 Message-Digest Algorithm" in all material 15 | mentioning or referencing the derived work. 16 | 17 | RSA Data Security, Inc. makes no representations concerning either 18 | the merchantability of this software or the suitability of this 19 | software for any particular purpose. It is provided "as is" 20 | without express or implied warranty of any kind. 21 | 22 | These notices must be retained in any copies of any part of this 23 | documentation and/or software. 24 | */ 25 | 26 | #ifndef _MD5_H_ 27 | #define _MD5_H_ 1 28 | 29 | /* MD5 context. */ 30 | typedef struct { 31 | UINT4 state[4]; /* state (ABCD) */ 32 | UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 33 | unsigned char buffer[64]; /* input buffer */ 34 | } MD5_CTX; 35 | 36 | void MD5Init PROTO_LIST ((MD5_CTX *)); 37 | void MD5Update PROTO_LIST 38 | ((MD5_CTX *, unsigned char *, unsigned int)); 39 | void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /d2warden-pvp/md5c.cpp: -------------------------------------------------------------------------------- 1 | /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm 2 | */ 3 | 4 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 5 | rights reserved. 6 | 7 | License to copy and use this software is granted provided that it 8 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest 9 | Algorithm" in all material mentioning or referencing this software 10 | or this function. 11 | 12 | License is also granted to make and use derivative works provided 13 | that such works are identified as "derived from the RSA Data 14 | Security, Inc. MD5 Message-Digest Algorithm" in all material 15 | mentioning or referencing the derived work. 16 | 17 | RSA Data Security, Inc. makes no representations concerning either 18 | the merchantability of this software or the suitability of this 19 | software for any particular purpose. It is provided "as is" 20 | without express or implied warranty of any kind. 21 | 22 | These notices must be retained in any copies of any part of this 23 | documentation and/or software. 24 | */ 25 | #include "stdafx.h" 26 | #include "global.h" 27 | #include "md5.h" 28 | 29 | /* Constants for MD5Transform routine. 30 | */ 31 | #define S11 7 32 | #define S12 12 33 | #define S13 17 34 | #define S14 22 35 | #define S21 5 36 | #define S22 9 37 | #define S23 14 38 | #define S24 20 39 | #define S31 4 40 | #define S32 11 41 | #define S33 16 42 | #define S34 23 43 | #define S41 6 44 | #define S42 10 45 | #define S43 15 46 | #define S44 21 47 | 48 | static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); 49 | static void Encode PROTO_LIST 50 | ((unsigned char *, UINT4 *, unsigned int)); 51 | static void Decode PROTO_LIST 52 | ((UINT4 *, unsigned char *, unsigned int)); 53 | static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); 54 | static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); 55 | 56 | static unsigned char PADDING[64] = { 57 | 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 60 | }; 61 | 62 | /* F, G, H and I are basic MD5 functions. 63 | */ 64 | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) 65 | #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) 66 | #define H(x, y, z) ((x) ^ (y) ^ (z)) 67 | #define I(x, y, z) ((y) ^ ((x) | (~z))) 68 | 69 | /* ROTATE_LEFT rotates x left n bits. 70 | */ 71 | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) 72 | 73 | /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. 74 | Rotation is separate from addition to prevent recomputation. 75 | */ 76 | #define FF(a, b, c, d, x, s, ac) { \ 77 | (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ 78 | (a) = ROTATE_LEFT ((a), (s)); \ 79 | (a) += (b); \ 80 | } 81 | #define GG(a, b, c, d, x, s, ac) { \ 82 | (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ 83 | (a) = ROTATE_LEFT ((a), (s)); \ 84 | (a) += (b); \ 85 | } 86 | #define HH(a, b, c, d, x, s, ac) { \ 87 | (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ 88 | (a) = ROTATE_LEFT ((a), (s)); \ 89 | (a) += (b); \ 90 | } 91 | #define II(a, b, c, d, x, s, ac) { \ 92 | (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ 93 | (a) = ROTATE_LEFT ((a), (s)); \ 94 | (a) += (b); \ 95 | } 96 | 97 | /* MD5 initialization. Begins an MD5 operation, writing a new context. 98 | */ 99 | void MD5Init (MD5_CTX *context) 100 | { 101 | context->count[0] = context->count[1] = 0; 102 | 103 | /* Load magic initialization constants. 104 | */ 105 | context->state[0] = 0x67452301; 106 | context->state[1] = 0xefcdab89; 107 | context->state[2] = 0x98badcfe; 108 | context->state[3] = 0x10325476; 109 | } 110 | 111 | /* MD5 block update operation. Continues an MD5 message-digest 112 | operation, processing another message block, and updating the 113 | context. 114 | */ 115 | void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen) 116 | { 117 | unsigned int i, index, partLen; 118 | 119 | /* Compute number of bytes mod 64 */ 120 | index = (unsigned int)((context->count[0] >> 3) & 0x3F); 121 | 122 | /* Update number of bits */ 123 | if ((context->count[0] += ((UINT4)inputLen << 3)) 124 | < ((UINT4)inputLen << 3)) 125 | context->count[1]++; 126 | context->count[1] += ((UINT4)inputLen >> 29); 127 | 128 | partLen = 64 - index; 129 | 130 | /* Transform as many times as possible. 131 | */ 132 | if (inputLen >= partLen) { 133 | MD5_memcpy 134 | ((POINTER)&context->buffer[index], (POINTER)input, partLen); 135 | MD5Transform (context->state, context->buffer); 136 | 137 | for (i = partLen; i + 63 < inputLen; i += 64) 138 | MD5Transform (context->state, &input[i]); 139 | 140 | index = 0; 141 | } 142 | else 143 | i = 0; 144 | 145 | /* Buffer remaining input */ 146 | MD5_memcpy 147 | ((POINTER)&context->buffer[index], (POINTER)&input[i], 148 | inputLen-i); 149 | } 150 | 151 | /* MD5 finalization. Ends an MD5 message-digest operation, writing the 152 | the message digest and zeroizing the context. 153 | */ 154 | void MD5Final (unsigned char digest[16], MD5_CTX *context) 155 | { 156 | unsigned char bits[8]; 157 | unsigned int index, padLen; 158 | 159 | /* Save number of bits */ 160 | Encode (bits, context->count, 8); 161 | 162 | /* Pad out to 56 mod 64. 163 | */ 164 | index = (unsigned int)((context->count[0] >> 3) & 0x3f); 165 | padLen = (index < 56) ? (56 - index) : (120 - index); 166 | MD5Update (context, PADDING, padLen); 167 | 168 | /* Append length (before padding) */ 169 | MD5Update (context, bits, 8); 170 | 171 | /* Store state in digest */ 172 | Encode (digest, context->state, 16); 173 | 174 | /* Zeroize sensitive information. 175 | */ 176 | MD5_memset ((POINTER)context, 0, sizeof (*context)); 177 | } 178 | 179 | /* MD5 basic transformation. Transforms state based on block. 180 | */ 181 | static void MD5Transform (UINT4 state[4], unsigned char block[64]) 182 | { 183 | UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 184 | 185 | Decode (x, block, 64); 186 | 187 | /* Round 1 */ 188 | FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ 189 | FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ 190 | FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ 191 | FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ 192 | FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ 193 | FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ 194 | FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ 195 | FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ 196 | FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ 197 | FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ 198 | FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ 199 | FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ 200 | FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ 201 | FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ 202 | FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ 203 | FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ 204 | 205 | /* Round 2 */ 206 | GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ 207 | GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ 208 | GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ 209 | GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ 210 | GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ 211 | GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ 212 | GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ 213 | GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ 214 | GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ 215 | GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ 216 | GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ 217 | GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ 218 | GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ 219 | GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ 220 | GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ 221 | GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ 222 | 223 | /* Round 3 */ 224 | HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ 225 | HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ 226 | HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ 227 | HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ 228 | HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ 229 | HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ 230 | HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ 231 | HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ 232 | HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ 233 | HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ 234 | HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ 235 | HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ 236 | HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ 237 | HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ 238 | HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ 239 | HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ 240 | 241 | /* Round 4 */ 242 | II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ 243 | II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ 244 | II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ 245 | II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ 246 | II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ 247 | II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ 248 | II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ 249 | II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ 250 | II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ 251 | II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ 252 | II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ 253 | II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ 254 | II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ 255 | II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ 256 | II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ 257 | II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ 258 | 259 | state[0] += a; 260 | state[1] += b; 261 | state[2] += c; 262 | state[3] += d; 263 | 264 | /* Zeroize sensitive information. 265 | */ 266 | MD5_memset ((POINTER)x, 0, sizeof (x)); 267 | } 268 | 269 | /* Encodes input (UINT4) into output (unsigned char). Assumes len is 270 | a multiple of 4. 271 | */ 272 | static void Encode (unsigned char *output, UINT4 *input, unsigned int len) 273 | { 274 | unsigned int i, j; 275 | 276 | for (i = 0, j = 0; j < len; i++, j += 4) { 277 | output[j] = (unsigned char)(input[i] & 0xff); 278 | output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); 279 | output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); 280 | output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); 281 | } 282 | } 283 | 284 | /* Decodes input (unsigned char) into output (UINT4). Assumes len is 285 | a multiple of 4. 286 | */ 287 | static void Decode (UINT4 *output, unsigned char *input, unsigned int len) 288 | { 289 | unsigned int i, j; 290 | 291 | for (i = 0, j = 0; j < len; i++, j += 4) 292 | output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | 293 | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); 294 | } 295 | 296 | /* Note: Replace "for loop" with standard memcpy if possible. 297 | */ 298 | static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) 299 | { 300 | unsigned int i; 301 | 302 | for (i = 0; i < len; i++) 303 | output[i] = input[i]; 304 | } 305 | 306 | /* Note: Replace "for loop" with standard memset if possible. 307 | */ 308 | static void MD5_memset (POINTER output, int value, unsigned int len) 309 | { 310 | unsigned int i; 311 | 312 | for (i = 0; i < len; i++) 313 | ((char *)output)[i] = (char)value; 314 | } 315 | -------------------------------------------------------------------------------- /d2warden-pvp/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | #include "stdafx.h" 21 | 22 | -------------------------------------------------------------------------------- /d2warden-pvp/stdafx.h: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * d2warden 3 | * https://github.com/lolet/d2warden 4 | * ========================================================== 5 | * Copyright 2011-2013 Bartosz Jankowski 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | #define _ENGLISH_LOGS 20 | #define D2EX_COLOR_STAT 183 // ItemStatCost.Txt record which stores item color value 21 | #define D2EX_LOOTED_STAT 184 // ItemStatCost.Txt record which stores monster id which gave the item 22 | #define D2EX_SPECTATOR_STATE 185 // States.Txt record set on spectators 23 | //#define D2EX_MYSQL // Replace gold with mysql database currency 24 | #define ENABLE_LEVEL_COMMAND 25 | 26 | #define WIN32_LEAN_AND_MEAN 27 | //******** SET HERE WORKING VERSION ********* 28 | #define VER_113D 29 | //******************************************* 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | #include "D2DataTables.h" 50 | #include "CommonStructs.h" 51 | 52 | #ifdef VER_113D 53 | #include "D2Structs_113D.h" 54 | #include "ExPointers_113D.h" 55 | #elif defined VER_111B 56 | #include "D2Structs_111B.h" 57 | #include "ExPointers_111B.h" 58 | #endif 59 | 60 | #ifdef D2EX_MYSQL 61 | #pragma comment(lib, "mysqlcppconn.lib") 62 | #endif 63 | 64 | #include "D2Stubs.h" 65 | 66 | #include "Misc.h" 67 | #include "Warden.h" 68 | #include "WardenClient.h" 69 | #include "Offset.h" 70 | 71 | #define ASSERT(e) if (e == 0) {Log("Critical error in line %d, file '%s' , function: '%s'm eip 0x%X.",__LINE__,__FILE__,__FUNCTION__,GetEIP()); exit(-1); } 72 | #define D2ERROR(s) { Log("Critical error '%s' in line %d, file '%s' , function: '%s'.",s,__LINE__,__FILE__,__FUNCTION__); exit(-1); } 73 | 74 | #ifdef _DEBUG 75 | #define DEBUGMSG(s,...) Debug(__FUNCTION__, s, ##__VA_ARGS__); 76 | #define BEGINDEBUGMSG(s,...) DebugNoEnter(__FUNCTION__, s, ##__VA_ARGS__); 77 | #define FINISHDEBUGMSG(s,...) DebugFinishEnter(s, ##__VA_ARGS__); 78 | #else 79 | #define DEBUGMSG(s,...) {} 80 | #define BEGINDEBUGMSG(s,...) {} 81 | #define FINISHDEBUGMSG(s,...) {} 82 | #endif 83 | -------------------------------------------------------------------------------- /patch_d2server/AssemblyInfo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/AssemblyInfo.cpp -------------------------------------------------------------------------------- /patch_d2server/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/ReadMe.txt -------------------------------------------------------------------------------- /patch_d2server/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/app.ico -------------------------------------------------------------------------------- /patch_d2server/app.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/app.rc -------------------------------------------------------------------------------- /patch_d2server/patch_d2server.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/patch_d2server.cpp -------------------------------------------------------------------------------- /patch_d2server/patch_d2server.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "patch_d2server", "patch_d2server.vcproj", "{EF1A3060-5B11-45FB-AF17-734E6875DA56}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectDependencies) = postSolution 12 | EndGlobalSection 13 | GlobalSection(ProjectConfiguration) = postSolution 14 | {EF1A3060-5B11-45FB-AF17-734E6875DA56}.Debug.ActiveCfg = Debug|Win32 15 | {EF1A3060-5B11-45FB-AF17-734E6875DA56}.Debug.Build.0 = Debug|Win32 16 | {EF1A3060-5B11-45FB-AF17-734E6875DA56}.Release.ActiveCfg = Release|Win32 17 | {EF1A3060-5B11-45FB-AF17-734E6875DA56}.Release.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityGlobals) = postSolution 20 | EndGlobalSection 21 | GlobalSection(ExtensibilityAddIns) = postSolution 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /patch_d2server/patch_d2server.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/patch_d2server.vcproj -------------------------------------------------------------------------------- /patch_d2server/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by app.rc 4 | -------------------------------------------------------------------------------- /patch_d2server/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/stdafx.cpp -------------------------------------------------------------------------------- /patch_d2server/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jankowskib/d2server/8eaeb4b0e88eb02946fd60c711a3c1ed8bf97753/patch_d2server/stdafx.h --------------------------------------------------------------------------------