Commit 1f1187d0151eeb3cfe263147e8725f77ac77a6cc

Authored by DarkGod
1 parent c4291a9f

plop

Showing 42 changed files with 115 additions and 12 deletions

11.2 KB | W: | H:

5.36 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

9.76 KB | W: | H:

5.17 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +-- TE4 - T-Engine 4
  2 +-- Copyright (C) 2009 - 2018 Nicolas Casalini
  3 +--
  4 +-- This program is free software: you can redistribute it and/or modify
  5 +-- it under the terms of the GNU General Public License as published by
  6 +-- the Free Software Foundation, either version 3 of the License, or
  7 +-- (at your option) any later version.
  8 +--
  9 +-- This program is distributed in the hope that it will be useful,
  10 +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12 +-- GNU General Public License for more details.
  13 +--
  14 +-- You should have received a copy of the GNU General Public License
  15 +-- along with this program. If not, see <http://www.gnu.org/licenses/>.
  16 +--
  17 +-- Nicolas Casalini "DarkGod"
  18 +-- darkgod@te4.org
  19 +
  20 +defineAction{
  21 + default = { "sym:_y:true:false:false:false" },
  22 + type = "MTXN_PURCHASE",
  23 + group = "microtransactions - cosmetic",
  24 + name = "List purchasable",
  25 + check = function() return profile:canMTXN() end,
  26 +}
  27 +
  28 +defineAction{
  29 + default = { "sym:_y:false:false:true:false" },
  30 + type = "MTXN_USE",
  31 + group = "microtransactions - cosmetic",
  32 + name = "Use purchased",
  33 + check = function() return profile:canMTXN() end,
  34 +}
... ...
... ... @@ -1053,6 +1053,10 @@ function _M:isDonator(s)
1053 1053 if not self.auth or not tonumber(self.auth.donated) or tonumber(self.auth.donated) < s then return false else return true end
1054 1054 end
1055 1055
  1056 +function _M:canMTXN()
  1057 + return self:isDonator()
  1058 +end
  1059 +
1056 1060 function _M:allowDLC(dlc)
1057 1061 -- if core.steam then if core.steam.checkDLC(dlc[2]) then return true end end
1058 1062 -- if self.auth and self.auth.dlcs and self.auth.dlcs[dlc[1]] then return true end
... ...
... ... @@ -205,7 +205,7 @@ function _M:generateList(key_source, force_all)
205 205 local tree = {}
206 206 local groups = {}
207 207 for _, k in ipairs(l) do
208   - if not k.only_on_cheat or config.settings.cheat then
  208 + if (not k.only_on_cheat or config.settings.cheat) and (not k.check or k.check()) then
209 209 local item = {
210 210 k = k,
211 211 name = tstring{{"font","italic"}, {"color","AQUAMARINE"}, k.name, {"font","normal"}},
... ...
... ... @@ -74,7 +74,13 @@ function _M:init(mode)
74 74 direct_draw=function(item, x, y, get_size)
75 75 if get_size then return 132 end
76 76 item.img:toScreen(nil, x+2, y+2, 128, 128)
77   - if self.cart[item.id_purchasable] and item.nb_purchase > 0 then in_cart_icon:toScreen(nil, x+2, y+2, 128, 128) end
  77 + if self.cart[item.id_purchasable] and item.nb_purchase > 0 then
  78 + in_cart_icon:toScreen(nil, x+2, y+2, 128, 128)
  79 + if item.nb_purchase > 1 and item.p_txt then
  80 + item.p_txt._tex:toScreenFull(x + 106 - item.p_txt.w / 2 + 2, y + 106 - item.p_txt.h / 2 + 2, item.p_txt.w, item.p_txt.h, item.p_txt._tex_w, item.p_txt._tex_h, 0, 0, 0, 1)
  81 + item.p_txt._tex:toScreenFull(x + 106 - item.p_txt.w / 2, y + 106 - item.p_txt.h / 2, item.p_txt.w, item.p_txt.h, item.p_txt._tex_w, item.p_txt._tex_h)
  82 + end
  83 + end
78 84 item.txt:display(x+10+130, y+2 + (128 - item.txt.h) / 2, 0)
79 85 end,
80 86 list=self.list, all_clicks=true, fct=function(item, _, button) self:use(item, button) end, select=function(item, sel) self:onSelectItem(item) end}
... ... @@ -153,6 +159,29 @@ function _M:init(mode)
153 159 self:checks()
154 160
155 161 self:generateList()
  162 +
  163 + if not config.settings.tome.mtxn_explain_seen then game:onTickEnd(function()
  164 + game:saveSettings("tome.mtxn_explain_seen", ("tome.mtxn_explain_seen = true\n"):format())
  165 + config.settings.tome.mtxn_explain_seen = true
  166 +
  167 + Dialog:forceNextDialogUI("microtxn")
  168 + self:simpleLongPopup("Online Store", [[Welcome!
  169 +
  170 +I am #{italic}##ANTIQUE_WHITE#DarkGod#LAST##{normal}#, the creator of the game and before you go on your merry way I wish to take a few seconds of your time to explain why there are microtransactions in the game.
  171 +
  172 +Before you run off in terror let me put it plainly: I am very #{bold}#firmly #CRIMSON#against#LAST# pay2win#{normal}# things so rest assured I will not add this kind of stuff.
  173 +
  174 +So why put microtransactions? Tales of Maj'Eyal is a cheap/free game and has no subscription required to play. It is my baby and I love it; I plan to work on it for many years to come (as I do since 2009!) but for it to be viable I must ensure a steady stream of income as this is sadly the state of the world we live in.
  175 +
  176 +As for what kind of purchases are/will be available:
  177 +- #GOLD#Cosmetics#LAST#: in addition to the existing racial cosmetics & item shimmers available in the game you can get new packs of purely cosmetic items & skins to look even more dapper!
  178 +- #GOLD#Pay2DIE#LAST#: Tired of your character? End it with style!
  179 +- #GOLD#Vault space#LAST#: For those that donated they can turn all those "useless" donations into even more online vault slots.
  180 +- #GOLD#Community events#LAST#: A few online events are automatically and randomly triggered by the server. With those options you can force one of them to trigger; bonus point they trigger for the whole server so everybody online benefits from them each time!
  181 +
  182 +I hope I've convinced you of my non-evil intentions (ironic for a DarkGod I know ;)). I must say feel dirty even doing microtransactions even as benign as those but I want to find all the ways I can to ensure the game's future.
  183 +Thanks, and have fun!]], math.min(900, game.w))
  184 + end) end
156 185 end
157 186
158 187 function _M:unload()
... ... @@ -245,6 +274,14 @@ function _M:updateCart()
245 274 recap_qty = item.nb_purchase,
246 275 item = item,
247 276 }
  277 +
  278 + if item.nb_purchase > 1 then
  279 + local str = tostring(item.nb_purchase)
  280 + local gen = self.font:draw(str, str:toTString():maxWidth(self.font), 255, 255, 255)
  281 + if gen and gen[1] then item.p_txt = gen[1] table.print(gen[1]) end
  282 + else
  283 + item.p_txt = nil
  284 + end
248 285 end end
249 286 table.sort(self.recap, "sort_name")
250 287 self.recap[#self.recap+1] = {
... ...
... ... @@ -91,6 +91,7 @@ Make sure you have #GOLD##{bold}#Allow online events#WHITE##{normal}# in the #GO
91 91 return
92 92 end
93 93
  94 + Dialog:forceNextDialogUI("microtxn")
94 95 Dialog:yesnoPopup(item.name, ("You are about to use a charge of this option. You currently have %d charges remaining."):format(item.nb_available), function(ret) if ret then
95 96 local popup = Dialog:simplePopup(item.name, "Please wait while contacting the server...", nil, true)
96 97 profile:registerTemporaryEventHandler("MicroTxnUseActionable", function(e)
... ...
... ... @@ -349,6 +349,10 @@ function _M:webPopup(url)
349 349 return d
350 350 end
351 351
  352 +function _M:forceNextDialogUI(ui)
  353 + _M.force_ui_inside = ui
  354 + _M.force_ui_inside_once = true
  355 +end
352 356
353 357 title_shadow = true
354 358
... ... @@ -356,6 +360,10 @@ function _M:init(title, w, h, x, y, alpha, font, showup, skin)
356 360 if self.force_ui_inside then
357 361 self._lastui = self.ui
358 362 Base:changeDefault(self.force_ui_inside)
  363 + if _M.force_ui_inside_once then
  364 + _M.force_ui_inside_once = nil
  365 + _M.force_ui_inside = nil
  366 + end
359 367 end
360 368
361 369 self.title = title
... ...
... ... @@ -1979,9 +1979,6 @@ function _M:setupCommands()
1979 1979 -- Debug mode
1980 1980 self.key:addCommands{
1981 1981 [{"_d","ctrl"}] = function() if config.settings.cheat then
1982   - package.loaded["mod.dialogs.Donation"] = nil
1983   - self:registerDialog(require("mod.dialogs.Donation").new())
1984   -do return end
1985 1982 local g = self.level.map(self.player.x, self.player.y, Map.TERRAIN)
1986 1983 print(g.define_as, g.image, g.z)
1987 1984 for i, a in ipairs(g.add_mos or {}) do print(" => ", a.image) end
... ... @@ -2000,8 +1997,8 @@ do return end
2000 1997 print("===============")
2001 1998 end end,
2002 1999 [{"_g","ctrl"}] = function() if config.settings.cheat then
2003   - package.loaded["engine.dialogs.microtxn.ShowPurchasable"] = nil
2004   - self:registerDialog(require("engine.dialogs.microtxn.ShowPurchasable").new())
  2000 + package.loaded["mod.dialogs.Donation"] = nil
  2001 + self:registerDialog(require("mod.dialogs.Donation").new())
2005 2002 do return end
2006 2003 if self.zone.short_name ~= "test" then
2007 2004 self:changeLevel(1, "test")
... ... @@ -2021,9 +2018,6 @@ do return end
2021 2018 print(pcall(f))
2022 2019 end end,
2023 2020 [{"_f","ctrl"}] = function() if config.settings.cheat then
2024   - package.loaded["engine.dialogs.microtxn.UsePurchased"] = nil
2025   - self:registerDialog(require("engine.dialogs.microtxn.UsePurchased").new())
2026   -do return end
2027 2021 local m = game.zone:makeEntityByName(game.level, "actor", "NPC_HUMANOID_KROG")
2028 2022 local x, y = util.findFreeGrid(game.player.x, game.player.y, 20, true, {[Map.ACTOR]=true})
2029 2023 if m and x then
... ... @@ -2419,7 +2413,19 @@ do return end
2419 2413 self.log("Movement Mode: #LIGHT_RED#Passive#LAST#.")
2420 2414 game_or_player.bump_attack_disabled = true
2421 2415 end
2422   - end
  2416 + end,
  2417 +
  2418 + MTXN_PURCHASE = function()
  2419 + if not profile:canMTXN() then return end
  2420 + package.loaded["engine.dialogs.microtxn.ShowPurchasable"] = nil
  2421 + self:registerDialog(require("engine.dialogs.microtxn.ShowPurchasable").new())
  2422 + end,
  2423 +
  2424 + MTXN_USE = function()
  2425 + if not profile:canMTXN() then return end
  2426 + package.loaded["engine.dialogs.microtxn.UsePurchased"] = nil
  2427 + self:registerDialog(require("engine.dialogs.microtxn.UsePurchased").new())
  2428 + end,
2423 2429 }
2424 2430 -- add key bindings for targeting mode
2425 2431 self.targetmode_key:addBinds{
... ...
... ... @@ -129,6 +129,9 @@ local pf_money_x, pf_money_y = 0, 0
129 129 local pf_exp_cur_x, pf_exp_cur_y = 0, 0
130 130 local pf_name_x, pf_name_y = 0, 0
131 131 local pf_level_x, pf_level_y = 0, 0
  132 +local pf_mtx = {imageLoader("playerframe/mtx_coin_button.png"):glTexture()}
  133 +local pf_mtx_sel = {imageLoader("playerframe/mtx_coin_button_sel.png"):glTexture()}
  134 +local pf_mtx_x, pf_mtx_y = 0, 0
132 135
133 136 local mm_bg_x, mm_bg_y = 0, 0
134 137 local mm_bg = {imageLoader("minimap/back.png"):glTexture()}
... ... @@ -174,6 +177,8 @@ _M:bindHook("UISet:Minimalist:Load", function(self, data)
174 177 data.alterlocal("pf_money_y", -2)
175 178 data.alterlocal("pf_exp_cur_x", 7)
176 179 data.alterlocal("pf_exp_cur_y", -1)
  180 + data.alterlocal("pf_mtx_x", 5)
  181 + data.alterlocal("pf_mtx_y", -15)
177 182 data.alterlocal("mm_bg_x", -5)
178 183 data.alterlocal("mm_bg_y", -3)
179 184 end)
... ... @@ -1564,6 +1569,10 @@ function _M:displayPlayer(scale, bx, by)
1564 1569 pf_encumber[1]:toScreenFull(162, 38, pf_encumber[6], pf_encumber[7], pf_encumber[2], pf_encumber[3], 1, 1, 1, glow / 255)
1565 1570 end
1566 1571
  1572 + if profile:canMTXN() then
  1573 + pf_mtx[1]:toScreenFull(298 + pf_mtx_x, 6 + pf_mtx_y, pf_mtx[6], pf_mtx[7], pf_mtx[2], pf_mtx[3], 1, 1, 1, 1)
  1574 + end
  1575 +
1567 1576 if not self.locked then
1568 1577 move_handle[1]:toScreenFull(self.mhandle_pos.player.x, self.mhandle_pos.player.y, move_handle[6], move_handle[7], move_handle[2], move_handle[3])
1569 1578 end
... ... @@ -1587,6 +1596,10 @@ function _M:displayPlayer(scale, bx, by)
1587 1596 elseif bx >= 269 and bx <= 269 + pf_levelup[6] and by >= 78 and by <= 78 + pf_levelup[7] and (player.unused_stats > 0 or player.unused_talents > 0 or player.unused_generics > 0 or player.unused_talents_types > 0) then
1588 1597 game.tooltip_x, game.tooltip_y = 1, 1; game:tooltipDisplayAtMap(game.w, game.h, "Click to assign stats and talents!")
1589 1598 if event == "button" and button == "left" then game.key:triggerVirtual("LEVELUP") end
  1599 + -- MTX
  1600 + elseif bx >= 298 + pf_mtx_x and bx <= 298 + pf_mtx_x + pf_mtx[6] and by >= 6 + pf_mtx_y and by <= 6 + pf_mtx_y + pf_mtx[7] and profile:canMTXN() then
  1601 + game.tooltip_x, game.tooltip_y = 1, 1; game:tooltipDisplayAtMap(game.w, game.h, "Show available cosmetic & fun microtransation")
  1602 + if event == "button" and button == "left" then game.key:triggerVirtual("MTXN_PURCHASE") end
1590 1603 -- Move handle
1591 1604 elseif not self.locked and bx >= self.mhandle_pos.player.x and bx <= self.mhandle_pos.player.x + move_handle[6] and by >= self.mhandle_pos.player.y and by <= self.mhandle_pos.player.y + move_handle[7] then
1592 1605 self:uiMoveResize("player", button, mx, my, xrel, yrel, bx, by, event)
... ...

1.13 KB | W: | H:

1.14 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.1 KB | W: | H:

1.08 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.13 KB | W: | H:

1.13 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.13 KB | W: | H:

1.13 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.1 KB | W: | H:

1.08 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.12 KB | W: | H:

1.13 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

48.1 KB | W: | H:

48.1 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

12.7 KB | W: | H:

12.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

48.7 KB | W: | H:

48.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

16.1 KB | W: | H:

16.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

4.07 KB | W: | H:

3.95 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

16.9 KB | W: | H:

16.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

63.9 KB | W: | H:

64.8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

17.9 KB | W: | H:

17.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

64.8 KB | W: | H:

65.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -111,7 +111,7 @@ WorldAchievements:loadDefinition("/data/achievements/")
111 111 PartyLore:loadDefinition("/data/lore/lore.lua")
112 112
113 113 -- Useful keybinds
114   -KeyBind:load("move,hotkeys,inventory,actions,interface,tome,debug")
  114 +KeyBind:load("move,hotkeys,inventory,actions,interface,tome,debug,mtxn")
115 115
116 116 -- Additional entities resolvers
117 117 dofile("/mod/resolvers.lua")
... ...