Перейти к содержимому
Для публикации в этом разделе необходимо провести 1 боёв.
MedvedevTD

💬 Обсуждение ModAPI

В этой теме 159 комментариев

Рекомендуемые комментарии

1 552
[0RZ]
Мододел, Коллекционер
801 публикация
19 487 боёв

Выше я немного растёкся мылью по древу. Чтобы было понятнее о чём речь:

Хочу сделать мод с более говорящими названиями файлов скриншотов.

В имени файла кроме даты и времени хочу добавить название экрана игры/карту/корабль.

Укажите направление в котором нужно двигаться.

  • Плюс 1

Рассказать о публикации


Ссылка на публикацию
Участник
537 публикаций

Хочу допилить карусель: возможность скрывать не главные корабли. Возможно ли это реализовать с помощью мода?

Рассказать о публикации


Ссылка на публикацию
Участник
14 публикаций

Всем привет.

Во-первых, мои извинения за грамматические и орфографические. Я ужасный человек, и знаю только английский, поэтому мне приходится использовать Google Translate для этого поста и его будет ужасно. Но это место, чтобы быть для моддинга, так что здесь я после 31 матчей в Black Swan на сервере RU для получения разрешения на размещение: P Я буду включать оригинальный английский в спойлер тегов упаковывают, что помогает кому-то понять мою галиматью.

 

Замечания:
Питон песочница ограничил доступ к множеству команд и методов, которые позволили бы нам определить, что мы можем сделать с существующими объектами, например, <объект> .__ dict__. Я не в первую очередь разработчик Python, но я ожидаю, что это по уважительной причине. Недостатком является то, что нам потребуется гораздо более Indepth документацию о том, какие методы доступны, их параметры и возвращать значения. То, что мы могли бы использовать с автозаполнения в IDE было бы фантастическим.

Представляется, что точка входа для Python заканчивается с глобальных объектов «событий» и «вспышки» Instanced. Я вижу из [ModAPI (Документация) нити, что есть и боевые, customPorts и объекты Utils, которые не делают по всей видимости, инстанс на старте. Как мы можем получить доступ к этим объектам?

 

Проблема с MyMod примера
В нижней части ModsAPI HowTo нить, пример находится здесь. Оказывается, что это только частично работает под 0.5.14. OnButtonClick работает, как это делает __init__, но onFlashLoad никогда не вызывается. Я ожидаю, что events.swe (self.onFlashReady), как предполагается, будет вызвана, когда вспышка загружается (так после каждого нажатия кнопки в приведенном выше примере), но то предположение. Что делает events.swe (объект) на самом деле делать?

 

Вопрос.

Я нахожусь в середине создания небольшой мод, который добавляет новую панель к battlescreen, и я хотел бы, чтобы это было доступно только когда люди находятся в самом матче. Как то, как миникарте отображается с момента, когда вы полностью загрузить в матче, и палками вокруг. Насколько я могу сказать, что нет событий в настоящее время для этого. Ближайший является onBattleStart, но начало боя не то же самое как в игре ждет счетчика.

 

Hi all.

First up, my apologies for the grammar and spelling. I'm a terrible human being and only know english, so I'm having to use google translate for this post and its going to be awful. But, this is the place to be for modding, so here I am after 31 matches in a Black Swan on the RU server to get posting permissions :P I'll include the original english in spoiler tags incase that helps someone understand my drivel.

 

Observations: 
The python sandbox has restricted access to a lot of the commands and methods that would allow us to determine what we can do with existing objects, like <object>.__dict__. I'm not primarily a python developer but I expect that that is for a good reason. The downside is that we will need a much more indepth documentation about what methods are available, their parameters, and return values. Something that we could use with autocomplete in an IDE would be fantastic.

It appears that the entry point for python ends up with the global objects 'events' and 'flash' instanced. I see from the ModAPI (Documentation) thread that there are also battle, customPorts, and utils objects that don't appear to be instanced at the start. How do we get access to these objects?

 

Issue with MyMod example
At the bottom of the ModsAPI HowTo thread, is an example located here. It appears that it only partially works under 0.5.14. The onButtonClick works, as does __init__, but onFlashLoad is never called. I expect that events.swe(self.onFlashReady) is supposed to be called when the flash has loaded (so after each button click in the example), but thats a guess. What does events.swe(object) actually do?

 

Question.

I'm in the middle of creating a small mod that adds a new panel to the battlescreen, and I'd like it to only be available when people are in the actual match. Like how the Minimap is displayed from when you load into a match fully, and sticks around. As far as I can tell, there is no event currently for that. The closest is onBattleStart, but the start of the battle isn't the same as being in the game waiting for the counter.

 

Рассказать о публикации


Ссылка на публикацию
Разработчик
102 публикации
3 719 боёв

 Хочу допилить карусель: возможность скрывать не главные корабли. Возможно ли это реализовать с помощью мода? 

 Через API- нет.

 

 I'm not primarily a python developer but I expect that that is for a good reason.

 You are right. :)

 

 The downside is that we will need a much more indepth documentation about what methods are available, their parameters, and return values.

 In progress.

 

 It appears that the entry point for python ends up with the global objects 'events' and 'flash' instanced. I see from the ModAPI (Documentation) thread that there are also battle, customPorts, and utils objects that don't appear to be instanced at the start. How do we get access to these objects?

 Can you explain what do you mean under "get access to these objects" ?

 

Рассказать о публикации


Ссылка на публикацию
Участник
79 публикаций

Question.

I'm in the middle of creating a small mod that adds a new panel to the battlescreen, and I'd like it to only be available when people are in the actual match. Like how the Minimap is displayed from when you load into a match fully, and sticks around. As far as I can tell, there is no event currently for that. The closest is onBattleStart, but the start of the battle isn't the same as being in the game waiting for the counter.

Hello,

You should use "events.onSFMEvent". For example:

def onSFMEvent(eventName, eventData):
    # {'eventName': 'window.show', 'windowName': 'Battle'} Battle window is ready
    # {'eventName': 'window.becomeTopInFlash', 'windowName': 'Battle'}
    # {'eventName': 'action.showBattle'} Start Battle button click
    # {'eventName': 'window.show', 'windowName': 'GameMenu'} GameMenu window
    if eventName == 'window.show' and eventData['windowName'] == 'GameMenu':
        pass # Show panel here
    if eventName == 'window.hide' and eventData['windowName'] == 'GameMenu':
        pass # Hide panel here
 
events.onSFMEvent(self.onSFMEvent)

Рассказать о публикации


Ссылка на публикацию
0
[S-F]
Участник
1 публикация
13 872 боя

1.Будут ли представлены корабли Италии? 2.Почему корабли в процессе игры временно  становятся "невидимками"? 

Рассказать о публикации


Ссылка на публикацию
Участник
14 публикаций

get access to these objects" ?

Looking into it further, I was being stupid. I was checking the values of them outside of my mod class and it was crashing my mod. It appears when you aren't being braindead and ask for them inside your mod class that they return as expected, and the method calls return None if that is the most appropriate (like asking battle.getSelfPlayeeInfo() in the __init__ method).

 

I do have a couple of other questions. How can we request additional API methods? I'd like to be able to get to the captain details for the player ship (name/image/trained skills) during a battle, which doesn't currently appear to be accessible via the ShipInfo structure. Also, what does the param value of the ShipInfo structure contain? Its a GameParams.GPData but I don't know what I can call on this, or even if it makes sense to do that.

19:37 Добавлено спустя 2 минуты

Hello,

You should use "events.onSFMEvent". For example:

def onSFMEvent(eventName, eventData):
    # {'eventName': 'window.show', 'windowName': 'Battle'} Battle window is ready
    # {'eventName': 'window.becomeTopInFlash', 'windowName': 'Battle'}
    # {'eventName': 'action.showBattle'} Start Battle button click
    # {'eventName': 'window.show', 'windowName': 'GameMenu'} GameMenu window
    if eventName == 'window.show' and eventData['windowName'] == 'GameMenu':
        pass # Show panel here
    if eventName == 'window.hide' and eventData['windowName'] == 'GameMenu':
        pass # Hide panel here
 
events.onSFMEvent(self.onSFMEvent)

 

Thankyou, that helped a lot.

Рассказать о публикации


Ссылка на публикацию
Разработчик
102 публикации
3 719 боёв

 I do have a couple of other questions. How can we request additional API methods?

Ask right here, as example :)

But no guarantees that your request will be implemented (because a lot of reasons).

 

Рассказать о публикации


Ссылка на публикацию
Участник
14 публикаций

Ask right here, as example :)

But no guarantees that your request will be implemented (because a lot of reasons).

 

 

And fair enough too. Just so its not hidden in my other questions in that post:

 

API Request

Can we please get an API that can access a player's captain name, nationality, and the selected talents while in battle. Ideally for each player in the battle, but at a minimum just the client's player. 

 

Rationale

This would allow mods to be created to check your own captain's talents while in a battle, and compare to other players so people can learn about effective (or not so effective) builds for captains and ships. It might also be kind of cool to be able to display the captain for your ship while playing in the game so they become more than out of battle talent holders.

 

Рассказать о публикации


Ссылка на публикацию
Разработчик
102 публикации
3 719 боёв

 

And fair enough too. Just so its not hidden in my other questions in that post:

 

API Request

Can we please get an API that can access a player's captain name, nationality, and the selected talents while in battle. Ideally for each player in the battle, but at a minimum just the client's player. 

 

Rationale

This would allow mods to be created to check your own captain's talents while in a battle, and compare to other players so people can learn about effective (or not so effective) builds for captains and ships. It might also be kind of cool to be able to display the captain for your ship while playing in the game so they become more than out of battle talent holders.

 

 

I will escalate your request.
  • Плюс 1

Рассказать о публикации


Ссылка на публикацию
Участник
627 публикаций

Also, what does the param value of the ShipInfo structure contain?

This one?

player.shipInfo.params

 

As far as I know, GPData in source looks like this:

class GPData(object):
  pass

There are no methods, but you can view available attributes simply by executing something like this:

print player.shipInfo.params.__dict__

E.g.:

{'permoflages': [], 'typeinfo': <GameParams.TypeInfo instance at 0x1AABE2B0>, 'weight': 1000, 'A_Hull': <GameParams.GPData object at 0x1AAC0310>, 'ShipModernization': <GameParams.GPData object at 0x1AAC0B70>, 'Cameras': <GameParams.GPData object at 0x1AAC0C50>, 'peculiarity': 'default', 'AIParams': <GameParams.GPData object at 0x1AAC3630>, 'peculiarityEffects': {}, 'peculiarityModels': {}, 'id': 4293834544L, 'index': 'PGSC001', 'battleLevel': {'pvp': (1,), 'pve': (1,)}, 'group': 'start', 'nativePermoflage': '', 'A1_FireControl': <GameParams.GPData object at 0x1AAC3770>, 'isPaperShip': True, 'maxEquippedFlags': 8, 'ShipUpgradeInfo': <GameParams.GPData object at 0x1AAC37D0>, 'A_Directors': <GameParams.GPData object at 0x1AAC3DB0>, 'A_Artillery': <GameParams.GPData object at 0x1AAC3ED0>, 'canEquipCamouflage': True, 'unpeculiarShip': None, 'A2_FireControl': <GameParams.GPData object at 0x1AAC6450>, 'A_Engine': <GameParams.GPData object at 0x1AAC64B0>, 'groupCustom': {}, 'name': 'PGSC001_Hermelin_1940', 'peculiarityFlag': '', 'level': 1, 'A_AirDefense': <GameParams.GPData object at 0x1AAC65B0>, 'defaultCrew': None, 'ShipAbilities': <GameParams.GPData object at 0x1AAC6AD0>, 'flagsScale': 0.5, 'A_Finders': <GameParams.GPData object at 0x1AAC6D10>, 'nationFlagScale': 1.0}

Изменено пользователем anonym_g9TzIXlujN2O
  • Плюс 1

Рассказать о публикации


Ссылка на публикацию
Участник
14 публикаций

This one?

player.shipInfo.params

 

As far as I know, GPData in source looks like this:

class GPData(object):
  pass

There are no methods, but you can view available attributes simply by executing something like this:

print player.shipInfo.params.__dict__

E.g.:

{'permoflages': [], 'typeinfo': <GameParams.TypeInfo instance at 0x1AABE2B0>, 'weight': 1000, 'A_Hull': <GameParams.GPData object at 0x1AAC0310>, 'ShipModernization': <GameParams.GPData object at 0x1AAC0B70>, 'Cameras': <GameParams.GPData object at 0x1AAC0C50>, 'peculiarity': 'default', 'AIParams': <GameParams.GPData object at 0x1AAC3630>, 'peculiarityEffects': {}, 'peculiarityModels': {}, 'id': 4293834544L, 'index': 'PGSC001', 'battleLevel': {'pvp': (1,), 'pve': (1,)}, 'group': 'start', 'nativePermoflage': '', 'A1_FireControl': <GameParams.GPData object at 0x1AAC3770>, 'isPaperShip': True, 'maxEquippedFlags': 8, 'ShipUpgradeInfo': <GameParams.GPData object at 0x1AAC37D0>, 'A_Directors': <GameParams.GPData object at 0x1AAC3DB0>, 'A_Artillery': <GameParams.GPData object at 0x1AAC3ED0>, 'canEquipCamouflage': True, 'unpeculiarShip': None, 'A2_FireControl': <GameParams.GPData object at 0x1AAC6450>, 'A_Engine': <GameParams.GPData object at 0x1AAC64B0>, 'groupCustom': {}, 'name': 'PGSC001_Hermelin_1940', 'peculiarityFlag': '', 'level': 1, 'A_AirDefense': <GameParams.GPData object at 0x1AAC65B0>, 'defaultCrew': None, 'ShipAbilities': <GameParams.GPData object at 0x1AAC6AD0>, 'flagsScale': 0.5, 'A_Finders': <GameParams.GPData object at 0x1AAC6D10>, 'nationFlagScale': 1.0}

 

Yes that's the one thank you.

 

I hadn't tried __dict__ as I had attempted to use it on the API classes battles/events/etc and received an error message about __dict__ being restricted. Figured that was for the entire sandbox, although now it appears its only for a select few.

Рассказать о публикации


Ссылка на публикацию
Разработчик
102 публикации
3 719 боёв

 

There are no methods, but you can view available attributes simply by executing something like this:

print player.shipInfo.params.__dict__

 New style classes will be fixed shortly.

Рассказать о публикации


Ссылка на публикацию
Участник
14 публикаций

 

not a good idea. this type of information will give advantage to the mod user. but knowing own talents will be great.

 

More concerned about some players using it as an excuse to harass others for not having the group think best build.

 

Learning from others is currently quite difficult in WoWS, generally from a lack of information in the UI. (You virtually never know what people are running except in a couple of instances - like the air superiority talent). Perhaps a battle controller version that allows for your own to be available during battle, and a new post battle controller that gives access to other players? Mostly I'm content to wait to see what WG come up with API and restriction wise if anything.

Рассказать о публикации


Ссылка на публикацию
3 216
[POI]
Участник
4 533 публикации
13 320 боёв

 New style classes will be fixed shortly.

 

вопрос в 0.5.16 мод апи не изменялся?, ато порты перестали работать 
Изменено пользователем Blackpredators

Рассказать о публикации


Ссылка на публикацию
225
Бета-тестер
202 публикации
1 998 боёв

вопрос в 0.5.16 мод апи не изменялся?, ато порты перестали работать

 

Подтверждаю, тоже очень заинтересован этим вопросом :look:

Дополнительные порты показываются в меню выбора, но при клике на них ничего не происходит, меню закрывается, порт не загружается :(

Изменено пользователем Traest

Рассказать о публикации


Ссылка на публикацию
17 903
[SK]
Разработчик, Коллекционер, Мододел
6 967 публикаций
8 883 боя

Вопрос по поломке портов-API передан Разработчикам.

Рассказать о публикации


Ссылка на публикацию
3 216
[POI]
Участник
4 533 публикации
13 320 боёв

 

Подтверждаю, тоже очень заинтересован этим вопросом :look:

Дополнительные порты показываются в меню выбора, но при клике на них ничего не происходит, меню закрывается, порт не загружается :(

 

да да верно на тесте все работало нормально,  в 6.15 зашол проверить, и порты не работали 
Изменено пользователем Blackpredators

Рассказать о публикации


Ссылка на публикацию
Разработчик
102 публикации
3 719 боёв

К сожалению Порты сломали в самый последний момент :(

Еще не все что касается модов и ModsAPI покрыто тестами, но мы движемся в сторону исправления этой ситуации.

Рассказать о публикации


Ссылка на публикацию

×