This commit is contained in:
Chris Chen 2025-11-06 16:58:36 -08:00
parent b44834343a
commit 349510db56
6 changed files with 122 additions and 11 deletions

View File

@ -15,6 +15,7 @@ export enum MobSkillType {
Combat, Combat,
Passive, Passive,
ConditionalSkill, ConditionalSkill,
OtherWiseSkill,
ActiveSkill, ActiveSkill,
MeleeAttack = 15, MeleeAttack = 15,
RangeAttack, RangeAttack,

View File

@ -57,7 +57,6 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
private msgBoxService: MsgBoxService private msgBoxService: MsgBoxService
) { ) {
super(dialog); super(dialog);
this.initializeEnums();
} }
ngOnInit(): void { ngOnInit(): void {
@ -68,6 +67,7 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
} }
this.loadSkills(); this.loadSkills();
} }
this.initializeEnums();
} }
private initializeEnums(): void { private initializeEnums(): void {
@ -140,6 +140,9 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
attackInfo: lastLevel.attackInfo attackInfo: lastLevel.attackInfo
? { ...lastLevel.attackInfo } ? { ...lastLevel.attackInfo }
: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null }, : { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null },
alterAttackInfo: lastLevel.alterAttackInfo
? { ...lastLevel.alterAttackInfo }
: null,
defenceInfo: lastLevel.defenceInfo defenceInfo: lastLevel.defenceInfo
? { ...lastLevel.defenceInfo } ? { ...lastLevel.defenceInfo }
: { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null } : { 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, hpPerHero: 0,
actions: actions, actions: actions,
attackInfo: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null }, 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 } 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: case 1:
newLevel.rewardTokens = 2; newLevel.rewardTokens = 2;
newLevel.fixedRareTreasure = 1; newLevel.fixedRareTreasure = 1;
newLevel.fixedEpicTreasure = 0;
newLevel.fixedLegendTreasure = 0;
break; break;
case 3: case 3:
newLevel.rewardTokens = 2; newLevel.rewardTokens = 2;
newLevel.fixedRareTreasure = 0;
newLevel.fixedEpicTreasure = 1; newLevel.fixedEpicTreasure = 1;
newLevel.fixedLegendTreasure = 0;
break; break;
case 5: case 5:
newLevel.rewardTokens = 0; newLevel.rewardTokens = 0;
newLevel.fixedRareTreasure = 0;
newLevel.fixedEpicTreasure = 3; newLevel.fixedEpicTreasure = 3;
newLevel.fixedLegendTreasure = 0;
break; break;
} }
break; break;
@ -309,11 +319,11 @@ export class MD2MobInfoDetailComponent extends DialogContentBase implements OnIn
level: level, level: level,
mobInfoId: this.mobInfo.id, mobInfoId: this.mobInfo.id,
type: type, type: type,
skillTarget: MobSkillTarget.Random, skillTarget: lastLevel?.skillTarget || MobSkillTarget.Random,
clawRoll: 0, clawRoll: lastLevel?.clawRoll || 0,
skillRoll: 1, skillRoll: lastLevel?.skillRoll || 1,
name: 'Basic Skill', name: lastLevel?.name || 'Combat Skill',
skillCondition: '', skillCondition: lastLevel?.skillCondition || '',
description: lastLevel?.description || '' description: lastLevel?.description || ''
}; };

View File

@ -20,10 +20,15 @@
<kendo-grid-column field="name" title="Name" [width]="200"> <kendo-grid-column field="name" title="Name" [width]="200">
</kendo-grid-column> </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>
<ng-template kendoGridCellTemplate let-dataItem> <ng-template kendoGridCellTemplate let-dataItem>
{{ getMobTypeName(dataItem.type) }} {{ getMobTypeName(dataItem.type) }}
</ng-template> </ng-template>
<ng-template kendoGridGroupHeaderTemplate let-value="value">
{{ getMobTypeName(value) }}
</ng-template>
</ng-template>
</kendo-grid-column> </kendo-grid-column>
<kendo-grid-column field="from" title="Game Bundle" [width]="150"> <kendo-grid-column field="from" title="Game Bundle" [width]="150">

View File

@ -119,6 +119,22 @@
<div class="col-md-12"> <div class="col-md-12">
<h5>Attack Info</h5> <h5>Attack Info</h5>
</div> </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="col-md-2">
<div class="form-group"> <div class="form-group">
<label class="k-label"> <label class="k-label">
@ -157,6 +173,63 @@
</div> </div>
</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> </form>
</div> </div>

View File

@ -5,6 +5,7 @@ import { MD2MobLevelInfo } from '../../massive-darkness2.db.model';
import { MobSkillType } from '../../massive-darkness2.model.boss'; import { MobSkillType } from '../../massive-darkness2.model.boss';
import { MD2MobLevelInfoService } from '../../service/massive-darkness2.service'; import { MD2MobLevelInfoService } from '../../service/massive-darkness2.service';
import { MD2Icon, MobType } from '../../massive-darkness2.model'; import { MD2Icon, MobType } from '../../massive-darkness2.model';
import { MD2StateService } from '../../../../services/MD2/md2-state.service';
@Component({ @Component({
selector: 'ngx-md2-mob-level-editor', selector: 'ngx-md2-mob-level-editor',
@ -20,21 +21,35 @@ export class MD2MobLevelEditorComponent extends DialogContentBase implements OnI
@Input() public mobInfoId: string; @Input() public mobInfoId: string;
@Input() public isAdding: boolean = false; @Input() public isAdding: boolean = false;
public selectedAttackType: { value: MobSkillType; text: string } | null = null;
public model: MD2MobLevelInfo; public model: MD2MobLevelInfo;
public processing: boolean = false; public processing: boolean = false;
public attackTypes: Array<{ value: MobSkillType; text: string }> = [];
public selectedAlterAttackType: { value: MobSkillType; text: string } | null = null;
constructor( constructor(
public dialog: DialogRef, public dialog: DialogRef,
private mobLevelInfoService: MD2MobLevelInfoService, private mobLevelInfoService: MD2MobLevelInfoService,
private cdr: ChangeDetectorRef private cdr: ChangeDetectorRef,
private md2StateService: MD2StateService
) { ) {
super(dialog); super(dialog);
} }
ngOnInit(): void { ngOnInit(): void {
this.initializeModel(); 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 { public initializeModel(): void {
this.model = { this.model = {
id: this.data?.id || '', id: this.data?.id || '',
@ -50,6 +65,9 @@ export class MD2MobLevelEditorComponent extends DialogContentBase implements OnI
attackInfo: this.data?.attackInfo attackInfo: this.data?.attackInfo
? { ...this.data.attackInfo } ? { ...this.data.attackInfo }
: { type: MobSkillType.Attack, yellow: null, orange: null, red: null, blue: null, green: null, black: null }, : { 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 defenceInfo: this.data?.defenceInfo
? { ...this.data.defenceInfo } ? { ...this.data.defenceInfo }
: { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null } : { 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) { if (!this.model.defenceInfo) {
this.model.defenceInfo = { type: MobSkillType.Defense, yellow: null, orange: null, red: null, blue: null, green: null, black: null }; 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.mobLevelInfoService.createOrUpdate(this.model).pipe(first()).subscribe(result => {
this.processing = false; this.processing = false;
this.dialog.close(result); this.dialog.close(result);

View File

@ -83,3 +83,4 @@ export class MD2StateService {
return this.imgHtml(`TreasureToken/${TreasureType[type]}.png`, 'g-height-40 mr-1'); return this.imgHtml(`TreasureToken/${TreasureType[type]}.png`, 'g-height-40 mr-1');
} }
} }