Skip to content

Commit

Permalink
Update 4.7 characters
Browse files Browse the repository at this point in the history
Add position option
  • Loading branch information
NotThorny committed Jun 21, 2024
1 parent 8542f83 commit ab46ba5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<dependency>
<groupId>xyz.grasscutters</groupId> <!-- Versions below 1.0.3-dev are on 'tech.xigam' -->
<artifactId>grasscutter</artifactId>
<version>1.7.0</version> <!-- Replace with the latest version of the API. -->
<version>1.7.4</version> <!-- Replace with the latest version of the API. -->
</dependency>
</dependencies>
</project>
16 changes: 16 additions & 0 deletions src/main/java/thorny/grasscutters/AttackModifier/AddAttack.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ public class AddAttack {
static ArrayList<Integer> blacklistUIDs = AttackModifier.getInstance().config.getBlacklist();
static List<EntityGadget> activeGadgets = new ArrayList<>(); // Current gadgets
static List<EntityGadget> removeGadgets = new ArrayList<>(); // To be removed gadgets
public static int x = 0;
public static int y = 0;
public static int z = 0;

public static void setXYZ(int x, int y, int z) {
AddAttack.x = x;
AddAttack.y = y;
AddAttack.z = z;
}

public static void addAttack(GameSession session, int skillId, int uid) {

Expand Down Expand Up @@ -88,6 +97,13 @@ public static void addAttack(GameSession session, int skillId, int uid) {
target.addZ((float) (r * Math.cos(Math.PI / 180 * angle)));
}

// Optional xyz args
if (x != 0 || y != 0 || z != 0) {
target.addX(x);
target.addY(y);
target.addZ(z);
}

// Only spawn on match
if (addedAttack != 0) {
EntityGadget att = new EntityGadget(scene, addedAttack, target, rot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
int thing = 0;
int newGadget = -1;
String state;
String avatarName = targetPlayer.getTeamManager().getCurrentAvatarEntity().getAvatar().getAvatarData().getName().toLowerCase() + "Ids";
int uid = targetPlayer.getUid();
String avatarName = targetPlayer.getTeamManager().getCurrentAvatarEntity().getAvatar().getAvatarData().getName()
.toLowerCase() + "Ids";
int uid = targetPlayer.getUid();
int x = 0;
int y = 0;
int z = 0;

state = args.get(0);
try {
Expand All @@ -48,19 +52,23 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {

// Change whether added attacks should be on or not
if (state.equals("off")) {
if(blacklistUIDs.contains(uid)){
if (blacklistUIDs.contains(uid)) {
CommandHandler.sendMessage(targetPlayer, "Added attacks already disabled!");
}else{blacklistUIDs.add(uid);
} else {
blacklistUIDs.add(uid);
AttackModifier.getInstance().saveBlacklist(blacklistUIDs);
CommandHandler.sendMessage(targetPlayer, "Disabled added attacks!");}
CommandHandler.sendMessage(targetPlayer, "Disabled added attacks!");
}
}

if (state.equals("on")) {
if(blacklistUIDs.contains(uid)){
if (blacklistUIDs.contains(uid)) {
blacklistUIDs.remove(Integer.valueOf(uid));
AttackModifier.getInstance().saveBlacklist(blacklistUIDs);
CommandHandler.sendMessage(targetPlayer, "Enabled added attacks!");
}else{CommandHandler.sendMessage(targetPlayer, "Added attacks already enabled!!");}
} else {
CommandHandler.sendMessage(targetPlayer, "Added attacks already enabled!!");
}
}

if (state.equals("remove")) {
Expand All @@ -73,9 +81,35 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {
AttackModifier.getInstance().reloadConfig();
CommandHandler.sendMessage(targetPlayer, "Reloaded config!");
}
if (state.equals("set")){
if (state.equals("set")) {
var attackType = args.get(1).toLowerCase();
try{newGadget = Integer.parseInt(args.get(2));}catch(Exception e){sendUsageMessage(targetPlayer); return;}
try {
newGadget = Integer.parseInt(args.get(2));
} catch (Exception e) {
sendUsageMessage(targetPlayer);
return;
}
try {
if (args.size() > 3) {
for (var a : args) {
if (a.startsWith("x")) {
x = Integer.parseInt(a.substring(1));
}
if (a.startsWith("y")) {
y = Integer.parseInt(a.substring(1));
}
if (a.startsWith("z")) {
z = Integer.parseInt(a.substring(1));
}
};
AddAttack.setXYZ(x, y, z);
CommandHandler.sendMessage(targetPlayer, "Set spawn coordinates of: x" + x + ", y" + y + ", z" + z);
}
} catch (Exception e) {
CommandHandler.sendMessage(targetPlayer,
"Coordinates may be invalid. Ensure they match the format of x123 y123 z123. Only the desired x, y, or z is required.\n If you only want to change y, include just y123.");
}

AddAttack.setGadget(targetPlayer, avatarName, uid, attackType, newGadget);
CommandHandler.sendMessage(targetPlayer, "Set new gadget!");
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/thorny/grasscutters/AttackModifier/utils/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ public final class Config {
public characters linetteIds = new characters();
public characters lineyIds = new characters();
public characters freminetIds = new characters();
public characters wriothesleyIds = new characters();
public characters neuvilletteIds = new characters();
public characters charlotteIds = new characters();
public characters furinaIds = new characters();
public characters chevreuseIds = new characters();
public characters naviaIds = new characters();
public characters gamingIds = new characters();
public characters xianyunIds = new characters();
public characters chioriIds = new characters();
public characters sigewinneIds = new characters();
public characters arlecchinoIds = new characters();
public characters sethosIds = new characters();
public characters clorindeIds = new characters();


public static class characters {

Expand Down

0 comments on commit ab46ba5

Please sign in to comment.