Add guild join time tracking for leaderboard qualification

This commit is contained in:
AconiteGodOfSWG
2021-02-14 21:11:31 -05:00
parent 026f80f855
commit 788a36dc3b
2 changed files with 20 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ public class fishing extends script.base_script {
public static final String OBJVAR_ELUSIVE_FISH_COUNT_TABLE_MADE = "elusive_fish.count_table_made";
public static final String OBJVAR_ELUSIVE_FISH_COUNT_TOTAL= "elusive_fish.count_rewarded_total";
public static final String OBJVAR_PLANET_OBJECT_REFERENCE = "master_fishing_object";
public static final String OBJVAR_LARGEST_FISH_CAUGHT_THIS_PERIOD = "fishing.record_fish_current_max";
/**
* getMasterFishingObject
@@ -322,4 +323,20 @@ public class fishing extends script.base_script {
return d;
}
/**
* Determines if you are eligible to contribute to your city's fishing score in the current period
* Based on the requirement that: You must have a declared residence in the city, and you must not have moved during the current period
*/
public static boolean isCityMemberEligibleToContributeToCityFishingScore(obj_id player) throws InterruptedException {
return (getCitizenOfCityId(player) > 0) && (getIntObjVar(player, player_structure.VAR_RESIDENCE_CAN_DECLARE) > (getGameTime() + 25200));
}
/**
* Determines if you are eligible to contribute to your guild's fishing score in the current period
* Based on the requirement that you must be a member of a guild and held that membership for longer than the current period
*/
public static boolean isGuildMemberEligibleToContributeToGuildFishingScore(obj_id player) throws InterruptedException {
return (getGuildId(player) > 0) && (getIntObjVar(player, guild.VAR_TIME_JOINED_CURRENT_GUILD) > (getGameTime() + 25200));
}
}

View File

@@ -234,6 +234,8 @@ public class guild extends script.base_script
public static final int INTERFACE_GUILD_PERMISSION_LIST = 4;
public static final int INTERFACE_GUILD_ELECTION = 5;
public static final int INTERFACE_GUILD_WAR_PREFERENCES = 6;
public static final String VAR_TIME_JOINED_CURRENT_GUILD = "guild.timeJoinedCurrentGuild";
public static String resolveGuildName(int guildId) throws InterruptedException
{
if (guildId != 0)
@@ -517,6 +519,7 @@ public class guild extends script.base_script
messageTo(memberId, "onGuildSponsorVerifyResponseProse", dict2, 0, false);
mailToGuild(guildId, GUILD_MAIL_ACCEPT_SUBJECT, GUILD_MAIL_ACCEPT_TEXT, getName(actor), memberName);
guildSetMemberPermissionAndAllegiance(guildId, memberId, GUILD_PERMISSION_MEMBER, guildGetLeader(guildId));
setObjVar(memberId, VAR_TIME_JOINED_CURRENT_GUILD, getGameTime());
mailToPerson(guildId, memberName, GUILD_MAIL_ACCEPT_TARGET_SUBJECT, GUILD_MAIL_ACCEPT_TARGET_TEXT, getName(actor), guildGetName(guildId));
messageTo(memberId, "onGuildCreateTerminalDataObject", null, 0, false);
}