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

Weapons 12 and 13 are not mapped between Python and backend #87

Open
cetteup opened this issue Dec 19, 2024 · 0 comments
Open

Weapons 12 and 13 are not mapped between Python and backend #87

cetteup opened this issue Dec 19, 2024 · 0 comments

Comments

@cetteup
Copy link

cetteup commented Dec 19, 2024

In the Python world, weapon type 12 refers to claymores while 13 represents handgrenades.

WEAPON_TYPE_CLAYMORE = 12
WEAPON_TYPE_HANDGRENADE = 13

In the database, however, the meaning is reversed.

INSERT INTO `weapon` VALUES (12, 'Hand Grenade', 0, 1);
INSERT INTO `weapon` VALUES (13, 'Claymore', 1, 1);

Yet the mismatch is not resolved when processing snaphots, the weapon ids are used as-is.

$query->set('time', '+', $object->time);
$query->set('score', '+', $object->score);
$query->set('kills', '+', $object->kills);
$query->set('deaths', '+', $object->deaths);
$query->set('fired', '+', $object->fired);
$query->set('hits', '+', $object->hits);
$query->set('deployed', '+', $object->deployed);
$query->where('weapon_id', '=', $object->id);
$query->execute();

Meaning the data is stored incorrectly and the in-game BFHQ will show the reversed data. To fix this, the mismatch should be addressed when processing snapshots. Note that this will only fix future data, existing data will need to be migrated.

foreach ($player->weaponData as $object) {
    // Claymore (12/13) and hand grenade (13/12) are swapped in ASP/database compared to the Python constants
    switch ($object->id) {
        case 12:
            $weaponId = 13;
            break;
        case 13:
            $weaponId = 12;
            break;
        default:
            $weaponId = $object->id;
    }

    // ...
}
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

No branches or pull requests

1 participant