Store some client settings on server side.
Contributed by Index.
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
|
||||
/**
|
||||
* @author Index
|
||||
*/
|
||||
public class ClientSettings
|
||||
{
|
||||
private static final String VARIABLE = "CLIENT_SETTINGS";
|
||||
|
||||
private final Player _player;
|
||||
private boolean _announceEnabled;
|
||||
private boolean _partyRequestRestrictedFromOthers;
|
||||
private boolean _partyRequestRestrictedFromClan;
|
||||
private boolean _partyRequestRestrictedFromFriends;
|
||||
private boolean _friendRequestRestrictedFromOthers;
|
||||
private boolean _friendRequestRestrictedFromClan;
|
||||
private int _partyContributionType;
|
||||
|
||||
public ClientSettings(Player player)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
final String variable = _player.getVariables().getString(VARIABLE, "");
|
||||
final StatSet settings = variable.isEmpty() ? new StatSet() : new StatSet(Arrays.stream(variable.split(",")).map(entry -> entry.split("=")).collect(Collectors.toMap(entry -> entry[0].replace("{", "").replace(" ", ""), entry -> entry[1].replace("}", "").replace(" ", ""))));
|
||||
_announceEnabled = settings.getBoolean("ANNOUNCE_ENABLED", true);
|
||||
_partyRequestRestrictedFromOthers = settings.getBoolean("PARTY_REQUEST_RESTRICTED_FROM_OTHERS", false);
|
||||
_partyRequestRestrictedFromClan = settings.getBoolean("PARTY_REQUEST_RESTRICTED_FROM_CLAN", false);
|
||||
_partyRequestRestrictedFromFriends = settings.getBoolean("PARTY_REQUEST_RESTRICTED_FROM_FRIENDS", false);
|
||||
_friendRequestRestrictedFromOthers = settings.getBoolean("FRIENDS_REQUEST_RESTRICTED_FROM_OTHERS", false);
|
||||
_friendRequestRestrictedFromClan = settings.getBoolean("FRIENDS_REQUEST_RESTRICTED_FROM_CLAN", false);
|
||||
_partyContributionType = settings.getInt("PARTY_CONTRIBUTION_TYPE", 0);
|
||||
}
|
||||
|
||||
public void storeSettings()
|
||||
{
|
||||
final StatSet settings = new StatSet();
|
||||
settings.set("ANNOUNCE_ENABLED", _announceEnabled);
|
||||
settings.set("PARTY_REQUEST_RESTRICTED_FROM_OTHERS", _partyRequestRestrictedFromOthers);
|
||||
settings.set("PARTY_REQUEST_RESTRICTED_FROM_CLAN", _partyRequestRestrictedFromClan);
|
||||
settings.set("PARTY_REQUEST_RESTRICTED_FROM_FRIENDS", _partyRequestRestrictedFromFriends);
|
||||
settings.set("FRIENDS_REQUEST_RESTRICTED_FROM_OTHERS", _friendRequestRestrictedFromOthers);
|
||||
settings.set("FRIENDS_REQUEST_RESTRICTED_FROM_CLAN", _friendRequestRestrictedFromClan);
|
||||
settings.set("PARTY_CONTRIBUTION_TYPE", _partyContributionType);
|
||||
_player.getVariables().set(VARIABLE, settings.getSet());
|
||||
}
|
||||
|
||||
public boolean isAnnounceEnabled()
|
||||
{
|
||||
return _announceEnabled;
|
||||
}
|
||||
|
||||
public void setAnnounceEnabled(boolean enabled)
|
||||
{
|
||||
_announceEnabled = enabled;
|
||||
storeSettings();
|
||||
}
|
||||
|
||||
public boolean isPartyRequestRestrictedFromOthers()
|
||||
{
|
||||
return _partyRequestRestrictedFromOthers;
|
||||
}
|
||||
|
||||
public void setPartyRequestRestrictedFromOthers(boolean partyRequestRestrictedFromOthers)
|
||||
{
|
||||
_partyRequestRestrictedFromOthers = partyRequestRestrictedFromOthers;
|
||||
}
|
||||
|
||||
public boolean isPartyRequestRestrictedFromClan()
|
||||
{
|
||||
return _partyRequestRestrictedFromClan;
|
||||
}
|
||||
|
||||
public void setPartyRequestRestrictedFromClan(boolean partyRequestRestrictedFromClan)
|
||||
{
|
||||
_partyRequestRestrictedFromClan = partyRequestRestrictedFromClan;
|
||||
}
|
||||
|
||||
public boolean isPartyRequestRestrictedFromFriends()
|
||||
{
|
||||
return _partyRequestRestrictedFromFriends;
|
||||
}
|
||||
|
||||
public void setPartyRequestRestrictedFromFriends(boolean partyRequestRestrictedFromFriends)
|
||||
{
|
||||
_partyRequestRestrictedFromFriends = partyRequestRestrictedFromFriends;
|
||||
}
|
||||
|
||||
public boolean isFriendRequestRestrictedFromOthers()
|
||||
{
|
||||
return _friendRequestRestrictedFromOthers;
|
||||
}
|
||||
|
||||
public void setFriendRequestRestrictedFromOthers(boolean friendRequestRestrictedFromOthers)
|
||||
{
|
||||
_friendRequestRestrictedFromOthers = friendRequestRestrictedFromOthers;
|
||||
}
|
||||
|
||||
public boolean isFriendRequestRestrictedFromClan()
|
||||
{
|
||||
return _friendRequestRestrictedFromClan;
|
||||
}
|
||||
|
||||
public void setFriendRequestRestrictionFromClan(boolean friendRequestRestrictedFromClan)
|
||||
{
|
||||
_friendRequestRestrictedFromClan = friendRequestRestrictedFromClan;
|
||||
}
|
||||
|
||||
public int getPartyContributionType()
|
||||
{
|
||||
return _partyContributionType;
|
||||
}
|
||||
|
||||
public void setPartyContributionType(int partyContributionType)
|
||||
{
|
||||
_partyContributionType = partyContributionType;
|
||||
storeSettings();
|
||||
}
|
||||
}
|
@@ -138,6 +138,7 @@ import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.AccessLevel;
|
||||
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.ClientSettings;
|
||||
import org.l2jmobius.gameserver.model.CommandChannel;
|
||||
import org.l2jmobius.gameserver.model.ContactList;
|
||||
import org.l2jmobius.gameserver.model.Duel;
|
||||
@@ -934,6 +935,18 @@ public class Player extends Playable
|
||||
return _sellingBuffs;
|
||||
}
|
||||
|
||||
// Player client settings
|
||||
private ClientSettings _clientSettings;
|
||||
|
||||
public ClientSettings getClientSettings()
|
||||
{
|
||||
if (_clientSettings == null)
|
||||
{
|
||||
_clientSettings = new ClientSettings(this);
|
||||
}
|
||||
return _clientSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Player and add it in the characters table of the database.<br>
|
||||
* <br>
|
||||
|
@@ -143,6 +143,8 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.settings.ExInteractModify;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.settings.ExSaveItemAnnounceSetting;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||
@@ -509,7 +511,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
EX_ELEMENTAL_SPIRIT_CHANGE_TYPE(0x15C, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_LIST_FOR_AD(0x15D, null, ConnectionState.IN_GAME),
|
||||
REQUEST_USER_BAN_INFO(0x15E, null, ConnectionState.IN_GAME),
|
||||
EX_INTERACT_MODIFY(0x15F, null, ConnectionState.IN_GAME),
|
||||
EX_INTERACT_MODIFY(0x15F, ExInteractModify::new, ConnectionState.IN_GAME),
|
||||
EX_TRY_ENCHANT_ARTIFACT(0x160, RequestExTryEnchantArtifact::new, ConnectionState.IN_GAME),
|
||||
EX_UPGRADE_SYSTEM_NORMAL_REQUEST(0x161, ExUpgradeSystemNormalRequest::new, ConnectionState.IN_GAME),
|
||||
EX_PURCHASE_LIMIT_SHOP_ITEM_LIST(0x162, RequestPurchaseLimitShopItemList::new, ConnectionState.IN_GAME),
|
||||
@@ -574,7 +576,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
EX_CRAFT_RANDOM_REFRESH(0x19C, null, ConnectionState.IN_GAME),
|
||||
EX_CRAFT_RANDOM_MAKE(0x19D, null, ConnectionState.IN_GAME),
|
||||
EX_MULTI_SELL_LIST(0x19E, null, ConnectionState.IN_GAME),
|
||||
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19F, null, ConnectionState.IN_GAME),
|
||||
EX_SAVE_ITEM_ANNOUNCE_SETTING(0x19F, ExSaveItemAnnounceSetting::new, ConnectionState.IN_GAME),
|
||||
EX_OLYMPIAD_UI(0x1A0, null, ConnectionState.IN_GAME),
|
||||
// 270
|
||||
EX_SHARED_POSITION_SHARING_UI(0x1A1, null, ConnectionState.IN_GAME),
|
||||
|
@@ -121,6 +121,7 @@ import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusPoi
|
||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExHomunculusReady;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.homunculus.ExShowHomunculusBirthInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.settings.ExItemAnnounceSetting;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
|
||||
/**
|
||||
@@ -668,6 +669,10 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
player.restoreAutoShortcuts();
|
||||
player.restoreAutoSettings();
|
||||
|
||||
// Client settings restore.
|
||||
player.getClientSettings();
|
||||
player.sendPacket(new ExItemAnnounceSetting(player.getClientSettings().isAnnounceEnabled()));
|
||||
|
||||
// Fix for equipped item skills
|
||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||
{
|
||||
|
@@ -68,7 +68,7 @@ public class RequestAnswerJoinParty implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
requestor.sendPacket(new JoinParty(_response, requestor));
|
||||
if (_response == 1)
|
||||
{
|
||||
if (party.getMemberCount() >= Config.ALT_PARTY_MAX_MEMBERS)
|
||||
|
@@ -227,7 +227,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
||||
sm.addInt(item.getEnchantLevel());
|
||||
sm.addItemName(item);
|
||||
player.broadcastPacket(sm);
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(item, player));
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.ENCHANT));
|
||||
|
||||
final Skill skill = CommonSkill.FIREWORK.getSkill();
|
||||
if (skill != null)
|
||||
|
@@ -22,6 +22,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.FakePlayerData;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.ClientSettings;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
@@ -74,6 +75,12 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final ClientSettings clientSettings = requestor.getClientSettings();
|
||||
if (clientSettings.getPartyContributionType() != _partyDistributionTypeId)
|
||||
{
|
||||
requestor.getClientSettings().setPartyContributionType(_partyDistributionTypeId);
|
||||
}
|
||||
|
||||
if (FakePlayerData.getInstance().isTalkable(_name))
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_BEEN_INVITED_TO_THE_PARTY);
|
||||
@@ -147,7 +154,12 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
requestor.sendPacket(SystemMessageId.THE_TARGET_CANNOT_BE_INVITED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkInviteByIgnoredSettings(target, requestor))
|
||||
{
|
||||
requestor.sendPacket(new SystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_PARTY_REQUESTS_AND_CANNOT_RECEIVE_A_PARTY_REQUEST).addPcName(target));
|
||||
target.sendPacket(new SystemMessage(SystemMessageId.PARTY_INVITATION_IS_SET_UP_TO_BE_REJECTED_AT_PREFERENCES_THE_PARTY_INVITATION_OF_C1_IS_AUTOMATICALLY_REJECTED).addPcName(requestor));
|
||||
return;
|
||||
}
|
||||
if (target.isCursedWeaponEquipped() || requestor.isCursedWeaponEquipped())
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
@@ -245,4 +257,16 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
requestor.sendPacket(SystemMessageId.WAITING_FOR_ANOTHER_REPLY);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkInviteByIgnoredSettings(Player target, Player requestor)
|
||||
{
|
||||
ClientSettings targetClientSettings = target.getClientSettings();
|
||||
boolean condition = targetClientSettings.isPartyRequestRestrictedFromOthers();
|
||||
boolean clanCheck = (target.getClan() != null) && (requestor.getClan() != null) && (target.getClan() == requestor.getClan());
|
||||
if (condition && ((!targetClientSettings.isPartyRequestRestrictedFromFriends() && target.getFriendList().contains(requestor.getObjectId())) || (!targetClientSettings.isPartyRequestRestrictedFromClan() && clanCheck)))
|
||||
{
|
||||
condition = false;
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.FakePlayerData;
|
||||
import org.l2jmobius.gameserver.model.BlockList;
|
||||
import org.l2jmobius.gameserver.model.ClientSettings;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
@@ -134,6 +135,12 @@ public class RequestFriendInvite implements IClientIncomingPacket
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
// Check, if tatget blocked sends requests in game.
|
||||
if (checkInviteByIgnoredSettings(friend, player))
|
||||
{
|
||||
player.sendPacket(new SystemMessage(SystemMessageId.PREFERENCES_IS_CONFIGURED_TO_REFUSE_FRIEND_REQUESTS_AND_THE_FRIEND_INVITATION_OF_C1_IS_AUTOMATICALLY_REJECTED).addPcName(friend));
|
||||
return;
|
||||
}
|
||||
// Friend request sent.
|
||||
player.onTransactionRequest(friend);
|
||||
friend.sendPacket(new FriendAddRequest(player.getName()));
|
||||
@@ -141,4 +148,15 @@ public class RequestFriendInvite implements IClientIncomingPacket
|
||||
sm.addString(_name);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
|
||||
private boolean checkInviteByIgnoredSettings(Player target, Player requestor)
|
||||
{
|
||||
final ClientSettings targetClientSettings = target.getClientSettings();
|
||||
final boolean condition = targetClientSettings.isFriendRequestRestrictedFromOthers();
|
||||
if (condition && !targetClientSettings.isFriendRequestRestrictedFromClan() && (target.getClan() != null) && (requestor.getClan() != null) && (target.getClan() == requestor.getClan()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.settings;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.ClientSettings;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
|
||||
/**
|
||||
* @author Index
|
||||
*/
|
||||
public class ExInteractModify implements IClientIncomingPacket
|
||||
{
|
||||
private int _type;
|
||||
private int _settings;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_type = packet.readC();
|
||||
_settings = packet.readC();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ClientSettings clientSettings = player.getClientSettings();
|
||||
switch (_type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
clientSettings.setPartyRequestRestrictedFromOthers((_settings & 1) == 1);
|
||||
clientSettings.setPartyRequestRestrictedFromClan((_settings & 2) == 2);
|
||||
clientSettings.setPartyRequestRestrictedFromFriends((_settings & 4) == 4);
|
||||
clientSettings.storeSettings();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
clientSettings.setFriendRequestRestrictedFromOthers((_settings & 1) == 1);
|
||||
clientSettings.setFriendRequestRestrictionFromClan((_settings & 2) == 2);
|
||||
clientSettings.storeSettings();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.settings;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.settings.ExItemAnnounceSetting;
|
||||
|
||||
/**
|
||||
* @author Index
|
||||
*/
|
||||
public class ExSaveItemAnnounceSetting implements IClientIncomingPacket
|
||||
{
|
||||
private boolean _announceType;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_announceType = packet.readC() == 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.getClientSettings().setAnnounceEnabled(_announceType);
|
||||
player.sendPacket(new ExItemAnnounceSetting(_announceType));
|
||||
}
|
||||
}
|
@@ -22,28 +22,62 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
/**
|
||||
* @author NviX
|
||||
* @author NviX, Mobius
|
||||
*/
|
||||
public class ExItemAnnounce implements IClientOutgoingPacket
|
||||
{
|
||||
private final Item _item;
|
||||
private final Player _player;
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
|
||||
public ExItemAnnounce(Item item, Player player)
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
private final String _announceName;
|
||||
|
||||
public ExItemAnnounce(Player player, Item item, int type)
|
||||
{
|
||||
_item = item;
|
||||
_player = player;
|
||||
_type = type;
|
||||
if (player.getClientSettings().isAnnounceEnabled())
|
||||
{
|
||||
_announceName = player.getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (player.getLang())
|
||||
{
|
||||
case "ru":
|
||||
{
|
||||
_announceName = "Некто";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_announceName = "Someone";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_ITEM_ANNOUNCE.writeId(packet);
|
||||
packet.writeC(0); // item icon
|
||||
packet.writeString(_player.getName()); // name of player
|
||||
// _type
|
||||
// 0 - enchant
|
||||
// 1 - item get from container
|
||||
// 2 - item get from random creation
|
||||
// 3 - item get from special creation
|
||||
// 4 - item get from workbench?
|
||||
// 5 - item get from festival
|
||||
// 6 - item get from "limited random creation"
|
||||
// 7 - fire and item get from container
|
||||
// 8 and others - null item name by item_id and icon from chest.
|
||||
packet.writeC(_type); // announce type
|
||||
packet.writeString(_announceName); // name of player
|
||||
packet.writeD(_item.getId()); // item id
|
||||
packet.writeD(_item.getEnchantLevel()); // enchant level
|
||||
packet.writeC(0); // name of item
|
||||
packet.writeC(_item.getEnchantLevel()); // enchant level
|
||||
packet.writeD(0); // chest item id
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -17,15 +17,18 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public class JoinParty implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _response;
|
||||
private final int _type;
|
||||
|
||||
public JoinParty(int response)
|
||||
public JoinParty(int response, Player requestor)
|
||||
{
|
||||
_response = response;
|
||||
_type = requestor.getClientSettings().getPartyContributionType();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,7 +36,12 @@ public class JoinParty implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.JOIN_PARTY.writeId(packet);
|
||||
packet.writeD(_response);
|
||||
packet.writeD(0); // TODO: Find me!
|
||||
packet.writeD(_type);
|
||||
if (_type != 0)
|
||||
{
|
||||
packet.writeD(0); // TODO: Find me!
|
||||
packet.writeD(0); // TODO: Find me!
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.settings;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Index
|
||||
*/
|
||||
public class ExItemAnnounceSetting implements IClientOutgoingPacket
|
||||
{
|
||||
private final boolean _announceEnabled;
|
||||
|
||||
public ExItemAnnounceSetting(boolean announceEnabled)
|
||||
{
|
||||
_announceEnabled = announceEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_ITEM_ANNOUNCE_SETTING.writeId(packet);
|
||||
packet.writeC(_announceEnabled ? 1 : 0);
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user