- Add unit, buildings, sergeants income resources
- Add repair speed - Add UA support - Rework race page
This commit is contained in:
@@ -19,6 +19,7 @@ import {ExpandMore} from "@mui/icons-material";
|
||||
import {IconUrl} from "../../core/api";
|
||||
import {IBuildingShort} from "../../types/IBuildingShort";
|
||||
import {goToAddon} from "../../pages/BuildingPage";
|
||||
import {IMod} from "../../types/Imod";
|
||||
|
||||
interface IAddonModifiersProvidesTable{
|
||||
modifiers: IAddonModifier[],
|
||||
@@ -34,10 +35,22 @@ function AddonModifiersProvidesTable (props: IAddonModifiersProvidesTable) {
|
||||
return 'Health';
|
||||
case 'modifiers\\keen_sight_radius_modifier.lua':
|
||||
return 'Detect';
|
||||
case 'modifiers\\sight_radius_modifier.lua':
|
||||
return 'Sight';
|
||||
case 'modifiers\\garrison_requisition_modifier.lua':
|
||||
return 'Requisition';
|
||||
case 'modifiers\\faith_max_modifier.lua':
|
||||
return 'Faith max';
|
||||
case 'modifiers\\holy_icon_cost_power.lua':
|
||||
return <span>Next icon cost <img style={{verticalAlign: "top"}} src='/images/Resource_power.gif'/></span>;
|
||||
case 'modifiers\\holy_icon_cost_requisition.lua':
|
||||
return <span>Next icon cost <img style={{verticalAlign: "top"}} src='/images/Resource_requisition.gif'/></span>;
|
||||
case 'modifiers\\enable_hardpoint_02.lua':
|
||||
return 'Weapon slot 2';
|
||||
case 'modifiers\\cost_requisition_modifier.lua':
|
||||
return 'Requisition cost';
|
||||
default:
|
||||
return mt;
|
||||
return mt.replace("modifiers\\", "").replace("modifier.lua", "").replace(".lua", "").replaceAll("_", " ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,23 +62,35 @@ function AddonModifiersProvidesTable (props: IAddonModifiersProvidesTable) {
|
||||
return <img style={{verticalAlign: "top"}} src='/images/Health_icon.webp'/>;
|
||||
case 'modifiers\\keen_sight_radius_modifier.lua':
|
||||
return <img style={{verticalAlign: "top"}} src='/images/DETECT_YES.webp'/>;
|
||||
case 'modifiers\\sight_radius_modifier.lua':
|
||||
return <img style={{verticalAlign: "top"}} src='/images/DETECT_NO.webp'/>;
|
||||
case 'modifiers\\faith_max_modifier.lua':
|
||||
return <img style={{verticalAlign: "top"}} src='/images/Resource_faith.gif'/>;
|
||||
case 'modifiers\\garrison_requisition_modifier.lua':
|
||||
return <img style={{verticalAlign: "top"}} src='/images/Resource_requisition.gif'/>;
|
||||
case 'modifiers\\cost_requisition_modifier.lua':
|
||||
return <img style={{verticalAlign: "top"}} src='/images/Resource_requisition.gif'/>;
|
||||
default:
|
||||
return mt;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function getChangeDescription(ref: String) {
|
||||
function getChangeDescription(ref: String, v: number) {
|
||||
switch(ref) {
|
||||
case 'type_modifierusagetype\\tp_mod_usage_addition.lua':
|
||||
return '+';
|
||||
if(v < 0){
|
||||
return v
|
||||
}else return '+' + v;
|
||||
case 'type_modifierusagetype\\tp_mod_usage_multiplication.lua':
|
||||
return 'x';
|
||||
return 'x' + v;
|
||||
case 'type_modifierusagetype\\tp_mod_usage_percentage.lua':
|
||||
return '%';
|
||||
return '%' + v;
|
||||
case 'type_modifierusagetype\\tp_mod_usage_enable.lua':
|
||||
return ' enable ';
|
||||
if(v === 1){
|
||||
return ' enable ';
|
||||
} else {
|
||||
return ' disable ';
|
||||
}
|
||||
default:
|
||||
return ref;
|
||||
}
|
||||
@@ -81,7 +106,7 @@ function AddonModifiersProvidesTable (props: IAddonModifiersProvidesTable) {
|
||||
sx={{'&:last-child td, &:last-child th': {border: 0}}}
|
||||
>
|
||||
<TableCell component="th" scope="row">{getModName(m.reference)}</TableCell>
|
||||
<TableCell component="th" scope="row">{getModIcon(m.reference)} {getChangeDescription(m.usageType)}{m.value}</TableCell>
|
||||
<TableCell component="th" scope="row">{getModIcon(m.reference)} {getChangeDescription(m.usageType, m.value)}</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</Table>
|
||||
@@ -92,7 +117,8 @@ function AddonModifiersProvidesTable (props: IAddonModifiersProvidesTable) {
|
||||
interface IAddonModifiersProvidesWeapons{
|
||||
modifiers: IAddonModifier[],
|
||||
replacedAddonModifiers: IAddonModifier[],
|
||||
weapons: WeaponHardpoint[]
|
||||
weapons: WeaponHardpoint[],
|
||||
mod: IMod,
|
||||
}
|
||||
|
||||
function AddonModifiersProvidesWeapons (props: IAddonModifiersProvidesWeapons) {
|
||||
@@ -107,7 +133,7 @@ function AddonModifiersProvidesWeapons (props: IAddonModifiersProvidesWeapons) {
|
||||
|
||||
let weapon = props.weapons.find(w => w.hardpoint === hardpoint && w.hardpointOrder === 1 + value )?.weapon
|
||||
if (weapon != null){
|
||||
return <WeaponSlot unitWeapons={new Map().set(hardpoint, weapon)} hardpoint={hardpoint}/>;
|
||||
return <WeaponSlot mod={props.mod} unitWeapons={new Map().set(hardpoint, weapon)} hardpoint={hardpoint}/>;
|
||||
}else{
|
||||
return "Can't find weapon, replaced by addon:" + value + " - "
|
||||
}
|
||||
@@ -126,7 +152,8 @@ function AddonModifiersProvidesWeapons (props: IAddonModifiersProvidesWeapons) {
|
||||
|
||||
interface IBuildingAddonProps {
|
||||
addon: IBuildingAddon,
|
||||
building: IBuilding
|
||||
building: IBuilding,
|
||||
mod: IMod,
|
||||
}
|
||||
|
||||
function BuildingAddon(props: IBuildingAddonProps){
|
||||
@@ -145,12 +172,12 @@ function BuildingAddon(props: IBuildingAddonProps){
|
||||
return requirementBuildings.length > 0 && (
|
||||
<div> Buildings: <img style={{verticalAlign: "top", height: 25}}
|
||||
src={IconUrl + requirementBuildings[0].icon.replaceAll('\\', '/')}/>
|
||||
{" "}<a href={`/mod/${building.modId}/race/${building.race.id}/building/${requirementBuildings[0].id}`}>
|
||||
{" "}<a href={`/mod/${props.mod.id}/race/${building.race.id}/building/${requirementBuildings[0].id}`}>
|
||||
{requirementBuildings[0].name}
|
||||
</a> or <img style={{verticalAlign: "top", height: 25}}
|
||||
src={IconUrl + requirementBuildings[1].icon.replaceAll('\\', '/')}/>
|
||||
{" "}<a href={`/mod/${building.modId}/race/${building.race.id}/building/${requirementBuildings[1].id}`}>
|
||||
{requirementBuildings[1].name}</a></div>
|
||||
</a> {requirementBuildings[1] !== undefined && <span>or <img style={{verticalAlign: "top", height: 25}}
|
||||
src={IconUrl + requirementBuildings[1].icon.replaceAll('\\', '/')}/>
|
||||
{" "}<a href={`/mod/${props.mod.id}/race/${building.race.id}/building/${requirementBuildings[1].id}`}>
|
||||
{requirementBuildings[1].name}</a></span> } </div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -158,7 +185,7 @@ function BuildingAddon(props: IBuildingAddonProps){
|
||||
return <div> {rgas.map(rga =>
|
||||
<span> Global addon: <img style={{verticalAlign: "top", height: 25}}
|
||||
src={IconUrl + rga.icon.replaceAll('\\', '/')}/>
|
||||
<a href={`/mod/${building.modId}/race/${building.race.id}/building/${rga.buildingId}#addon-${rga.id}`}>
|
||||
<a href={`/mod/${props.mod.id}/race/${building.race.id}/building/${rga.buildingId}#addon-${rga.id}`}>
|
||||
{rga.name}
|
||||
</a></span>
|
||||
)}</div>
|
||||
@@ -224,7 +251,7 @@ function BuildingAddon(props: IBuildingAddonProps){
|
||||
</Grid2>
|
||||
{addon.addonModifiers !== null &&
|
||||
<Grid2 size={{xs: 12, md: 12}}>
|
||||
<AddonModifiersProvidesWeapons modifiers={addon.addonModifiers} replacedAddonModifiers={prevAddonModifiers} weapons={building.weapons}/>
|
||||
<AddonModifiersProvidesWeapons mod={props.mod} modifiers={addon.addonModifiers} replacedAddonModifiers={prevAddonModifiers} weapons={building.weapons}/>
|
||||
</Grid2>}
|
||||
{addon.addonRequirement !== null &&
|
||||
<Grid2 size={{xs: 12, md: 12}}>
|
||||
@@ -244,7 +271,7 @@ function BuildingAddon(props: IBuildingAddonProps){
|
||||
{addon.addonRequirement.requirementBuildings.map(b =>
|
||||
<div> Building: <img style={{verticalAlign: "top", height: 25}}
|
||||
src={IconUrl + b.icon.replaceAll('\\', '/')}/>
|
||||
<a href= {'/mod/'+ building.modId +'/race/'+ building.race.id +'/building/' + b.id + "/"}>{b.name}</a></div>)
|
||||
<a href= {'/mod/'+ props.mod.id +'/race/'+ building.race.id +'/building/' + b.id + "/"}>{b.name}</a></div>)
|
||||
}
|
||||
{addon.addonRequirement.requirementBuildingsEither.length !== 0 &&
|
||||
renderRequirementBuilding(addon.addonRequirement.requirementBuildingsEither, building)}
|
||||
|
||||
Reference in New Issue
Block a user