Removal of pledge bonus system.
Contributed by NviX.
This commit is contained in:
parent
695a2dd7f0
commit
59e4e2a322
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ClanReward.xsd">
|
||||
<membersOnline>
|
||||
<players size="10" level="1">
|
||||
<skill id="23774" level="1" /> <!-- Clan Teamwork - Stage 1 -->
|
||||
</players>
|
||||
<players size="20" level="2">
|
||||
<skill id="23775" level="1" /> <!-- Clan Teamwork - Stage 2 -->
|
||||
</players>
|
||||
<players size="30" level="3">
|
||||
<skill id="23776" level="1" /> <!-- Clan Teamwork - Stage 3 -->
|
||||
</players>
|
||||
<players size="40" level="4">
|
||||
<skill id="23777" level="1" /> <!-- Clan Teamwork - Stage 4 -->
|
||||
</players>
|
||||
</membersOnline>
|
||||
<huntingBonus>
|
||||
<hunting points="28800000" level="1">
|
||||
<item id="27589" count="1" /> <!-- Supply Box - Standard -->
|
||||
</hunting>
|
||||
<hunting points="57600000" level="2">
|
||||
<item id="27590" count="1" /> <!-- Supply Box - Mid-grade -->
|
||||
</hunting>
|
||||
<hunting points="86400000" level="3">
|
||||
<item id="27591" count="1" /> <!-- Supply Box - High-grade -->
|
||||
</hunting>
|
||||
<hunting points="115200000" level="4">
|
||||
<item id="27663" count="1" /> <!-- Supply Box - Top-grade -->
|
||||
</hunting>
|
||||
</huntingBonus>
|
||||
</list>
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanHallData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanShopData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClassListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CombinationItemsData;
|
||||
@ -241,7 +240,6 @@ public class GameServer
|
||||
SecondaryAuthData.getInstance();
|
||||
CombinationItemsData.getInstance();
|
||||
SayuneData.getInstance();
|
||||
ClanRewardData.getInstance();
|
||||
DailyMissionHandler.getInstance().executeScript();
|
||||
DailyMissionData.getInstance();
|
||||
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanRewardData.class.getName());
|
||||
private final Map<ClanRewardType, List<ClanRewardBonus>> _clanRewards = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanRewardData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("config/ClanReward.xml");
|
||||
for (ClanRewardType type : ClanRewardType.values())
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + (_clanRewards.containsKey(type) ? _clanRewards.get(type).size() : 0) + " rewards for " + type + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc.getFirstChild(), IXmlReader::isNode, listNode ->
|
||||
{
|
||||
switch (listNode.getNodeName())
|
||||
{
|
||||
case "membersOnline":
|
||||
{
|
||||
parseMembersOnline(listNode);
|
||||
break;
|
||||
}
|
||||
case "huntingBonus":
|
||||
{
|
||||
parseHuntingBonus(listNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseMembersOnline(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("players".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "size");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.MEMBERS_ONLINE, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, skillNode ->
|
||||
{
|
||||
if ("skill".equalsIgnoreCase(skillNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap skillAttr = skillNode.getAttributes();
|
||||
final int skillId = parseInteger(skillAttr, "id");
|
||||
final int skillLevel = parseInteger(skillAttr, "level");
|
||||
bonus.setSkillReward(new SkillHolder(skillId, skillLevel));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseHuntingBonus(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("hunting".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "points");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.HUNTING_MONSTERS, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, itemsNode ->
|
||||
{
|
||||
if ("item".equalsIgnoreCase(itemsNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap itemsAttr = itemsNode.getAttributes();
|
||||
final int id = parseInteger(itemsAttr, "id");
|
||||
final int count = parseInteger(itemsAttr, "count");
|
||||
bonus.setItemReward(new ItemHolder(id, count));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<ClanRewardBonus> getClanRewardBonuses(ClanRewardType type)
|
||||
{
|
||||
return _clanRewards.get(type);
|
||||
}
|
||||
|
||||
public ClanRewardBonus getHighestReward(ClanRewardType type)
|
||||
{
|
||||
ClanRewardBonus selectedBonus = null;
|
||||
for (ClanRewardBonus currentBonus : _clanRewards.get(type))
|
||||
{
|
||||
if ((selectedBonus == null) || (selectedBonus.getLevel() < currentBonus.getLevel()))
|
||||
{
|
||||
selectedBonus = currentBonus;
|
||||
}
|
||||
}
|
||||
return selectedBonus;
|
||||
}
|
||||
|
||||
public Collection<List<ClanRewardBonus>> getClanRewardBonuses()
|
||||
{
|
||||
return _clanRewards.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of ClanRewardData.
|
||||
* @return single instance of ClanRewardData
|
||||
*/
|
||||
public static ClanRewardData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ClanRewardData INSTANCE = new ClanRewardData();
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.enums;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum ClanRewardType
|
||||
{
|
||||
MEMBERS_ONLINE(0, Clan::getPreviousMaxOnlinePlayers),
|
||||
HUNTING_MONSTERS(1, Clan::getPreviousHuntingPoints);
|
||||
|
||||
final int _clientId;
|
||||
final int _mask;
|
||||
final Function<Clan, Integer> _pointsFunction;
|
||||
|
||||
ClanRewardType(int clientId, Function<Clan, Integer> pointsFunction)
|
||||
{
|
||||
_clientId = clientId;
|
||||
_mask = 1 << clientId;
|
||||
_pointsFunction = pointsFunction;
|
||||
}
|
||||
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
public ClanRewardBonus getAvailableBonus(Clan clan)
|
||||
{
|
||||
ClanRewardBonus availableBonus = null;
|
||||
for (ClanRewardBonus bonus : ClanRewardData.getInstance().getClanRewardBonuses(this))
|
||||
{
|
||||
if (bonus.getRequiredAmount() <= _pointsFunction.apply(clan))
|
||||
{
|
||||
if ((availableBonus == null) || (availableBonus.getLevel() < bonus.getLevel()))
|
||||
{
|
||||
availableBonus = bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
return availableBonus;
|
||||
}
|
||||
|
||||
public static int getDefaultMask()
|
||||
{
|
||||
int mask = 0;
|
||||
for (ClanRewardType type : values())
|
||||
{
|
||||
mask |= type.getMask();
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
@ScheduleTarget
|
||||
private void onReset()
|
||||
{
|
||||
resetClanBonus();
|
||||
resetExtendDrop();
|
||||
resetDailyMissionRewards();
|
||||
resetDailySkills();
|
||||
@ -141,12 +140,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
LOGGER.info("Vitality resetted");
|
||||
}
|
||||
|
||||
private void resetClanBonus()
|
||||
{
|
||||
ClanTable.getInstance().getClans().forEach(Clan::resetClanBonus);
|
||||
LOGGER.info("Daily clan bonus has been resetted.");
|
||||
}
|
||||
|
||||
private void resetExtendDrop()
|
||||
{
|
||||
// Update data for offline players.
|
||||
|
@ -43,7 +43,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
@ -887,16 +886,6 @@ public class Party extends AbstractPlayerGroup
|
||||
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = member.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (target.useVitalityRate())
|
||||
{
|
||||
finalExp *= member.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(member, target, finalExp);
|
||||
}
|
||||
member.updateVitalityPoints(target.getVitalityPoints(member.getLevel(), exp, target.isRaid()), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(member, exp);
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.status.AttackableStatus;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.attackable.CommandChannelTimer;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.Hero;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnAttackableAggroRangeEnter;
|
||||
@ -506,16 +505,6 @@ public class Attackable extends Npc
|
||||
attacker.addExpAndSp(exp, sp, useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = attacker.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (useVitalityRate())
|
||||
{
|
||||
finalExp *= attacker.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(attacker, this, finalExp);
|
||||
}
|
||||
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
|
||||
}
|
||||
|
@ -546,8 +546,6 @@ public class PlayerInstance extends Playable
|
||||
/** Recommendation Two Hours bonus **/
|
||||
protected boolean _recoTwoHoursGiven = false;
|
||||
|
||||
private ScheduledFuture<?> _onlineTimeUpdateTask;
|
||||
|
||||
private final PlayerInventory _inventory = new PlayerInventory(this);
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
@ -5431,7 +5429,6 @@ public class PlayerInstance extends Playable
|
||||
stopChargeTask();
|
||||
stopFameTask();
|
||||
stopRecoGiveTask();
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6815,7 +6812,6 @@ public class PlayerInstance extends Playable
|
||||
|
||||
player.loadRecommendations();
|
||||
player.startRecoGiveTask();
|
||||
player.startOnlineTimeUpdateTask();
|
||||
|
||||
player.setOnlineStatus(true, false);
|
||||
|
||||
@ -13896,33 +13892,6 @@ public class PlayerInstance extends Playable
|
||||
return super.getMoveType();
|
||||
}
|
||||
|
||||
private void startOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
|
||||
}
|
||||
|
||||
private void updateOnlineTime()
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
_clan.addMemberOnlineTime(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
_onlineTimeUpdateTask.cancel(true);
|
||||
_onlineTimeUpdateTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
public GroupType getGroupType()
|
||||
{
|
||||
return isInParty() ? (_party.isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;
|
||||
|
@ -45,14 +45,12 @@ import org.l2jmobius.gameserver.data.xml.impl.ClanLevelData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanJoin;
|
||||
@ -82,7 +80,6 @@ import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeShowInfoUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
|
||||
import org.l2jmobius.gameserver.util.EnumIntBitmask;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@ -152,9 +149,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
private final AtomicInteger _siegeKills = new AtomicInteger();
|
||||
private final AtomicInteger _siegeDeaths = new AtomicInteger();
|
||||
|
||||
private ClanRewardBonus _lastMembersOnlineBonus = null;
|
||||
private ClanRewardBonus _lastHuntingBonus = null;
|
||||
|
||||
private final Collection<ScheduledFuture<?>> masterySkillTasks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private volatile ClanVariables _vars;
|
||||
@ -170,18 +164,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
restore();
|
||||
_warehouse.restore();
|
||||
|
||||
final ClanRewardBonus availableOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if ((_lastMembersOnlineBonus == null) && (availableOnlineBonus != null))
|
||||
{
|
||||
_lastMembersOnlineBonus = availableOnlineBonus;
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableHuntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if ((_lastHuntingBonus == null) && (availableHuntingBonus != null))
|
||||
{
|
||||
_lastHuntingBonus = availableHuntingBonus;
|
||||
}
|
||||
|
||||
final int masteryTime19538 = getMasterySkillRemainingTime(19538);
|
||||
if (masteryTime19538 > 0)
|
||||
{
|
||||
@ -2725,112 +2707,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
return _atWarWith.get(clanId);
|
||||
}
|
||||
|
||||
public synchronized void addMemberOnlineTime(PlayerInstance player)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
if (clanMember != null)
|
||||
{
|
||||
clanMember.setOnlineTime(clanMember.getOnlineTime() + (60 * 1000));
|
||||
if (clanMember.getOnlineTime() == (30 * 60 * 1000))
|
||||
{
|
||||
broadcastToOnlineMembers(new PledgeShowMemberListUpdate(clanMember));
|
||||
}
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastMembersOnlineBonus == null)
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastMembersOnlineBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
|
||||
final int currentMaxOnline = (int) _members.values().stream().filter(member -> member.getOnlineTime() > Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS).count();
|
||||
if (getMaxOnlineMembers() < currentMaxOnline)
|
||||
{
|
||||
getVariables().set("MAX_ONLINE_MEMBERS", currentMaxOnline);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param target
|
||||
* @param value
|
||||
*/
|
||||
public synchronized void addHuntingPoints(PlayerInstance player, Npc target, double value)
|
||||
{
|
||||
// TODO: Figure out the retail formula
|
||||
final int points = (int) value / 29600;
|
||||
if (points > 0)
|
||||
{
|
||||
getVariables().set("HUNTING_POINTS", getHuntingPoints() + points);
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastHuntingBonus == null)
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastHuntingBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxOnlineMembers()
|
||||
{
|
||||
return getVariables().getInt("MAX_ONLINE_MEMBERS", 0);
|
||||
}
|
||||
|
||||
public int getHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousMaxOnlinePlayers()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_MAX_ONLINE_PLAYERS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public boolean canClaimBonusReward(PlayerInstance player, ClanRewardType type)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
return (clanMember != null) && (type.getAvailableBonus(this) != null) && !clanMember.isRewardClaimed(type);
|
||||
}
|
||||
|
||||
public void resetClanBonus()
|
||||
{
|
||||
// Save current state
|
||||
getVariables().set("PREVIOUS_MAX_ONLINE_PLAYERS", getMaxOnlineMembers());
|
||||
getVariables().set("PREVIOUS_HUNTING_POINTS", getHuntingPoints());
|
||||
|
||||
// Reset
|
||||
_members.values().forEach(ClanMember::resetBonus);
|
||||
getVariables().remove("HUNTING_POINTS");
|
||||
|
||||
// force store
|
||||
getVariables().storeMe();
|
||||
|
||||
// Send Packet
|
||||
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public void addMastery(int id)
|
||||
{
|
||||
getVariables().set(ClanVariables.CLAN_MASTERY + id, true);
|
||||
|
@ -23,12 +23,9 @@ import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
|
||||
/**
|
||||
* This class holds the clan members data.
|
||||
@ -50,7 +47,6 @@ public class ClanMember
|
||||
private int _pledgeType;
|
||||
private int _apprentice;
|
||||
private int _sponsor;
|
||||
private long _onlineTime;
|
||||
|
||||
/**
|
||||
* Used to restore a clan member from the database.
|
||||
@ -817,48 +813,4 @@ public class ClanMember
|
||||
LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getOnlineTime()
|
||||
{
|
||||
return _onlineTime;
|
||||
}
|
||||
|
||||
public void setOnlineTime(long onlineTime)
|
||||
{
|
||||
_onlineTime = onlineTime;
|
||||
}
|
||||
|
||||
public void resetBonus()
|
||||
{
|
||||
_onlineTime = 0;
|
||||
final PlayerVariables vars = getVariables();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", 0);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
public int getOnlineStatus()
|
||||
{
|
||||
return !isOnline() ? 0 : _onlineTime >= (Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS) ? 2 : 1;
|
||||
}
|
||||
|
||||
public boolean isRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
final int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
return (claimedRewards & type.getMask()) == type.getMask();
|
||||
}
|
||||
|
||||
public void setRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
claimedRewards |= type.getMask();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", claimedRewards);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
private PlayerVariables getVariables()
|
||||
{
|
||||
return _player != null ? _player.getVariables() : new PlayerVariables(_objectId);
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.clan;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardBonus
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _level;
|
||||
private final int _requiredAmount;
|
||||
private SkillHolder _skillReward;
|
||||
private ItemHolder _itemReward;
|
||||
|
||||
public ClanRewardBonus(ClanRewardType type, int level, int requiredAmount)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
_requiredAmount = requiredAmount;
|
||||
}
|
||||
|
||||
public ClanRewardType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public int getRequiredAmount()
|
||||
{
|
||||
return _requiredAmount;
|
||||
}
|
||||
|
||||
public SkillHolder getSkillReward()
|
||||
{
|
||||
return _skillReward;
|
||||
}
|
||||
|
||||
public void setSkillReward(SkillHolder skillReward)
|
||||
{
|
||||
_skillReward = skillReward;
|
||||
}
|
||||
|
||||
public ItemHolder getItemReward()
|
||||
{
|
||||
return _itemReward;
|
||||
}
|
||||
|
||||
public void setItemReward(ItemHolder itemReward)
|
||||
{
|
||||
_itemReward = itemReward;
|
||||
}
|
||||
}
|
@ -90,9 +90,6 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMa
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRPresentBuyProduct;
|
||||
@ -395,9 +392,9 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_TODO_LIST_HTML(0x11F, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ONE_DAY_REWARD_RECEIVE(0x120, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET(0x121, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusOpen;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusOpen implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusOpen(player));
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusReward implements IClientIncomingPacket
|
||||
{
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_type < 0) || (_type > ClanRewardType.values().length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Clan clan = player.getClan();
|
||||
final ClanRewardType type = ClanRewardType.values()[_type];
|
||||
final ClanMember member = clan.getClanMember(player.getObjectId());
|
||||
if (clan.canClaimBonusReward(player, type))
|
||||
{
|
||||
final ClanRewardBonus bonus = type.getAvailableBonus(player.getClan());
|
||||
if (bonus != null)
|
||||
{
|
||||
final ItemHolder itemReward = bonus.getItemReward();
|
||||
final SkillHolder skillReward = bonus.getSkillReward();
|
||||
if (itemReward != null)
|
||||
{
|
||||
player.addItem("ClanReward", itemReward.getId(), itemReward.getCount(), player, true);
|
||||
}
|
||||
else if (skillReward != null)
|
||||
{
|
||||
skillReward.getSkill().activateSkill(player, player);
|
||||
}
|
||||
member.setRewardClaimed(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(player + " Attempting to claim reward but clan(" + clan + ") doesn't have such!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusRewardList implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusList());
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ public class PledgeShowMemberListAll implements IClientOutgoingPacket
|
||||
packet.writeD(0); // race
|
||||
packet.writeD(m.isOnline() ? m.getObjectId() : 0); // objectId = online 0 = offline
|
||||
packet.writeD(0);
|
||||
packet.writeC(m.getOnlineStatus());
|
||||
packet.writeC(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
private final int _level;
|
||||
private final int _classId;
|
||||
private final int _objectId;
|
||||
private final int _onlineStatus;
|
||||
|
||||
public PledgeShowMemberListUpdate(PlayerInstance player)
|
||||
{
|
||||
@ -45,7 +44,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
_classId = member.getClassId();
|
||||
_objectId = member.isOnline() ? member.getObjectId() : 0;
|
||||
_pledgeType = member.getPledgeType();
|
||||
_onlineStatus = member.getOnlineStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,7 +59,7 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
packet.writeD(_objectId);
|
||||
packet.writeD(_pledgeType);
|
||||
packet.writeD(0); // _hasSponsor
|
||||
packet.writeC(_onlineStatus);
|
||||
packet.writeC(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExPledgeBonusList implements IClientOutgoingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
|
||||
packet.writeC(0x00); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.MEMBERS_ONLINE).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getSkillReward().getSkillId());
|
||||
});
|
||||
packet.writeC(0x01); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.HUNTING_MONSTERS).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getItemReward().getId());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusMarkReset implements IClientOutgoingPacket
|
||||
{
|
||||
public static ExPledgeBonusMarkReset STATIC_PACKET = new ExPledgeBonusMarkReset();
|
||||
|
||||
private ExPledgeBonusMarkReset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_MARK_RESET.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusOpen implements IClientOutgoingPacket
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusOpen.class.getName());
|
||||
|
||||
private final PlayerInstance _player;
|
||||
|
||||
public ExPledgeBonusOpen(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
final Clan clan = _player.getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + _player + " attempting to write to a null clan!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final ClanRewardBonus highestMembersOnlineBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.MEMBERS_ONLINE);
|
||||
final ClanRewardBonus highestHuntingBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.HUNTING_MONSTERS);
|
||||
final ClanRewardBonus membersOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(clan);
|
||||
final ClanRewardBonus huntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(clan);
|
||||
if (highestMembersOnlineBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestMembersOnlineBonus.getSkillReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find skill reward for highest available members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus.getItemReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find item reward for highest available hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// General OP Code
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_OPEN.writeId(packet);
|
||||
|
||||
// Members online bonus
|
||||
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getMaxOnlineMembers());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(membersOnlineBonus != null ? highestMembersOnlineBonus.getSkillReward().getSkillId() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
|
||||
|
||||
// Hunting bonus
|
||||
packet.writeD(highestHuntingBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getHuntingPoints());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(huntingBonus != null ? highestHuntingBonus.getItemReward().getId() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? 0x01 : 0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusUpdate implements IClientOutgoingPacket
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _value;
|
||||
|
||||
public ExPledgeBonusUpdate(ClanRewardType type, int value)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_UPDATE.writeId(packet);
|
||||
packet.writeC(_type.getClientId());
|
||||
packet.writeD(_value);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ClanReward.xsd">
|
||||
<membersOnline>
|
||||
<players size="10" level="1">
|
||||
<skill id="23774" level="1" /> <!-- Clan Teamwork - Stage 1 -->
|
||||
</players>
|
||||
<players size="20" level="2">
|
||||
<skill id="23775" level="1" /> <!-- Clan Teamwork - Stage 2 -->
|
||||
</players>
|
||||
<players size="30" level="3">
|
||||
<skill id="23776" level="1" /> <!-- Clan Teamwork - Stage 3 -->
|
||||
</players>
|
||||
<players size="40" level="4">
|
||||
<skill id="23777" level="1" /> <!-- Clan Teamwork - Stage 4 -->
|
||||
</players>
|
||||
</membersOnline>
|
||||
<huntingBonus>
|
||||
<hunting points="28800000" level="1">
|
||||
<item id="27589" count="1" /> <!-- Supply Box - Standard -->
|
||||
</hunting>
|
||||
<hunting points="57600000" level="2">
|
||||
<item id="27590" count="1" /> <!-- Supply Box - Mid-grade -->
|
||||
</hunting>
|
||||
<hunting points="86400000" level="3">
|
||||
<item id="27591" count="1" /> <!-- Supply Box - High-grade -->
|
||||
</hunting>
|
||||
<hunting points="115200000" level="4">
|
||||
<item id="27663" count="1" /> <!-- Supply Box - Top-grade -->
|
||||
</hunting>
|
||||
</huntingBonus>
|
||||
</list>
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanHallData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanShopData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClassListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CombinationItemsData;
|
||||
@ -241,7 +240,6 @@ public class GameServer
|
||||
SecondaryAuthData.getInstance();
|
||||
CombinationItemsData.getInstance();
|
||||
SayuneData.getInstance();
|
||||
ClanRewardData.getInstance();
|
||||
DailyMissionHandler.getInstance().executeScript();
|
||||
DailyMissionData.getInstance();
|
||||
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanRewardData.class.getName());
|
||||
private final Map<ClanRewardType, List<ClanRewardBonus>> _clanRewards = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanRewardData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("config/ClanReward.xml");
|
||||
for (ClanRewardType type : ClanRewardType.values())
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + (_clanRewards.containsKey(type) ? _clanRewards.get(type).size() : 0) + " rewards for " + type + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc.getFirstChild(), IXmlReader::isNode, listNode ->
|
||||
{
|
||||
switch (listNode.getNodeName())
|
||||
{
|
||||
case "membersOnline":
|
||||
{
|
||||
parseMembersOnline(listNode);
|
||||
break;
|
||||
}
|
||||
case "huntingBonus":
|
||||
{
|
||||
parseHuntingBonus(listNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseMembersOnline(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("players".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "size");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.MEMBERS_ONLINE, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, skillNode ->
|
||||
{
|
||||
if ("skill".equalsIgnoreCase(skillNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap skillAttr = skillNode.getAttributes();
|
||||
final int skillId = parseInteger(skillAttr, "id");
|
||||
final int skillLevel = parseInteger(skillAttr, "level");
|
||||
bonus.setSkillReward(new SkillHolder(skillId, skillLevel));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseHuntingBonus(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("hunting".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "points");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.HUNTING_MONSTERS, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, itemsNode ->
|
||||
{
|
||||
if ("item".equalsIgnoreCase(itemsNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap itemsAttr = itemsNode.getAttributes();
|
||||
final int id = parseInteger(itemsAttr, "id");
|
||||
final int count = parseInteger(itemsAttr, "count");
|
||||
bonus.setItemReward(new ItemHolder(id, count));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<ClanRewardBonus> getClanRewardBonuses(ClanRewardType type)
|
||||
{
|
||||
return _clanRewards.get(type);
|
||||
}
|
||||
|
||||
public ClanRewardBonus getHighestReward(ClanRewardType type)
|
||||
{
|
||||
ClanRewardBonus selectedBonus = null;
|
||||
for (ClanRewardBonus currentBonus : _clanRewards.get(type))
|
||||
{
|
||||
if ((selectedBonus == null) || (selectedBonus.getLevel() < currentBonus.getLevel()))
|
||||
{
|
||||
selectedBonus = currentBonus;
|
||||
}
|
||||
}
|
||||
return selectedBonus;
|
||||
}
|
||||
|
||||
public Collection<List<ClanRewardBonus>> getClanRewardBonuses()
|
||||
{
|
||||
return _clanRewards.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of ClanRewardData.
|
||||
* @return single instance of ClanRewardData
|
||||
*/
|
||||
public static ClanRewardData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ClanRewardData INSTANCE = new ClanRewardData();
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.enums;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum ClanRewardType
|
||||
{
|
||||
MEMBERS_ONLINE(0, Clan::getPreviousMaxOnlinePlayers),
|
||||
HUNTING_MONSTERS(1, Clan::getPreviousHuntingPoints);
|
||||
|
||||
final int _clientId;
|
||||
final int _mask;
|
||||
final Function<Clan, Integer> _pointsFunction;
|
||||
|
||||
ClanRewardType(int clientId, Function<Clan, Integer> pointsFunction)
|
||||
{
|
||||
_clientId = clientId;
|
||||
_mask = 1 << clientId;
|
||||
_pointsFunction = pointsFunction;
|
||||
}
|
||||
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
public ClanRewardBonus getAvailableBonus(Clan clan)
|
||||
{
|
||||
ClanRewardBonus availableBonus = null;
|
||||
for (ClanRewardBonus bonus : ClanRewardData.getInstance().getClanRewardBonuses(this))
|
||||
{
|
||||
if (bonus.getRequiredAmount() <= _pointsFunction.apply(clan))
|
||||
{
|
||||
if ((availableBonus == null) || (availableBonus.getLevel() < bonus.getLevel()))
|
||||
{
|
||||
availableBonus = bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
return availableBonus;
|
||||
}
|
||||
|
||||
public static int getDefaultMask()
|
||||
{
|
||||
int mask = 0;
|
||||
for (ClanRewardType type : values())
|
||||
{
|
||||
mask |= type.getMask();
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
@ScheduleTarget
|
||||
private void onReset()
|
||||
{
|
||||
resetClanBonus();
|
||||
resetExtendDrop();
|
||||
resetDailyMissionRewards();
|
||||
resetDailySkills();
|
||||
@ -141,12 +140,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
LOGGER.info("Vitality resetted");
|
||||
}
|
||||
|
||||
private void resetClanBonus()
|
||||
{
|
||||
ClanTable.getInstance().getClans().forEach(Clan::resetClanBonus);
|
||||
LOGGER.info("Daily clan bonus has been resetted.");
|
||||
}
|
||||
|
||||
private void resetExtendDrop()
|
||||
{
|
||||
// Update data for offline players.
|
||||
|
@ -43,7 +43,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
@ -887,16 +886,6 @@ public class Party extends AbstractPlayerGroup
|
||||
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = member.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (target.useVitalityRate())
|
||||
{
|
||||
finalExp *= member.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(member, target, finalExp);
|
||||
}
|
||||
member.updateVitalityPoints(target.getVitalityPoints(member.getLevel(), exp, target.isRaid()), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(member, exp);
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.status.AttackableStatus;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.attackable.CommandChannelTimer;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.Hero;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnAttackableAggroRangeEnter;
|
||||
@ -506,16 +505,6 @@ public class Attackable extends Npc
|
||||
attacker.addExpAndSp(exp, sp, useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = attacker.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (useVitalityRate())
|
||||
{
|
||||
finalExp *= attacker.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(attacker, this, finalExp);
|
||||
}
|
||||
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
|
||||
}
|
||||
|
@ -546,8 +546,6 @@ public class PlayerInstance extends Playable
|
||||
/** Recommendation Two Hours bonus **/
|
||||
protected boolean _recoTwoHoursGiven = false;
|
||||
|
||||
private ScheduledFuture<?> _onlineTimeUpdateTask;
|
||||
|
||||
private final PlayerInventory _inventory = new PlayerInventory(this);
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
@ -5431,7 +5429,6 @@ public class PlayerInstance extends Playable
|
||||
stopChargeTask();
|
||||
stopFameTask();
|
||||
stopRecoGiveTask();
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6815,7 +6812,6 @@ public class PlayerInstance extends Playable
|
||||
|
||||
player.loadRecommendations();
|
||||
player.startRecoGiveTask();
|
||||
player.startOnlineTimeUpdateTask();
|
||||
|
||||
player.setOnlineStatus(true, false);
|
||||
|
||||
@ -13899,33 +13895,6 @@ public class PlayerInstance extends Playable
|
||||
return super.getMoveType();
|
||||
}
|
||||
|
||||
private void startOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
|
||||
}
|
||||
|
||||
private void updateOnlineTime()
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
_clan.addMemberOnlineTime(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
_onlineTimeUpdateTask.cancel(true);
|
||||
_onlineTimeUpdateTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
public GroupType getGroupType()
|
||||
{
|
||||
return isInParty() ? (_party.isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;
|
||||
|
@ -45,14 +45,12 @@ import org.l2jmobius.gameserver.data.xml.impl.ClanLevelData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanJoin;
|
||||
@ -82,7 +80,6 @@ import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeShowInfoUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
|
||||
import org.l2jmobius.gameserver.util.EnumIntBitmask;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@ -152,9 +149,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
private final AtomicInteger _siegeKills = new AtomicInteger();
|
||||
private final AtomicInteger _siegeDeaths = new AtomicInteger();
|
||||
|
||||
private ClanRewardBonus _lastMembersOnlineBonus = null;
|
||||
private ClanRewardBonus _lastHuntingBonus = null;
|
||||
|
||||
private final Collection<ScheduledFuture<?>> masterySkillTasks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private volatile ClanVariables _vars;
|
||||
@ -170,18 +164,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
restore();
|
||||
_warehouse.restore();
|
||||
|
||||
final ClanRewardBonus availableOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if ((_lastMembersOnlineBonus == null) && (availableOnlineBonus != null))
|
||||
{
|
||||
_lastMembersOnlineBonus = availableOnlineBonus;
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableHuntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if ((_lastHuntingBonus == null) && (availableHuntingBonus != null))
|
||||
{
|
||||
_lastHuntingBonus = availableHuntingBonus;
|
||||
}
|
||||
|
||||
final int masteryTime19538 = getMasterySkillRemainingTime(19538);
|
||||
if (masteryTime19538 > 0)
|
||||
{
|
||||
@ -2725,112 +2707,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
return _atWarWith.get(clanId);
|
||||
}
|
||||
|
||||
public synchronized void addMemberOnlineTime(PlayerInstance player)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
if (clanMember != null)
|
||||
{
|
||||
clanMember.setOnlineTime(clanMember.getOnlineTime() + (60 * 1000));
|
||||
if (clanMember.getOnlineTime() == (30 * 60 * 1000))
|
||||
{
|
||||
broadcastToOnlineMembers(new PledgeShowMemberListUpdate(clanMember));
|
||||
}
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastMembersOnlineBonus == null)
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastMembersOnlineBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
|
||||
final int currentMaxOnline = (int) _members.values().stream().filter(member -> member.getOnlineTime() > Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS).count();
|
||||
if (getMaxOnlineMembers() < currentMaxOnline)
|
||||
{
|
||||
getVariables().set("MAX_ONLINE_MEMBERS", currentMaxOnline);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param target
|
||||
* @param value
|
||||
*/
|
||||
public synchronized void addHuntingPoints(PlayerInstance player, Npc target, double value)
|
||||
{
|
||||
// TODO: Figure out the retail formula
|
||||
final int points = (int) value / 29600;
|
||||
if (points > 0)
|
||||
{
|
||||
getVariables().set("HUNTING_POINTS", getHuntingPoints() + points);
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastHuntingBonus == null)
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastHuntingBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxOnlineMembers()
|
||||
{
|
||||
return getVariables().getInt("MAX_ONLINE_MEMBERS", 0);
|
||||
}
|
||||
|
||||
public int getHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousMaxOnlinePlayers()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_MAX_ONLINE_PLAYERS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public boolean canClaimBonusReward(PlayerInstance player, ClanRewardType type)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
return (clanMember != null) && (type.getAvailableBonus(this) != null) && !clanMember.isRewardClaimed(type);
|
||||
}
|
||||
|
||||
public void resetClanBonus()
|
||||
{
|
||||
// Save current state
|
||||
getVariables().set("PREVIOUS_MAX_ONLINE_PLAYERS", getMaxOnlineMembers());
|
||||
getVariables().set("PREVIOUS_HUNTING_POINTS", getHuntingPoints());
|
||||
|
||||
// Reset
|
||||
_members.values().forEach(ClanMember::resetBonus);
|
||||
getVariables().remove("HUNTING_POINTS");
|
||||
|
||||
// force store
|
||||
getVariables().storeMe();
|
||||
|
||||
// Send Packet
|
||||
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public void addMastery(int id)
|
||||
{
|
||||
getVariables().set(ClanVariables.CLAN_MASTERY + id, true);
|
||||
|
@ -23,12 +23,9 @@ import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
|
||||
/**
|
||||
* This class holds the clan members data.
|
||||
@ -50,7 +47,6 @@ public class ClanMember
|
||||
private int _pledgeType;
|
||||
private int _apprentice;
|
||||
private int _sponsor;
|
||||
private long _onlineTime;
|
||||
|
||||
/**
|
||||
* Used to restore a clan member from the database.
|
||||
@ -817,48 +813,4 @@ public class ClanMember
|
||||
LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getOnlineTime()
|
||||
{
|
||||
return _onlineTime;
|
||||
}
|
||||
|
||||
public void setOnlineTime(long onlineTime)
|
||||
{
|
||||
_onlineTime = onlineTime;
|
||||
}
|
||||
|
||||
public void resetBonus()
|
||||
{
|
||||
_onlineTime = 0;
|
||||
final PlayerVariables vars = getVariables();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", 0);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
public int getOnlineStatus()
|
||||
{
|
||||
return !isOnline() ? 0 : _onlineTime >= (Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS) ? 2 : 1;
|
||||
}
|
||||
|
||||
public boolean isRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
final int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
return (claimedRewards & type.getMask()) == type.getMask();
|
||||
}
|
||||
|
||||
public void setRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
claimedRewards |= type.getMask();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", claimedRewards);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
private PlayerVariables getVariables()
|
||||
{
|
||||
return _player != null ? _player.getVariables() : new PlayerVariables(_objectId);
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.clan;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardBonus
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _level;
|
||||
private final int _requiredAmount;
|
||||
private SkillHolder _skillReward;
|
||||
private ItemHolder _itemReward;
|
||||
|
||||
public ClanRewardBonus(ClanRewardType type, int level, int requiredAmount)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
_requiredAmount = requiredAmount;
|
||||
}
|
||||
|
||||
public ClanRewardType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public int getRequiredAmount()
|
||||
{
|
||||
return _requiredAmount;
|
||||
}
|
||||
|
||||
public SkillHolder getSkillReward()
|
||||
{
|
||||
return _skillReward;
|
||||
}
|
||||
|
||||
public void setSkillReward(SkillHolder skillReward)
|
||||
{
|
||||
_skillReward = skillReward;
|
||||
}
|
||||
|
||||
public ItemHolder getItemReward()
|
||||
{
|
||||
return _itemReward;
|
||||
}
|
||||
|
||||
public void setItemReward(ItemHolder itemReward)
|
||||
{
|
||||
_itemReward = itemReward;
|
||||
}
|
||||
}
|
@ -90,9 +90,6 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMa
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRPresentBuyProduct;
|
||||
@ -395,9 +392,9 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_TODO_LIST_HTML(0x11F, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ONE_DAY_REWARD_RECEIVE(0x120, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET(0x121, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusOpen;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusOpen implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusOpen(player));
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusReward implements IClientIncomingPacket
|
||||
{
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_type < 0) || (_type > ClanRewardType.values().length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Clan clan = player.getClan();
|
||||
final ClanRewardType type = ClanRewardType.values()[_type];
|
||||
final ClanMember member = clan.getClanMember(player.getObjectId());
|
||||
if (clan.canClaimBonusReward(player, type))
|
||||
{
|
||||
final ClanRewardBonus bonus = type.getAvailableBonus(player.getClan());
|
||||
if (bonus != null)
|
||||
{
|
||||
final ItemHolder itemReward = bonus.getItemReward();
|
||||
final SkillHolder skillReward = bonus.getSkillReward();
|
||||
if (itemReward != null)
|
||||
{
|
||||
player.addItem("ClanReward", itemReward.getId(), itemReward.getCount(), player, true);
|
||||
}
|
||||
else if (skillReward != null)
|
||||
{
|
||||
skillReward.getSkill().activateSkill(player, player);
|
||||
}
|
||||
member.setRewardClaimed(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(player + " Attempting to claim reward but clan(" + clan + ") doesn't have such!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusRewardList implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusList());
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ public class PledgeShowMemberListAll implements IClientOutgoingPacket
|
||||
packet.writeD(0); // race
|
||||
packet.writeD(m.isOnline() ? m.getObjectId() : 0); // objectId = online 0 = offline
|
||||
packet.writeD(0);
|
||||
packet.writeC(m.getOnlineStatus());
|
||||
packet.writeC(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
private final int _level;
|
||||
private final int _classId;
|
||||
private final int _objectId;
|
||||
private final int _onlineStatus;
|
||||
|
||||
public PledgeShowMemberListUpdate(PlayerInstance player)
|
||||
{
|
||||
@ -45,7 +44,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
_classId = member.getClassId();
|
||||
_objectId = member.isOnline() ? member.getObjectId() : 0;
|
||||
_pledgeType = member.getPledgeType();
|
||||
_onlineStatus = member.getOnlineStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,7 +59,7 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
packet.writeD(_objectId);
|
||||
packet.writeD(_pledgeType);
|
||||
packet.writeD(0); // _hasSponsor
|
||||
packet.writeC(_onlineStatus);
|
||||
packet.writeC(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExPledgeBonusList implements IClientOutgoingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
|
||||
packet.writeC(0x00); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.MEMBERS_ONLINE).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getSkillReward().getSkillId());
|
||||
});
|
||||
packet.writeC(0x01); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.HUNTING_MONSTERS).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getItemReward().getId());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusMarkReset implements IClientOutgoingPacket
|
||||
{
|
||||
public static ExPledgeBonusMarkReset STATIC_PACKET = new ExPledgeBonusMarkReset();
|
||||
|
||||
private ExPledgeBonusMarkReset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_MARK_RESET.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusOpen implements IClientOutgoingPacket
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusOpen.class.getName());
|
||||
|
||||
private final PlayerInstance _player;
|
||||
|
||||
public ExPledgeBonusOpen(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
final Clan clan = _player.getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + _player + " attempting to write to a null clan!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final ClanRewardBonus highestMembersOnlineBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.MEMBERS_ONLINE);
|
||||
final ClanRewardBonus highestHuntingBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.HUNTING_MONSTERS);
|
||||
final ClanRewardBonus membersOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(clan);
|
||||
final ClanRewardBonus huntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(clan);
|
||||
if (highestMembersOnlineBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestMembersOnlineBonus.getSkillReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find skill reward for highest available members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus.getItemReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find item reward for highest available hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// General OP Code
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_OPEN.writeId(packet);
|
||||
|
||||
// Members online bonus
|
||||
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getMaxOnlineMembers());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(membersOnlineBonus != null ? highestMembersOnlineBonus.getSkillReward().getSkillId() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
|
||||
|
||||
// Hunting bonus
|
||||
packet.writeD(highestHuntingBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getHuntingPoints());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(huntingBonus != null ? highestHuntingBonus.getItemReward().getId() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? 0x01 : 0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusUpdate implements IClientOutgoingPacket
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _value;
|
||||
|
||||
public ExPledgeBonusUpdate(ClanRewardType type, int value)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_UPDATE.writeId(packet);
|
||||
packet.writeC(_type.getClientId());
|
||||
packet.writeD(_value);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ClanReward.xsd">
|
||||
<membersOnline>
|
||||
<players size="10" level="1">
|
||||
<skill id="23774" level="1" /> <!-- Clan Teamwork - Stage 1 -->
|
||||
</players>
|
||||
<players size="20" level="2">
|
||||
<skill id="23775" level="1" /> <!-- Clan Teamwork - Stage 2 -->
|
||||
</players>
|
||||
<players size="30" level="3">
|
||||
<skill id="23776" level="1" /> <!-- Clan Teamwork - Stage 3 -->
|
||||
</players>
|
||||
<players size="40" level="4">
|
||||
<skill id="23777" level="1" /> <!-- Clan Teamwork - Stage 4 -->
|
||||
</players>
|
||||
</membersOnline>
|
||||
<huntingBonus>
|
||||
<hunting points="28800000" level="1">
|
||||
<item id="27589" count="1" /> <!-- Supply Box - Standard -->
|
||||
</hunting>
|
||||
<hunting points="57600000" level="2">
|
||||
<item id="27590" count="1" /> <!-- Supply Box - Mid-grade -->
|
||||
</hunting>
|
||||
<hunting points="86400000" level="3">
|
||||
<item id="27591" count="1" /> <!-- Supply Box - High-grade -->
|
||||
</hunting>
|
||||
<hunting points="115200000" level="4">
|
||||
<item id="27663" count="1" /> <!-- Supply Box - Top-grade -->
|
||||
</hunting>
|
||||
</huntingBonus>
|
||||
</list>
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanHallData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanShopData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClassListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CombinationItemsData;
|
||||
@ -242,7 +241,6 @@ public class GameServer
|
||||
SecondaryAuthData.getInstance();
|
||||
CombinationItemsData.getInstance();
|
||||
SayuneData.getInstance();
|
||||
ClanRewardData.getInstance();
|
||||
DailyMissionHandler.getInstance().executeScript();
|
||||
DailyMissionData.getInstance();
|
||||
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanRewardData.class.getName());
|
||||
private final Map<ClanRewardType, List<ClanRewardBonus>> _clanRewards = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanRewardData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("config/ClanReward.xml");
|
||||
for (ClanRewardType type : ClanRewardType.values())
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + (_clanRewards.containsKey(type) ? _clanRewards.get(type).size() : 0) + " rewards for " + type + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc.getFirstChild(), IXmlReader::isNode, listNode ->
|
||||
{
|
||||
switch (listNode.getNodeName())
|
||||
{
|
||||
case "membersOnline":
|
||||
{
|
||||
parseMembersOnline(listNode);
|
||||
break;
|
||||
}
|
||||
case "huntingBonus":
|
||||
{
|
||||
parseHuntingBonus(listNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseMembersOnline(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("players".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "size");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.MEMBERS_ONLINE, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, skillNode ->
|
||||
{
|
||||
if ("skill".equalsIgnoreCase(skillNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap skillAttr = skillNode.getAttributes();
|
||||
final int skillId = parseInteger(skillAttr, "id");
|
||||
final int skillLevel = parseInteger(skillAttr, "level");
|
||||
bonus.setSkillReward(new SkillHolder(skillId, skillLevel));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseHuntingBonus(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("hunting".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "points");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.HUNTING_MONSTERS, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, itemsNode ->
|
||||
{
|
||||
if ("item".equalsIgnoreCase(itemsNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap itemsAttr = itemsNode.getAttributes();
|
||||
final int id = parseInteger(itemsAttr, "id");
|
||||
final int count = parseInteger(itemsAttr, "count");
|
||||
bonus.setItemReward(new ItemHolder(id, count));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<ClanRewardBonus> getClanRewardBonuses(ClanRewardType type)
|
||||
{
|
||||
return _clanRewards.get(type);
|
||||
}
|
||||
|
||||
public ClanRewardBonus getHighestReward(ClanRewardType type)
|
||||
{
|
||||
ClanRewardBonus selectedBonus = null;
|
||||
for (ClanRewardBonus currentBonus : _clanRewards.get(type))
|
||||
{
|
||||
if ((selectedBonus == null) || (selectedBonus.getLevel() < currentBonus.getLevel()))
|
||||
{
|
||||
selectedBonus = currentBonus;
|
||||
}
|
||||
}
|
||||
return selectedBonus;
|
||||
}
|
||||
|
||||
public Collection<List<ClanRewardBonus>> getClanRewardBonuses()
|
||||
{
|
||||
return _clanRewards.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of ClanRewardData.
|
||||
* @return single instance of ClanRewardData
|
||||
*/
|
||||
public static ClanRewardData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ClanRewardData INSTANCE = new ClanRewardData();
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.enums;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum ClanRewardType
|
||||
{
|
||||
MEMBERS_ONLINE(0, Clan::getPreviousMaxOnlinePlayers),
|
||||
HUNTING_MONSTERS(1, Clan::getPreviousHuntingPoints);
|
||||
|
||||
final int _clientId;
|
||||
final int _mask;
|
||||
final Function<Clan, Integer> _pointsFunction;
|
||||
|
||||
ClanRewardType(int clientId, Function<Clan, Integer> pointsFunction)
|
||||
{
|
||||
_clientId = clientId;
|
||||
_mask = 1 << clientId;
|
||||
_pointsFunction = pointsFunction;
|
||||
}
|
||||
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
public ClanRewardBonus getAvailableBonus(Clan clan)
|
||||
{
|
||||
ClanRewardBonus availableBonus = null;
|
||||
for (ClanRewardBonus bonus : ClanRewardData.getInstance().getClanRewardBonuses(this))
|
||||
{
|
||||
if (bonus.getRequiredAmount() <= _pointsFunction.apply(clan))
|
||||
{
|
||||
if ((availableBonus == null) || (availableBonus.getLevel() < bonus.getLevel()))
|
||||
{
|
||||
availableBonus = bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
return availableBonus;
|
||||
}
|
||||
|
||||
public static int getDefaultMask()
|
||||
{
|
||||
int mask = 0;
|
||||
for (ClanRewardType type : values())
|
||||
{
|
||||
mask |= type.getMask();
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
@ScheduleTarget
|
||||
private void onReset()
|
||||
{
|
||||
resetClanBonus();
|
||||
resetExtendDrop();
|
||||
resetDailyMissionRewards();
|
||||
resetDailySkills();
|
||||
@ -141,12 +140,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
LOGGER.info("Vitality resetted");
|
||||
}
|
||||
|
||||
private void resetClanBonus()
|
||||
{
|
||||
ClanTable.getInstance().getClans().forEach(Clan::resetClanBonus);
|
||||
LOGGER.info("Daily clan bonus has been resetted.");
|
||||
}
|
||||
|
||||
private void resetExtendDrop()
|
||||
{
|
||||
// Update data for offline players.
|
||||
|
@ -43,7 +43,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
@ -887,16 +886,6 @@ public class Party extends AbstractPlayerGroup
|
||||
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = member.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (target.useVitalityRate())
|
||||
{
|
||||
finalExp *= member.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(member, target, finalExp);
|
||||
}
|
||||
member.updateVitalityPoints(target.getVitalityPoints(member.getLevel(), exp, target.isRaid()), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(member, exp);
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.status.AttackableStatus;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.attackable.CommandChannelTimer;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.Hero;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnAttackableAggroRangeEnter;
|
||||
@ -506,16 +505,6 @@ public class Attackable extends Npc
|
||||
attacker.addExpAndSp(exp, sp, useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = attacker.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (useVitalityRate())
|
||||
{
|
||||
finalExp *= attacker.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(attacker, this, finalExp);
|
||||
}
|
||||
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
|
||||
}
|
||||
|
@ -546,8 +546,6 @@ public class PlayerInstance extends Playable
|
||||
/** Recommendation Two Hours bonus **/
|
||||
protected boolean _recoTwoHoursGiven = false;
|
||||
|
||||
private ScheduledFuture<?> _onlineTimeUpdateTask;
|
||||
|
||||
private final PlayerInventory _inventory = new PlayerInventory(this);
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
@ -5432,7 +5430,6 @@ public class PlayerInstance extends Playable
|
||||
stopChargeTask();
|
||||
stopFameTask();
|
||||
stopRecoGiveTask();
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6816,7 +6813,6 @@ public class PlayerInstance extends Playable
|
||||
|
||||
player.loadRecommendations();
|
||||
player.startRecoGiveTask();
|
||||
player.startOnlineTimeUpdateTask();
|
||||
|
||||
player.setOnlineStatus(true, false);
|
||||
|
||||
@ -13905,33 +13901,6 @@ public class PlayerInstance extends Playable
|
||||
return super.getMoveType();
|
||||
}
|
||||
|
||||
private void startOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
|
||||
}
|
||||
|
||||
private void updateOnlineTime()
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
_clan.addMemberOnlineTime(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
_onlineTimeUpdateTask.cancel(true);
|
||||
_onlineTimeUpdateTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
public GroupType getGroupType()
|
||||
{
|
||||
return isInParty() ? (_party.isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;
|
||||
|
@ -45,14 +45,12 @@ import org.l2jmobius.gameserver.data.xml.impl.ClanLevelData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanJoin;
|
||||
@ -82,7 +80,6 @@ import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeShowInfoUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
|
||||
import org.l2jmobius.gameserver.util.EnumIntBitmask;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@ -152,9 +149,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
private final AtomicInteger _siegeKills = new AtomicInteger();
|
||||
private final AtomicInteger _siegeDeaths = new AtomicInteger();
|
||||
|
||||
private ClanRewardBonus _lastMembersOnlineBonus = null;
|
||||
private ClanRewardBonus _lastHuntingBonus = null;
|
||||
|
||||
private final Collection<ScheduledFuture<?>> masterySkillTasks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private volatile ClanVariables _vars;
|
||||
@ -170,18 +164,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
restore();
|
||||
_warehouse.restore();
|
||||
|
||||
final ClanRewardBonus availableOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if ((_lastMembersOnlineBonus == null) && (availableOnlineBonus != null))
|
||||
{
|
||||
_lastMembersOnlineBonus = availableOnlineBonus;
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableHuntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if ((_lastHuntingBonus == null) && (availableHuntingBonus != null))
|
||||
{
|
||||
_lastHuntingBonus = availableHuntingBonus;
|
||||
}
|
||||
|
||||
final int masteryTime19538 = getMasterySkillRemainingTime(19538);
|
||||
if (masteryTime19538 > 0)
|
||||
{
|
||||
@ -2725,112 +2707,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
return _atWarWith.get(clanId);
|
||||
}
|
||||
|
||||
public synchronized void addMemberOnlineTime(PlayerInstance player)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
if (clanMember != null)
|
||||
{
|
||||
clanMember.setOnlineTime(clanMember.getOnlineTime() + (60 * 1000));
|
||||
if (clanMember.getOnlineTime() == (30 * 60 * 1000))
|
||||
{
|
||||
broadcastToOnlineMembers(new PledgeShowMemberListUpdate(clanMember));
|
||||
}
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastMembersOnlineBonus == null)
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastMembersOnlineBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
|
||||
final int currentMaxOnline = (int) _members.values().stream().filter(member -> member.getOnlineTime() > Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS).count();
|
||||
if (getMaxOnlineMembers() < currentMaxOnline)
|
||||
{
|
||||
getVariables().set("MAX_ONLINE_MEMBERS", currentMaxOnline);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param target
|
||||
* @param value
|
||||
*/
|
||||
public synchronized void addHuntingPoints(PlayerInstance player, Npc target, double value)
|
||||
{
|
||||
// TODO: Figure out the retail formula
|
||||
final int points = (int) value / 29600;
|
||||
if (points > 0)
|
||||
{
|
||||
getVariables().set("HUNTING_POINTS", getHuntingPoints() + points);
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastHuntingBonus == null)
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastHuntingBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxOnlineMembers()
|
||||
{
|
||||
return getVariables().getInt("MAX_ONLINE_MEMBERS", 0);
|
||||
}
|
||||
|
||||
public int getHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousMaxOnlinePlayers()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_MAX_ONLINE_PLAYERS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public boolean canClaimBonusReward(PlayerInstance player, ClanRewardType type)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
return (clanMember != null) && (type.getAvailableBonus(this) != null) && !clanMember.isRewardClaimed(type);
|
||||
}
|
||||
|
||||
public void resetClanBonus()
|
||||
{
|
||||
// Save current state
|
||||
getVariables().set("PREVIOUS_MAX_ONLINE_PLAYERS", getMaxOnlineMembers());
|
||||
getVariables().set("PREVIOUS_HUNTING_POINTS", getHuntingPoints());
|
||||
|
||||
// Reset
|
||||
_members.values().forEach(ClanMember::resetBonus);
|
||||
getVariables().remove("HUNTING_POINTS");
|
||||
|
||||
// force store
|
||||
getVariables().storeMe();
|
||||
|
||||
// Send Packet
|
||||
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public void addMastery(int id)
|
||||
{
|
||||
getVariables().set(ClanVariables.CLAN_MASTERY + id, true);
|
||||
|
@ -23,12 +23,9 @@ import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
|
||||
/**
|
||||
* This class holds the clan members data.
|
||||
@ -50,7 +47,6 @@ public class ClanMember
|
||||
private int _pledgeType;
|
||||
private int _apprentice;
|
||||
private int _sponsor;
|
||||
private long _onlineTime;
|
||||
|
||||
/**
|
||||
* Used to restore a clan member from the database.
|
||||
@ -817,48 +813,4 @@ public class ClanMember
|
||||
LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getOnlineTime()
|
||||
{
|
||||
return _onlineTime;
|
||||
}
|
||||
|
||||
public void setOnlineTime(long onlineTime)
|
||||
{
|
||||
_onlineTime = onlineTime;
|
||||
}
|
||||
|
||||
public void resetBonus()
|
||||
{
|
||||
_onlineTime = 0;
|
||||
final PlayerVariables vars = getVariables();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", 0);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
public int getOnlineStatus()
|
||||
{
|
||||
return !isOnline() ? 0 : _onlineTime >= (Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS) ? 2 : 1;
|
||||
}
|
||||
|
||||
public boolean isRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
final int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
return (claimedRewards & type.getMask()) == type.getMask();
|
||||
}
|
||||
|
||||
public void setRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
claimedRewards |= type.getMask();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", claimedRewards);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
private PlayerVariables getVariables()
|
||||
{
|
||||
return _player != null ? _player.getVariables() : new PlayerVariables(_objectId);
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.clan;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardBonus
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _level;
|
||||
private final int _requiredAmount;
|
||||
private SkillHolder _skillReward;
|
||||
private ItemHolder _itemReward;
|
||||
|
||||
public ClanRewardBonus(ClanRewardType type, int level, int requiredAmount)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
_requiredAmount = requiredAmount;
|
||||
}
|
||||
|
||||
public ClanRewardType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public int getRequiredAmount()
|
||||
{
|
||||
return _requiredAmount;
|
||||
}
|
||||
|
||||
public SkillHolder getSkillReward()
|
||||
{
|
||||
return _skillReward;
|
||||
}
|
||||
|
||||
public void setSkillReward(SkillHolder skillReward)
|
||||
{
|
||||
_skillReward = skillReward;
|
||||
}
|
||||
|
||||
public ItemHolder getItemReward()
|
||||
{
|
||||
return _itemReward;
|
||||
}
|
||||
|
||||
public void setItemReward(ItemHolder itemReward)
|
||||
{
|
||||
_itemReward = itemReward;
|
||||
}
|
||||
}
|
@ -91,9 +91,6 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMa
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRPresentBuyProduct;
|
||||
@ -396,9 +393,9 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_TODO_LIST_HTML(0x11F, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ONE_DAY_REWARD_RECEIVE(0x120, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET(0x121, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x122, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x123, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x124, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusOpen;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusOpen implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusOpen(player));
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusReward implements IClientIncomingPacket
|
||||
{
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_type < 0) || (_type > ClanRewardType.values().length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Clan clan = player.getClan();
|
||||
final ClanRewardType type = ClanRewardType.values()[_type];
|
||||
final ClanMember member = clan.getClanMember(player.getObjectId());
|
||||
if (clan.canClaimBonusReward(player, type))
|
||||
{
|
||||
final ClanRewardBonus bonus = type.getAvailableBonus(player.getClan());
|
||||
if (bonus != null)
|
||||
{
|
||||
final ItemHolder itemReward = bonus.getItemReward();
|
||||
final SkillHolder skillReward = bonus.getSkillReward();
|
||||
if (itemReward != null)
|
||||
{
|
||||
player.addItem("ClanReward", itemReward.getId(), itemReward.getCount(), player, true);
|
||||
}
|
||||
else if (skillReward != null)
|
||||
{
|
||||
skillReward.getSkill().activateSkill(player, player);
|
||||
}
|
||||
member.setRewardClaimed(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(player + " Attempting to claim reward but clan(" + clan + ") doesn't have such!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusRewardList implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusList());
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ public class PledgeShowMemberListAll implements IClientOutgoingPacket
|
||||
packet.writeD(0); // race
|
||||
packet.writeD(m.isOnline() ? m.getObjectId() : 0); // objectId = online 0 = offline
|
||||
packet.writeD(0);
|
||||
packet.writeC(m.getOnlineStatus());
|
||||
packet.writeC(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
private final int _level;
|
||||
private final int _classId;
|
||||
private final int _objectId;
|
||||
private final int _onlineStatus;
|
||||
|
||||
public PledgeShowMemberListUpdate(PlayerInstance player)
|
||||
{
|
||||
@ -45,7 +44,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
_classId = member.getClassId();
|
||||
_objectId = member.isOnline() ? member.getObjectId() : 0;
|
||||
_pledgeType = member.getPledgeType();
|
||||
_onlineStatus = member.getOnlineStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,7 +59,7 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
packet.writeD(_objectId);
|
||||
packet.writeD(_pledgeType);
|
||||
packet.writeD(0); // _hasSponsor
|
||||
packet.writeC(_onlineStatus);
|
||||
packet.writeC(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExPledgeBonusList implements IClientOutgoingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
|
||||
packet.writeC(0x00); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.MEMBERS_ONLINE).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getSkillReward().getSkillId());
|
||||
});
|
||||
packet.writeC(0x01); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.HUNTING_MONSTERS).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getItemReward().getId());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusMarkReset implements IClientOutgoingPacket
|
||||
{
|
||||
public static ExPledgeBonusMarkReset STATIC_PACKET = new ExPledgeBonusMarkReset();
|
||||
|
||||
private ExPledgeBonusMarkReset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_MARK_RESET.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusOpen implements IClientOutgoingPacket
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusOpen.class.getName());
|
||||
|
||||
private final PlayerInstance _player;
|
||||
|
||||
public ExPledgeBonusOpen(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
final Clan clan = _player.getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + _player + " attempting to write to a null clan!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final ClanRewardBonus highestMembersOnlineBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.MEMBERS_ONLINE);
|
||||
final ClanRewardBonus highestHuntingBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.HUNTING_MONSTERS);
|
||||
final ClanRewardBonus membersOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(clan);
|
||||
final ClanRewardBonus huntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(clan);
|
||||
if (highestMembersOnlineBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestMembersOnlineBonus.getSkillReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find skill reward for highest available members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus.getItemReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find item reward for highest available hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// General OP Code
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_OPEN.writeId(packet);
|
||||
|
||||
// Members online bonus
|
||||
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getMaxOnlineMembers());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(membersOnlineBonus != null ? highestMembersOnlineBonus.getSkillReward().getSkillId() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
|
||||
|
||||
// Hunting bonus
|
||||
packet.writeD(highestHuntingBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getHuntingPoints());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(huntingBonus != null ? highestHuntingBonus.getItemReward().getId() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? 0x01 : 0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusUpdate implements IClientOutgoingPacket
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _value;
|
||||
|
||||
public ExPledgeBonusUpdate(ClanRewardType type, int value)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_UPDATE.writeId(packet);
|
||||
packet.writeC(_type.getClientId());
|
||||
packet.writeD(_value);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ClanReward.xsd">
|
||||
<membersOnline>
|
||||
<players size="10" level="1">
|
||||
<skill id="23774" level="1" /> <!-- Clan Teamwork - Stage 1 -->
|
||||
</players>
|
||||
<players size="20" level="2">
|
||||
<skill id="23775" level="1" /> <!-- Clan Teamwork - Stage 2 -->
|
||||
</players>
|
||||
<players size="30" level="3">
|
||||
<skill id="23776" level="1" /> <!-- Clan Teamwork - Stage 3 -->
|
||||
</players>
|
||||
<players size="40" level="4">
|
||||
<skill id="23777" level="1" /> <!-- Clan Teamwork - Stage 4 -->
|
||||
</players>
|
||||
</membersOnline>
|
||||
<huntingBonus>
|
||||
<hunting points="28800000" level="1">
|
||||
<item id="27589" count="1" /> <!-- Supply Box - Standard -->
|
||||
</hunting>
|
||||
<hunting points="57600000" level="2">
|
||||
<item id="27590" count="1" /> <!-- Supply Box - Mid-grade -->
|
||||
</hunting>
|
||||
<hunting points="86400000" level="3">
|
||||
<item id="27591" count="1" /> <!-- Supply Box - High-grade -->
|
||||
</hunting>
|
||||
<hunting points="115200000" level="4">
|
||||
<item id="27663" count="1" /> <!-- Supply Box - Top-grade -->
|
||||
</hunting>
|
||||
</huntingBonus>
|
||||
</list>
|
@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanHallData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanShopData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClassListData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.CombinationItemsData;
|
||||
@ -243,7 +242,6 @@ public class GameServer
|
||||
SecondaryAuthData.getInstance();
|
||||
CombinationItemsData.getInstance();
|
||||
SayuneData.getInstance();
|
||||
ClanRewardData.getInstance();
|
||||
DailyMissionHandler.getInstance().executeScript();
|
||||
DailyMissionData.getInstance();
|
||||
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ClanRewardData.class.getName());
|
||||
private final Map<ClanRewardType, List<ClanRewardBonus>> _clanRewards = new ConcurrentHashMap<>();
|
||||
|
||||
protected ClanRewardData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("config/ClanReward.xml");
|
||||
for (ClanRewardType type : ClanRewardType.values())
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + (_clanRewards.containsKey(type) ? _clanRewards.get(type).size() : 0) + " rewards for " + type + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc.getFirstChild(), IXmlReader::isNode, listNode ->
|
||||
{
|
||||
switch (listNode.getNodeName())
|
||||
{
|
||||
case "membersOnline":
|
||||
{
|
||||
parseMembersOnline(listNode);
|
||||
break;
|
||||
}
|
||||
case "huntingBonus":
|
||||
{
|
||||
parseHuntingBonus(listNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseMembersOnline(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("players".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "size");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.MEMBERS_ONLINE, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, skillNode ->
|
||||
{
|
||||
if ("skill".equalsIgnoreCase(skillNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap skillAttr = skillNode.getAttributes();
|
||||
final int skillId = parseInteger(skillAttr, "id");
|
||||
final int skillLevel = parseInteger(skillAttr, "level");
|
||||
bonus.setSkillReward(new SkillHolder(skillId, skillLevel));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseHuntingBonus(Node node)
|
||||
{
|
||||
forEach(node, IXmlReader::isNode, memberNode ->
|
||||
{
|
||||
if ("hunting".equalsIgnoreCase(memberNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = memberNode.getAttributes();
|
||||
final int requiredAmount = parseInteger(attrs, "points");
|
||||
final int level = parseInteger(attrs, "level");
|
||||
final ClanRewardBonus bonus = new ClanRewardBonus(ClanRewardType.HUNTING_MONSTERS, level, requiredAmount);
|
||||
forEach(memberNode, IXmlReader::isNode, itemsNode ->
|
||||
{
|
||||
if ("item".equalsIgnoreCase(itemsNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap itemsAttr = itemsNode.getAttributes();
|
||||
final int id = parseInteger(itemsAttr, "id");
|
||||
final int count = parseInteger(itemsAttr, "count");
|
||||
bonus.setItemReward(new ItemHolder(id, count));
|
||||
}
|
||||
});
|
||||
_clanRewards.computeIfAbsent(bonus.getType(), key -> new ArrayList<>()).add(bonus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<ClanRewardBonus> getClanRewardBonuses(ClanRewardType type)
|
||||
{
|
||||
return _clanRewards.get(type);
|
||||
}
|
||||
|
||||
public ClanRewardBonus getHighestReward(ClanRewardType type)
|
||||
{
|
||||
ClanRewardBonus selectedBonus = null;
|
||||
for (ClanRewardBonus currentBonus : _clanRewards.get(type))
|
||||
{
|
||||
if ((selectedBonus == null) || (selectedBonus.getLevel() < currentBonus.getLevel()))
|
||||
{
|
||||
selectedBonus = currentBonus;
|
||||
}
|
||||
}
|
||||
return selectedBonus;
|
||||
}
|
||||
|
||||
public Collection<List<ClanRewardBonus>> getClanRewardBonuses()
|
||||
{
|
||||
return _clanRewards.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of ClanRewardData.
|
||||
* @return single instance of ClanRewardData
|
||||
*/
|
||||
public static ClanRewardData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ClanRewardData INSTANCE = new ClanRewardData();
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.enums;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public enum ClanRewardType
|
||||
{
|
||||
MEMBERS_ONLINE(0, Clan::getPreviousMaxOnlinePlayers),
|
||||
HUNTING_MONSTERS(1, Clan::getPreviousHuntingPoints);
|
||||
|
||||
final int _clientId;
|
||||
final int _mask;
|
||||
final Function<Clan, Integer> _pointsFunction;
|
||||
|
||||
ClanRewardType(int clientId, Function<Clan, Integer> pointsFunction)
|
||||
{
|
||||
_clientId = clientId;
|
||||
_mask = 1 << clientId;
|
||||
_pointsFunction = pointsFunction;
|
||||
}
|
||||
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
public int getMask()
|
||||
{
|
||||
return _mask;
|
||||
}
|
||||
|
||||
public ClanRewardBonus getAvailableBonus(Clan clan)
|
||||
{
|
||||
ClanRewardBonus availableBonus = null;
|
||||
for (ClanRewardBonus bonus : ClanRewardData.getInstance().getClanRewardBonuses(this))
|
||||
{
|
||||
if (bonus.getRequiredAmount() <= _pointsFunction.apply(clan))
|
||||
{
|
||||
if ((availableBonus == null) || (availableBonus.getLevel() < bonus.getLevel()))
|
||||
{
|
||||
availableBonus = bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
return availableBonus;
|
||||
}
|
||||
|
||||
public static int getDefaultMask()
|
||||
{
|
||||
int mask = 0;
|
||||
for (ClanRewardType type : values())
|
||||
{
|
||||
mask |= type.getMask();
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
@ScheduleTarget
|
||||
private void onReset()
|
||||
{
|
||||
resetClanBonus();
|
||||
resetExtendDrop();
|
||||
resetDailyMissionRewards();
|
||||
resetDailySkills();
|
||||
@ -141,12 +140,6 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
LOGGER.info("Vitality resetted");
|
||||
}
|
||||
|
||||
private void resetClanBonus()
|
||||
{
|
||||
ClanTable.getInstance().getClans().forEach(Clan::resetClanBonus);
|
||||
LOGGER.info("Daily clan bonus has been resetted.");
|
||||
}
|
||||
|
||||
private void resetExtendDrop()
|
||||
{
|
||||
// Update data for offline players.
|
||||
|
@ -43,7 +43,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
@ -887,16 +886,6 @@ public class Party extends AbstractPlayerGroup
|
||||
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = member.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (target.useVitalityRate())
|
||||
{
|
||||
finalExp *= member.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(member, target, finalExp);
|
||||
}
|
||||
member.updateVitalityPoints(target.getVitalityPoints(member.getLevel(), exp, target.isRaid()), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(member, exp);
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ServitorInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.status.AttackableStatus;
|
||||
import org.l2jmobius.gameserver.model.actor.tasks.attackable.CommandChannelTimer;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.Hero;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnAttackableAggroRangeEnter;
|
||||
@ -506,16 +505,6 @@ public class Attackable extends Npc
|
||||
attacker.addExpAndSp(exp, sp, useVitalityRate());
|
||||
if (exp > 0)
|
||||
{
|
||||
final Clan clan = attacker.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
double finalExp = exp;
|
||||
if (useVitalityRate())
|
||||
{
|
||||
finalExp *= attacker.getStat().getExpBonusMultiplier();
|
||||
}
|
||||
clan.addHuntingPoints(attacker, this, finalExp);
|
||||
}
|
||||
attacker.updateVitalityPoints(getVitalityPoints(attacker.getLevel(), exp, _isRaid), true, false);
|
||||
PcCafePointsManager.getInstance().givePcCafePoint(attacker, exp);
|
||||
}
|
||||
|
@ -545,8 +545,6 @@ public class PlayerInstance extends Playable
|
||||
/** Recommendation Two Hours bonus **/
|
||||
protected boolean _recoTwoHoursGiven = false;
|
||||
|
||||
private ScheduledFuture<?> _onlineTimeUpdateTask;
|
||||
|
||||
private final PlayerInventory _inventory = new PlayerInventory(this);
|
||||
private final PlayerFreight _freight = new PlayerFreight(this);
|
||||
private PlayerWarehouse _warehouse;
|
||||
@ -5344,7 +5342,6 @@ public class PlayerInstance extends Playable
|
||||
stopChargeTask();
|
||||
stopFameTask();
|
||||
stopRecoGiveTask();
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6724,7 +6721,6 @@ public class PlayerInstance extends Playable
|
||||
|
||||
player.loadRecommendations();
|
||||
player.startRecoGiveTask();
|
||||
player.startOnlineTimeUpdateTask();
|
||||
|
||||
player.setOnlineStatus(true, false);
|
||||
|
||||
@ -13798,33 +13794,6 @@ public class PlayerInstance extends Playable
|
||||
return super.getMoveType();
|
||||
}
|
||||
|
||||
private void startOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
stopOnlineTimeUpdateTask();
|
||||
}
|
||||
|
||||
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
|
||||
}
|
||||
|
||||
private void updateOnlineTime()
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
_clan.addMemberOnlineTime(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopOnlineTimeUpdateTask()
|
||||
{
|
||||
if (_onlineTimeUpdateTask != null)
|
||||
{
|
||||
_onlineTimeUpdateTask.cancel(true);
|
||||
_onlineTimeUpdateTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
public GroupType getGroupType()
|
||||
{
|
||||
return isInParty() ? (_party.isInCommandChannel() ? GroupType.COMMAND_CHANNEL : GroupType.PARTY) : GroupType.NONE;
|
||||
|
@ -45,14 +45,12 @@ import org.l2jmobius.gameserver.data.xml.impl.ClanLevelData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanMasteryData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanJoin;
|
||||
@ -82,7 +80,6 @@ import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgeV2.ExPledgeShowInfoUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
|
||||
import org.l2jmobius.gameserver.util.EnumIntBitmask;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@ -152,9 +149,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
private final AtomicInteger _siegeKills = new AtomicInteger();
|
||||
private final AtomicInteger _siegeDeaths = new AtomicInteger();
|
||||
|
||||
private ClanRewardBonus _lastMembersOnlineBonus = null;
|
||||
private ClanRewardBonus _lastHuntingBonus = null;
|
||||
|
||||
private final Collection<ScheduledFuture<?>> masterySkillTasks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private volatile ClanVariables _vars;
|
||||
@ -170,18 +164,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
restore();
|
||||
_warehouse.restore();
|
||||
|
||||
final ClanRewardBonus availableOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if ((_lastMembersOnlineBonus == null) && (availableOnlineBonus != null))
|
||||
{
|
||||
_lastMembersOnlineBonus = availableOnlineBonus;
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableHuntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if ((_lastHuntingBonus == null) && (availableHuntingBonus != null))
|
||||
{
|
||||
_lastHuntingBonus = availableHuntingBonus;
|
||||
}
|
||||
|
||||
final int masteryTime19538 = getMasterySkillRemainingTime(19538);
|
||||
if (masteryTime19538 > 0)
|
||||
{
|
||||
@ -2725,112 +2707,6 @@ public class Clan implements IIdentifiable, INamable
|
||||
return _atWarWith.get(clanId);
|
||||
}
|
||||
|
||||
public synchronized void addMemberOnlineTime(PlayerInstance player)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
if (clanMember != null)
|
||||
{
|
||||
clanMember.setOnlineTime(clanMember.getOnlineTime() + (60 * 1000));
|
||||
if (clanMember.getOnlineTime() == (30 * 60 * 1000))
|
||||
{
|
||||
broadcastToOnlineMembers(new PledgeShowMemberListUpdate(clanMember));
|
||||
}
|
||||
}
|
||||
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastMembersOnlineBonus == null)
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastMembersOnlineBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastMembersOnlineBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_LOGIN_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
|
||||
final int currentMaxOnline = (int) _members.values().stream().filter(member -> member.getOnlineTime() > Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS).count();
|
||||
if (getMaxOnlineMembers() < currentMaxOnline)
|
||||
{
|
||||
getVariables().set("MAX_ONLINE_MEMBERS", currentMaxOnline);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param target
|
||||
* @param value
|
||||
*/
|
||||
public synchronized void addHuntingPoints(PlayerInstance player, Npc target, double value)
|
||||
{
|
||||
// TODO: Figure out the retail formula
|
||||
final int points = (int) value / 29600;
|
||||
if (points > 0)
|
||||
{
|
||||
getVariables().set("HUNTING_POINTS", getHuntingPoints() + points);
|
||||
final ClanRewardBonus availableBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(this);
|
||||
if (availableBonus != null)
|
||||
{
|
||||
if (_lastHuntingBonus == null)
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
else if (_lastHuntingBonus.getLevel() < availableBonus.getLevel())
|
||||
{
|
||||
_lastHuntingBonus = availableBonus;
|
||||
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_HAS_ACHIEVED_HUNTING_BONUS_LV_S1).addByte(availableBonus.getLevel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxOnlineMembers()
|
||||
{
|
||||
return getVariables().getInt("MAX_ONLINE_MEMBERS", 0);
|
||||
}
|
||||
|
||||
public int getHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousMaxOnlinePlayers()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_MAX_ONLINE_PLAYERS", 0);
|
||||
}
|
||||
|
||||
public int getPreviousHuntingPoints()
|
||||
{
|
||||
return getVariables().getInt("PREVIOUS_HUNTING_POINTS", 0);
|
||||
}
|
||||
|
||||
public boolean canClaimBonusReward(PlayerInstance player, ClanRewardType type)
|
||||
{
|
||||
final ClanMember clanMember = getClanMember(player.getObjectId());
|
||||
return (clanMember != null) && (type.getAvailableBonus(this) != null) && !clanMember.isRewardClaimed(type);
|
||||
}
|
||||
|
||||
public void resetClanBonus()
|
||||
{
|
||||
// Save current state
|
||||
getVariables().set("PREVIOUS_MAX_ONLINE_PLAYERS", getMaxOnlineMembers());
|
||||
getVariables().set("PREVIOUS_HUNTING_POINTS", getHuntingPoints());
|
||||
|
||||
// Reset
|
||||
_members.values().forEach(ClanMember::resetBonus);
|
||||
getVariables().remove("HUNTING_POINTS");
|
||||
|
||||
// force store
|
||||
getVariables().storeMe();
|
||||
|
||||
// Send Packet
|
||||
broadcastToOnlineMembers(ExPledgeBonusMarkReset.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public void addMastery(int id)
|
||||
{
|
||||
getVariables().set(ClanVariables.CLAN_MASTERY + id, true);
|
||||
|
@ -23,12 +23,9 @@ import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
|
||||
/**
|
||||
* This class holds the clan members data.
|
||||
@ -50,7 +47,6 @@ public class ClanMember
|
||||
private int _pledgeType;
|
||||
private int _apprentice;
|
||||
private int _sponsor;
|
||||
private long _onlineTime;
|
||||
|
||||
/**
|
||||
* Used to restore a clan member from the database.
|
||||
@ -817,48 +813,4 @@ public class ClanMember
|
||||
LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getOnlineTime()
|
||||
{
|
||||
return _onlineTime;
|
||||
}
|
||||
|
||||
public void setOnlineTime(long onlineTime)
|
||||
{
|
||||
_onlineTime = onlineTime;
|
||||
}
|
||||
|
||||
public void resetBonus()
|
||||
{
|
||||
_onlineTime = 0;
|
||||
final PlayerVariables vars = getVariables();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", 0);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
public int getOnlineStatus()
|
||||
{
|
||||
return !isOnline() ? 0 : _onlineTime >= (Config.ALT_CLAN_MEMBERS_TIME_FOR_BONUS) ? 2 : 1;
|
||||
}
|
||||
|
||||
public boolean isRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
final int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
return (claimedRewards & type.getMask()) == type.getMask();
|
||||
}
|
||||
|
||||
public void setRewardClaimed(ClanRewardType type)
|
||||
{
|
||||
final PlayerVariables vars = getVariables();
|
||||
int claimedRewards = vars.getInt("CLAIMED_CLAN_REWARDS", ClanRewardType.getDefaultMask());
|
||||
claimedRewards |= type.getMask();
|
||||
vars.set("CLAIMED_CLAN_REWARDS", claimedRewards);
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
private PlayerVariables getVariables()
|
||||
{
|
||||
return _player != null ? _player.getVariables() : new PlayerVariables(_objectId);
|
||||
}
|
||||
}
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.clan;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ClanRewardBonus
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _level;
|
||||
private final int _requiredAmount;
|
||||
private SkillHolder _skillReward;
|
||||
private ItemHolder _itemReward;
|
||||
|
||||
public ClanRewardBonus(ClanRewardType type, int level, int requiredAmount)
|
||||
{
|
||||
_type = type;
|
||||
_level = level;
|
||||
_requiredAmount = requiredAmount;
|
||||
}
|
||||
|
||||
public ClanRewardType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public int getRequiredAmount()
|
||||
{
|
||||
return _requiredAmount;
|
||||
}
|
||||
|
||||
public SkillHolder getSkillReward()
|
||||
{
|
||||
return _skillReward;
|
||||
}
|
||||
|
||||
public void setSkillReward(SkillHolder skillReward)
|
||||
{
|
||||
_skillReward = skillReward;
|
||||
}
|
||||
|
||||
public ItemHolder getItemReward()
|
||||
{
|
||||
return _itemReward;
|
||||
}
|
||||
|
||||
public void setItemReward(ItemHolder itemReward)
|
||||
{
|
||||
_itemReward = itemReward;
|
||||
}
|
||||
}
|
@ -92,9 +92,6 @@ import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMa
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeMasterySet;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillActivate;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgeV2.RequestExPledgeSkillInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRGamePoint;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.primeshop.RequestBRPresentBuyProduct;
|
||||
@ -402,9 +399,9 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_TODO_LIST_HTML(0x11E, null, ConnectionState.IN_GAME),
|
||||
REQUEST_ONE_DAY_REWARD_RECEIVE(0x11F, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET(0x120, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x121, RequestPledgeBonusOpen::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x122, RequestPledgeBonusRewardList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x123, RequestPledgeBonusReward::new, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_OPEN(0x121, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD_LIST(0x122, null, ConnectionState.IN_GAME),
|
||||
REQUEST_PLEDGE_BONUS_REWARD(0x123, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x124, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET_LOGIN(0x125, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_MEMO_INFO(0x126, null, ConnectionState.IN_GAME),
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusOpen;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusOpen implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusOpen(player));
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanMember;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusReward implements IClientIncomingPacket
|
||||
{
|
||||
private int _type;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_type < 0) || (_type > ClanRewardType.values().length))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Clan clan = player.getClan();
|
||||
final ClanRewardType type = ClanRewardType.values()[_type];
|
||||
final ClanMember member = clan.getClanMember(player.getObjectId());
|
||||
if (clan.canClaimBonusReward(player, type))
|
||||
{
|
||||
final ClanRewardBonus bonus = type.getAvailableBonus(player.getClan());
|
||||
if (bonus != null)
|
||||
{
|
||||
final ItemHolder itemReward = bonus.getItemReward();
|
||||
final SkillHolder skillReward = bonus.getSkillReward();
|
||||
if (itemReward != null)
|
||||
{
|
||||
player.addItem("ClanReward", itemReward.getId(), itemReward.getCount(), player, true);
|
||||
}
|
||||
else if (skillReward != null)
|
||||
{
|
||||
skillReward.getSkill().activateSkill(player, player);
|
||||
}
|
||||
member.setRewardClaimed(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(player + " Attempting to claim reward but clan(" + clan + ") doesn't have such!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.clientpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusList;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestPledgeBonusRewardList implements IClientIncomingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if ((player == null) || (player.getClan() == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExPledgeBonusList());
|
||||
}
|
||||
}
|
@ -91,7 +91,7 @@ public class PledgeShowMemberListAll implements IClientOutgoingPacket
|
||||
packet.writeD(0); // race
|
||||
packet.writeD(m.isOnline() ? m.getObjectId() : 0); // objectId = online 0 = offline
|
||||
packet.writeD(0);
|
||||
packet.writeC(m.getOnlineStatus());
|
||||
packet.writeC(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
private final int _level;
|
||||
private final int _classId;
|
||||
private final int _objectId;
|
||||
private final int _onlineStatus;
|
||||
|
||||
public PledgeShowMemberListUpdate(PlayerInstance player)
|
||||
{
|
||||
@ -45,7 +44,6 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
_classId = member.getClassId();
|
||||
_objectId = member.isOnline() ? member.getObjectId() : 0;
|
||||
_pledgeType = member.getPledgeType();
|
||||
_onlineStatus = member.getOnlineStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,7 +59,7 @@ public class PledgeShowMemberListUpdate implements IClientOutgoingPacket
|
||||
packet.writeD(_objectId);
|
||||
packet.writeD(_pledgeType);
|
||||
packet.writeD(0); // _hasSponsor
|
||||
packet.writeC(_onlineStatus);
|
||||
packet.writeC(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExPledgeBonusList implements IClientOutgoingPacket
|
||||
{
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_LIST.writeId(packet);
|
||||
packet.writeC(0x00); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.MEMBERS_ONLINE).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getSkillReward().getSkillId());
|
||||
});
|
||||
packet.writeC(0x01); // 140
|
||||
ClanRewardData.getInstance().getClanRewardBonuses(ClanRewardType.HUNTING_MONSTERS).stream().sorted(Comparator.comparingInt(ClanRewardBonus::getLevel)).forEach(bonus ->
|
||||
{
|
||||
packet.writeD(bonus.getItemReward().getId());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusMarkReset implements IClientOutgoingPacket
|
||||
{
|
||||
public static ExPledgeBonusMarkReset STATIC_PACKET = new ExPledgeBonusMarkReset();
|
||||
|
||||
private ExPledgeBonusMarkReset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_MARK_RESET.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ClanRewardData;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.clan.ClanRewardBonus;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusOpen implements IClientOutgoingPacket
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ExPledgeBonusOpen.class.getName());
|
||||
|
||||
private final PlayerInstance _player;
|
||||
|
||||
public ExPledgeBonusOpen(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
final Clan clan = _player.getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + _player + " attempting to write to a null clan!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final ClanRewardBonus highestMembersOnlineBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.MEMBERS_ONLINE);
|
||||
final ClanRewardBonus highestHuntingBonus = ClanRewardData.getInstance().getHighestReward(ClanRewardType.HUNTING_MONSTERS);
|
||||
final ClanRewardBonus membersOnlineBonus = ClanRewardType.MEMBERS_ONLINE.getAvailableBonus(clan);
|
||||
final ClanRewardBonus huntingBonus = ClanRewardType.HUNTING_MONSTERS.getAvailableBonus(clan);
|
||||
if (highestMembersOnlineBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find highest available clan hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestMembersOnlineBonus.getSkillReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find skill reward for highest available members online bonus!!");
|
||||
return false;
|
||||
}
|
||||
else if (highestHuntingBonus.getItemReward() == null)
|
||||
{
|
||||
LOGGER.warning("Couldn't find item reward for highest available hunting bonus!!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// General OP Code
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_OPEN.writeId(packet);
|
||||
|
||||
// Members online bonus
|
||||
packet.writeD(highestMembersOnlineBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getMaxOnlineMembers());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(membersOnlineBonus != null ? highestMembersOnlineBonus.getSkillReward().getSkillId() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? membersOnlineBonus.getLevel() : 0x00);
|
||||
packet.writeC(membersOnlineBonus != null ? 0x01 : 0x00);
|
||||
|
||||
// Hunting bonus
|
||||
packet.writeD(highestHuntingBonus.getRequiredAmount());
|
||||
packet.writeD(clan.getHuntingPoints());
|
||||
packet.writeC(0x00); // 140
|
||||
packet.writeD(huntingBonus != null ? highestHuntingBonus.getItemReward().getId() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? huntingBonus.getLevel() : 0x00);
|
||||
packet.writeC(huntingBonus != null ? 0x01 : 0x00);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets.pledgebonus;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.enums.ClanRewardType;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExPledgeBonusUpdate implements IClientOutgoingPacket
|
||||
{
|
||||
private final ClanRewardType _type;
|
||||
private final int _value;
|
||||
|
||||
public ExPledgeBonusUpdate(ClanRewardType type, int value)
|
||||
{
|
||||
_type = type;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_PLEDGE_BONUS_UPDATE.writeId(packet);
|
||||
packet.writeC(_type.getClientId());
|
||||
packet.writeD(_value);
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user