- Code: Select all
// EIP = 0x00445901
int PLAYER::GetPlayerWeaponSpeed(void)
{
// part 1: determine speed
WEAPON weapon = this->GetWeaponInHand();
int WeaponSpeed = 50; // wrestling speed
if(weapon != NULL)
weaponSpeed = weapon->GetSpeed();
// part 2: math
int dividor = weaponSpeed;
dividor = dividor * (GetRealDexterity() + 100);
if(dividor < 2000)
return 20;
return 40000 / dividor;
}
// EIP=0x00445981
void PLAYER::AdvanceSwingState(void)
{
// EIP=0x0044598A
WEAPON weapon = this->GetWeaponInHand();
// EIP=0x00445995
int SwingDuration = this->GetPlayerWeaponSpeed() * 2;
// EIP=0x004459A2
int DurationSecondState= (weapon != NULL) && weapon->ISRanged() ? 4 : 6; // archery 4, otherwise 6
// EIP=0x004459C4
DurationSecondState= SwingDuration <= DurationSecondState? 0 : SwingDuration - DurationSecondState;
// EIP=0x004459E7
int InitialDuration= DurationSecondState<= 4 ? 0 : DurationSecondState- 4;
// EIP=0x00445A02
int SwingState= this->SwingState;
switch(SwingState)
{
case 0: if(this->SwingCounter >= InitialDuration)
{
this->SwingState = 1; // advance to next SwingState
this->SwingCounter = InitialDuration;
}
break;
case 1: if(this->SwingCounter >= DurationSecondState)
{
this->SwingState = 2; // advance to next SwingState
this->SwingCounter = DurationSecondState;
}
break;
default: if(this->SwingCounter > SwingDuration)
{
this->SwingState = 0; // begin a new swing
this->SwingCounter = 0;
return 3;
}
}
return this->SwingState; // 0 or 1 or 2
}
// EIP=0x00445AB0
void PLAYER::ResetSwingState(int TargetState)
{
if(TargetState == 0)
{
this->SwingCounter = 0;
this->SwingState = 0x318 = TargetState; // will be 0
}
else
{
this->SwingState = TargetState - 1; // will be 0 too
// (TargetState is always 1)
this->AdvanceSwingState(); // this->SwingState will now be 1...
}
}
Inside the Attack function "ResetSwingState(0)" is called, exact conditions are currently unknown
The mobile variable at address 0x314 (SwingCounter) (integer) gets increased, 1 by 1 per tick up to 1000, regardless your combat mode!
"AdvanceSwingState()" is called from inside the CombatHearBeat function too.
EDIT: code clean-up & bug-fix with "return 3" in AdvanceSwingState