Fixed clan contribution points decreasing clan exp.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment 2021-12-17 18:05:56 +00:00
parent b73c6387bd
commit b25618c95c
6 changed files with 64 additions and 38 deletions

View File

@ -156,9 +156,10 @@ public class AdminPledge implements IAdminCommandHandler
}
final int level = Integer.parseInt(param);
if ((level >= 0) && (level < 12))
if ((level >= 0) && (level <= (Clan.EXP_TABLE.length - 1)))
{
clan.changeLevel(level);
clan.setExp(activeChar.getObjectId(), Clan.EXP_TABLE[level]);
for (Player member : clan.getOnlineMembers(0))
{
member.broadcastUserInfo(UserInfoType.RELATION, UserInfoType.CLAN);

View File

@ -121,6 +121,21 @@ public class Clan implements IIdentifiable, INamable
/** Clan subunit type of Order of Knights B-2 */
public static final int SUBUNIT_KNIGHT4 = 2002;
public static final int[] EXP_TABLE =
{
0,
100,
1000,
5000,
100000,
500000,
1500000,
4500000,
7500000,
11000000,
14500000
};
private String _name;
private int _clanId;
private ClanMember _leader;
@ -156,21 +171,7 @@ public class Clan implements IIdentifiable, INamable
private int _reputationScore = 0;
private int _rank = 0;
private int _exp;
private static final int[] EXP_TABLE =
{
100,
1000,
5000,
100000,
500000,
1500000,
4500000,
7500000,
11000000,
14500000
};
private int _exp = 0;
private String _notice;
private boolean _noticeEnabled = false;
@ -3114,7 +3115,7 @@ public class Clan implements IIdentifiable, INamable
_exp += value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
if ((EXP_TABLE[Math.max(0, getLevel() - 1)]) <= _exp)
if (((EXP_TABLE[Math.max(0, getLevel() + 1)]) <= _exp))
{
changeLevel(_level + 1);
}
@ -3127,4 +3128,15 @@ public class Clan implements IIdentifiable, INamable
updateClanInDB();
}
}
public void setExp(int objId, int value)
{
_exp = value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
final int contribution = getClanContribution(objId);
setClanContribution(objId, contribution + value);
setClanContributionWeekly(objId, contribution + value);
updateClanInDB();
}
}

View File

@ -79,7 +79,7 @@ public class RequestExPledgeDonationRequest implements IClientIncomingPacket
{
if (player.getInventory().destroyItemByItemId("pledge donation", Inventory.LCOIN_ID, 100, player, null) != null)
{
clan.addExp(player.getObjectId(), 100, true);
clan.addExp(player.getObjectId(), 30, true);
player.setHonorCoins(player.getHonorCoins() + 100);
}
else
@ -99,7 +99,7 @@ public class RequestExPledgeDonationRequest implements IClientIncomingPacket
{
if (player.getInventory().destroyItemByItemId("pledge donation", Inventory.LCOIN_ID, 500, player, null) != null)
{
clan.addExp(player.getObjectId(), 500, true);
clan.addExp(player.getObjectId(), 150, true);
player.setHonorCoins(player.getHonorCoins() + 500);
}
else

View File

@ -156,9 +156,10 @@ public class AdminPledge implements IAdminCommandHandler
}
final int level = Integer.parseInt(param);
if ((level >= 0) && (level < 12))
if ((level >= 0) && (level <= (Clan.EXP_TABLE.length - 1)))
{
clan.changeLevel(level);
clan.setExp(activeChar.getObjectId(), Clan.EXP_TABLE[level]);
for (Player member : clan.getOnlineMembers(0))
{
member.broadcastUserInfo(UserInfoType.RELATION, UserInfoType.CLAN);

View File

@ -121,6 +121,21 @@ public class Clan implements IIdentifiable, INamable
/** Clan subunit type of Order of Knights B-2 */
public static final int SUBUNIT_KNIGHT4 = 2002;
public static final int[] EXP_TABLE =
{
0,
100,
1000,
5000,
100000,
500000,
1500000,
4500000,
7500000,
11000000,
14500000
};
private String _name;
private int _clanId;
private ClanMember _leader;
@ -156,21 +171,7 @@ public class Clan implements IIdentifiable, INamable
private int _reputationScore = 0;
private int _rank = 0;
private int _exp;
private static final int[] EXP_TABLE =
{
100,
1000,
5000,
100000,
500000,
1500000,
4500000,
7500000,
11000000,
14500000
};
private int _exp = 0;
private String _notice;
private boolean _noticeEnabled = false;
@ -3114,7 +3115,7 @@ public class Clan implements IIdentifiable, INamable
_exp += value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
if ((EXP_TABLE[Math.max(0, getLevel() - 1)]) <= _exp)
if (((EXP_TABLE[Math.max(0, getLevel() + 1)]) <= _exp))
{
changeLevel(_level + 1);
}
@ -3127,4 +3128,15 @@ public class Clan implements IIdentifiable, INamable
updateClanInDB();
}
}
public void setExp(int objId, int value)
{
_exp = value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
final int contribution = getClanContribution(objId);
setClanContribution(objId, contribution + value);
setClanContributionWeekly(objId, contribution + value);
updateClanInDB();
}
}

View File

@ -79,7 +79,7 @@ public class RequestExPledgeDonationRequest implements IClientIncomingPacket
{
if (player.getInventory().destroyItemByItemId("pledge donation", Inventory.LCOIN_ID, 100, player, null) != null)
{
clan.addExp(player.getObjectId(), 100, true);
clan.addExp(player.getObjectId(), 30, true);
player.setHonorCoins(player.getHonorCoins() + 100);
}
else
@ -99,7 +99,7 @@ public class RequestExPledgeDonationRequest implements IClientIncomingPacket
{
if (player.getInventory().destroyItemByItemId("pledge donation", Inventory.LCOIN_ID, 500, player, null) != null)
{
clan.addExp(player.getObjectId(), 500, true);
clan.addExp(player.getObjectId(), 150, true);
player.setHonorCoins(player.getHonorCoins() + 500);
}
else