Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MapleGenericPortal.java
Package: src.rar [view]
Upload User: gwt600
Upload Date: 2021-06-03
Package Size: 704k
Code Size: 5k
Category:
Games
Development Platform:
Java
- /*
- This file is part of the OdinMS Maple Story Server
- Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
- Matthias Butz <matze@odinms.de>
- Jan Christian Meyer <vimes@odinms.de>
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License version 3
- as published by the Free Software Foundation. You may not use, modify
- or distribute this program under any other version of the
- GNU Affero General Public License.
- 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 Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.odinms.server.maps;
- import java.awt.Point;
- import net.sf.odinms.client.MapleCharacter;
- import net.sf.odinms.client.MapleClient;
- import net.sf.odinms.client.anticheat.CheatingOffense;
- import net.sf.odinms.net.channel.ChannelServer;
- import net.sf.odinms.scripting.portal.PortalScriptManager;
- import net.sf.odinms.server.MaplePortal;
- import net.sf.odinms.server.fourthjobquests.FourthJobQuestsPortalHandler;
- import net.sf.odinms.tools.MaplePacketCreator;
- public class MapleGenericPortal implements MaplePortal {
- private String name;
- private String target;
- private Point position;
- private int targetmap;
- private int type;
- private int id;
- private String scriptName;
- private boolean portalState;
- public MapleGenericPortal(int type) {
- this.type = type;
- portalState = OPEN;
- }
- @Override
- public void setPortalState(boolean state) {
- this.portalState = state;
- }
- @Override
- public boolean getPortalState() {
- return portalState;
- }
- @Override
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- @Override
- public String getName() {
- return name;
- }
- @Override
- public Point getPosition() {
- return position;
- }
- @Override
- public String getTarget() {
- return target;
- }
- @Override
- public int getTargetMapId() {
- return targetmap;
- }
- @Override
- public int getType() {
- return type;
- }
- @Override
- public String getScriptName() {
- return scriptName;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void setPosition(Point position) {
- this.position = position;
- }
- public void setTarget(String target) {
- this.target = target;
- }
- public void setTargetMapId(int targetmapid) {
- this.targetmap = targetmapid;
- }
- @Override
- public void setScriptName(String scriptName) {
- this.scriptName = scriptName;
- }
- @Override
- public void enterPortal(MapleClient c) {
- MapleCharacter player = c.getPlayer();
- double distanceSq = getPosition().distanceSq(player.getPosition());
- if (distanceSq > 22500) {
- player.getCheatTracker().registerOffense(CheatingOffense.USING_FARAWAY_PORTAL, "D" + Math.sqrt(distanceSq));
- }
- boolean changed = false;
- if (getScriptName() != null) {
- if (!FourthJobQuestsPortalHandler.handlePortal(getScriptName(), c.getPlayer())) {
- changed = PortalScriptManager.getInstance().executePortalScript(this, c);
- }
- } else if (getTargetMapId() != 999999999) {
- MapleMap to;
- if (player.getEventInstance() == null) {
- to = ChannelServer.getInstance(c.getChannel()).getMapFactory().getMap(getTargetMapId());
- } else {
- to = player.getEventInstance().getMapInstance(getTargetMapId());
- }
- MaplePortal pto = to.getPortal(getTarget());
- if (pto == null) { // fallback for missing portals - no real life case anymore - intresting for not implemented areas
- pto = to.getPortal(0);
- }
- if (getTargetMapId() >= 910000010 && getTargetMapId() <= 910000021) {
- c.getSession().write(MaplePacketCreator.enableActions());
- player.getClient().getSession().write(MaplePacketCreator.serverNotice(5, "[公告]请通过npc进入pk房间!"));
- } else {
- c.getPlayer().changeMap(to, pto); //late resolving makes this harder but prevents us from loading the whole world at once
- changed = true;
- }
- if (!changed) {
- c.getSession().write(MaplePacketCreator.enableActions());
- }
- }
- }
- public void setPortalStatus(boolean newStatus) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- }