diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 114119274f..1fc9afb87e 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -33,6 +33,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.runelite.api.annotations.VisibleForDevtools; import net.runelite.api.annotations.VisibleForExternalPlugins; +import net.runelite.api.clan.ClanChannel; +import net.runelite.api.clan.ClanSettings; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import net.runelite.api.hooks.Callbacks; @@ -1824,4 +1826,32 @@ public interface Client extends GameEngine * @return */ int getCrossWorldMessageIdsIndex(); + + /** + * Get the primary clan channel the player is in. + * @return + */ + @Nullable + ClanChannel getClanChannel(); + + /** + * Get the guest clan channel the player is in. + * @return + */ + @Nullable + ClanChannel getGuestClanChannel(); + + /** + * Get clan settings for the clan the user is in. + * @return + */ + @Nullable + ClanSettings getClanSettings(); + + /** + * Get the guest clan's settings. + * @return + */ + @Nullable + ClanSettings getGuestClanSettings(); } diff --git a/runelite-api/src/main/java/net/runelite/api/EnumID.java b/runelite-api/src/main/java/net/runelite/api/EnumID.java index 2c2fcecb87..e5ffc4b92a 100644 --- a/runelite-api/src/main/java/net/runelite/api/EnumID.java +++ b/runelite-api/src/main/java/net/runelite/api/EnumID.java @@ -35,4 +35,6 @@ public final class EnumID public static final int MUSIC_TRACK_IDS = 819; public static final int XPDROP_COLORS = 1169; public static final int FRIENDS_CHAT_RANK_ICONS = 1543; + public static final int CLAN_RANK_NAME = 3797; + public static final int CLAN_RANK_GRAPHIC = 3798; } diff --git a/runelite-api/src/main/java/net/runelite/api/Player.java b/runelite-api/src/main/java/net/runelite/api/Player.java index e6ae715a7d..2b7d5a04d7 100644 --- a/runelite-api/src/main/java/net/runelite/api/Player.java +++ b/runelite-api/src/main/java/net/runelite/api/Player.java @@ -71,6 +71,13 @@ public interface Player extends Actor */ boolean isFriend(); + /** + * Checks whether the player is a member of the same clan as the local player. + * + * @return + */ + boolean isClanMember(); + /** * Gets the displayed overhead icon of the player. * diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanChannel.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanChannel.java new file mode 100644 index 0000000000..7f2bba0d28 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanChannel.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +import java.util.List; +import javax.annotation.Nullable; + +/** + * A clan channel. + */ +public interface ClanChannel +{ + /** + * The name of the channel + * @return + */ + String getName(); + + /** + * The members currently online in the channel. + * @return + */ + List getMembers(); + + /** + * Find a clan member by name + * @param name + * @return + */ + @Nullable + ClanChannelMember findMember(String name); +} diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanChannelMember.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanChannelMember.java new file mode 100644 index 0000000000..be01248f76 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanChannelMember.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +import net.runelite.api.ChatPlayer; + +/** + * A member of a clan channel + */ +public interface ClanChannelMember extends ChatPlayer +{ + /** + * The member name + * @return + */ + String getName(); + + /** + * The member's rank relative to the other members. To get the member title, + * see ClanSettings. + * @see ClanRank + * @see ClanSettings#titleForRank(ClanRank) + * @return + */ + ClanRank getRank(); + + /** + * The world the member is on + * @return + */ + int getWorld(); +} diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanMember.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanMember.java new file mode 100644 index 0000000000..896939a505 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanMember.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +import lombok.Value; + +/** + * A member of a clan. + */ +@Value +public class ClanMember +{ + /** + * The clan member's name + */ + String name; + + /** + * The clan member's rank + */ + ClanRank rank; +} diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanRank.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanRank.java new file mode 100644 index 0000000000..05175059fa --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanRank.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +/** + * The ranks in a clan. Clan ranks 1-14 are mapped to corresponding titles via + * the clan settings. + */ +public enum ClanRank +{ + GUEST, + CLAN_RANK_1, + CLAN_RANK_2, + CLAN_RANK_3, + CLAN_RANK_4, + CLAN_RANK_5, + CLAN_RANK_6, + CLAN_RANK_7, + CLAN_RANK_8, + CLAN_RANK_9, + CLAN_RANK_10, + ADMINISTRATOR, + CLAN_RANK_11, + CLAN_RANK_12, + CLAN_RANK_13, + CLAN_RANK_14, + DEPUTY_OWNER, + OWNER, + JMOD; +} diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanSettings.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanSettings.java new file mode 100644 index 0000000000..c24f6ec23f --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanSettings.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +import java.util.List; +import javax.annotation.Nullable; + +/** + * A clan's settings. + */ +public interface ClanSettings +{ + /** + * The clan name + * @return + */ + String getName(); + + /** + * The members of the clan. This includes all members, whether online or offline. + * @return + */ + List getMembers(); + + /** + * Find a member of the clan. + * @param name + * @return + */ + @Nullable + ClanMember findMember(String name); + + /** + * Get the clan title for a clan rank. + * @param clanRank the rank + * @see ClanRank + * @return + */ + ClanTitle titleForRank(ClanRank clanRank); +} diff --git a/runelite-api/src/main/java/net/runelite/api/clan/ClanTitle.java b/runelite-api/src/main/java/net/runelite/api/clan/ClanTitle.java new file mode 100644 index 0000000000..3c6daee6d7 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/clan/ClanTitle.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api.clan; + +import lombok.Value; + +/** + * A clan title, such as Owner, Administrator, Anchor, etc. + */ +@Value +public class ClanTitle +{ + /** + * The id of the title + */ + int id; + /** + * The name of the title + */ + String name; +}