import logging try: import ujson as json except ImportError: try: import simplejson as json except ImportError: import json from pcounter.hwr import HwReceiver from pcounter.plugin import ICounter from pcounter.pctypes import enum logger = logging.getLogger("PCounter") USBIO_BIT = enum('COUNT', 'BONUS', 'CHANCE', 'SBONUS', 'LAST') N_BITS = USBIO_BIT.LAST BITMASK = (1 << USBIO_BIT.LAST) - 1 if sys.version_info[0] >= 3: unicode = str class PCounterError(Exception): pass class CountData(object): def __init__(self, colnames=None, *argnames): if colnames is None: colnames = []
# coding: utf-8 # vim: ts=4 sts=4 sw=4 et from pcounter.core import json, CountData, USBIO_BIT from pcounter.plugin import ICounter, UtilsMixin from pcounter.pctypes import enum from pcounter.util import (gen_bonusrate, bit_is_enable) STATE = enum('NORMAL', 'UFOZONE', 'XTRARUSH') class xfiles(ICounter, UtilsMixin): def __init__(self): self.state = STATE.NORMAL def createCountData(self): return CountData('count', 'totalcount', 'chancegames', 'normalgames', 'bonus', 'sbonus', 'xr', 'chain', 'chance') def on(self, cbittype, bitgroup, cd): if cbittype == USBIO_BIT.COUNT: cd.count += 1 cd.totalcount += 1 if bit_is_enable(bitgroup, USBIO_BIT.CHANCE): cd.chancegames += 1 # 直撃のEXTRA-RUSHは、最初の5回転のみではUFO-ZONEと見分けが # つかないため、UFO-ZONE状態中に5回転以上回ったら、直撃の # XTRA-RUSHだったと判定する。 if self.state == STATE.UFOZONE and cd.count > 5: self.state = STATE.EXTRARUSH