mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-06-26 18:14:50 +08:00
Compare commits
No commits in common. "ec7a6aec5047f7fdd656217ea01c2df03b97ce95" and "3a39545e3478a907f1a2b03e15b055828456f1e6" have entirely different histories.
ec7a6aec50
...
3a39545e34
112
install.sh
112
install.sh
@ -35,38 +35,16 @@ valid_ip() {
|
|||||||
return $stat
|
return $stat
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks for supported installer(s) (only apt-get and pacman right now, might add more in the future)
|
# Checks for supported installer(s) (only apt-get for now :(, might add pacman in the future)
|
||||||
if is_command apt-get ; then
|
if is_command apt-get ; then
|
||||||
echo -e "Supported package manager found (apt-get)\n"
|
echo -e "Supported package manager found\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
|
||||||
|
|
||||||
BRANCH="stable" # Stable by default
|
INSTALLER_DEPS="curl wget openssl unzip git"
|
||||||
# Allows choice between stable and dev branch
|
GC_DEPS="mongodb openjdk-17-jre"
|
||||||
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"
|
||||||
@ -82,95 +60,21 @@ select yn in "Yes" "No" ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Updating package cache..."
|
echo "Updating package cache..."
|
||||||
case $SYSTEM in # More concise than if
|
apt-get update -qq > /dev/null
|
||||||
deb ) apt-get update -qq;;
|
|
||||||
arch ) pacman -Syy;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Starts installing dependencies
|
# Starts installing dependencies
|
||||||
echo "Installing setup dependencies..."
|
echo "Installing setup dependencies..."
|
||||||
case $SYSTEM in # These are one-liners anyways
|
apt-get -qq install $INSTALLER_DEPS -y > /dev/null
|
||||||
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..."
|
||||||
case $SYSTEM in
|
apt-get -qq install $GC_DEPS -y > /dev/null
|
||||||
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/$BRANCH/Grasscutter.zip"
|
wget -q --show-progress https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/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, killerId);
|
getScene().killEntity(this, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ 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;
|
||||||
@ -80,21 +79,22 @@ public class PlayerCodex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkAnimal(GameEntity target, CodexAnimalData.CodexAnimalUnlockCondition condition){
|
public void checkAnimal(GameEntity target, CodexAnimalData.CodexAnimalUnlockCondition condition){
|
||||||
if(target instanceof EntityMonster){
|
if(target.getEntityType() == 2){
|
||||||
var monsterId = ((EntityMonster)target).getMonsterData().getId();
|
var monsterId = target.getSpawnEntry().getMonsterId();
|
||||||
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 || codexAnimal.getUnlockCondition() == null){
|
if(codexAnimal.getUnlockCondition() == condition){
|
||||||
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,19 +386,9 @@ public class Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void killEntity(GameEntity target, int attackerId) {
|
public void killEntity(GameEntity target, int attackerId) {
|
||||||
GameEntity attacker = getEntityById(attackerId);
|
for (Player player : this.getPlayers()) {
|
||||||
|
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