Fixed successful scrolled items not using up an upgrade slot when using white scroll. Fixed some issues with the PiratePQ and added a "clear all boxes to complete a stage"-mode. Added "Party for Starters" feature. Added concurrency protection on event script modules.
168 lines
4.2 KiB
Java
168 lines
4.2 KiB
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 as
|
|
published by the Free Software Foundation 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.server.world;
|
|
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Collection;
|
|
|
|
import server.maps.MapleDoor;
|
|
import client.MapleCharacter;
|
|
import client.MapleJob;
|
|
import java.util.Collections;
|
|
|
|
public class MaplePartyCharacter {
|
|
private String name;
|
|
private int id;
|
|
private int level;
|
|
private int channel, world;
|
|
private int jobid;
|
|
private int mapid;
|
|
private Map<Integer, MapleDoor> doors = new LinkedHashMap<>();
|
|
private boolean online;
|
|
private MapleJob job;
|
|
private MapleCharacter character;
|
|
|
|
public MaplePartyCharacter(MapleCharacter maplechar) {
|
|
this.character = maplechar;
|
|
this.name = maplechar.getName();
|
|
this.level = maplechar.getLevel();
|
|
this.channel = maplechar.getClient().getChannel();
|
|
this.world = maplechar.getWorld();
|
|
this.id = maplechar.getId();
|
|
this.jobid = maplechar.getJob().getId();
|
|
this.mapid = maplechar.getMapId();
|
|
this.online = true;
|
|
this.job = maplechar.getJob();
|
|
for (Entry<Integer, MapleDoor> entry : maplechar.getDoors().entrySet()) {
|
|
doors.put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
public MaplePartyCharacter() {
|
|
this.name = "";
|
|
}
|
|
|
|
public MapleCharacter getPlayer() {
|
|
return character;
|
|
}
|
|
|
|
public MapleJob getJob() {
|
|
return job;
|
|
}
|
|
|
|
public int getLevel() {
|
|
return level;
|
|
}
|
|
|
|
public int getChannel() {
|
|
return channel;
|
|
}
|
|
|
|
public void setChannel(int channel) {
|
|
this.channel = channel;
|
|
}
|
|
|
|
public boolean isLeader() {
|
|
return getPlayer().isPartyLeader();
|
|
}
|
|
|
|
public boolean isOnline() {
|
|
return online;
|
|
}
|
|
|
|
public void setOnline(boolean online) {
|
|
this.online = online;
|
|
}
|
|
|
|
public int getMapId() {
|
|
return mapid;
|
|
}
|
|
|
|
public void setMapId(int mapid) {
|
|
this.mapid = mapid;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public int getJobId() {
|
|
return jobid;
|
|
}
|
|
|
|
public int getGuildId() {
|
|
return character.getGuildId();
|
|
}
|
|
|
|
public void addDoor(Integer owner, MapleDoor door) {
|
|
this.doors.put(owner, door);
|
|
}
|
|
|
|
public void removeDoor(Integer owner) {
|
|
this.doors.remove(owner);
|
|
}
|
|
|
|
public Collection<MapleDoor> getDoors() {
|
|
return Collections.unmodifiableCollection(doors.values());
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
final int prime = 31;
|
|
int result = 1;
|
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null) {
|
|
return false;
|
|
}
|
|
if (getClass() != obj.getClass()) {
|
|
return false;
|
|
}
|
|
final MaplePartyCharacter other = (MaplePartyCharacter) obj;
|
|
if (name == null) {
|
|
if (other.name != null) {
|
|
return false;
|
|
}
|
|
} else if (!name.equals(other.name)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public int getWorld() {
|
|
return world;
|
|
}
|
|
}
|