Fixed ObservationInstance (Broadcasting Tower).

Contributed by ReynalDev.
This commit is contained in:
MobiusDevelopment
2019-08-17 13:06:55 +00:00
parent a04e548895
commit f9fadd38c5
3 changed files with 142 additions and 151 deletions

View File

@@ -1,5 +1,5 @@
<html><body>&$650;<br><br> <html><body>&$650;<br><br>
<a action="bypass -h npc_%objectId%_observe 80 148416 46724 -3000">&$634; - 80 &$469;</a><br1> <a action="bypass -h npc_%objectId%_observe 148416 46724 -3000 80">&$634; - 80 &$469;</a><br1>
<a action="bypass -h npc_%objectId%_observe 80 149500 46724 -3000">&$635; - 80 &$469;</a><br1> <a action="bypass -h npc_%objectId%_observe 149500 46724 -3000 80">&$635; - 80 &$469;</a><br1>
<a action="bypass -h npc_%objectId%_observe 80 150511 46724 -3000">&$636; - 80 &$469;</a><br1> <a action="bypass -h npc_%objectId%_observe 150511 46724 -3000 80">&$636; - 80 &$469;</a><br1>
</body></html> </body></html>

View File

@@ -1,4 +1,4 @@
<html><body>&$650;<br><br> <html><body>&$650;<br><br>
<a action="bypass -h npc_%objectId%_observeSiege 500 77541 -147447 353">&$1424; - 500 &$469;</a><br1> <a action="bypass -h npc_%objectId%_observeSiege 77541 -147447 353 500">&$1424; - 500 &$469;</a><br1>
<a action="bypass -h npc_%objectId%_observeSiege 500 77541 -149245 353">&$1425; - 500 &$469;</a><br1> <a action="bypass -h npc_%objectId%_observeSiege 77541 -149245 353 500">&$1425; - 500 &$469;</a><br1>
</body></html> </body></html>

View File

@@ -1,146 +1,137 @@
/* /*
* This file is part of the L2J Mobius project. * This file is part of the L2J Mobius project.
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.l2jmobius.gameserver.model.actor.instance; package org.l2jmobius.gameserver.model.actor.instance;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.l2jmobius.gameserver.instancemanager.SiegeManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.model.entity.olympiad.Olympiad; import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed; import org.l2jmobius.gameserver.network.serverpackets.ItemList;
import org.l2jmobius.gameserver.network.serverpackets.ItemList; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.templates.creatures.NpcTemplate; import org.l2jmobius.gameserver.templates.creatures.NpcTemplate;
/** /**
* The Class L2ObservationInstance. * The Class L2ObservationInstance.
* @author NightMarez * @author NightMarez
* @version $Revision: 1.3.2.2.2.5 $ $Date: 2005/03/27 15:29:32 $ * @version $Revision: 1.3.2.2.2.5 $ $Date: 2005/03/27 15:29:32 $
*/ */
public class ObservationInstance extends FolkInstance public class ObservationInstance extends FolkInstance
{ {
/** /**
* Instantiates a new l2 observation instance. * Instantiates a new l2 observation instance.
* @param objectId the object id * @param objectId the object id
* @param template the template * @param template the template
*/ */
public ObservationInstance(int objectId, NpcTemplate template) public ObservationInstance(int objectId, NpcTemplate template)
{ {
super(objectId, template); super(objectId, template);
} }
@Override @Override
public void onBypassFeedback(PlayerInstance player, String command) public void onBypassFeedback(PlayerInstance player, String command)
{ {
if (command.startsWith("observeSiege")) if (player.isInOlympiadMode())
{ {
String val = command.substring(13); player.sendMessage("You already participated in Olympiad!");
StringTokenizer st = new StringTokenizer(val); player.sendPacket(ActionFailed.STATIC_PACKET);
st.nextToken(); // Bypass cost return;
}
if (Olympiad.getInstance().isRegistered(player) || player.isInOlympiadMode())
{ if (player._inEventTvT || player._inEventDM || player._inEventCTF)
player.sendMessage("You already participated in Olympiad!"); {
return; player.sendMessage("You already participated in Event!");
} player.sendPacket(ActionFailed.STATIC_PACKET);
return;
if (player._inEventTvT || player._inEventDM || player._inEventCTF) }
{
player.sendMessage("You already participated in Event!"); if (player.isInCombat() || (player.getPvpFlag() > 0))
return; {
} player.sendMessage("You are in combat now!");
player.sendPacket(ActionFailed.STATIC_PACKET);
if (player.isInCombat() || (player.getPvpFlag() > 0)) return;
{ }
player.sendMessage("You are in combat now!");
return; if (command.startsWith("observeSiege"))
} {
StringTokenizer st = new StringTokenizer(command);
if (SiegeManager.getInstance().getSiege(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())) != null) st.nextToken(); // Command
{
doObserve(player, val); int x = Integer.parseInt(st.nextToken()); // X location
} int y = Integer.parseInt(st.nextToken()); // Y location
else int z = Integer.parseInt(st.nextToken()); // Z location
{
player.sendPacket(SystemMessageId.ONLY_VIEW_SIEGE); if (SiegeManager.getInstance().getSiege(x, y, z) != null)
} {
} doObserve(player, command);
else if (command.startsWith("observe")) }
{ else
if (Olympiad.getInstance().isRegistered(player) || player.isInOlympiadMode()) {
{ player.sendPacket(new SystemMessage(SystemMessageId.ONLY_VIEW_SIEGE));
player.sendMessage("You already participated in Olympiad!"); }
return; }
} else if (command.startsWith("observe"))
{
if (player._inEventTvT || player._inEventDM || player._inEventCTF) doObserve(player, command);
{ }
player.sendMessage("You already participated in Event!"); else
return; {
} super.onBypassFeedback(player, command);
}
if (player.isInCombat() || (player.getPvpFlag() > 0)) }
{
player.sendMessage("You are in combat now!"); @Override
return; public String getHtmlPath(int npcId, int val)
} {
String pom = "";
doObserve(player, command.substring(8)); if (val == 0)
} {
else pom = "" + npcId;
{ }
super.onBypassFeedback(player, command); else
} {
} pom = npcId + "-" + val;
}
@Override
public String getHtmlPath(int npcId, int val) return "data/html/observation/" + pom + ".htm";
{ }
String pom = "";
if (val == 0) /**
{ * Do observe.
pom = "" + npcId; * @param player the player
} * @param val the val
else */
{ private void doObserve(PlayerInstance player, String val)
pom = npcId + "-" + val; {
} StringTokenizer st = new StringTokenizer(val);
st.nextToken(); // Command
return "data/html/observation/" + pom + ".htm"; int x = Integer.parseInt(st.nextToken());
} int y = Integer.parseInt(st.nextToken());
int z = Integer.parseInt(st.nextToken());
/** int cost = Integer.parseInt(st.nextToken());
* Do observe.
* @param player the player if (player.reduceAdena("Broadcast", cost, this, true))
* @param val the val {
*/ // enter mode
private void doObserve(PlayerInstance player, String val) player.enterObserverMode(x, y, z);
{ final ItemList il = new ItemList(player, false);
StringTokenizer st = new StringTokenizer(val); player.sendPacket(il);
final int cost = Integer.parseInt(st.nextToken()); }
final int x = Integer.parseInt(st.nextToken());
final int y = Integer.parseInt(st.nextToken()); player.sendPacket(ActionFailed.STATIC_PACKET);
final int z = Integer.parseInt(st.nextToken()); }
if (player.reduceAdena("Broadcast", cost, this, true)) }
{
// enter mode
player.enterObserverMode(x, y, z);
final ItemList il = new ItemList(player, false);
player.sendPacket(il);
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}