NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Kamihime Project R - Display ability turns // @description Displays ability turn cooldown directly on character card // @updateURL https://openuserjs.org/meta/nike/Kamihime_Project_R_-_Display_ability_turns.meta.js // @license MIT // @match https://gnkh-api-r.prod.nkh.dmmgames.com/front/cocos2d-proj/components-pc/game/app.html // @run-at document-start // ==/UserScript== (function() { var interval = setInterval(function() { if (typeof kh !== 'undefined' && kh.CharacterCard) { clearInterval(interval); kh.CHARACTER_PANEL_ABILITY_TURN = { COUNT: 4, NAME: "ability_turn_" }; var generateAbilityTurnUi = function(characterCard, index, x, y) { var newAbilityTurnName = kh.CHARACTER_PANEL_ABILITY_TURN.NAME + index.toString() var targetAbilityTurn = characterCard._widget.seekWidgetByName(newAbilityTurnName) if (typeof targetStatus === 'undefined' || targetStatus === null) { var new_ability_turn = new ccui.Text() new_ability_turn.setName(newAbilityTurnName) new_ability_turn.setPosition(x, y) new_ability_turn.setFontSize(12); new_ability_turn.enableOutline(cc.color(0, 0, 0), 2); characterCard._widget.addChild(new_ability_turn) } } var _CHARACTER_CARD_INIT_ELEMENTS_ABILITY_TURNS if (typeof _CHARACTER_CARD_INIT_ELEMENTS_ABILITY_TURNS === 'undefined') { var orig_init_elements = kh.CharacterCard.prototype._initElements; kh.CharacterCard.prototype._initElements = function() { generateAbilityTurnUi(this, 0, 75.5, 31.5) generateAbilityTurnUi(this, 1, 93.5, 31.5) generateAbilityTurnUi(this, 2, 111.5, 31.5) generateAbilityTurnUi(this, 3, 129.5, 31.5) this._abilityTurns = this._setUiArrayList(this._widget, kh.CHARACTER_PANEL_ABILITY_TURN) orig_init_elements.apply(this) } var _CHARACTER_CARD_INIT_ELEMENTS_ABILITY_TURNS = true } kh.CharacterCard.prototype.updateAbilityTurn = function(turn, index, isUsable) { var color = !isUsable ? "black" : this.abilityIconColors[index]; var diamondTexture = this.ABILITY_ICON_RESOURCE_NAMES[color]; var abilityIcon = this.abilityIcons[index]; abilityIcon.loadTexture(diamondTexture, ccui.Widget.PLIST_TEXTURE); if (turn == 0 || typeof turn === 'boolean') { this._abilityTurns[index].setVisible(false) this._abilityTurns[index].setText("") } else { this._abilityTurns[index].setVisible(true) this._abilityTurns[index].setText(turn.toString()) } } } }, 10); })();