UncleDan / pardus-infocenter

Information sharing tool for the MMOBG Pardus
GNU General Public License v3.0
4 stars 3 forks source link

Combats.php broken with raid logs #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
money raid log and probably others break combat.php

fix:

replace the appropriate lines in combat.php with

    foreach ($combats as $cmbt):
        if ($cmbt->getType() == "Ship vs NPC" || $cmbt->getType() == "Ship vs Ship"):
            $cr = split(";", $cmbt->getData());
            $len = count($cr);
            $stats = $len-9;
            for($i=1;$i<16;$i++){
                if($cr[$len-$i] =="E") $stats=$len-$i;
            }

?>
    combats.push({
        attacker: {
            name: <?php printf("\"%s\"", $cmbt->getAttacker())?>,
            image: <?php printf("\"%s\"", $cr[1])?>,
            isNPC: <?php echo((int) (stripos($npcImages, $cr[1]) !== false))?>,
            hullA: <?php echo($cr[2])?>,
            armourA: <?php echo($cr[3])?>,
            shieldA: <?php echo($cr[4])?>,
            hullB: <?php echo($cr[$stats + 1])?>,
            armourB: <?php echo($cr[$stats + 2])?>,
            shieldB: <?php echo($cr[$stats + 3])?>
        },
        defender: {
            name: <?php printf("\"%s\"", $cmbt->getDefender())?>,
            image: <?php printf("\"%s\"", $cr[6])?>,
            isNPC: <?php echo((int) (stripos($npcImages, $cr[6]) !== false))?>,
            hullA: <?php echo($cr[7])?>,
            armourA: <?php echo($cr[8])?>,
            shieldA: <?php echo($cr[9])?>,
            hullB: <?php echo($cr[$stats + 5])?>,
            armourB: <?php echo($cr[$stats + 6])?>,
            shieldB: <?php echo($cr[$stats + 7])?>
        }

Original issue reported on code.google.com by spoilerh...@gmail.com on 5 Mar 2012 at 11:10

GoogleCodeExporter commented 9 years ago
actually a much better fix: (this one works with multiple raided stuff as well

        foreach ($combats as $cmbt):
                if ($cmbt->getType() == "Ship vs NPC" || $cmbt->getType() == "Ship vs Ship"):
                        $cr = split(";", $cmbt->getData());
                        $len = count($cr);
                        $stats = $len-9;
                        for($i=1;$i<=$len;$i++){
                                if($cr[$len-$i] =="E") $stats=$len-$i;
                        }

?>
        combats.push({
                attacker: {
                        name: <?php printf("\"%s\"", $cmbt->getAttacker())?>,
                        image: <?php printf("\"%s\"", $cr[1])?>,
                        isNPC: <?php echo((int) (stripos($npcImages, $cr[1]) !== false))?>,
                        hullA: <?php echo($cr[2])?>,
                        armourA: <?php echo($cr[3])?>,
                        shieldA: <?php echo($cr[4])?>,
                        hullB: <?php echo($cr[$stats + 1])?>,
                        armourB: <?php echo($cr[$stats + 2])?>,
                        shieldB: <?php echo($cr[$stats + 3])?>
                },
                defender: {
                        name: <?php printf("\"%s\"", $cmbt->getDefender())?>,
                        image: <?php printf("\"%s\"", $cr[6])?>,
                        isNPC: <?php echo((int) (stripos($npcImages, $cr[6]) !== false))?>,
                        hullA: <?php echo($cr[7])?>,
                        armourA: <?php echo($cr[8])?>,
                        shieldA: <?php echo($cr[9])?>,
                        hullB: <?php echo($cr[$stats + 5])?>,
                        armourB: <?php echo($cr[$stats + 6])?>,
                        shieldB: <?php echo($cr[$stats + 7])?>
                }
        });

Original comment by spoilerh...@gmail.com on 11 Mar 2012 at 12:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed in release 1.6.9. Thanks.

Original comment by uncledan74 on 11 Mar 2012 at 3:25