Open Positiff88 opened 2 years ago
Do you have a hook for the function which control rod planting and its cost, so I can implement this issue myself? Or it needs to be reverse engineered first? I was unable to find such a hook in a project.
There is no such hook since library does not change rod planting cost, you need to find it yourself.
You will need to hook at least 4 functions for this. In terms of Akella or Russobit-M game executables, their addresses are:
0x437B81
- actual rod planting, logic of planting rod effect
. In this function game decrements player gold and places new rod on a map. This logic is called only on server: in response of stack planting rod and for rod planter AI.0x48F4C3
- 'plant rod' button handler. Client interface.0x4CE569
- 'drop rod' task logic, state of the game when player clicked 'plant rod' button and starts choosing placement tile. In this function you will be fixing resource checks and price computation for message popup X005TA0265
from TApp.dbf: 'Drop a rod for %COST% gold coins?'. Client side0x5DAE4F
- small utility function that searches for player by its ID and check if it has enough resources for rod planting.Thank you. It will help. By the way, do you have C code file or IDA Pro database with all other game functions you already know about? Please share if any. It is hard to understand the logic of needed functions from scratch if all other functions have no meaningful names, especially with my pretty low level of knowledge about Assembler and C languages. Is there any documentation about D2ModdingToolset possibilities in function hooks? For example, can I modify only part of the function (which takes rod planting cost from the value taken from ROD_COST column) and then return back to its execution, or I need to rewrite it's code completely (so I need to hook also all functions it is using inside)?
You can upload data structures and function from this repo into your IDA db to simplify things, but you will need some understanding of asm and low-level c++ implementation to do the modding.
Make sure you upload only those in namespace game
or namespace <Something>Api
.
The only possibility of mss32 is to change data in running game process memory. With this you can hook functions (for convenience this does Detours library), you can change single instructions (first version of crit chance was implemented this way) or you can change data, for example maximum damage value.
I and Unven agreed we will not mess with changes of single instructions and inline asm, but it is up to you what tools to choose. Sometimes it easier to change couple of instructions to get desired effect, but when we need to change game function behavior we hook it and reimplement it with our logic. There is no need to reimplement all nested functions, they can be described as function pointers and called - just make sure function signature is the same or behaves the same (no stack corruptions)
At the moment Rod-planting cost is the same for all races and specified in GVars.dbf in a ROD_COST column. Please add an ability to specify different costs for every race, so it can be possible to require some amount of mana to plant a rod (land transformation seems to be some magic-involved action, so it is logical to spend mana for it).