ThaPwned / WCS

Warcraft: Source using Source.Python to be faster, expandable, and flexible
GNU General Public License v3.0
30 stars 23 forks source link

Conversion from index exceptions #67

Closed NosferatuJoe closed 2 years ago

NosferatuJoe commented 3 years ago

I'm getting quite frequent userid conversion errors. Although they are probably harmless I thought to post them here to keep it logged.

2021-04-12 09:31:15 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/commandsx/commandsx.py", line 190, in set_model
    Player.from_userid(userid).color = Color(255, 255, 255, 255)
  File "../addons/source-python/packages/source-python/players/_base.py", line 109, in from_userid
    return cls(index_from_userid(userid), caching=caching)

ValueError: Conversion from "Userid" (159) to "Index" failed.

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/wcs/wcs.py", line 1365, in on_take_damage_alive
    if ffa_enabled or not wcsvictim.player.team_index == wcsattacker.player.team_index:
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 751, in player
    return _Player(self.index)
  File "../addons/source-python/packages/source-python/entities/_base.py", line 132, in __call__
    obj = super().__call__(index)
  File "../addons/source-python/packages/source-python/players/_base.py", line 96, in __init__
    PlayerMixin.__init__(self, index)

ValueError: Conversion from "Index" (3) to "BaseEntity" failed.

2021-04-12 12:25:10 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/events/hooks.py", line 222, in _pre_game_event
    current_action = callback(game_event)
  File "../addons/source-python/plugins/wcs/wcs.py", line 735, in pre_player_hurt
    wcsattacker = Player.from_userid(attacker)
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 892, in from_userid
    return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (269) to "Index" failed.

2021-04-12 12:25:10 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/events/listener.py", line 92, in fire_game_event
    callback(game_event)
  File "../addons/source-python/plugins/wcs/wcs.py", line 702, in player_hurt
    wcsattacker = Player.from_userid(attacker)
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 892, in from_userid
    return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (269) to "Index" failed.

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/wcs/wcs.py", line 1365, in on_take_damage_alive
    if ffa_enabled or not wcsvictim.player.team_index == wcsattacker.player.team_index:
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 751, in player
    return _Player(self.index)
  File "../addons/source-python/packages/source-python/entities/_base.py", line 132, in __call__
    obj = super().__call__(index)
  File "../addons/source-python/packages/source-python/players/_base.py", line 96, in __init__
    PlayerMixin.__init__(self, index)

ValueError: Conversion from "Index" (3) to "BaseEntity" failed.

2021-04-12 12:25:11 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/events/hooks.py", line 222, in _pre_game_event
    current_action = callback(game_event)
  File "../addons/source-python/plugins/wcs/wcs.py", line 735, in pre_player_hurt
    wcsattacker = Player.from_userid(attacker)
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 892, in from_userid
    return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (269) to "Index" failed.

2021-04-12 18:02:56 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/wcs/wcs.py", line 1365, in on_take_damage_alive
    if ffa_enabled or not wcsvictim.player.team_index == wcsattacker.player.team_index:
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 751, in player
    return _Player(self.index)
  File "../addons/source-python/packages/source-python/entities/_base.py", line 132, in __call__
    obj = super().__call__(index)
  File "../addons/source-python/packages/source-python/players/_base.py", line 96, in __init__
    PlayerMixin.__init__(self, index)

ValueError: Conversion from "Index" (13) to "BaseEntity" failed.

2021-04-12 18:02:56 - sp    -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/events/listener.py", line 92, in fire_game_event
    callback(game_event)
  File "../addons/source-python/plugins/wcs/wcs.py", line 702, in player_hurt
    wcsattacker = Player.from_userid(attacker)
  File "../addons/source-python/plugins/wcs/core/players/entity.py", line 892, in from_userid
    return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (456) to "Index" failed.
NosferatuJoe commented 3 years ago

Exception has been reported to be thrown when a player leaves the game, exception is harmless.

ManifestManah commented 3 years ago

I will be taking a look in to this as it is technically not part of the core, but part of the WCS Essentials. :-)

ThaPwned commented 2 years ago

As @ManifestManah mentions, this is not part of the core. The only one is the last one but I'm unable to reproduce it on the newest version.