Exemplo n.º 1
0
        def conv(what):
            if isinstance(what, unicode):
                return what.encode('ascii', 'replace')
            return str(what)

        s = ' '.join(map(conv, what))

    logmodule.general.Log(s.replace('\x00', '\\0'), severity)


def LogInfo(*what):
    _Log(logmodule.LGINFO, what)


def LogNotice(*what):
    _Log(logmodule.LGNOTICE, what)


def LogWarn(*what):
    _Log(logmodule.LGWARN, what)


def LogError(*what):
    _Log(logmodule.LGERR, what)


LogException = logmodule.LogException
import carbon.common.script.util.autoexport as autoexport

exports = autoexport.AutoExports('log', locals())
Exemplo n.º 2
0
        animInfo[const.animation.METADATA_IMPACT_POINT] = 0.5
    if const.animation.METADATA_START_DISTANCE not in animInfo:
        animInfo[const.animation.METADATA_START_DISTANCE] = 0.5
    return animInfo


def GetRelativeLookAtVector(sourcePosition, sourceRotation, targetPosition):
    lookAtVector = geo2.Vec3Subtract(targetPosition, sourcePosition)
    yaw, trash, trash = geo2.QuaternionRotationGetYawPitchRoll(sourceRotation)
    yaw = -yaw
    relativeLookAtVector = (lookAtVector[0] * math.cos(yaw) +
                            lookAtVector[2] * math.sin(yaw), lookAtVector[1],
                            -lookAtVector[0] * math.sin(yaw) +
                            lookAtVector[2] * math.cos(yaw))
    return relativeLookAtVector


def GetMaxLookAtWeight_Facing(ent, targetPos):
    sourcePos = ent.GetComponent('position').position
    sourceRot = ent.GetComponent('position').rotation
    source2Target = geo2.Vec3Subtract(targetPos, sourcePos)
    source2Target = geo2.Vec3Normalize(source2Target)
    facingDir = mathCommon.CreateDirectionVectorFromYawAngle(
        geo2.QuaternionRotationGetYawPitchRoll(sourceRot)[0])
    dot = geo2.Vec3Dot(source2Target, facingDir)
    return max(dot, 0)


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('animUtils', globals())
Exemplo n.º 3
0
            if const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector and not playerIsDirector:
                return 1
            if myBaseID != playersBaseID:
                return 0
            if myGrantableRolesAtBase & roleID != roleID:
                return 0
        elif roleGroup.appliesTo == 'rolesAtOther':
            if myGrantableRolesAtOther & roleID != roleID:
                return 0
        return 1


def CanEditBase(playerIsCEO, IAmCEO, IAmDirector):
    if playerIsCEO:
        if IAmCEO:
            return 1
    else:
        if IAmCEO:
            return 1
        if IAmDirector:
            return 1
    return 0


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('corputil', locals())
exports = {
    'corputil.CanEditRole': CanEditRole,
    'corputil.CanEditBase': CanEditBase
}
Exemplo n.º 4
0
    """
    diameter = 2 * radius
    hasPole = True
    if latitude - radius < 0.0 or diameter / math.cos(latitude - radius - MATH_PI_DIV_2) > MATH_2PI:
        minLatitude, maxLatitude = 0.0, latitude + radius
        minLongitude, maxLongitude = 0.0, MATH_2PI
    elif latitude + radius > math.pi or diameter / math.cos(latitude + radius - MATH_PI_DIV_2) > MATH_2PI:
        minLatitude, maxLatitude = latitude - radius, math.pi
        minLongitude, maxLongitude = 0.0, MATH_2PI
    else:
        minLatitude, maxLatitude = latitude - radius, latitude + radius
        minLongitude, maxLongitude = longitude - radius, longitude + radius
        hasPole = False
    latitudeStepSize = (maxLatitude - minLatitude) / (numSamplesPerAxis - 1)
    longitudeStepSize = (maxLongitude - minLongitude) / (numSamplesPerAxis - 1)
    _latitude = 0
    for x in xrange(numSamplesPerAxis):
        _latitude = minLatitude + x * latitudeStepSize
        for y in xrange(numSamplesPerAxis):
            if hasPole:
                _longitude = minLongitude + y * longitudeStepSize
            else:
                tempDiameter = diameter / math.cos(_latitude - MATH_PI_DIV_2)
                tempStepSize = 1.0 / (numSamplesPerAxis - 1) * tempDiameter
                _longitude = longitude - tempDiameter * 0.5 + y * tempStepSize
            yield (_latitude, _longitude)


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('planetUtil', locals())
Exemplo n.º 5
0

def FindTextBoundaries(text, regexObject=None):
    regexObject = regexObject or uiconst.LINE_BREAK_BOUNDARY_REGEX
    return [token for token in regexObject.split(text) if token]


def ReplaceStringWithTags(string, old=' ', new='<br>'):
    tagSplit = re.split('(<.*?>)', string)
    ret = u''
    for part in tagSplit:
        if part.startswith('<'):
            ret += part
            continue
        ret += part.replace(old, new)

    return ret


def SanitizeFilename(filename, replacementChar='_'):
    invalidChars = '\\/:*?"<>|'
    validatedName = filename
    for c in invalidChars:
        validatedName = validatedName.replace(c, replacementChar)

    return validatedName


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('uiutil', locals())
Exemplo n.º 6
0
MATERIAL_RUBBERMATS = 13
CLIMBABLE_FLAG = 65536 | MATERIAL_CONCRETE
LADDERTOP_FLAG = 131072 | MATERIAL_CONCRETE
DEFAULT_MATERIAL = MATERIAL_CONCRETE
MATERIAL_INDEXES = [
    MATERIAL_CONCRETE, MATERIAL_WOOD, MATERIAL_METAL, MATERIAL_GLASS,
    MATERIAL_CARDBOARD, MATERIAL_GRASS, MATERIAL_GRAVEL, MATERIAL_PLASTIC,
    MATERIAL_CARPET, MATERIAL_STONE, MATERIAL_WATER, MATERIAL_METALGRATE,
    MATERIAL_RUBBERMATS
]
MATERIAL_NAMES = {
    u'Invalid': MATERIAL_INVALID,
    u'Concrete': MATERIAL_CONCRETE,
    u'Wood': MATERIAL_WOOD,
    u'Metal': MATERIAL_METAL,
    u'Glass': MATERIAL_GLASS,
    u'Cardboard': MATERIAL_CARDBOARD,
    u'Grass': MATERIAL_GRASS,
    u'Gravel': MATERIAL_GRAVEL,
    u'Plastic': MATERIAL_PLASTIC,
    u'Carpet': MATERIAL_CARPET,
    u'Stone': MATERIAL_STONE,
    u'Water': MATERIAL_WATER,
    u'MetalGrate': MATERIAL_METALGRATE,
    u'RubberMats': MATERIAL_RUBBERMATS,
    u'Climbable': CLIMBABLE_FLAG,
    u'LadderTop': LADDERTOP_FLAG
}
import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('materialTypes', globals())
Exemplo n.º 7
0
                           typeID=typeInfo.typeID,
                           quantity=typeInfo.quantity)
        if typeInfo.isInput:
            inputs.append(data)
        else:
            outputs.append(data)

    return (inputs, outputs)


def GetSchematicDataByGroupID():
    schematics = GetSchematicData()
    ret = {}
    for schematic in schematics:
        groupID = cfg.invtypes.Get(schematic.output.typeID).groupID
        if groupID not in ret:
            ret[groupID] = []
        ret[groupID].append(schematic)

    return ret


def PinHasBeenBuilt(pinID):
    if isinstance(pinID, tuple):
        return False
    return True


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('planetCommon', locals())
Exemplo n.º 8
0
#Embedded file name: e:\jenkins\workspace\client_SERENITY\branches\release\SERENITY\eve\client\script\ui\station\worldspaceCustomizationDefinitions.py
DEFAULT_GALLENTE = 1000168
QUAFE_OWNER = 1000100
themeSettings = {
    const.raceAmarr: {},
    const.raceMinmatar: {},
    const.raceCaldari: {},
    const.raceJove: {},
    const.raceGallente: {}
}
import carbon.common.script.util.autoexport as autoexport

exports = autoexport.AutoExports('worldspaceCustomization', locals())
Exemplo n.º 9
0
        return geo2.Vec3Project(point, viewport,
                                self.projectionMatrix.transform,
                                self.viewMatrix.transform,
                                geo2.MatrixIdentity())

    def IsPointInViewport(self, point):
        """
            Takes a point in 3D space and determines whether this point is visible.
            It does not take in to account if the object is occluded.
        """
        point2D = self.ProjectPoint(point)
        if point2D[0] < trinity.device.viewport.x or point2D[
                0] > trinity.device.viewport.x + trinity.device.viewport.width or point2D[
                    1] < trinity.device.viewport.y or point2D[
                        1] > trinity.device.viewport.y + trinity.device.viewport.height or point2D[
                            2] < trinity.device.viewport.minZ or point2D[
                                2] > trinity.device.viewport.maxZ:
            return False
        return True

    def ResetBehaviors(self):
        """
            Calls Reset on all behaviors on this camera
        """
        for prio, behavior in self.cameraBehaviors:
            behavior.Reset()


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('cameras', globals())
            self.SetControlParameter('TurnAngle', 0)
        self.previousMoving = moving
        if self.renderDebugControlParameters:
            self.RenderDebugControlParameters(speed, deltaTurnAngle / math.pi,
                                              immed, applied)

    def ToggleDebugRenderControlParameters(self):
        self.renderDebugControlParameters = not self.renderDebugControlParameters

    def RenderDebugControlParameters(self, speed, turnAngle, immed, applied):
        debugRender = sm.GetService('debugRenderClient')
        if not debugRender.GetDebugRendering():
            debugRender.SetDebugRendering(True)
        text = 'Speed ' + str(speed) + '\n' + 'TurnAngle: ' + str(
            turnAngle) + '\n' + 'immed ' + str(
                immed) + '\n' + 'applied: ' + str(applied)
        position = self.entPos
        position = (position[0] + 0.5, position[1] +
                    self.entityRef.movement.characterController.height,
                    position[2])
        debugRender.RenderText(position,
                               text,
                               color=4294901760L,
                               time=0,
                               fade=False)


import carbon.common.script.util.autoexport as autoexport

exports = autoexport.AutoExports('animation', locals())
Exemplo n.º 11
0
def RunSymmetricalSingleNudeLODTest(iterations=20,
                                    coldCache=True,
                                    printStatistics=True):
    RunSymmetricalSingleDollLODTest(iterations=iterations,
                                    printStatistics=printStatistics)


def RunSymmetricalSingleClothedDollLODTest(iterations=20,
                                           coldCache=True,
                                           printStatistics=True):
    RunSymmetricalSingleDollLODTest(iterations=iterations,
                                    respaths=CollectCharacterSelectionPaths(),
                                    printStatistics=printStatistics)


def RunComprehensiveSymmetricalDollLODTest(iterations=20):
    def fun():
        RunSymmetricalSingleNudeLODTest(coldCache=True, iterations=iterations)
        RunSymmetricalSingleClothedDollLODTest(coldCache=True,
                                               iterations=iterations)
        RunSymmetricalSingleNudeLODTest(coldCache=False, iterations=iterations)
        RunSymmetricalSingleClothedDollLODTest(coldCache=False,
                                               iterations=iterations)

    uthread.new(fun)


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('paperDoll.testing', globals())
Exemplo n.º 12
0
"""
import blue
from carbon.common.lib.const import MIN


def CalculateDecayedInfluence(info):
    """Calculate the current influence is based upon the time since last update"""
    currentTime = blue.os.GetWallclockTime()
    return CalculateDecayedInfluenceWithTime(info.influence, info.lastUpdated,
                                             currentTime, info.decayRate,
                                             info.graceTime)


def CalculateDecayedInfluenceWithTime(influence, lastUpdated, currentTime,
                                      decayRate, graceTime):
    """Calculate the current influence is based upon the time since last update"""
    if decayRate > 0.0 and currentTime - graceTime * MIN > lastUpdated:
        timePastGrace = (currentTime - lastUpdated) / MIN - graceTime
        hourPast = max(timePastGrace / 60.0, 0.0)
        decay = decayRate * hourPast
        influence = influence - decay
    else:
        influence = influence
    if influence < 0.0001:
        influence = 0.0
    return influence


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('taleCommon', locals())
Exemplo n.º 13
0
        if ALL_BROADCASTS[idx] == messageName:
            break

    sm.GetService('infoGatheringMgr').LogInfoEventFromServer(
        const.infoEventFleetBroadcast, idx, int_1=1, int_2=scope)
    sm.GetService('fleetObjectHandler').LogPlayerEvent('Broadcast',
                                                       messageName, scope,
                                                       itemID)
    sm.GetService('fleetObjectHandler').LogPlayerEventJson(
        'Broadcast', broadcastName=messageName, scope=scope, targetID=itemID)


def IsOpenToCorp(fleet):
    return fleet.get('inviteScope', 0) & INVITE_CORP == INVITE_CORP


def IsOpenToAlliance(fleet):
    return fleet.get('inviteScope', 0) & INVITE_ALLIANCE == INVITE_ALLIANCE


def IsOpenToMilitia(fleet):
    return fleet.get('inviteScope', 0) & INVITE_MILITIA == INVITE_MILITIA


def IsOpenToPublic(fleet):
    return fleet.get('inviteScope', 0) & INVITE_PUBLIC == INVITE_PUBLIC


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('fleetcommon', locals())
        It supports loading in decals that might have been saved out before more attributes
        were added to the class.
        """
        inst = source
        if isinstance(source, basestring):
            inst = pdDm.LoadYamlFileNicely(source)
        projectedDecal = ProjectedDecal()
        for key, val in inst.__dict__.iteritems():
            if key in projectedDecal.__dict__:
                projectedDecal.__dict__[key] = val

        if inst.texturePath:
            projectedDecal.SetTexturePath(inst.texturePath)
        if inst.maskPath:
            projectedDecal.SetMaskPath(inst.maskPath)
        return projectedDecal

    @staticmethod
    def Save(source, resPath):
        """
        Dumps the source as text and saves it in a .proj file to the given respath.
        """
        f = file(resPath, 'w')
        yaml.dump(source, f, default_flow_style=False, Dumper=yaml.CDumper)
        f.flush()
        f.close()


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('paperDoll', locals())
Exemplo n.º 15
0

def RadToDeg(degs):
    return degs * RAD_2_DEG


def RayToPlaneIntersection(P, d, Q, n):
    """
    Computes the intersection of the ray defined by point P and direction d with the plane
    defined by the point Q and the normal n.
    
    If the P lies on the plane defined by n and Q, there are infinite number of 
    intersection points, so the function returns P.
    
    d' = - Q.Dot(n)
    t = -(n.Dot(P) + d' )/n.Dot(d)
    S = P + t*d
    """
    denom = geo2.Vec3Dot(n, d)
    if abs(denom) < 1e-05:
        return P
    else:
        distance = -geo2.Vec3Dot(Q, n)
        t = -(geo2.Vec3Dot(n, P) + distance) / denom
        S = geo2.Add(geo2.Scale(d, t), P)
        return S


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('mathUtil', locals())
Exemplo n.º 16
0
        if self.activeManipAxis in local_axis:
            axis = local_axis[self.activeManipAxis]
            if geo2.Vec3Dot(view, axis) > 0.0:
                norm = -axis
            else:
                norm = axis
        else:
            norm = view
        norm = geo2.Vec3Normalize(norm)
        return norm

    def _DiffProjectedPoint(self, ray, start):
        """
            Get the vector between the current previously projected point.
        """
        self.endPlanePos = RayToPlaneIntersection(start, ray,
                                                  self.GetTranslation(),
                                                  self.targetPlaneNormal)

    def _InternalUpdate(self):
        mat = CameraFacingMatrix(self.worldTranslation)
        warea = self.geometry.GetArea('w')
        wwarea = self.geometry.GetArea('ww')
        warea.localTransform = mat
        wwarea.localTransform = mat


import carbon.common.script.util.autoexport as autoexport

exports = autoexport.AutoExports('dungeonEditorTools', locals())
    """
    l = d.get(key, [])
    if type(l) != list:
        return []
    return l


@telemetry.ZONE_FUNCTION
def NastyYamlLoad(yamlStr):
    """
    Backwards compatiable load function that accepts persisted yaml files from the PaperDoll since
    before it was corified and moved to /Script.    
    """
    import paperDoll as PD
    sys.modules[PD.__name__] = PD
    instance = None
    try:
        blue.statistics.EnterZone('yaml.load')
        instance = yaml.load(yamlStr, Loader=yaml.CLoader)
    except Exception:
        log.LogError('PaperDoll: Yaml parsing failed for data', yamlStr)
    finally:
        blue.statistics.LeaveZone()
        del sys.modules[PD.__name__]

    return instance


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('paperDoll', globals())
Exemplo n.º 18
0
                           eventDustQuestComplete, eventDustQuestReceiveReward,
                           eventDustQuestGMReroll, eventDustQuestGMSetComplete,
                           eventDustQuestGMChangeProgress)
setDustPersonalWarbargeEvents = (
    eventDustWarbargePersonalWarbargeUpgrade,
    eventDustWarbargePersonalWarbargeModuleUpgrade,
    eventDustWarbargePersonalWarbargeModuleClaim,
    eventDustWarbargePersonalWarbargeModuleActive,
    eventDustWarbargePersonalWarbargeModuleDeactive,
    eventDustWarbargePersonalWarbargeSlotUpgrade,
    eventDustWarbargePersonalWarbargeUpgradeCDClear,
    eventDustWarbargePersonalWarbargeModuleUpgradeCDClear,
    eventDustWarbargePersonalWarbargeGMModifyWarbargeLevel,
    eventDustWarbargePersonalWarbargeGMModifyWarbargeModuleLevel,
    eventDustWarbargePersonalWarbargeGMModifyWarbargeUpgradeCD,
    eventDustWarbargePersonalWarbargeGMModifyWarbargeModuleUpgradeCD,
    eventDustWarbargePersonalWarbargeGMModifyWarbargeModuleLastClaimDate)
eventControlTowerAnchored = 364
eventControlTowerUnanchored = 365
eventControlTowerDestroyed = 366
eventSpaceComponentBeginActivating = 388
eventSpaceComponentActivated = 389
eventSpaceComponentDecayed = 390
eventSpaceComponentEnterReinforce = 391
eventSpaceComponentExitReinforce = 392
eventSpaceComponentDeployed = 393
eventSpaceComponentScooped = 394
eventSpaceComponentExploding = 395
import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('logConst', locals())
        typeID:         The inventory type ID of the item type being consumed. 
                        Cfg will be used to check group & category IDs.
        priorityBays:   A list of inventory flags to check first. Defaults to an empty list.
                        Also resets to an empty list if set to None.
        
        RETURNS
            A list of inventory flags to check for items.
    """
    baysToCheck = priorityBays
    if baysToCheck is None:
        baysToCheck = []
    if typeID in autoConsumeTypes:
        baysToCheck.extend(autoConsumeTypes[typeID])
    else:
        invType = cfg.invtypes.Get(typeID)
        if invType.groupID in autoConsumeGroups:
            baysToCheck.extend(autoConsumeGroups[invType.groupID])
        elif invType.categoryID in autoConsumeCategories:
            baysToCheck.extend(autoConsumeCategories[invType.categoryID])
    if const.flagCargo not in baysToCheck:
        baysToCheck.append(const.flagCargo)
    return baysToCheck


def GetNameForFlag(flagID):
    return localization.GetByLabel(inventoryFlagData[flagID]['name'])


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('inventoryFlagsCommon', locals())
Exemplo n.º 20
0
    'res:/UI/Texture/classes/hacking/lineBleed/horiz10.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz11.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz12.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz13.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz14.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz15.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz16.png',
    'res:/UI/Texture/classes/hacking/lineBleed/horiz17.png')
LINEBLEED_TEXTUREPATHS_DIAGONAL = (
    'res:/UI/Texture/classes/hacking/lineBleed/diag01.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag02.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag03.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag04.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag05.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag06.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag07.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag08.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag09.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag10.png',
    'res:/UI/Texture/classes/hacking/lineBleed/diag11.png')
LINEBLEED_SIZE_BY_LINETYPE = {
    LINETYPE_HORIZONTAL: (96, 50),
    LINETYPE_INCLINE: (64, 75),
    LINETYPE_DECLINE: (64, 75)
}
STAT_COHERENCE = 1
STAT_STRENGTH = 2
UTILITYELEMENT_SPACING = 34
import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('hackingUIConst', locals())
Exemplo n.º 21
0
        """
        timeVal = self.Seconds() * const.SEC
        showTo = 'minute'
        if _displaySeconds:
            showTo = 'second'
        return localization.formatters.FormatTimeIntervalWritten(timeVal, showFrom='year', showTo=showTo)

    def __repr__(self):
        label = localization.GetByLabel('/Carbon/UI/Common/DateTimeQuantity/DateTimeShort3Elements', value1=int(self.Hours()), value2=int(self.Minutes() % 60), value3=int(self.Seconds() % 60))
        return '<Time: %s>' % label


_liveWatchSpan = Hours(24)
_testWatchSpan = Minutes(24)
_liveAllowedTime = Hours(3)
_testAllowedTime = Minutes(3)
_liveSchedule = [(NoTime(), lambda blah: KickPlayer()),
 (Minutes(5), TimeWarning),
 (Minutes(15), TimeWarning),
 (Hours(1), TimeWarning),
 (Hours(2), TimeWarning)]
_testSchedule = [(NoTime(), lambda blah: KickPlayer()),
 (Seconds(5), TimeWarning),
 (Seconds(15), TimeWarning),
 (Minutes(1), TimeWarning),
 (Minutes(2), TimeWarning)]
_liveSavePeriod = Minutes(1)
_testSavePeriod = Seconds(1)
import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('antiaddiction', locals())
Exemplo n.º 22
0
#Embedded file name: eve/client/script/util\bubble.py
"""
Utility functions related to Michelle's ballpark. 

They are here so we don't bloat the interface of michelle.Park with stuff that
can be defined in terms of the existing interface.
"""


def SlimItemFromCharID(charID):
    """
    Used to find a ship by pilot charID in bubble.
    """
    bp = sm.GetService('michelle').GetBallpark()
    if bp:
        for item in bp.slimItems.values():
            if item.charID == charID:
                return item


def InBubble(itemID):
    bp = sm.GetService('michelle').GetBallpark()
    if bp:
        return itemID in bp.balls
    else:
        return False


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('util', globals())
Exemplo n.º 23
0
class LegendItem(object):
    """
    Wrapping legend item entries in a fuzzy warm cloak before this tuple stuff gets out of hand
    We wants it to sort correctly and to fit into sets for easy duplication removal
    """
    def __init__(self, order, caption, color, data=None, highlight=True):
        """
        caption: this is the text that is displayed in the legend list
        color: this is the color that is in the color box on the legend entry
        data: arbitrary data item, usualy factionID/allianceID/regionID etc.
        highlight: this enables or disables highlighting
        order: this is used to sort the legend entries can be text or numbers, defaults to caption if None
        """
        self.order = order
        self.caption = caption
        self.color = color
        self.data = data
        self.highlight = highlight

    def __cmp__(self, other):
        """for some proper sorting"""
        return cmp((self.order, self.caption), (other.order, self.caption))

    def __hash__(self):
        """for set compatability, duplicate removal"""
        return hash(self.caption)


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('mapcommon', locals())
Exemplo n.º 24
0
def GetLPUpgradeLevel(lps):
    for i, threshold in enumerate(const.facwarSolarSystemUpgradeThresholds):
        if lps < threshold:
            return i

    return i + 1


def GetAdjustedFeePercentage(solarSystemID, factionID, feePercentage):
    level = GetSolarSystemUpgradeLevel(solarSystemID, factionID)
    return feePercentage * (1 - 0.1 * level)


def GetDonationTax(factionID):
    if boot.role == 'client':
        facwarSvc = sm.GetService('facwar')
        zoneInfo = facwarSvc.GetFacWarZoneInfo(factionID)
        percentControlled = zoneInfo.factionPoints / zoneInfo.maxWarZonePoints
    else:
        facWarZoneMgr = sm.GetService('facWarZoneMgr')
        points, maxPoints = facWarZoneMgr.GetZonePoints(factionID)
        percentControlled = points / maxPoints
    rawTax = 5 * math.pow(percentControlled, 3)
    donationTax = round(1 - 1 / (1 + rawTax), 2)
    return donationTax


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('facwarCommon', locals())
Exemplo n.º 25
0
        deltaY = deltaY / divideBy
        self.currAverageDeltaX = deltaX / self.mouseLookSpeed
        self.currAverageDeltaY = deltaY / self.mouseLookSpeed
        activeCamera.SetDesiredMouseDelta(deltaX, deltaY)

    def CameraLoop(self):
        while self.state != service.SERVICE_STOPPED:
            if self.enabled:
                self.TickCamera()
            blue.pyos.synchro.SleepWallclock(5)

    def TickCamera(self):
        try:
            activeCam = self.GetActiveCamera()
            if self.mouseSmooth:
                self.ApplyMouseDeltaMoveSmoothing(activeCam)
            else:
                activeCam.SetDesiredMouseDelta(self.desiredDeltaX,
                                               self.desiredDeltaY)
                self.desiredDeltaX = 0
                self.desiredDeltaY = 0
            activeCam.UpdateProjectionMatrix()
            activeCam.Update()
        except Exception:
            log.LogException('Error in CameraLoop')
            sys.exc_clear()


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('cameras', locals())
Exemplo n.º 26
0
                          vivoxSvc.SetSpeakingChannel, (channel, )))
        elif type(channel) is not types.TupleType or not channel[0].startswith(
                'inst'):
            m.append((uiutil.MenuLabel('UI/Chat/ChannelWindow/JoinChannel'),
                      vivoxSvc.JoinChannel, (channel, )))
        m.append(None)
    m += sm.GetService('menu').CharacterMenu(charID)
    return m


def GetBroadcastScopeName(scope, where=fleetConst.BROADCAST_UNIVERSE):
    labelName = broadcastScopes.get(scope, {}).get(
        where, 'UI/Fleet/FleetBroadcast/BroadcastRangeAll')
    return localization.GetByLabel(labelName)


def GetBroadcastWhere(name):
    return broadcastRanges.get(name, defaultBroadcastRange)


def GetBroadcastWhereName(scope):
    return localization.GetByLabel(broadcastRangeNames[scope])


def GetBroadcastName(broadcastType):
    return localization.GetByLabel(broadcastNames[broadcastType])


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('fleetbr', locals())
Exemplo n.º 27
0
    stats['loadObjectShared'] = 0
    stats['getResourceCalls'] = 0
    stats['getResourceCacheHits'] = 0
    stats['getResourceShared'] = 0
    stats['loadObject'] = 0
    stats['frameTimeAbove100ms'] = 0
    stats['frameTimeAbove200ms'] = 0
    stats['frameTimeAbove300ms'] = 0
    stats['frameTimeAbove400ms'] = 0
    stats['frameTimeAbove500ms'] = 0
    stats['browserRequests'] = 0
    stats['trinityPlatform'] = 0
    stats['logInfo'] = 0
    stats['logNotice'] = 0
    stats['logWarn'] = 0
    stats['logErr'] = 0
    stats['bytesDownloaded'] = 0
    stats['bytesDownloaded'] = 0
    stats['pretransferTime'] = 0
    stats['downloadTime'] = 0
    stats['failedDownloadsPrimary'] = 0
    stats['failedDownloadsSecondary'] = 0
    stats['corruptDownloads'] = 0
    stats['corruptFiles'] = 0
    stats['timesliceWarnings'] = 0
    return stats


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('clientStatsCommon', locals())
Exemplo n.º 28
0
 RAGEQUITGROUP,
 SELECTIONGROUP]

def GetMenuGroup(caption, *args):
    group = menuGroupsFromCaption.get(caption, None)
    return group


blacklist = ['UI/Chat/InviteToChat',
 'UI/Chat/StartConversation',
 'UI/CloneJump/OfferCloneInstallation',
 'UI/Commands/AddBountyToPilot',
 'UI/Commands/CapturePortrait',
 'UI/Commands/GiveMoney',
 'UI/Corporations/Common/AwardCorpMemberDecoration',
 'UI/Corporations/Common/EditCorpMember',
 'UI/Corporations/Common/ExpelCorpMember',
 'UI/Corporations/Common/TransferCorpCash',
 'UI/Corporations/Common/ViewCorpMemberDetails',
 'UI/Corporations/Common/SendInvite',
 'UI/Corporations/DeliverCorpStuffTo',
 'UI/Fleet/FormFleetWith',
 'UI/Fleet/InvitePilotToFleet',
 'UI/InfoWindow/ShowContracts',
 'UI/Market/TradeWithCharacter',
 'UI/PeopleAndPlaces/AddAllianceContact',
 'UI/PeopleAndPlaces/EditAllianceContact',
 'UI/PeopleAndPlaces/RemoveAllianceContact']
import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('menu', locals())
Exemplo n.º 29
0
    def ShowLines(self, *args):
        self.line.display = True
        self.trace.display = True

    def HideLines(self, *args):
        self.line.display = False
        self.trace.display = False

    def StopAnimations(self, *args):
        self.trace.StopAnimations()


def FixLines(target):
    """
    Defect : Other: Horizontal target lines are too short in 1900x1200 screen resolution 
    http://haven/ccpActive-MIS/DT2/issue.asp?ISID=18343
    """
    def FindLine(name):
        return getattr(target.lines, name)

    l, r, t, b = map(FindLine,
                     ['lineleft', 'lineright', 'linetop', 'linebottom'])
    l.left -= uicore.desktop.width - l.width
    l.width = r.width = uicore.desktop.width
    t.top -= uicore.desktop.height - t.height
    t.height = b.height = uicore.desktop.height


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('bracketUtils', locals())
Exemplo n.º 30
0
    ret.sort()
    return ret


def GetSolarSystemOptions():
    import uiutil, util, listentry
    validGroups = GetValidSolarsystemGroups()
    wantedGroups = GetVisibleSolarsystemBrackets()
    wantedHints = GetHintsOnSolarsystemBrackets()
    scrolllist = []
    for groupID in validGroups:
        data = util.KeyVal()
        data.visible = groupID in wantedGroups
        data.showhint = groupID in wantedHints
        data.groupID = groupID
        if type(groupID) in types.StringTypes:
            cerbString = {'bookmark': 'UI/Map/MapPallet/cbSolarSystem_bookmark',
             'scanresult': 'UI/Map/MapPallet/cbSolarSystem_scanresult'}[groupID]
            data.label = localization.GetByLabel(cerbString)
        else:
            data.label = cfg.invgroups.Get(groupID).name
        scrolllist.append((data.label, listentry.Get('BracketSelectorEntry', data=data)))

    if scrolllist:
        scrolllist = uiutil.SortListOfTuples(scrolllist)
    return scrolllist


import carbon.common.script.util.autoexport as autoexport
exports = autoexport.AutoExports('maputils', locals())