Jump to content

API

Pending 3.0.5

IIIaKa
IIIaKa

Posted (edited)

@nivex
Hello.

  1. In the latest version(or possibly earlier), I noticed that you changed the arguments for the OnRaidableDespawnUpdate hook, and unfortunately despawnDateTime is no longer among them. Could you please add it back as the last argument?
  2. I noticed that the API method GetAllEvents now uses a string mode instead of an int mode. Could you please change it back? "raid.Options.Mode" instead of "raid.Options.Level".

Thanks in advance!

Edited by IIIaKa
nivex

Posted (edited)

Hi, I've added the despawnDateTime back to the hook. 

As for GetAllEvents, this will not work, and the code you're referencing needs to be updated in RealPve.

public enum RaidableMode { Disabled = -1, Easy = 0, Medium = 1, Hard = 2, Expert = 3, Nightmare = 4, Points = 8888, Random = 9999 }

This enum is no longer used, everything is dynamic now, and pulled from the profiles.

As of version 3.0.0 (released February 6, 2025), dynamic difficulties were introduced with the rb.difficulty command. This allows users to:

  • Rename any difficulty
  • Remove any difficulty
  • Add unlimited additional difficulties

Here are some examples of what this means:

  • Users may change the name Easy to Beginner
  • Users may change Easy level from 0 to 10
  • Users may add a new difficulty, using any name, and any level.
  • There is no limit. They can create as many new difficulties as they like. I've seen upwards of 20, and as few as 2.

 

        [HookMethod("GetAllEvents")]
        public List<(Vector3 pos, string mode, int level, bool allowPVP, string a, float b, float c, float loadTime, ulong ownerId, BasePlayer owner, List<BasePlayer> raiders, List<BasePlayer> intruders, HashSet<BaseEntity> entities, string baseName, DateTime spawnDateTime, DateTime despawnDateTime, float radius, int lootRemaining)> GetAllEvents(Vector3 position, float x = 0f)
        {
            return new(Raids.Select(raid => (raid.Location, raid.Options.Mode, raid.Options.Level, raid.AllowPVP, raid.ID, 0f, 0f, raid.loadTime, raid.ownerId, raid.GetOwner(), raid.GetRaiders(), raid.GetIntruders(), raid.Entities, raid.BaseName, raid.spawnDateTime, raid.despawnDateTime, raid.ProtectionRadius, raid.GetLootAmountRemaining())));
        }

        [HookMethod("GetAllDifficulties")]
        public List<(string mode, int level)> GetAllDifficulties()
        {
            return new(Buildings.Profiles.Select(x => (x.Value.Options.Mode, x.Value.Options.Level)));
        }

 

I've made the above change to GetAllEvents, to include the mode and the level, and added a new method.

The solution is simple. 

Allow the user to map the difficulty mode to a level in your configuration file, and use the GetAllEvents API to match with that configuration.

I've included an additional GetAllDifficulties API for you for ease of use, allowing you to easily create a default mapping in your configuration. But, it is still required that the user map them in your configuration file whenever they make changes in the future.

Edited by nivex
1.9m

Downloads

Total number of downloads.

8.9k

Customers

Total customers served.

131.4k

Files Sold

Total number of files sold.

2.7m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.