Compare commits

..

No commits in common. "master" and "1.0" have entirely different histories.
master ... 1.0

7 changed files with 60 additions and 24 deletions

View file

@ -4,5 +4,4 @@ branches:
projects: projects:
Spooky: Spooky:
path: "" path: ""
icon: "icon.png"
... ...

View file

@ -1,4 +1,3 @@
## This repository was moved to [git.ad5001.eu](https://git.ad5001.eu/Ad5001/Spooky)
# Spooky # Spooky
Halloween plugin. Halloween plugin.
A new bossfight's waiting for you and your players. <b>The Ghost is <i>here</i></b>. A new bossfight's waiting for you and your players. <b>The Ghost is <i>here</i></b>.

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

View file

@ -1,7 +1,7 @@
--- ---
name: Spooky name: Spooky
author: Ad5001 author: Ad5001
version: 1.0.1 version: 1.0
api: [3.0.0-ALPHA9] api: [3.0.0-ALPHA9]
main: Ad5001\Spooky\Main main: Ad5001\Spooky\Main
commands: [] commands: []

View file

@ -44,33 +44,32 @@ class Main extends PluginBase implements Listener{
$this->getServer()->getScheduler()->scheduleRepeatingTask(new TickTask($this), 2); $this->getServer()->getScheduler()->scheduleRepeatingTask(new TickTask($this), 2);
$this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getServer()->getPluginManager()->registerEvents($this, $this);
// Resource pack // Resource pack
if(!file_exists($this->getDataFolder())){
mkdir($this->getDataFolder());
}
$downRP = false; $downRP = false;
if(!file_exists($this->getDataFolder() . "Spooky.mcpack")) { if(!file_exists($this->getDataFolder() . "Spooky.mcpack")) {
$downRP = true; $downRP = true;
echo TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack..."); echo TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack...");
file_put_contents($this->getDataFolder() . "Spooky.mcpack", Utils::getURL("https://github.com/Ad5001/Spooky/releases/download/1.0/Spooky.mcpack")); file_put_contents($this->getDataFolder() . "Spooky.mcpack", Utils::getURL("https://download.ad5001.eu/other/Spooky/Spooky.mcpack"));
} }
echo str_repeat("\010", $downRP ? strlen(TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack...")) : 0) . TextFormat::toANSI("§f[Spooky] ⚪ Applying resource pack... "); // Replacing latest message echo str_repeat("\010", $downRP ? strlen(TextFormat::toANSI("§f[Spooky] ⚪ Downloading resource pack...")) : 0) . TextFormat::toANSI("§f[Spooky] ⚪ Applying resource pack... "); // Replacing latest message
$pack = new ZippedResourcePack($this->getDataFolder() . "Spooky.mcpack"); $pack = new ZippedResourcePack($this->getDataFolder() . "Spooky.mcpack");
$r = new \ReflectionClass("pocketmine\\resourcepacks\\ResourcePackManager"); $r = new \ReflectionClass("pocketmine\\resourcepacks\\ResourcePackManager");
// Reflection because devs thought it was a great idea to not let plugins manage resource packs :/ if($pack instanceof \pocketmine\resourcepacks\ResourcePack){
$resourcePacks = $r->getProperty("resourcePacks"); // Reflection because devs thought it was a great idea to not let plugins manage resource packs :/
$resourcePacks->setAccessible(true); $resourcePacks = $r->getProperty("resourcePacks");
$rps = $resourcePacks->getValue($this->getServer()->getResourceManager()); $resourcePacks->setAccessible(true);
$rps[] = $pack; $rps = $resourcePacks->getValue($this->getServer()->getResourceManager());
$resourcePacks->setValue($this->getServer()->getResourceManager(), $rps); $rps[] = $pack;
$resourceUuids = $r->getProperty("uuidList"); $resourcePacks->setValue($this->getServer()->getResourceManager(), $rps);
$resourceUuids->setAccessible(true); $resourceUuids = $r->getProperty("uuidList");
$uuids = $resourceUuids->getValue($this->getServer()->getResourceManager()); $resourceUuids->setAccessible(true);
$uuids[$pack->getPackId()] = $pack; $uuids = $resourceUuids->getValue($this->getServer()->getResourceManager());
$resourceUuids->setValue($this->getServer()->getResourceManager(), $uuids); $uuids[$pack->getPackId()] = $pack;
// Forcing resource packs. We want the client to hear the music! $resourceUuids->setValue($this->getServer()->getResourceManager(), $uuids);
$forceResources = $r->getProperty("serverForceResources"); // Forcing resource packs. We want the client to hear the music!
$forceResources->setAccessible(true); $forceResources = $r->getProperty("serverForceResources");
$forceResources->setValue($this->getServer()->getResourceManager(), true); $forceResources->setAccessible(true);
$forceResources->setValue($this->getServer()->getResourceManager(), true);
}
echo str_repeat("\010", strlen("⚪ Applying resource pack... ")) . TextFormat::toANSI("§a✔ Done! Spooky enabled! \n"); echo str_repeat("\010", strlen("⚪ Applying resource pack... ")) . TextFormat::toANSI("§a✔ Done! Spooky enabled! \n");
} }
@ -198,4 +197,4 @@ class Main extends PluginBase implements Listener{
} }
} }
} }
} }

View file

@ -104,6 +104,25 @@ class Ghost extends Human {
$p->sendPopup("Music: The Return by Niviro, www.djniviro.com"); $p->sendPopup("Music: The Return by Niviro, www.djniviro.com");
} }
/**
* Starts a sequence where the ghost is in an intense fight.
*
* @return void
*/
public function intenseFight(){
if(!$this->checkIfConnected()) return;
// TODO: Custom intense fight
}
/**
* Starts a sequence where the ghost is in an calm fight.
*
* @return void
*/
public function calmFight(){
if(!$this->checkIfConnected()) return;
}
/** /**
* Starts a sequence where the ghost blinds the player, * Starts a sequence where the ghost blinds the player,
* slows him down (zooming effect w/ fov) and he appears invuulnerable * slows him down (zooming effect w/ fov) and he appears invuulnerable
@ -430,7 +449,7 @@ class Ghost extends Human {
$pk->headYaw = $this->yaw; $pk->headYaw = $this->yaw;
$pk->pitch = $this->pitch; $pk->pitch = $this->pitch;
$this->getPlayer()->dataPacket($pk); $this->getPlayer()->dataPacket($pk);
$this->getPlayer()->sendPopup("He's " . round($this->x - $this->getPlayer()->x, 1) . ", " . round($this->y - $this->getPlayer()->y, 1) . ", " . round($this->z - $this->getPlayer()->z, 1) . " blocks away"); $this->getPlayer()->sendPopup("He's " . ($this->x - $this->getPlayer()->x) . ", " . ($this->y - $this->getPlayer()->y) . ", " . ($this->z - $this->getPlayer()->z) . " blocks away");
} }

View file

@ -43,11 +43,15 @@ class TickTask extends PluginTask {
self::$ghosts[$i]->spawnTo(self::$ghosts[$i]->getPlayer()); self::$ghosts[$i]->spawnTo(self::$ghosts[$i]->getPlayer());
self::$ghosts[$i]->scareEnterPhase(); self::$ghosts[$i]->scareEnterPhase();
break; break;
case 66: // 1m06s
self::$ghosts[$i]->intenseFight();
break;
case 82: // 1m22s case 82: // 1m22s
self::$ghosts[$i]->movePlayerRandomly(); self::$ghosts[$i]->movePlayerRandomly();
self::$ghosts[$i]->repeatFunc = "move"; self::$ghosts[$i]->repeatFunc = "move";
break; break;
case 88: // 1m28s case 88: // 1m28s
self::$ghosts[$i]->calmFight();
self::$ghosts[$i]->repeatFunc = null; self::$ghosts[$i]->repeatFunc = null;
break; break;
case 95: // 1m35s case 95: // 1m35s
@ -58,9 +62,18 @@ class TickTask extends PluginTask {
self::$ghosts[$i]->repeatFunc = null; self::$ghosts[$i]->repeatFunc = null;
self::$ghosts[$i]->scareEnterPhase(); self::$ghosts[$i]->scareEnterPhase();
break; break;
case 103: // 1m43s
self::$ghosts[$i]->intenseFight();
break;
case 136: // 2m16s
self::$ghosts[$i]->calmFight();
break;
case 151: // 2m31s case 151: // 2m31s
self::$ghosts[$i]->scareEnterPhase(); self::$ghosts[$i]->scareEnterPhase();
break; break;
case 153: // 2m33s
self::$ghosts[$i]->intenseFight();
break;
case 168: // 2m48s case 168: // 2m48s
self::$ghosts[$i]->movePlayerRandomly(); self::$ghosts[$i]->movePlayerRandomly();
self::$ghosts[$i]->repeatFunc = "move"; self::$ghosts[$i]->repeatFunc = "move";
@ -71,10 +84,17 @@ class TickTask extends PluginTask {
break; break;
case 183: // 3m03s case 183: // 3m03s
self::$ghosts[$i]->repeatFunc = null; self::$ghosts[$i]->repeatFunc = null;
self::$ghosts[$i]->intenseFight();
break; break;
case 197: // 3m17s case 197: // 3m17s
self::$ghosts[$i]->scareEnterPhase(); self::$ghosts[$i]->scareEnterPhase();
break; break;
case 198: // 3m18s
self::$ghosts[$i]->intenseFight();
break;
case 227: // 3m47s
self::$ghosts[$i]->calmFight();
break;
case 262: // 4m22 case 262: // 4m22
self::$ghosts[$i]->getPlayer()->sendMessage("Mwahahahaha... Try being faster next time!"); self::$ghosts[$i]->getPlayer()->sendMessage("Mwahahahaha... Try being faster next time!");
self::$ghosts[$i]->close(); self::$ghosts[$i]->close();