-
Notifications
You must be signed in to change notification settings - Fork 69
Add PvP bots for Clan Wars Free-For-All #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7eec454
14cd8e9
72a7b6a
50ecf1d
4d84b79
1f0f121
28ebe69
1d16a59
95c63f3
dc728e3
6c670f0
a975716
ac2ea43
46529be
5a40793
08ebf81
44068fa
5409e8b
8822021
da202fa
43cfd24
8663b12
04b92b2
5154071
ec51a6d
c6582ea
3106625
389f08a
569b521
62b9cf3
d3af568
7d07669
36b3ed5
2de3f31
bee8cf0
5bfc1ac
0950683
f6a31d5
f21ca5e
43e92dd
d5627ec
da6beab
5d17dbb
d825125
46d88c3
a8abebf
b1b47c5
528c7da
0e86324
25971f2
4b582a3
1281f87
4c45971
8164080
d1dd090
530d2aa
3942bf5
fd9d780
37efa4e
a150888
b0f7d6f
40395d3
8197526
a3f4be6
405344c
36ce967
67eaeeb
d5781a6
e88a08a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| [clan_wars_arenas] | ||
| row_id = "string" | ||
| spawn_area = "string" | ||
| tiers = "list<string>" | ||
|
|
||
| [.clan_wars_ffa_safe] | ||
| spawn_area = "clan_wars_teleport" | ||
| tiers = [ | ||
| "clan_wars_ffa_safe_zerker", | ||
| "clan_wars_ffa_safe_dharoker", | ||
| "clan_wars_ffa_safe_ags_main", | ||
| "clan_wars_ffa_safe_obby_pure", | ||
| "clan_wars_ffa_safe_msb_pure", | ||
| "clan_wars_ffa_safe_karils_tank", | ||
| "clan_wars_ffa_safe_ancient_tank", | ||
| "clan_wars_ffa_safe_ancient_hybrid", | ||
| ] | ||
|
|
||
| [.clan_wars_ffa_dangerous] | ||
| spawn_area = "clan_wars_teleport" | ||
| tiers = [ | ||
| "clan_wars_ffa_dangerous_melee", | ||
| "clan_wars_ffa_dangerous_ranged", | ||
| "clan_wars_ffa_dangerous_magic", | ||
| "clan_wars_ffa_dangerous_hybrid", | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| [clan_wars_tiers] | ||
| row_id = "string" | ||
| combat_style = "string" | ||
| skills = "list<string>" | ||
| levels = "list<int>" | ||
|
|
||
| [.clan_wars_ffa_safe_zerker] | ||
| combat_style = "slash" | ||
| skills = ["attack", "strength", "defence", "constitution", "prayer"] | ||
| levels = [60, 80, 45, 75, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_dharoker] | ||
| combat_style = "slash" | ||
| skills = ["attack", "strength", "defence", "constitution", "prayer"] | ||
| levels = [70, 70, 70, 70, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_ags_main] | ||
| combat_style = "slash" | ||
| skills = ["attack", "strength", "defence", "constitution", "prayer"] | ||
| levels = [75, 85, 75, 85, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_obby_pure] | ||
| combat_style = "crush" | ||
| skills = ["attack", "strength", "defence", "constitution"] | ||
| levels = [1, 80, 1, 70] | ||
|
|
||
| [.clan_wars_ffa_safe_msb_pure] | ||
| combat_style = "rapid" | ||
| skills = ["attack", "strength", "defence", "constitution", "ranged", "prayer"] | ||
| levels = [1, 1, 1, 70, 70, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_karils_tank] | ||
| combat_style = "rapid" | ||
| skills = ["attack", "strength", "defence", "constitution", "ranged", "prayer"] | ||
| levels = [1, 1, 70, 75, 75, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_ancient_tank] | ||
| combat_style = "accurate" | ||
| skills = ["magic", "defence", "constitution", "prayer"] | ||
| levels = [94, 70, 80, 95] | ||
|
|
||
| [.clan_wars_ffa_safe_ancient_hybrid] | ||
| combat_style = "accurate" | ||
| skills = ["magic", "attack", "strength", "ranged", "defence", "constitution", "prayer"] | ||
| levels = [94, 75, 80, 75, 70, 85, 95] | ||
|
|
||
| [.clan_wars_ffa_dangerous_melee] | ||
| combat_style = "slash" | ||
| skills = ["attack", "strength", "defence", "constitution", "prayer", "magic"] | ||
| levels = [60, 70, 40, 70, 95, 94] | ||
|
|
||
| [.clan_wars_ffa_dangerous_ranged] | ||
| combat_style = "rapid" | ||
| skills = ["ranged", "defence", "constitution", "prayer"] | ||
| levels = [70, 40, 70, 95] | ||
|
|
||
| [.clan_wars_ffa_dangerous_magic] | ||
| combat_style = "accurate" | ||
| skills = ["magic", "defence", "constitution", "prayer"] | ||
| levels = [94, 40, 70, 95] | ||
|
|
||
| [.clan_wars_ffa_dangerous_hybrid] | ||
| combat_style = "slash" | ||
| skills = ["attack", "strength", "ranged", "magic", "defence", "constitution", "prayer"] | ||
| levels = [75, 80, 75, 94, 60, 80, 95] | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| [clan_wars_ffa_safe_zerker] | ||
| template = "pvp_zerker" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_dharoker] | ||
| template = "pvp_dharoker" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_ags_main] | ||
| template = "pvp_ags_main" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_obby_pure] | ||
| template = "pvp_obby_pure" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_msb_pure] | ||
| template = "pvp_msb_pure" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_karils_tank] | ||
| template = "pvp_karils_tank" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_ancient_tank] | ||
| template = "pvp_ancient_tank" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_safe_ancient_hybrid] | ||
| template = "pvp_ancient_hybrid" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { area = "clan_wars_ffa_safe_arena", safe_area = "clan_wars_ffa_safe_lobby" } | ||
|
|
||
| [clan_wars_ffa_dangerous_melee] | ||
| template = "pvp_dangerous_melee" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_dangerous_arena", safe_area = "clan_wars_ffa_dangerous_lobby" } | ||
| reactive = [ | ||
| { interface = { option = "Wear", id = "inventory:inventory:games_necklace_6", if = { pvp_retreat_needed = {} }, success = { any = [{ area = { id = "clan_wars_teleport" } }, { equipment = { amulet = { id = "games_necklace_*" } } }] } } }, | ||
| { jewellery_teleport = { item = "games_necklace_6", area = "clan_wars_teleport", if = { pvp_retreat_needed = {} }, success = { area = { id = "clan_wars_teleport" } } } }, | ||
| ] | ||
|
|
||
| [clan_wars_ffa_dangerous_ranged] | ||
| template = "pvp_dangerous_ranged" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { style = "style2", area = "clan_wars_ffa_dangerous_arena", safe_area = "clan_wars_ffa_dangerous_lobby" } | ||
| reactive = [ | ||
| { interface = { option = "Wear", id = "inventory:inventory:games_necklace_6", if = { pvp_retreat_needed = {} }, success = { any = [{ area = { id = "clan_wars_teleport" } }, { equipment = { amulet = { id = "games_necklace_*" } } }] } } }, | ||
| { jewellery_teleport = { item = "games_necklace_6", area = "clan_wars_teleport", if = { pvp_retreat_needed = {} }, success = { area = { id = "clan_wars_teleport" } } } }, | ||
| ] | ||
|
|
||
| [clan_wars_ffa_dangerous_magic] | ||
| template = "pvp_dangerous_magic" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { area = "clan_wars_ffa_dangerous_arena", safe_area = "clan_wars_ffa_dangerous_lobby" } | ||
| reactive = [ | ||
| { interface = { option = "Wear", id = "inventory:inventory:games_necklace_6", if = { pvp_retreat_needed = {} }, success = { any = [{ area = { id = "clan_wars_teleport" } }, { equipment = { amulet = { id = "games_necklace_*" } } }] } } }, | ||
| { jewellery_teleport = { item = "games_necklace_6", area = "clan_wars_teleport", if = { pvp_retreat_needed = {} }, success = { area = { id = "clan_wars_teleport" } } } }, | ||
| ] | ||
|
|
||
| [clan_wars_ffa_dangerous_hybrid] | ||
| template = "pvp_dangerous_hybrid" | ||
| capacity = 3 | ||
| timeout = 500 | ||
| fields = { area = "clan_wars_ffa_dangerous_arena", safe_area = "clan_wars_ffa_dangerous_lobby" } | ||
| reactive = [ | ||
| { interface = { option = "Wear", id = "inventory:inventory:games_necklace_6", if = { pvp_retreat_needed = {} }, success = { any = [{ area = { id = "clan_wars_teleport" } }, { equipment = { amulet = { id = "games_necklace_*" } } }] } } }, | ||
| { jewellery_teleport = { item = "games_necklace_6", area = "clan_wars_teleport", if = { pvp_retreat_needed = {} }, success = { area = { id = "clan_wars_teleport" } } } }, | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| [teleport_clan_wars_games_necklace] | ||
| weight = 100 | ||
| requires = [ | ||
| { equipment = { amulet = { id = "games_necklace_8" } } }, | ||
| ] | ||
| actions = [ | ||
| { interface = { option = "Clan Wars", id = "worn_equipment:amulet_slot:games_necklace_8" } }, | ||
| { wait = { ticks = 5 } }, | ||
| ] | ||
| produces = [ | ||
| { area = "clan_wars_teleport" }, | ||
| ] | ||
|
|
||
| [enter_clan_wars_ffa_safe] | ||
| weight = -10 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think the weight needs to be negative, 0 would be fine? |
||
| requires = [ | ||
| { combat_level = { min = 30 } }, | ||
| { area = { id = "clan_wars_teleport" } }, | ||
| ] | ||
| actions = [ | ||
| { object = { option = "Enter", id = "clan_wars_portal_ffa_safe", radius = 15, success = { any = [{ interface_open = { id = "warning_clan_wars_ffa_safe" } }, { area = { id = "clan_wars_ffa_safe_lobby" } }, { area = { id = "clan_wars_ffa_safe_arena" } }] } } }, | ||
| { interface = { option = "Go in", id = "warning_clan_wars_ffa_safe:yes", if = { interface_open = { id = "warning_clan_wars_ffa_safe" } }, success = { any = [{ area = { id = "clan_wars_ffa_safe_lobby" } }, { area = { id = "clan_wars_ffa_safe_arena" } }] } } }, | ||
| { tile = { x = 2815, y = 5515, radius = 2 } }, | ||
| ] | ||
| produces = [ | ||
| { area = "clan_wars_ffa_safe_arena" }, | ||
| ] | ||
|
|
||
| [enter_clan_wars_ffa_safe_from_lobby] | ||
| weight = -10 | ||
| requires = [ | ||
| { combat_level = { min = 30 } }, | ||
| { area = { id = "clan_wars_ffa_safe_lobby" } }, | ||
| ] | ||
| actions = [ | ||
| { tile = { x = 2815, y = 5515, radius = 2 } }, | ||
| ] | ||
| produces = [ | ||
| { area = "clan_wars_ffa_safe_arena" }, | ||
| ] | ||
|
|
||
| [enter_clan_wars_ffa_dangerous] | ||
| weight = -10 | ||
| requires = [ | ||
| { combat_level = { min = 30 } }, | ||
| { area = { id = "clan_wars_teleport" } }, | ||
| ] | ||
| actions = [ | ||
| { object = { option = "Enter", id = "clan_wars_portal_ffa_dangerous", radius = 15, success = { any = [{ interface_open = { id = "warning_clan_wars_ffa_safe" } }, { area = { id = "clan_wars_ffa_dangerous_lobby" } }, { area = { id = "clan_wars_ffa_dangerous_arena" } }] } } }, | ||
| { interface = { option = "Go in", id = "warning_clan_wars_ffa_safe:yes", if = { interface_open = { id = "warning_clan_wars_ffa_safe" } }, success = { any = [{ area = { id = "clan_wars_ffa_dangerous_lobby" } }, { area = { id = "clan_wars_ffa_dangerous_arena" } }] } } }, | ||
| { tile = { x = 3007, y = 5515, radius = 2 } }, | ||
| ] | ||
| produces = [ | ||
| { area = "clan_wars_ffa_dangerous_arena" }, | ||
| ] | ||
|
|
||
| [enter_clan_wars_ffa_dangerous_from_lobby] | ||
| weight = -10 | ||
| requires = [ | ||
| { combat_level = { min = 30 } }, | ||
| { area = { id = "clan_wars_ffa_dangerous_lobby" } }, | ||
| ] | ||
| actions = [ | ||
| { tile = { x = 3007, y = 5515, radius = 2 } }, | ||
| ] | ||
| produces = [ | ||
| { area = "clan_wars_ffa_dangerous_arena" }, | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,8 @@ class CharacterIndexMap(size: Int) { | |
| /** | ||
| * Table mapping tiles to sets | ||
| */ | ||
| private val table = Int2ObjectOpenHashMap<MutableSet<Int>>(size) | ||
| @PublishedApi | ||
| internal val table = Int2ObjectOpenHashMap<MutableSet<Int>>(size) | ||
|
|
||
| /** | ||
| * Which tile set the index is currently in | ||
|
|
@@ -51,8 +52,11 @@ class CharacterIndexMap(size: Int) { | |
| current.fill(INVALID) | ||
| } | ||
|
|
||
| fun onEach(id: Int, action: (Int) -> Unit) { | ||
| table.get(id)?.onEach(action) | ||
| inline fun onEach(id: Int, action: (Int) -> Unit) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again with the inline and public, keep these things private |
||
| val set = table.get(id) ?: return | ||
| for (index in set) { | ||
| action(index) | ||
| } | ||
| } | ||
|
|
||
| companion object { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,9 +9,9 @@ import world.gregs.voidps.type.Zone | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| object Players : Iterable<Player>, CharacterSearch<Player> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private val players = mutableListOf<Player>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private val indexArray: Array<Player?> = arrayOfNulls(MAX_PLAYERS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PublishedApi internal val indexArray: Array<Player?> = arrayOfNulls(MAX_PLAYERS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private var indexer = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private val map = CharacterIndexMap(MAX_PLAYERS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PublishedApi internal val map = CharacterIndexMap(MAX_PLAYERS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val size: Int | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| get() = players.size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -71,6 +71,34 @@ object Players : Iterable<Player>, CharacterSearch<Player> { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Non-allocating chebyshev-radius scan centred on [center]. Iterates only the zones whose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * bounds overlap `[center.x ± radius]` × `[center.y ± radius]` on [center]'s level, then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * filters each zone's players by exact tile bounds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Dramatically cheaper than calling [at] per-tile in a spiral: one zone lookup per overlapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * zone (≤ 25 for radius 15) versus 961 tile lookups each scanning the full zone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inline fun forEachInRadius(center: Tile, radius: Int, action: (Player) -> Unit) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't need to be inline? and indexArray/map can stay private |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val minZx = (center.x - radius) shr 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val maxZx = (center.x + radius) shr 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val minZy = (center.y - radius) shr 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val maxZy = (center.y + radius) shr 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val level = center.level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (zx in minZx..maxZx) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (zy in minZy..maxZy) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| map.onEach(Zone.id(zx, zy, level)) { index -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val player = indexArray[index] ?: return@onEach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val dx = player.tile.x - center.x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (dx < -radius || dx > radius) return@onEach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val dy = player.tile.y - center.y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (dy < -radius || dy > radius) return@onEach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action(player) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+83
to
+99
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Double check this behaviour)
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fun clear() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (player in this) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Despawn.player(player) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.