NemesiS Posted June 24, 2017 Share Posted June 24, 2017 (edited) Ковыряю старые исходники, вроде начинаю въезжать, разобрался как загружать и показывать текстуры на поле боя, но никак не могу понять как что нибудь отобразить на мини карте, мне нужно поставить хотя бы точку, чтобы отобразить положение танка, проковырял все, перерыл все форумы, так ничего из нового и не могу найти, раньше как понял все было просто, что то типа: ... MinimapapEntry = g_appLoader.getDefBattleApp().minimap._Minimap__ownUI.addEntry(MathMatrix2, MyInt2) ... а теперь, как то, что то, через какую то большую же это все делается, что ли типа: ... g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._MinimapComponent__component.entryInvoke(MinimapapEntry, ('init', ['ally','teamKiller','SPG',''])) ... Голова пухнет, получается нифига нерабочий код, потому что было очень много изменений. Никак не могу понять логику работы, хотя перекопал все исходники клиента но так и не нашел где и как работает мини карта. вот кусок нерабочего кода: def ShowEnemyShotOnMap(type, pos): global MyBuffA2 global MyInt2 global MyBuff3 if g_appLoader.getDefBattleApp() is not None: if g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap'] is not None: MathMatrix = Math.Matrix() MathMatrix.setTranslate((0, 0, 0)) MathMatrix2 = Math.Matrix() MathMatrix2.setTranslate(Math.Matrix(MathMatrix).applyPoint(pos)) MyInt2 = MyInt2 + 1 if MyInt2 >= 50: MyInt2 = 40 for MyVal1, MyVal2 in MyBuff3.items(): if MyVal2['type'] == type: if MyVal2['nextid'] == MyInt2: DelOldMapEntry(MyVal1) MyBuff3.pop(MyVal1, None) MinimapapEntry = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._MinimapComponent__component.addEntry(MathMatrix2, MyInt2) if MinimapapEntry is not None: if MinimapapEntry in MyBuff3.keys(): MyBuff3.pop(MinimapapEntry, None) return MyBuff3 = {MinimapapEntry: {'type': type, 'nextid': MyInt2, 'time': BigWorld.time()}} try: g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._MinimapComponent__component.entryInvoke(MinimapapEntry, ('init', ['ally', 'teamKiller', 'SPG', ''])) except: LOG_NOTE('g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components[minimap]._MinimapComponent__component.entryInvoke') try: g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._Minimap__parentUI.call('minimap.entryInited', []) except: LOG_NOTE('g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components[minimap]._Minimap__parentUI.call') try: g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._MinimapComponent__component.entryInvoke(MinimapapEntry, ('showAction', ['attackSender'])) except: LOG_NOTE('g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components[minimap]._MinimapComponent__component.entryInvoke') try: g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._Minimap__parentUI.call('minimap.entryInited', []) except: LOG_NOTE('g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components[minimap]._Minimap__parentUI.call') MyThread = Threading.Thread(target=oooooOoo0ooo, args=(MyInt2, 30)) MyThread.start() MyBuffA2.append(MyThread) for MyThread in MyBuffA2: MyThread.join() return Поделитесь опытом, как поставить а затем удалить точку на мини карте.И еще одно, если я делаю так: shooterID = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap']._Minimap__enemyEntries в логах получаю ошибку: AttributeError: 'ClassicMinimapComponent' object has no attribute '_Minimap__enemyEntries' Edited June 24, 2017 by NemesiS @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 25, 2017 Share Posted June 25, 2017 (edited) minimap = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap'] _entry = minimap.getPlugin('vehicles')._entries.get(vehicleID) _entry = minimap.addEntry(symbol, container, matrix, active) minimap.invoke(_entry.getID(), ['setVehicleInfo', vehicleID, classTag, vName, entryName, 'enemySPG']) minimap.delEntry(_entry.getID())Но ты бы завязывал с читами, тем более с чужим, кривым кодом. Edited June 25, 2017 by spoter 1 @ Quote Link to comment Short link Share on other sites More sharing options...
NemesiS Posted June 25, 2017 Author Share Posted June 25, 2017 Спасибо, да я решил немного python поучить, программирую на C++ в основном, а так и учить веселей, и стимул какой никакой. Сам не люблю чужой код, просто с документацией в WOT негусто, если есть где что почитать буду рад ссылочке. Спасибо за пример, только вот откуда взять переменные: symbol, container, matrix, active, classTag? Покопался в исходниках клиента, нашел только объявления функций addEntry, invoke в component.py Как узнать что да как если оно все не документировано и нет примеров использования? Поделитесь опытом пожалуйста. @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 25, 2017 Share Posted June 25, 2017 (edited) Сложный вопрос, только опыт и dir() поможет. Документации нет, примеров вменяемого кода тоже почти нет, да еще и ВГ активно работают над закрытием кода, в борьбе с "читерами". Боюсь что, мододелов старых не останется совсем, а новые не смогут прорваться через нагромождения "защиты". Если хотите изучать питон, после Си, почитайте учебник и начните делать реальные программы. Моды для танков сильно специфические, навыков для реальной работы не дадут. А заработать на этих модах много не получится. Разве что чисто для себя, в целях развлечения или личного использования, но порог вхождения становится с каждым годом все выше и выше. А выхлопа всё меньше и меньше. Edited June 25, 2017 by spoter 2 @ Quote Link to comment Short link Share on other sites More sharing options...
NemesiS Posted June 25, 2017 Author Share Posted June 25, 2017 (edited) Да не стать мне великим мододелом, я и не стремлюсь, просто погода хреновая и заняться нечем, да и разве на этом заработать много можно? Ладно разберусь как нибудь minimap = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap'] _entry = minimap.getPlugin('vehicles')._entries.get(vehicleID) _entry = minimap.addEntry(symbol, container, matrix, active) minimap.invoke(_entry.getID(), ['setVehicleInfo', vehicleID, classTag, vName, entryName, 'enemySPG']) minimap.delEntry(_entry.getID()) Не работает, пишет: AttributeError: 'int' object has no attribute 'getID' Edited June 25, 2017 by NemesiS @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 25, 2017 Share Posted June 25, 2017 Ну чуть чуть сам подумай, если не функция а int, значит это и есть ID @ Quote Link to comment Short link Share on other sites More sharing options...
NemesiS Posted June 25, 2017 Author Share Posted June 25, 2017 (edited) Ну чуть чуть сам подумай, если не функция а int, значит это и есть ID Я понял уже из объявления: def addEntry(self, symbol, container, matrix=None, active=False, transformProps=settings.TRANSFORM_FLAG.DEFAULT): entryID = self.__component.addEntry(symbol, container, matrix, active, transformProps) if entryID: self.__ids.add(entryID) return entryID Исправил на: _entry = minimap.addEntry(symbol, container, matrix, active) minimap.invoke(_entry, ['setVehicleInfo', vehicleID, classTag, vName, entryName, 'enemySPG']) Но в логе все равно получаю ошибку: AssertionError: Entry is not added by given ID Не буду ходить вокруг да около, я пытаюсь показать на карте стреляющего: def MyShowTracer(self, shooterID, shotID, isRicochet, effectsIndex, refStartPoint, velocity, gravity, maxShotDist): global MyBuffA1 if not BigWorld.player().arena.vehicles[BigWorld.player().playerVehicleID]['isAlive']: ShowPlTracer(self, shooterID, shotID, isRicochet, effectsIndex, refStartPoint, velocity, gravity, maxShotDist) else: startPoint = refStartPoint shooter = BigWorld.entity(shooterID) if shooter is not None and shooter.isStarted: gunMatrix = Math.Matrix(shooter.appearance.compoundModel.node('HP_gunFire')) gunFirePos = gunMatrix.translation if cameras.isPointOnScreen(gunFirePos): startPoint = gunFirePos # replayCtrl = BattleReplay.g_replayCtrl if (gunFirePos - refStartPoint).length > 50.0 and (gunFirePos - BigWorld.camera().position).length < 50.0: # and replayCtrl.isPlaying: velocity = velocity.length * gunMatrix.applyVector((0, 0, 1)) effectsIndex = max(effectsIndex, 10) effectsIndex = min(effectsIndex + 2, 19) effectsDescr = vehicles.g_cache.shotEffects[effectsIndex] shooter2ID = self.playerVehicleID == shooterID # self.__projectileMover.add(shotID, effectsDescr, gravity, refStartPoint, velocity, startPoint, maxShotDist, shooterID, BigWorld.camera().position) ProjMove = ProjectileMover.ProjectileMover() ProjMove.add(shotID, effectsDescr, gravity, refStartPoint, velocity, startPoint, maxShotDist, shooter2ID, BigWorld.camera().position) # if isRicochet: # self.__projectileMover.hold(shotID) if self.arena.vehicles[shooterID]['team'] != self.team: if shooter is not None: minimap = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['minimap'] _entry = minimap.getPlugin('vehicles')._entries.get(shooterID) symbol = ENTRY_SYMBOL_NAME.VEHICLE container = 'vehicles' MathMatrix = Math.Matrix() MathMatrix.setTranslate((0, 0, 0)) MathMatrix2 = Math.Matrix() MathMatrix2.setTranslate(Math.Matrix(MathMatrix).applyPoint(refStartPoint)) _entry = minimap.addEntry(symbol, container, MathMatrix2, True) minimap.invoke(_entry, ['setVehicleInfo', shooterID, VEHICLE_CLASS_NAME.SPG, 'vName Test', 'entryName test', 'enemySPG']) return Конечно я туплю потому что все делаю интуитивно от балды и пока не въехал что, откуда и куда. Edited June 25, 2017 by NemesiS @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.