Compare commits

..

No commits in common. "ec7a6aec5047f7fdd656217ea01c2df03b97ce95" and "3a39545e3478a907f1a2b03e15b055828456f1e6" have entirely different histories.

4 changed files with 17 additions and 123 deletions

View File

@ -35,38 +35,16 @@ valid_ip() {
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
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
echo -e "Supported package manager found\n"
else
echo "No supported package manager found"
exit
fi
BRANCH="stable" # Stable by default
# 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
INSTALLER_DEPS="curl wget openssl unzip git"
GC_DEPS="mongodb openjdk-17-jre"
echo "The following packages will have to be installed in order to INSTALL grasscutter:"
echo -e "$INSTALLER_DEPS \n"
@ -82,95 +60,21 @@ select yn in "Yes" "No" ; do
done
echo "Updating package cache..."
case $SYSTEM in # More concise than if
deb ) apt-get update -qq;;
arch ) pacman -Syy;;
esac
apt-get update -qq > /dev/null
# Starts installing dependencies
echo "Installing setup dependencies..."
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
apt-get -qq install $INSTALLER_DEPS -y > /dev/null
echo "Done"
echo "Installing grasscutter dependencies..."
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
apt-get -qq install $GC_DEPS -y > /dev/null
echo "Done"
echo "Getting grasscutter..."
# Download and rename jar
wget -q --show-progress "https://nightly.link/Grasscutters/Grasscutter/workflows/build/$BRANCH/Grasscutter.zip"
echo "unzipping"
wget -q --show-progress https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip
unzip -qq Grasscutter.zip
mv $(find -name "grasscutter*.jar" -type f) grasscutter.jar

View File

@ -216,7 +216,7 @@ public abstract class GameEntity {
// Check if dead
if (isDead) {
getScene().killEntity(this, killerId);
getScene().killEntity(this, 0);
}
}
}

View File

@ -5,7 +5,6 @@ import dev.morphia.annotations.Transient;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.CodexAnimalData;
import emu.grasscutter.data.def.CodexReliquaryData;
import emu.grasscutter.game.entity.EntityMonster;
import emu.grasscutter.game.entity.GameEntity;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.inventory.ItemType;
@ -80,21 +79,22 @@ public class PlayerCodex {
}
public void checkAnimal(GameEntity target, CodexAnimalData.CodexAnimalUnlockCondition condition){
if(target instanceof EntityMonster){
var monsterId = ((EntityMonster)target).getMonsterData().getId();
if(target.getEntityType() == 2){
var monsterId = target.getSpawnEntry().getMonsterId();
var codexAnimal = GameData.getCodexAnimalDataMap().get(monsterId);
if(!getUnlockedAnimal().containsKey(monsterId)) {
if (codexAnimal != null) {
if(codexAnimal.getUnlockCondition() == condition || codexAnimal.getUnlockCondition() == null){
if(codexAnimal.getUnlockCondition() == condition){
getUnlockedAnimal().put(monsterId, 1);
player.save();
this.player.sendPacket(new PacketCodexDataUpdateNotify(3, monsterId));
}
}
}else{
getUnlockedAnimal().put(monsterId, getUnlockedAnimal().get(monsterId) + 1);
player.save();
}
player.save();
this.player.sendPacket(new PacketCodexDataUpdateNotify(3, monsterId));
}
}

View File

@ -386,19 +386,9 @@ public class Scene {
}
public void killEntity(GameEntity target, int attackerId) {
GameEntity attacker = getEntityById(attackerId);
//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);
}
for (Player player : this.getPlayers()) {
player.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
this.broadcastPacket(new PacketLifeStateChangeNotify(attackerId, target, LifeState.LIFE_DEAD));