Commit f9ff153d authored by Romain DELEAU's avatar Romain DELEAU

add discussion/sentence/response rewards

parent 88e5cb61
......@@ -315,6 +315,39 @@ export class AppComponent {
discussionData
);
discussion.character = character as Character;
discussion.rewards = discussion.rewards.map((rewardData: any) => {
if (rewardData.type == 'skill') {
return Object.assign(new SkillReward(), rewardData);
}
if (rewardData.type == 'character') {
return Object.assign(new CharacterReward(), rewardData);
}
if (rewardData.type == 'quest') {
return Object.assign(new QuestReward(), rewardData);
}
if (rewardData.type == 'object') {
return Object.assign(new ObjectReward(), rewardData);
}
});
discussion.rewards.forEach((reward: Reward, index: number) => {
if (reward instanceof SkillReward) {
let i: number = role.ressources.findIndex(element => element.type == 'attribut' && element.name == reward.skill.name && element.number == reward.skill.number);
reward.skill = role.ressources[i];
}
if (reward instanceof CharacterReward) {
let i: number = scenario.characters.findIndex(element => element.color == reward.character.color && element.description == reward.character.description && element.name == reward.character.name);
reward.character = scenario.characters[i];
}
if (reward instanceof ObjectReward) {
if (scenario.ressources.some(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number)) {
let i: number = scenario.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = role.ressources[i];
}
}
});
return discussion;
});
role.sentences = role.sentences.map((sentenceData: any) => {
......@@ -324,7 +357,78 @@ export class AppComponent {
return Object.assign(new DeclarativeSentence(sentenceData.ID), sentenceData);
}
});
role.sentences.forEach(sentence => {
sentence.rewards = sentence.rewards.map((rewardData: any) => {
if (rewardData.type == 'skill') {
return Object.assign(new SkillReward(), rewardData);
}
if (rewardData.type == 'character') {
return Object.assign(new CharacterReward(), rewardData);
}
if (rewardData.type == 'quest') {
return Object.assign(new QuestReward(), rewardData);
}
if (rewardData.type == 'object') {
return Object.assign(new ObjectReward(), rewardData);
}
});
sentence.rewards.forEach((reward: Reward, index: number) => {
if (reward instanceof SkillReward) {
let i: number = role.ressources.findIndex(element => element.type == 'attribut' && element.name == reward.skill.name && element.number == reward.skill.number);
reward.skill = role.ressources[i];
}
if (reward instanceof CharacterReward) {
let i: number = scenario.characters.findIndex(element => element.color == reward.character.color && element.description == reward.character.description && element.name == reward.character.name);
reward.character = scenario.characters[i];
}
if (reward instanceof ObjectReward) {
if (scenario.ressources.some(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number)) {
let i: number = scenario.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = role.ressources[i];
}
}
});
});
role.responses = role.responses.map((responseData: any) => Object.assign(new Response(responseData.ID), responseData));
role.responses.forEach(response => {
response.rewards = response.rewards.map((rewardData: any) => {
if (rewardData.type == 'skill') {
return Object.assign(new SkillReward(), rewardData);
}
if (rewardData.type == 'character') {
return Object.assign(new CharacterReward(), rewardData);
}
if (rewardData.type == 'quest') {
return Object.assign(new QuestReward(), rewardData);
}
if (rewardData.type == 'object') {
return Object.assign(new ObjectReward(), rewardData);
}
});
response.rewards.forEach((reward: Reward, index: number) => {
if (reward instanceof SkillReward) {
let i: number = role.ressources.findIndex(element => element.type == 'attribut' && element.name == reward.skill.name && element.number == reward.skill.number);
reward.skill = role.ressources[i];
}
if (reward instanceof CharacterReward) {
let i: number = scenario.characters.findIndex(element => element.color == reward.character.color && element.description == reward.character.description && element.name == reward.character.name);
reward.character = scenario.characters[i];
}
if (reward instanceof ObjectReward) {
if (scenario.ressources.some(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number)) {
let i: number = scenario.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = scenario.ressources[i];
} else {
let i: number = role.ressources.findIndex(element => element.name == reward.object.name && element.type == 'ressource' && element.number == reward.object.number);
reward.object = role.ressources[i];
}
}
});
});
role.tasks.forEach((inlineTasks: any[], index: number) => {
role.tasks[index] = inlineTasks.map((taskData: any) => {
if (taskData !== null) {
......@@ -475,7 +579,8 @@ export class AppComponent {
}
this.cdr.detectChanges();
this._snackBar.openFromComponent(LoadingsucessSnackbarComponent, { duration: 5000 });
} catch {
} catch (e) {
console.error(e);
this._snackBar.openFromComponent(LoadingfailSnackbarComponent, { duration: 5000 });
}
};
......
import { Character } from "../character/character";
import { CharacterReward } from "../rewards/character-reward/character-reward";
import { ObjectReward } from "../rewards/object-reward/object-reward";
import { QuestReward } from "../rewards/quest-reward/quest-reward";
import { Reward } from "../rewards/reward";
import { SkillReward } from "../rewards/skill-reward/skill-reward";
export class Discussion {
......@@ -11,8 +16,66 @@ export class Discussion {
name: string = '';
ID: number = 0;
sentences: number[] = [];
results: [] = [];
firstSentenceID: number = -1;
character: Character;
isFirstDiscussion: boolean = false;
rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new', this.missionIndex, this.i, 'Reward_[' + this.role.rewards.length + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
}
changeRewardType(index: number, type: string): void {
switch (type) {
case 'quest': this.rewards[index] = new QuestReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[QuestReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'skill': this.rewards[index] = new SkillReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[SkillReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'character': this.rewards[index] = new CharacterReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[CharacterReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.rewards.splice(index, 1);
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//} else {
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
}
import { CharacterReward } from "../rewards/character-reward/character-reward";
import { ObjectReward } from "../rewards/object-reward/object-reward";
import { QuestReward } from "../rewards/quest-reward/quest-reward";
import { Reward } from "../rewards/reward";
import { SkillReward } from "../rewards/skill-reward/skill-reward";
export class Response {
constructor(ID: number) {
......@@ -7,7 +13,65 @@ export class Response {
ID: number = 0;
value: string = '';
nextSentence: number = -1;
results: [] = [];
idInterrogativeSentence: number = 0;
rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new', this.missionIndex, this.i, 'Reward_[' + this.role.rewards.length + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
}
changeRewardType(index: number, type: string): void {
switch (type) {
case 'quest': this.rewards[index] = new QuestReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[QuestReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'skill': this.rewards[index] = new SkillReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[SkillReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'character': this.rewards[index] = new CharacterReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[CharacterReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.rewards.splice(index, 1);
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//} else {
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
}
import { CharacterReward } from "../rewards/character-reward/character-reward";
import { ObjectReward } from "../rewards/object-reward/object-reward";
import { QuestReward } from "../rewards/quest-reward/quest-reward";
import { Reward } from "../rewards/reward";
import { SkillReward } from "../rewards/skill-reward/skill-reward";
export abstract class Sentence {
constructor(ID: number) {
......@@ -6,7 +12,64 @@ export abstract class Sentence {
ID: number = 0;
value: string = '';
results: [] = [];
idDiscussion: number = 0;
rewards: Reward[] = [];
addReward(): void {
this.rewards.push(new ObjectReward());
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'new', this.missionIndex, this.i, 'Reward_[' + this.role.rewards.length + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
}
changeRewardType(index: number, type: string): void {
switch (type) {
case 'quest': this.rewards[index] = new QuestReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[QuestReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'skill': this.rewards[index] = new SkillReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[SkillReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'character': this.rewards[index] = new CharacterReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[CharacterReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
case 'object': this.rewards[index] = new ObjectReward();
//this.scenario.traces.push(new Trace(this.scenario.traces.length,'transform',this.missionIndex,this.i,'Reward_['+index+']_transform_into_[ObjectReward]', 'Role_['+this.i+']', '#9AD5EC', '*'));
break;
}
}
removeReward(index: number): void {
//const dialogRef = this.dialog.open(SuppressDialogComponent, { data: this.translate.instant('role_reward_delete') });
//dialogRef.afterClosed().subscribe(result => {
//if (result == true) {
this.rewards.splice(index, 1);
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//} else {
//this.scenario.traces.push(new Trace(this.scenario.traces.length, 'cancel_delete', this.missionIndex, this.i, 'Reward_[' + index + ']', 'Role_[' + this.i + ']', '#9AD5EC', '*'));
//}
//});
}
getQuestReward(index: number): QuestReward {
return this.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.rewards[index] as SkillReward;
}
getObjectReward(index: number): ObjectReward {
return this.rewards[index] as ObjectReward;
}
changeQuestReward(roleIntitule: string, index: number, event: any) {
let value: string = event.target.value;
let reward = new QuestReward();
reward.intitule = roleIntitule;
reward.questName = value;
this.rewards[index] = reward;
}
}
......@@ -61,6 +61,61 @@ mat-dialog-actions {
&-result {
margin-top: 20px;
&-results {
&-result {
margin-bottom: 5px;
&-type {
display: flex;
justify-content: space-between;
select {
width: 200px;
}
}
&-skill, &-object {
margin-top: 3px;
width: 250px;
display: flex;
justify-content: space-between;
input {
width: 30px;
text-align: center;
}
select {
width: 200px;
}
}
&-character, &-quest {
margin-top: 3px;
width: 250px;
select {
width: 250px;
}
}
}
}
&-button {
&-add {
margin-top: 5px;
width: 250px;
}
&-remove {
position: relative;
left: 100%;
transform: translateX(-100%);
margin-top: 5px;
}
}
}
&-result, &-nextSentence {
......@@ -68,6 +123,10 @@ mat-dialog-actions {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
&-nextSentence {
margin-top: 5px;
select {
width: 250px;
......
......@@ -9,6 +9,8 @@ import { InterrogativeSentence } from 'src/app/class/sentence/interrogativeSente
import { Sentence } from 'src/app/class/sentence/sentence';
import { TooltipService } from 'src/app/services/tooltip/tooltip.service';
import { SuppressDialogComponent } from '../suppress-dialog/suppress-dialog.component';
import { QuestReward } from 'src/app/class/rewards/quest-reward/quest-reward';
import { Scenario } from 'src/app/class/scenario/scenario';
@Component({
selector: 'app-discussion-dialog',
......@@ -19,11 +21,13 @@ export class DiscussionDialogComponent implements OnInit {
role: Role;
discussion: Discussion;
scenario: Scenario;
constructor(public dialogRef: MatDialogRef<DiscussionDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogDiscussionData, protected translate: TranslateService, protected tooltipService: TooltipService, public dialog: MatDialog) {
this.role = this.data.role;
this.discussion = this.data.discussion;
this.scenario = this.data.scenario;
}
ngOnInit(): void {
......@@ -177,4 +181,5 @@ export class DiscussionDialogComponent implements OnInit {
export interface DialogDiscussionData {
role: Role;
discussion: Discussion;
scenario: Scenario;
}
......@@ -53,6 +53,33 @@ export class GameCharactersComponent implements OnInit {
i--;
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward: Reward = discussion.rewards[i];
if (reward.type == 'character') {
discussion.rewards.splice(i,1);
i--;
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward: Reward = sentence.rewards[i];
if (reward.type == 'character') {
sentence.rewards.splice(i,1);
i--;
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward: Reward = response.rewards[i];
if (reward.type == 'character') {
response.rewards.splice(i,1);
i--;
}
}
});
role.tasks.forEach(inlineTasks => {
inlineTasks.forEach(task => {
if (task instanceof Task) {
......@@ -103,6 +130,39 @@ export class GameCharactersComponent implements OnInit {
}
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward: Reward = discussion.rewards[i];
if (reward.type == 'character') {
if ((reward as CharacterReward).character == this.scenario.characters[index]) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward: Reward = sentence.rewards[i];
if (reward.type == 'character') {
if ((reward as CharacterReward).character == this.scenario.characters[index]) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward: Reward = response.rewards[i];
if (reward.type == 'character') {
if ((reward as CharacterReward).character == this.scenario.characters[index]) {
response.rewards.splice(i,1);
i--;
}
}
}
});
role.tasks.forEach(inlineTask => {
inlineTask.forEach(task => {
if (task instanceof Task) {
......
......@@ -131,6 +131,7 @@ matTooltipPosition="left" [matTooltipDisabled]="!tooltipService.activatedTooltip
<select (change)="changeQuestReward(i, $event)"
[matTooltip]="translate.instant('role_reward_type_newQuest_tooltip')"
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips">
<option [ngValue]="null" selected disabled>{{'role_reward_quest_placeholder' | translate}}</option>
<ng-container *ngFor="let mission of scenario.missions; let indexMission = index">
<ng-container *ngFor="let quest of mission.roles; let indexRole = index">
<option [ngValue]="quest.questName" [selected]="getQuestReward(i).intitule == quest.intitule && getQuestReward(i).questName == quest.questName"
......
......@@ -219,6 +219,54 @@ export class RoleComponent implements OnInit {
const dialogRef = this.dialog.open(CleanDialogComponent, { data: this.translate.instant('role_clean')+' '+(this.role.intitule ? '<'+this.role.intitule+'>' : (this.i+1)) });
dialogRef.afterClosed().subscribe(result => {
if (result == true) {
this.scenario.missions.forEach(mission => {
mission.roles.forEach(role => {
if (role.intitule == this.role.intitule) {
for (let i = 0; i < role.rewards.length; i++) {
let reward = role.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
role.rewards.splice(i,1);
i--;
}
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward = discussion.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward = sentence.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward = response.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
response.rewards.splice(i,1);
i--;
}
}
}
});
}
});
});
this.role.intitule = '';
this.role.questName = '';
this.role.description = '';
......@@ -226,6 +274,9 @@ export class RoleComponent implements OnInit {
this.role.rewards = [];
this.role.stuff = '';
this.role.supplementaryRoles = [];
this.role.discussions = [];
this.role.sentences = [];
this.role.responses = [];
this.role.tasks.forEach(inlineTasks => {
inlineTasks.forEach(task => {
this.role.ressources.forEach(ressource => {
......@@ -287,7 +338,52 @@ export class RoleComponent implements OnInit {
dialogRef.afterClosed().subscribe(result => {
let missionIndex: number = this.scenario.missions.findIndex(mission => mission == this.mission);
if (result == true) {
this.mission.roles.forEach(role => {
this.scenario.missions.forEach(mission => {
mission.roles.forEach(role => {
if (role.intitule == this.role.intitule) {
for (let i = 0; i < role.rewards.length; i++) {
let reward = role.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
role.rewards.splice(i,1);
i--;
}
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward = discussion.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward = sentence.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward = response.rewards[i];
if (reward.type == 'quest') {
if ((reward as QuestReward).questName == this.role.questName) {
response.rewards.splice(i,1);
i--;
}
}
}
});
}
role.tasks.forEach(inlineTask => {
inlineTask.forEach(task => {
if (task instanceof Task) {
......@@ -300,6 +396,7 @@ export class RoleComponent implements OnInit {
});
});
});
});
this.mission.roles.splice(this.i, 1);
this.scenario.traces.push(new Trace(this.scenario.traces.length,'delete',missionIndex,this.i,'all','Role_['+(this.i)+']','#9AD5EC'));
this.minimapService.reset();
......@@ -348,19 +445,70 @@ export class RoleComponent implements OnInit {
if (result == true) {
for (let i = 0; i < this.role.rewards.length; i++) {
let reward: Reward = this.role.rewards[i];
if (reward.type = 'object') {
if (reward.type == 'object') {
if (this.role.ressources[index] == (reward as ObjectReward).object) {
this.role.rewards.splice(i,1);
i--;
}
}
if (reward.type = 'skill') {
if (reward.type == 'skill') {
if (this.role.ressources[index] == (reward as SkillReward).skill) {
this.role.rewards.splice(i,1);
i--;
}
}
}
this.role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward: Reward = discussion.rewards[i];
if (reward.type == 'object') {
if (this.role.ressources[index] == (reward as ObjectReward).object) {
discussion.rewards.splice(i,1);
i--;
}
}
if (reward.type == 'skill') {
if (this.role.ressources[index] == (reward as SkillReward).skill) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
this.role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward: Reward = sentence.rewards[i];
if (reward.type == 'object') {
if (this.role.ressources[index] == (reward as ObjectReward).object) {
sentence.rewards.splice(i,1);
i--;
}
}
if (reward.type == 'skill') {
if (this.role.ressources[index] == (reward as SkillReward).skill) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
this.role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward: Reward = response.rewards[i];
if (reward.type == 'object') {
if (this.role.ressources[index] == (reward as ObjectReward).object) {
response.rewards.splice(i,1);
i--;
}
}
if (reward.type == 'skill') {
if (this.role.ressources[index] == (reward as SkillReward).skill) {
response.rewards.splice(i,1);
i--;
}
}
}
});
this.role.tasks.forEach(inlineTasks => {
inlineTasks.forEach(task => {
if (task instanceof Task) {
......
......@@ -52,6 +52,39 @@ export class RulesComponent implements OnInit {
}
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward: Reward = discussion.rewards[i];
if (reward.type == 'object') {
if (ressource == (reward as ObjectReward).object) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward: Reward = sentence.rewards[i];
if (reward.type == 'object') {
if (ressource == (reward as ObjectReward).object) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward: Reward = response.rewards[i];
if (reward.type == 'object') {
if (ressource == (reward as ObjectReward).object) {
response.rewards.splice(i,1);
i--;
}
}
}
});
role.tasks.forEach(inlineTasks => {
inlineTasks.forEach(task => {
if (task instanceof Task) {
......@@ -125,6 +158,39 @@ export class RulesComponent implements OnInit {
}
}
}
role.discussions.forEach(discussion => {
for (let i = 0; i < discussion.rewards.length; i++) {
let reward: Reward = discussion.rewards[i];
if (reward.type == 'object') {
if (this.scenario.ressources[index] == (reward as ObjectReward).object) {
discussion.rewards.splice(i,1);
i--;
}
}
}
});
role.sentences.forEach(sentence => {
for (let i = 0; i < sentence.rewards.length; i++) {
let reward: Reward = sentence.rewards[i];
if (reward.type == 'object') {
if (this.scenario.ressources[index] == (reward as ObjectReward).object) {
sentence.rewards.splice(i,1);
i--;
}
}
}
});
role.responses.forEach(response => {
for (let i = 0; i < response.rewards.length; i++) {
let reward: Reward = response.rewards[i];
if (reward.type == 'object') {
if (this.scenario.ressources[index] == (reward as ObjectReward).object) {
response.rewards.splice(i,1);
i--;
}
}
}
});
role.tasks.forEach(inlineTasks => {
inlineTasks.forEach(task => {
if (task instanceof Task) {
......
......@@ -39,7 +39,7 @@ export class DiscussionsComponent implements OnInit {
this.role.discussions.push(discussion);
const dialogRef = this.dialog.open(DiscussionDialogComponent, {
width: '60vw',
data: { role: this.role, discussion: discussion }
data: { role: this.role, discussion: discussion, scenario: this.scenario }
});
}
}
......@@ -47,7 +47,7 @@ export class DiscussionsComponent implements OnInit {
openDiscussion(discussion: Discussion) {
const dialogRef = this.dialog.open(DiscussionDialogComponent, {
width: '60vw',
data: { role: this.role, discussion: discussion }
data: { role: this.role, discussion: discussion, scenario: this.scenario }
});
}
......
......@@ -138,6 +138,7 @@
"role_reward_type_label": "Type",
"role_reward_type_newQuest": "Start a new quest",
"role_reward_type_newQuest_tooltip": "Choose a quest from another mission with the same Role name",
"role_reward_quest_placeholder": "Name of the quest",
"role_reward_type_skill": "Develop a field of expertise",
"role_reward_type_skill_tooltip": "Choose a skill created below",
"role_reward_type_character": "Retrieve the contact of an NPC",
......@@ -147,6 +148,7 @@
"role_reward_type_object": "Retrieve an item",
"role_reward_type_object_placeholder": "Name of the object",
"role_reward_type_object_delete": "this Object of the Reward",
"role_reward_type_object_tooltip": "Choose a created object",
"role_reward_type_other": "Other",
"role_reward_delete": "this Reward",
"role_personnalization_title": "Customization",
......@@ -434,7 +436,7 @@
"discussion_declarativeSentence": "Sentence",
"discussion_interrogativeSentence": "Question",
"discussion_response": "Response",
"discussion_result_label": "Result",
"discussion_result_label": "Results",
"discussion_result_placeholder": "Select a result",
"discussion_nextSentence_label": "Next sentence",
"discussion_nextSentence_placeholder": "Select the next sentence",
......@@ -448,6 +450,10 @@
"discussion_delete": "this Discussion",
"discussion_declarativeSentence_delete": "this Sentence",
"discussion_interrogativeSentence_delete": "this Question",
"discussion_response_delete": "this Response"
"discussion_response_delete": "this Response",
"discussion_reward_type_discussion_tooltip": "",
"discussion_reward_type_declarativeSentence_tootlip": "",
"discussion_reward_type_interrogativeSentence_tooltip": "",
"discussion_reward_type_response_tooltip": ""
}
\ No newline at end of file
......@@ -138,6 +138,7 @@
"role_reward_type_label": "Type",
"role_reward_type_newQuest": "Débuter une nouvelle quête",
"role_reward_type_newQuest_tooltip": "Choisir une quête d'une autre mission avec le même nom de Rôle",
"role_reward_quest_placeholder": "Nom de la quête",
"role_reward_type_skill": "Travailler un champ de compétence",
"role_reward_type_skill_tooltip": "Choisir une compétence créée ci-dessous",
"role_reward_type_character": "Récupérer le contact d'un PNJ",
......@@ -146,6 +147,7 @@
"role_reward_type_objective_tooltip": "Choisir un objectif pédagogique créé ci-dessus",
"role_reward_type_object": "Récupérer un objet",
"role_reward_type_object_placeholder": "Nom de l'objet",
"role_reward_type_object_tooltip": "Choisir un objet créé",
"role_reward_type_object_delete": "cet Objet de la Récompense",
"role_reward_type_other": "Autre",
"role_reward_delete": "cette Récompense",
......@@ -434,7 +436,7 @@
"discussion_declarativeSentence": "Phrase",
"discussion_interrogativeSentence": "Question",
"discussion_response": "Réponse",
"discussion_result_label": "Résultat",
"discussion_result_label": "Résultats",
"discussion_result_placeholder": "Choisir un résultat",
"discussion_nextSentence_label": "Phrase suivante",
"discussion_nextSentence_placeholder": "Choisir la phrase suivante",
......@@ -448,5 +450,9 @@
"discussion_delete": "cette Discussion",
"discussion_declarativeSentence_delete": "cette Phrase",
"discussion_interrogativeSentence_delete": "cette Question",
"discussion_response_delete": "cette Réponse"
"discussion_response_delete": "cette Réponse",
"discussion_reward_type_discussion_tooltip": "",
"discussion_reward_type_declarativeSentence_tootlip": "",
"discussion_reward_type_interrogativeSentence_tooltip": "",
"discussion_reward_type_response_tooltip": ""
}
\ No newline at end of file
Markdown is supported
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