Skip to content

Instantly share code, notes, and snippets.

@PEMapModder
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save PEMapModder/27df2c449f222e2bfa06 to your computer and use it in GitHub Desktop.

Select an option

Save PEMapModder/27df2c449f222e2bfa06 to your computer and use it in GitHub Desktop.

Nothing here :P

<?php
/*
* libtheta
*
* Copyright (C) 2015 PEMapModder and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
namespace libtheta\info\pvp;
class PvpArmorKitInfo extends PvpKitInfo{
protected function __construct($material, $slot){
parent::__construct(self::CAT_ARMOR | $material | $slot, 0, 1);
}
public function getUpgardes(){
$out = [];
foreach(self::$_ as $info){
if($info instanceof PvpArmorKitInfo and $info->getSlot() === $this->getSlot() and $info->getMaterial() > $this->getMaterial()){
$out[] = $info;
}
}
return $out;
}
public function getMaterial(){
return $this->getId() & self::SUBCAT_ARMOR_MATERIAL;
}
public function getSlot(){
return $this->getId() & self::SUBCAT_ARMOR_SLOT;
}
public function getMaterialName(){
switch($this->getMaterial()){
case self::ARMOR_MATERIAL_LEATHER:
return "Leather";
case self::ARMOR_MATERIAL_GOLD:
return "Gold";
case self::ARMOR_MATERIAL_CHAIN:
return "Chain";
case self::ARMOR_MATERIAL_IRON:
return "Iron";
case self::ARMOR_MATERIAL_DIAMOND:
return "Diamond";
}
return "";
}
public function getSlotName(){
switch($this->getSlot()){
case self::ARMOR_SLOT_HELMET:
return "Helmet";
case self::ARMOR_SLOT_CHESTPLATE:
return "Chestplate";
case self::ARMOR_SLOT_LEGGINGS:
return "Leggings";
case self::ARMOR_SLOT_BOOTS:
return "Boots";
}
return "Armor";
}
public function name(){
return $this->getMaterialName() . " " . $this->getSlotName();
}
}
<?php
/*
* libtheta
*
* Copyright (C) 2015 PEMapModder and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
namespace libtheta\info\pvp;
use pocketmine\item\Item;
class PvpFoodKitInfo extends PvpKitInfo{
const MELON = 1;
const COOKIE = 2;
const CARROT = 3;
const APPLE = 4;
const BREAD = 5;
const GRASS_CARP = 6;
const SALMON = 7;
const PORKCHOP = 8;
const CHICKEN_LEG = 9;
const STEAK = 10;
private $level;
public function __construct($level, $count){
parent::__construct($this->levelToItemId($this->level = $level), $this->levelToItemDamage($level), $count);
}
public function name(){
switch($this->level){
case self::MELON:
$item = "Melons";
break;
case self::COOKIE:
$item = "Cookies";
break;
case self::CARROT:
$item = "Carrots";
break;
case self::APPLE:
$item = "Apples";
break;
case self::BREAD:
$item = "Bread";
break;
case self::GRASS_CARP:
$item = "Grass Carp";
break;
case self::SALMON:
$item = "Salmon Fish";
break;
case self::PORKCHOP:
$item = "Porkchop";
break;
case self::CHICKEN_LEG:
$item = "Chicken Legs";
break;
case self::STEAK:
$item = "Beef Steak";
break;
default:
$item = "Food";
}
return $this->getCount() . " " . $item;
}
public function levelToItemId($level){
switch($level){
case self::MELON:
return Item::MELON_SLICE;
case self::COOKIE:
return Item::COOKIE;
case self::CARROT:
return Item::CARROT;
case self::APPLE:
return Item::APPLE;
case self::BREAD:
return Item::BREAD;
case self::GRASS_CARP:
return Item::COOKED_FISH;
case self::SALMON:
return Item::COOKED_FISH;
case self::PORKCHOP:
return Item::COOKED_PORKCHOP;
case self::CHICKEN_LEG:
return Item::COOKED_CHICKEN;
}
}
}
<?php
/*
* libtheta
*
* Copyright (C) 2015 PEMapModder and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
namespace libtheta\info\pvp;
interface PvpKitData{
const CAT_ARMOR = 0x01000000;
const SUBCAT_ARMOR_MATERIAL = 0x0000000F;
const ARMOR_MATERIAL_DIAMOND = 0x00000005;
const ARMOR_MATERIAL_IRON = 0x00000004;
const ARMOR_MATERIAL_CHAIN = 0x00000003;
const ARMOR_MATERIAL_GOLD = 0x00000002;
const ARMOR_MATERIAL_LEATHER = 0x00000001;
const SUBCAT_ARMOR_SLOT = 0x00000030;
const ARMOR_SLOT_HELMET = 0x00000000;
const ARMOR_SLOT_CHESTPLATE = 0x00000010;
const ARMOR_SLOT_LEGGINGS = 0x00000020;
const ARMOR_SLOT_BOOTS = 0x00000030;
const CAT_REAL = 0x02000000;
const SUBCAT_REAL_ACTUAL_ITEM = 0x00100000;
const ACTUAL_ITEM_ID = 0x0000FFFF;
const SUBCAT_REAL_SPECIAL_ITEM = 0x00200000;
const SPECIAL_EXPLOSIVE = 0x00000001;
const SPECIAL_SPEED = 0x00000002;
const SPECIAL_SLOW_BOMB = 0x00000003;
const SPECIAL_NAUSEA_BOMB = 0x00000004;
const SPECIAL_JUMP = 0x00000005;
const SPECIAL_INVISIBILITY = 0x00000006;
const SPECIAL_STRENTH = 0x00000007;
const SPECIAL_WEAKNESS_BOMB = 0x00000008;
const SPECIAL_RESISTANCE = 0x00000009;
const SPECIAL_VULNERABILITY_BOMB = 0x0000000A;
const SPECIAL_OXYGEN = 0x0000000B;
const SPECIAL_FIRE_RESISTANCE = 0x0000000C;
const SPECIAL_REGENERATION = 0x0000000D;
const SPECIAL_POISON_BOMB = 0x0000000E;
const SPECIAL_WITHER = 0x0000000F;
const SPECIAL_DIARRHEA = 0x00000010; // eating heals less
const CAT_ABSTRACT = 0x04000000;
const CAT_ABSTRACT_EFFECT = 0x04100000;
const SUBCAT_ABSTRACT_EFFECT_ID = 0x000000FF;
const CAT_ABSTRACT_ENCHANT = 0x04200000;
const ENCHANT_FIRE_SWORD = 0x00000001;
const ENCHANT_FLAME_BOW = 0x00000002;
const ENCHANT_STRIKER_SWORD = 0x00000003;
const ENCHANT_KNOCKBACK_BOW = 0x00000003;
const ENCHANT_ELECTRIC_SWORD = 0x00000004;
const ENCHANT_MAGNETIC_ARROW = 0x00000006;
const ENCHANT_DIAMOND_CRUSHER_SWORD = 0x00000005;
const ENCHANT_CARBON_FLATTENER = 0x00000007;
const ENCHANT_STICKY_ARMOR = 0x00000010; // increase cooldown
const ENCHANT_THORNED_ARMOR = 0x00000020;
const ENCHANT_NAILED_BOOTS = 0x00000030;
const ENCHANT_PARACHUTE_HELMET = 0x000000040;
const AMPLITUDE_NIL = -1;
const FIRE_SWORD_TICKS = [
0 => 20,
1 => 40,
2 => 60,
3 => 80
];
const FLAME_BOW_TICKS = [
0 => 40,
1 => 70,
2 => 120,
3 => 160
];
const STRIKER_SWORD_AMPLIFIER = [
0 => 1.4,
1 => 1.6,
2 => 1.8,
3 => 1.0,
4 => 2.2
];
const KNOCKBACK_BOW_AMPLIFIER = [
0 => 1.2,
1 => 1.6,
2 => 2.2,
3 => 3.0,
4 => 4.0
];
const ELECTRIC_SWORD_AMPLIFIER = [
0 => 0.3,
1 => 0.6,
2 => 0.9,
3 => 1.2,
4 => 1.5
];
const MAGNETIC_ARROW_AMPLIFIER = [
0 => 0.5,
1 => 0.7,
2 => 0.9,
3 => 1.1
];
const DIAMOND_CRUSHER_SWORD_AMPLIFIER = [
0 => 0.3,
1 => 0.6,
2 => 0.9,
3 => 1.2,
4 => 1.5
];
const CARBON_FLATTENER_ARROW_AMPLIFIER = [
0 => 0.5,
1 => 0.7,
2 => 0.9,
3 => 1.1
];
const STICKY_ARMOR_COOLDOWN = [
self::AMPLITUDE_NIL => 0.5, // default value
0 => 0.55,
1 => 0.6,
2 => 0.7,
3 => 0.75,
4 => 0.8
];
const FORTUNE_DOUBLE_CHANCE = [
0 => 20,
1 => 40,
2 => 60,
3 => 80
];
const THORNED_ARMOR_CHANCE = [
0 => 20,
1 => 40,
2 => 60,
3 => 80,
4 => 100
];
const NAILED_BOOTS_AMPLIFIER = [
0 => 0.7,
1 => 0.5,
2 => 0.4,
3 => 0.2,
4 => 0
];
const PARACHUTE_HELMET_AMPLIFIER = [
0 => 0.5,
1 => 0.3,
2 => 0.1
];
const THORNED_ARMOR_CHARGEBACK_RATE = 0.3;
}
<?php
/*
* libtheta
*
* Copyright (C) 2015 PEMapModder and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
namespace libtheta\info\pvp;
use libtheta\info\KitInfo;
abstract class PvpKitInfo extends KitInfo implements PvpKitData{
/** @var PvpKitInfo[] */
public static $_ = [];
/** @var int */
private $id;
/** @var int */
private $amplitude;
/** @var int */
private $count;
protected function __construct($id, $amplitude, $count){
$this->id = $id;
$this->amplitude = $amplitude;
$this->count = $count;
self::register($this);
}
public function getIncreasables(){
return [];
}
public function getUpgrades(){
return [];
}
public function canLengthen(){
return true;
}
/**
* @return int
*/
public function getId(){
return $this->id;
}
/**
* @return int
*/
public function getAmplitude(){
return $this->amplitude;
}
/**
* @return int
*/
public function getCount(){
return $this->count;
}
public static function register(self $info){
self::$_[$info->id] = $info;
}
public static function init(){
new PvpArmorKitInfo(self::ARMOR_MATERIAL_LEATHER, self::ARMOR_SLOT_HELMET);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_LEATHER, self::ARMOR_SLOT_CHESTPLATE);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_LEATHER, self::ARMOR_SLOT_LEGGINGS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_LEATHER, self::ARMOR_SLOT_BOOTS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_GOLD, self::ARMOR_SLOT_HELMET);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_GOLD, self::ARMOR_SLOT_CHESTPLATE);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_GOLD, self::ARMOR_SLOT_LEGGINGS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_GOLD, self::ARMOR_SLOT_BOOTS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_CHAIN, self::ARMOR_SLOT_HELMET);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_CHAIN, self::ARMOR_SLOT_CHESTPLATE);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_CHAIN, self::ARMOR_SLOT_LEGGINGS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_CHAIN, self::ARMOR_SLOT_BOOTS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_IRON, self::ARMOR_SLOT_HELMET);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_IRON, self::ARMOR_SLOT_CHESTPLATE);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_IRON, self::ARMOR_SLOT_LEGGINGS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_IRON, self::ARMOR_SLOT_BOOTS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_DIAMOND, self::ARMOR_SLOT_HELMET);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_DIAMOND, self::ARMOR_SLOT_CHESTPLATE);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_DIAMOND, self::ARMOR_SLOT_LEGGINGS);
new PvpArmorKitInfo(self::ARMOR_MATERIAL_DIAMOND, self::ARMOR_SLOT_BOOTS);
new PvpSwordKitInfo(PvpSwordKitInfo::WOODEN_SWORD);
new PvpSwordKitInfo(PvpSwordKitInfo::STONE_SWORD);
new PvpSwordKitInfo(PvpSwordKitInfo::IRON_SWORD);
new PvpSwordKitInfo(PvpSwordKitInfo::DIAMOND_SWORD);
}
}
<?php
/*
* libtheta
*
* Copyright (C) 2015 PEMapModder and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
namespace libtheta\info\pvp;
use pocketmine\item\Item;
class PvpSwordKitInfo extends PvpKitInfo{
const WOODEN_SWORD = 1;
const STONE_SWORD = 2;
const IRON_SWORD = 3;
const DIAMOND_SWORD = 4;
private $materialId;
protected function __construct($materialId){
parent::__construct(self::CAT_REAL | self::SUBCAT_REAL_ACTUAL_ITEM | $this->getItemIdByMaterialId($this->materialId = $materialId), 0, 1);
}
public static function getItemIdByMaterialId($materialId){
switch($materialId){
case self::WOODEN_SWORD:
return Item::WOODEN_SWORD;
case self::STONE_SWORD:
return Item::STONE_SWORD;
case self::IRON_SWORD:
return Item::IRON_SWORD;
case self::DIAMOND_SWORD:
return Item::DIAMOND_SWORD;
}
return 0;
}
public static function getMaterialIdByItemId($itemId){
switch($itemId){
case Item::WOODEN_SWORD:
return self::WOODEN_SWORD;
case Item::STONE_SWORD:
return self::STONE_SWORD;
case Item::IRON_SWORD:
return self::IRON_SWORD;
case Item::DIAMOND_SWORD:
return self::DIAMOND_SWORD;
}
return 0;
}
public function getUpgrades(){
$out = [];
foreach(self::$_ as $info){
if($info instanceof self and $info->getMaterialId() > $this->getMaterialId()){
$out[] = $info;
}
}
return $out;
}
public function name(){
switch($this->materialId){
case self::WOODEN_SWORD:
return "Wooden Sword";
case self::STONE_SWORD:
return "Stone Sword";
case self::IRON_SWORD:
return "Iron Sword";
case self::DIAMOND_SWORD:
return "Diamond Sword";
}
return "Sword";
}
/**
* @return int
*/
public function getMaterialId(){
return $this->materialId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment