Skip to content

Commit 55097bd

Browse files
committed
2 parents 454e59d + 59d75ab commit 55097bd

6 files changed

Lines changed: 392 additions & 19 deletions

File tree

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
"Games"
2+
{
3+
"#default"
4+
{
5+
"Functions"
6+
{
7+
"CBaseAbility::UpdateAbility"
8+
{
9+
"offset" "CBaseAbility::UpdateAbility"
10+
"hooktype" "entity"
11+
"return" "void"
12+
"this" "entity"
13+
}
14+
15+
"CBaseEntity::PhysicsSolidMaskForEntity"
16+
{
17+
"offset" "CBaseEntity::PhysicsSolidMaskForEntity"
18+
"hooktype" "entity"
19+
"return" "int"
20+
"this" "ignore"
21+
}
22+
}
23+
}
24+
25+
"left4dead"
26+
{
27+
"MemPatches"
28+
{
29+
"ShouldHitEntity_MyInfectedPointer"
30+
{
31+
"signature" "CTraceFilterSimpleListNoInfectedOrGhosts_ShouldHitEntity"
32+
"linux"
33+
{
34+
"offset" "101"
35+
36+
/*
37+
* 8B 06 mov eax, [esi]
38+
* 89 34 24 mov [esp+2Ch+var_2C], esi ; IHandleEntity *
39+
*
40+
* OUR_PATCH:
41+
* FF 90 24 01 00 00 call dword ptr [eax+124h] ; CBaseEntity::MyInfectedPointer(void)
42+
* 85 C0 test eax, eax
43+
* 8B 54 24 0C mov edx, [esp+2Ch+var_20]
44+
* 75 CB jnz short loc_2A614C ; return 0 (no collision)
45+
*/
46+
"verify" "\xFF\x90\x2A\x2A\x2A\x2A\x85\xC0\x2A\x2A\x2A\x2A\x75"
47+
48+
"preserve" "\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\xFF\xFF\x00"
49+
50+
/*
51+
* E8 ? ? ? ? call CBaseEntity::GetTeamNumber(void)
52+
* 83 F8 03 cmp eax, 3
53+
* 8B 54 24 0C mov edx, [esp+2Ch+var_20]
54+
* 74 CB jz short loc_2A614C ; return 0 (no collision)
55+
*/
56+
"patch" "\xE8\x00\x00\x00\x00\x83\xF8\x03\x90\x90\x90\x90\x74"
57+
}
58+
"windows"
59+
{
60+
"offset" "46"
61+
62+
/*
63+
* 8B 06 mov eax, [esi] ; IHandleEntity *
64+
* 8B 90 20 01 00 00 mov edx, [eax+120h] ; CBaseEntity::MyInfectedPointer(void)
65+
* 8B CE mov ecx, esi
66+
* FF D2 call edx
67+
* 85 C0 test eax, eax
68+
* 75 0F jnz short loc_102CCC1D
69+
*/
70+
"verify" "\x8B\x06\x8B\x2A\x2A\x2A\x2A\x2A\x8B\xCE\xFF\x2A\x85\xC0\x75"
71+
72+
/*
73+
* EB 02 jmp short OUR_PATCH
74+
* 66 90 NOP
75+
*
76+
* OUR_PATCH:
77+
* 8B CE mov ecx, esi ; IHandleEntity *
78+
* E8 ? ? ? ? call sub_1003FA90 ; CBaseEntity::GetTeamNumber(void)
79+
* 83 F8 03 cmp eax, 3
80+
* 74 0F jz short loc_102CCC1D
81+
*/
82+
"patch" "\xEB\x02\x66\x90\x8B\xCE\xE8\x00\x00\x00\x00\x83\xF8\x03\x74"
83+
}
84+
}
85+
86+
"OnVomitCollide__TraceRayMask_patch"
87+
{
88+
"signature" "OnVomitCollide"
89+
"linux"
90+
{
91+
"offset" "16Eh"
92+
"verify" "\x0B\x40\x00\x46"
93+
"patch" "\x03\x40\x00\x46"
94+
}
95+
"windows"
96+
{
97+
"offset" "5Ch"
98+
"verify" "\x0B\x40\x00\x46"
99+
"patch" "\x03\x40\x00\x46"
100+
}
101+
}
102+
103+
"OnVomitCollide__ClipRayMask_patch"
104+
{
105+
"signature" "OnVomitCollide"
106+
"linux"
107+
{
108+
"offset" "252h"
109+
"verify" "\x0B\x40\x00\x46"
110+
"patch" "\x03\x40\x00\x46"
111+
}
112+
"windows"
113+
{
114+
"offset" "F1h"
115+
"verify" "\x0B\x40\x00\x46"
116+
"patch" "\x03\x40\x00\x46"
117+
}
118+
}
119+
}
120+
121+
"Offsets"
122+
{
123+
"CBaseAbility::UpdateAbility"
124+
{
125+
"linux" "190"
126+
"windows" "189"
127+
}
128+
129+
"PatchOffset"
130+
{
131+
"linux" "1"
132+
"windows" "7"
133+
}
134+
135+
"CBaseEntity::PhysicsSolidMaskForEntity"
136+
{
137+
"linux" "164"
138+
"windows" "163"
139+
}
140+
}
141+
142+
"Addresses"
143+
{
144+
"CBaseEntity_GetTeamNumber"
145+
{
146+
"linux"
147+
{
148+
"signature" "CBaseEntity_GetTeamNumber"
149+
}
150+
"windows"
151+
{
152+
"signature" "CBaseEntity_GetTeamNumber"
153+
}
154+
}
155+
}
156+
157+
"Signatures"
158+
{
159+
"CTraceFilterSimpleListNoInfectedOrGhosts_ShouldHitEntity"
160+
{
161+
"library" "server"
162+
"linux" "@_ZN40CTraceFilterSimpleListNoInfectedOrGhosts15ShouldHitEntityEP13IHandleEntityi"
163+
"windows" "\x53\x8B\x2A\x2A\x2A\x56\x8B\x2A\x2A\x2A\x57\x53\x56\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x84\x2A\x74"
164+
/* 53 8B ? ? ? 56 8B ? ? ? 57 53 56 8B ? E8 ? ? ? ? 84 ? 74 */
165+
}
166+
167+
"CBaseEntity_GetTeamNumber"
168+
{
169+
"library" "server"
170+
"linux" "@_ZNK11CBaseEntity13GetTeamNumberEv"
171+
"windows" "\x8B\x81\xEC\x01\x00\x00\xC3"
172+
/* 8B 81 EC 01 00 00 C3 */
173+
}
174+
175+
"OnVomitCollide"
176+
{
177+
"library" "server"
178+
"linux" "@_Z14OnVomitCollideP13CTerrorPlayerP11CBaseEntityS2_i6VectorS3_"
179+
"windows" "\x81\xEC\x2A\x2A\x2A\x2A\x8B\x84\x24\x2A\x2A\x2A\x2A\x8B\x8C\x24\x2A\x2A\x2A\x2A\x8B\x94\x24"
180+
/* 81 EC ? ? ? ? 8B 84 24 ? ? ? ? 8B 8C 24 ? ? ? ? 8B 94 24 */
181+
}
182+
}
183+
}
184+
185+
"left4dead2"
186+
{
187+
"Offsets"
188+
{
189+
"CBaseEntity::PhysicsSolidMaskForEntity"
190+
{
191+
"linux" "178"
192+
"windows" "177"
193+
}
194+
}
195+
}
196+
}
5.64 KB
Binary file not shown.
24 Bytes
Binary file not shown.

‎addons/sourcemod/scripting/l4d_boss_percent.sp‎

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ out what's going on :D Kinda makes my other plugins look bad huh :/
2626
#include <readyup>
2727
#include <witch_and_tankifier>
2828

29-
#define PLUGIN_VERSION "3.2.7"
29+
#define PLUGIN_VERSION "3.2.8"
3030

3131
public Plugin myinfo =
3232
{
@@ -349,26 +349,21 @@ int GetPercentageFromText(const char[] text)
349349
// Check to see if text contains '%' - Store the index if it does
350350
int index = StrContains(text, "%", false);
351351

352-
// If the index isn't -1 (No '%' found) then find the percentage
353-
if (index > -1)
354-
{
355-
char sBuffer[12]; // Where our percentage will be kept.
356-
357-
// If the 3rd character before the '%' symbol is a number it's 100%.
358-
if (IsCharNumeric(text[index - 3]))
359-
{
360-
return 100;
361-
}
352+
// Walk back over the digits before our '%' symbol
353+
int start = index;
354+
while (start > 0 && IsCharNumeric(text[start - 1]))
355+
start--;
362356

363-
// Check to see if the characters that are 1 and 2 characters before our '%' symbol are numbers
364-
if (IsCharNumeric(text[index - 2]) && IsCharNumeric(text[index - 1]))
365-
{
366-
// If both characters are numbers combine them into 1 string
367-
FormatEx(sBuffer, sizeof(sBuffer), "%c%c", text[index - 2], text[index - 1]);
357+
int digits = index - start;
358+
if (digits >= 1 && digits <= 3)
359+
{
360+
char sBuffer[4];
361+
strcopy(sBuffer, digits + 1, text[start]);
368362

369-
// Convert our string to an int
370-
return StringToInt(sBuffer);
371-
}
363+
// Convert our string to an int
364+
int percentage = StringToInt(sBuffer);
365+
if (percentage <= 100)
366+
return percentage;
372367
}
373368

374369
// Couldn't find a percentage

0 commit comments

Comments
 (0)