Files
sweetgum-server/tools/MapleArrowFetcher/src/provider/wz/WZIMGEntry.java
ronancpl 64af2cfa00 Updated Meso & Arrow drops + Aran change jobs fix + improved concurrency
Added meso drop data for many mobs that were missing mesos.
Enhanced arrow drop data, now dropping bundles instead of unitary items.
Fixed issues with several Aran change jobs crashing the player shortly after changing jobs.
Improved concurrency in MapleGuild, MapleAlliance and MaplePlayerShop.
New tools: MapleArrowFetcher and MapleMesoFetcher, that were used to compile the updated drop data info.
2017-11-01 13:34:26 -02:00

119 lines
3.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 provider.wz;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import provider.MapleData;
import provider.MapleDataEntity;
public class WZIMGEntry implements MapleData {
private String name;
private MapleDataType type;
private List<MapleData> children = new ArrayList<MapleData>(10);
private Object data;
private MapleDataEntity parent;
public WZIMGEntry(MapleDataEntity parent) {
this.parent = parent;
}
@Override
public String getName() {
return name;
}
@Override
public MapleDataType getType() {
return type;
}
@Override
public List<MapleData> getChildren() {
return Collections.unmodifiableList(children);
}
@Override
public MapleData getChildByPath(String path) {
String segments[] = path.split("/");
if (segments[0].equals("..")) {
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
}
MapleData ret = this;
for (int x = 0; x < segments.length; x++) {
boolean foundChild = false;
for (MapleData child : ret.getChildren()) {
if (child.getName().equals(segments[x])) {
ret = child;
foundChild = true;
break;
}
}
if (!foundChild) {
return null;
}
}
return ret;
}
@Override
public Object getData() {
return data;
}
public void setName(String name) {
this.name = name;
}
public void setType(MapleDataType type) {
this.type = type;
}
public void setData(Object data) {
this.data = data;
}
public void addChild(WZIMGEntry entry) {
children.add(entry);
}
@Override
public Iterator<MapleData> iterator() {
return getChildren().iterator();
}
@Override
public String toString() {
return getName() + ":" + getData();
}
public MapleDataEntity getParent() {
return parent;
}
public void finish() {
((ArrayList<MapleData>) children).trimToSize();
}
}