Commit 66d2d7b3 authored by Ktulho's avatar Ktulho 👶🏻
Browse files

xvm/battle: added macro {{dmg-color-key}}

parent c090d103
Pipeline #550688807 passed with stages
in 2 minutes and 21 seconds
......@@ -2,6 +2,10 @@
* Compatibility with World of Tanks 1.16.1.0
#### Battle
* Added macro `{{dmg-color-key}}`
#### damageLog, hitLog
* Added "high_explosive_stun" parameter to "type-shell" and "c:type-shell" sections.
......
......@@ -2,6 +2,10 @@
* Совместимость с World of Tanks 1.16.1.0
#### Бой
* Добавлен макрос `{{dmg-color-key}}`
#### damageLog, hitLog
* В секции "type-shell" и "c:type-shell" добавлен параметр "high_explosive_stun"
......
......@@ -80,6 +80,7 @@ Legend:
│ D │ {{dmg-kind}} │ │ │ │ │ X │ │ damage kind (attack, fire, ramming, ...)
│ D │ {{dmg-kind-key}} │ │ │ │ │ X │ │ damage kind table key value (shot, fire, ramming, ...)
│ D │ {{c:dmg}} │ │ │ │ │ X │ │ color depending on damage source
│ D │ {{dmg-color-key}} │ │ │ │ │ X │ │ table key name by damage source
│ D │ {{c:dmg-kind}} │ │ │ │ │ X │ │ color depending on damage kind
│S/D│ {{py:f()}} │ X │ X │ X │ X │ X │ X │ dynamic python function call
└───┴────────────────────┴───┴───┴───┴───┴───┴───┴─────────────────────────────────────────
......
......@@ -81,6 +81,7 @@ Legend:
│ D │ {{dmg-kind}} │ │ │ │ │ X │ │ вид урона (атака, пожар ...)
│ D │ {{dmg-kind-key}} │ │ │ │ │ X │ │ название ключа таблицы вида урона (shot, fire, ramming, ...)
│ D │ {{c:dmg}} │ │ │ │ │ X │ │ цвет по источнику урона
│ D │ {{dmg-color-key}} │ │ │ │ │ X │ │ название ключа таблицы по источнику урона
│ D │ {{c:dmg-kind}} │ │ │ │ │ X │ │ цвет по виду урона
│S/D│ {{py:f()}} │ X │ X │ X │ X │ X │ X │ динамический вызов функции в Python
└───┴────────────────────┴───┴───┴───┴───┴───┴───┴────────────────────────────────────────
......
......@@ -403,6 +403,13 @@ package com.xvm.battle
return ps && ps.damageInfo && ps.damageInfo.damageType ? ps.damageInfo.damageType : null;
}
// {{dmg-color-key}}
m_globals["dmg-color-key"] = function(o:IVOMacrosOptions):String
{
var ps:VOPlayerState = o as VOPlayerState;
return ps ? getDamageSystemColorKey(ps) : null;
}
// {{c:dmg}}
m_globals["c:dmg"] = function(o:IVOMacrosOptions):String
{
......@@ -450,36 +457,55 @@ package com.xvm.battle
return o ? parseInt(Config.config.colors.system[getSystemColorKey(o/*, isBase*/)]) : NaN;
}
private static function isDamageDelta(o:VOPlayerState):Boolean
{
return o ? (o.damageInfo ? (o.damageInfo.damageDelta ? true : false) : false) : false;
}
private static function getDamageSystemColor(o:VOPlayerState):Number
{
if (o)
if (isDamageDelta(o))
{
if (o.damageInfo)
switch (o.damageInfo.damageType)
{
if (o.damageInfo.damageDelta)
{
switch (o.damageInfo.damageType)
{
//case "world_collision":
case "death_zone":
//case "drowning":
return getDmgKindValue(o.damageInfo.damageType);
default:
return getDmgSrcColorValue(o);
}
}
//case "world_collision":
case "death_zone":
//case "drowning":
return getDmgKindValue(o.damageInfo.damageType);
default:
return getDmgSrcColorValue(o);
}
}
return NaN;
}
private static function getDmgSrcColorValue(o:VOPlayerState):Number
private static function getDamageSystemColorKey(o:VOPlayerState):String
{
if (isDamageDelta(o))
{
switch (o.damageInfo.damageType)
{
//case "world_collision":
case "death_zone":
//case "drowning":
return o.damageInfo.damageType;
default:
return getDmgSrcColorValueKey(o);
}
}
return null;
}
private static function getDmgSrcColorValueKey(o:VOPlayerState):String
{
if (!o)
return NaN;
var damageSource:String = damageFlagToDamageSource(o.damageInfo.damageFlag);
var damageDest:String = o.isTeamKiller ? (o.isAlly ? "ally" : "enemy") + "tk" : getEntityName(o);
var key:String = damageSource + "_" + damageDest + "_" + (o.isAlive ? "hit" : o.isBlown ? "blowup" : "kill");
return damageSource + "_" + damageDest + "_" + (o.isAlive ? "hit" : o.isBlown ? "blowup" : "kill");
}
private static function getDmgSrcColorValue(o:VOPlayerState):Number
{
var key:String = getDmgSrcColorValueKey(o);
if (Config.config.colors.damage[key] == null)
return NaN;
var value:int = XfwUtils.toInt(Config.config.colors.damage[key], -1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment