MHServerEmu/docs/Web/EmbeddedBrowser.md

74 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2023-09-12 16:02:25 +03:00
# Embedded Browser
2023-09-11 22:25:28 +03:00
Some of the in-game UI panels (TOS popup on login, store, community news) use an embedded web browser that can load HTML pages. These pages can interact with the client UI via a JavaScript API.
## Browser Versions
Originally the client used Awesomium as the browser backend, but it was replaced with Chromium Embedded Framework (CEF) in game version 1.22. Below is a list of known browser versions used by the client.
| Game Version | Browser Version | Browser Release Date |
| ------------ | ------------------------ | -------------------- |
| 1.9-1.21 | Awesomium 1.6.5 | 2012-02-23 |
| 1.22-1.32 | CEF 3.1650.1544 | 2013-12-08 |
| 1.33 | CEF 3.2272.2035 | 2015-02-26 |
| 1.34 | CEF 3.2272.2077 | 2015-04-13 |
| 1.35-1.52 | CEF 3.1650.1639 | 2014-03-13 |
| 1.53 | CEF 3.3112.1656.g9ec3e42 | 2017-08-10 |
2023-09-11 22:25:28 +03:00
## API Calls
2024-03-10 12:51:30 +03:00
Calls are generally made with onclick events (e.g. ```<a onclick="myApi.OpenCatalogToItem('HeroesPage', '')">```). You can find an example of a store home page [here](https://github.com/Crypto137/MHServerEmuWebAssets/tree/master/store).
2023-09-11 22:25:28 +03:00
| Call | Description |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| myApi.OpenCatalogToItem(string pageName, string skuId) | Opens the specified page / item. See the table below for page names. SkuId should be in hex (e.g. 0x1CA0070). |
2023-09-12 16:02:25 +03:00
| myApi.CloseAddGPanel(bool success) | Closes the add G panel. If success is true (1) calls UpdateWalletBalance. |
2023-09-11 22:25:28 +03:00
| myApi.UpdateWalletBalance() | Sends a NetMessageGetCurrencyBalance to the server. |
| myApi.BuyBundleFromJS(string skuId) | |
| myApi.ReloadAddGPage() | |
2023-10-04 06:59:38 +03:00
| myApi.OpenExternalBrowserFromJS(string url) | Opens a URL in the user's default web browser (TOS and news only). |
2023-09-12 16:02:25 +03:00
| myApi.OpenNewsUrl(string url) | Opens a popup in the news window (news V2 only). |
| myApi.CloseNewsUrl() | Closes the news window popup (news V2 only). |
2023-10-04 06:59:38 +03:00
| myApi.CloseLegalDoc(bool accepted) | Closes the TOS popup. |
2023-09-11 22:25:28 +03:00
## Store Page Names
| In-Game Name | Internal Name |
| ------------ | ------------- |
2023-09-12 16:02:25 +03:00
| Home | HomePage |
2023-09-11 22:25:28 +03:00
| Heroes | HeroesPage |
| Costumes | CostumesPage |
| Items | BoostsPage |
| Team Ups | TeamUpsPage |
| Cards | ChestsPage |
2023-09-11 22:25:28 +03:00
| Specials | SpecialsPage |
| Bundles | BundlesPage |
2023-09-12 16:02:25 +03:00
## Frame Sizes
2023-09-11 22:25:28 +03:00
2023-10-04 06:59:38 +03:00
The actual viewable area is slightly smaller than these.
2023-09-12 16:02:25 +03:00
2023-10-04 06:59:38 +03:00
- TOS Popup: 500x400
2023-09-12 16:02:25 +03:00
2023-10-04 06:59:38 +03:00
- Store Home Page: 974x528
2023-09-12 16:02:25 +03:00
2023-10-04 06:59:38 +03:00
- Store Banner: 748x110
- Store Add G: 1050x700
- Store Bundles: 880x569
2023-09-12 16:02:25 +03:00
- Community News (Version 1): 954x641
- Community News (Version 2) Main Page 988x644
- Community News (Version 2) Popup: 650x764
2025-11-06 17:56:59 +03:00
## Bundles
- Bundle images are downloaded and cached in `%TEMP%\MarvelHeroes`. It is possible for the client to cache an invalid bundle image, which may require clearing the cache to fix it.
- A bundle image needs to be a PNG file with its horizontal and vertical resolution being a multiple of 4. Preferred resolution is 344x128.
- `?gmode=` is appended to information page requests, indicating whether the gifting mode is enabled (0 or 1).