From 8666fce9b02a1a3d0a3fb7801922c84cbae4de23 Mon Sep 17 00:00:00 2001 From: verinia Date: Sat, 15 Jun 2019 13:14:43 -0800 Subject: [PATCH] Lotta bots --- .../src/org/runite/GameLaunch.java | 2 +- .../data/eco/grand_exchange_db.emp | Bin 138082 -> 138082 bytes .../global/tutorial/CharacterDesign.java | 2 +- .../node/entity/player/ai/AIPBuilder.java | 1595 +++++++++++++++++ .../game/node/entity/player/ai/AIPlayer.java | 231 ++- .../entity/player/ai/ArtificialSession.java | 4 +- .../entity/player/ai/general/ScriptAPI.java | 18 +- .../scriptrepository/LobsterCatcher.java | 66 + .../general/scriptrepository/ManThiever.java | 6 +- .../ai/general/scriptrepository/Script.java | 16 + .../player/ai/pvmbots/DragonKiller.java | 69 + .../player/ai/pvmbots/GiantMoleBot.java | 68 + .../entity/player/ai/pvmbots/LowestBot.java | 40 + .../entity/player/ai/pvmbots/NoobBot.java | 54 + .../player/ai/pvmbots/PestControlTestBot.java | 78 + .../entity/player/ai/pvmbots/PvMBots.java | 125 ++ .../player/ai/pvmbots/PvMBotsBuilder.java | 623 +++++++ .../entity/player/ai/pvp/PVPAIPActions.java | 75 +- .../player/ai/pvp/PVPAIPBuilderUtils.java | 145 +- .../ai/resource/ResourceAIPActions.java | 36 +- .../player/ai/skillingbot/SkillingBot.java | 141 ++ .../ai/skillingbot/SkillingBotsBuilder.java | 209 +++ .../player/ai/wilderness/PvPBotsBuilder.java | 551 ++++++ .../player/ai/wilderness/WildernessBot.java | 285 +++ .../net/packet/in/InteractionPacket.java | 2 +- .../crandor/tools/LastNameFirstNameP9A.java | 47 + .../src/org/crandor/tools/Lesson.java | 46 + .../src/org/crandor/tools/Test.java | 31 +- .../crandor/tools/firewatch/Firewatch.java | 29 + .../src/plugin/command/AIPCommandPlugin.java | 424 +++-- 30 files changed, 4746 insertions(+), 272 deletions(-) create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/LobsterCatcher.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/DragonKiller.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/GiantMoleBot.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/LowestBot.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/NoobBot.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PestControlTestBot.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBots.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBotsBuilder.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/PvPBotsBuilder.java create mode 100644 09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/WildernessBot.java create mode 100644 09HDscape-server/src/org/crandor/tools/LastNameFirstNameP9A.java create mode 100644 09HDscape-server/src/org/crandor/tools/Lesson.java create mode 100644 09HDscape-server/src/org/crandor/tools/firewatch/Firewatch.java diff --git a/09HDscape-client/src/org/runite/GameLaunch.java b/09HDscape-client/src/org/runite/GameLaunch.java index dd2bd720a..b93c0f0af 100644 --- a/09HDscape-client/src/org/runite/GameLaunch.java +++ b/09HDscape-client/src/org/runite/GameLaunch.java @@ -12,7 +12,7 @@ public class GameLaunch { /** * The game settings. */ - public static GameSetting SETTINGS = new GameSetting("RuneScape", Configurations.LOCAL_SERVER ? "127.0.0.1" : "frostblades.org", 1, "live", false, false); + public static GameSetting SETTINGS = new GameSetting("Fat Cunt", Configurations.LOCAL_SERVER ? "127.0.0.1" : "frostblades.org", 1, "live", false, false); /** * The main method. diff --git a/09HDscape-server/data/eco/grand_exchange_db.emp b/09HDscape-server/data/eco/grand_exchange_db.emp index 2b045145b03cd5f1ed951fd1fc2b46fa0c565c71..5661ec662610c11f55724e880bae8ae5a861de59 100644 GIT binary patch delta 25 gcmaE~jpNZa4h{we#_S+ ITEMS = new ArrayList<>(Arrays.asList(new Item(286), //Orange goblin mail + + new Item(287), //Blue goblin mail + + new Item(288), //Goblin mail + + new Item(426), //Priest gown + + new Item(428), //Priest gown + + new Item(466), //Pickaxe handle + + new Item(492), //Picture + + new Item(542), //Monk's robe + + new Item(544), //Monk's robe + + new Item(546), //Shade robe + + new Item(548), //Shade robe + + new Item(552), //Ghostspeak amulet + + new Item(577), //Wizard robe + + new Item(579), //Wizard hat + + new Item(581), //Black robe + + new Item(599), //Picture + + new Item(667), //Blurite sword + + new Item(713), //Picture + + new Item(762), //Picture + + new Item(764), //Picture + + new Item(766), //Picture + + new Item(767), //Phoenix crossbow + + new Item(770), //Picture + + new Item(837), //Crossbow + + new Item(839), //Longbow + + new Item(841), //Shortbow + + new Item(843), //Oak shortbow + + new Item(845), //Oak longbow + + new Item(847), //Willow longbow + + new Item(849), //Willow shortbow + + new Item(851), //Maple longbow + + new Item(853), //Maple shortbow + + new Item(877), //Bronze bolts + + new Item(882), //Bronze arrow + + new Item(884), //Iron arrow + + new Item(886), //Steel arrow + + new Item(888), //Mithril arrow + + new Item(890), //Adamant arrow + + new Item(1005), //White apron + + new Item(1007), //Cape + + new Item(1009), //Brass necklace + + new Item(1011), //Blue skirt + + new Item(1013), //Pink skirt + + new Item(1015), //Black skirt + + new Item(1017), //Wizard hat + + new Item(1019), //Cape + + new Item(1021), //Cape + + new Item(1023), //Cape + + new Item(1027), //Cape + + new Item(1029), //Cape + + new Item(1031), //Cape + + new Item(1037), //Bunny ears + + new Item(1038), //Red partyhat + + new Item(1040), //Yellow partyhat + + new Item(1042), //Blue partyhat + + new Item(1044), //Green partyhat + + new Item(1046), //Purple partyhat + + new Item(1048), //White partyhat + + new Item(1050), //Santa hat + + new Item(1053), //Green h'ween mask + + new Item(1055), //Blue h'ween mask + + new Item(1057), //Red h'ween mask + + new Item(1059), //Leather gloves + + new Item(1061), //Leather boots + + new Item(1063), //Leather vambraces + + new Item(1065), //Green d'hide vamb + + new Item(1067), //Iron platelegs + + new Item(1069), //Steel platelegs + + new Item(1071), //Mithril platelegs + + new Item(1073), //Adamant platelegs + + new Item(1075), //Bronze platelegs + + new Item(1077), //Black platelegs + + new Item(1079), //Rune platelegs + + new Item(1081), //Iron plateskirt + + new Item(1083), //Steel plateskirt + + new Item(1085), //Mithril plateskirt + + new Item(1087), //Bronze plateskirt + + new Item(1089), //Black plateskirt + + new Item(1091), //Adamant plateskirt + + new Item(1093), //Rune plateskirt + + new Item(1095), //Leather chaps + + new Item(1097), //Studded chaps + + new Item(1099), //Green d'hide chaps + + new Item(1101), //Iron chainbody + + new Item(1103), //Bronze chainbody + + new Item(1105), //Steel chainbody + + new Item(1107), //Black chainbody + + new Item(1109), //Mithril chainbody + + new Item(1111), //Adamant chainbody + + new Item(1113), //Rune chainbody + + new Item(1115), //Iron platebody + + new Item(1117), //Bronze platebody + + new Item(1119), //Steel platebody + + new Item(1121), //Mithril platebody + + new Item(1123), //Adamant platebody + + new Item(1125), //Black platebody + + new Item(1127), //Rune platebody + + new Item(1129), //Leather body + + new Item(1131), //Hardleather body + + new Item(1133), //Studded body + + new Item(1135), //Green d'hide body + + new Item(1137), //Iron med helm + + new Item(1139), //Bronze med helm + + new Item(1141), //Steel med helm + + new Item(1143), //Mithril med helm + + new Item(1145), //Adamant med helm + + new Item(1147), //Rune med helm + + new Item(1151), //Black med helm + + new Item(1153), //Iron full helm + + new Item(1155), //Bronze full helm + + new Item(1157), //Steel full helm + + new Item(1159), //Mithril full helm + + new Item(1161), //Adamant full helm + + new Item(1163), //Rune full helm + + new Item(1165), //Black full helm + + new Item(1167), //Leather cowl + + new Item(1169), //Coif + + new Item(1171), //Wooden shield + + new Item(1173), //Bronze sq shield + + new Item(1175), //Iron sq shield + + new Item(1177), //Steel sq shield + + new Item(1179), //Black sq shield + + new Item(1181), //Mithril sq shield + + new Item(1183), //Adamant sq shield + + new Item(1185), //Rune sq shield + + new Item(1189), //Bronze kiteshield + + new Item(1191), //Iron kiteshield + + new Item(1193), //Steel kiteshield + + new Item(1195), //Black kiteshield + + new Item(1197), //Mithril kiteshield + + new Item(1199), //Adamant kiteshield + + new Item(1201), //Rune kiteshield + + new Item(1203), //Iron dagger + + new Item(1205), //Bronze dagger + + new Item(1207), //Steel dagger + + new Item(1209), //Mithril dagger + + new Item(1211), //Adamant dagger + + new Item(1213), //Rune dagger + + new Item(1217), //Black dagger + + new Item(1265), //Bronze pickaxe + + new Item(1267), //Iron pickaxe + + new Item(1269), //Steel pickaxe + + new Item(1271), //Adamant pickaxe + + new Item(1273), //Mithril pickaxe + + new Item(1275), //Rune pickaxe + + new Item(1277), //Bronze sword + + new Item(1279), //Iron sword + + new Item(1281), //Steel sword + + new Item(1283), //Black sword + + new Item(1285), //Mithril sword + + new Item(1287), //Adamant sword + + new Item(1289), //Rune sword + + new Item(1291), //Bronze longsword + + new Item(1293), //Iron longsword + + new Item(1295), //Steel longsword + + new Item(1297), //Black longsword + + new Item(1299), //Mithril longsword + + new Item(1301), //Adamant longsword + + new Item(1303), //Rune longsword + + new Item(1307), //Bronze 2h sword + + new Item(1309), //Iron 2h sword + + new Item(1311), //Steel 2h sword + + new Item(1313), //Black 2h sword + + new Item(1315), //Mithril 2h sword + + new Item(1317), //Adamant 2h sword + + new Item(1319), //Rune 2h sword + + new Item(1321), //Bronze scimitar + + new Item(1323), //Iron scimitar + + new Item(1325), //Steel scimitar + + new Item(1327), //Black scimitar + + new Item(1329), //Mithril scimitar + + new Item(1331), //Adamant scimitar + + new Item(1333), //Rune scimitar + + new Item(1335), //Iron warhammer + + new Item(1337), //Bronze warhammer + + new Item(1339), //Steel warhammer + + new Item(1341), //Black warhammer + + new Item(1343), //Mithril warhammer + + new Item(1345), //Adamant warhammer + + new Item(1347), //Rune warhammer + + new Item(1349), //Iron axe + + new Item(1351), //Bronze axe + + new Item(1353), //Steel axe + + new Item(1355), //Mithril axe + + new Item(1357), //Adamant axe + + new Item(1359), //Rune axe + + new Item(1361), //Black axe + + new Item(1363), //Iron battleaxe + + new Item(1365), //Steel battleaxe + + new Item(1367), //Black battleaxe + + new Item(1369), //Mithril battleaxe + + new Item(1371), //Adamant battleaxe + + new Item(1373), //Rune battleaxe + + new Item(1375), //Bronze battleaxe + + new Item(1379), //Staff + + new Item(1381), //Staff of air + + new Item(1383), //Staff of water + + new Item(1385), //Staff of earth + + new Item(1387), //Staff of fire + + new Item(1389), //Magic staff + + new Item(1419), //Scythe + + new Item(1420), //Iron mace + + new Item(1422), //Bronze mace + + new Item(1424), //Steel mace + + new Item(1426), //Black mace + + new Item(1428), //Mithril mace + + new Item(1430), //Adamant mace + + new Item(1432), //Rune mace + + new Item(1478), //Amulet of accuracy + + new Item(1540), //Anti-dragon shield + + new Item(1589), //Picture + + new Item(1635), //Gold ring + + new Item(1637), //Sapphire ring + + new Item(1639), //Emerald ring + + new Item(1641), //Ruby ring + + new Item(1643), //Diamond ring + + new Item(1654), //Gold necklace + + new Item(1656), //Sapphire necklace + + new Item(1658), //Emerald necklace + + new Item(1660), //Ruby necklace + + new Item(1662), //Diamond necklace + + new Item(1692), //Gold amulet + + new Item(1694), //Sapphire amulet + + new Item(1696), //Emerald amulet + + new Item(1698), //Ruby amulet + + new Item(1700), //Diamond amulet + + new Item(1716), //Unblessed symbol + + new Item(1718), //Holy symbol + + new Item(1725), //Amulet of strength + + new Item(1727), //Amulet of magic + + new Item(1729), //Amulet of defence + + new Item(1731), //Amulet of power + + new Item(1757), //Brown apron + + new Item(1949), //Chef's hat + + new Item(2402), //Silverlight + + new Item(2420), //Picture + + new Item(2422), //Blue partyhat + + new Item(2425), //Picture + + new Item(2480), //Picture + + new Item(2512), //Picture + + new Item(2513), //Dragon chainbody + + new Item(2583), //Black platebody (t) + + new Item(2585), //Black platelegs (t) + + new Item(2587), //Black full helm(t) + + new Item(2589), //Black kiteshield (t) + + new Item(2591), //Black platebody (g) + + new Item(2593), //Black platelegs (g) + + new Item(2595), //Black full helm(g) + + new Item(2597), //Black kiteshield (g) + + new Item(2599), //Adam platebody (t) + + new Item(2601), //Adam platelegs (t) + + new Item(2603), //Adam kiteshield (t) + + new Item(2605), //Adam full helm(t) + + new Item(2607), //Adam platebody (g) + + new Item(2609), //Adam platelegs (g) + + new Item(2611), //Adam kiteshield (g) + + new Item(2613), //Adam full helm(g) + + new Item(2615), //Rune platebody (g) + + new Item(2617), //Rune platelegs (g) + + new Item(2619), //Rune full helm(g) + + new Item(2621), //Rune kiteshield (g) + + new Item(2623), //Rune platebody (t) + + new Item(2625), //Rune platelegs (t) + + new Item(2627), //Rune full helm (t) + + new Item(2629), //Rune kiteshield (t) + + new Item(2653), //Zamorak platebody + + new Item(2655), //Zamorak platelegs + + new Item(2657), //Zamorak full helm + + new Item(2659), //Zamorak kiteshield + + new Item(2661), //Saradomin platebody + + new Item(2663), //Saradomin platelegs + + new Item(2665), //Saradomin full helm + + new Item(2667), //Saradomin kiteshield + + new Item(2669), //Guthix platebody + + new Item(2671), //Guthix platelegs + + new Item(2673), //Guthix full helm + + new Item(2675), //Guthix kiteshield + + new Item(2902), //Gloves + + new Item(2912), //Gloves + + new Item(2922), //Gloves + + new Item(2932), //Gloves + + new Item(2942), //Gloves + + new Item(3057), //Mime mask + + new Item(3058), //Mime top + + new Item(3059), //Mime legs + + new Item(3060), //Mime gloves + + new Item(3061), //Mime boots + + new Item(3472), //Black plateskirt (t) + + new Item(3473), //Black plateskirt (g) + + new Item(3474), //Adam plateskirt (t) + + new Item(3475), //Adam plateskirt (g) + + new Item(3476), //Rune plateskirt (g) + + new Item(3477), //Rune plateskirt (t) + + new Item(3478), //Zamorak plateskirt + + new Item(3479), //Saradomin plateskirt + + new Item(3480), //Guthix plateskirt + + new Item(3667), //Picture + + new Item(4000), //Picture + + new Item(4076), //Picture + + new Item(4178), //Abyssal whip + + new Item(4180), //Dragon platelegs + + new Item(4315), //Team-1 cape + + new Item(4317), //Team-2 cape + + new Item(4319), //Team-3 cape + + new Item(4321), //Team-4 cape + + new Item(4323), //Team-5 cape + + new Item(4325), //Team-6 cape + + new Item(4327), //Team-7 cape + + new Item(4329), //Team-8 cape + + new Item(4331), //Team-9 cape + + new Item(4333), //Team-10 cape + + new Item(4335), //Team-11 cape + + new Item(4337), //Team-12 cape + + new Item(4339), //Team-13 cape + + new Item(4341), //Team-14 cape + + new Item(4343), //Team-15 cape + + new Item(4345), //Team-16 cape + + new Item(4347), //Team-17 cape + + new Item(4349), //Team-18 cape + + new Item(4351), //Team-19 cape + + new Item(4353), //Team-20 cape + + new Item(4355), //Team-21 cape + + new Item(4357), //Team-22 cape + + new Item(4359), //Team-23 cape + + new Item(4361), //Team-24 cape + + new Item(4363), //Team-25 cape + + new Item(4365), //Team-26 cape + + new Item(4367), //Team-27 cape + + new Item(4369), //Team-28 cape + + new Item(4371), //Team-29 cape + + new Item(4373), //Team-30 cape + + new Item(4375), //Team-31 cape + + new Item(4377), //Team-32 cape + + new Item(4379), //Team-33 cape + + new Item(4381), //Team-34 cape + + new Item(4383), //Team-35 cape + + new Item(4385), //Team-36 cape + + new Item(4387), //Team-37 cape + + new Item(4389), //Team-38 cape + + new Item(4391), //Team-39 cape + + new Item(4393), //Team-40 cape + + new Item(4395), //Team-41 cape + + new Item(4397), //Team-42 cape + + new Item(4399), //Team-43 cape + + new Item(4401), //Team-44 cape + + new Item(4403), //Team-45 cape + + new Item(4405), //Team-46 cape + + new Item(4407), //Team-47 cape + + new Item(4409), //Team-48 cape + + new Item(4411), //Team-49 cape + + new Item(4413), //Team-50 cape + + new Item(4565), //Basket of eggs + + new Item(4566), //Rubber chicken + + new Item(5525), //Tiara + + new Item(5527), //Air tiara + + new Item(5529), //Mind tiara + + new Item(5531), //Water tiara + + new Item(5533), //Body tiara + + new Item(5535), //Earth tiara + + new Item(5537), //Fire tiara + + new Item(6180), //Lederhosen top + + new Item(6181), //Lederhosen shorts + + new Item(6182), //Lederhosen hat + + new Item(6184), //Prince tunic + + new Item(6185), //Prince leggings + + new Item(6186), //Princess blouse + + new Item(6187), //Princess skirt + + new Item(6188), //Frog mask + + new Item(6201), //Picture + + new Item(6203), //Picture + + new Item(6205), //Picture + + new Item(6207), //Picture + + new Item(6208), //Man speak amulet + + new Item(6210), //Picture + + new Item(6381), //Picture + + new Item(6654), //Camo top + + new Item(6655), //Camo bottoms + + new Item(6656), //Camo helmet + + new Item(6659), //Camo helmet + + new Item(6856), //Bobble hat + + new Item(6857), //Bobble scarf + + new Item(6858), //Jester hat + + new Item(6859), //Jester scarf + + new Item(6860), //Tri-jester hat + + new Item(6861), //Tri-jester scarf + + new Item(6862), //Woolly hat + + new Item(6863), //Woolly scarf + + new Item(6864), //Marionette handle + + new Item(6967), //Dragon med helm + + new Item(7332), //Black shield(h1) + + new Item(7334), //Adamant shield(h1) + + new Item(7336), //Rune shield(h1) + + new Item(7338), //Black shield(h2) + + new Item(7340), //Adamant shield(h2) + + new Item(7342), //Rune shield(h2) + + new Item(7344), //Black shield(h3) + + new Item(7346), //Adamant shield(h3) + + new Item(7348), //Rune shield(h3) + + new Item(7350), //Black shield(h4) + + new Item(7352), //Adamant shield(h4) + + new Item(7354), //Rune shield(h4) + + new Item(7356), //Black shield(h5) + + new Item(7358), //Adamant shield(h5) + + new Item(7360), //Rune shield(h5) + + new Item(7362), //Studded body (g) + + new Item(7364), //Studded body (t) + + new Item(7366), //Studded chaps (g) + + new Item(7368), //Studded chaps (t) + + new Item(7370), //D'hide body(g) + + new Item(7372), //D'hide body (t) + + new Item(7378), //D'hide chaps (g) + + new Item(7380), //D'hide chaps (t) + + new Item(7386), //Blue skirt (g) + + new Item(7388), //Blue skirt (t) + + new Item(7390), //Wizard robe (g) + + new Item(7392), //Wizard robe (t) + + new Item(7394), //Wizard hat (g) + + new Item(7396), //Wizard hat (t) + + new Item(7414), //Paddle + + new Item(7592), //Zombie shirt + + new Item(7593), //Zombie trousers + + new Item(7594), //Zombie mask + + new Item(7595), //Zombie gloves + + new Item(7596), //Zombie boots + + new Item(7672), //Picture + + new Item(7674), //Perfect + + new Item(7803), //Yin yang amulet + + new Item(7927), //Easter ring + + new Item(9005), //Fancy boots + + new Item(9006), //Fighting boots + + new Item(9013), //Skull sceptre + + new Item(9054), //Red goblin mail + + new Item(9056), //Yellow goblin mail + + new Item(9057), //Green goblin mail + + new Item(9058), //Purple goblin mail + + new Item(9059), //Pink goblin mail + + new Item(9665), //Torch + + new Item(9702), //Stick + + new Item(9703), //Training sword + + new Item(9704), //Training shield + + new Item(9705), //Training bow + + new Item(9706), //Training arrows + + new Item(9906), //Ghost buster 500 + + new Item(9907), //Ghost buster 500 + + new Item(9908), //Ghost buster 500 + + new Item(9909), //Ghost buster 500 + + new Item(9910), //Ghost buster 500 + + new Item(9911), //Ghost buster 500 + + new Item(9920), //Jack lantern mask + + new Item(9921), //Skeleton boots + + new Item(9922), //Skeleton gloves + + new Item(9923), //Skeleton leggings + + new Item(9924), //Skeleton shirt + + new Item(9925), //Skeleton mask + + new Item(10280), //Willow comp bow + + new Item(10286), //Rune helm (h1) + + new Item(10288), //Rune helm (h2) + + new Item(10290), //Rune helm (h3) + + new Item(10292), //Rune helm (h4) + + new Item(10294), //Rune helm (h5) + + new Item(10296), //Adamant helm (h1) + + new Item(10298), //Adamant helm (h2) + + new Item(10300), //Adamant helm (h3) + + new Item(10302), //Adamant helm (h4) + + new Item(10304), //Adamant helm (h5) + + new Item(10306), //Black helm (h1) + + new Item(10308), //Black helm (h2) + + new Item(10310), //Black helm (h3) + + new Item(10312), //Black helm (h4) + + new Item(10314), //Black helm (h5) + + new Item(10364), //Strength amulet(t) + + new Item(10366), //Amulet of magic(t) + + new Item(10501), //Snowball + + new Item(10507), //Reindeer hat + + new Item(10567), //Picture + + new Item(10569), //Picture + + new Item(10571), //Picture + + new Item(10573), //Picture + + new Item(10575), //Picture + + new Item(10577), //Picture + + new Item(10579), //Picture + + new Item(10629), //Mime mask + + new Item(10630), //Princess blouse + + new Item(10631), //Zombie shirt + + new Item(10632), //Camo top + + new Item(10633), //Lederhosen top + + new Item(10634), //Shade robe + + new Item(10665), //Black shield(h1) + + new Item(10666), //Adamant shield(h1) + + new Item(10667), //Rune shield(h1) + + new Item(10668), //Black shield(h2) + + new Item(10669), //Adamant shield(h2) + + new Item(10670), //Rune shield(h2) + + new Item(10671), //Black shield(h3) + + new Item(10672), //Adamant shield(h3) + + new Item(10673), //Rune shield(h3) + + new Item(10674), //Black shield(h4) + + new Item(10675), //Adamant shield(h4) + + new Item(10676), //Rune shield(h4) + + new Item(10677), //Black shield(h5) + + new Item(10678), //Adamant shield(h5) + + new Item(10679), //Rune shield(h5) + + new Item(10680), //Studded body (g) + + new Item(10681), //Studded body (t) + + new Item(10682), //D'hide body(g) + + new Item(10683), //D'hide body (t) + + new Item(10686), //Wizard robe (g) + + new Item(10687), //Wizard robe (t) + + new Item(10690), //Black platebody (t) + + new Item(10691), //Black platebody (g) + + new Item(10697), //Adam platebody (t) + + new Item(10698), //Adam platebody (g) + + new Item(10699), //Black helm (h1) + + new Item(10700), //Black helm (h2) + + new Item(10701), //Black helm (h3) + + new Item(10702), //Black helm (h4) + + new Item(10703), //Black helm (h5) + + new Item(10704), //Rune helm (h1) + + new Item(10705), //Rune helm (h2) + + new Item(10706), //Rune helm (h3) + + new Item(10707), //Rune helm (h4) + + new Item(10708), //Rune helm (h5) + + new Item(10709), //Adamant helm (h1) + + new Item(10710), //Adamant helm (h2) + + new Item(10711), //Adamant helm (h3) + + new Item(10712), //Adamant helm (h4) + + new Item(10713), //Adamant helm (h5) + + new Item(10736), //Strength amulet(t) + + new Item(10738), //Amulet of magic(t) + + new Item(10776), //Zamorak platebody + + new Item(10778), //Saradomin plate + + new Item(10780), //Guthix platebody + + new Item(10798), //Rune platebody (g) + + new Item(10800), //Rune platebody (t) + + new Item(11019), //Chicken feet + + new Item(11020), //Chicken wings + + new Item(11021), //Chicken head + + new Item(11022), //Chicken legs + + new Item(11165), //Phoenix crossbow + + new Item(11167), //Phoenix crossbow + + new Item(11789), //Grim reaper hood + + new Item(11790), //Grim reaper hood + + new Item(11951), //Snowball + + new Item(12629), //Safety gloves + + new Item(12634), //Chocatrice cape + + new Item(12645), //Chocatrice cape + + new Item(12844), //Toy kite + + new Item(12845), //Stone of power + + new Item(12846), //Stone of power + + new Item(12847), //Stone of power + + new Item(12848), //Stone of power + + new Item(12849), //Stone of power + + new Item(12860), //Swordfish gloves + + new Item(12863), //Air runecrafting gloves + + new Item(12864), //Water runecrafting gloves + + new Item(12865), //Earth runecrafting gloves + + new Item(12887), //Druidic mage hood 100 + + new Item(12888), //Druidic mage hood 80 + + new Item(12889), //Druidic mage hood 60 + + new Item(12890), //Druidic mage hood 40 + + new Item(12891), //Druidic mage hood 20 + + new Item(12892), //Druidic mage hood 0 + + new Item(12894), //Druidic mage top 100 + + new Item(12895), //Druidic mage top 80 + + new Item(12896), //Druidic mage top 60 + + new Item(12897), //Druidic mage top 40 + + new Item(12898), //Druidic mage top 20 + + new Item(12899), //Druidic mage top 0 + + new Item(12901), //Druidic mage bottom 100 + + new Item(12902), //Druidic mage bottom 80 + + new Item(12903), //Druidic mage bottom 60 + + new Item(12904), //Druidic mage bottom 40 + + new Item(12905), //Druidic mage bottom 20 + + new Item(12906), //Druidic mage bottom 0 + + new Item(12908), //Adamant spikeshield 100 + + new Item(12909), //Adamant spikeshield 80 + + new Item(12910), //Adamant spikeshield 60 + + new Item(12911), //Adamant spikeshield 40 + + new Item(12912), //Adamant spikeshield 20 + + new Item(12913), //Adamant spikeshield 0 + + new Item(12915), //Adamant berserker shield 100 + + new Item(12916), //Adamant berserker shield 80 + + new Item(12917), //Adamant berserker shield 60 + + new Item(12918), //Adamant berserker shield 40 + + new Item(12919), //Adamant berserker shield 20 + + new Item(12920), //Adamant berserker shield 0 + + new Item(12922), //Rune spikeshield 100 + + new Item(12923), //Rune spikeshield 80 + + new Item(12924), //Rune spikeshield 60 + + new Item(12925), //Rune spikeshield 40 + + new Item(12926), //Rune spikeshield 20 + + new Item(12927), //Rune spikeshield 0 + + new Item(12929), //Rune berserker shield 100 + + new Item(12930), //Rune berserker shield 80 + + new Item(12931), //Rune berserker shield 60 + + new Item(12932), //Rune berserker shield 40 + + new Item(12933), //Rune berserker shield 20 + + new Item(12934), //Rune berserker shield 0 + + new Item(12936), //Green d'hide coif 100 + + new Item(12937), //Green d'hide coif 80 + + new Item(12938), //Green d'hide coif 60 + + new Item(12939), //Green d'hide coif 40 + + new Item(12940), //Green d'hide coif 20 + + new Item(12941), //Green d'hide coif 0 + + new Item(12964), //Combat hood 100 + + new Item(12965), //Combat hood 80 + + new Item(12966), //Combat hood 60 + + new Item(12967), //Combat hood 40 + + new Item(12968), //Combat hood 20 + + new Item(12969), //Combat hood 0 + + new Item(12971), //Combat robe top 100 + + new Item(12972), //Combat robe top 80 + + new Item(12973), //Combat robe top 60 + + new Item(12974), //Combat robe top 40 + + new Item(12975), //Combat robe top 20 + + new Item(12976), //Combat robe top 0 + + new Item(12978), //Combat robe bottom 100 + + new Item(12979), //Combat robe bottom 80 + + new Item(12980), //Combat robe bottom 60 + + new Item(12981), //Combat robe bottom 40 + + new Item(12982), //Combat robe bottom 20 + + new Item(12983), //Combat robe bottom 0 + + new Item(12985), //Bronze gauntlets + + new Item(12986), //Worn-out bronze gauntlets + + new Item(12988), //Iron gauntlets + + new Item(12989), //Worn-out iron gauntlets + + new Item(12991), //Steel gauntlets + + new Item(12992), //Worn-out steel gauntlets + + new Item(12994), //Black gauntlets + + new Item(12995), //Worn-out black gauntlets + + new Item(12997), //Mithril gauntlets + + new Item(12998), //Worn-out mithril gauntlets + + new Item(13000), //Adamant gauntlets + + new Item(13001), //Worn-out adamant gauntlets + + new Item(13003), //Rune gauntlets + + new Item(13004), //Worn-out rune gauntlets + + new Item(13469), //Rune axe + + new Item(13471), //Rune battleaxe + + new Item(13473), //Rune warhammer + + new Item(13474), //Rune longsword + + new Item(13476), //Rune scimitar + + new Item(13480), //Rune pickaxe + + new Item(13482), //Rune platebody + + new Item(13483), //Green d'hide body + + new Item(13487), //Rune platelegs + + new Item(13489), //Rune plateskirt + + new Item(13491), //Green d'hide chaps + + new Item(13496), //Rune full helm + + new Item(13497), //Green d'hide vamb + + new Item(13507), //Rune kiteshield + + new Item(13523), //Maple longbow + + new Item(13524), //Maple shortbow + + new Item(13531), //Red partyhat + + new Item(13532), //Yellow partyhat + + new Item(13533), //Blue partyhat + + new Item(13534), //Green partyhat + + new Item(13535), //Purple partyhat + + new Item(13536), //White partyhat + + new Item(13537), //Santa hat + + new Item(13538), //Green h'ween mask + + new Item(13539), //Blue h'ween mask + + new Item(13540), //Red h'ween mask + + new Item(13541), //Willow comp bow + + new Item(13560), //Explorer's ring 1 + + new Item(13561), //Explorer's ring 2 + + new Item(13562), //Explorer's ring 3 + + new Item(13613), //Runecrafter hat + + new Item(13614), //Runecrafter robe + + new Item(13615), //Runecrafter hat + + new Item(13616), //Runecrafter hat + + new Item(13617), //Runecrafter skirt + + new Item(13618), //Runecrafter gloves + + new Item(13619), //Runecrafter robe + + new Item(13620), //Runecrafter hat + + new Item(13621), //Runecrafter hat + + new Item(13622), //Runecrafter skirt + + new Item(13623), //Runecrafter gloves + + new Item(13624), //Runecrafter robe + + new Item(13625), //Runecrafter hat + + new Item(13626), //Runecrafter hat + + new Item(13627), //Runecrafter skirt + + new Item(13628), //Runecrafter gloves + + new Item(13630), //Air talisman staff + + new Item(13631), //Mind talisman staff + + new Item(13632), //Water talisman staff + + new Item(13633), //Earth talisman staff + + new Item(13634), //Fire talisman staff + + new Item(13635), //Body talisman staff + + new Item(13643), //Yellow attractor + + new Item(13644), //Yellow repeller + + new Item(13645), //Green attractor + + new Item(13646), //Green repeller + + new Item(13657), //Runecrafter hat + + new Item(13658), //Runecrafter hat + + new Item(13765), //Rune dagger + + new Item(13777), //Rune sword + + new Item(13778), //Rune 2h sword + + new Item(13780), //Rune mace + + new Item(13781), //Rune chainbody + + new Item(13783), //Rune med helm + + new Item(13787), //Rune sq shield + + new Item(13800), //Rune platebody (g) + + new Item(13801), //Rune platelegs (g) + + new Item(13802), //Rune plateskirt (g) + + new Item(13803), //Rune full helm(g) + + new Item(13804), //Rune kiteshield (g) + + new Item(13805), //Rune platebody (t) + + new Item(13806), //Rune platelegs (t) + + new Item(13807), //Rune plateskirt (t) + + new Item(13808), //Rune full helm (t) + + new Item(13809), //Rune kiteshield (t) + + new Item(13820), //Zamorak platebody + + new Item(13821), //Zamorak platelegs + + new Item(13822), //Zamorak plateskirt + + new Item(13823), //Zamorak full helm + + new Item(13824), //Zamorak kiteshield + + new Item(13825), //Saradomin platebody + + new Item(13826), //Saradomin platelegs + + new Item(13827), //Saradomin plateskirt + + new Item(13828), //Saradomin full helm + + new Item(13829), //Saradomin kiteshield + + new Item(13830), //Guthix platebody + + new Item(13831), //Guthix platelegs + + new Item(13832), //Guthix plateskirt + + new Item(13833), //Guthix full helm + + new Item(13834), //Guthix kiteshield + + new Item(13958), //Corrupt dragon chainbody + + new Item(13960), //Corrupt dragon chainbody (deg) + + new Item(13961), //Corrupt dragon med helm + + new Item(13963), //Corrupt dragon med helm (deg) + + new Item(13964), //Corrupt dragon sq shield + + new Item(13966), //Corrupt dragon sq shield (deg) + + new Item(13967), //Corrupt dragon plateskirt + + new Item(13969), //Corrupt dragon plateskirt (deg) + + new Item(13970), //Corrupt dragon platelegs + + new Item(13972), //Corrupt dragon platelegs (deg) + + new Item(13973), //Corrupt dragon battleaxe + + new Item(13975), //C. dragon battleaxe (deg) + + new Item(13976), //Corrupt dragon dagger + + new Item(13978), //C. dragon dagger (deg) + + new Item(13979), //Corrupt dragon scimitar + + new Item(13981), //C. dragon scimitar (deg) + + new Item(13982), //Corrupt dragon longsword + + new Item(13984), //C. dragon longsword (deg) + + new Item(13985), //Corrupt dragon mace + + new Item(13987), //Corrupt dragon mace (deg) + + new Item(13988), //Corrupt dragon spear + + new Item(13990), //Corrupt dragon spear (deg) + + new Item(14057), //Broomstick + + new Item(14076), //Warlock top + + new Item(14077), //Warlock legs + + new Item(14078), //Witch top + + new Item(14079), //Witch skirt + + new Item(14080), //Witch cloak + + new Item(14081), //Warlock cloak + + new Item(14086), //Witch top + + new Item(14087), //Witch skirt + + new Item(14088), //Witch cloak + + new Item(14595), //Santa costume top + + new Item(14596), //Ice amulet + + new Item(14599), //Ice amulet + + new Item(14600), //Santa costume top + + new Item(14601), //Santa costume top + + new Item(14602), //Santa costume gloves + + new Item(14603), //Santa costume legs + + new Item(14604), //Santa costume legs + + new Item(14605), //Santa costume boots + + new Item(14812), //Black partyhat + + new Item(14819), //Rainbow partyhat + + new Item(14873), //Black santa hat + + new Item(14874)//Inverted santa hat + )); } \ No newline at end of file diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java index 0ba12cbb0..d53533575 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java @@ -1,20 +1,29 @@ package org.crandor.game.node.entity.player.ai; -import org.crandor.ServerConstants; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.crandor.game.content.dialogue.DialoguePlugin; +import org.crandor.game.content.global.tutorial.CharacterDesign; import org.crandor.game.interaction.DestinationFlag; import org.crandor.game.interaction.MovementPulse; +import org.crandor.game.interaction.Option; +import org.crandor.game.interaction.OptionHandler; +import org.crandor.game.node.Node; import org.crandor.game.node.entity.Entity; +import org.crandor.game.node.entity.combat.CombatStyle; +import org.crandor.game.node.entity.npc.NPC; import org.crandor.game.node.entity.player.Player; -import org.crandor.game.node.entity.player.ai.general.ScriptAPI; -import org.crandor.game.node.entity.player.ai.general.scriptrepository.Script; import org.crandor.game.node.entity.player.info.PlayerDetails; -import org.crandor.game.system.task.Pulse; +import org.crandor.game.node.item.Item; import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.RegionManager; +import org.crandor.game.world.map.path.Pathfinder; +import org.crandor.plugin.Plugin; +import org.crandor.tools.RandomFunction; import org.crandor.tools.StringUtils; -import plugin.skill.thieving.ThievingOptionPlugin; - -import java.util.HashMap; -import java.util.Map; /** * Represents an Artificial Intelligent Player. @@ -56,6 +65,8 @@ public class AIPlayer extends Player { * The player controlling this AIP. */ private Player controler; + + /** * Constructs a new {@code AIPlayer} {@code Object}. @@ -64,23 +75,24 @@ public class AIPlayer extends Player { */ @SuppressWarnings("deprecation") public AIPlayer(String name, Location l) { - super(new PlayerDetails(/*"/aip" + (currentUID + 1) + ":" + */name)); + super(new PlayerDetails("/aip" + (currentUID + 1) + ":" + name)); super.setLocation(startLocation = l); super.artificial = true; super.getDetails().setSession(ArtificialSession.getSingleton()); - this.username = StringUtils.formatDisplayName(name); + this.username = StringUtils.formatDisplayName(name + (currentUID + 1)); this.uid = currentUID++; } @Override public void init() { - getProperties().setSpawnLocation(/*startLocation*/ ServerConstants.HOME_LOCATION); + getProperties().setSpawnLocation(startLocation); getInterfaceManager().openDefaultTabs(); getSession().setObject(this); botMapping.put(uid, this); super.init(); getSettings().setRunToggled(true); - /*getInteraction().set(new Option("Control", 7).setHandler(new OptionHandler() { + CharacterDesign.randomize(this, false); + getInteraction().set(new Option("Control", 7).setHandler(new OptionHandler() { @Override public Plugin newInstance(Object arg) throws Throwable { return null; @@ -100,7 +112,8 @@ public class AIPlayer extends Player { return false; } - }));*/ + })); + } /** @@ -116,6 +129,191 @@ public class AIPlayer extends Player { } }, "movement"); } + + public void randomWalk(int radiusX, int radiusY) + { + Pathfinder.find(this, this.getLocation().transform(RandomFunction.random(radiusX, (radiusX * -1)), RandomFunction.random(radiusY, (radiusY * -1)), 0), false, Pathfinder.SMART).walk(this); + } + + public void walkPos(int x, int y) + { + Pathfinder.find(this, new Location(x, y)); + } + + public boolean checkVictimIsPlayer() + { + if (this.getProperties().getCombatPulse().getVictim() != null) + if (this.getProperties().getCombatPulse().getVictim().isPlayer()) + return true; + return false; + } + + public Item getItemById(int id) + { + for (int i = 0; i < 28; i++) + { + Item item = this.getInventory().get(i); + if (item != null) + { + if (item.getId() == id) + return item; + } + } + return null; + } + + private ArrayList getNodeInRange(int range, int entry) + { + int meX = this.getLocation().getX(); + int meY = this.getLocation().getY(); + //int meX2 = this.getLocation().getX(); + //System.out.println("local " + meX + " real x? " + meX2 ); + ArrayList nodes = new ArrayList(); + for (int x = 0; x < range; x++) + { + for (int y = 0; y < range - x; y++) + { + Node node = RegionManager.getObject(0, meX + x, meY + y); + if (node != null) + if (node.getId() == entry) + nodes.add(node); + Node node2 = RegionManager.getObject(0, meX + x, meY - y); + if (node2 != null) + if (node2.getId() == entry) + nodes.add(node2); + Node node3 = RegionManager.getObject(0, meX - x, meY + y); + if (node3 != null) + if (node3.getId() == entry) + nodes.add(node3); + Node node4 = RegionManager.getObject(0, meX - x, meY - y); + if (node4 != null) + if (node4.getId() == entry) + nodes.add(node4); + } + } + return nodes; + } + + private ArrayList getNodeInRange(int range, ArrayList entrys) + { + int meX = this.getLocation().getX(); + int meY = this.getLocation().getY(); + //int meX2 = this.getLocation().getX(); + //System.out.println("local " + meX + " real x? " + meX2 ); + ArrayList nodes = new ArrayList(); + for (int x = 0; x < range; x++) + { + for (int y = 0; y < range - x; y++) + { + Node node = RegionManager.getObject(0, meX + x, meY + y); + if (node != null) + if (entrys.contains(node.getId())) + nodes.add(node); + Node node2 = RegionManager.getObject(0, meX + x, meY - y); + if (node2 != null) + if (entrys.contains(node2.getId())) + nodes.add(node2); + Node node3 = RegionManager.getObject(0, meX - x, meY + y); + if (node3 != null) + if (entrys.contains(node3.getId())) + nodes.add(node3); + Node node4 = RegionManager.getObject(0, meX - x, meY - y); + if (node4 != null) + if (entrys.contains(node4.getId())) + nodes.add(node4); + } + } + return nodes; + } + + public Node getClosestNodeWithEntry(int range, int entry) + { + ArrayList nodeList = getNodeInRange(range, entry); + if (nodeList.isEmpty()) + { + System.out.println("nodelist empty"); + return null; + } + Node node = getClosestNodeinNodeList(nodeList); + return node; + } + + public Node getClosestNodeWithEntry(int range, ArrayList entrys) + { + ArrayList nodeList = getNodeInRange(range, entrys); + if (nodeList.isEmpty()) + { + System.out.println("nodelist empty"); + return null; + } + Node node = getClosestNodeinNodeList(nodeList); + return node; + } + + public Node getClosesCreature(int radius) { + int distance = radius + 1; + Node npcReturn = null; + for (NPC npc : RegionManager.getLocalNpcs(this, radius)) { + double distanceToNpc = npc.getLocation().getDistance(this.getLocation()); + if ((distanceToNpc) < distance) { + distance = (int) distanceToNpc; + npcReturn = npc; + } + } + return npcReturn; + } + + public Node getClosesCreature(int radius, int entry) { + int distance = radius + 1; + Node npcReturn = null; + for (NPC npc : RegionManager.getLocalNpcs(this, radius)) { + double distanceToNpc = npc.getLocation().getDistance(this.getLocation()); + if (npc.getId() == entry) { + if ((distanceToNpc) < distance) { + distance = (int) distanceToNpc; + npcReturn = npc; + } + } + } + return npcReturn; + } + + public Node getClosesCreature(int radius, ArrayList entrys) { + int distance = radius + 1; + Node npcReturn = null; + for (NPC npc : RegionManager.getLocalNpcs(this, radius)) { + double distanceToNpc = npc.getLocation().getDistance(this.getLocation()); + if (entrys.contains(npc.getId())) { + if ((distanceToNpc) < distance) { + distance = (int) distanceToNpc; + npcReturn = npc; + } + } + } + return npcReturn; + } + + private Node getClosestNodeinNodeList(ArrayList nodes) + { + if (nodes.isEmpty()) + { + System.out.println("nodelist empty"); + return null; + } + + double distance = 0; + Node nodeReturn = null; + for (Node node : nodes) + { + double nodeDistance = this.getLocation().getDistance(node.getLocation()); + if (nodeReturn == null || nodeDistance < distance) + { + distance = nodeDistance; + nodeReturn = node; + } + } + return nodeReturn; + } @Override public void clear() { @@ -130,12 +328,6 @@ public class AIPlayer extends Player { } super.reset(); } - - @Override - public void finalizeDeath(Entity killer) { - super.finalizeDeath(killer); - this.setAttribute("dead", true); - } /** * Gets the UID. @@ -196,4 +388,5 @@ public class AIPlayer extends Player { public void setControler(Player controler) { this.controler = controler; } + } \ No newline at end of file diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/ArtificialSession.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/ArtificialSession.java index 9eeea29f5..c220dd42b 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/ArtificialSession.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/ArtificialSession.java @@ -1,9 +1,9 @@ package org.crandor.game.node.entity.player.ai; -import org.crandor.net.IoSession; - import java.nio.ByteBuffer; +import org.crandor.net.IoSession; + /** * Represents an artificial networking session. * @author Emperor diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/ScriptAPI.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/ScriptAPI.java index a0dcb17c2..4a71a1b4a 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/ScriptAPI.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/ScriptAPI.java @@ -21,12 +21,28 @@ public class ScriptAPI { } public Node getNearestNode(String entityName) + { + Node entity = null; + double minDistance = Double.MAX_VALUE; + for (Node node : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[bot.getLocation().getZ()].getEntities()) + { + if (node != null && node.getName().equals(entityName) && distance(bot, node) < minDistance && !Pathfinder.find(bot, node).isMoveNear()) + { + entity = node; + minDistance = distance(bot, node); + } + } + + return entity; + } + + public Node getNearestNode(int id) { Node entity = null; double minDistance = Double.MAX_VALUE; for (Node e : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[bot.getLocation().getZ()].getEntities()) { - if (e != null && e.getName().equals(entityName) && distance(bot, e) < minDistance && !Pathfinder.find(bot, e).isMoveNear()) + if (e != null && e.getId() == id && distance(bot, e) < minDistance && !Pathfinder.find(bot, e).isMoveNear()) { entity = e; minDistance = distance(bot, e); diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/LobsterCatcher.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/LobsterCatcher.java new file mode 100644 index 000000000..5427fc84c --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/LobsterCatcher.java @@ -0,0 +1,66 @@ +package org.crandor.game.node.entity.player.ai.general.scriptrepository; + +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.Node; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.path.Pathfinder; +import org.crandor.tools.RandomFunction; + +import java.util.Arrays; +import java.util.List; + + +public class LobsterCatcher extends Script { + + enum Sets { + + SET_1 (Arrays.asList(new Item(2643), new Item(9470), new Item(10756), new Item(10394), new Item(88), new Item(9793))), + SET_2 (Arrays.asList(new Item(2643), new Item(6585), new Item(10750), new Item(10394), new Item(88), new Item(9793))), + SET_3 (Arrays.asList(new Item(9472), new Item(9470), new Item(10750), new Item(10394), new Item(88), new Item(9786))), + SET_4 (Arrays.asList(new Item(2639), new Item(6585), new Item(10752), new Item(10394), new Item(88), new Item(9786))), + SET_5 (Arrays.asList(new Item(2639), new Item(9470), new Item(10750), new Item(10394), new Item(88), new Item(9784))), + SET_6 (Arrays.asList(new Item(2639), new Item(6585), new Item(10750), new Item(10394), new Item(88), new Item(9784))); + + private List equipment; + + Sets(List equipment) { + this.equipment = equipment; + } + + public List getEquipment() { + return equipment; + } + } + + private int tick = 0; + + public LobsterCatcher() { + int setUp = RandomFunction.random(Sets.values().length); + this.equipment.addAll(Sets.values()[setUp].getEquipment()); + this.inventory.add(new Item(301)); + this.skills.put(Skills.FISHING, 40); + } + + @Override + public void runLoop() { + tick++; + Node spot = scriptAPI.getNearestNode(333); + Node bank = scriptAPI.getNearestNode(2213); + + + Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot); + + if (spot != null) { + System.out.println(spot.getLocation().toString()); + spot.getInteraction().handle(bot, spot.getInteraction().get(0)); + } + + + if (bot.getInventory().isFull()) { + bank.getInteraction().handle(bot, bank.getInteraction().get(2)); + } + + System.out.println(tick); + } +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/ManThiever.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/ManThiever.java index 7774743e8..086866cad 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/ManThiever.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/ManThiever.java @@ -6,8 +6,7 @@ import org.crandor.game.node.item.Item; import java.util.Arrays; public class ManThiever extends Script { - public ManThiever() - { + public ManThiever() { this.equipment.addAll(Arrays.asList(new Item(1103), new Item(1139), new Item(1265))); } @@ -15,8 +14,7 @@ public class ManThiever extends Script { public void runLoop() { Node man = scriptAPI.getNearestNode("Man"); - if (man != null) - { + if (man != null) { man.getInteraction().handle(bot, man.getInteraction().get(2)); } } diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/Script.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/Script.java index ad649cd06..b5b282ed4 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/Script.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/general/scriptrepository/Script.java @@ -5,11 +5,16 @@ import org.crandor.game.node.entity.player.ai.general.ScriptAPI; import org.crandor.game.node.item.Item; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; public abstract class Script { + public ScriptAPI scriptAPI; public ArrayList inventory = new ArrayList<>(); public ArrayList equipment = new ArrayList<>(); + public Map skills = new HashMap<>(); + public AIPlayer bot; @@ -26,7 +31,18 @@ public abstract class Script { { bot.getEquipment().add(i, true, false); } + for (Map.Entry skill : skills.entrySet()) + { + setLevel(skill.getKey(), skill.getValue()); + } } public abstract void runLoop(); + + public void setLevel(int skill, int level) { + bot.getSkills().setLevel(skill, level); + bot.getSkills().setStaticLevel(skill, level); + bot.getSkills().updateCombatLevel(); + bot.getAppearance().sync(); + } } diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/DragonKiller.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/DragonKiller.java new file mode 100644 index 000000000..ee1bbffa3 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/DragonKiller.java @@ -0,0 +1,69 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.TeleportManager.TeleportType; +import org.crandor.game.node.entity.player.link.prayer.*; +import org.crandor.game.world.GameWorld; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.zone.impl.WildernessZone; +import org.crandor.tools.RandomFunction; + +public class DragonKiller extends PvMBots{ + + private int tick = 0; + + public DragonKiller(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + @Override + public void tick() + { + super.tick(); + + //Despawn + if (this.getSkills().getLifepoints() == 0 || this.getLocation().equals(new Location(0, 0))) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + + if (this.checkVictimIsPlayer()) + { + tryEscape(); + } + + //Npc Combat + if (tick == 0) + { + if (!this.inCombat()) + AttackNpcsInRadius(this, 15); + this.tick = 10; + } + else + this.tick--; + + this.eat(379); + this.getSkills().setLevel(Skills.PRAYER, 99); + this.getSkills().setStaticLevel(Skills.PRAYER, 99); + if (!(this.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE))) + this.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE); + //this.getPrayer().toggle() + } + + public void tryEscape() + { + if (this.isTeleBlocked() == false) + { + if (WildernessZone.getWilderness(this) <= 20) + { + System.out.println("not Teleblocked"); + this.teleport(new Location(0, 0)); + } + } + else + return; + //run away + } +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/GiantMoleBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/GiantMoleBot.java new file mode 100644 index 000000000..abc59ef7c --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/GiantMoleBot.java @@ -0,0 +1,68 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.prayer.PrayerType; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; + +public class GiantMoleBot extends PvMBots{ + + public GiantMoleBot(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + int tick = 0; + int movetimer = 5; + + private void checkLightSource() + { + if (!this.getInventory().containItems(33)) + { + if (this.getInventory().containItems(36)) + this.getInventory().remove(new Item(36)); + this.getInventory().add(new Item(33)); + } + } + + @Override + public void tick() + { + checkLightSource(); + super.tick(); + PrayerType type[] = {PrayerType.PROTECT_FROM_MELEE, PrayerType.PIETY}; + this.CheckPrayer(type); + + //Despawn + if (this.getSkills().getLifepoints() == 0) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + + //Npc Combat + if (this.tick == 0) + { + if (!this.inCombat()) + AttackNpcsInRadius(this, 50); + this.tick = 5; + } + + else + this.tick--; + + /*if (this.movetimer == 0) + { + if (!this.inCombat()) + { + this.randomWalk(10, 10); + } + this.movetimer = 4; + } + else + this.movetimer--;*/ + //if (this.getSkills().getLifepoints() > 1) + //this.eat(); + //this.getPrayer().toggle() + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/LowestBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/LowestBot.java new file mode 100644 index 000000000..2fddb1ab9 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/LowestBot.java @@ -0,0 +1,40 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.world.map.Location; + +public class LowestBot extends PvMBots{ + + public LowestBot(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + private int tick = 0; + + @Override + public void tick() + { + super.tick(); + + //Despawn + if (this.getSkills().getLifepoints() == 0) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + + //Npc Combat + if (tick == 0) + { + if (!this.inCombat()) + AttackNpcsInRadius(this, 5); + this.tick = 10; + } + else + this.tick--; + + this.eat(329); + //this.getPrayer().toggle() + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/NoobBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/NoobBot.java new file mode 100644 index 000000000..67188d6e5 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/NoobBot.java @@ -0,0 +1,54 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.world.map.Location; + +public class NoobBot extends PvMBots{ + + private int tick = 0; + private int movetimer = 0; + + public NoobBot(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + @Override + public void tick() + { + super.tick(); + + //Despawn + if (this.getSkills().getLifepoints() == 0) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + + //Npc Combat + if (tick == 0) + { + if (!this.inCombat()) + AttackNpcsInRadius(this, 5); + this.tick = 5; + } + else + this.tick--; + + this.eat(329); + //this.getPrayer().toggle() + //System.out.println(this.getPulseManager().getCurrent()); + + if (!this.inCombat()) + { + if (movetimer == 0) + { + if (this.FindTargets(this, 5) == null) + this.randomWalk(5, 5); + this.movetimer = 10; + } + else + movetimer --; + } + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PestControlTestBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PestControlTestBot.java new file mode 100644 index 000000000..5ccda6168 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PestControlTestBot.java @@ -0,0 +1,78 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import java.util.ArrayList; + +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.Node; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.TeleportManager.TeleportType; +import org.crandor.game.node.entity.player.link.prayer.*; +import org.crandor.game.world.GameWorld; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.zone.impl.WildernessZone; +import org.crandor.net.packet.in.InteractionPacket; +import org.crandor.tools.RandomFunction; + +public class PestControlTestBot extends PvMBots{ + + private int tick = 0; + private int movetimer = 0; + + public PestControlTestBot(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + @Override + public void tick() + { + super.tick(); + + Node test = getClosestNodeWithEntry(15, 14315); + if (test != null) { + int x = test.getLocation().getX(); + int y = test.getLocation().getY(); + if (this.getLocation() != new Location(2660, 2638)) + InteractionPacket.handleObjectInteraction(this, 0, x, y, test.getId()); + } + + ArrayList doorEntrys = new ArrayList(); + doorEntrys.add(14233); + doorEntrys.add(14235); + test = getClosestNodeWithEntry(5, doorEntrys); + if (!this.inCombat() && test != null) { + int x = test.getLocation().getX(); + int y = test.getLocation().getY(); + InteractionPacket.handleObjectInteraction(this, 0, x, y, test.getId()); + } + + //Npc Combat + if (tick == 0) + { + if (!this.inCombat()) + AttackNpcsInRadius(this, 15); + this.tick = 10; + } + else + this.tick--; + + this.eat(379); + this.getSkills().setLevel(Skills.PRAYER, 99); + this.getSkills().setStaticLevel(Skills.PRAYER, 99); + if (!(this.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE))) + this.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE); + + if (!this.inCombat()) + { + if (movetimer == 0) + { + if (this.FindTargets(this, 5) == null) + this.randomWalk(5, 5); + this.movetimer = 5; + } + else + movetimer --; + } + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBots.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBots.java new file mode 100644 index 000000000..e9c5bc4e1 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBots.java @@ -0,0 +1,125 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import java.util.ArrayList; +import java.util.List; + +import org.crandor.game.content.global.consumable.Consumable; +import org.crandor.game.content.global.consumable.ConsumableProperties; +import org.crandor.game.content.global.consumable.Consumables; +import org.crandor.game.content.global.consumable.Food; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.Entity; +import org.crandor.game.node.entity.npc.NPC; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.prayer.PrayerType; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.RegionManager; +import org.crandor.game.world.update.flag.context.Animation; +import org.crandor.tools.RandomFunction; + +public class PvMBots extends AIPlayer { + + //Used so the bot doesn't spam actions + private int tick = 0; + + public PvMBots(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + + public List FindTargets(Entity entity, int radius) { + List targets = new ArrayList<>(); + for (NPC npc : RegionManager.getLocalNpcs(entity, radius)) { + { + if (checkValidTargets(npc)) + targets.add(npc); + } + } + if (targets.size() == 0) + return null; + return targets; + } + + public boolean checkValidTargets(NPC target) { + if (!target.isActive()) { + return false; + } + if (!target.getProperties().isMultiZone() && target.inCombat()) { + return false; + } + if (!target.getDefinition().hasAction("attack")) { + return false; + } + return true; + } + + public void AttackNpcsInRadius(Player bot, int radius) { + if (bot.inCombat()) + return; + List creatures = FindTargets(bot, radius); + if (creatures == null) { + return; + } + if (!(creatures.isEmpty())) { + bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1)))); + return; + } else { + creatures = FindTargets(bot, radius); + if (!creatures.isEmpty()) + bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1)))); + return; + } + } + + @Override + public void tick() { + super.tick(); + + //Despawn + if (this.getSkills().getLifepoints() == 0) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + + //Npc Combat + if (tick == 0) { + if (!this.inCombat()) + AttackNpcsInRadius(this, 5); + this.tick = 10; + } else + this.tick--; + + //this.eat(); + //this.getPrayer().toggle() + } + + public void CheckPrayer(PrayerType type[]) { + for (int i = 0; i < type.length; i++) + this.getPrayer().toggle(type[i]); + } + + public void eat(int foodId) { + Item foodItem = new Item(foodId); + + if ((this.getSkills().getStaticLevel(Skills.HITPOINTS) >= this.getSkills().getLifepoints() * 3) && this.getInventory().containsItem(foodItem)) { + this.lock(3); + //this.animate(new Animation(829)); + Item food = this.getInventory().getItem(foodItem); + + Consumable consumable = Consumables.forFood(food); + + if (consumable == null) { + consumable = new Food(food.getId(), new ConsumableProperties(1)); + } + + consumable.consume(food, this); + this.getProperties().getCombatPulse().delayNextAttack(3); + } + if (this.checkVictimIsPlayer() == false) + if (!(this.getInventory().contains(foodId, 1))) + this.getInventory().add(new Item(foodId, 5)); //Add Food to Inventory + } +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBotsBuilder.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBotsBuilder.java new file mode 100644 index 000000000..18d011d8d --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvmbots/PvMBotsBuilder.java @@ -0,0 +1,623 @@ +package org.crandor.game.node.entity.player.ai.pvmbots; + +import java.util.ArrayList; + +import org.crandor.game.container.impl.EquipmentContainer; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.combat.CombatSpell; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.SpellBookManager; +import org.crandor.game.node.entity.player.link.appearance.Gender; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.repository.Repository; +import org.crandor.tools.RandomFunction; + +public final class PvMBotsBuilder{ + + public static PestControlTestBot createPestControlTestBot(String name, Location l) + { + return new PestControlTestBot(name, l); + } + + public static PvMBots create(String name, Location l) + { + return new PvMBots(name, l); + } + + public static LowestBot createLowest(String name, Location l) + { + return new LowestBot(name, l); + } + + public static NoobBot createNoob(String name, Location l) + { + return new NoobBot(name, l); + } + + public static DragonKiller createDragonKiller(String name, Location l) + { + return new DragonKiller(name, l); + } + + public static GiantMoleBot createGiantMoleBot(String name, Location l) + { + return new GiantMoleBot(name, l); + } + + public static void generateGiantMoleBot(PvMBots p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + p.getSkills().setLevel(Skills.STRENGTH, 99); + p.getSkills().setStaticLevel(Skills.STRENGTH, 99); + p.getSkills().setLevel(Skills.ATTACK, 99); + p.getSkills().setStaticLevel(Skills.ATTACK, 99); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 99); + p.getSkills().setLevel(Skills.HITPOINTS, 99); + p.getSkills().setStaticLevel(Skills.DEFENCE, 99); + p.getSkills().setLevel(Skills.DEFENCE, 99); + p.getSkills().setStaticLevel(Skills.PRAYER, 99); + p.getSkills().setLevel(Skills.PRAYER, 99); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + + p.getEquipment().replace(new Item(4720) ,EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(4722) ,EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(4716) ,EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(4718) ,EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(-1) ,EquipmentContainer.SLOT_SHIELD); + + p.getInventory().add(new Item(952)); + p.getInventory().add(new Item(33)); + + } + + public static void generateMinLevels(PvMBots p) + { + //Slayer so they can attack alls monsters + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(2); + p.getSkills().setLevel(Skills.HITPOINTS, 15); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 15); + p.getInventory().add(new Item(329, 5)); + switch(combatType) + { + case 0: + { + buildArcherStats(p); + buildArcherEquipment(p); + break; + } + case 1: + { + buildMeleeStats(p); + buildMeleeEquipment(p); + break; + } + case 2: + { + buildMageStats(p); + buildMagicEquipment(p); + setupWizard(p); + break; + } + default: + { + buildMeleeStats(p); + buildMeleeEquipment(p); + break; + } + + } + } + + public static void createDragonKiller(DragonKiller p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(2); + p.getSkills().setLevel(Skills.HITPOINTS, 55); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 55); + switch(combatType) + { + case 0: + { + buildDragonArcherStats(p); + buildDragonArcherEquipment(p); + break; + } + case 1: + { + buildDragonMeleeStats(p); + buildDragonMeleeEquipment(p); + break; + } + default: + { + buildDragonMeleeStats(p); + buildDragonMeleeEquipment(p); + break; + } + } + } + + public static void createPestControlBot(PestControlTestBot p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(2); + buildMaxMeleeStats(p); + buildMaxMeleeEquipment(p); + switch(combatType) + { + case 0: + { + break; + } + case 1: + { + break; + } + default: + { + break; + } + } + } + + private static void buildMaxMeleeStats(AIPlayer p) + { + p.getSkills().setLevel(Skills.ATTACK, 99); + p.getSkills().setStaticLevel(Skills.ATTACK, 99); + p.getSkills().setLevel(Skills.STRENGTH, 99); + p.getSkills().setStaticLevel(Skills.STRENGTH, 99); + p.getSkills().setLevel(Skills.DEFENCE, 99); + p.getSkills().setStaticLevel(Skills.DEFENCE, 99); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildMaxMeleeEquipment(AIPlayer p) { + int[] helms = { + 3751, //Berserker Helm + }; + int[] shield = { + 14767, //Dragon defender + }; + int[] platebody = { + 11724, //Bandos chainmail. + }; + int[] platelegs = { + 11726, //Bandos Tassets. + }; + int[] amulets = { + 6585, //fury + }; + int[] boots = { + 3105, //Climbing boots. + }; + int[] cape = { + 6570, //Fire cape. + }; + int[] gloves = { + 7462, //Barrows Gloves. + }; + + int[] weapons2 = { + 4151, //Whip + }; + + p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET); + p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET); + p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS); + } + + public static void createNoob(NoobBot p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(3); + p.getSkills().setLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10)); + p.getSkills().setLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9)); + p.getSkills().setStaticLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9)); + p.getInventory().add(new Item(329, 5)); + switch(combatType) + { + case 0: + { + buildNoobArcherStats(p); + buildNoobArcherEquipment(p); + break; + } + case 1: + { + buildNoobMeleeStats(p); + buildNoobMeleeEquipment(p); + break; + } + case 2: + { + buildNoobMageStats(p); + buildNoobMagicEquipment(p); + setupWizard(p); + } + default: + { + buildNoobMeleeStats(p); + buildNoobMeleeEquipment(p); + break; + } + } + } + + private static void buildArcherStats(PvMBots p) + { + p.getSkills().setLevel(Skills.RANGE, 10); + p.getSkills().setStaticLevel(Skills.RANGE, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildDragonArcherStats(DragonKiller p) + { + p.getSkills().setStaticLevel(Skills.RANGE, 55 + RandomFunction.getRandom(15)); + p.getSkills().setLevel(Skills.RANGE, p.getSkills().getLevel(Skills.RANGE)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobArcherStats(NoobBot p) + { + p.getSkills().setLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + public static void buildMeleeStats(PvMBots p) + { + p.getSkills().setLevel(Skills.ATTACK, 10); + p.getSkills().setStaticLevel(Skills.ATTACK, 10); + p.getSkills().setLevel(Skills.STRENGTH, 10); + p.getSkills().setStaticLevel(Skills.STRENGTH, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + public static void buildDragonMeleeStats(DragonKiller p) + { + + p.getSkills().setStaticLevel(Skills.ATTACK, 55 + RandomFunction.getRandom(15)); + p.getSkills().setLevel(Skills.ATTACK, p.getSkills().getLevel(Skills.ATTACK)); + p.getSkills().setStaticLevel(Skills.STRENGTH, 55 + RandomFunction.getRandom(15)); + p.getSkills().setLevel(Skills.STRENGTH, p.getSkills().getLevel(Skills.STRENGTH)); + p.getSkills().setLevel(Skills.DEFENCE, 45 + RandomFunction.getRandom(15)); + p.getSkills().setLevel(Skills.DEFENCE, p.getSkills().getLevel(Skills.DEFENCE)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobMeleeStats(NoobBot p) + { + p.getSkills().setLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10)); + p.getSkills().setLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildMageStats(PvMBots p) + { + p.getSkills().setLevel(Skills.MAGIC, 10); + p.getSkills().setStaticLevel(Skills.MAGIC, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobMageStats(NoobBot p) + { + p.getSkills().setLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void setupWizard(PvMBots p) + { + //final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 }; + p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(1))); + p.getInventory().add(new Item(556, 1000)); //Air runes + p.getInventory().add(new Item(558, 1000)); //Mind runes + } + + private static void buildArcherEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1129), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1095), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildDragonArcherEquipment(DragonKiller p) + { + p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(13483), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1099), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(9185), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(9140, 500), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(10498), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobArcherEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildMeleeEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(1153), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1115), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1067), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1309), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildDragonMeleeEquipment(DragonKiller p) + { + p.getEquipment().replace(new Item(1163), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1127), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1079), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1333), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobMeleeEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + int weapons[] = {1307, 1321, 1375, 1203, 1239, 1267, 1293, 1323, 1335}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildMagicEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(579), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(577), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1011), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1389), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobMagicEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + int weapons[] = {1379, 1383, 1385, 1387, 1389}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET); + } + + public static void spawn(Location loc) + { + final PvMBots bot = PvMBotsBuilder.create("bottest", loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + } + + public static void spawnPestControlTestBot(Location loc) + { + final PestControlTestBot bot = PvMBotsBuilder.createPestControlTestBot("PestBot", loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + + createPestControlBot(bot); + } + + public static void spawnLowest(Location loc) + { + final LowestBot bot = PvMBotsBuilder.createLowest("bottest", loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + + generateMinLevels(bot); + } + + public static void spawnNoob(Location loc) + { + final NoobBot bot = PvMBotsBuilder.createNoob("bottest", loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + + createNoob(bot); + } + + public static void spawnDragonKiller(Location loc) + { + final DragonKiller bot = PvMBotsBuilder.createDragonKiller("bottest", loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + + createDragonKiller(bot); + } + + public static void spawnGiantMoleBot(Location loc) + { + final GiantMoleBot bot = PvMBotsBuilder.createGiantMoleBot("bottest", new Location(0, 0)); + bot.teleport(loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + + generateGiantMoleBot(bot); + } + + public static void immersiveSpawns() + { + //Lumbridge + //GOBLINS + spawnLowest(new Location(3259, 3224)); + spawnLowest(new Location(3251, 3235)); + spawnLowest(new Location(3244, 3247)); + spawnNoob(new Location(3244, 3247)); + //COWS + spawnLowest(new Location(3259, 3245)); + spawnLowest(new Location(3258, 3261)); + spawnLowest(new Location(3263, 3263)); + spawnLowest(new Location(3263, 3271)); + spawnLowest(new Location(3254, 3288)); + //CHICKENS + spawnLowest(new Location(3234, 3294)); + spawnLowest(new Location(3229, 3297)); + //GOBLINS2 + spawnLowest(new Location(3182, 3255)); + spawnLowest(new Location(3169, 3254)); + spawnLowest(new Location(3167, 3233)); + spawnLowest(new Location(3152, 3228)); + //Lumby castle + spawnLowest(new Location(3221, 3219)); + spawnNoob(new Location(3193, 3208)); + //Lumby swamp + spawnNoob(new Location(3224, 3186)); + spawnNoob(new Location(3217, 3177)); + spawnNoob(new Location(3209, 3191)); + + //Edge + spawnLowest(new Location(3096, 3509)); + + //Edge dungeon + //Hill giants + spawnLowest(new Location(3118, 9848)); + spawnLowest(new Location(3110, 9842)); + spawnLowest(new Location(3115, 9836)); + spawnLowest(new Location(3107, 9832)); + spawnLowest(new Location(3099, 9834)); + //brass key room + spawnLowest(new Location(3127, 9863)); + + //Dark wizzards + spawnLowest(new Location(3226, 3367)); + spawnLowest(new Location(3226, 3368)); + spawnLowest(new Location(3230, 3373)); + spawnLowest(new Location(3209, 3378)); + + //Varrock palace + spawnLowest(new Location(3218, 3465)); + spawnLowest(new Location(3209, 3462)); + + //Varrock Sewers + spawnLowest(new Location(3235, 9868)); + spawnLowest(new Location(3242, 9915)); + spawnLowest(new Location(3176, 9883)); + + //Dragons Wilderness + //WEST + spawnDragonKiller(new Location(2977, 3614)); + spawnDragonKiller(new Location(2987, 3619)); + + //Burthrope Dungeon + //Blue dragons + spawnDragonKiller(new Location(2901, 9799)); + spawnDragonKiller(new Location(2910, 9804)); + //Al kharid + //palace + spawnLowest(new Location(3301, 3173)); + spawnNoob(new Location(3293, 3170)); + spawnNoob(new Location(3286, 3171)); + spawnNoob(new Location(3289, 3169)); + + //Slayer Tower + spawnLowest(new Location(3412, 3173)); + spawnNoob(new Location(3412, 3539)); + spawnNoob(new Location(3420, 3545)); + spawnNoob(new Location(3420, 3545)); + spawnNoob(new Location(3420, 3558)); + spawnNoob(new Location(3433, 3571)); + //Replace with something like rune bots + spawnDragonKiller(new Location(3437, 3562, 1)); + spawnDragonKiller(new Location(3437, 3562, 1)); + spawnDragonKiller(new Location(3437, 3562, 1)); + //Bloodvelds + spawnDragonKiller(new Location(3417, 3561, 1)); + spawnDragonKiller(new Location(3417, 3561, 1)); + spawnDragonKiller(new Location(3417, 3561, 1)); + //Brimhaven dragons + spawnDragonKiller(new Location(2704, 9450)); + spawnDragonKiller(new Location(2704, 9450)); + } + public void randomItem() + { + Item test = null; + ArrayList tests = new ArrayList(); + for (int x = 0; x < 9999; x++) + test = new Item(x); + if (test.getDefinition().getEquipId() != 0) + tests.add(test); + } +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPActions.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPActions.java index 5c8f42475..27857df92 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPActions.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPActions.java @@ -1,37 +1,52 @@ package org.crandor.game.node.entity.player.ai.pvp; +import java.util.ArrayList; +import java.util.List; + import org.crandor.game.container.impl.EquipmentContainer; -import org.crandor.game.content.global.consumable.*; +import org.crandor.game.content.global.consumable.Consumable; +import org.crandor.game.content.global.consumable.ConsumableProperties; +import org.crandor.game.content.global.consumable.Consumables; +import org.crandor.game.content.global.consumable.Food; import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.Entity; +import org.crandor.game.node.entity.npc.NPC; import org.crandor.game.node.entity.player.Player; import org.crandor.game.node.entity.player.ai.AIPlayer; import org.crandor.game.node.item.Item; import org.crandor.game.system.task.Pulse; import org.crandor.game.world.GameWorld; +import org.crandor.game.world.map.RegionManager; import org.crandor.game.world.map.path.Pathfinder; import org.crandor.game.world.update.flag.context.ChatMessage; import org.crandor.game.world.update.flag.player.ChatFlag; import org.crandor.tools.RandomFunction; -import java.util.List; - public class PVPAIPActions { public static List pvp_players = null; private static final String[] trashMessages = { - "Your suck brooo", - "Your suck broo", - "Your suck bro", - "Come on dude", - "lol", - "l0l", + "I'll do your bloody nan in m8", + "Your sister smells like a tuna sandwich", + "You suck at bridding bro lmao", + "Gf your bank :)", + "Just delete your cache ur bad", + "FFS mate get wrekt", + "Dylan is a better pkr than u, kid..l0l" + + }; private static final String[] safeMessages = { - "Safe up bro", - "Stop safein", - "No safing bro", + "Safe up n00b", + "No safe", + "Get rekt m8", + "Stop fkin eating scrub", + "Dw, you're gunna die anyhow.. :)", + "Either ur eating shrimps or I'm hitting high asf", + "Once i kill u wanna rematch?", + }; public static void syncBotThread(final Player player) { @@ -49,11 +64,9 @@ public class PVPAIPActions { int ticks; @Override public boolean pulse() { - if (bot.getLocation().equals(3088, 3491, 0)) { - System.out.println("Logging out"); + if (bot.getAttribute("dead", true)) { AIPlayer.deregister(bot.getUid()); pvp_players.remove(bot); - bot.getPacketDispatch().sendLogout(); return true; } if (!bot.getInventory().contains(385, 1)) { @@ -69,20 +82,22 @@ public class PVPAIPActions { if (!pvp_players.contains(target) || !Pathfinder.find(bot, target[0]).isSuccessful() || !canAttack(bot, target[0])) { target[0] = pvp_players.get(RandomFunction.getRandom(pvp_players.size() - 1)); } - pot(bot); attackTarget(player, bot, target[0]); + //prayer(bot, target[0]); eat(bot, target[0]); return false; } }); } } + private static void attackTarget(Player player, AIPlayer bot, AIPlayer target) { //If bots target is not himself we continue. if (bot != target) { //If they are in combat or attacking: if (bot.getProperties().getCombatPulse().isInCombat() || bot.getProperties().getCombatPulse().isAttacking()) { + //TODO: Pray Item weapon = bot.getEquipment().get(EquipmentContainer.SLOT_WEAPON); if (RandomFunction.getRandom(25) == 1) { if(bot.getSettings().getSpecialEnergy() == 100) { //TODO: Change 100 to their weielded weapons spec max amount @@ -90,7 +105,7 @@ public class PVPAIPActions { } } } else { - if (RandomFunction.getRandom(25) == 1 && player != null) { + if (RandomFunction.getRandom(25) == 1) { bot.attack(player); } else { //If a 1/50 chance is true, the attacker screams his opponents name hoping his team will dogpile him. @@ -116,7 +131,10 @@ public class PVPAIPActions { * TODO: Possibly make them run away and hop the ditch (I did not do this because we have no other actions than pking at the moment). */ private static void flee(final AIPlayer bot) { - bot.sendChat("WE FLEEIN"); + bot.sendChat("Outta food m8! Off!"); + bot.sendChat("Ahh!"); + bot.sendChat("GTFO M8"); + bot.sendChat("Someone spec him!"); GameWorld.submit(new Pulse(1, bot) { int ticks; @Override @@ -166,27 +184,6 @@ public class PVPAIPActions { } } - private static void pot(Player bot) { - Item[] pots = new Item[] { new Item(145), new Item(157), new Item(163), new Item(169), new Item(3042)}; - //385 is shark, you can add more from there easier. - for (Item pot : pots) { - if (((PotionEffect.SUPER_ATTACK.getSkillBonus(bot) == null) || PotionEffect.SUPER_STRENGTH.getSkillBonus(bot) == null || PotionEffect.SUPER_DEFENCE.getSkillBonus(bot) == null || PotionEffect.RANGING_POTION.getSkillBonus(bot) == null || PotionEffect.MAGIC_POTION.getSkillBonus(bot) == null) && bot.getInventory().containsItem(pot)) { - bot.lock(3); - Item potion = bot.getInventory().getItem(pot); - Consumable consumable = Consumables.forDrink(potion); - if (consumable == null) { - consumable = new Drink(potion.getId(), new ConsumableProperties(1)); - } - consumable.consume(potion, bot); - bot.getProperties().getCombatPulse().delayNextAttack(3); - int chatRandom = RandomFunction.getRandom(50); - if (chatRandom == 1) { - bot.getUpdateMasks().register(new ChatFlag(new ChatMessage(bot, safeMessages[RandomFunction.getRandom(safeMessages.length - 1)], 0, 0))); - } - } - } - } - private static boolean canAttack(Player p, Player t) { int level = p.getSkullManager().getLevel(); if (t.getSkullManager().getLevel() < level) { diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPBuilderUtils.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPBuilderUtils.java index 9776f6dcc..dc0f21cef 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPBuilderUtils.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/pvp/PVPAIPBuilderUtils.java @@ -27,12 +27,17 @@ public class PVPAIPBuilderUtils { buildWizardStats(p); buildWizardEquipment(p); break; + case 3: + //max rune + buildMaxMeleeStats(p); + buildMaxMeleeEquipment(p); + break; } p.getInventory().add(new Item(385, 20)); - p.getProperties().setCombatLevel(100); + p.getProperties().setCombatLevel(126); - p.getSkills().setLevel(Skills.PRAYER, 99); - p.getSkills().setStaticLevel(Skills.PRAYER, 99); + p.getSkills().setLevel(Skills.PRAYER, 98); + p.getSkills().setStaticLevel(Skills.PRAYER, 98); p.getSkills().updateCombatLevel(); p.getAppearance().sync(); correctHitpointsStat(p); @@ -40,7 +45,8 @@ public class PVPAIPBuilderUtils { private static void buildWizardEquipment(AIPlayer p) { int[] weapons = { - 1381 + 1381, + 4675, }; int hat = -1; int platebody = -1; @@ -73,6 +79,13 @@ public class PVPAIPBuilderUtils { gloves = RandomFunction.getRandom(10) == 1 ? generateGloves() : 4115; boots = RandomFunction.getRandom(10) == 1 ? generateBoots() : 4117; break; + case 3: + hat = 4708; + platebody = 4712; + platelegs = 44714; + gloves = RandomFunction.getRandom(10) == 1 ? generateGloves() : 4095; + boots = RandomFunction.getRandom(10) == 1 ? generateBoots() : 4097; + break; } p.getEquipment().replace(new Item(hat), EquipmentContainer.SLOT_HAT); p.getEquipment().replace(new Item(platebody), EquipmentContainer.SLOT_CHEST); @@ -86,8 +99,8 @@ public class PVPAIPBuilderUtils { } private static void setupWizard(AIPlayer p) { - final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 }; - p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(SPELL_IDS[RandomFunction.random(SPELL_IDS.length)]))); + //final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 }; + p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(55))); p.getInventory().add(new Item(554, 1000)); //Fire runes p.getInventory().add(new Item(555, 1000)); //Water runes p.getInventory().add(new Item(556, 1000)); //Air runes @@ -101,8 +114,8 @@ public class PVPAIPBuilderUtils { } private static void buildWizardStats(AIPlayer p) { - int magicLevel = RandomFunction.random(60, 99); - int defenceLevel = RandomFunction.random(40, 99); + int magicLevel = RandomFunction.random(80, 98); + int defenceLevel = RandomFunction.random(80, 98); p.getSkills().setLevel(Skills.MAGIC, magicLevel); p.getSkills().setStaticLevel(Skills.MAGIC, magicLevel); @@ -116,9 +129,9 @@ public class PVPAIPBuilderUtils { private static void buildMeleeStats(AIPlayer p) { - int attackLevel = RandomFunction.random(60, 99); + int attackLevel = RandomFunction.random(80, 98); int strengthLevel = RandomFunction.random(attackLevel - 10, attackLevel + 10); - int defenceLevel = RandomFunction.random(40, 99); + int defenceLevel = RandomFunction.random(60, 98); p.getSkills().setLevel(Skills.ATTACK, attackLevel); p.getSkills().setStaticLevel(Skills.ATTACK, attackLevel); @@ -137,6 +150,9 @@ public class PVPAIPBuilderUtils { 1163, //Rune Full Helm 3751, //Berserker Helm 3753, //Warrior Helm + 10828, + 1038, + 4753, //TODO: No helm }; int[] shield = { @@ -144,13 +160,22 @@ public class PVPAIPBuilderUtils { 1201, //Rune kiteshield 6524, //Obsidian shield 8850, //Rune defender + 11283, //dragonfire shield + 14767, //dragon defender }; int[] platebody = { 1113, //Rune chainmail. 1127, //Rune platebody. + 10551, + 4757, + 11724, + 4720, }; int[] platelegs = { 1079, //Rune platelegs. + 4759, + 11726, + 1075, }; p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT); p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD); @@ -164,17 +189,69 @@ public class PVPAIPBuilderUtils { } public static final int[] weapons = { - 1303, //Rune long sword - 1305, //Dragon longsword - 1434, //Dragon mace - 1215, //Dragon dagger - 5698, //DDS + 4151, //Whip + 4587, //Dragon Scimitar + + }; + + + private static void buildMaxMeleeStats(AIPlayer p) { + + p.getSkills().setLevel(Skills.ATTACK, 99); + p.getSkills().setStaticLevel(Skills.ATTACK, 99); + p.getSkills().setLevel(Skills.STRENGTH, 99); + p.getSkills().setStaticLevel(Skills.STRENGTH, 99); + p.getSkills().setLevel(Skills.DEFENCE, 99); + p.getSkills().setStaticLevel(Skills.DEFENCE, 99); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + correctHitpointsStat(p); + } + + private static void buildMaxMeleeEquipment(AIPlayer p) { + int[] helms = { + 3751, //Berserker Helm + }; + int[] shield = { + 14767, //Dragon defender + }; + int[] platebody = { + 11724, //Bandos chainmail. + }; + int[] platelegs = { + 11726, //Bandos Tassets. + }; + int[] amulets = { + 6585, //fury + }; + int[] boots = { + 3105, //Climbing boots. + }; + int[] cape = { + 6570, //Fire cape. + }; + int[] gloves = { + 7462, //Barrows Gloves. + }; + p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET); + p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET); + p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS); + } + + public static final int[] weapons2 = { 4151, //Whip }; private static void buildArcherStats(AIPlayer p) { - int rangedLevel = RandomFunction.random(60, 99); - int defenceLevel = RandomFunction.random(40, 99); + int rangedLevel = RandomFunction.random(80, 98); + int defenceLevel = RandomFunction.random(60, 98); p.getSkills().setLevel(Skills.RANGE, rangedLevel); p.getSkills().setStaticLevel(Skills.RANGE, rangedLevel); @@ -189,15 +266,19 @@ public class PVPAIPBuilderUtils { private static void buildArcherEquipment(AIPlayer p) { int[] helms = { 3749, //Archer helm + 2581, + 10828, }; int[] weapons = { 857, //Yew shortbow 855, //Yew longbow 861, //Magic shortbow 859, //Magic longbow + 11235, }; int[] arrows = { 892, //Rune arrow + 11212, }; int platebody = -1; int platelegs = -1; @@ -245,6 +326,7 @@ public class PVPAIPBuilderUtils { 2412, //Saradomin Cape 2413, //Guthix Cape 2414, //Zamorak Cape + 6570, }; return capes[RandomFunction.random(capes.length)]; } @@ -256,13 +338,15 @@ public class PVPAIPBuilderUtils { 1727, //Amulet of magic 1729, //Amulet of defence 1478, //Amulet of accuracy + 6585, }; return amulets[RandomFunction.random(amulets.length)]; } private static int generateGloves() { int[] gloves = { - 1059 + 1059, + 7462 }; return gloves[RandomFunction.random(gloves.length)]; } @@ -273,6 +357,7 @@ public class PVPAIPBuilderUtils { 1837, //Desert boots. 3105, //Climbing boots. 3791, //Fremmy boots. + 11732, }; return boots[RandomFunction.random(boots.length)]; } @@ -280,16 +365,17 @@ public class PVPAIPBuilderUtils { private static void correctHitpointsStat(AIPlayer player) { player.getSkills().setLevel(Skills.HITPOINTS, 10); player.getSkills().setStaticLevel(Skills.HITPOINTS, 10); - double total_exp = - player.getSkills().getExperience(Skills.ATTACK) + - player.getSkills().getExperience(Skills.STRENGTH) + - player.getSkills().getExperience(Skills.DEFENCE) + - player.getSkills().getExperience(Skills.RANGE)+ - player.getSkills().getExperience(Skills.MAGIC); - double hp_exp = Math.floor(total_exp / 3.0) + 1154; - player.getSkills().addExperience(Skills.HITPOINTS, hp_exp); player.getSkills().updateCombatLevel(); - player.getAppearance().sync(); + int rangedLevel = RandomFunction.random(80, 98); + int defenceLevel = RandomFunction.random(80, 98); + + player.getSkills().setLevel(Skills.HITPOINTS, rangedLevel); + player.getSkills().setStaticLevel(Skills.HITPOINTS, rangedLevel); + player.getSkills().setLevel(Skills.HITPOINTS, defenceLevel); + player.getSkills().setStaticLevel(Skills.HITPOINTS, defenceLevel); + + player.getSkills().updateCombatLevel(); + player.getAppearance().sync(); } public static final String[] names = { @@ -420,6 +506,7 @@ public class PVPAIPBuilderUtils { "k4eo9ssi7", "juxikeederast", "d_man_5567", + "mod_richard", "q1w2e1r2", "be_kingless", "hardflip", @@ -437,6 +524,10 @@ public class PVPAIPBuilderUtils { "giantpenis3959737", "dragonoid798", "qwerty798", + "dylansuxnutz", + "2016", + "nigbittiesbro", + "pk4lifefoo", "logieboi", "wichking", "kyros60r0bl33mfzo", diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPActions.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPActions.java index ea89768d4..e7d00768d 100644 --- a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPActions.java +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPActions.java @@ -1,20 +1,15 @@ package org.crandor.game.node.entity.player.ai.resource; -import org.crandor.game.content.skill.free.gather.GatheringSkillPulse; import org.crandor.game.content.skill.free.gather.SkillingResource; import org.crandor.game.node.entity.player.Player; import org.crandor.game.node.entity.player.ai.AIPlayer; -import org.crandor.game.node.object.GameObject; import org.crandor.game.system.task.Pulse; import org.crandor.game.world.GameWorld; -import org.crandor.game.world.map.Location; -import org.crandor.game.world.map.RegionManager; -import org.crandor.game.world.map.path.Pathfinder; +import org.crandor.game.world.repository.Repository; import java.util.List; public class ResourceAIPActions { - public static List resource_players = null; @@ -28,6 +23,7 @@ public class ResourceAIPActions { final AIPlayer bot = resource_players.get(aip_index); GameWorld.submit(new Pulse(1, bot) { int ticks; + int ov; @Override public boolean pulse() { /*if (bot.getInventory().freeSlots() < 1) { @@ -40,18 +36,36 @@ public class ResourceAIPActions { resource_players.remove(bot); return true; } - chopTree(bot, RegionManager.getObject(Location.create(3234,3231,0))); + if (ov++ >= 3) { + chopTree(bot); + ov = 0; + } +// ov = 0; + System.out.println(ov); return false; } }); } } - private static void chopTree(final AIPlayer bot, final GameObject node) { - bot.sendChat("WE CHOPPIN"); -// Pathfinder.find(bot, node); + private static boolean chopTree(final AIPlayer bot) { + /*for (GameObject[] o : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[0].getObjects()) { + for (GameObject obj : o) { + if (obj != null) { + for (SkillingResource r : SkillingResource.values()) { + if (obj.getId() == r.getId()) { + Pathfinder.find(bot, obj).walk(bot); + bot.sendChat("WE CHOPPIN"); + } + } + } + } + }*/ + bot.attack(Repository.getNpcs().get(106)); + // Pulse pulse = new GatheringSkillPulse(bot, node); - bot.getPulseManager().run(new GatheringSkillPulse(bot, node)); +// bot.getPulseManager().run(new GatheringSkillPulse(bot, node)); // pulse.start(); + return true; } } diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java new file mode 100644 index 000000000..a59456ea3 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java @@ -0,0 +1,141 @@ +package org.crandor.game.node.entity.player.ai.skillingbot; + +import org.crandor.game.world.map.Location; + +import java.util.ArrayList; + +import org.crandor.cache.def.impl.ObjectDefinition; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.content.skill.free.gather.*; +import org.crandor.game.interaction.Interaction; +import org.crandor.game.interaction.Option; +import org.crandor.game.interaction.OptionHandler; +import org.crandor.game.node.Node; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.item.Item; +import org.crandor.game.node.object.GameObject; +import org.crandor.game.world.map.RegionManager; +import org.crandor.game.world.map.path.Pathfinder; +import org.crandor.net.packet.in.InteractionPacket; +import org.crandor.tools.RandomFunction; + +import plugin.skill.gather.*; + +public class SkillingBot extends AIPlayer{ + + private int tick = 5; + private ArrayList interactNodeIds; + private int fromWhereDoIdrop; + private int skill; + private int interactionRange; + + public SkillingBot(String name, Location l) + { + super(name, l); + this.fromWhereDoIdrop = 0; + this.interactionRange = 15; + // TODO Auto-generated constructor stub + } + + public SkillingBot(String name, Location l, int skill, ArrayList entrys) + { + super(name, l); + this.skill = skill; + this.fromWhereDoIdrop = 0; + this.interactNodeIds = entrys; + this.interactionRange = 15; + + switch (this.skill) + { + case Skills.MINING: + default: + break; + } + + // TODO Auto-generated constructor stub + } + + @Override + public void tick() + { + super.tick(); + + //Despawn + if (this.getSkills().getLifepoints() == 0) + AIPlayer.deregister(this.getUid()); + + //Interact with object + if (this.tick <= 0) + { + this.tick = 5; + if (this.skill == Skills.FISHING) + this.tick = 20; + + // Node test = getClosestNodeWithEntry(15, 15503); + Node node; + if (this.skill != Skills.FISHING) + { + node = getClosestNodeWithEntry(interactionRange, interactNodeIds); + } + else + { + node = getClosesCreature(interactionRange, interactNodeIds); +// if (test != null) +// System.out.println("interact with " + test.getName()); + } + + if (node == null) { + System.out.println("Object not found " + this.skill); + return; + } + + //System.out.println("free slots " + this.getInventory().freeSlots()); + + if (this.getInventory().isFull()) + { +// System.out.println(this.getName() + " starts droping from " + fromWhereDoIdrop); + for (int i = fromWhereDoIdrop; i < 28; i++) + { + Item drop = this.getInventory().get(i); + final Option option = drop.getInteraction().get(4); + drop.getInteraction().handleItemOption(this, option, this.getInventory()); +// System.out.println("drop item " + i); + } + } + + int x = node.getLocation().getX(); + int y = node.getLocation().getY(); + if (this.skill != Skills.FISHING) + { + InteractionPacket.handleObjectInteraction(this, 0, x, y, node.getId()); + } + else + { + InteractionPacket.handleNPCInteraction(this, 0, node.getIndex()); + } + } + else + this.tick--; + } + + public int getSkill() + { + return this.skill; + } + + public int getFromWhereToDrop() + { + return this.fromWhereDoIdrop; + } + + public void setFromWhereDoIdrop(int id) + { + this.fromWhereDoIdrop = id; + } + + public void setInteractionRange(int range) + { + this.interactionRange = range; + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java new file mode 100644 index 000000000..ecd1a9ba9 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java @@ -0,0 +1,209 @@ +package org.crandor.game.node.entity.player.ai.skillingbot; + +import java.util.ArrayList; + +import org.crandor.game.container.impl.EquipmentContainer; +import org.crandor.game.content.global.tutorial.CharacterDesign; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.appearance.Gender; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.repository.Repository; +import org.crandor.tools.RandomFunction; + +public final class SkillingBotsBuilder extends AIPlayer { + + public SkillingBotsBuilder(String name, Location l) { + super(name, l); + // TODO Auto-generated constructor stub + } + + private static SkillingBot generateMiningBot(String name, Location loc, ArrayList entrys) + { + SkillingBot bot = new SkillingBot(name, loc, Skills.MINING, entrys); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + bot.getEquipment().replace(new Item(1265), EquipmentContainer.SLOT_WEAPON); + return bot; + } + + private static SkillingBot generateWoodcuttingBot(String name, Location loc, ArrayList entrys) + { + SkillingBot bot = new SkillingBot(name, loc, Skills.WOODCUTTING, entrys); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + bot.init(); + bot.getEquipment().replace(new Item(1351), EquipmentContainer.SLOT_WEAPON); + return bot; + } + + private static SkillingBot generateFishingBot(String name, Location loc, ArrayList entrys) + { + SkillingBot bot = new SkillingBot(name, loc, Skills.FISHING, entrys); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + CharacterDesign.randomize(bot, false); + Repository.getPlayers().add(bot); + bot.init(); + return bot; + } + + public static void spawnClayBotVarrock(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(15503); + entrys.add(15505); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 10); + } + + public static void spawnIronBotVarrock(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(11954); + entrys.add(11955); + entrys.add(11956); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 25); + } + + public static void spawnSilverBotVarrock(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(11948); + entrys.add(11949); + entrys.add(11950); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 30); + } + + public static void spawnTinBotVarrock(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(11957); + entrys.add(11959); + entrys.add(11958); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 5); + } + + public static void spawnTinBotLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(11933); + entrys.add(11934); + entrys.add(11935); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 5); + } + + public static void spawnCopperBotLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(11936); + entrys.add(11937); + entrys.add(11938); + + SkillingBot bot = generateMiningBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.MINING, 5); + } + + public static void spawnOakTreeBotLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(1281); + entrys.add(1278); + entrys.add(1276); + + SkillingBot bot = generateWoodcuttingBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.WOODCUTTING, 25); + bot.setInteractionRange(25); + } + + public static void spawnDeadTreeBotLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(1282); + entrys.add(1286); + + SkillingBot bot = generateWoodcuttingBot(name, loc, entrys); + + bot.getSkills().setLevel(Skills.WOODCUTTING, 25); + bot.setInteractionRange(15); + } + + public static void spawnShrimpFisherLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(323); + entrys.add(326); + + SkillingBot bot = generateFishingBot(name, loc, entrys); + + bot.getInventory().add(new Item(303)); + // don't drop net + bot.setFromWhereDoIdrop(1); + + bot.getSkills().setLevel(Skills.FISHING, 25); + bot.setInteractionRange(25); + } + + public static void spawnTroutLumbridge(String name, Location loc) + { + ArrayList entrys = new ArrayList(); + entrys.add(310); + + SkillingBot bot = generateFishingBot(name, loc, entrys); + + bot.getInventory().add(new Item(309)); + bot.getInventory().add(new Item(314, 20000)); + // don't drop net + bot.setFromWhereDoIdrop(2); + + bot.getSkills().setLevel(Skills.FISHING, 25); + bot.setInteractionRange(25); + } + + public static void immersiveSpawnsSkillingBots() + { + // Varrock Mine + SkillingBotsBuilder.spawnClayBotVarrock("clay", new Location(3181, 3368)); + SkillingBotsBuilder.spawnSilverBotVarrock("silver", new Location(3181, 3368)); + SkillingBotsBuilder.spawnIronBotVarrock("iron", new Location(3181, 3368)); + SkillingBotsBuilder.spawnTinBotVarrock("tin", new Location(3181, 3368)); + + // Lumbridge woodcutting + spawnOakTreeBotLumbridge("Bot", new Location(3227, 3243)); + spawnOakTreeBotLumbridge("Bot", new Location(3186, 3251)); + spawnOakTreeBotLumbridge("Bot", new Location(3188, 3223)); + spawnOakTreeBotLumbridge("Bot", new Location(3162, 3222)); + spawnOakTreeBotLumbridge("Bot", new Location(3162, 3219)); + spawnOakTreeBotLumbridge("Bot", new Location(3152, 3228)); + spawnOakTreeBotLumbridge("Bot", new Location(3146, 3244)); + spawnDeadTreeBotLumbridge("Bot", new Location(3247, 3240)); + + // Lumbridge mining + spawnTinBotLumbridge("Bot", new Location(3224, 3147)); + spawnCopperBotLumbridge("Bot", new Location(3224, 3147)); + + // Lumbridge Fishing + spawnShrimpFisherLumbridge("Bot", new Location(3242, 3151)); + spawnShrimpFisherLumbridge("Bot", new Location(3238, 3148)); + spawnShrimpFisherLumbridge("Bot", new Location(3245, 3161)); + spawnTroutLumbridge("Bot", new Location(3241, 3242)); + } + +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/PvPBotsBuilder.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/PvPBotsBuilder.java new file mode 100644 index 000000000..e52aabde5 --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/PvPBotsBuilder.java @@ -0,0 +1,551 @@ +package org.crandor.game.node.entity.player.ai.wilderness; + +import java.util.ArrayList; + +import org.crandor.game.container.impl.EquipmentContainer; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.node.entity.combat.CombatSpell; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.ai.pvmbots.DragonKiller; +import org.crandor.game.node.entity.player.ai.pvmbots.NoobBot; +import org.crandor.game.node.entity.player.ai.pvmbots.PvMBots; +import org.crandor.game.node.entity.player.link.SpellBookManager; +import org.crandor.game.node.entity.player.link.appearance.Gender; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.repository.Repository; +import org.crandor.tools.RandomFunction; + +public final class PvPBotsBuilder{ + + public static WildernessBot create(String name, Location l) + { + return new WildernessBot(name, l); + } + + public static void generateClass(WildernessBot p) { + int combatType = RandomFunction.getRandom(1); + switch(combatType) { + case 0: + buildMeleeStats(p); + buildMeleeEquipment(p); + correctHitpointsStat(p); + break; + case 1: + //max rune + buildMaxMeleeStats(p); + buildMaxMeleeEquipment(p); + correctHitpointsStat(p); + break; + } + p.getInventory().add(new Item(385, 20)); + p.getProperties().setCombatLevel(126); + + p.getSkills().setLevel(Skills.PRAYER, 98); + p.getSkills().setStaticLevel(Skills.PRAYER, 98); + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + + private static void buildMeleeStats(WildernessBot p) { + int attackLevel = RandomFunction.random(80, 98); + int strengthLevel = RandomFunction.random(attackLevel - 10, attackLevel + 10); + int defenceLevel = RandomFunction.random(60, 98); + + p.getSkills().setLevel(Skills.ATTACK, attackLevel); + p.getSkills().setStaticLevel(Skills.ATTACK, attackLevel); + p.getSkills().setLevel(Skills.STRENGTH, strengthLevel); + p.getSkills().setStaticLevel(Skills.STRENGTH, strengthLevel); + p.getSkills().setLevel(Skills.DEFENCE, defenceLevel); + p.getSkills().setStaticLevel(Skills.DEFENCE, defenceLevel); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildMeleeEquipment(WildernessBot p) { + int[] helms = { + 1163, //Rune Full Helm + 3751, //Berserker Helm + 3753, //Warrior Helm + 10828, + 1038, + 4753, + }; + int[] shield = { + 1185, //Rune sq shield + 1201, //Rune kiteshield + 6524, //Obsidian shield + 8850, //Rune defender + 11286, + 14767, + }; + int[] platebody = { + 1113, //Rune chainmail. + 1127, //Rune platebody. + 10551, + 4757, + 11724, + 4720, + }; + int[] platelegs = { + 1079, //Rune platelegs. + 4759, + 11726, + 1075, + }; + + p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS); + + Item weapon = new Item(weapons[RandomFunction.random(weapons.length)]); + p.setMainWeapon(weapon.getId()); + p.getEquipment().replace(weapon, EquipmentContainer.SLOT_WEAPON); + + p.getEquipment().replace(new Item(generateNecklace()), EquipmentContainer.SLOT_AMULET); + p.getEquipment().replace(new Item(generateBoots()), EquipmentContainer.SLOT_FEET); + p.getEquipment().replace(new Item(generateCape()), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(generateGloves()), EquipmentContainer.SLOT_HANDS); + } + + public static final int[] weapons = { + 4151, //Whip + 4587, //Dragon Scimitar + + }; + + + private static void buildMaxMeleeStats(AIPlayer p) + { + p.getSkills().setLevel(Skills.ATTACK, 99); + p.getSkills().setStaticLevel(Skills.ATTACK, 99); + p.getSkills().setLevel(Skills.STRENGTH, 99); + p.getSkills().setStaticLevel(Skills.STRENGTH, 99); + p.getSkills().setLevel(Skills.DEFENCE, 99); + p.getSkills().setStaticLevel(Skills.DEFENCE, 99); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildMaxMeleeEquipment(AIPlayer p) { + int[] helms = { + 3751, //Berserker Helm + }; + int[] shield = { + 14767, //Dragon defender + }; + int[] platebody = { + 11724, //Bandos chainmail. + }; + int[] platelegs = { + 11726, //Bandos Tassets. + }; + int[] amulets = { + 6585, //fury + }; + int[] boots = { + 3105, //Climbing boots. + }; + int[] cape = { + 6570, //Fire cape. + }; + int[] gloves = { + 7462, //Barrows Gloves. + }; + p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET); + p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET); + p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS); + } + + public static final int[] weapons2 = { + 4151, //Whip + }; + + private static int generateCape() { + int[] capes = { + 1052, //Legends Cape + 6570, //Fire cape + }; + return capes[RandomFunction.random(capes.length)]; + } + + private static int generateNecklace() { + int[] amulets = { + 1712, //Glory + 1725, //Strength ammy + 6585, //fury + }; + return amulets[RandomFunction.random(amulets.length)]; + } + + private static int generateGloves() { + int[] gloves = { + 1059, + 7462 + }; + return gloves[RandomFunction.random(gloves.length)]; + } + + private static int generateBoots() { + int[] boots = { + 1061, //Leather boots. + 1837, //Desert boots. + 3105, //Climbing boots. + 3791, //Fremmy boots. + 11732, + }; + return boots[RandomFunction.random(boots.length)]; + } + + public static void generateMinLevels(PvMBots p) + { + //Slayer so they can attack alls monsters + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(2); + p.getSkills().setLevel(Skills.HITPOINTS, 15); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 15); + p.getInventory().add(new Item(329, 5)); + switch(combatType) + { + case 0: + { + buildArcherStats(p); + buildArcherEquipment(p); + break; + } + case 1: + { + buildMeleeStats(p); + buildMeleeEquipment(p); + break; + } + case 2: + { + buildMageStats(p); + buildMagicEquipment(p); + setupWizard(p); + break; + } + default: + { + buildMeleeStats(p); + buildMeleeEquipment(p); + break; + } + + } + } + + public static void createDragonKiller(DragonKiller p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(2); + p.getSkills().setLevel(Skills.HITPOINTS, 55); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 55); + switch(combatType) + { + case 0: + { + buildDragonArcherStats(p); + buildDragonArcherEquipment(p); + break; + } + case 1: + { + buildDragonMeleeStats(p); + buildDragonMeleeEquipment(p); + break; + } + default: + { + buildDragonMeleeStats(p); + buildDragonMeleeEquipment(p); + break; + } + } + } + + public static void createNoob(NoobBot p) + { + p.getSkills().setLevel(Skills.SLAYER, 99); + p.getSkills().setStaticLevel(Skills.SLAYER, 99); + int combatType = RandomFunction.getRandom(3); + p.getSkills().setLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10)); + p.getSkills().setLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9)); + p.getSkills().setStaticLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9)); + p.getInventory().add(new Item(329, 5)); + switch(combatType) + { + case 0: + { + buildNoobArcherStats(p); + buildNoobArcherEquipment(p); + break; + } + case 1: + { + buildNoobMeleeStats(p); + buildNoobMeleeEquipment(p); + break; + } + case 2: + { + buildNoobMageStats(p); + buildNoobMagicEquipment(p); + setupWizard(p); + } + default: + { + buildNoobMeleeStats(p); + buildNoobMeleeEquipment(p); + break; + } + } + } + + private static void buildArcherStats(PvMBots p) + { + p.getSkills().setLevel(Skills.RANGE, 10); + p.getSkills().setStaticLevel(Skills.RANGE, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildDragonArcherStats(DragonKiller p) + { + p.getSkills().setLevel(Skills.RANGE, 55); + p.getSkills().setStaticLevel(Skills.RANGE, 55); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobArcherStats(NoobBot p) + { + p.getSkills().setLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + public static void buildMeleeStats(PvMBots p) + { + p.getSkills().setLevel(Skills.ATTACK, 10); + p.getSkills().setStaticLevel(Skills.ATTACK, 10); + p.getSkills().setLevel(Skills.STRENGTH, 10); + p.getSkills().setStaticLevel(Skills.STRENGTH, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + public static void buildDragonMeleeStats(DragonKiller p) + { + p.getSkills().setLevel(Skills.ATTACK, 55); + p.getSkills().setStaticLevel(Skills.ATTACK, 55); + p.getSkills().setLevel(Skills.STRENGTH, 55); + p.getSkills().setStaticLevel(Skills.STRENGTH, 55); + p.getSkills().setLevel(Skills.DEFENCE, 45); + p.getSkills().setStaticLevel(Skills.DEFENCE, 45); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobMeleeStats(NoobBot p) + { + p.getSkills().setLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10)); + p.getSkills().setLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildMageStats(PvMBots p) + { + p.getSkills().setLevel(Skills.MAGIC, 10); + p.getSkills().setStaticLevel(Skills.MAGIC, 10); + p.getSkills().setLevel(Skills.DEFENCE, 10); + p.getSkills().setStaticLevel(Skills.DEFENCE, 10); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void buildNoobMageStats(NoobBot p) + { + p.getSkills().setLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10)); + p.getSkills().setStaticLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10)); + + p.getSkills().updateCombatLevel(); + p.getAppearance().sync(); + } + + private static void setupWizard(PvMBots p) + { + //final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 }; + p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(1))); + p.getInventory().add(new Item(556, 1000)); //Air runes + p.getInventory().add(new Item(558, 1000)); //Mind runes + } + + private static void buildArcherEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1129), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1095), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildDragonArcherEquipment(DragonKiller p) + { + p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(13483), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1099), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(9185), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(9140, 500), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(10498), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobArcherEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET); + } + + private static void buildMeleeEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(1153), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1115), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1067), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1309), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildDragonMeleeEquipment(DragonKiller p) + { + p.getEquipment().replace(new Item(1163), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(1127), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1079), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1333), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobMeleeEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + int weapons[] = {1307, 1321, 1375, 1203, 1239, 1267, 1293, 1323, 1335}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET); + } + + private static void buildMagicEquipment(PvMBots p) + { + p.getEquipment().replace(new Item(579), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(577), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(1011), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(1389), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET); + } + + private static void buildNoobMagicEquipment(PvMBots p) + { + int hats[] = {1169, 1169, 1139, 1137, 1153, 579}; + int legs[] = {1095, 7366, 1075, 1087, 1095}; + int chest[] = {1129, 1103, 1101, 1129, 1117, 577}; + int weapons[] = {1379, 1383, 1385, 1387, 1389}; + + p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT); + p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST); + p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS); + p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON); + p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS); + p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE); + p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET); + } + + public static void spawn(Location loc) + { + final WildernessBot bot = PvPBotsBuilder.create("bottest", new Location(0, 0)); + bot.teleport(loc); + bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(bot); + generateClass(bot); + bot.init(); + } + + private static void correctHitpointsStat(AIPlayer player) { + player.getSkills().setLevel(Skills.HITPOINTS, 10); + player.getSkills().setStaticLevel(Skills.HITPOINTS, 10); + player.getSkills().updateCombatLevel(); + int rangedLevel = RandomFunction.random(80, 98); + int defenceLevel = RandomFunction.random(80, 98); + + player.getSkills().setLevel(Skills.HITPOINTS, rangedLevel); + player.getSkills().setStaticLevel(Skills.HITPOINTS, rangedLevel); + player.getSkills().setLevel(Skills.HITPOINTS, defenceLevel); + player.getSkills().setStaticLevel(Skills.HITPOINTS, defenceLevel); + + player.getSkills().updateCombatLevel(); + player.getAppearance().sync(); + } + + public void RandomItem() + { + Item test = null; + ArrayList tests = new ArrayList(); + for (int x = 0; x < 9999; x++) + test = new Item(x); + if (test.getDefinition().getEquipId() != 0) + tests.add(test); + } +} diff --git a/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/WildernessBot.java b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/WildernessBot.java new file mode 100644 index 000000000..db1073fed --- /dev/null +++ b/09HDscape-server/src/org/crandor/game/node/entity/player/ai/wilderness/WildernessBot.java @@ -0,0 +1,285 @@ +package org.crandor.game.node.entity.player.ai.wilderness; + +import java.util.ArrayList; +import java.util.List; + +import org.crandor.game.container.impl.EquipmentContainer; +import org.crandor.game.content.global.consumable.Consumable; +import org.crandor.game.content.global.consumable.ConsumableProperties; +import org.crandor.game.content.global.consumable.Consumables; +import org.crandor.game.content.global.consumable.Food; +import org.crandor.game.content.skill.Skills; +import org.crandor.game.interaction.Option; +import org.crandor.game.node.entity.Entity; +import org.crandor.game.node.entity.combat.equipment.Weapon; +import org.crandor.game.node.entity.npc.NPC; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.entity.player.ai.AIPlayer; +import org.crandor.game.node.entity.player.link.prayer.PrayerType; +import org.crandor.game.node.item.Item; +import org.crandor.game.world.map.Location; +import org.crandor.game.world.map.RegionManager; +import org.crandor.game.world.update.flag.context.ChatMessage; +import org.crandor.game.world.update.flag.player.ChatFlag; +import org.crandor.tools.RandomFunction; + +public class WildernessBot extends AIPlayer { + + public WildernessBot(String name, Location l) { + super(name, l); + this.specWeapon = 1215; + this.normalWeapon = 4151; + this.getInventory().add(new Item(specWeapon)); + // TODO Auto-generated constructor stub + } + + public WildernessBot(String name, Location l, int normalWeaponId, int specWeaponId) { + super(name, l); + this.specWeapon = specWeaponId; + this.normalWeapon = normalWeaponId; + this.getInventory().add(new Item(specWeaponId)); + } + + int tick = 0; + int movetimer = 0; + int agressiveTimer = 2; + int eatdelay = 2; + boolean fleeing = false; + boolean riskIt = false; + int specWeapon;// = new Item(1215); + int normalWeapon;// = new Item(4151); + + Item chest = this.getEquipment().get(EquipmentContainer.SLOT_CHEST); + Item legs = this.getEquipment().get(EquipmentContainer.SLOT_LEGS); + Item helmet = this.getEquipment().get(EquipmentContainer.SLOT_HAT); + Item weapon = this.getEquipment().get(EquipmentContainer.SLOT_WEAPON); + Item shield = this.getEquipment().get(EquipmentContainer.SLOT_SHIELD); + + + public List FindTargets(Entity entity, int radius) { + List targets = new ArrayList<>(); + for (Player player : RegionManager.getLocalPlayers(entity, radius)) { { + if (checkValidTargets(player)) + targets.add(player); + } + } + if (targets.size() == 0) + return null; + return targets; + } + + public boolean checkValidTargets(Player target){ + if (!target.isActive()) + { + return false; + } + if (!target.getProperties().isMultiZone() && target.inCombat()) { + return false; + } + if (target.inCombat()) + { + return false; + } + return true; + } + + public void AttackPlayersInRadius(Player bot, int radius) + { + if (bot.inCombat()) + return; + List players = FindTargets(bot, radius); + if (players == null) + { + return; + } + if (!(players.isEmpty())) + { + if (agressiveTimer <= 0) + bot.attack(players.get(RandomFunction.getRandom((players.size() - 1)))); + return; + } + } + + private Entity getTarget() + { + return this.getProperties().getCombatPulse().getVictim(); + } + + private void checkSpecialAttack() + { + Entity target = getTarget(); + if (target == null) + return; + + if (target.getSkills().getLifepoints() <= 75 && this.getSettings().getSpecialEnergy() >= 25) + { + //System.out.println("try special"); + Item weapon = this.getItemById(specWeapon); + if (weapon != null) + { + //System.out.println("found weapon " + weapon.getName()); + final Option option = weapon.getInteraction().get(1); + if (option == null) + { + System.out.println("Option not found"); + return; + } + weapon.getInteraction().handleItemOption(this, option, this.getInventory()); + this.getSettings().setSpecialToggled(true); + this.attack(target); + } + if (!this.getSettings().isSpecialToggled()) + { + //System.out.println("toggle special"); + this.getSettings().setSpecialToggled(true); + this.attack(target); + } + } + else + { + //System.out.println("try normal again"); + Item weapon = this.getItemById(normalWeapon); + if (weapon != null) + { + //System.out.println("found weapon " + weapon.getName()); + final Option option = weapon.getInteraction().get(1); + if (option == null) + { + System.out.println("Option not found"); + return; + } + weapon.getInteraction().handleItemOption(this, option, this.getInventory()); + this.getSettings().setSpecialToggled(false); + this.attack(target); + } + } + } + + private void checkBarrowsSwitch() + { + System.out.println(this.getSkills().getLifepoints()); + Entity target = getTarget(); + if (target == null) + return; + + if (this.getSkills().getLifepoints() <= 35 && target.isPlayer() && target.getSkills().getLifepoints() <= 60) + { + this.getEquipment().replace(new Item(4720) ,EquipmentContainer.SLOT_CHEST); + this.getEquipment().replace(new Item(4722) ,EquipmentContainer.SLOT_LEGS); + this.getEquipment().replace(new Item(4716) ,EquipmentContainer.SLOT_HAT); + this.getEquipment().replace(new Item(4719) ,EquipmentContainer.SLOT_WEAPON); + this.getEquipment().replace(new Item(-1) ,EquipmentContainer.SLOT_SHIELD); + riskIt = true; + } + else if (riskIt) + { + this.getEquipment().replace(chest, EquipmentContainer.SLOT_CHEST); + this.getEquipment().replace(legs, EquipmentContainer.SLOT_LEGS); + this.getEquipment().replace(helmet, EquipmentContainer.SLOT_HAT); + this.getEquipment().replace(weapon, EquipmentContainer.SLOT_WEAPON); + this.getEquipment().replace(shield, EquipmentContainer.SLOT_SHIELD); + riskIt = false; + } + } + + private void checkPrayer() + { + if (this.inCombat()) + { + if (!(this.getPrayer().getActive().contains(PrayerType.PIETY))) + this.getPrayer().toggle((PrayerType.PIETY)); + } + } + + @Override + public void tick() + { + super.tick(); + //checkBarrowsSwitch(); + checkSpecialAttack(); + checkPrayer(); + //Despawn + if (this.getSkills().getLifepoints() == 0) + //this.teleport(new Location(500, 500)); + //Despawning not being delayed causes 3 errors in the console + AIPlayer.deregister(this.getUid()); + if (agressiveTimer != 0) + { + agressiveTimer--; + } + + //Combat + if (!fleeing) + { + if (tick == 0) + { + if (!this.inCombat()) + AttackPlayersInRadius(this, 5); + this.tick = 10; + } + else + this.tick--; + + if (!this.inCombat()) + { + if (movetimer == 0) + { + //if (this.FindTargets(this, 5) == null) + this.randomWalk(20, 20); + this.movetimer = 10; + } + else + movetimer --; + } + } + this.sendChat("Tik"); + this.checkFlee(385); + this.eat(385); + //this.getPrayer().toggle() + } + + public void checkFlee(int foodId) + { + if (this.getInventory().contains(foodId, 18) == false) + { + //todo: add tp + // if () + this.getProperties().setRetaliating(false); + this.sendChat("Oi"); + walkPos(this.getLocation().getLocalX(), this.getLocation().getLocalY() - 5 - RandomFunction.getRandom(5)); + fleeing = true; + } + } + + public void eat(int foodId) + { + if (riskIt) + return; + + Item foodItem = new Item(foodId); + + if (!(this.getInventory().contains(foodId, 1))) + return; + + if((this.getSkills().getStaticLevel(Skills.HITPOINTS) >= this.getSkills().getLifepoints() * 3) && this.getInventory().containsItem(foodItem)) + { + this.lock(3); + //this.animate(new Animation(829)); + Item food = this.getInventory().getItem(foodItem); + + Consumable consumable = Consumables.forFood(food); + + if (consumable == null) { + consumable = new Food(food.getId(), new ConsumableProperties(1)); + } + + consumable .consume(food, this); + this.getProperties().getCombatPulse().delayNextAttack(3); + } + } + + public void setMainWeapon(int weapon) + { + this.normalWeapon = weapon; + } +} diff --git a/09HDscape-server/src/org/crandor/net/packet/in/InteractionPacket.java b/09HDscape-server/src/org/crandor/net/packet/in/InteractionPacket.java index 7826cc73f..efc210979 100644 --- a/09HDscape-server/src/org/crandor/net/packet/in/InteractionPacket.java +++ b/09HDscape-server/src/org/crandor/net/packet/in/InteractionPacket.java @@ -149,7 +149,7 @@ public final class InteractionPacket implements IncomingPacket { * @param optionIndexthe option index. * @param index the index. */ - private static void handleNPCInteraction(Player player, int optionIndex, final int index) { + public static void handleNPCInteraction(Player player, int optionIndex, final int index) { if (index < 1 || index > ServerConstants.MAX_NPCS) { PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player)); return; diff --git a/09HDscape-server/src/org/crandor/tools/LastNameFirstNameP9A.java b/09HDscape-server/src/org/crandor/tools/LastNameFirstNameP9A.java new file mode 100644 index 000000000..b2f30f41f --- /dev/null +++ b/09HDscape-server/src/org/crandor/tools/LastNameFirstNameP9A.java @@ -0,0 +1,47 @@ +package org.crandor.tools; + +import java.util.Random; +import java.util.Scanner; + +public class LastNameFirstNameP9A { + + private static final int PHYSICAL_SIZE = 100; + + public static void main(String[] args) { + + Scanner scanner = new Scanner(System.in); + Random generator = new Random(); + + int logicalSize; + String menuChoice; + int[] origList = new int[PHYSICAL_SIZE]; + int[] list = new int[PHYSICAL_SIZE]; + //---------------------------Display My Information--------------------------- + System.out.println("Main Menu for Sorts and Searches\n\n"); + System.out.println("1. Generate Random Numbers For the Original Array"); + System.out.println("2. Copy the original Array"); + + while (scanner.hasNext()) { + + + if (scanner.next().equalsIgnoreCase("Q")) { + System.out.println("Thank you for using the program."); + System.exit(0); + continue; + } + + switch (scanner.next()) { + + case "1": + System.out.println("How many elements would you like to have in this array?"); + logicalSize = scanner.nextInt(); + break; + } + +// if (scanner.next().equalsIgnoreCase("1")); { +// } + + } + + } +} diff --git a/09HDscape-server/src/org/crandor/tools/Lesson.java b/09HDscape-server/src/org/crandor/tools/Lesson.java new file mode 100644 index 000000000..37e94dbf1 --- /dev/null +++ b/09HDscape-server/src/org/crandor/tools/Lesson.java @@ -0,0 +1,46 @@ +package org.crandor.tools; + +public class Lesson { + + + public static void main(String[] args) { + + String text = "Beal"; + + System.out.println(frontBack(text)); + + } + + public boolean sleepIn(boolean weekday, boolean vaction) { + if (!weekday || vaction) { + return true; + } + return false; + } + + public int sumDouble(int a, int b) { + int sum = a + b; + return a == b ? sum * 2 : sum; + } + + public static String frontBack(String str) { + char first = str.charAt(0); + char last = str.charAt(str.length() - 1); + return str.replace(last, first).replace(first, last); + } + + public boolean scores100(int[] scores) { + if (scores[0] == 100) { + return true; + } + for (int i = 1; i < scores.length; i++) { + if (scores[i - 1] == 100) { + return true; + } + } + return false; + } + + + +} diff --git a/09HDscape-server/src/org/crandor/tools/Test.java b/09HDscape-server/src/org/crandor/tools/Test.java index 11422e1d6..51c1df031 100644 --- a/09HDscape-server/src/org/crandor/tools/Test.java +++ b/09HDscape-server/src/org/crandor/tools/Test.java @@ -2,6 +2,7 @@ package org.crandor.tools; import org.crandor.cache.Cache; import org.crandor.cache.def.impl.ItemDefinition; +import org.omg.CORBA.CODESET_INCOMPATIBLE; public class Test { @@ -9,6 +10,22 @@ public class Test { //@SuppressWarnings("unused") public static void main(String...args) { Cache.init(); + /*while(true) { + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.gc(); + System.out.println("ur gay"); + }*/ /* for (int i = 0; i < Cache.getNPCDefinitionsSize(); i++) { if (NPCDefinition.forId(i).getName().toLowerCase().contains("beaver")) { //System.out.println(i + ", " + NPCDefinition.forId(i).getName()); @@ -22,9 +39,21 @@ public class Test { } }*/ System.out.println("------Items-------"); + int count = 0; for (int i = 0; i < Cache.getItemDefinitionsSize(); i++) { + ItemDefinition def = ItemDefinition.forId(i); - System.out.println(def.getName() + ", " + i); + if (def.getName().equalsIgnoreCase("null")) + continue; + if (def.getName().contains("ironman") || def.getName().startsWith("Ironman")) + continue; + if (!def.isUnnoted()) + continue; + if (def.isMembersOnly()) + continue; + if (def.hasWearAction()) + System.out.println("new Item(" + def.getId() + "), //" + def.getName() + "\n"); +// System.out.println(def.getName() + ", " + i + " - " + !def.isUnnoted() + " - COUNT = " + count++); } } } diff --git a/09HDscape-server/src/org/crandor/tools/firewatch/Firewatch.java b/09HDscape-server/src/org/crandor/tools/firewatch/Firewatch.java new file mode 100644 index 000000000..14b4d6ae6 --- /dev/null +++ b/09HDscape-server/src/org/crandor/tools/firewatch/Firewatch.java @@ -0,0 +1,29 @@ +package org.crandor.tools.firewatch; + +import java.util.*; + +public class Firewatch { + + private static Map firewatch = new HashMap<>(4); + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int count = 0; + String[] names = {"Willams", "Fabiano", "Martinez", "Popocamartinez", "Millard", "Wilson", "Young", "Dennis"}; + for (int i = 0; i < names.length; i++) { + boolean hasWatch = new Random().nextInt(1) == 0; + firewatch.put(names[i++], hasWatch); + } + System.out.println("Enter the name of the Marine you wish to check:"); + String name = scanner.nextLine(); + + int time = new Random().nextInt(4); + + for (Map.Entry marine : firewatch.entrySet()) { + if (name.equalsIgnoreCase(marine.getKey())) { + System.out.println(name + ( marine.getValue() ? " does " : " does not ") + "have firewatch."); + System.out.println("From " + time + " to " + (time + 4) + "."); + } + } + } +} diff --git a/09HDscape-server/src/plugin/command/AIPCommandPlugin.java b/09HDscape-server/src/plugin/command/AIPCommandPlugin.java index 351956904..f29f42d3e 100644 --- a/09HDscape-server/src/plugin/command/AIPCommandPlugin.java +++ b/09HDscape-server/src/plugin/command/AIPCommandPlugin.java @@ -1,15 +1,20 @@ package plugin.command; import org.crandor.game.container.Container; +import org.crandor.game.content.skill.Skills; import org.crandor.game.interaction.Interaction; import org.crandor.game.node.entity.player.Player; import org.crandor.game.node.entity.player.ai.AIPBuilder; import org.crandor.game.node.entity.player.ai.AIPlayer; import org.crandor.game.node.entity.player.ai.general.GeneralBotCreator; +import org.crandor.game.node.entity.player.ai.general.scriptrepository.LobsterCatcher; import org.crandor.game.node.entity.player.ai.general.scriptrepository.ManThiever; +import org.crandor.game.node.entity.player.ai.pvmbots.PvMBotsBuilder; import org.crandor.game.node.entity.player.ai.pvp.PVPAIPActions; import org.crandor.game.node.entity.player.ai.pvp.PVPAIPBuilderUtils; import org.crandor.game.node.entity.player.ai.resource.ResourceAIPActions; +import org.crandor.game.node.entity.player.ai.skillingbot.SkillingBotsBuilder; +import org.crandor.game.node.entity.player.ai.wilderness.PvPBotsBuilder; import org.crandor.game.node.entity.player.link.appearance.Gender; import org.crandor.game.node.item.Item; import org.crandor.game.system.command.CommandPlugin; @@ -31,181 +36,270 @@ import java.util.List; /** * Handles the AIPlayer commands. * These commands are for bots + * * @author Emperor */ @InitializablePlugin public final class AIPCommandPlugin extends CommandPlugin { - @Override - public Plugin newInstance(Object arg) throws Throwable { - link(CommandSet.ADMINISTRATOR); - return this; - } + @Override + public Plugin newInstance(Object arg) throws Throwable { + link(CommandSet.ADMINISTRATOR); + return this; + } - @Override - public boolean parse(final Player player, String name, String[] args) { - List legion = player.getAttribute("aip_legion"); - switch (name) { - case "desaip": - player.removeAttribute("aip_select"); - return true; - case "sellegion": - if (legion != null && !legion.isEmpty()) { - player.setAttribute("aip_select", legion.get(0)); - } - return true; - case "regroup": - Player last = player; - if (legion != null && !legion.isEmpty()) { - for (AIPlayer p : legion) { - p.follow(last); - last = p; - } - } - player.removeAttribute("aip_select"); - return true; - case "clearlegion": - if (legion != null && !legion.isEmpty()) { - for (AIPlayer p : legion) { - AIPlayer.deregister(p.getUid()); - } - legion.clear(); - } - player.removeAttribute("aip_select"); - player.removeAttribute("aip_legion"); - return true; - case "clearaips": - for (Player p : Repository.getPlayers()) { - if (p.isArtificial()) { - p.clear(); - } - } - return true; - case "aip": - name = args.length < 2 ? player.getName() : args[1]; - AIPlayer p = AIPBuilder.copy(player, name, player.getLocation().transform(0, 1, 0)); - Repository.getPlayers().add(p); - p.init(); - - Interaction.sendOption(player, 7, "Control"); - return true; - case "legion": - int size = args.length < 2 ? 10 : Integer.parseInt(args[1]); - last = player; - if (legion == null) { - player.setAttribute("aip_legion", legion = new ArrayList<>()); - } - Interaction.sendOption(player, 7, "Control"); - boolean joinClan = player.getCommunication().getClan() != null && !player.getCommunication().getClan().isDefault(); - String message = player.getName().equals("ethan") ? "The Dark Army marches again!" : null; // Add - // your - // own - // message - for (int i = 0; i < size; i++) { - final AIPlayer aip = AIPBuilder.copy(player, last.getLocation().transform(0, 1, 0)); - Repository.getPlayers().add(aip); - aip.init(); - if (legion.isEmpty()) { - aip.setAttribute("aip_legion", legion); - } - legion.add(aip); - final Player l = last; - if (joinClan) { - if (player.getCommunication().getClan().enter(aip)) { - aip.getCommunication().setClan(player.getCommunication().getClan()); - } - if (player.getCommunication().getClan().getClanWar() != null) { - player.getCommunication().getClan().getClanWar().fireEvent("join", aip); - } - } - GameWorld.submit(new Pulse(1) { - @Override - public boolean pulse() { - aip.follow(l); - return true; - } - }); - if (message != null) { - aip.sendChat("The Dark Army marches again!"); - } - last = aip; - } - return true; - case "pvplegion": - size = args.length < 2 ? 10 : Integer.parseInt(args[1]); - last = player; - if (PVPAIPActions.pvp_players == null) { - player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>()); - } - for (int i = 0; i < size; i++) { - String aipName = PVPAIPBuilderUtils.names[i]; - final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player)); - aip.setControler(player); - aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); - Repository.getPlayers().add(aip); - aip.init(); - PVPAIPBuilderUtils.generateClass(aip); - - if (PVPAIPActions.pvp_players.isEmpty()) { - aip.setAttribute("aip_legion", PVPAIPActions.pvp_players); - } - PVPAIPActions.pvp_players.add(aip); - last = aip; - } - return true; - - case "resourcelegion": - size = args.length < 2 ? 10 : Integer.parseInt(args[1]); - last = player; - if (ResourceAIPActions.resource_players == null) { - player.setAttribute("aip_legion", ResourceAIPActions.resource_players = new ArrayList<>()); - } - for (int i = 0; i < size; i++) { - String aipName = PVPAIPBuilderUtils.names[i]; - final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player)); - aip.setControler(player); - aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); - Repository.getPlayers().add(aip); - aip.init(); - PVPAIPBuilderUtils.generateClass(aip); - - if (ResourceAIPActions.resource_players .isEmpty()) { - aip.setAttribute("aip_legion", ResourceAIPActions.resource_players ); - } - ResourceAIPActions.resource_players.add(aip); - last = aip; - } - return true; - case "syncresource": - ResourceAIPActions.syncBotThread(player); - break; - case "pvpfight": - PVPAIPActions.syncBotThread(player); - return true; + @Override + public boolean parse(final Player player, String name, String[] args) { + List legion = player.getAttribute("aip_legion"); + switch (name) { + case "desaip": + player.removeAttribute("aip_select"); + return true; + case "sellegion": + if (legion != null && !legion.isEmpty()) { + player.setAttribute("aip_select", legion.get(0)); + } + return true; + case "regroup": + Player last = player; + if (legion != null && !legion.isEmpty()) { + for (AIPlayer p : legion) { + p.follow(last); + last = p; + } + } + player.removeAttribute("aip_select"); + return true; + case "clearlegion": + if (legion != null && !legion.isEmpty()) { + for (AIPlayer p : legion) { + AIPlayer.deregister(p.getUid()); + } + legion.clear(); + } + player.removeAttribute("aip_select"); + player.removeAttribute("aip_legion"); + return true; + case "clearaips": + for (Player p : Repository.getPlayers()) { + if (p.isArtificial()) { + p.clear(); + } + } + return true; + case "aip": + name = args.length < 2 ? player.getName() : args[1]; + AIPlayer p = AIPBuilder.copy(player, name, player.getLocation().transform(0, 1, 0)); + Repository.getPlayers().add(p); + p.init(); + + Interaction.sendOption(player, 7, "Control"); + return true; + case "legion": + int size = args.length < 2 ? 10 : Integer.parseInt(args[1]); + last = player; + if (legion == null) { + player.setAttribute("aip_legion", legion = new ArrayList<>()); + } + Interaction.sendOption(player, 7, "Control"); + boolean joinClan = player.getCommunication().getClan() != null && !player.getCommunication().getClan().isDefault(); + String message = player.getName().equals("ethan") ? "The Dark Army marches again!" : null; // Add + // your + // own + // message + for (int i = 0; i < size; i++) { + final AIPlayer aip = AIPBuilder.copy(player, last.getLocation().transform(0, 1, 0)); + Repository.getPlayers().add(aip); + aip.init(); + if (legion.isEmpty()) { + aip.setAttribute("aip_legion", legion); + } + legion.add(aip); + final Player l = last; + if (joinClan) { + if (player.getCommunication().getClan().enter(aip)) { + aip.getCommunication().setClan(player.getCommunication().getClan()); + } + if (player.getCommunication().getClan().getClanWar() != null) { + player.getCommunication().getClan().getClanWar().fireEvent("join", aip); + } + } + GameWorld.submit(new Pulse(1) { + @Override + public boolean pulse() { + aip.follow(l); + return true; + } + }); + if (message != null) { + aip.sendChat("The Dark Army marches again!"); + } + last = aip; + } + return true; + case "pvplegion": + size = args.length < 2 ? 10 : Integer.parseInt(args[1]); + last = player; + if (PVPAIPActions.pvp_players == null) { + player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>()); + } + for (int i = 0; i < size; i++) { + String aipName = PVPAIPBuilderUtils.names[i]; + final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player)); + aip.setControler(player); + aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(aip); + aip.init(); + PVPAIPBuilderUtils.generateClass(aip); + + if (PVPAIPActions.pvp_players.isEmpty()) { + aip.setAttribute("aip_legion", PVPAIPActions.pvp_players); + } + PVPAIPActions.pvp_players.add(aip); + last = aip; + } + return true; + + case "resourcelegion": + size = args.length < 2 ? 10 : Integer.parseInt(args[1]); + last = player; + if (ResourceAIPActions.resource_players == null) { + player.setAttribute("aip_legion", ResourceAIPActions.resource_players = new ArrayList<>()); + } + for (int i = 0; i < size; i++) { + String aipName = PVPAIPBuilderUtils.names[i]; + final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player)); + aip.setControler(player); + aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); + Repository.getPlayers().add(aip); + aip.init(); + PVPAIPBuilderUtils.generateClass(aip); + + if (ResourceAIPActions.resource_players.isEmpty()) { + aip.setAttribute("aip_legion", ResourceAIPActions.resource_players); + } + ResourceAIPActions.resource_players.add(aip); + last = aip; + } + return true; + case "syncresource": + ResourceAIPActions.syncBotThread(player); + break; + case "pvpfight": + PVPAIPActions.syncBotThread(player); + return true; + + + case "bot": + PvMBotsBuilder.spawnLowest(player.getLocation()); + return true; + case "molebot": + PvMBotsBuilder.spawnGiantMoleBot(player.getLocation()); + return true; + case "slayerpoints": + player.getSlayer().setSlayerPoints(50000); + return true; + case "dragonbot": + PvMBotsBuilder.spawnDragonKiller(player.getLocation()); + return true; + case "pure": + player.getSkills().setStaticLevel(Skills.HITPOINTS, 60); + player.getSkills().setStaticLevel(Skills.RANGE, 95); + player.getSkills().setStaticLevel(Skills.MAGIC, 95); + player.getSkills().setStaticLevel(Skills.ATTACK, 50); + player.getSkills().setStaticLevel(Skills.STRENGTH, 93); + player.getSkills().setStaticLevel(Skills.DEFENCE, 1); + player.getSkills().setStaticLevel(Skills.PRAYER, 1); + player.getSkills().updateCombatLevel(); + return true; + case "noobbot": + PvMBotsBuilder.spawnNoob(player.getLocation()); + return true; + case "immersive": + PvMBotsBuilder.immersiveSpawns(); + AIPBuilder.immersiveSpawns(); + SkillingBotsBuilder.immersiveSpawnsSkillingBots(); + return true; + case "fishtest": + SkillingBotsBuilder.spawnTroutLumbridge("Bot", new Location(3241, 3242)); + return true; + case "varrockminebots": + SkillingBotsBuilder.spawnClayBotVarrock("clay", new Location(3181, 3368)); + SkillingBotsBuilder.spawnSilverBotVarrock("silver", new Location(3181, 3368)); + SkillingBotsBuilder.spawnIronBotVarrock("iron", new Location(3181, 3368)); + SkillingBotsBuilder.spawnTinBotVarrock("tin", new Location(3181, 3368)); + return true; + case "pvpbot": + PvPBotsBuilder.spawn(player.getLocation()); + return true; + case "pvpbots": + for (int amountBots = 0; amountBots < 50; amountBots++) { + PvPBotsBuilder.spawn(player.getLocation()); + } + return true; + case "removetask": + if (!player.getSlayer().hasTask()) { + player.sendMessage("You don't have an active task right now."); + return true; + } else { + player.getSlayer().clear(); + player.sendMessage("You have canceled your current task."); + return true; + } + case "pesttest": + int arg2; + try { + arg2 = Integer.parseInt(args[1]); + } catch (Exception e) { + arg2 = 1; + } + for (int pestBotsAmount = 0; pestBotsAmount < arg2; pestBotsAmount++) { + PvMBotsBuilder.spawnPestControlTestBot(player.getLocation()); + } + return true; + case "bots": + int arg = 1; + int xpos = 0; + int ypos = 0; + try { + arg = Integer.parseInt(args[1]); + } catch (Exception e) { + System.out.println("Rip " + args[1]); + } + for (int amountBots2 = 0; amountBots2 < arg; amountBots2++) { + xpos = 2500 + RandomFunction.getRandom(1000); + ypos = 3000 + RandomFunction.getRandom(500); + PvMBotsBuilder.spawnNoob(new Location(xpos, ypos)); + } + System.out.println((xpos) + " " + (ypos)); + return true; /* Start regular bots */ - case "manthiev": - new GeneralBotCreator("Bot", player.getLocation(), new ManThiever()); - break; + case "manthiev": + new GeneralBotCreator("Bot", player.getLocation(), new ManThiever()); + break; + case "fish": + new GeneralBotCreator("Fisher", Location.create(2805, 3435, 0), new LobsterCatcher()); + break; - } - return false; - } - - private Location generateLocation(Player player) { - Location random_location = player.getLocation().transform(RandomFunction.random(-15, 15), RandomFunction.random(-15, 15), 0); - if (!RegionManager.isTeleportPermitted(random_location)) { - return generateLocation(player); - } - if (!Pathfinder.find(player, random_location, false, Pathfinder.DUMB).isSuccessful()) { - return generateLocation(player); - } - if (RegionManager.getObject(random_location) != null) { - return generateLocation(player); - } - return random_location; - } + } + return false; + } + + private Location generateLocation(Player player) { + Location random_location = player.getLocation().transform(RandomFunction.random(-15, 15), RandomFunction.random(-15, 15), 0); + if (!RegionManager.isTeleportPermitted(random_location)) { + return generateLocation(player); + } + if (!Pathfinder.find(player, random_location, false, Pathfinder.DUMB).isSuccessful()) { + return generateLocation(player); + } + if (RegionManager.getObject(random_location) != null) { + return generateLocation(player); + } + return random_location; + } }