From 776162c7ec37aaa51fde1a58e00f2c3ae4f9e918 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 10 Sep 2018 04:04:19 +0000 Subject: [PATCH] Fixed dice rolling. --- .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handler/itemhandlers/RollingDice.java | 18 +++++++++++++++--- .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ .../handlers/itemhandlers/RollingDice.java | 16 +++++++++++++++- .../dist/game/data/stats/items/04200-04299.xml | 5 ++++- .../dist/game/data/stats/items/04600-04699.xml | 4 ++++ 25 files changed, 199 insertions(+), 19 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04200-04299.xml index b16acd2fa1..07dc817370 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04200-04299.xml @@ -505,8 +505,11 @@ + + + - + diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04600-04699.xml index b1067c0df4..830c1270d7 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04200-04299.xml index 473d50c1a0..6b70d75529 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04200-04299.xml @@ -505,8 +505,11 @@ + + + - + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04600-04699.xml index 5c875dd26e..0b1ee17649 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04200-04299.xml index be76afe9c5..2d6b89f104 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04200-04299.xml @@ -505,8 +505,11 @@ + + + - + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04600-04699.xml index b5338dd437..b2746c09f9 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04200-04299.xml index be76afe9c5..2d6b89f104 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04200-04299.xml @@ -505,8 +505,11 @@ + + + - + diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04600-04699.xml index b49ebb9f71..31a8b7504e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/RollingDice.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/RollingDice.java index 6c2086dcd0..f04a18815c 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/RollingDice.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/RollingDice.java @@ -17,21 +17,23 @@ package com.l2jmobius.gameserver.handler.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geodata.GeoData; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.actor.position.Location; import com.l2jmobius.gameserver.model.zone.ZoneId; import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; /** * This class ... * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:30:07 $ */ - public class RollingDice implements IItemHandler { private static final int[] ITEM_IDS = @@ -76,8 +78,18 @@ public class RollingDice implements IItemHandler return; } - Dice d = new Dice(activeChar.getObjectId(), item.getItemId(), number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ()); - Broadcast.toSelfAndKnownPlayers(activeChar, d); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), item.getItemId(), number, destination.getX(), destination.getY(), destination.getZ())); SystemMessage sm = new SystemMessage(SystemMessageId.S1_ROLLED_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index 318c32f3ff..72357f9e41 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceId()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04200-04299.xml index fc29598318..8d8358fd65 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04200-04299.xml @@ -417,7 +417,10 @@ - + + + + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04600-04699.xml index f66498fdd2..4cef8029b3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/items/04600-04699.xml @@ -231,6 +231,7 @@ + @@ -240,6 +241,7 @@ + @@ -249,6 +251,7 @@ + @@ -258,6 +261,7 @@ + diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04200-04299.xml index 8c3cc0ada0..0e5e82eb89 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04200-04299.xml @@ -518,8 +518,11 @@ + + + - + diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04600-04699.xml index 26aa73d98a..90f10a02e6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04200-04299.xml index 8c3cc0ada0..0e5e82eb89 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04200-04299.xml @@ -518,8 +518,11 @@ + + + - + diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04600-04699.xml index 26aa73d98a..90f10a02e6 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ + diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java index f3d4957fbe..e2c7363f99 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/RollingDice.java @@ -17,7 +17,9 @@ package handlers.itemhandlers; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.Dice; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; public class RollingDice implements IItemHandler { @@ -54,7 +57,18 @@ public class RollingDice implements IItemHandler return false; } - Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, activeChar.getX() - 30, activeChar.getY() - 30, activeChar.getZ())); + // Mobius: Retail dice position land calculation. + final double angle = Util.convertHeadingToDegree(activeChar.getHeading()); + final double radian = Math.toRadians(angle); + final double course = Math.toRadians(180); + final int x1 = (int) (Math.cos(Math.PI + radian + course) * 40); + final int y1 = (int) (Math.sin(Math.PI + radian + course) * 40); + final int x = activeChar.getX() + x1; + final int y = activeChar.getY() + y1; + final int z = activeChar.getZ(); + final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(activeChar.getX(), activeChar.getY(), activeChar.getZ(), x, y, z, activeChar.getInstanceWorld()); + + Broadcast.toSelfAndKnownPlayers(activeChar, new Dice(activeChar.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); sm.addString(activeChar.getName()); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04200-04299.xml b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04200-04299.xml index 300970d29b..8fa989f262 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04200-04299.xml +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04200-04299.xml @@ -518,8 +518,11 @@ + + + - + diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04600-04699.xml b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04600-04699.xml index f412047cd2..ae8930f73a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04600-04699.xml +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/stats/items/04600-04699.xml @@ -282,6 +282,7 @@ + @@ -293,6 +294,7 @@ + @@ -304,6 +306,7 @@ + @@ -315,6 +318,7 @@ +