예제 #1
0
 def OnSessionMutated(self, isremote, session, change):
     if not self.useJumpMonitor:
         return
     try:
         if type(session) == types.TupleType:
             if len(session) == 1 and session[0] >= const.minFakeItem:
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'wormhole %s' % session[0]
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsStargate(session[0]) and util.IsStargate(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'stargate %d->%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsPlayerItem(session[0]) and util.IsSolarSystem(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'pos cyno array:%d' % (session[0],)
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsPlayerItem(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'bridge src:%s dst:%d in:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsCharacter(session[0]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'cyno char:%s cyno:%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 4 and util.IsCharacter(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[3]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'ship bridge char:%s-%s cyno:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
     except:
         sys.exc_clear()
예제 #2
0
 def OnSessionMutated(self, isremote, session, change):
     """
         OnSessionMutated is called on the client, by the client when certain jump events
         are requested. The only way to differentiate between jump types is to observe the 
         change dictionnary and trap known patterns.    
         
         Current patterns of change are:
             wormhole jump: chnage contains a single value, the wormhole object. Which 
                 is a fake item not in the DB
             stargate jump: the clean one really, change contains 2 values, both stargates itemID
             cyno jump: 3 value tuple, of the form: character holding the cyno, cyno itemID 
                 (which is fakeItem too) and destination solarsystem
     """
     if not self.useJumpMonitor:
         return
     try:
         if type(session) == types.TupleType:
             if len(session) == 1 and session[0] >= const.minFakeItem:
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'wormhole %s' % session[0]
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsStargate(session[0]) and util.IsStargate(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'stargate %d->%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 2 and util.IsPlayerItem(session[0]) and util.IsSolarSystem(session[1]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'pos cyno array:%d' % (session[0],)
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsPlayerItem(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'bridge src:%s dst:%d in:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
             elif len(session) == 3 and util.IsCharacter(session[0]) and util.IsSolarSystem(session[2]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'cyno char:%s cyno:%d' % (session[0], session[1])
                 self.checkBallpark = True
             elif len(session) == 4 and util.IsCharacter(session[0]) and util.IsPlayerItem(session[1]) and util.IsSolarSystem(session[3]):
                 self.jumpStartTime = blue.os.GetWallclockTime()
                 self.jumpType = 'ship bridge char:%s-%s cyno:%d' % (session[0], session[1], session[2])
                 self.checkBallpark = True
     except:
         sys.exc_clear()
예제 #3
0
def CheckSameStation(invItem):
    if session.stationid2:
        if invItem.locationID == session.stationid2:
            return 1
        if isinstance(
                invItem, blue.DBRow
        ) and 'stationID' in invItem.__columns__ and invItem.stationID == session.stationid2:
            return 1
        if CheckIfInPrimedOffice(invItem):
            return 1
        if util.IsPlayerItem(invItem.locationID) and sm.GetService(
                'invCache').IsInventoryPrimedAndListed(invItem.locationID):
            return 1
    return 0
def CheckSameLocation(invItem):
    inSameLocation = 0
    if session.stationid:
        if invItem.locationID == session.stationid:
            inSameLocation = 1
        elif util.IsPlayerItem(invItem.locationID):
            inSameLocation = 1
        else:
            office = sm.StartService('corp').GetOffice_NoWireTrip()
            if office is not None:
                if invItem.locationID == office.itemID:
                    inSameLocation = 1
    if invItem.locationID == session.shipid and invItem.flagID != const.flagShipHangar:
        inSameLocation = 1
    elif session.solarsystemid and invItem.locationID == session.solarsystemid:
        inSameLocation = 1
    return inSameLocation
def CheckSameStation(invItem):
    inSameLocation = 0
    if session.stationid2:
        if invItem.locationID == session.stationid2:
            inSameLocation = 1
        elif util.IsPlayerItem(invItem.locationID):
            if 'stationID' in invItem.__columns__:
                if invItem.stationID == session.stationid2:
                    inSameLocation = 1
            else:
                inSameLocation = 1
        else:
            office = sm.StartService('corp').GetOffice_NoWireTrip()
            if office is not None:
                if invItem.locationID == office.itemID:
                    inSameLocation = 1
    return inSameLocation
예제 #6
0
 def GetStructureInfo(self, structureID):
     if not util.IsPlayerItem(structureID):
         return None
     if structureID not in self.knownStructures:
         self.knownStructures[structureID] = sm.RemoteSvc(REMOTESVC).GetStructureInfo(structureID)
     return self.knownStructures[structureID]