Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
325fe6c4
Commit
325fe6c4
authored
Aug 10, 2022
by
AnimeGitB
Committed by
Luke H-W
Aug 11, 2022
Browse files
Fix TalentCommand for Traveler
parent
edd4c8ca
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/TalentCommand.java
View file @
325fe6c4
...
@@ -11,8 +11,6 @@ import emu.grasscutter.server.packet.send.PacketAvatarSkillUpgradeRsp;
...
@@ -11,8 +11,6 @@ import emu.grasscutter.server.packet.send.PacketAvatarSkillUpgradeRsp;
import
java.util.List
;
import
java.util.List
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
@Command
(
label
=
"talent"
,
label
=
"talent"
,
usage
=
{
"set <talentId> <level>"
,
"(n|e|q) <level>"
,
"getid"
},
usage
=
{
"set <talentId> <level>"
,
"(n|e|q) <level>"
,
"getid"
},
...
@@ -20,14 +18,15 @@ import static emu.grasscutter.utils.Language.translate;
...
@@ -20,14 +18,15 @@ import static emu.grasscutter.utils.Language.translate;
permissionTargeted
=
"player.settalent.others"
)
permissionTargeted
=
"player.settalent.others"
)
public
final
class
TalentCommand
implements
CommandHandler
{
public
final
class
TalentCommand
implements
CommandHandler
{
private
void
setTalentLevel
(
Player
sender
,
Player
player
,
Avatar
avatar
,
int
talentId
,
int
talentLevel
)
{
private
void
setTalentLevel
(
Player
sender
,
Player
player
,
Avatar
avatar
,
int
talentId
,
int
talentLevel
)
{
int
oldLevel
=
avatar
.
getSkillLevelMap
().
get
(
talentId
);
var
skillLevelMap
=
avatar
.
getSkillLevelMap
();
int
oldLevel
=
skillLevelMap
.
get
(
talentId
);
if
(
talentLevel
<
0
||
talentLevel
>
15
)
{
if
(
talentLevel
<
0
||
talentLevel
>
15
)
{
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.lower_16"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.lower_16"
);
return
;
return
;
}
}
// Upgrade skill
// Upgrade skill
avatar
.
getS
killLevelMap
()
.
put
(
talentId
,
talentLevel
);
s
killLevelMap
.
put
(
talentId
,
talentLevel
);
avatar
.
save
();
avatar
.
save
();
// Packet
// Packet
...
@@ -35,7 +34,7 @@ public final class TalentCommand implements CommandHandler {
...
@@ -35,7 +34,7 @@ public final class TalentCommand implements CommandHandler {
player
.
sendPacket
(
new
PacketAvatarSkillUpgradeRsp
(
avatar
,
talentId
,
oldLevel
,
talentLevel
));
player
.
sendPacket
(
new
PacketAvatarSkillUpgradeRsp
(
avatar
,
talentId
,
oldLevel
,
talentLevel
));
String
successMessage
=
"commands.talent.set_id"
;
String
successMessage
=
"commands.talent.set_id"
;
AvatarSkillDepotData
depot
=
avatar
.
getData
().
getSkillDepot
();
AvatarSkillDepotData
depot
=
avatar
.
getSkillDepot
();
if
(
talentId
==
depot
.
getSkills
().
get
(
0
))
{
if
(
talentId
==
depot
.
getSkills
().
get
(
0
))
{
successMessage
=
"commands.talent.set_atk"
;
successMessage
=
"commands.talent.set_atk"
;
}
else
if
(
talentId
==
depot
.
getSkills
().
get
(
1
))
{
}
else
if
(
talentId
==
depot
.
getSkills
().
get
(
1
))
{
...
@@ -43,7 +42,7 @@ public final class TalentCommand implements CommandHandler {
...
@@ -43,7 +42,7 @@ public final class TalentCommand implements CommandHandler {
}
else
if
(
talentId
==
depot
.
getEnergySkill
())
{
}
else
if
(
talentId
==
depot
.
getEnergySkill
())
{
successMessage
=
"commands.talent.set_q"
;
successMessage
=
"commands.talent.set_q"
;
}
}
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
successMessage
,
talentLevel
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
successMessage
,
talentLevel
);
}
}
@Override
@Override
...
@@ -72,7 +71,7 @@ public final class TalentCommand implements CommandHandler {
...
@@ -72,7 +71,7 @@ public final class TalentCommand implements CommandHandler {
int
newLevel
=
Integer
.
parseInt
(
args
.
get
(
2
));
int
newLevel
=
Integer
.
parseInt
(
args
.
get
(
2
));
setTalentLevel
(
sender
,
targetPlayer
,
avatar
,
skillId
,
newLevel
);
setTalentLevel
(
sender
,
targetPlayer
,
avatar
,
skillId
,
newLevel
);
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.invalid_skill_id"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.invalid_skill_id"
);
return
;
return
;
}
}
}
}
...
@@ -81,7 +80,7 @@ public final class TalentCommand implements CommandHandler {
...
@@ -81,7 +80,7 @@ public final class TalentCommand implements CommandHandler {
sendUsageMessage
(
sender
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
AvatarSkillDepotData
SkillDepot
=
avatar
.
getData
().
getSkillDepot
();
AvatarSkillDepotData
SkillDepot
=
avatar
.
getSkillDepot
();
int
skillId
=
switch
(
cmdSwitch
)
{
int
skillId
=
switch
(
cmdSwitch
)
{
default
->
SkillDepot
.
getSkills
().
get
(
0
);
default
->
SkillDepot
.
getSkills
().
get
(
0
);
case
"e"
->
SkillDepot
.
getSkills
().
get
(
1
);
case
"e"
->
SkillDepot
.
getSkills
().
get
(
1
);
...
@@ -91,17 +90,17 @@ public final class TalentCommand implements CommandHandler {
...
@@ -91,17 +90,17 @@ public final class TalentCommand implements CommandHandler {
int
newLevel
=
Integer
.
parseInt
(
args
.
get
(
1
));
int
newLevel
=
Integer
.
parseInt
(
args
.
get
(
1
));
setTalentLevel
(
sender
,
targetPlayer
,
avatar
,
skillId
,
newLevel
);
setTalentLevel
(
sender
,
targetPlayer
,
avatar
,
skillId
,
newLevel
);
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.invalid_level"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.invalid_level"
);
return
;
return
;
}
}
}
}
case
"getid"
->
{
case
"getid"
->
{
int
skillIdNorAtk
=
avatar
.
getData
().
getSkillDepot
().
getSkills
().
get
(
0
);
int
skillIdNorAtk
=
avatar
.
getSkillDepot
().
getSkills
().
get
(
0
);
int
skillIdE
=
avatar
.
getData
().
getSkillDepot
().
getSkills
().
get
(
1
);
int
skillIdE
=
avatar
.
getSkillDepot
().
getSkills
().
get
(
1
);
int
skillIdQ
=
avatar
.
getData
().
getSkillDepot
().
getEnergySkill
();
int
skillIdQ
=
avatar
.
getSkillDepot
().
getEnergySkill
();
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.normal_attack_id"
,
Integer
.
toString
(
skillIdNorAtk
))
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.normal_attack_id"
,
Integer
.
toString
(
skillIdNorAtk
));
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.e_skill_id"
,
Integer
.
toString
(
skillIdE
))
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.e_skill_id"
,
Integer
.
toString
(
skillIdE
));
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.talent.q_skill_id"
,
Integer
.
toString
(
skillIdQ
))
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.talent.q_skill_id"
,
Integer
.
toString
(
skillIdQ
));
}
}
}
}
}
}
...
...
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