public override string GenerateJson(bool topLevel) { var b = new StringBuilder(base.GenerateJson(false)); if (BurnTime.HasValue) { b.AppendFormat("BurnTime:{0},", BurnTime.Value); } if (CookTime.HasValue) { b.AppendFormat("CookTime:{0},", CookTime.Value); } var items = new List <string> { Smelting.GenerateJson(false), Fuel.GenerateJson(false), Output.GenerateJson(false) }; if (items.All(string.IsNullOrWhiteSpace)) { return(b.ToString()); } b.Append("Items:["); for (var i = 0; i < items.Count; i++) { if (string.IsNullOrWhiteSpace(items[i])) { continue; } if (items[i].EndsWith(",")) { items[i] = items[i].Remove(items[i].Length - 1, 1); } b.AppendFormat("{0}:{{{1}}},", i, items[i]); } b.Remove(b.Length - 1, 1); b.Append("],"); return(b.ToString()); }
private bool canWalk(Player player, Packet packet, bool following) { if (player.getTemporaryAttribute("smeltingBar") != null) { Smelting.setAmountToZero(player); return(false); } else if (player.getTemporaryAttribute("teleporting") != null && player.getTemporaryAttribute("homeTeleporting") == null) { return(false); } else if (player.isFrozen()) { player.getPackets().sendMessage("A magic force prevents you from moving!"); return(false); } else if (player.getDuel() != null) { if (player.getDuel().ruleEnabled(DuelSession.RULE.NO_MOVEMENT)) { if (player.getDuel().getStatus() == 5 || player.getDuel().getStatus() == 6) { if (player.getTarget() == null) { player.getPackets().sendMessage("Movement is disabled for this duel."); } return(false); } } } else if (player.getTemporaryAttribute("unmovable") != null || player.getTemporaryAttribute("cantDoAnything") != null) { return(false); } else if (player.isDead()) { return(false); } else if (player.getTeleportTo() != null) { return(false); } return(true); }
private static void meGetOrdenesFabricacion(DBStorage db, OrdenFabricacion ordenFabricacion, string uuid, TcpClient server) { string articuloMinecraftID; if (ordenFabricacion.idCrafteo != null) { Crafteo crafteo = db.getCrafteo((int)ordenFabricacion.idCrafteo); if (crafteo == null) { return; } Articulo articulo = db.getArticulo(crafteo.idArticuloResultado); if (articulo == null) { return; } articuloMinecraftID = articulo.minecraftID; } else if (ordenFabricacion.idSmelting != null) { Smelting smelting = db.getSmelting((int)ordenFabricacion.idSmelting); if (smelting == null) { return; } Articulo articulo = db.getArticulo(smelting.idArticuloResultado); if (articulo == null) { return; } articuloMinecraftID = articulo.minecraftID; } else { return; } enviarMensaje(server, "MSG$$" + uuid + "&&" + ordenFabricacion.id + ";" + articuloMinecraftID + ";" + ordenFabricacion.cantidad); }
public override void Run() { if (!IgnoreSmeltingZone) { Logging.Write("Smelting in progress"); Npc smeltingZone = NpcDB.GetNpcNearby(Npc.NpcType.SmeltingForge); if (smeltingZone.Entry <= 0) { return; } if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 10) { List <Point> pointssmelting = new List <Point>(); if ((smeltingZone.Position.Type.ToLower() == "flying") && nManagerSetting.CurrentSetting.FlyingMountName != "") { pointssmelting.Add(smeltingZone.Position); } else { pointssmelting = PathFinder.FindPath(smeltingZone.Position); } MovementManager.Go(pointssmelting); Timer timer = new Timer((int)(Math.DistanceListPoint(pointssmelting) / 3 * 1000) + 5000); Thread.Sleep(700); while (MovementManager.InMovement && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InInevitableCombat && !ObjectManager.ObjectManager.Me.IsDeadMe) { if (timer.IsReady) { MovementManager.StopMove(); } if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 3.7f) { MovementManager.StopMove(); } Thread.Sleep(100); } } MovementManager.StopMove(); Tasks.MountTask.DismountMount(); Thread.Sleep(500); if (smeltingZone.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 15) { return; } } // Smelting Smelting.OpenSmeltingWindow(); Timer timer2 = new Timer(15 * 60 * 1000); while (Smelting.NeedRun(false) && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InCombat && !ObjectManager.ObjectManager.Me.IsDeadMe && !timer2.IsReady) { Smelting.Pulse(); Thread.Sleep(1500); while (ObjectManager.ObjectManager.Me.IsCast && Products.Products.IsStarted && Usefuls.InGame && !ObjectManager.ObjectManager.Me.InCombat && !ObjectManager.ObjectManager.Me.IsDeadMe && !timer2.IsReady) { Thread.Sleep(700); if (!ObjectManager.ObjectManager.Me.IsCast) { Thread.Sleep(700); } } Thread.Sleep(Usefuls.Latency); } Smelting.CloseSmeltingWindow(); }
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 handleSecondClickObject(Player player, Packet packet) { int objectY = packet.readLEShortA(); int objectX = packet.readLEShort(); ushort objectId = packet.readUShort(); Console.WriteLine("Second object click = " + objectId + " " + objectX + " " + objectY); if (player.getTemporaryAttribute("unmovable") != null) { return; } if (objectX < 1000 || objectY < 1000 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) { return; } SkillHandler.resetAllSkills(player); player.getPackets().closeInterfaces(); player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ())); if (Thieving.wantToThieveStall(player, objectId, objectX, objectY)) { return; } else if (Farming.interactWithPatch(player, objectId, objectX, objectY, -1)) { return; } else if (LaddersAndStairs.useObject(player, objectId, new Location(objectX, objectY, player.getLocation().getZ()), 2)) { return; } switch (objectId) { case 28089: // GE desk Server.getGrandExchange().clickDesk(player, objectX, objectY, 2); break; case 25824: // Spinning wheel (Seers) case 36970: // Spinning wheel (Lumbridge Spinning.displaySpinningInterface(player); break; case 6: // Dwarf multicannon DwarfCannon cannon = player.getCannon(); Location l = new Location(objectX, objectY, player.getLocation().getZ()); if (cannon == null || (cannon != null & !l.Equals(cannon.getLocation()))) { player.getPackets().sendMessage("This isn't your cannon!"); break; } cannon.pickupCannon(); break; case 11666: // Falador furnace case 36956: // Lumbridge furnace Smelting.displaySmeltOptions(player); break; case 11959: // Tin rocks case 11958: case 11957: case 11933: case 11934: case 11935: case 31077: case 31078: case 31079: Mining.prospectRock(player, objectX, objectY, "tin"); break; case 11960: // Copper rocks case 11961: case 11962: case 11936: case 11937: case 11938: case 31080: case 31081: case 31082: Mining.prospectRock(player, objectX, objectY, "copper"); break; case 15504: // Clay rocks case 15503: case 15505: case 11189: case 11190: case 11191: case 31062: case 31063: case 31064: case 32429: case 32430: case 32431: Mining.prospectRock(player, objectX, objectY, "clay"); break; case 11948: // Silver rocks case 11949: case 11950: case 11165: case 11186: case 11187: case 11188: case 31074: case 31075: case 31076: case 32444: case 32445: case 32446: case 15579: case 15580: case 15581: Mining.prospectRock(player, objectX, objectY, "silver"); break; case 11930: // Coal rocks case 11931: case 11932: case 14850: case 14851: case 14852: case 31068: case 31069: case 31070: case 32426: case 32427: case 32428: Mining.prospectRock(player, objectX, objectY, "coal"); break; case 11945: // Mithril rocks case 11946: case 11947: case 11942: case 11943: case 11944: case 14853: case 14854: case 14855: case 31086: case 31087: case 31088: case 32438: case 32439: case 32440: Mining.prospectRock(player, objectX, objectY, "mithril"); break; case 11954: // Iron rocks case 11955: case 11956: case 14856: case 14857: case 14858: case 31071: case 31072: case 31073: case 32441: case 32442: case 32443: Mining.prospectRock(player, objectX, objectY, "iron"); break; case 14859: // Rune rocks case 14860: case 14861: Mining.prospectRock(player, objectX, objectY, "runite"); break; case 11951: // Gold rocks case 11952: case 11953: case 11183: case 11184: case 11185: case 31065: case 31066: case 31067: case 32432: case 32433: case 32434: case 15576: case 15577: case 15578: Mining.prospectRock(player, objectX, objectY, "gold"); break; case 11963: // Adamant rocks case 11964: case 11965: case 11939: case 11940: case 11941: case 14862: case 14863: case 14864: case 31083: case 31084: case 31085: case 32435: case 32436: case 32437: Mining.prospectRock(player, objectX, objectY, "adamantite"); break; case 11552: // Empty rocks case 11553: case 11554: case 11555: case 11556: case 31059: case 31060: case 31061: case 14832: case 14833: case 14834: case 33400: case 33401: case 33402: case 15582: case 15583: case 15584: Mining.displayEmptyRockMessage(player, new Location(objectX, objectY, player.getLocation().getZ())); break; case 2491: // Rune essence Mining.prospectRock(player, objectX, objectY, "Rune essence"); break; case 27663: // Duel arena bank chest. case 2213: // Catherby bank booth. case 11402: // Varrock bank booth. case 11758: // Falador bank booth. case 36786: // Lumbridge bank booth. case 35647: // Al-Kharid bank booth. case 25808: // Seers bank booth. case 34752: // Ardougne bank booth. case 26972: // Edgeville bank booth. case 29085: // Ooglog bank booth. player.getBank().openBank(false, objectX, objectY); break; } }
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; } } }
private static void robotGetOrdenesFabricacion(string uuid, DBStorage db, TcpClient server, Fabricacion fabricacion, OrdenFabricacion ordenFabricacion) { StringBuilder str = new StringBuilder(); // id;cantidad;c=craft/s=smelt, str.Append("MSG$$").Append(uuid).Append("&&").Append(ordenFabricacion.id).Append(";").Append(ordenFabricacion.cantidad).Append(";"); if (ordenFabricacion.idCrafteo != null) { str.Append("C"); Crafteo crafteo = db.getCrafteo((int)ordenFabricacion.idCrafteo); // minecraft_id:cant;minecraft_id:cant;minecraft_id:cant;minecraft_id:cant;minecraft_id:cant;minecraft_id:cant... (x9) if (crafteo.idArticuloSlot1 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot1).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot1); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot2 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot2).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot2); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot3 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot3).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot3); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot4 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot4).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot4); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot5 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot5).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot5); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot6 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot6).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot6); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot7 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot7).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot7); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot8 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot8).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot8); } else { str.Append(";;").Append(0); } if (crafteo.idArticuloSlot9 != null) { str.Append(";").Append(db.getArticulo((short)crafteo.idArticuloSlot9).minecraftID).Append(";").Append(crafteo.cantidadArticuloSlot9); } else { str.Append(";;").Append(0); } } else if (ordenFabricacion.idSmelting != null) { str.Append("S;"); Smelting smelting = db.getSmelting((int)ordenFabricacion.idSmelting); // minecraft_id;cant str.Append(db.getArticulo(smelting.idArticuloEntrada).minecraftID).Append(";").Append(fabricacion.hornoSide); } else { return; } str.Append(";" + fabricacion.cofreSide); db.setOrdenFabricacionReady(ordenFabricacion.id, ordenFabricacion.idAlmacen, ordenFabricacion.idFabricacion); Console.WriteLine(str.ToString()); enviarMensaje(server, str.ToString()); }