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
68e1c8d7
Commit
68e1c8d7
authored
May 28, 2022
by
KingRainbow44
Browse files
Merge remote-tracking branch 'origin/development' into development
parents
05527fcb
c164b25f
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java
View file @
68e1c8d7
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"givechar"
,
usage
=
"givechar <avatarId> [level]"
,
aliases
=
{
"givec"
},
permission
=
"player.givechar"
,
permissionTargeted
=
"player.givechar.others"
,
description
=
"commands.giveChar.description"
)
@Command
(
label
=
"givechar"
,
usage
=
"givechar
<player>
<avatarId> [level]"
,
aliases
=
{
"givec"
},
permission
=
"player.givechar"
,
permissionTargeted
=
"player.givechar.others"
,
description
=
"commands.giveChar.description"
)
public
final
class
GiveCharCommand
implements
CommandHandler
{
public
final
class
GiveCharCommand
implements
CommandHandler
{
@Override
@Override
...
@@ -26,7 +26,7 @@ public final class GiveCharCommand implements CommandHandler {
...
@@ -26,7 +26,7 @@ public final class GiveCharCommand implements CommandHandler {
level
=
Integer
.
parseInt
(
args
.
get
(
1
));
level
=
Integer
.
parseInt
(
args
.
get
(
1
));
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
// TODO: Parse from avatar name using GM Handbook.
// TODO: Parse from avatar name using GM Handbook.
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
execution
.invalid.avatarLevel"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
generic
.invalid.avatarLevel"
));
return
;
return
;
}
// Cheeky fall-through to parse first argument too
}
// Cheeky fall-through to parse first argument too
case
1
:
case
1
:
...
@@ -34,7 +34,7 @@ public final class GiveCharCommand implements CommandHandler {
...
@@ -34,7 +34,7 @@ public final class GiveCharCommand implements CommandHandler {
avatarId
=
Integer
.
parseInt
(
args
.
get
(
0
));
avatarId
=
Integer
.
parseInt
(
args
.
get
(
0
));
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
// TODO: Parse from avatar name using GM Handbook.
// TODO: Parse from avatar name using GM Handbook.
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
execution
.invalid.avatarId"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
generic
.invalid.avatarId"
));
return
;
return
;
}
}
break
;
break
;
...
@@ -45,13 +45,13 @@ public final class GiveCharCommand implements CommandHandler {
...
@@ -45,13 +45,13 @@ public final class GiveCharCommand implements CommandHandler {
AvatarData
avatarData
=
GameData
.
getAvatarDataMap
().
get
(
avatarId
);
AvatarData
avatarData
=
GameData
.
getAvatarDataMap
().
get
(
avatarId
);
if
(
avatarData
==
null
)
{
if
(
avatarData
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
execution
.invalid.avatarId"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
generic
.invalid.avatarId"
));
return
;
return
;
}
}
// Check level.
// Check level.
if
(
level
>
90
)
{
if
(
level
>
90
)
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
execution
.invalid.avatarLevel"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.
generic
.invalid.avatarLevel"
));
return
;
return
;
}
}
...
...
src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java
View file @
68e1c8d7
...
@@ -215,7 +215,7 @@ public final class SetStatsCommand implements CommandHandler {
...
@@ -215,7 +215,7 @@ public final class SetStatsCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.setStats.set_self"
,
stat
.
name
,
valueStr
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.setStats.set_self"
,
stat
.
name
,
valueStr
));
}
else
{
}
else
{
String
uidStr
=
targetPlayer
.
getAccount
().
getId
();
String
uidStr
=
targetPlayer
.
getAccount
().
getId
();
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.setStats.set_
self
"
,
stat
.
name
,
uidStr
,
valueStr
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.setStats.set_
for_uid
"
,
stat
.
name
,
uidStr
,
valueStr
));
}
}
}
else
{
}
else
{
CommandHandler
.
sendMessage
(
sender
,
usage
);
CommandHandler
.
sendMessage
(
sender
,
usage
);
...
...
src/main/java/emu/grasscutter/database/DatabaseHelper.java
View file @
68e1c8d7
...
@@ -97,7 +97,7 @@ public final class DatabaseHelper {
...
@@ -97,7 +97,7 @@ public final class DatabaseHelper {
}
}
public
static
Account
getAccountByPlayerId
(
int
playerId
)
{
public
static
Account
getAccountByPlayerId
(
int
playerId
)
{
return
DatabaseManager
.
getGameDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"
p
layerId"
,
playerId
)).
first
();
return
DatabaseManager
.
getGameDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"
reservedP
layerId"
,
playerId
)).
first
();
}
}
public
static
void
deleteAccount
(
Account
target
)
{
public
static
void
deleteAccount
(
Account
target
)
{
...
...
src/main/java/emu/grasscutter/game/managers/EnergyManager/EnergyManager.java
View file @
68e1c8d7
...
@@ -303,6 +303,13 @@ public class EnergyManager {
...
@@ -303,6 +303,13 @@ public class EnergyManager {
}
}
}
}
public
void
handleMonsterEnergyDrop
(
EntityMonster
monster
,
float
hpBeforeDamage
,
float
hpAfterDamage
)
{
public
void
handleMonsterEnergyDrop
(
EntityMonster
monster
,
float
hpBeforeDamage
,
float
hpAfterDamage
)
{
// Make sure this is actually a monster.
// Note that some wildlife also has that type, like boars or birds.
String
type
=
monster
.
getMonsterData
().
getType
();
if
(!
type
.
equals
(
"MONSTER_ORDINARY"
)
&&
!
type
.
equals
(
"MONSTER_BOSS"
))
{
return
;
}
// Calculate the HP tresholds for before and after the damage was taken.
// Calculate the HP tresholds for before and after the damage was taken.
float
maxHp
=
monster
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
);
float
maxHp
=
monster
.
getFightProperty
(
FightProperty
.
FIGHT_PROP_MAX_HP
);
float
thresholdBefore
=
hpBeforeDamage
/
maxHp
;
float
thresholdBefore
=
hpBeforeDamage
/
maxHp
;
...
...
src/main/resources/defaults/data/EnergyDrop.json
View file @
68e1c8d7
...
@@ -156,5 +156,30 @@
...
@@ -156,5 +156,30 @@
"dropId"
:
22003100
,
"dropId"
:
22003100
,
"dropList"
:
[
"dropList"
:
[
]
]
},
{
"dropId"
:
22001000
,
"dropList"
:
[
]
},
{
"dropId"
:
22000100
,
"dropList"
:
[
]
},
{
"dropId"
:
22003000
,
"dropList"
:
[
]
},
{
"dropId"
:
22001100
,
"dropList"
:
[
]
},
{
"dropId"
:
22000000
,
"dropList"
:
[
]
}
}
]
]
\ No newline at end of file
src/main/resources/languages/en-US.json
View file @
68e1c8d7
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
"description"
:
"Gives the player a specified artifact"
"description"
:
"Gives the player a specified artifact"
},
},
"giveChar"
:
{
"giveChar"
:
{
"usage"
:
"Usage: givechar <player> <
itemID|itemName
> [level]"
,
"usage"
:
"Usage: givechar <player> <
avatarId
> [level]"
,
"given"
:
"Given %s with level %s to %s."
,
"given"
:
"Given %s with level %s to %s."
,
"invalid_avatar_id"
:
"Invalid avatar ID."
,
"invalid_avatar_id"
:
"Invalid avatar ID."
,
"invalid_avatar_level"
:
"Invalid avatar level."
,
"invalid_avatar_level"
:
"Invalid avatar level."
,
...
...
src/main/resources/languages/pl-PL.json
View file @
68e1c8d7
...
@@ -146,7 +146,7 @@
...
@@ -146,7 +146,7 @@
"success"
:
"Dano %s dla %s."
"success"
:
"Dano %s dla %s."
},
},
"giveChar"
:
{
"giveChar"
:
{
"usage"
:
"Użycie: givechar <gracz> <
id przedmiotu | nazwa przedmiotu
> [ilość]"
,
"usage"
:
"Użycie: givechar <gracz> <
avatarId
> [ilość]"
,
"given"
:
"Dano %s z poziomem %s dla %s."
,
"given"
:
"Dano %s z poziomem %s dla %s."
,
"invalid_avatar_id"
:
"Błędne ID postaci."
,
"invalid_avatar_id"
:
"Błędne ID postaci."
,
"invalid_avatar_level"
:
"Błędny poziom postaci."
,
"invalid_avatar_level"
:
"Błędny poziom postaci."
,
...
...
src/main/resources/languages/zh-CN.json
View file @
68e1c8d7
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
"modify"
:
"修改用户账号"
,
"modify"
:
"修改用户账号"
,
"invalid"
:
"无效的UID。"
,
"invalid"
:
"无效的UID。"
,
"exists"
:
"账号已存在。"
,
"exists"
:
"账号已存在。"
,
"create"
:
"已创建
账号,
UID 为 %s。"
,
"create"
:
"已创建
UID 为 %s
的账号
。"
,
"delete"
:
"账号已删除。"
,
"delete"
:
"账号已删除。"
,
"no_account"
:
"账号不存在。"
,
"no_account"
:
"账号不存在。"
,
"command_usage"
:
"用法:account <create|delete> <用户名> [UID]"
,
"command_usage"
:
"用法:account <create|delete> <用户名> [UID]"
,
...
@@ -163,7 +163,7 @@
...
@@ -163,7 +163,7 @@
"description"
:
"给予指定圣遗物"
"description"
:
"给予指定圣遗物"
},
},
"giveChar"
:
{
"giveChar"
:
{
"usage"
:
"用法:givechar <玩家> <角色ID
|角色名
> [等级]"
,
"usage"
:
"用法:givechar <玩家> <角色ID> [等级]"
,
"given"
:
"已将角色 %s [等级 %s] 给与 %s。"
,
"given"
:
"已将角色 %s [等级 %s] 给与 %s。"
,
"invalid_avatar_id"
:
"无效的角色ID。"
,
"invalid_avatar_id"
:
"无效的角色ID。"
,
"invalid_avatar_level"
:
"无效的角色等级。"
,
"invalid_avatar_level"
:
"无效的角色等级。"
,
...
@@ -251,7 +251,7 @@
...
@@ -251,7 +251,7 @@
},
},
"sendMail"
:
{
"sendMail"
:
{
"usage"
:
"用法:sendmail <用户ID|all|help> [模板ID]"
,
"usage"
:
"用法:sendmail <用户ID|all|help> [模板ID]"
,
"user_not_exist"
:
"用户 %s 不存在。"
,
"user_not_exist"
:
"用户
'
%s
'
不存在。"
,
"start_composition"
:
"开始撰写邮件。
\n
请使用 '/sendmail <标题>' 继续。
\n
你可以随时使用 '/sendmail stop' 停止。"
,
"start_composition"
:
"开始撰写邮件。
\n
请使用 '/sendmail <标题>' 继续。
\n
你可以随时使用 '/sendmail stop' 停止。"
,
"templates"
:
"邮件模板尚未实装..."
,
"templates"
:
"邮件模板尚未实装..."
,
"invalid_arguments"
:
"无效的参数。"
,
"invalid_arguments"
:
"无效的参数。"
,
...
...
src/main/resources/languages/zh-TW.json
View file @
68e1c8d7
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
"description"
:
"給予指定聖遺物。"
"description"
:
"給予指定聖遺物。"
},
},
"giveChar"
:
{
"giveChar"
:
{
"usage"
:
"用法:givechar <player> <
itemId|itemName
> [level]"
,
"usage"
:
"用法:givechar <player> <
avatarId
> [level]"
,
"given"
:
"已將 %s 等級 %s 給予 %s。"
,
"given"
:
"已將 %s 等級 %s 給予 %s。"
,
"invalid_avatar_id"
:
"無效的角色ID。"
,
"invalid_avatar_id"
:
"無效的角色ID。"
,
"invalid_avatar_level"
:
"無效的角色等級。."
,
"invalid_avatar_level"
:
"無效的角色等級。."
,
...
...
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