Expand auto-hunt pursuit ranges and show server bonus effects
This commit is contained in:
@@ -31,8 +31,8 @@ STOP_TEXT = {
|
||||
STOP_INVENTORY_FULL: "背包已满,自动狩猎已停止",
|
||||
}
|
||||
|
||||
RANGE_VALUES = (1000, 2000, 3500)
|
||||
RANGE_TEXTS = ("近", "中", "远")
|
||||
RANGE_VALUES = (3500, 10000, 15000)
|
||||
RANGE_TEXTS = ("35米", "100米", "150米")
|
||||
HP_VALUES = (0, 30, 50, 70)
|
||||
SP_VALUES = (0, 20, 40, 60)
|
||||
PICKUP_TEXTS = ("不拾取", "全部", "金币装备")
|
||||
@@ -178,7 +178,7 @@ class SettingDialog(ui.BoardWithTitleBar):
|
||||
self.targetLabel.SetPosition(18, y + 4)
|
||||
self.targetLabel.SetText(L("攻击"))
|
||||
self.targetLabel.Show()
|
||||
self.stoneButton = FlagButton(self, 70, y, MIDDLE_BUTTON, "石头", self.__Save)
|
||||
self.stoneButton = FlagButton(self, 70, y, MIDDLE_BUTTON, "优先石头", self.__Save)
|
||||
self.bossButton = FlagButton(self, 136, y, MIDDLE_BUTTON, "首领", self.__Save)
|
||||
y += 30
|
||||
|
||||
@@ -290,14 +290,18 @@ class Ticker(ui.Window):
|
||||
|
||||
def OnUpdate(self):
|
||||
state = player.AutoHuntGetState()
|
||||
if state != self.last:
|
||||
config = player.AutoHuntGetConfig()
|
||||
displayState = state + (config[7],)
|
||||
if displayState != self.last:
|
||||
(stateIndex, reason, noHP, noSP, gathering, gathered) = state
|
||||
wasOn = self.last and self.last[0] != STATE_OFF
|
||||
self.last = state
|
||||
self.last = displayState
|
||||
if stateIndex != STATE_OFF:
|
||||
text = L("自动狩猎 · ") + L(STATE_TEXT.get(stateIndex, ""))
|
||||
if gathering:
|
||||
text = L("自动狩猎 · 披风引怪中(最多%d组)" % player.AutoHuntGetConfig()[7])
|
||||
elif config[7]:
|
||||
text += L(" · 本轮引怪%d/%d组" % (gathered, config[7]))
|
||||
if noHP:
|
||||
text += L(" · 无红药")
|
||||
if noSP:
|
||||
|
||||
@@ -916,6 +916,7 @@ namespace PythonBoot
|
||||
#include "UIScaleOptionScript.inc"
|
||||
#include "InventoryPagesScript.inc"
|
||||
#include "MallHintScript.inc"
|
||||
#include "ServerBonusScript.inc"
|
||||
|
||||
static void install_script_module(const char* c_szModule, const char* c_szScript)
|
||||
{
|
||||
@@ -975,6 +976,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
|
||||
install_script_module("mt_uiscale", c_szUIScaleOptionScript);
|
||||
install_script_module("mt_inventory", c_szInventoryPagesScript);
|
||||
install_script_module("mt_mallhint", c_szMallHintScript);
|
||||
install_script_module("mt_bonuses", c_szServerBonusScript);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// PORT: server rates and privilege events are not character AFFECT packets in 40250.
|
||||
// Add distinct entries to the original affect bar; leave packed scripts unchanged.
|
||||
static const char c_szServerBonusScript[] = R"PY(# -*- coding: utf-8 -*-
|
||||
import app
|
||||
import game
|
||||
import net
|
||||
import player
|
||||
import ui
|
||||
import uiAffectShower
|
||||
|
||||
L = player.AutoHuntLocalize
|
||||
PREFIX = "d:/ymir work/ui/skill/common/affect/"
|
||||
ENTRIES = (
|
||||
("服务器经验 %d%%", "exp_bonus.sub", 100),
|
||||
("服务器金币数量 %d%%", "gold_bonus.sub", 100),
|
||||
("服务器金币掉落率 %d%%", "gold_bonus.sub", 100),
|
||||
("服务器物品掉落率 %d%%", "item_bonus.sub", 100),
|
||||
("活动经验加成 %+d%%", "exp_bonus.sub", 0),
|
||||
("活动物品掉落加成 %+d%%", "item_bonus.sub", 0),
|
||||
("活动金币掉落加成 %+d%%", "gold_bonus.sub", 0),
|
||||
("活动金币礼包掉落加成 %+d%%", "gold_premium.sub", 0),
|
||||
)
|
||||
KEY_START = 20000
|
||||
g_game = None
|
||||
g_ticker = None
|
||||
|
||||
|
||||
def Update(window, *values):
|
||||
if len(values) != len(ENTRIES):
|
||||
return
|
||||
try:
|
||||
values = tuple(int(value) for value in values)
|
||||
except (ValueError, TypeError):
|
||||
return
|
||||
bar = window.affectShower
|
||||
if not bar:
|
||||
return
|
||||
for i, ((text, asset, baseline), value) in enumerate(zip(ENTRIES, values)):
|
||||
key = KEY_START + i
|
||||
image = bar.affectImageDict.get(key)
|
||||
if value == baseline:
|
||||
if image:
|
||||
image.Hide()
|
||||
del bar.affectImageDict[key]
|
||||
continue
|
||||
if not image:
|
||||
image = uiAffectShower.AffectImage()
|
||||
image.SetParent(bar)
|
||||
image.LoadImage(PREFIX + asset)
|
||||
image.SetScale(0.7, 0.7)
|
||||
image.SetAffect(key)
|
||||
image.SetSkillAffectFlag(False)
|
||||
image.SetClock(False)
|
||||
bar.affectImageDict[key] = image
|
||||
image.SetDescription(L(text % value))
|
||||
image.UpdateDescription()
|
||||
image.Show()
|
||||
bar._AffectShower__ArrangeImageList()
|
||||
|
||||
|
||||
class Ticker(ui.Window):
|
||||
def __init__(self, window):
|
||||
ui.Window.__init__(self)
|
||||
self.window = window
|
||||
self.nextQuery = app.GetTime() + 3.0
|
||||
self.Show()
|
||||
|
||||
def OnUpdate(self):
|
||||
now = app.GetTime()
|
||||
if self.window and now >= self.nextQuery:
|
||||
self.nextQuery = now + 15.0
|
||||
net.SendChatPacket("/server_bonuses")
|
||||
|
||||
|
||||
_open = game.GameWindow.Open
|
||||
_close = game.GameWindow.Close
|
||||
_command = game.GameWindow.BINARY_ServerCommand_Run
|
||||
|
||||
|
||||
def Open(self):
|
||||
global g_game, g_ticker
|
||||
_open(self)
|
||||
g_game = self
|
||||
g_ticker = Ticker(self)
|
||||
|
||||
|
||||
def Close(self):
|
||||
global g_game, g_ticker
|
||||
if g_ticker:
|
||||
g_ticker.Hide()
|
||||
g_ticker.window = None
|
||||
g_game = g_ticker = None
|
||||
_close(self)
|
||||
|
||||
|
||||
def Command(self, line):
|
||||
words = line.split()
|
||||
if words and words[0] == "ServerBonuses":
|
||||
Update(self, *words[1:])
|
||||
return 1
|
||||
return _command(self, line)
|
||||
|
||||
|
||||
game.GameWindow.Open = Open
|
||||
game.GameWindow.Close = Close
|
||||
game.GameWindow.BINARY_ServerCommand_Run = Command
|
||||
)PY";
|
||||
Reference in New Issue
Block a user