Advertisement
Guest User

Untitled

a guest
Dec 31st, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 5.72 KB | None | 0 0
  1. package com.wc.world.content.skill.woodcutting
  2.  
  3. import java.util.HashMap
  4. import java.util.Map
  5. import com.wc.util.ItemNames
  6. import com.wc.world.content.skill.SkillConstants
  7. import com.wc.world.entity.player.Player
  8. import com.wc.world.model.item.Item
  9. import scala.reflect.{BeanProperty, BooleanBeanProperty}
  10. //remove if not needed
  11. import scala.collection.JavaConversions._
  12.  
  13. object WoodcuttingData {
  14.  
  15.   object Tree extends Enumeration {
  16.  
  17.     val NORMAL = new Tree(1, 25, 1511, Array(1276, 1277, 1278, 1279, 1280, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1301, 1303, 1304, 1305, 1318, 1319, 1315, 1316, 1330, 1331, 1332, 1333, 1383, 1384, 2409, 2447, 2448, 3033, 3034, 3035, 3036, 3879, 3881, 3883, 3893, 3885, 3886, 3887, 3888, 3892, 3889, 3890, 3891, 3928, 3967, 3968, 4048, 4049, 4050, 4051, 4052, 4053, 4054, 4060, 5004, 5005, 5045, 5902, 5903, 5904, 8973, 8974, 10041, 10081, 10082, 10664, 11112, 11510, 12559, 12560, 12732, 12895, 12896, 13412, 13411, 13419, 13843, 13844, 13845, 13847, 13848, 13849, 13850, 14308, 14309, 14513, 14514, 14515, 14521, 14564, 14565, 14566, 14593, 14594, 14595, 14600, 14635, 14636, 14637, 14642, 14664, 14665, 14666, 14693, 14694, 14695, 14696, 14701, 14738, 14796, 14797, 14798, 14799, 14800, 14801, 14802, 14803, 14804, 14805, 14806, 14807, 15489, 15776, 15777, 16264, 16265, 19165, 19166, 19167, 23381),
  18.       2400, 2400, 5)
  19.  
  20.     val OAK = new Tree(15, 37.5, 1521, Array(1281, 3037, 8462, 8463, 8464, 8465, 8466, 8467, 10083, 13413, 13420),
  21.       3000, 4000, 8)
  22.  
  23.     val WILLOW = new Tree(30, 67.5, 1519, Array(1308, 5551, 5552, 5553, 8481, 8482, 8483, 8484, 8485, 8486, 8487, 8488, 8496, 8497, 8498, 8499, 8500, 8501, 13414, 13421),
  24.       3600, 8200, 10)
  25.  
  26.     val TEAK = new Tree(35, 85, 6333, Array(9036), 4200, 10200, 3)
  27.  
  28.     val MAPLE = new Tree(45, 100, 1517, Array(1307, 4674, 8435, 8436, 8437, 8438, 8439, 8440, 8441, 8442, 8443, 8444, 8454, 8455, 8456, 8457, 8458, 8459, 8460, 8461, 13415, 13423),
  29.       4200, 15000, 6)
  30.  
  31.     val MAHOGANY = new Tree(50, 125, 6332, Array(9034), 4200, 17600, 4)
  32.  
  33.     val YEW = new Tree(60, 4200, 1515, Array(1309, 8503, 8504, 8505, 8506, 8507, 8508, 8509, 8510, 8511, 8512, 8513, 13416, 13422),
  34.       4800, 22800, 9)
  35.  
  36.     val MAGIC = new Tree(75, 7990, 1513, Array(1306, 8396, 8397, 8398, 8399, 8400, 8401, 8402, 8403, 8404, 8405, 8406, 8407, 8408, 8409, 13417, 13424),
  37.       5400, 28400, 9)
  38.  
  39.     class Tree private (@BeanProperty var level: Int,
  40.         @BeanProperty var exp: Double,
  41.         @BeanProperty var product: Int,
  42.         private var objectIds: Array[Int],
  43.         @BeanProperty var lifeCycle: Int,
  44.         @BeanProperty var respawnTimer: Int,
  45.         @BeanProperty var logCount: Int) extends Val
  46.  
  47.     def forId(`object`: Int): Tree = trees.get(`object`)
  48.  
  49.     private val trees = new HashMap()
  50.  
  51.     for (tree <- Tree.values; `object` <- tree.objectIds) {
  52.       trees.put(`object`, tree)
  53.     }
  54.  
  55.     implicit def convertValue(v: Value): Tree = v.asInstanceOf[Tree]
  56.   }
  57.  
  58.   object Hatchet extends Enumeration {
  59.  
  60.     val BRONZE_HATCHET = new Hatchet(ItemNames.BRONZE_AXE, 1, 879, 1000)
  61.  
  62.     val IRON_HATCHET = new Hatchet(ItemNames.IRON_HATCHET, 1, 877, 1250)
  63.  
  64.     val STEEL_HATCHET = new Hatchet(ItemNames.STEEL_AXE, 6, 875, 1500)
  65.  
  66.     val BLACK_HATCHET = new Hatchet(ItemNames.BLACK_AXE, 6, 873, 1750)
  67.  
  68.     val MITHRIL_HATCHET = new Hatchet(ItemNames.MITHRIL_AXE, 21, 871, 2000)
  69.  
  70.     val ADAMANT_HATCHET = new Hatchet(ItemNames.ADAMANT_AXE, 31, 869, 2250)
  71.  
  72.     val RUNE_HATCHET = new Hatchet(ItemNames.RUNE_AXE, 41, 867, 2500)
  73.  
  74.     val DRAGON_HATCHET = new Hatchet(ItemNames.DRAGON_HATCHET, 61, 2846, 2750)
  75.  
  76.     val INFERNO_ADZE = new Hatchet(ItemNames.INFERNO_ADZE, 61, 10251, 2750)
  77.  
  78.     class Hatchet private (@BeanProperty var item: Int,
  79.         @BeanProperty var level: Int,
  80.         @BeanProperty var animation: Int,
  81.         @BeanProperty var speed: Int) extends Val
  82.  
  83.     def getHatchet(player: Player): Hatchet = {
  84.       var best: Hatchet = null
  85.       for (hatchet <- values if player.getInventory.contains(hatchet.getItem) || player.getEquipment.contains(hatchet.getItem)
  86.           if hatchet.getLevel <=
  87.         player.getSkills.getLevel(SkillConstants.WOODCUTTING) if best == null || hatchet.getLevel > best.getLevel) best = hatchet
  88.       best
  89.     }
  90.  
  91.     implicit def convertValue(v: Value): Hatchet = v.asInstanceOf[Hatchet]
  92.   }
  93.  
  94.   object BirdNest extends Enumeration {
  95.  
  96.     val RED_EGG_BIRD_NEST = new BirdNest(ItemNames.BIRDS_NEST, 4, Array(5076))
  97.  
  98.     val GREEN_EGG_NEST = new BirdNest(ItemNames.BIRDS_NEST_1, 4, Array(5077))
  99.  
  100.     val PURPLE_EGG_NEST = new BirdNest(ItemNames.BIRDS_NEST_2, 4, Array(5078))
  101.  
  102.     val SEED_NEST = new BirdNest(ItemNames.BIRDS_NEST_3, 22, Array(5312, 5313, 5314, 5315, 5316, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5317))
  103.  
  104.     val RING_NEST = new BirdNest(ItemNames.BIRDS_NEST_4, 18, Array(1635, 1637, 1639, 1641, 1643))
  105.  
  106.     val RAVENS_NEST = new BirdNest(ItemNames.BIRDS_NEST_7, 8, Array(11964))
  107.  
  108.     val EMPTY_NEST = new BirdNest(ItemNames.BIRDS_NEST_6, 40, Array())
  109.  
  110.     class BirdNest private (private var nest: Int, private var drop_chance: Int, rewards: Array[Int])
  111.         extends Val {
  112.  
  113.       private var reward: Array[Int] = rewards
  114.  
  115.       def getNest(): Item = new Item(nest)
  116.  
  117.       def getNestId(): Int = nest
  118.  
  119.       def getDropChance(): Int = drop_chance
  120.  
  121.       def getRewards(): Array[Int] = reward
  122.     }
  123.  
  124.     var birdNests: Map[Integer, BirdNest] = new HashMap[Integer, BirdNest]()
  125.  
  126.     def forId(index: Int): BirdNest = birdNests.get(index)
  127.  
  128.     for (data <- values) {
  129.       birdNests.put(data.ordinal(), data)
  130.       birdNests.put(data.getNestId, data)
  131.     }
  132.  
  133.     implicit def convertValue(v: Value): BirdNest = v.asInstanceOf[BirdNest]
  134.   }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement