Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of the massive testing of StatList Functions #25

Closed
Araksson opened this issue Apr 13, 2021 · 0 comments · Fixed by #28
Closed

Result of the massive testing of StatList Functions #25

Araksson opened this issue Apr 13, 2021 · 0 comments · Fixed by #28

Comments

@Araksson
Copy link

I did an exhaustive verification of all the code related to StatList (basically because my intention is to expand some sections, but before doing so I must verify that all the vanilla code works perfectly).

The testing was carried out in 3 phases:

  • I checked all the functions together in the same HOOK (Exactly the same from the D2Moo code). The result was bad (obviously) since there were endless errors when starting a game. After this result I started the second phase.
  • I checked the code from the latest D2Moo update (with the massive changes) and compared it to the code I used previously (with the first version). In this phase I rechecked all the code with its changes, and the result was exactly the same. Negative, only this time I noticed corrected functions and functions with helpers (which did not exist before). For this reason, when exposing phase 3 of my tests, I included a partial result when using the Helper functions, but I am not 100% sure of their correct operation, however 50% of them work well at first glance. And regarding the rest of the functions, I did a third test to analyze them one by one.
  • In this phase, I did an individual test and changed the syntax of some functions (for my convenience, but the result is theoretically the same). This phase is the most extensive and consists of trying to repair what I can and report everything I got (with my corrections).
    Here I got the following result:

  • 29 Wrong Functions (Short functions that depend on these long functions I don't consider "wrong" because they are literally the same function.)

  • 77 functions that work fine (within my limited, but extreme tests).

  • A function I could not verify in any way that I have no idea where or when it is executed (in D2Game and D2Client).

Also, I proposed some names for the unknown functions and some changes to other functions (although the latter is not important). And, Most of the improvements, I made were control for IFs (if you use pUnit->pStatListEx I added if pUnit and other things like that). I did this because some functions just fixed like this

I clarify that there are also functions that internally call the functions that "do not work", this is because I did a complete stability test, I added vanilla PTRS in each function and I was verifying one by one (its structure, loops and other characteristics). That is why there are functions that "work". This is an attempt to isolate the error.

And one last clarification regarding the Names: I mean "new name" with respect to the first name they had, some I updated them with the Name you gave them and others I invented them.

Work Functions:

  1. 10470 - STATLIST_AllocStatList
  2. 10471 - STATLIST_GetOwnerType (The result if pUnit is NULL is 6) (In D2Game it is common to use these values)
  3. 10472 - STATLIST_GetOwnerGUID (The result if pUnit is NULL is -1 not 0) (In D2Game it is common to use these values)
  4. 11304 - STATLIST_GetBaseStatsCount
  5. 11305 - STATLIST_GetFullStatsCountFromUnit
  6. 10478 - STATLIST_SetState
  7. 10479 - STATLIST_GetState
  8. 10528 - STATLIST_SetExpireFrame
  9. 10529 - STATLIST_GetExpireFrame
  10. 10467 - STATLIST_GetStatFromStatListByStatID
  11. 11264 - STATLIST_SetSkillId
  12. 11265 - STATLIST_GetSkillId
  13. 11266 - STATLIST_SetSkillLevel
  14. 11267 - STATLIST_GetSkillLevel
  15. 10534 - (NEW NAME) STATLIST_SetFlag100Unknown
  16. 10530 - STATLIST_CheckStatlistFlagDMGRed
  17. 10477 - STATLIST_SetStatRemoveCallback
  18. 10482 - STATLIST_GetStatListFromFlag (Improvement FLAG change (nFlag & pStatList->dwFlags) to (pStatList->dwFlags & nFlag))
  19. 10481 - STATLIST_GetStatListFromUnitAndFlag (Improvement control IF FLAG change (nFlag & pStatList->dwFlags) to (pStatList->dwFlags & nFlag))
  20. 10484 - STATLIST_GetStatListFromUnitStateAndFlag (Improvement control if and Flags change (nFlag & pStatList->dwFlags) to (pStatList->dwFlags & nFlag))
  21. 10535 - STATLIST_GetOwner (Corrected flag (pUnit->pStatListEx->dwFlags & STATLIST_DYNAMIC) to ~(pUnit->pStatListEx->dwFlags & STATLIST_DYNAMIC)) - In this function you can notice the error if it is patched as it is extracted from D2Moo, the Weapons do not add the damage to the character until you position the cursor over it, with this improvement this is corrected.
  22. 10512 - (New Name) STATLIST_FindStatAndCallBack (In this function I was especially careful with the order of the control if, otherwise it did not work - if (pUnit1 && pUnit1->pStatListEx && STATLIST_IsExtended(pUnit1->pStatListEx) && !STATLIST_FindStatFromArrayID(&pUnit1->pStatListEx->ModStats, nStatId << 16))
  23. 10511 - STATLIST_FreeModStats
  24. 11268 - STATLIST_GetFullStatsDataFromUnit
  25. 11243 - STATLIST_GetBaseStatsData
  26. 10519 - 10520 - STATLIST_GetUnitStatUnsigned - STATLIST_GetUnitStatSigned (Theoretically they are exactly the same functions. Since Blizzard uses 10519 to extract 80% of the Game Stats (including those that can have negative numbers like Resistances in Hell), I removed the return uint32_t and left it int (the old type) because int casts as uint32_t, int32_t , int8_t int16_t, uint8_t and uint16_t alike. Without this change these functions do not work properly).
  27. 10532 - (New Name) STATLIST_GetStatUnsigned_Layer0
  28. 11248 - (New Name) STATLIST_GetUnitStatInLayer0Control
  29. 10564 - 10565 - 10566 - 10567 - 10568 - 10569 - 10570 - 10571 - 10572 - STATLIST_GetMaxLifeFromUnit - STATLIST_GetMaxManaFromUnit - STATLIST_GetMaxStaminaFromUnit - STATLIST_GetMaxDurabilityFromUnit - STATLIST_GetMaxDamageFromUnit - STATLIST_GetMinDamageFromUnit - STATLIST_GetMaxThrowDamageFromUnit - STATLIST_GetMinThrowDamageFromUnit - STATLIST_GetDefenseFromUnit (these depend solely on 11248)
  30. 10466 - STATLIST_GetStatValue
  31. 11269 - STATLIST_CopyStatsToBuffer
  32. 11270 - (New Name) STATLIST_CheckAndCopyStatToBufferEX (Improvement Control IF)
  33. 10480 - STATLIST_GetStatListFromUnitAndState (Improvement control IF)
  34. 10563 - STATLIST_AreUnitsAligned (Improvement control IF)
  35. 10562 - STATLIST_GetUnitAlignment
  36. 10521 - STATLIST_GetUnitBaseStat (Improvement Control IF)
  37. 10522 - STATLIST_GetUnitStatBonus (Improvement Control IF and Simplify)
  38. 10527 - STATLIST_FreeStatListEx (Improvement Control IF)
  39. 10526 - STATLIST_AllocStatListEx (Improvement Control IF)
  40. 10515 - (New Name) STATLIST_CleanStatesAndStatListEx (Improvement control IF and Clean)
  41. 10485 - STATLIST_FreeStatList
  42. 10469 - (New Name) STATLIST_Delete (Improvement control IF and Clean)
  43. 10516 - (New Name) STATLIST_UpdateStatListsExpiration (Improvement Control IF)
  44. 10483 - STATLIST_GetStatListFromUnitStateOrFlag (Improvement Control IF)
  45. 0x6FDB8A90 - (New Name) STATLIST_STATES_GetStatFlags
  46. 0x6FDB8AC0 - (New Name) STATLIST_STATES_GetListGfxFlags
  47. 0x6FDB6300 - STATLIST_FindStatIndex (Improvement Control IF)
  48. 0x6FDB6920 - STATLIST_FindStatFromArrayID (Improvement Control IF)
  49. 0x6FDB8190 - (New Name) STATLIST_GetStatListExFromState
  50. 0x6FDB63E0 - (New Name) STATLIST_GetTotalStat (Improvement Control IF)
  51. 0x6FDB7050 - (New Name) STATLIST_FreeStatListImpl (Improvement control IF)
  52. 0x6FDB6A30 - (New Name) STATLIST_RemoveStat
  53. 0x6FDB9C50 - (New Name) STATLIST_CopyStatToBufferEX
  54. 0x6FDB6340 - (New Name) STATLIST_GetBaseStatVal (Improvement Control IF)
  55. 0x6FDB8900 - (New Name) STATLIST_STATES_ToggleState (Improvement Control IF and Clean)

Functions that exclusively depend on wrong functions to Work:

  1. 10531 - STATLIS_GoSetStatInStatListLayer0 (depends on 10463 STATLIST_SetStat)
  2. 11295 - STATLIST_SetBaseStat2 (depends on 11294 STATLIST_SetBaseStat)
  3. 11273 - (New Name) STATLIST_CheckAndGetNewValueFromStatID (Improvement control IF and depends on 0x6FDB5830 STATLIST_GetNewValueFromStatID)
  4. 10514 - (New Name) STATLIST_ClampStaminaManaHP (depends on 10464 STATLIST_AddStat)
  5. 10524 - STATLIST_ExpireUnitStatlist (depends on 0x6FDB6E30 STATLIST_ExpireStatListEx)
  6. 10574 - (New Name) STATLIST_SetOrRemoveStatListFromStateID (Improvement control IF and Clean, and depends on 0x6FDB6E30 STATLIST_ExpireStatListEx and 10475 STATLIST_AddPostStatToStatList)
  7. 10474 - STATLIST_ExpireStatList (depends on 0x6FDB6E30 STATLIST_ExpireStatListEx)
  8. 0x6FDB7690 - (New Name) STATLIST_InsertStatModOrFail (depends on 0x6FDB6970 STATLIST_InsertStatOrFail)

WRONG functions:

  1. 10513 - (New Name) STATLIST_FindStatAndCallBackEx
  2. 10523 - STATLIST_MergeStatLists
  3. 11274 - (New Name) STATLIST_MergeStatListTRUE
  4. 11275 - (New Name) STATLIST_MergeStatListFALSE
  5. 10463 - STATLIST_SetStat
  6. 11294 - (New Name) STATLIST_SetBaseStat
  7. 10517 - STATLIST_SetUnitStat
  8. 10573 - STATLIST_MergeBaseStats
  9. 10464 - STATLIST_AddStat (Improvement Clean)
  10. 10465 - STATLIST_SetStatIfListIsValid
  11. 10518 - STATLIST_AddUnitStat
  12. 10468 - STATLIST_RemoveAllStats
  13. 10475 - (New Name) STATLIST_AddPostStatToStatList
  14. 10525 - (New Name) STATLIST_MergeStatListFromUnitToUnit
  15. 0x6FDB6970 - (New Name) STATLIST_InsertStatOrFail
  16. 0x6FDB6C10 - (New Name) STATLIST_SetStatProcess
  17. 0x6FDB6E30 - (New Name) STATLIST_ExpireStatListEx
  18. 0x6FDB5830 - (New Name) STATLIST_GetNewValueFromStatID (The error you have is curious. Make Missiles Invisible)
  19. 0x6FDB6AB0 - (New Name) STATLIST_UpdateUnitStat (Wrong DIV BY ZERO)
  20. 0x6FDB64A0 - (New Name) STATLIST_UpdateUnitNewStat

HELPER Functions:

Work Functions:

  1. STATLIST_IsExtended - Improvement Control IF
  2. BITMANIP_SetBitsValueForMask
  3. STATLIST_StatListExCast - Improvement Control IF
  4. STATLIST_ApplyMinValue - Improvement Control IF and __fastcall
  5. STATLIST_GetStatUnsigned
  6. STATLIST_CopyStatsData - Improvement Control IF
  7. STATLIST_ClampStat - Improvement Control IF (depends on 10464 STATLIST_AddStat)

Wrong Functions:

  1. STATLIST_FindStatInsertionIndex
  2. STATLIST_InsertStat
  3. STATLIST_GetOrInsertStat
  4. STATLIST_NotifyUnitOfStatValueChange
  5. STATLIST_SetUnitStatNewValue
  6. ComputeStatPercentage
  7. STATLIST_MergeStatListWithBool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant