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

Fix missing entity in TargetOption #1

Closed
beheh opened this issue Aug 27, 2017 · 1 comment
Closed

Fix missing entity in TargetOption #1

beheh opened this issue Aug 27, 2017 · 1 comment
Assignees

Comments

@beheh
Copy link
Member

beheh commented Aug 27, 2017

The following options block from this power.log contains a player name not matching the Battletag. The generated HSReplay file is therefore missing the entity attribute on the Target block.

D 23:49:45.8759909 GameState.DebugPrintOptions() -   option 1 type=POWER mainEntity=[name=Gadgetzan Socialite id=43 zone=HAND zonePos=1 cardId=CFM_659 player=2] error=NONE errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 0 entity=[name=Anduin Wrynn id=64 zone=PLAY zonePos=0 cardId=HERO_09 player=1] error=NONE errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 1 entity=[name=Magni Bronzebeard id=66 zone=PLAY zonePos=0 cardId=HERO_01a player=2] error=NONE errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 2 entity=[name=Emerald Reaver id=47 zone=PLAY zonePos=1 cardId=UNG_803 player=2] error=NONE errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 3 entity=[name=Bloodsail Corsair id=33 zone=PLAY zonePos=1 cardId=NEW1_025 player=1] error=NONE errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 4 entity=GameEntity error=REQ_HERO_OR_MINION_TARGET errorParam=
D 23:49:45.8759909 GameState.DebugPrintOptions() -     target 5 entity=dan conley error=REQ_HERO_OR_MINION_TARGET errorParam=
D 23:49:45.8764913 GameState.DebugPrintOptions() -     target 6 entity=Carrot error=REQ_HERO_OR_MINION_TARGET errorParam=
D 23:49:45.8764913 GameState.DebugPrintOptions() -     target 7 entity=[name=Lesser Heal id=65 zone=PLAY zonePos=0 cardId=CS1h_001 player=1] error=REQ_HERO_OR_MINION_TARGET errorParam=
D 23:49:45.8764913 GameState.DebugPrintOptions() -     target 8 entity=[name=Armor Up! id=67 zone=PLAY zonePos=0 cardId=CS2_102_H1 player=2] error=REQ_HERO_OR_MINION_TARGET errorPar

HSReplay document with missing entity attribute on <Target/>:

<Option EntityName="Gadgetzan Socialite" entity="43" index="1" type="3">
	<Target EntityName="Anduin Wrynn" entity="64" index="0"/>
	<Target EntityName="Magni Bronzebeard" entity="66" index="1"/>
	<Target EntityName="Emerald Reaver" entity="47" index="2"/>
	<Target EntityName="Bloodsail Corsair" entity="33" index="3"/>
	<Target entity="1" error="33" index="4"/>
	<Target error="33" index="5"/>
	<Target entity="3" error="33" index="6"/>
	<Target EntityName="Lesser Heal" entity="65" error="33" index="7"/>
	<Target EntityName="Armor Up!" entity="67" error="33" index="8"/>
</Option>

The resulting XML cannot be reimported using HSReplayDocument.from_xml_file, since it erros with the following stacktrace:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
helpers.py:126: in __init__
    self.exporter = get_exporter_from_replay(path, is_power_log)
helpers.py:111: in get_exporter_from_replay
    packet_tree = replay.to_packet_tree()[0]
../../../redshift-env/lib/python3.4/site-packages/hsreplay/document.py:71: in to_packet_tree
    ret.append(game.export())
../../../redshift-env/lib/python3.4/site-packages/hsreplay/elements.py:90: in export
    tree.packets.append(node.export())
../../../redshift-env/lib/python3.4/site-packages/hsreplay/elements.py:343: in export
    packet.options.append(node.export(i))
../../../redshift-env/lib/python3.4/site-packages/hsreplay/elements.py:360: in export
    packet.options.append(node.export(i))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <OptionTargetNode>, id = 5

    def export(self, id):
            optype = "target"
            type = None
            packet = self.packet_class(
>                   self.ts, int(self.entity), id, type, optype,
                    self.error, self.errorParam
            )
E           TypeError: int() argument must be a string or a number, not 'NoneType'

../../../redshift-env/lib/python3.4/site-packages/hsreplay/elements.py:392: TypeError
@jleclanche
Copy link
Member

Issue moved to HearthSim/HSReplay #39 via ZenHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants