mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-06-26 01:54:51 +08:00
Compare commits
5 Commits
bade510c09
...
61f849dbd8
Author | SHA1 | Date | |
---|---|---|---|
|
61f849dbd8 | ||
|
262c9c4bf4 | ||
|
1496553c44 | ||
|
5ba2ee1b50 | ||
|
ac50e78b2c |
@ -23,7 +23,7 @@ import java.util.Random;
|
||||
import static emu.grasscutter.Configuration.*;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]", permission = "server.spawn", permissionTargeted = "server.spawn.others", description = "commands.spawn.description")
|
||||
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)] <x> <y> <z>(monster only, optional)", permission = "server.spawn", permissionTargeted = "server.spawn.others", description = "commands.spawn.description")
|
||||
public final class SpawnCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
@ -31,7 +31,16 @@ public final class SpawnCommand implements CommandHandler {
|
||||
int id = 0; // This is just to shut up the linter, it's not a real default
|
||||
int amount = 1;
|
||||
int level = 1;
|
||||
float x = 0, y = 0, z = 0;
|
||||
switch (args.size()) {
|
||||
case 6:
|
||||
try {
|
||||
x = Float.parseFloat(args.get(3));
|
||||
y = Float.parseFloat(args.get(4));
|
||||
z = Float.parseFloat(args.get(5));
|
||||
} catch (NumberFormatException ignored) {
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.execution.argument_error"));
|
||||
} // Fallthrough
|
||||
case 3:
|
||||
try {
|
||||
level = Integer.parseInt(args.get(2));
|
||||
@ -77,6 +86,9 @@ public final class SpawnCommand implements CommandHandler {
|
||||
double maxRadius = Math.sqrt(amount * 0.2 / Math.PI);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Position pos = GetRandomPositionInCircle(targetPlayer.getPos(), maxRadius).addY(3);
|
||||
if(x != 0 && y != 0 && z != 0) {
|
||||
pos = GetRandomPositionInCircle(new Position(x, y, z), maxRadius).addY(3);
|
||||
}
|
||||
GameEntity entity = null;
|
||||
if (itemData != null) {
|
||||
entity = new EntityItem(scene, null, itemData, pos, 1, true);
|
||||
|
@ -94,6 +94,7 @@ public enum OpenState {
|
||||
OPEN_STATE_GUIDE_RELICRESOLVE(84),
|
||||
OPEN_STATE_GUIDE_GGUIDE(85),
|
||||
OPEN_STATE_GUIDE_GGUIDE_HINT(86),
|
||||
OPEN_STATE_GUIDE_RIGHT_TEAM(90), // mobile phone only!
|
||||
OPEN_STATE_CITY_REPUATION_MENGDE(800),
|
||||
OPEN_STATE_CITY_REPUATION_LIYUE(801),
|
||||
OPEN_STATE_CITY_REPUATION_UI_HINT(802),
|
||||
|
@ -465,7 +465,11 @@ public class Scene {
|
||||
continue;
|
||||
}
|
||||
|
||||
EntityMonster entity = new EntityMonster(this, data, entry.getPos(), worldLevelOverride > 0 ? worldLevelOverride : entry.getLevel());
|
||||
int level = worldLevelOverride > 0 ? worldLevelOverride + entry.getLevel() - 22 : entry.getLevel();
|
||||
level = level >= 100 ? 100 : level;
|
||||
level = level <= 0 ? 1 : level;
|
||||
|
||||
EntityMonster entity = new EntityMonster(this, data, entry.getPos(), level);
|
||||
entity.getRotation().set(entry.getRot());
|
||||
entity.setGroupId(entry.getGroup().getGroupId());
|
||||
entity.setPoseId(entry.getPoseId());
|
||||
|
@ -132794,21 +132794,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
@ -132855,21 +132855,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
@ -132916,21 +132916,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
@ -132977,21 +132977,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
@ -133038,21 +133038,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
@ -133099,21 +133099,21 @@
|
||||
"maxWeight": 1
|
||||
},
|
||||
{
|
||||
"itemId": 112047,
|
||||
"itemId": 112023,
|
||||
"minCount": 1,
|
||||
"maxCount": 3,
|
||||
"minWeight": 2000,
|
||||
"maxWeight": 6000
|
||||
},
|
||||
{
|
||||
"itemId": 112048,
|
||||
"itemId": 112024,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 8001,
|
||||
"maxWeight": 9500
|
||||
},
|
||||
{
|
||||
"itemId": 112049,
|
||||
"itemId": 112025,
|
||||
"minCount": 1,
|
||||
"maxCount": 1,
|
||||
"minWeight": 9501,
|
||||
|
@ -5,8 +5,8 @@
|
||||
{
|
||||
"goodsId": 1004202,
|
||||
"goodsItem": {
|
||||
"Id": 202,
|
||||
"Count": 1000000
|
||||
"id": 202,
|
||||
"count": 1000000
|
||||
},
|
||||
"scoin": 1,
|
||||
"buyLimit": 500,
|
||||
@ -16,17 +16,18 @@
|
||||
"maxLevel": 99,
|
||||
"costItemList": [
|
||||
{
|
||||
"Id": 223,
|
||||
"Count": 100
|
||||
"id": 223,
|
||||
"count": 100
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"goodsId": 10048006,
|
||||
"goodsItem": {
|
||||
"Id": 108006,
|
||||
"Count": 20
|
||||
"id": 108006,
|
||||
"count": 20
|
||||
},
|
||||
"costItemList": [],
|
||||
"scoin": 100,
|
||||
"hcoin": 100,
|
||||
"mcoin": 100,
|
||||
@ -39,9 +40,10 @@
|
||||
{
|
||||
"goodsId": 10048033,
|
||||
"goodsItem": {
|
||||
"Id": 108033,
|
||||
"Count": 20
|
||||
"id": 108033,
|
||||
"count": 20
|
||||
},
|
||||
"costItemList": [],
|
||||
"scoin": 1,
|
||||
"buyLimit": 50000,
|
||||
"beginTime": 1575129600,
|
||||
|
@ -304,7 +304,7 @@
|
||||
"description": "Sets your world level (Relog to see proper effects)"
|
||||
},
|
||||
"spawn": {
|
||||
"usage": "Usage: spawn <entityID> [amount] [level(monster only)]",
|
||||
"usage": "Usage: spawn <entityID> [amount] [level(monster only)] <x> <y> <z>(monster only, optional)",
|
||||
"success": "Spawned %s of %s.",
|
||||
"limit_reached": "Scene spawn limit reached. Spawning %s entities instead.",
|
||||
"description": "Spawns an entity near you"
|
||||
|
Loading…
x
Reference in New Issue
Block a user