Updated AgitDecoInfo packet.
This commit is contained in:
		| @@ -30,6 +30,7 @@ import java.util.logging.Logger; | ||||
| import org.l2jmobius.commons.database.DatabaseFactory; | ||||
| import org.l2jmobius.gameserver.data.xml.SkillData; | ||||
| import org.l2jmobius.gameserver.data.xml.SkillTreeData; | ||||
| import org.l2jmobius.gameserver.enums.ClanHallGrade; | ||||
| import org.l2jmobius.gameserver.enums.SocialClass; | ||||
| import org.l2jmobius.gameserver.model.SkillLearn; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| @@ -43,9 +44,11 @@ import org.l2jmobius.gameserver.model.zone.type.ResidenceZone; | ||||
| public abstract class AbstractResidence extends ListenersContainer implements INamable | ||||
| { | ||||
| 	private static final Logger LOGGER = Logger.getLogger(AbstractResidence.class.getName()); | ||||
| 	 | ||||
| 	protected ClanHallGrade _grade = ClanHallGrade.GRADE_NONE; | ||||
| 	 | ||||
| 	private final int _residenceId; | ||||
| 	private String _name; | ||||
| 	 | ||||
| 	private ResidenceZone _zone = null; | ||||
| 	private final Map<Integer, ResidenceFunction> _functions = new ConcurrentHashMap<>(); | ||||
| 	private List<SkillLearn> _residentialSkills = new ArrayList<>(); | ||||
| @@ -67,6 +70,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN | ||||
| 		_residentialSkills = SkillTreeData.getInstance().getAvailableResidentialSkills(getResidenceId()); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Gets the grade of clan hall. | ||||
| 	 * @return grade of this {@link ClanHall} in {@link ClanHallGrade} enum. | ||||
| 	 */ | ||||
| 	public ClanHallGrade getGrade() | ||||
| 	{ | ||||
| 		return _grade; | ||||
| 	} | ||||
| 	 | ||||
| 	public int getResidenceId() | ||||
| 	{ | ||||
| 		return _residenceId; | ||||
|   | ||||
| @@ -57,7 +57,6 @@ public class ClanHall extends AbstractResidence | ||||
| 	private static final Logger LOGGER = Logger.getLogger(ClanHall.class.getName()); | ||||
| 	 | ||||
| 	// Static parameters | ||||
| 	private final ClanHallGrade _grade; | ||||
| 	private final ClanHallType _type; | ||||
| 	private final int _minBid; | ||||
| 	final int _lease; | ||||
| @@ -196,15 +195,6 @@ public class ClanHall extends AbstractResidence | ||||
| 		_doors.forEach(door -> door.openCloseMe(open)); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Gets the grade of clan hall. | ||||
| 	 * @return grade of this {@link ClanHall} in {@link ClanHallGrade} enum. | ||||
| 	 */ | ||||
| 	public ClanHallGrade getGrade() | ||||
| 	{ | ||||
| 		return _grade; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Gets all {@link Door} related to this {@link ClanHall}. | ||||
| 	 * @return all {@link Door} related to this {@link ClanHall} | ||||
|   | ||||
| @@ -17,12 +17,14 @@ | ||||
| package org.l2jmobius.gameserver.network.serverpackets; | ||||
|  | ||||
| import org.l2jmobius.commons.network.PacketWriter; | ||||
| import org.l2jmobius.gameserver.enums.ClanHallGrade; | ||||
| import org.l2jmobius.gameserver.model.residences.AbstractResidence; | ||||
| import org.l2jmobius.gameserver.model.residences.ResidenceFunction; | ||||
| import org.l2jmobius.gameserver.model.residences.ResidenceFunctionType; | ||||
| import org.l2jmobius.gameserver.network.OutgoingPackets; | ||||
|  | ||||
| /** | ||||
|  * @author Steuf, UnAfraid | ||||
|  * @author Steuf | ||||
|  */ | ||||
| public class AgitDecoInfo implements IClientOutgoingPacket | ||||
| { | ||||
| @@ -38,20 +40,151 @@ public class AgitDecoInfo implements IClientOutgoingPacket | ||||
| 	{ | ||||
| 		OutgoingPackets.AGIT_DECO_INFO.writeId(packet); | ||||
| 		packet.writeD(_residense.getResidenceId()); | ||||
| 		for (ResidenceFunctionType type : ResidenceFunctionType.values()) | ||||
| 		// Fireplace | ||||
| 		ResidenceFunction function = _residense.getFunction(ResidenceFunctionType.HP_REGEN); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			if (type == ResidenceFunctionType.NONE) | ||||
| 			{ | ||||
| 				continue; | ||||
| 			} | ||||
| 			packet.writeC(_residense.hasFunction(type) ? 1 : 0); | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (((_residense.getGrade() == ClanHallGrade.GRADE_NONE) && (function.getLevel() < 2)) || ((_residense.getGrade() == ClanHallGrade.GRADE_D) && (function.getLevel() < 3)) || ((_residense.getGrade() == ClanHallGrade.GRADE_C) && (function.getLevel() < 4)) || ((_residense.getGrade() == ClanHallGrade.GRADE_B) && (function.getLevel() < 5))) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Carpet - Statue | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.MP_REGEN); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if ((((_residense.getGrade() == ClanHallGrade.GRADE_NONE) || (_residense.getGrade() == ClanHallGrade.GRADE_D)) && (function.getLevel() < 2)) || ((_residense.getGrade() == ClanHallGrade.GRADE_C) && (function.getLevel() < 3)) || ((_residense.getGrade() == ClanHallGrade.GRADE_B) && (function.getLevel() < 4))) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Chandelier | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.EXP_RESTORE); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (function.getLevel() < 2) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Mirror | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.TELEPORT); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (function.getLevel() < 2) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Crystal | ||||
| 		packet.writeC(0); | ||||
| 		// Curtain | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.CURTAIN); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (function.getLevel() < 2) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Magic Curtain | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.ITEM); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (((_residense.getGrade() == ClanHallGrade.GRADE_NONE) && (function.getLevel() < 2)) || (function.getLevel() < 3)) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Support | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.BUFF); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (((_residense.getGrade() == ClanHallGrade.GRADE_NONE) && (function.getLevel() < 2)) || ((_residense.getGrade() == ClanHallGrade.GRADE_D) && (function.getLevel() < 4)) || ((_residense.getGrade() == ClanHallGrade.GRADE_C) && (function.getLevel() < 5)) || ((_residense.getGrade() == ClanHallGrade.GRADE_B) && (function.getLevel() < 8))) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Flag | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.OUTERFLAG); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (function.getLevel() < 2) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Front platform | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.PLATFORM); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (function.getLevel() < 2) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Item create? | ||||
| 		function = _residense.getFunction(ResidenceFunctionType.ITEM); | ||||
| 		if ((function == null) || (function.getLevel() == 0)) | ||||
| 		{ | ||||
| 			packet.writeC(0); | ||||
| 		} | ||||
| 		else if (((_residense.getGrade() == ClanHallGrade.GRADE_NONE) && (function.getLevel() < 2)) || (function.getLevel() < 3)) | ||||
| 		{ | ||||
| 			packet.writeC(1); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			packet.writeC(2); | ||||
| 		} | ||||
| 		// Unknown | ||||
| 		packet.writeD(0); // TODO: Find me! | ||||
| 		packet.writeD(0); // TODO: Find me! | ||||
| 		packet.writeD(0); // TODO: Find me! | ||||
| 		packet.writeD(0); // TODO: Find me! | ||||
| 		packet.writeD(0); // TODO: Find me! | ||||
| 		return true; | ||||
| 	} | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment