-
AlexSpl
имя: Александр
- Эксперт
-
- Сообщения: 5587
- Зарегистрирован: 17 сен 2010, 12:58
- Пол:
- Награды: 14
-
-
- Поблагодарили: 2185 раз.
|
AlexSpl » 07 окт 2020, 12:31
Плагин для изменения кол-ва нужного ресурса для покупки существ. Тип и кол-во ресурса (Wood, Mercury, Ore, Sulfur, Crystal, Gems) задаются в файле ChangeResourceCost.ini. Например, пусть Crusaders дополнительно требуют 2 ед. дерева, а Greater Druids - 1 ед. кристаллов: - Код: Выделить всё
[Crusader] Res=Wood Num=2
[Greater Druid] Res=Crystal Num=1
Максимальное количество ед. ресурса - 255. К сожалению, плагин не умеет менять стоимость существ в золоте Исходный код - Код: Выделить всё
#include "patcher_x86.hpp"
Patcher* _P; PatcherInstance* _PI;
static _bool_ plugin_On = 0;
const char MonName[][17] = { "Peasant", "Archer", "Ranger", "Pikeman", "Veteran Pikeman", "Swordsman", "Master Swordsman", "Cavalry", "Champion", "Paladin", "Crusader", "Goblin", "Orc", "Orc Chief", "Wolf", "Ogre", "Ogre Lord", "Troll", "War Troll", "Cyclops", "Sprite", "Dwarf", "Battle Dwarf", "Elf", "Grand Elf", "Druid", "Greater Druid", "Unicorn", "Phoenix", "Centaur", "Gargoyle", "Griffin", "Minotaur", "Minotaur King", "Hydra", "Green Dragon", "Red Dragon", "Black Dragon", "Halfling", "Boar", "Iron Golem", "Steel Golem", "Roc", "Mage", "Archmage", "Giant", "Titan", "Skeleton", "Zombie", "Mutant Zombie", "Mummy", "Royal Mummy", "Vampire", "Vampire Lord", "Lich", "Power Lich", "Bone Dragon", "Rogue", "Nomad", "Ghost", "Genie", "Medusa", "Earth Elemental", "Air Elemental", "Fire Elemental", "Water Elemental" };
const char ResName[][8] = { "Wood", "Mercury", "Ore", "Sulfur", "Crystal", "Gems" };
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { if ( DLL_PROCESS_ATTACH == ul_reason_for_call ) { if ( !plugin_On ) { plugin_On = 1; _P = GetPatcher(); _PI = _P->CreateInstance("HD.Plugin.H2.AddResourceCost"); _PI->WriteHexPatch(0x468D4B, "8B 4D F8 31 C0 8A 84 09 6A 8D 46 00 31 D2 8A 94" \ "09 6B 8D 46 00 8B 4D F4 89 14 81 89 EC 5D C3 00" \ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" \ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" \ "00 00 00 00 00 04 01 00 00 00 00 00 00 00 00 00" \ "00 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00" \ "00 00 00 00 00 03 01 03 02 03 03 00 00 00 00 00" \ "00 00 00 00 00 00 00 00 00 05 01 05 02 00 00 00" \ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" \ "00 00 00 00 00 00 00 05 01 00 00 00 00 00 00 00" \ "00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90" \ "90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90" \ "90 90 90 90 90 90 90");
char res[8] = ""; signed char resId, num; for (int i = 0; i < 66; ++i) { GetPrivateProfileStringA(MonName[i], "Res", "Wood", res, 8, ".\\Plugins\\ChangeResourceCost.ini"); num = GetPrivateProfileIntA(MonName[i], "Num", 0, ".\\Plugins\\ChangeResourceCost.ini"); if ( num ) { switch ( res[0] ) { case 'W': resId = 0; break; case 'M': resId = 1; break; case 'O': resId = 2; break; case 'S': resId = 3; break; case 'C': resId = 4; break; case 'G': resId = 5; break; default: resId = 0; } _PI->WriteByte(0x468D6A + (i << 1), resId); _PI->WriteByte(0x468D6A + (i << 1) + 1, num); } } } }
return TRUE; }
|