Multisell, augment and tax zone rework.
Adapted from: L2jUnity free files.
This commit is contained in:
@@ -19,11 +19,10 @@ package ai.others.DelusionTeleport;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.instancemanager.TownManager;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2TownZone;
|
||||
import com.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -50,20 +49,18 @@ public final class DelusionTeleport extends AbstractNpcAI
|
||||
new Location(-114597, -152501, -6750),
|
||||
new Location(-114589, -154162, -6750)
|
||||
};
|
||||
// Player Variables
|
||||
private static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||
|
||||
private static final Map<Integer, Location> RETURN_LOCATIONS = new HashMap<>();
|
||||
|
||||
static
|
||||
{
|
||||
RETURN_LOCATIONS.put(0, new Location(43835, -47749, -792)); // Undefined origin, return to Rune
|
||||
RETURN_LOCATIONS.put(7, new Location(-14023, 123677, -3112)); // Gludio
|
||||
RETURN_LOCATIONS.put(8, new Location(18101, 145936, -3088)); // Dion
|
||||
RETURN_LOCATIONS.put(10, new Location(80905, 56361, -1552)); // Oren
|
||||
RETURN_LOCATIONS.put(14, new Location(42772, -48062, -792)); // Rune
|
||||
RETURN_LOCATIONS.put(15, new Location(108469, 221690, -3592)); // Heine
|
||||
RETURN_LOCATIONS.put(17, new Location(85991, -142234, -1336)); // Schuttgart
|
||||
RETURN_LOCATIONS.put(20, new Location(-14023, 123677, -3112)); // Gludio
|
||||
RETURN_LOCATIONS.put(30, new Location(18101, 145936, -3088)); // Dion
|
||||
RETURN_LOCATIONS.put(40, new Location(80905, 56361, -1552)); // Heine
|
||||
RETURN_LOCATIONS.put(50, new Location(108469, 221690, -3592)); // Oren
|
||||
RETURN_LOCATIONS.put(60, new Location(85991, -142234, -1336)); // Schuttgart
|
||||
RETURN_LOCATIONS.put(70, new Location(42772, -48062, -792)); // Rune
|
||||
}
|
||||
|
||||
private DelusionTeleport()
|
||||
@@ -77,16 +74,15 @@ public final class DelusionTeleport extends AbstractNpcAI
|
||||
{
|
||||
if (npc.getId() == NPCS[0]) // Pathfinder Worker
|
||||
{
|
||||
final L2TownZone town = TownManager.getTown(npc.getX(), npc.getY(), npc.getZ());
|
||||
final int townId = ((town == null) ? 0 : town.getTownId());
|
||||
player.getVariables().set(DELUSION_RETURN, townId);
|
||||
final int locId = npc.getParameters().getInt("Level", -1);
|
||||
player.getVariables().set(PlayerVariables.DELUSION_RETURN, RETURN_LOCATIONS.containsKey(locId) ? locId : 0);
|
||||
player.teleToLocation(HALL_LOCATIONS[getRandom(HALL_LOCATIONS.length)], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
final int townId = player.getVariables().getInt(DELUSION_RETURN, 0);
|
||||
final int townId = player.getVariables().getInt(PlayerVariables.DELUSION_RETURN, 0);
|
||||
player.teleToLocation(RETURN_LOCATIONS.get(townId), true);
|
||||
player.getVariables().remove(DELUSION_RETURN);
|
||||
player.getVariables().remove(PlayerVariables.DELUSION_RETURN);
|
||||
}
|
||||
return super.onTalk(npc, player);
|
||||
}
|
||||
|
@@ -162,7 +162,7 @@ public class AdminElement implements IAdminCommandHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
itemInstance.setAttribute(new AttributeHolder(type, value));
|
||||
itemInstance.setAttribute(new AttributeHolder(type, value), true);
|
||||
}
|
||||
player.getInventory().equipItem(itemInstance);
|
||||
|
||||
|
@@ -19,9 +19,10 @@ package handlers.admincommandhandlers;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.buylist.L2BuyList;
|
||||
import com.l2jmobius.gameserver.model.buylist.ProductList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.BuyList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExBuySellList;
|
||||
@@ -40,7 +41,9 @@ public class AdminShop implements IAdminCommandHandler
|
||||
private static final String[] ADMIN_COMMANDS =
|
||||
{
|
||||
"admin_buy",
|
||||
"admin_gmshop"
|
||||
"admin_gmshop",
|
||||
"admin_multisell",
|
||||
"admin_exc_multisell"
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -61,6 +64,30 @@ public class AdminShop implements IAdminCommandHandler
|
||||
{
|
||||
AdminHtml.showAdminHtml(activeChar, "gmshops.htm");
|
||||
}
|
||||
else if (command.startsWith("admin_multisell"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int listId = Integer.parseInt(command.substring(16).trim());
|
||||
MultisellData.getInstance().separateAndSend(listId, activeChar, null, false);
|
||||
}
|
||||
catch (NumberFormatException | IndexOutOfBoundsException e)
|
||||
{
|
||||
activeChar.sendMessage("Please specify multisell list ID.");
|
||||
}
|
||||
}
|
||||
else if (command.toLowerCase().startsWith("admin_exc_multisell"))
|
||||
{
|
||||
try
|
||||
{
|
||||
int listId = Integer.parseInt(command.substring(20).trim());
|
||||
MultisellData.getInstance().separateAndSend(listId, activeChar, null, true);
|
||||
}
|
||||
catch (NumberFormatException | IndexOutOfBoundsException e)
|
||||
{
|
||||
activeChar.sendMessage("Please specify multisell list ID.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -82,17 +109,16 @@ public class AdminShop implements IAdminCommandHandler
|
||||
_log.warning("admin buylist failed:" + command);
|
||||
}
|
||||
|
||||
final L2BuyList buyList = BuyListData.getInstance().getBuyList(val);
|
||||
|
||||
final ProductList buyList = BuyListData.getInstance().getBuyList(val);
|
||||
if (buyList != null)
|
||||
{
|
||||
activeChar.sendPacket(new BuyList(buyList, activeChar.getAdena(), 0));
|
||||
activeChar.sendPacket(new BuyList(buyList, activeChar, 0));
|
||||
activeChar.sendPacket(new ExBuySellList(activeChar, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("no buylist with id:" + val);
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@@ -114,7 +114,6 @@ public class AdminZone implements IAdminCommandHandler
|
||||
adminReply.replace("%PEACE%", activeChar.isInsideZone(ZoneId.PEACE) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%PVP%", activeChar.isInsideZone(ZoneId.PVP) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%SIEGE%", activeChar.isInsideZone(ZoneId.SIEGE) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%TOWN%", activeChar.isInsideZone(ZoneId.TOWN) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%CASTLE%", activeChar.isInsideZone(ZoneId.CASTLE) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%FORT%", activeChar.isInsideZone(ZoneId.FORT) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%HQ%", activeChar.isInsideZone(ZoneId.HQ) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
@@ -128,6 +127,7 @@ public class AdminZone implements IAdminCommandHandler
|
||||
adminReply.replace("%DANGER%", activeChar.isInsideZone(ZoneId.DANGER_AREA) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%NOSTORE%", activeChar.isInsideZone(ZoneId.NO_STORE) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%SCRIPT%", activeChar.isInsideZone(ZoneId.SCRIPT) ? "<font color=\"LEVEL\">YES</font>" : "NO");
|
||||
adminReply.replace("%TAX%", (activeChar.isInsideZone(ZoneId.TAX) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
|
||||
|
||||
final StringBuilder zones = new StringBuilder(100);
|
||||
for (L2ZoneType zone : ZoneManager.getInstance().getZones(activeChar))
|
||||
|
@@ -24,7 +24,7 @@ import com.l2jmobius.gameserver.data.xml.impl.BuyListData;
|
||||
import com.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.buylist.L2BuyList;
|
||||
import com.l2jmobius.gameserver.model.buylist.ProductList;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ShopPreviewList;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Wear implements IBypassHandler
|
||||
|
||||
private static void showWearWindow(L2PcInstance player, int val)
|
||||
{
|
||||
final L2BuyList buyList = BuyListData.getInstance().getBuyList(val);
|
||||
final ProductList buyList = BuyListData.getInstance().getBuyList(val);
|
||||
if (buyList == null)
|
||||
{
|
||||
_log.warning("BuyList not found! BuyListId:" + val);
|
||||
|
@@ -154,7 +154,7 @@ public final class HomeBoard implements IParseBoardHandler
|
||||
{
|
||||
final String page = command.replace("_bbssell;", "");
|
||||
returnHtml = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/Custom/" + page + ".html");
|
||||
activeChar.sendPacket(new BuyList(BuyListData.getInstance().getBuyList(423), activeChar.getAdena(), 0));
|
||||
activeChar.sendPacket(new BuyList(BuyListData.getInstance().getBuyList(423), activeChar, 0));
|
||||
activeChar.sendPacket(new ExBuySellList(activeChar, false));
|
||||
}
|
||||
else if (command.startsWith("_bbsteleport"))
|
||||
|
@@ -18,6 +18,7 @@ package handlers.communityboard;
|
||||
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.TaxType;
|
||||
import com.l2jmobius.gameserver.handler.CommunityBoardHandler;
|
||||
import com.l2jmobius.gameserver.handler.IWriteBoardHandler;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
@@ -64,7 +65,7 @@ public class RegionBoard implements IWriteBoardHandler
|
||||
link = link.replace("%region_name%", String.valueOf(REGIONS[i]));
|
||||
link = link.replace("%region_owning_clan%", (clan != null ? clan.getName() : "NPC"));
|
||||
link = link.replace("%region_owning_clan_alliance%", ((clan != null) && (clan.getAllyName() != null) ? clan.getAllyName() : ""));
|
||||
link = link.replace("%region_tax_rate%", (castle.getTaxRate() * 100) + "%");
|
||||
link = link.replace("%region_tax_rate%", castle.getTaxPercent(TaxType.BUY) + "%");
|
||||
sb.append(link);
|
||||
}
|
||||
|
||||
|
@@ -139,7 +139,7 @@ public final class ConvertItem extends AbstractEffect
|
||||
|
||||
if (elementals != null)
|
||||
{
|
||||
newItem.setAttribute(elementals);
|
||||
newItem.setAttribute(elementals, true);
|
||||
}
|
||||
newItem.setEnchantLevel(enchantLevel);
|
||||
player.getInventory().equipItem(newItem);
|
||||
|
@@ -22,13 +22,13 @@ import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.ItemSkillType;
|
||||
import com.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Seed;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2ChestInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Castle;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -81,7 +81,9 @@ public class Seed implements IItemHandler
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (seed.getCastleId() != MapRegionManager.getInstance().getAreaCastle(playable)) // TODO: replace me with tax zone
|
||||
|
||||
final Castle taxCastle = target.getTaxCastle();
|
||||
if ((taxCastle == null) || (seed.getCastleId() != taxCastle.getResidenceId()))
|
||||
{
|
||||
playable.sendPacket(SystemMessageId.THIS_SEED_MAY_NOT_BE_SOWN_HERE);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user