mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-06-26 10:04:58 +08:00
Compare commits
5 Commits
3a39545e34
...
ec7a6aec50
Author | SHA1 | Date | |
---|---|---|---|
|
ec7a6aec50 | ||
|
0d5dc5ec31 | ||
|
f1211eca09 | ||
|
444463cab2 | ||
|
1bf13d17f8 |
112
install.sh
112
install.sh
@ -35,16 +35,38 @@ valid_ip() {
|
|||||||
return $stat
|
return $stat
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks for supported installer(s) (only apt-get for now :(, might add pacman in the future)
|
# Checks for supported installer(s) (only apt-get and pacman right now, might add more in the future)
|
||||||
if is_command apt-get ; then
|
if is_command apt-get ; then
|
||||||
echo -e "Supported package manager found\n"
|
echo -e "Supported package manager found (apt-get)\n"
|
||||||
|
|
||||||
|
GC_DEPS="mongodb openjdk-17-jre"
|
||||||
|
INSTALLER_DEPS="wget openssl unzip git"
|
||||||
|
SYSTEM="deb" # Debian-based (debian, ubuntu)
|
||||||
|
elif is_command pacman ; then
|
||||||
|
echo -e "supported package manager found (pacman)\n"
|
||||||
|
|
||||||
|
GC_DEPS="jre17-openjdk"
|
||||||
|
INSTALLER_DEPS="curl wget openssl unzip git base-devel" # curl is still a dependency here in order to successfully build mongodb
|
||||||
|
SYSTEM="arch" # Arch for the elitists :P
|
||||||
else
|
else
|
||||||
echo "No supported package manager found"
|
echo "No supported package manager found"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALLER_DEPS="curl wget openssl unzip git"
|
BRANCH="stable" # Stable by default
|
||||||
GC_DEPS="mongodb openjdk-17-jre"
|
# Allows choice between stable and dev branch
|
||||||
|
echo "Please select the branch you wish to install"
|
||||||
|
echo -e "!!NOTE!!: stable is the recommended branch.\nDo *NOT* use development unless you have a reason to and know what you're doing"
|
||||||
|
select branch in "stable" "development" ; do
|
||||||
|
case $branch in
|
||||||
|
stable )
|
||||||
|
BRANCH="stable"
|
||||||
|
break;;
|
||||||
|
development )
|
||||||
|
BRANCH="development"
|
||||||
|
break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
echo "The following packages will have to be installed in order to INSTALL grasscutter:"
|
echo "The following packages will have to be installed in order to INSTALL grasscutter:"
|
||||||
echo -e "$INSTALLER_DEPS \n"
|
echo -e "$INSTALLER_DEPS \n"
|
||||||
@ -60,21 +82,95 @@ select yn in "Yes" "No" ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Updating package cache..."
|
echo "Updating package cache..."
|
||||||
apt-get update -qq > /dev/null
|
case $SYSTEM in # More concise than if
|
||||||
|
deb ) apt-get update -qq;;
|
||||||
|
arch ) pacman -Syy;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Starts installing dependencies
|
# Starts installing dependencies
|
||||||
echo "Installing setup dependencies..."
|
echo "Installing setup dependencies..."
|
||||||
apt-get -qq install $INSTALLER_DEPS -y > /dev/null
|
case $SYSTEM in # These are one-liners anyways
|
||||||
|
deb ) apt-get -qq install $INSTALLER_DEPS -y;;
|
||||||
|
arch ) pacman -Sq --noconfirm --needed $INSTALLER_DEPS > /dev/null;;
|
||||||
|
esac
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|
||||||
echo "Installing grasscutter dependencies..."
|
echo "Installing grasscutter dependencies..."
|
||||||
apt-get -qq install $GC_DEPS -y > /dev/null
|
case $SYSTEM in
|
||||||
|
deb) apt-get -qq install $GC_DEPS -y > /dev/null;;
|
||||||
|
arch ) pacman -Sq --noconfirm --needed $GC_DEPS > /dev/null;;
|
||||||
|
esac
|
||||||
|
# *sighs* here we go...
|
||||||
|
INST_ARCH_MONGO="no"
|
||||||
|
if [ $SYSTEM = "arch" ]; then
|
||||||
|
echo -e "-=-=-=-=-=--- !! IMPORTANT !! ---=-=-=-=-=-\n"
|
||||||
|
echo -e " Due to licensing issues with mongodb,\n it is no longer available on the official arch repositiries."
|
||||||
|
echo -e " In order to install mongodb,\n it needs to be fetched from the Arch User Repository.\n"
|
||||||
|
echo -e " As this script is running as root,\n a temporary user will need to be created to run makepkg."
|
||||||
|
echo -e " The temporary user will be deleted once\n makepkg has finished.\n"
|
||||||
|
echo -e " This will be handled automatically.\n"
|
||||||
|
echo -e "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n"
|
||||||
|
echo -e "!!NOTE!!: Only select \"Skip\" if mongodb is already installed on this system"
|
||||||
|
echo "Do you want to continue?"
|
||||||
|
select yn in "Yes" "Skip" "No" ; do
|
||||||
|
case $yn in
|
||||||
|
Yes )
|
||||||
|
INST_ARCH_MONGO="yes"
|
||||||
|
break;;
|
||||||
|
No ) exit;;
|
||||||
|
Skip )
|
||||||
|
INST_ARCH_MONGO="no"
|
||||||
|
break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $INST_ARCH_MONGO = "yes" ]; then
|
||||||
|
DIR=$(pwd)
|
||||||
|
# Make temp user
|
||||||
|
echo "Creating temporary user..."
|
||||||
|
TEMPUSER="gctempuser"
|
||||||
|
TEMPHOME="/home/$TEMPUSER"
|
||||||
|
useradd -m $TEMPUSER
|
||||||
|
cd $TEMPHOME
|
||||||
|
|
||||||
|
# Do the actual makepkg shenanigans
|
||||||
|
echo "Building mongodb... (this will take a moment)"
|
||||||
|
su $TEMPUSER<<EOF
|
||||||
|
mkdir temp
|
||||||
|
cd temp
|
||||||
|
git clone https://aur.archlinux.org/mongodb-bin.git -q
|
||||||
|
cd mongodb-bin
|
||||||
|
makepkg -s > /dev/null
|
||||||
|
exit
|
||||||
|
EOF
|
||||||
|
mv "$(find -name "mongodb-bin*.pkg.tar.zst" -type f)" ./mongodb-bin.pkg.tar.zst
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
# Snatch the file to current working directory
|
||||||
|
mv "$TEMPHOME/mongodb-bin.pkg.tar.zst" ./mongodb-bin.pkg.tar.zst
|
||||||
|
chown root ./mongodb-bin.pkg.tar.zst
|
||||||
|
chgrp root ./mongodb-bin.pkg.tar.zst
|
||||||
|
chmod 775 ./mongodb-bin.pkg.tar.zst
|
||||||
|
|
||||||
|
echo "Installing mongodb..."
|
||||||
|
pacman -U mongodb-bin.pkg.tar.zst --noconfirm > /dev/null
|
||||||
|
rm mongodb-bin.pkg.tar.zst
|
||||||
|
|
||||||
|
echo "Starting mongodb..."
|
||||||
|
systemctl enable mongodb
|
||||||
|
systemctl start mongodb
|
||||||
|
|
||||||
|
echo "Removing temporary account..."
|
||||||
|
userdel -r $TEMPUSER
|
||||||
|
fi
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|
||||||
echo "Getting grasscutter..."
|
echo "Getting grasscutter..."
|
||||||
|
|
||||||
# Download and rename jar
|
# Download and rename jar
|
||||||
wget -q --show-progress https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip
|
wget -q --show-progress "https://nightly.link/Grasscutters/Grasscutter/workflows/build/$BRANCH/Grasscutter.zip"
|
||||||
|
echo "unzipping"
|
||||||
unzip -qq Grasscutter.zip
|
unzip -qq Grasscutter.zip
|
||||||
mv $(find -name "grasscutter*.jar" -type f) grasscutter.jar
|
mv $(find -name "grasscutter*.jar" -type f) grasscutter.jar
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ public abstract class GameEntity {
|
|||||||
|
|
||||||
// Check if dead
|
// Check if dead
|
||||||
if (isDead) {
|
if (isDead) {
|
||||||
getScene().killEntity(this, 0);
|
getScene().killEntity(this, killerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import dev.morphia.annotations.Transient;
|
|||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.def.CodexAnimalData;
|
import emu.grasscutter.data.def.CodexAnimalData;
|
||||||
import emu.grasscutter.data.def.CodexReliquaryData;
|
import emu.grasscutter.data.def.CodexReliquaryData;
|
||||||
|
import emu.grasscutter.game.entity.EntityMonster;
|
||||||
import emu.grasscutter.game.entity.GameEntity;
|
import emu.grasscutter.game.entity.GameEntity;
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.inventory.ItemType;
|
import emu.grasscutter.game.inventory.ItemType;
|
||||||
@ -79,22 +80,21 @@ public class PlayerCodex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkAnimal(GameEntity target, CodexAnimalData.CodexAnimalUnlockCondition condition){
|
public void checkAnimal(GameEntity target, CodexAnimalData.CodexAnimalUnlockCondition condition){
|
||||||
if(target.getEntityType() == 2){
|
if(target instanceof EntityMonster){
|
||||||
var monsterId = target.getSpawnEntry().getMonsterId();
|
var monsterId = ((EntityMonster)target).getMonsterData().getId();
|
||||||
var codexAnimal = GameData.getCodexAnimalDataMap().get(monsterId);
|
var codexAnimal = GameData.getCodexAnimalDataMap().get(monsterId);
|
||||||
|
|
||||||
if(!getUnlockedAnimal().containsKey(monsterId)) {
|
if(!getUnlockedAnimal().containsKey(monsterId)) {
|
||||||
if (codexAnimal != null) {
|
if (codexAnimal != null) {
|
||||||
if(codexAnimal.getUnlockCondition() == condition){
|
if(codexAnimal.getUnlockCondition() == condition || codexAnimal.getUnlockCondition() == null){
|
||||||
getUnlockedAnimal().put(monsterId, 1);
|
getUnlockedAnimal().put(monsterId, 1);
|
||||||
player.save();
|
|
||||||
this.player.sendPacket(new PacketCodexDataUpdateNotify(3, monsterId));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
getUnlockedAnimal().put(monsterId, getUnlockedAnimal().get(monsterId) + 1);
|
getUnlockedAnimal().put(monsterId, getUnlockedAnimal().get(monsterId) + 1);
|
||||||
player.save();
|
|
||||||
}
|
}
|
||||||
|
player.save();
|
||||||
|
this.player.sendPacket(new PacketCodexDataUpdateNotify(3, monsterId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,9 +386,19 @@ public class Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void killEntity(GameEntity target, int attackerId) {
|
public void killEntity(GameEntity target, int attackerId) {
|
||||||
for (Player player : this.getPlayers()) {
|
GameEntity attacker = getEntityById(attackerId);
|
||||||
player.getCodex().checkAnimal(target, CodexAnimalData.CodexAnimalUnlockCondition.CODEX_COUNT_TYPE_KILL);
|
|
||||||
|
//Check codex
|
||||||
|
if (attacker instanceof EntityClientGadget) {
|
||||||
|
var clientGadgetOwner = getEntityById(((EntityClientGadget) attacker).getOwnerEntityId());
|
||||||
|
if(clientGadgetOwner instanceof EntityAvatar) {
|
||||||
|
((EntityClientGadget) attacker).getOwner().getCodex().checkAnimal(target, CodexAnimalData.CodexAnimalUnlockCondition.CODEX_COUNT_TYPE_KILL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (attacker instanceof EntityAvatar) {
|
||||||
|
((EntityAvatar) attacker).getPlayer().getCodex().checkAnimal(target, CodexAnimalData.CodexAnimalUnlockCondition.CODEX_COUNT_TYPE_KILL);
|
||||||
|
}
|
||||||
|
|
||||||
// Packet
|
// Packet
|
||||||
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
|
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user