public static void resetAllSkills(Player p) { Fletching.setFletchItem(p, null); Herblore.setHerbloreItem(p, null); Cooking.setCookingItem(p, null); Mining.resetMining(p); Smithing.resetSmithing(p); Woodcutting.resetWoodcutting(p); Fishing.resetFishing(p); Crafting.resetCrafting(p); p.removeTemporaryAttribute("harvesting"); }
private void handleEnterAmount(Player player, Packet packet) { if (player.getTemporaryAttribute("interfaceVariable") == null) { player.getPackets().sendMessage("An error occured, please try again."); return; } EnterVariable var = (EnterVariable)player.getTemporaryAttribute("interfaceVariable"); int craftType = (int)(player.getTemporaryAttribute("craftType") == null ? -1 : (int)player.getTemporaryAttribute("craftType")); // 'Category' of item to craft int amount = packet.readInt(); switch (var.getInterfaceId()) { case 675: // Jewellery crafting Jewellery.makeJewellery(player, var.getSlot(), amount, true); break; case 304: // Dragonhide crafting. int leatherType = (int)(player.getTemporaryAttribute("leatherCraft") == null ? -1 : (int)player.getTemporaryAttribute("leatherCraft")); // Type of leather to craft. switch (var.getSlot()) { case 0: if (leatherType != -1) { Leather.craftDragonHide(player, 1, 0, leatherType, true); // Body break; } else if (craftType == 6) // Ball of wool { Spinning.craftSpinning(player, amount, 0, true); break; } break; case 1: if (craftType == 6) // Bowstring { Spinning.craftSpinning(player, amount, 1, true); break; } break; case 2: if (craftType == 6) // Crossbow string { Spinning.craftSpinning(player, amount, 2, true); break; } break; case 4: Leather.craftDragonHide(player, 1, 4, leatherType, true); // Vambraces break; case 8: Leather.craftDragonHide(player, 1, 8, leatherType, true); // Chaps break; } break; case 303: switch (var.getSlot()) { case 120: // Unholy symbol Silver.newSilverItem(player, amount, var.getSlot(), true); break; case 121: // Tiara Silver.newSilverItem(player, amount, var.getSlot(), true); break; } break; case 154: // Craft normal leather. if (var.getSlot() >= 28 && var.getSlot() <= 34) { Leather.craftNormalLeather(player, var.getSlot(), amount, true); break; } break; case 542: // Glassblowing. switch (var.getSlot()) { case 40: // Make X beer glass. Glass.craftGlass(player, amount, 0, true); break; case 41: // Make X candle lantern. Glass.craftGlass(player, amount, 1, true); break; case 42: // Make X oil lamp. Glass.craftGlass(player, amount, 2, true); break; case 38: // Make X vial. Glass.craftGlass(player, amount, 3, true); break; case 44: // Make X Fishbowl Glass.craftGlass(player, amount, 4, true); break; case 39: // Make X orb. Glass.craftGlass(player, amount, 5, true); break; case 43: // Make X lantern lens Glass.craftGlass(player, amount, 6, true); break; case 45: // Make X dorgeshuun light orb. Glass.craftGlass(player, amount, 7, true); break; } break; case 763: // Bank inventory - X. player.getBank().setLastXAmount(amount); player.getBank().deposit(var.getSlot(), amount); player.getBank().refreshBank(); break; case 762: // Bank - X. player.getBank().setLastXAmount(amount); player.getBank().withdraw(var.getSlot(), amount); player.getBank().refreshBank(); break; case 336: // Trade/stake inventory - trade X. if (player.getTrade() != null) { player.getTrade().tradeItem(var.getSlot(), amount); break; } if (player.getDuel() != null) { player.getDuel().stakeItem(var.getSlot(), amount); break; } break; case 631: if (player.getDuel() != null) { player.getDuel().removeItem(var.getSlot(), amount); break; } break; case 335: // Trade/stake interface - remove X. player.getTrade().removeItem(var.getSlot(), amount); break; case 620: // Shop - buy X. player.getShopSession().buyItem(var.getSlot(), amount); break; case 105: //Grand Exchange custom quantity and price inputs. switch (var.getSlot()) { case 0: //custom enter quantity player.getGESession().setCustomAmount(amount); break; case 1: //custom enter per price player.getGESession().setCustomPrice(amount); break; } break; case 305: // What would you like to make? - 4 options if (player.getTemporaryAttribute("fletchType") == null) { return; } int logType = (int)player.getTemporaryAttribute("fletchType"); switch (var.getSlot()) { case 0: MakeBows.cutLog(player, amount, logType, 0, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true); break; case 1: MakeBows.cutLog(player, amount, logType, 1, (player.getTemporaryAttribute("stringingBow") == null ? false : (bool)player.getTemporaryAttribute("stringingBow")), true); break; case 2: MakeBows.cutLog(player, amount, 0, 2, false, true); break; case 3: MakeBows.cutLog(player, amount, 0, 3, false, true); break; } break; case 306: // What would you like to make? - 5 options switch (var.getSlot()) { case 0: Clay.craftClay(player, amount, craftType, var.getSlot(), true); break; case 1: Clay.craftClay(player, amount, craftType, var.getSlot(), true); break; case 2: Clay.craftClay(player, amount, craftType, var.getSlot(), true); break; case 3: Clay.craftClay(player, amount, craftType, var.getSlot(), true); break; case 4: Clay.craftClay(player, amount, craftType, var.getSlot(), true); break; } break; case 309: // What would you like to make - 1 option if (var.getSlot() >= 50 && var.getSlot() <= 60) // Cut gem { Jewellery.cutGem(player, craftType, amount, true); break; } else if (var.getSlot() >= 100 && var.getSlot() <= 110) // String amulet { Jewellery.stringAmulet(player, craftType, amount, true); break; } switch (var.getSlot()) { case 0: MakeXbow.createXbow(player, amount, (int)(player.getTemporaryAttribute("bowType2") == null ? -1 : (int)player.getTemporaryAttribute("bowType2")), (bool)(player.getTemporaryAttribute("stringingBow") == null ? false :(bool)player.getTemporaryAttribute("stringingBow")), true); break; case 1: MakeBows.cutLog(player, amount, (int)(player.getTemporaryAttribute("fletchType") == null ? -1 : (int)player.getTemporaryAttribute("fletchType")), (int)(player.getTemporaryAttribute("bowType") == null ? -1 : (int)player.getTemporaryAttribute("bowType")), true, true); break; case 2: Herblore.grindIngredient(player, amount, true); break; case 3: Herblore.makeUnfinishedPotion(player, amount, true); break; case 4: Herblore.completePotion(player, amount, true); break; case 5: Cooking.cookItem(player, amount, true, player.getTemporaryAttribute("cookingFireLocation") != null); break; case 6: MakeAmmo.makeBoltTip(player, (int)(player.getTemporaryAttribute("boltTips") == null ? -1 : (int)player.getTemporaryAttribute("boltTips")), amount, true); break; } break; case 311: // Smelting interface switch (var.getSlot()) { case 13: // Bronze Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 17: // Blurite Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 21: // Iron Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 25: // Silver Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 29: // Steel Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 33: // Gold Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 37: // Mithril Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 41: // Adamant Smelting.smeltOre(player, var.getSlot(), true, amount); break; case 45: // Rune Smelting.smeltOre(player, var.getSlot(), true, amount); break; } break; case 300: // Smithing interface. if (player.getTemporaryAttribute("smithingItem") == null) { return; } SmithBar item = (SmithBar)player.getTemporaryAttribute("smithingItem"); if (item != null) { item.setAmount(amount); } Smithing.smithItem(player, var.getSlot(), amount, false); break; } player.removeTemporaryAttribute("interfaceVariable"); }
private void handleItemOnObject(Player player, Packet packet) { int objectX = packet.readShortA(); int item = packet.readUShort(); int objectY = packet.readLEShort(); int slot = packet.readUShort(); int interfaceId = packet.readLEShort(); int child = packet.readUShort(); int objectId = packet.readShortA(); if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY); SkillHandler.resetAllSkills(player); player.getPackets().closeInterfaces(); player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ())); if (player.getInventory().getItemInSlot(slot) == item) { if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) { return; } else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) { return; } else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) { return; } if (player.getInventory().getItemInSlot(slot) == 7936) { if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) { return; } if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) { return; } } switch (objectId) { case 6: // Cannon: DwarfCannon cannon = player.getCannon(); Location l = new Location(objectX, objectY, player.getLocation().getZ()); if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) { player.getPackets().sendMessage("This isn't your cannon!"); break; } cannon.loadCannon(); break; case 36781: // Lumbridge fountain. case 24214: // Fountain in east Varrock. case 24265: // Varrock main fountain. case 11661: // Falador waterpump. case 11759: // Falador south fountain. case 879: // Camelot fountains. case 29529: // Sink. case 874: // Sink. if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) { break; } break; case 2728: // Range in Catherby if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) { break; } break; case 2732: // Fire if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) { break; } break; case 36956: // Lumbridge furnace case 11666: // Falador furnace if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) { break; } else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) { break; } break; case 2783: // Anvil if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) { break; } break; default: player.getPackets().sendMessage("Nothing interesting happens."); break; } } }
public Player() { this.Type = PlayerTypes.Player; this.Level = 1; this.Description = this.Description ?? "You see nothing special about them."; this.AlignmentScore = 0; this.TotalExperience = 0; this.Experience = 0; this.ExperienceToNextLevel = 1000; // create class to work out this.HitPoints = 32; // class to workout this.MaxHitPoints = 32; this.ManaPoints = 50; this.MaxManaPoints = 50; this.MovePoints = 60; this.MaxMovePoints = 60; this.Explored = 1; this.HitRoll = 1; this.DamRoll = 1; this.Wimpy = 10; this.Hours = 0; this.Weight = 0; this.MaxWeight = 70; // class to workout this.Status = PlayerStatus.Standing; // enum property? 1 standing this.Target = null; this.Inventory = this.Inventory ?? (this.Inventory = new ItemContainer()); this.Skills = new List <Skill>() { //Forage.ForageAb(), //Chopping.ChoppingAb(), //Carving.CarvingAb(), //Crafting.CraftingAb(), //Brewing.BrewingAb(), //Cook.CookAb(), //Knitting.KnittingAb(), //Carving.CarvingAb(), Swim.SwimAb() }; //kills this.MobKills = 0; this.MobDeaths = 0; this.Pkills = 0; this.PkDeaths = 0; this.PkPoints = 0; //Money this.Gold = 0; this.Silver = 5; this.Copper = 100; //Location this.Region = "Tutorial"; this.Area = "Tutorial"; this.AreaId = 0; //Eq this.Equipment = this.Equipment ?? (this.Equipment = new Equipment()); this.Equipment.Floating = this.Equipment.Floating; this.Equipment.Head = Equipment.Head; this.Equipment.Face = Equipment.Face; this.Equipment.Neck = Equipment.Neck; this.Equipment.Neck2 = Equipment.Neck2; this.Equipment.Body = Equipment.Body; this.Equipment.Waist = Equipment.Waist; this.Equipment.Legs = Equipment.Legs; this.Equipment.Feet = Equipment.Feet; this.Practices = 10; this.Trains = 10; this.KnownByName = true; this.QuestLog = new List <Quest>(); this.Quest = new List <Quest>(); this.EventWake = ""; this.EventOnEnter = ""; this.EventOnComunicate = new Dictionary <string, string>(); var recall = new Recall { Area = "Anker", AreaId = 0, Region = "Anker" }; this.Recall = recall; this.CraftingRecipes.Add(MIMWebClient.Core.World.Crafting.Crafting.CampFire().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Crafting.Crafting.PineLog().Name); this.CraftingRecipes.Add(Recipes.SmokedChub().Name); this.CraftingRecipes.Add(Recipes.BoiledCarp().Name); this.CraftingRecipes.Add(Recipes.PeasantStew().Name); this.CraftingRecipes.Add(Recipes.SeasonedBream().Name); this.CraftingRecipes.Add(Recipes.BoiledCarp().Name); this.CraftingRecipes.Add(Recipes.FishStew().Name); this.CraftingRecipes.Add(Recipes.Bread().Name); this.CraftingRecipes.Add(Recipes.FriedTrout().Name); this.CraftingRecipes.Add(Recipes.TurtleSoup().Name); this.CraftingRecipes.Add(Recipes.FriedEel().Name); this.CraftingRecipes.Add(Recipes.FrogLegs().Name); this.CraftingRecipes.Add(Alchemy.BurnCream().Name); this.CraftingRecipes.Add(Alchemy.Antivenom().Name); this.CraftingRecipes.Add(Alchemy.LavenderPerfume().Name); this.CraftingRecipes.Add(Alchemy.Antibiotic().Name); this.CraftingRecipes.Add(Alchemy.Antiseptic().Name); this.CraftingRecipes.Add(Smithing.Lantern().Name); this.CraftingRecipes.Add(Smithing.CopperSword().Name); this.CraftingRecipes.Add(Smithing.CopperMace().Name); this.CraftingRecipes.Add(Smithing.CopperAxe().Name); this.CraftingRecipes.Add(Smithing.CopperDagger().Name); this.CraftingRecipes.Add(Smithing.CopperFlail().Name); this.CraftingRecipes.Add(Carve.WoodenRaft().Name); this.CraftingRecipes.Add(Carve.WoodenTorch().Name); this.CraftingRecipes.Add(Carve.WoodenChest().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothBoots().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothGloves().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothHelmet().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothLeggings().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothShirt().Name); this.CraftingRecipes.Add(MIMWebClient.Core.World.Knitting.Knitting.WoolenClothSleeves().Name); }