def __addDeadEntry(self, entry, id): """ adding death animation to minimap (WOTD-5884) """ if id in BigWorld.entities.keys(): m = self.__getEntryMatrixByLocation(id, entry['location']) scaledMatrix = None if self.__markerScale is not None: scaleMatrix = Matrix() scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale)) scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, m) if scaledMatrix is None: entry['handle'] = self.__ownUI.addEntry(m, self.zIndexManager.getDeadVehicleIndex(id)) else: entry['handle'] = self.__ownUI.addEntry(scaledMatrix, self.zIndexManager.getVehicleIndex(id)) self.__entries[id] = entry if not GUI_SETTINGS.permanentMinimapDeath: self.__deadCallbacks[id] = BigWorld.callback(GUI_SETTINGS.minimapDeathDuration / 1000, partial(self.__delEntry, id)) self.__callEntryFlash(id, 'setDead', [GUI_SETTINGS.permanentMinimapDeath]) self.__callEntryFlash(id, 'init', [entry['markerType'], entry['entryName'], entry['vClass'], '']) if self.__markerScale is None: self.__parentUI.call('minimap.entryInited', [])
def __addEntryLit(self, id, matrix, visible = True): battleCtx = g_sessionProvider.getCtx() if battleCtx.isObserver(id): return if matrix is None: return mp = Math.WGReplayAwaredSmoothTranslationOnlyMP() mp.source = matrix scaledMatrix = None if self.__markerScale is not None: scaleMatrix = Matrix() scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale)) scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, mp) if scaledMatrix is None: handle = self.__ownUI.addEntry(mp, self.zIndexManager.getVehicleIndex(id)) else: handle = self.__ownUI.addEntry(scaledMatrix, self.zIndexManager.getVehicleIndex(id)) entry = {'matrix': mp, 'handle': handle} arena = BigWorld.player().arena entryVehicle = arena.vehicles[id] entityName = battleCtx.getPlayerEntityName(id, entryVehicle.get('team')) markerType = entityName.base entryName = entityName.name() self.__entrieLits[id] = entry vName = entryVehicle['vehicleType'].type.shortUserString self.__ownUI.entryInvoke(entry['handle'], ('init', [markerType, entryName, 'lastLit', '', vName])) if not visible: self.__ownUI.entryInvoke(entry['handle'], ('setVisible', [visible])) if self.__markerScale is None: self.__parentUI.call('minimap.entryInited', [])
def __addEntryMarker(self, marker, matrix): if matrix is None: return else: mp = Math.WGReplayAwaredSmoothTranslationOnlyMP() mp.source = matrix scaledMatrix = None if self.__markerScale is not None: scaleMatrix = Matrix() scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale)) scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, mp) zIndex = self.zIndexManager.getMarkerIndex(marker) if scaledMatrix is None: handle = self.__ownUI.addEntry(mp, zIndex) else: handle = self.__ownUI.addEntry(scaledMatrix, zIndex) entry = {'matrix': mp, 'handle': handle} self.__entrieMarkers[marker] = entry self.__ownUI.entryInvoke(entry['handle'], ('init', ['fortConsumables', marker, '', '', 'empty'])) if self.__markerScale is None: self.__parentUI.call('minimap.entryInited', []) return handle
def scaleMarker(self, handle, originalMatrix, scale): if handle is not None and originalMatrix is not None: scaleMatrix = Matrix() scaleMatrix.setScale(Vector3(scale, scale, scale)) mp = mathUtils.MatrixProviders.product(scaleMatrix, originalMatrix) self.__ownUI.entrySetMatrix(handle, mp) return
def createSRTMatrix(scale, rotation, translation): scaleMatrix = Matrix() scaleMatrix.setScale(scale) result = Matrix() result.setRotateYPR(rotation) result.translation = translation result.preMultiply(scaleMatrix) return result
class FlagModel(object): model = property(lambda self: self.__flagStaffModel) def __init__(self): self.__flagModel = None self.__flagAnimator = None self.__flagFashion = None self.__flagScaleMatrix = Matrix() self.__flagStaffModel = None self.__flagStaffFashion = None return def setupFlag(self, position, flagSettings, color): self.__setupFlagStaff(flagSettings, position) self.__setupFlagModel(flagSettings, color) def changeFlagColor(self, color): if self.__flagFashion: self.__flagFashion.setColor(color) def startFlagAnimation(self): if self.__flagModel is not None: try: clipResource = self.__flagModel.deprecatedGetAnimationClipResource(self.__flagSettings.flagAnim) if clipResource: loader = AnimationSequence.Loader(clipResource, BigWorld.player().spaceID) self.__flagAnimator = loader.loadSync() self.__flagAnimator.bindTo(AnimationSequence.ModelWrapperContainer(self.__flagModel)) self.__flagAnimator.start() except Exception: LOG_WARNING('Unable to start "%s" animation action for model' % self.__flagSettings.flagAnim) return def __setupFlagStaff(self, flagSettings, position): self.__flagStaffModel = flagSettings.flagStaffModel self.__flagStaffModel.position = position self.__flagStaffFashion = BigWorld.WGAlphaFadeFashion() self.__flagStaffModel.fashion = self.__flagStaffFashion def __setupFlagModel(self, flagSettings, color): self.__flagSettings = flagSettings self.__flagScaleMatrix = Matrix() self.__flagScaleMatrix.setScale(flagSettings.flagScale) flagNode = self.__flagStaffModel.node(flagSettings.flagStaffFlagHP, self.__flagScaleMatrix) if self.__flagModel is not None: flagNode.detach(self.__flagModel) self.__flagModel = None self.__flagModel = flagSettings.flagModel self.__flagFashion = BigWorld.WGFlagAlphaFadeFashion() self.__flagFashion.setColor(color) self.__flagFashion.setFlagBackgroundTexture(flagSettings.flagBackgroundTex) self.__flagFashion.setEmblemTexture(flagSettings.flagEmblemTex, flagSettings.flagEmblemTexCoords) self.__flagModel.fashion = self.__flagFashion if self.__flagModel is not None: flagNode.attach(self.__flagModel) self.__flagFashion.overridePosition(self.__flagStaffModel.matrix) return
class FlagModel(object): model = property(lambda self: self.__flagStaffModel) def __init__(self): self.__flagModel = None self.__flagFashion = None self.__flagScaleMatrix = Matrix() self.__flagStaffModel = None self.__flagStaffFashion = None return def setupFlag(self, position, flagSettings, color): self.__setupFlagStaff(flagSettings, position) self.__setupFlagModel(flagSettings, color) def changeFlagColor(self, color): if self.__flagFashion: self.__flagFashion.setColor(color) def startFlagAnimation(self): if self.__flagModel is not None: try: animAction = self.__flagModel.action( self.__flagSettings.flagAnim) animAction() except Exception: LOG_WARNING('Unable to start "%s" animation action for model' % self.__flagSettings.flagAnim) return def __setupFlagStaff(self, flagSettings, position): self.__flagStaffModel = flagSettings.flagStaffModel self.__flagStaffModel.position = position self.__flagStaffFashion = BigWorld.WGAlphaFadeFashion() self.__flagStaffModel.fashion = self.__flagStaffFashion def __setupFlagModel(self, flagSettings, color): self.__flagSettings = flagSettings self.__flagScaleMatrix = Matrix() self.__flagScaleMatrix.setScale(flagSettings.flagScale) flagNode = self.__flagStaffModel.node(flagSettings.flagStaffFlagHP, self.__flagScaleMatrix) if self.__flagModel is not None: flagNode.detach(self.__flagModel) self.__flagModel = None self.__flagModel = flagSettings.flagModel self.__flagFashion = BigWorld.WGFlagAlphaFadeFashion() self.__flagFashion.setColor(color) self.__flagFashion.setFlagBackgroundTexture( flagSettings.flagBackgroundTex) self.__flagFashion.setEmblemTexture(flagSettings.flagEmblemTex, flagSettings.flagEmblemTexCoords) self.__flagModel.fashion = self.__flagFashion if self.__flagModel is not None: flagNode.attach(self.__flagModel) self.__flagFashion.overridePosition(self.__flagStaffModel.matrix) return
def prerequisites(self): self.capturePercentage = float(self.pointsPercentage) / 100 self.__isCapturedOnStart = self.isCaptured sectorBaseComponent = BigWorld.player().arena.componentSystem.sectorBaseComponent if sectorBaseComponent is not None: sectorBaseComponent.addSectorBase(self) assembler = BigWorld.CompoundAssembler(_g_sectorBaseSettings.flagStaffModelName, self.spaceID) assembler.addRootPart(_g_sectorBaseSettings.flagStaffModelName, 'root') scaleMatrix = Matrix() scaleMatrix.setScale(_g_sectorBaseSettings.flagScale) assembler.addPart(_g_sectorBaseSettings.flagModelName, _g_sectorBaseSettings.flagStaffFlagHP, _g_sectorBaseSettings.flagNodeAliasName, scaleMatrix) rv = [assembler, _g_sectorBaseSettings.radiusModel] if _g_sectorBaseSettings.flagAnim is not None: loader = AnimationSequence.Loader(_g_sectorBaseSettings.flagAnim, self.spaceID) rv.append(loader) mProv = Matrix() mProv.translation = self.position self.__baseCaptureSoundObject = SoundGroups.g_instance.WWgetSoundObject('base_' + str(self.baseID), mProv) self.__baseCaptureSoundObject.play(_g_sectorBaseSettings.baseAttachedSoundEventName) return rv
def plasmaExplode(owner, targetModel, delTargetModel): m = BigWorld.Model('objects/models/fx/03_pchangs/shockwave.model') targetModel.root.attach(m) m.Go() BigWorld.callback(1.0, partial(targetModel.root.detach, m)) m = targetModel.root m2 = Matrix() m2.setScale((5, 5, 5)) m2.postMultiply(m) v1 = Vector4(1.0, 100000, 0, 0) v2 = Vector4(0.0, 0, 0, 0) v = Vector4Animation() v.keyframes = [(0, v1), (0.5, v2)] v.duration = 1 v.time = 0 try: BigWorld.addWarp(0.5, m2, v) except: pass shake(targetModel) ps2 = Pixie.create('particles/plasma_blow.xml') targetModel.root.attach(ps2) ps2.system(0).actions[0].force(1) BigWorld.callback(5.0, partial(targetModel.root.detach, ps2)) if delTargetModel: BigWorld.callback(5.0, partial(owner.delModel, targetModel)) if BigWorld.player().flashBangCount == 0: fba = Vector4Animation() fba.keyframes = [(0, Vector4(0, 0, 0, 0)), (0.1, Vector4(0.1, 0.1, 0.2, 0.5)), (0.3, Vector4(0, 0, 0, 0))] fba.duration = 0.3 try: BigWorld.flashBangAnimation(fba) except: pass BigWorld.callback(fba.duration, partial(BigWorld.flashBangAnimation, None)) return
def __addEntry(self, id, location, doMark): battleCtx = g_sessionProvider.getCtx() if battleCtx.isObserver(id): return arena = BigWorld.player().arena entry = dict() m = self.__getEntryMatrixByLocation(id, location) scaledMatrix = None if self.__markerScale is not None: scaleMatrix = Matrix() scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale)) scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, m) if location == VehicleLocation.AOI_TO_FAR: self.__aoiToFarCallbacks[id] = BigWorld.callback(self.__AOI_TO_FAR_TIME, partial(self.__delEntry, id)) entry['location'] = location entry['matrix'] = m if scaledMatrix is None: entry['handle'] = self.__ownUI.addEntry(m, self.zIndexManager.getVehicleIndex(id)) else: entry['handle'] = self.__ownUI.addEntry(scaledMatrix, self.zIndexManager.getVehicleIndex(id)) self.__entries[id] = entry entryVehicle = arena.vehicles[id] entityName = battleCtx.getPlayerEntityName(id, entryVehicle.get('team')) markerType = entityName.base entryName = entityName.name() markMarker = '' if not entityName.isFriend: if doMark: if 'SPG' in entryVehicle['vehicleType'].type.tags: if not self.__isFirstEnemySPGMarkedById.has_key(id): self.__isFirstEnemySPGMarkedById[id] = False isFirstEnemySPGMarked = self.__isFirstEnemySPGMarkedById[id] if not isFirstEnemySPGMarked: markMarker = 'enemySPG' self.__isFirstEnemySPGMarkedById[id] = True self.__resetSPGMarkerTimoutCbckId = BigWorld.callback(5, partial(self.__resetSPGMarkerCallback, id)) elif not self.__isFirstEnemyNonSPGMarked and markMarker == '': if not len(self.__enemyEntries): markMarker = 'firstEnemy' self.__isFirstEnemyNonSPGMarked = True if markMarker != '': BigWorld.player().soundNotifications.play('enemy_sighted_for_team') self.__enemyEntries[id] = entry if entryVehicle['vehicleType'] is not None: tags = set(entryVehicle['vehicleType'].type.tags & VEHICLE_CLASS_TAGS) else: LOG_ERROR('Try to show minimap marker without vehicle info.') return vClass = tags.pop() if len(tags) > 0 else '' if GUI_SETTINGS.showMinimapSuperHeavy and entryVehicle['vehicleType'].type.level == 10 and vClass == 'heavyTank': vClass = 'super' + vClass vName = entryVehicle['vehicleType'].type.shortUserString self.__callEntryFlash(id, 'init', [markerType, entryName, vClass, markMarker, vName]) entry['markerType'] = markerType entry['entryName'] = entryName entry['vClass'] = vClass if self.__markerScale is None: self.__parentUI.call('minimap.entryInited', [])