mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-06-26 10:04:58 +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.Configuration.*;
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
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 {
|
public final class SpawnCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@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 id = 0; // This is just to shut up the linter, it's not a real default
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
int level = 1;
|
int level = 1;
|
||||||
|
float x = 0, y = 0, z = 0;
|
||||||
switch (args.size()) {
|
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:
|
case 3:
|
||||||
try {
|
try {
|
||||||
level = Integer.parseInt(args.get(2));
|
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);
|
double maxRadius = Math.sqrt(amount * 0.2 / Math.PI);
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
Position pos = GetRandomPositionInCircle(targetPlayer.getPos(), maxRadius).addY(3);
|
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;
|
GameEntity entity = null;
|
||||||
if (itemData != null) {
|
if (itemData != null) {
|
||||||
entity = new EntityItem(scene, null, itemData, pos, 1, true);
|
entity = new EntityItem(scene, null, itemData, pos, 1, true);
|
||||||
|
@ -94,6 +94,7 @@ public enum OpenState {
|
|||||||
OPEN_STATE_GUIDE_RELICRESOLVE(84),
|
OPEN_STATE_GUIDE_RELICRESOLVE(84),
|
||||||
OPEN_STATE_GUIDE_GGUIDE(85),
|
OPEN_STATE_GUIDE_GGUIDE(85),
|
||||||
OPEN_STATE_GUIDE_GGUIDE_HINT(86),
|
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_MENGDE(800),
|
||||||
OPEN_STATE_CITY_REPUATION_LIYUE(801),
|
OPEN_STATE_CITY_REPUATION_LIYUE(801),
|
||||||
OPEN_STATE_CITY_REPUATION_UI_HINT(802),
|
OPEN_STATE_CITY_REPUATION_UI_HINT(802),
|
||||||
|
@ -465,7 +465,11 @@ public class Scene {
|
|||||||
continue;
|
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.getRotation().set(entry.getRot());
|
||||||
entity.setGroupId(entry.getGroup().getGroupId());
|
entity.setGroupId(entry.getGroup().getGroupId());
|
||||||
entity.setPoseId(entry.getPoseId());
|
entity.setPoseId(entry.getPoseId());
|
||||||
|
@ -132794,21 +132794,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
@ -132855,21 +132855,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
@ -132916,21 +132916,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
@ -132977,21 +132977,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
@ -133038,21 +133038,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
@ -133099,21 +133099,21 @@
|
|||||||
"maxWeight": 1
|
"maxWeight": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112047,
|
"itemId": 112023,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 3,
|
"maxCount": 3,
|
||||||
"minWeight": 2000,
|
"minWeight": 2000,
|
||||||
"maxWeight": 6000
|
"maxWeight": 6000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112048,
|
"itemId": 112024,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 8001,
|
"minWeight": 8001,
|
||||||
"maxWeight": 9500
|
"maxWeight": 9500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"itemId": 112049,
|
"itemId": 112025,
|
||||||
"minCount": 1,
|
"minCount": 1,
|
||||||
"maxCount": 1,
|
"maxCount": 1,
|
||||||
"minWeight": 9501,
|
"minWeight": 9501,
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
{
|
{
|
||||||
"goodsId": 1004202,
|
"goodsId": 1004202,
|
||||||
"goodsItem": {
|
"goodsItem": {
|
||||||
"Id": 202,
|
"id": 202,
|
||||||
"Count": 1000000
|
"count": 1000000
|
||||||
},
|
},
|
||||||
"scoin": 1,
|
"scoin": 1,
|
||||||
"buyLimit": 500,
|
"buyLimit": 500,
|
||||||
@ -16,17 +16,18 @@
|
|||||||
"maxLevel": 99,
|
"maxLevel": 99,
|
||||||
"costItemList": [
|
"costItemList": [
|
||||||
{
|
{
|
||||||
"Id": 223,
|
"id": 223,
|
||||||
"Count": 100
|
"count": 100
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"goodsId": 10048006,
|
"goodsId": 10048006,
|
||||||
"goodsItem": {
|
"goodsItem": {
|
||||||
"Id": 108006,
|
"id": 108006,
|
||||||
"Count": 20
|
"count": 20
|
||||||
},
|
},
|
||||||
|
"costItemList": [],
|
||||||
"scoin": 100,
|
"scoin": 100,
|
||||||
"hcoin": 100,
|
"hcoin": 100,
|
||||||
"mcoin": 100,
|
"mcoin": 100,
|
||||||
@ -39,9 +40,10 @@
|
|||||||
{
|
{
|
||||||
"goodsId": 10048033,
|
"goodsId": 10048033,
|
||||||
"goodsItem": {
|
"goodsItem": {
|
||||||
"Id": 108033,
|
"id": 108033,
|
||||||
"Count": 20
|
"count": 20
|
||||||
},
|
},
|
||||||
|
"costItemList": [],
|
||||||
"scoin": 1,
|
"scoin": 1,
|
||||||
"buyLimit": 50000,
|
"buyLimit": 50000,
|
||||||
"beginTime": 1575129600,
|
"beginTime": 1575129600,
|
||||||
|
@ -304,7 +304,7 @@
|
|||||||
"description": "Sets your world level (Relog to see proper effects)"
|
"description": "Sets your world level (Relog to see proper effects)"
|
||||||
},
|
},
|
||||||
"spawn": {
|
"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.",
|
"success": "Spawned %s of %s.",
|
||||||
"limit_reached": "Scene spawn limit reached. Spawning %s entities instead.",
|
"limit_reached": "Scene spawn limit reached. Spawning %s entities instead.",
|
||||||
"description": "Spawns an entity near you"
|
"description": "Spawns an entity near you"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user