[Help][SL 9.2.7] CGPlayer CalculateThreat menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Trogg's Avatar Member
    Reputation
    1
    Join Date
    Feb 2024
    Posts
    18
    Thanks G/R
    12/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help][SL 9.2.7] CGPlayer CalculateThreat

    Hello, trying to reverse CalculateThreat (thanks to scizzydo) function but it returns zeros, seems i missing something:
    char __fastcall CGUnit_C::CalculateThreat(__int64 a1, wGUID *a2, bool *a3, _BYTE *a4, float *a5, _QWORD *a6)
    Code:
    auto inline ThreatPercentFor(Unit* a1, Unit* otherUnit)
    {
    	int tStatus = 0;
    	int tPercent = 0;
    	int tRawPercent = 0;
    	int tValue = 0;
    
    	((void(__fastcall*)(DWORD_PTR, wGUID&, int&, int&, int&, int&))(Hook::baseAddress + 0x1865710))(a1->addr, otherUnit->wguid, tStatus, tPercent, tRawPercent, tValue);
    
    	std::cout << tStatus << " " << tPercent << " " << tRawPercent << " " << tValue << " " << std::endl;
    
    	return tPercent; 
    }

    [Help][SL 9.2.7] CGPlayer CalculateThreat
  2. #2
    scizzydo's Avatar Contributor
    Reputation
    137
    Join Date
    Oct 2019
    Posts
    99
    Thanks G/R
    5/57
    Trade Feedback
    0 (0%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Maybe try calling it the same way as the binary? Correct data types, and correct passing. You decided to change it all from what you write at the top, to how it's actually used

    Also worth noting, that if you're calling it against training dummies, you usually don't have threat on those. Make sure you're testing it on a monster attacking you
    Last edited by scizzydo; 04-06-2024 at 03:11 PM.

  3. #3
    scizzydo's Avatar Contributor
    Reputation
    137
    Join Date
    Oct 2019
    Posts
    99
    Thanks G/R
    5/57
    Trade Feedback
    0 (0%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just tested on retail, and it does indeed work. However, I feel the confusion comes from the way it's called.
    Code:
    inline bool(__fastcall* CGUnit_C__GetThreatSituation)(void* pObj, WoWGUID* guid, bool* status, uint8_t* rawthreatpct, float* threatpct, uint64_t* threatvalue) = nullptr;
    The confusion happens in the pObj & GUID. In the lua function, arg1 is the "unit" and arg2 is the "target", however, in the lua what happens is arg1 "unit" is the GUID in this case, and the arg2 "target" is the pObj

    Code:
    auto result = CGUnit_C__GetThreatSituation(pObj, &guid, &status, &rawthreatpct, &threatpct, &threatvalue);
    std::cout << "Result: " << result << std::endl;
    std::cout << "Status: " << status << std::endl;
    std::cout << "rawthreatpct: " << (uint32_t)rawthreatpct << std::endl;
    std::cout << "threatpct: " << threatpct << std::endl;
    std::cout << "threatvalue: " << threatvalue << std::endl;

  4. Thanks Trogg (1 members gave Thanks to scizzydo for this useful post)
  5. #4
    Trogg's Avatar Member
    Reputation
    1
    Join Date
    Feb 2024
    Posts
    18
    Thanks G/R
    12/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my current call is:
    Code:
     typedef bool(__fastcall* _ThreatPercentFor)(void* addr, wGUID* guid, bool* tStatus, uint8_t* tPercent, float* tRawPercent, uint64_t* tValue);
    I’m not sure that the output data types are correct, the function in 3.3.5 looks exactly the same, but in fact the output was ints
    Code:
    bool ThreatPercentFor(Unit* a1, Unit* otherUnit)
    {
    	auto addr = a1->addr;
    	void* addrv = &addr;
    	wGUID guid = otherUnit->wguid;
    	bool tStatus = 0;
    	uint8_t tPercent = 0;
    	float tRawPercent = 0;
    	uint64_t tValue = 0;
    	_ThreatPercentFor Threat = (_ThreatPercentFor)(0x1865710 + Hook::baseAddress);
    	bool res = Threat(addrv, &guid, &tStatus, &tPercent, &tRawPercent, &tValue);
    
    	std::cout << "Result: " << res << std::endl;
    	std::cout << "Status: " << tStatus << std::endl;
    	std::cout << "rawthreatpct: " << (uint32_t)tPercent << std::endl;
    	std::cout << "threatpct: " << tRawPercent << std::endl;
    	std::cout << "threatvalue: " << tValue << std::endl;
    	return res;
    }
    on each call, no matter, in combat or not with target it returns
    Code:
    Result: 0
    Status: 0
    rawthreatpct: 0
    threatpct: 0
    threatvalue: 0
    v8 = *(_DWORD *)(a1 + 5816);
    a1 - address of unit1

    v20 = *a2;
    v9 = (unsigned int)(-691005195 * LODWORD(v20.low) - 1565916357 * LODWORD(v20.high)+ ((3603962101u * v20.low + 2729050939u * v20.high) >> 32)) % v8;
    *a2 - pointer to WGUID of unit2
    others parrameters are the same
    Last edited by Trogg; 04-07-2024 at 06:20 AM.

  6. #5
    scizzydo's Avatar Contributor
    Reputation
    137
    Join Date
    Oct 2019
    Posts
    99
    Thanks G/R
    5/57
    Trade Feedback
    0 (0%)
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    3.3.5 pointers were 32 bit (so ints). But, looking at your test, your addr is wrong. You want to pass addr, not addrv. You also aren't doing it how I explained with them flipped. So, depending on what you're testing on you may not get anything. addr is the "other unit" and guid is your "a1" guid

  7. Thanks Trogg (1 members gave Thanks to scizzydo for this useful post)
  8. #6
    Trogg's Avatar Member
    Reputation
    1
    Join Date
    Feb 2024
    Posts
    18
    Thanks G/R
    12/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, thanks, solved

Similar Threads

  1. [Help][SL 9.2.7] CGPlayer Auras
    By Trogg in forum WoW Memory Editing
    Replies: 11
    Last Post: 04-07-2024, 05:34 PM
  2. [Help][SL 9.2.7] Find type of animation
    By Trogg in forum WoW Memory Editing
    Replies: 2
    Last Post: 03-20-2024, 02:42 PM
  3. Help WoW Fish-Bot
    By Eliteplague in forum World of Warcraft General
    Replies: 1
    Last Post: 05-07-2006, 08:36 PM
  4. Hit points and talent points? Please help
    By hankusdankus in forum World of Warcraft General
    Replies: 6
    Last Post: 05-04-2006, 02:00 PM
  5. bot help
    By xwhitedeathx in forum World of Warcraft General
    Replies: 3
    Last Post: 05-01-2006, 03:50 AM
All times are GMT -5. The time now is 02:55 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search