WIP
This commit is contained in:
parent
b44834343a
commit
349510db56
@ -15,6 +15,7 @@ export enum MobSkillType {
|
||||
Combat,
|
||||
Passive,
|
||||
ConditionalSkill,
|
||||
OtherWiseSkill,
|
||||
ActiveSkill,
|
||||
MeleeAttack = 15,
|
||||
RangeAttack,
|
||||
|
||||
@ -57,7 +57,6 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
private msgBoxService: MsgBoxService
|
||||
) {
|
||||
super(dialog);
|
||||
this.initializeEnums();
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -68,6 +67,7 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
}
|
||||
this.loadSkills();
|
||||
}
|
||||
this.initializeEnums();
|
||||
}
|
||||
|
||||
private initializeEnums(): void {
|
||||
@ -140,6 +140,9 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
attackInfo: lastLevel.attackInfo
|
||||
? { ...lastLevel.attackInfo }
|
||||
: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
|
||||
alterAttackInfo: lastLevel.alterAttackInfo
|
||||
? { ...lastLevel.alterAttackInfo }
|
||||
: null,
|
||||
defenceInfo: lastLevel.defenceInfo
|
||||
? { ...lastLevel.defenceInfo }
|
||||
: { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null }
|
||||
@ -158,6 +161,7 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
hpPerHero: 0,
|
||||
actions: actions,
|
||||
attackInfo: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
|
||||
alterAttackInfo: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
|
||||
defenceInfo: { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null }
|
||||
};
|
||||
}
|
||||
@ -186,14 +190,20 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
case 1:
|
||||
newLevel.rewardTokens = 2;
|
||||
newLevel.fixedRareTreasure = 1;
|
||||
newLevel.fixedEpicTreasure = 0;
|
||||
newLevel.fixedLegendTreasure = 0;
|
||||
break;
|
||||
case 3:
|
||||
newLevel.rewardTokens = 2;
|
||||
newLevel.fixedRareTreasure = 0;
|
||||
newLevel.fixedEpicTreasure = 1;
|
||||
newLevel.fixedLegendTreasure = 0;
|
||||
break;
|
||||
case 5:
|
||||
newLevel.rewardTokens = 0;
|
||||
newLevel.fixedRareTreasure = 0;
|
||||
newLevel.fixedEpicTreasure = 3;
|
||||
newLevel.fixedLegendTreasure = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -309,11 +319,11 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
|
||||
level: level,
|
||||
mobInfoId: this.mobInfo.id,
|
||||
type: type,
|
||||
skillTarget: MobSkillTarget.Random,
|
||||
clawRoll: 0,
|
||||
skillRoll: 1,
|
||||
name: 'Basic Skill',
|
||||
skillCondition: '',
|
||||
skillTarget: lastLevel?.skillTarget || MobSkillTarget.Random,
|
||||
clawRoll: lastLevel?.clawRoll || 0,
|
||||
skillRoll: lastLevel?.skillRoll || 1,
|
||||
name: lastLevel?.name || 'Combat Skill',
|
||||
skillCondition: lastLevel?.skillCondition || '',
|
||||
description: lastLevel?.description || ''
|
||||
};
|
||||
|
||||
|
||||
@ -20,9 +20,14 @@
|
||||
<kendo-grid-column field="name" title="Name" [width]="200">
|
||||
</kendo-grid-column>
|
||||
|
||||
<kendo-grid-column field="type" title="Type" [width]="150">
|
||||
<kendo-grid-column field="type" title="Type" [width]="1">
|
||||
<ng-template kendoGridCellTemplate let-dataItem>
|
||||
{{ getMobTypeName(dataItem.type) }}
|
||||
<ng-template kendoGridCellTemplate let-dataItem>
|
||||
{{ getMobTypeName(dataItem.type) }}
|
||||
</ng-template>
|
||||
<ng-template kendoGridGroupHeaderTemplate let-value="value">
|
||||
{{ getMobTypeName(value) }}
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
</kendo-grid-column>
|
||||
|
||||
|
||||
@ -119,6 +119,22 @@
|
||||
<div class="col-md-12">
|
||||
<h5>Attack Info</h5>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.Attack"></md2-icon>Attack Type</label>
|
||||
<!-- Dropdown list for attack type , the text is html string-->
|
||||
<kendo-dropdownlist [(ngModel)]="selectedAttackType" name="attackInfo.type" [data]="attackTypes"
|
||||
[textField]="'text'" [valueField]="'value'">
|
||||
<ng-template kendoDropDownListItemTemplate let-dataItem>
|
||||
<span [innerHTML]="dataItem.text"></span>
|
||||
</ng-template>
|
||||
<ng-template kendoDropDownListValueTemplate let-dataItem>
|
||||
<span [innerHTML]="dataItem?.text || ''"></span>
|
||||
</ng-template>
|
||||
</kendo-dropdownlist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
@ -157,6 +173,63 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" *ngIf="mobType!=MobType.Mob">
|
||||
<div class="col-md-12">
|
||||
<h5>Alter Attack Info</h5>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.Attack"></md2-icon>Alter Attack Type</label>
|
||||
<!-- Dropdown list for attack type , the text is html string-->
|
||||
<kendo-dropdownlist [(ngModel)]="selectedAlterAttackType" name="alterAttackInfo.type"
|
||||
[data]="attackTypes" [textField]="'text'" [valueField]="'value'">
|
||||
<ng-template kendoDropDownListItemTemplate let-dataItem>
|
||||
<span [innerHTML]="dataItem.text"></span>
|
||||
</ng-template>
|
||||
<ng-template kendoDropDownListValueTemplate let-dataItem>
|
||||
<span [innerHTML]="dataItem?.text || ''"></span>
|
||||
</ng-template>
|
||||
</kendo-dropdownlist>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.YellowDice"></md2-icon>Yellow Dice</label>
|
||||
<kendo-numerictextbox [(ngModel)]="model.alterAttackInfo.yellow" name="alterAttackInfo.yellow"
|
||||
[min]="0" [decimals]="0" [format]="'n0'">
|
||||
</kendo-numerictextbox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.OrangeDice"></md2-icon>Orange Dice</label>
|
||||
<kendo-numerictextbox [(ngModel)]="model.alterAttackInfo.orange" name="alterAttackInfo.orange"
|
||||
[min]="0" [decimals]="0" [format]="'n0'">
|
||||
</kendo-numerictextbox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.RedDice"></md2-icon>Red Dice</label>
|
||||
<kendo-numerictextbox [(ngModel)]="model.alterAttackInfo.red" name="alterAttackInfo.red" [min]="0"
|
||||
[decimals]="0" [format]="'n0'">
|
||||
</kendo-numerictextbox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="k-label">
|
||||
<md2-icon [icon]="MD2Icon.BlackDice"></md2-icon>Black Dice</label>
|
||||
<kendo-numerictextbox [(ngModel)]="model.alterAttackInfo.black" name="alterAttackInfo.black"
|
||||
[min]="0" [decimals]="0" [format]="'n0'">
|
||||
</kendo-numerictextbox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import { MD2MobLevelInfo } from '../../massive-darkness2.db.model';
|
||||
import { MobSkillType } from '../../massive-darkness2.model.boss';
|
||||
import { MD2MobLevelInfoService } from '../../service/massive-darkness2.service';
|
||||
import { MD2Icon, MobType } from '../../massive-darkness2.model';
|
||||
import { MD2StateService } from '../../../../services/MD2/md2-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-md2-mob-level-editor',
|
||||
@ -20,21 +21,35 @@ export class MD2MobLevelEditorComponent extends DialogContentBase implements OnI
|
||||
@Input() public mobInfoId: string;
|
||||
@Input() public isAdding: boolean = false;
|
||||
|
||||
public selectedAttackType: { value: MobSkillType; text: string } | null = null;
|
||||
public model: MD2MobLevelInfo;
|
||||
public processing: boolean = false;
|
||||
|
||||
public attackTypes: Array<{ value: MobSkillType; text: string }> = [];
|
||||
public selectedAlterAttackType: { value: MobSkillType; text: string } | null = null;
|
||||
constructor(
|
||||
public dialog: DialogRef,
|
||||
private mobLevelInfoService: MD2MobLevelInfoService,
|
||||
private cdr: ChangeDetectorRef
|
||||
private cdr: ChangeDetectorRef,
|
||||
private md2StateService: MD2StateService
|
||||
) {
|
||||
super(dialog);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initializeModel();
|
||||
this.initializeEnums();
|
||||
}
|
||||
|
||||
public initializeEnums(): void {
|
||||
this.attackTypes = [
|
||||
{ value: MobSkillType.Attack, text: 'None' },
|
||||
{ value: MobSkillType.MeleeAttack, text: this.md2StateService.iconHtml(MD2Icon.Melee) + ' Melee Attack' },
|
||||
{ value: MobSkillType.RangeAttack, text: this.md2StateService.iconHtml(MD2Icon.Range) + ' Range Attack' },
|
||||
{ value: MobSkillType.MagicAttack, text: this.md2StateService.iconHtml(MD2Icon.Magic) + ' Magic Attack' },
|
||||
];
|
||||
this.selectedAttackType = this.attackTypes.find(t => t.value === this.model.attackInfo.type) || this.attackTypes[0] || null;
|
||||
this.selectedAlterAttackType = this.attackTypes.find(t => t.value === this.model.alterAttackInfo?.type) || this.attackTypes[0] || null;
|
||||
}
|
||||
public initializeModel(): void {
|
||||
this.model = {
|
||||
id: this.data?.id || '',
|
||||
@ -50,6 +65,9 @@ export class MD2MobLevelEditorComponent extends DialogContentBase implements OnI
|
||||
attackInfo: this.data?.attackInfo
|
||||
? { ...this.data.attackInfo }
|
||||
: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
|
||||
alterAttackInfo: this.data?.alterAttackInfo
|
||||
? { ...this.data.alterAttackInfo }
|
||||
: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
|
||||
defenceInfo: this.data?.defenceInfo
|
||||
? { ...this.data.defenceInfo }
|
||||
: { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null }
|
||||
@ -73,7 +91,10 @@ export class MD2MobLevelEditorComponent extends DialogContentBase implements OnI
|
||||
if (!this.model.defenceInfo) {
|
||||
this.model.defenceInfo = { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null };
|
||||
}
|
||||
|
||||
this.model.attackInfo.type = this.selectedAttackType?.value ?? MobSkillType.Attack;
|
||||
if (this.model.alterAttackInfo) {
|
||||
this.model.alterAttackInfo.type = this.selectedAlterAttackType?.value ?? MobSkillType.Attack;
|
||||
}
|
||||
this.mobLevelInfoService.createOrUpdate(this.model).pipe(first()).subscribe(result => {
|
||||
this.processing = false;
|
||||
this.dialog.close(result);
|
||||
|
||||
@ -83,3 +83,4 @@ export class MD2StateService {
|
||||
return this.imgHtml(`TreasureToken/${TreasureType[type]}.png`, 'g-height-40 mr-1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user