Skip to content

Commit 2996a74

Browse files
localize strings
1 parent 76cb48d commit 2996a74

2 files changed

Lines changed: 63 additions & 10 deletions

File tree

DotAAllstarsHelperFinal/DotaAllstarsHelper.cpp

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,38 @@ void __stdcall SetMagicCampValue(int value)
854854
magicampval = value;
855855
}
856856

857+
858+
859+
860+
static std::string magicAmpBonusStr1 = "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|nSpell Damage: %i%% (|cFF20FF20+%i%%|r)|n";
861+
int __stdcall SetMagicAmpBonusStr1(const char* str)
862+
{
863+
magicAmpBonusStr1 = str;
864+
return 0;
865+
}
866+
867+
static std::string magicAmpBonusStr2 = "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|nSpell Damage: %i%% (0%%)|n";
868+
int __stdcall SetMagicAmpBonusStr2(const char* str)
869+
{
870+
magicAmpBonusStr2 = str;
871+
return 0;
872+
}
873+
874+
static std::string attackBonusStr = "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|n";
875+
int __stdcall SetAttackBonusStr(const char* str)
876+
{
877+
attackBonusStr = str;
878+
return 0;
879+
}
880+
881+
static std::string attackReloadStr = "%.3f (Reload: %.2f sec)";
882+
int __stdcall SetAttackReloadStr(const char* str)
883+
{
884+
attackReloadStr = str;
885+
return 0;
886+
}
887+
888+
857889
// Функция принимает данные о скорости атаки (и о увеличении урона от способностей) и сохраняет в буфер который будет использоваться при отрисовке
858890
int __stdcall PrintAttackSpeedAndOtherInfo(unsigned char* addr, float* attackspeed, float* BAT, unsigned char** unitaddr)
859891
{
@@ -919,9 +951,9 @@ int __stdcall PrintAttackSpeedAndOtherInfo(unsigned char* addr, float* attackspe
919951
float AttackSpeedBonus = realattackspeed * 100.0f - 100.0f;
920952

921953
if (magicampbonus)
922-
sprintf_s(buffer, sizeof(buffer), "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|nSpell Damage: %i%% (|cFF20FF20+%i%%|r)|n", AttacksPerSec, AttackReload, AttackSpeedBonus, magicamp, magicampbonus);
954+
sprintf_s(buffer, sizeof(buffer), magicAmpBonusStr1.c_str(), AttacksPerSec, AttackReload, AttackSpeedBonus, magicamp, magicampbonus);
923955
else
924-
sprintf_s(buffer, sizeof(buffer), "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|nSpell Damage: %i%% (0%%)|n", AttacksPerSec, AttackReload, AttackSpeedBonus, magicamp);
956+
sprintf_s(buffer, sizeof(buffer), magicAmpBonusStr2.c_str(), AttacksPerSec, AttackReload, AttackSpeedBonus, magicamp);
925957
}
926958
else
927959
{
@@ -936,7 +968,7 @@ int __stdcall PrintAttackSpeedAndOtherInfo(unsigned char* addr, float* attackspe
936968
}
937969
float AttackSpeedBonus = realattackspeed * 100.0f - 100.0f;
938970

939-
sprintf_s(buffer, sizeof(buffer), "%.1f/sec (Reload: %.2f sec)|nAttack speed bonus: %.0f|n", AttacksPerSec, AttackReload, AttackSpeedBonus);
971+
sprintf_s(buffer, sizeof(buffer), attackBonusStr.c_str(), AttacksPerSec, AttackReload, AttackSpeedBonus);
940972
}
941973
if (fixedattackspeed > *(float*)(GameDll + pAttackSpeedLimit))
942974
fixedattackspeed = *(float*)(GameDll + pAttackSpeedLimit);
@@ -964,7 +996,7 @@ int __stdcall PrintAttackSpeedAndOtherInfo(unsigned char* addr, float* attackspe
964996
if (fixedattackspeed < 0.2f)
965997
fixedattackspeed = 0.2f;
966998

967-
sprintf_s(buffer, sizeof(buffer), "%.3f (Reload: %.2f sec)", (fixedattackspeed / *(float*)BAT), 1.0f / (fixedattackspeed / *(float*)BAT));
999+
sprintf_s(buffer, sizeof(buffer), attackReloadStr.c_str(), (fixedattackspeed / *(float*)BAT), 1.0f / (fixedattackspeed / *(float*)BAT));
9681000

9691001
__asm
9701002
{
@@ -1081,6 +1113,14 @@ float __stdcall GetMagicProtectionForHero_by_abiladdr(unsigned char* abil_addr)
10811113
return 0.0f;
10821114
}
10831115

1116+
static std::string magicProtStr = "Magic Protection";
1117+
1118+
int __stdcall SetMagicProtectionString(const char* str)
1119+
{
1120+
magicProtStr = str;
1121+
return 0;
1122+
}
1123+
10841124
int __stdcall PrintMoveSpeed(unsigned char* addr, float* movespeed, unsigned char* AmovAddr)
10851125
{
10861126
if (DEBUG_FULL)
@@ -1096,11 +1136,11 @@ int __stdcall PrintMoveSpeed(unsigned char* addr, float* movespeed, unsigned cha
10961136
if (fabs(MagicProtection) < 0.00001f)
10971137
sprintf_s(buffer, sizeof(buffer), "%.1f", (*(float*)movespeed));
10981138
else if (MagicProtection > 30.0f)
1099-
sprintf_s(buffer, sizeof(buffer), "%.1f|nMagic Protection: |cFF00C800%.1f|r%%", (*(float*)movespeed), MagicProtection);
1139+
sprintf_s(buffer, sizeof(buffer), "%.1f|n%s: |cFF00C800%.1f|r%%", (*(float*)movespeed), magicProtStr.c_str(), MagicProtection);
11001140
else if (MagicProtection <= 30.0f && MagicProtection > 0.0f)
1101-
sprintf_s(buffer, sizeof(buffer), "%.1f|nMagic Protection: %.1f%%", (*(float*)movespeed), MagicProtection);
1141+
sprintf_s(buffer, sizeof(buffer), "%.1f|n%s: %.1f%%", (*(float*)movespeed), magicProtStr.c_str(), MagicProtection);
11021142
else
1103-
sprintf_s(buffer, sizeof(buffer), "%.1f|nMagic Protection: |cFFD82005%.1f|r%%", (*(float*)movespeed), MagicProtection);
1143+
sprintf_s(buffer, sizeof(buffer), "%.1f|n%s: |cFFD82005%.1f|r%%", (*(float*)movespeed), magicProtStr.c_str(), MagicProtection);
11041144
__asm
11051145
{
11061146
PUSH 0x200;
@@ -1201,19 +1241,26 @@ const char* GetPlayerColorString2(int player)
12011241
}
12021242

12031243

1244+
static std::string ownedByStr = "Owned by";
1245+
1246+
int __stdcall SetOwnedByString(const char* str)
1247+
{
1248+
ownedByStr = str;
1249+
return 0;
1250+
}
1251+
12041252

12051253
unsigned char* __stdcall SaveStringsForPrintItem(unsigned char* itemaddr)
12061254
{
12071255
if (itemaddr)
12081256
{
1209-
12101257
if (IsNotBadItem(itemaddr))
12111258
{
12121259
int itemowner = *(int*)(itemaddr + 0x74);
12131260
if (itemowner <= 15 && itemowner >= 0)
12141261
{
1215-
sprintf_s(itemstr1, 512, "Owned by %s%s|r|n%%s%%s%%s%%s%%s", GetPlayerColorString2(Player(itemowner)), GetPlayerName(itemowner, 0));
1216-
sprintf_s(itemstr2, 512, "Owned by %s%s|r|n%%s%%s%%s", GetPlayerColorString2(Player(itemowner)), GetPlayerName(itemowner, 0));
1262+
sprintf_s(itemstr1, 512, "%s %s%s|r|n%%s%%s%%s%%s%%s", ownedByStr.c_str(), GetPlayerColorString2(Player(itemowner)), GetPlayerName(itemowner, 0));
1263+
sprintf_s(itemstr2, 512, "%s %s%s|r|n%%s%%s%%s", ownedByStr.c_str(), GetPlayerColorString2(Player(itemowner)), GetPlayerName(itemowner, 0));
12171264
return itemaddr;
12181265
}
12191266
}

DotAAllstarsHelperFinal/Source.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,9 @@ ShowSkillPanelForEnemyNeurals
216216
GetEspValue
217217
GetEspValueStdCall
218218
Packet_Send_Ex
219+
SetMagicProtectionString
220+
SetOwnedByString
221+
SetMagicAmpBonusStr1
222+
SetMagicAmpBonusStr2
223+
SetAttackBonusStr
224+
SetAttackReloadStr

0 commit comments

Comments
 (0)