Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RLG Maker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Romain DELEAU
RLG Maker
Commits
f1e4c203
Commit
f1e4c203
authored
Mar 07, 2024
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
full copy of the role (without the QuestReward)
parent
a17c671d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
7 deletions
+99
-7
role.component.ts
src/app/pieces/role/role.component.ts
+99
-7
No files found.
src/app/pieces/role/role.component.ts
View file @
f1e4c203
...
@@ -26,6 +26,7 @@ import { RoleNameDuplicateComponent } from 'src/app/components/snackbars/role-na
...
@@ -26,6 +26,7 @@ import { RoleNameDuplicateComponent } from 'src/app/components/snackbars/role-na
import
{
CopyRoleService
}
from
'src/app/services/copyRole/copy-role.service'
;
import
{
CopyRoleService
}
from
'src/app/services/copyRole/copy-role.service'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
CopyRoleSuccessComponent
}
from
'src/app/components/snackbars/copy-role-success/copy-role-success.component'
;
import
{
CopyRoleSuccessComponent
}
from
'src/app/components/snackbars/copy-role-success/copy-role-success.component'
;
import
{
RoleOccurrence
}
from
'src/app/class/role-occurrence/role-occurrence'
;
@
Component
({
@
Component
({
selector
:
'app-role'
,
selector
:
'app-role'
,
...
@@ -68,25 +69,116 @@ export class RoleComponent implements OnInit {
...
@@ -68,25 +69,116 @@ export class RoleComponent implements OnInit {
}
}
onClickCopy
():
void
{
onClickCopy
():
void
{
this
.
copyRoleService
.
role
=
Object
.
assign
({},
this
.
role
);
this
.
copyRoleService
.
role
=
Object
.
assign
(
new
Role
(),
this
.
role
);
this
.
copyRoleService
.
role
.
questName
=
''
;
this
.
copyRoleService
.
role
.
educationnalObjectives
=
this
.
role
.
educationnalObjectives
.
map
((
educationnalObjectiveData
)
=>
Object
.
assign
(
new
RoleEducationnalObjective
(),
educationnalObjectiveData
));
this
.
copyRoleService
.
role
.
description
=
''
;
this
.
copyRoleService
.
role
.
educationnalObjectives
=
[];
this
.
copyRoleService
.
role
.
rewards
=
[];
this
.
copyRoleService
.
role
.
ressources
=
this
.
role
.
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
copyRoleService
.
role
.
ressources
=
this
.
role
.
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
copyRoleService
.
role
.
supplementaryRoles
=
this
.
role
.
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
copyRoleService
.
role
.
supplementaryRoles
=
this
.
role
.
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
copyRoleService
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
copyRoleService
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
copyRoleService
.
role
.
chronologie
=
[];
this
.
copyRoleService
.
role
.
chronologie
=
[];
this
.
copyRoleService
.
role
.
occurences
=
this
.
role
.
occurences
.
map
((
occurenceData
:
any
)
=>
Object
.
assign
(
new
RoleOccurrence
(),
occurenceData
));
this
.
copyRoleService
.
role
.
comments
=
[];
this
.
copyRoleService
.
role
.
discussions
=
[];
this
.
copyRoleService
.
role
.
sentences
=
[];
this
.
copyRoleService
.
role
.
responses
=
[];
this
.
copyRoleService
.
role
.
rewards
=
[];
this
.
role
.
rewards
.
forEach
(
reward
=>
{
if
(
reward
.
type
==
'skill'
)
{
let
newReward
:
SkillReward
=
new
SkillReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
quantity
=
(
reward
as
SkillReward
).
quantity
;
this
.
copyRoleService
.
role
?.
ressources
.
forEach
(
ressource
=>
{
if
(
ressource
.
name
==
(
reward
as
SkillReward
).
skill
.
name
&&
ressource
.
number
==
(
reward
as
SkillReward
).
skill
.
number
&&
ressource
.
type
==
(
reward
as
SkillReward
).
skill
.
type
)
{
newReward
.
skill
=
ressource
;
}
});
this
.
copyRoleService
.
role
?.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'objective'
)
{
let
newReward
:
ObjectiveReward
=
new
ObjectiveReward
();
newReward
.
type
=
reward
.
type
;
this
.
copyRoleService
.
role
?.
educationnalObjectives
.
forEach
(
objective
=>
{
if
(
objective
.
objective
==
(
reward
as
ObjectiveReward
).
objective
.
objective
)
{
newReward
.
objective
=
objective
;
}
});
this
.
copyRoleService
.
role
?.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'character'
)
{
let
newReward
:
CharacterReward
=
new
CharacterReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
character
=
(
reward
as
CharacterReward
).
character
;
this
.
copyRoleService
.
role
?.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'other'
)
{
let
newReward
:
OtherReward
=
new
OtherReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
text
=
(
reward
as
OtherReward
).
text
;
this
.
copyRoleService
.
role
?.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'objects'
)
{
let
newReward
:
ObjectsReward
=
new
ObjectsReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
objects
=
(
reward
as
ObjectsReward
).
objects
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
copyRoleService
.
role
?.
rewards
.
push
(
newReward
);
}
});
this
.
copyRoleService
.
mission
=
this
.
mission
;
this
.
copyRoleService
.
mission
=
this
.
mission
;
this
.
_snackBar
.
openFromComponent
(
CopyRoleSuccessComponent
,
{
duration
:
5000
});
this
.
_snackBar
.
openFromComponent
(
CopyRoleSuccessComponent
,
{
duration
:
5000
});
}
}
onClickPaste
():
void
{
onClickPaste
():
void
{
this
.
role
=
Object
.
assign
(
{}
,
this
.
copyRoleService
.
role
);
this
.
role
=
Object
.
assign
(
new
Role
()
,
this
.
copyRoleService
.
role
);
this
.
role
.
ressources
=
(
this
.
copyRoleService
.
role
as
Role
).
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
role
.
ressources
=
(
this
.
copyRoleService
.
role
as
Role
).
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
role
.
educationnalObjectives
=
(
this
.
copyRoleService
.
role
as
Role
).
educationnalObjectives
.
map
((
educationnalObjectiveData
:
any
)
=>
Object
.
assign
(
new
RoleEducationnalObjective
(),
educationnalObjectiveData
));
this
.
role
.
supplementaryRoles
=
(
this
.
copyRoleService
.
role
as
Role
).
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
role
.
supplementaryRoles
=
(
this
.
copyRoleService
.
role
as
Role
).
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
role
.
educationnalObjectives
=
[
new
RoleEducationnalObjective
()];
this
.
role
.
occurences
=
(
this
.
copyRoleService
.
role
as
Role
).
occurences
.
map
((
occurenceData
:
any
)
=>
Object
.
assign
(
new
RoleOccurrence
(),
occurenceData
));
this
.
role
.
comments
=
[];
this
.
role
.
discussions
=
[];
this
.
role
.
sentences
=
[];
this
.
role
.
responses
=
[];
this
.
role
.
rewards
=
[];
this
.
copyRoleService
.
role
?.
rewards
.
forEach
(
reward
=>
{
if
(
reward
.
type
==
'skill'
)
{
let
newReward
:
SkillReward
=
new
SkillReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
quantity
=
(
reward
as
SkillReward
).
quantity
;
this
.
role
.
ressources
.
forEach
(
ressource
=>
{
if
(
ressource
.
name
==
(
reward
as
SkillReward
).
skill
.
name
&&
ressource
.
number
==
(
reward
as
SkillReward
).
skill
.
number
&&
ressource
.
type
==
(
reward
as
SkillReward
).
skill
.
type
)
{
newReward
.
skill
=
ressource
;
}
});
this
.
role
.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'objective'
)
{
let
newReward
:
ObjectiveReward
=
new
ObjectiveReward
();
newReward
.
type
=
reward
.
type
;
this
.
role
?.
educationnalObjectives
.
forEach
(
objective
=>
{
if
(
objective
.
objective
==
(
reward
as
ObjectiveReward
).
objective
.
objective
)
{
newReward
.
objective
=
objective
;
}
});
this
.
role
.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'character'
)
{
let
newReward
:
CharacterReward
=
new
CharacterReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
character
=
(
reward
as
CharacterReward
).
character
;
this
.
role
.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'other'
)
{
let
newReward
:
OtherReward
=
new
OtherReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
text
=
(
reward
as
OtherReward
).
text
;
this
.
role
.
rewards
.
push
(
newReward
);
}
if
(
reward
.
type
==
'objects'
)
{
let
newReward
:
ObjectsReward
=
new
ObjectsReward
();
newReward
.
type
=
reward
.
type
;
newReward
.
objects
=
(
reward
as
ObjectsReward
).
objects
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
role
.
rewards
.
push
(
newReward
);
}
});
this
.
intituleIsAlreadyUsed
();
this
.
intituleIsAlreadyUsed
();
this
.
minimapService
.
reset
();
this
.
minimapService
.
reset
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment