NPCConversationManager.java
资源名称:src.rar [点击查看]
上传用户:gwt600
上传日期:2021-06-03
资源大小:704k
文件大小:77k
源码类别:
游戏
开发平台:
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.scripting.npc;
- import java.awt.Point;
- import java.sql.*;
- import net.sf.odinms.database.*;
- import java.awt.Point;
- import net.sf.odinms.database.DatabaseConnection;
- import java.rmi.RemoteException;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import net.sf.odinms.server.maps.FakeCharacter;
- import net.sf.odinms.server.MapleInventoryManipulator;
- import java.sql.SQLException;
- import java.util.Iterator;
- import net.sf.odinms.net.MaplePacket;
- import net.sf.odinms.client.MapleInventory;
- import net.sf.odinms.net.channel.ChannelServer;
- import net.sf.odinms.client.MapleBuffStat;
- import net.sf.odinms.net.world.MapleParty;
- import net.sf.odinms.server.maps.MapleMapFactory;
- import java.util.Arrays;
- import net.sf.odinms.server.maps.MapleMapObject;
- import net.sf.odinms.server.maps.MapleMapObjectType;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Calendar;
- import java.util.LinkedList;
- import java.util.List;
- import net.sf.odinms.client.IItem;
- import net.sf.odinms.client.Item;
- import net.sf.odinms.client.MapleCharacter;
- import net.sf.odinms.client.MapleClient;
- import net.sf.odinms.client.MapleInventoryType;
- import net.sf.odinms.client.MapleJob;
- import net.sf.odinms.client.SkillFactory;
- import net.sf.odinms.scripting.AbstractPlayerInteraction;
- import net.sf.odinms.scripting.event.EventManager;
- import net.sf.odinms.server.MapleItemInformationProvider;
- import net.sf.odinms.server.MapleShopFactory;
- import net.sf.odinms.server.quest.MapleQuest;
- import net.sf.odinms.tools.MaplePacketCreator;
- import net.sf.odinms.client.MapleStat;
- import net.sf.odinms.net.world.guild.MapleGuild;
- import net.sf.odinms.server.MapleSquad;
- import net.sf.odinms.server.MapleSquadType;
- import net.sf.odinms.server.maps.MapleMap;
- import java.util.Map;
- import java.util.Map.Entry;
- import java.util.Random;
- import net.sf.odinms.client.Equip;
- import net.sf.odinms.client.ExpTable;
- import net.sf.odinms.client.ISkill;
- import net.sf.odinms.client.MapleKeyBinding;
- import net.sf.odinms.client.MaplePet;
- import net.sf.odinms.database.DatabaseConnection;
- import net.sf.odinms.net.channel.ChannelServer;
- import net.sf.odinms.net.world.MaplePartyCharacter;
- import net.sf.odinms.server.ClanHolder;
- import net.sf.odinms.server.MapleInventoryManipulator;
- import net.sf.odinms.server.MaplePortal;
- import net.sf.odinms.server.MapleStatEffect;
- import net.sf.odinms.server.TimerManager;
- import net.sf.odinms.server.life.MapleLifeFactory;
- import net.sf.odinms.server.life.MapleMonster;
- import net.sf.odinms.server.life.MapleMonsterStats;
- import net.sf.odinms.server.life.MapleNPC;
- import net.sf.odinms.server.maps.MapleMapObject;
- import net.sf.odinms.server.maps.MapleMapObjectType;
- import net.sf.odinms.tools.Pair;
- /**
- *
- * @author Matze
- */
- public class NPCConversationManager extends AbstractPlayerInteraction {
- private MapleClient c;
- private int npc;
- private String fileName = null;
- private List<MaplePartyCharacter> otherParty;
- private ChannelServer cserv;
- private String getText;
- private MapleCharacter chr;
- public NPCConversationManager(MapleClient c, int npc) {
- super(c);
- this.c = c;
- this.npc = npc;
- }
- public void giveClone() {
- FakeCharacter fc = new FakeCharacter(c.getPlayer(), c.getPlayer().getId() + c.getPlayer().getFakeChars().size() + 1);
- c.getPlayer().addFakeChar(fc);
- }
- public void callGM(String Text) {
- for (ChannelServer cservs : ChannelServer.getAllInstances()) {
- for (MapleCharacter players : cservs.getPlayerStorage().getAllCharacters()) {
- if (players.isGM()) {
- players.getClient().getSession().write(MaplePacketCreator.serverNotice(6, c.getPlayer().getName() + " sent you a message : " + Text));
- }
- }
- }
- }
- public void openDuey() {
- c.getSession().write(MaplePacketCreator.sendDueyAction((byte) 8));
- }
- public NPCConversationManager(MapleClient c, int npc, MapleCharacter chr) {
- super(c);
- this.c = c;
- this.npc = npc;
- this.chr = chr;
- }
- public String zakumSquadMembers(String Members) {
- Connection con = DatabaseConnection.getConnection();
- try {
- PreparedStatement ps = con.prepareStatement(Members);
- ps.executeUpdate();
- ps.close();
- } catch (SQLException se) {
- return "" + se;
- }
- return "Member was added succefully";
- }
- public int getCharQuantity(int ismap) {
- MapleMap map = c.getChannelServer().getMapFactory().getMap(ismap) ;
- double range = Double.POSITIVE_INFINITY;
- List<MapleMapObject> players = map.getMapObjectsInRange(c.getPlayer().getPosition (), range, Arrays.asList(MapleMapObjectType.PLAYER));
- return players.size();
- }
- public void closePortal(int mapid, String pName) {
- getClient().getChannelServer().getMapFactory().getMap(mapid).getPortal(pName).setPortalState(false);
- }
- public void openPortal(int mapid, String pName) {
- getClient().getChannelServer().getMapFactory().getMap(mapid).getPortal(pName).setPortalState(true);
- }
- public void closeDoor(int mapid) {
- getClient().getChannelServer().getMapFactory().getMap(mapid).setReactorState();
- }
- public void openDoor(int mapid) {
- getClient().getChannelServer().getMapFactory().getMap(mapid).resetReactors();
- }
- public boolean isPartyAllHere() {
- int num = 0;
- int myparty = 0;
- while (getPlayer().getParty().getMembers().iterator().hasNext()) {
- MaplePartyCharacter curChar = getPlayer().getParty().getMembers().iterator().next();
- if (curChar.isOnline()) {
- num += 1;
- }
- }
- while (getPlayer().getMap().getCharacters().iterator().hasNext()) {
- MapleCharacter curChar2 = getPlayer().getMap().getCharacters().iterator().next();
- if (curChar2.getParty() == getPlayer().getParty()) {
- myparty += 1;
- }
- }
- if (num == myparty) {
- return true;
- } else {
- return false;
- }
- }
- public void warpPartyWithExp(int mapId, int exp) {
- MapleMap target = getMap(mapId);
- for (MaplePartyCharacter chr : getPlayer().getParty().getMembers()) {
- MapleCharacter curChar = c.getChannelServer().getPlayerStorage().getCharacterByName(chr.getName());
- if ((curChar.getEventInstance() == null && c.getPlayer().getEventInstance() == null) || curChar.getEventInstance() == getPlayer().getEventInstance()) {
- curChar.changeMap(target, target.getPortal(0));
- curChar.gainExp(exp, true, false, true);
- }
- }
- }
- public void warpPartyWithExpMeso(int mapId, int exp, int meso) {
- MapleMap target = getMap(mapId);
- for (MaplePartyCharacter chr : getPlayer().getParty().getMembers()) {
- MapleCharacter curChar = c.getChannelServer().getPlayerStorage().getCharacterByName(chr.getName());
- if ((curChar.getEventInstance() == null && c.getPlayer().getEventInstance() == null) || curChar.getEventInstance() == getPlayer().getEventInstance()) {
- curChar.changeMap(target, target.getPortal(0));
- curChar.gainExp(exp, true, false, true);
- curChar.gainMeso(meso, true);
- }
- }
- }
- public void giveWonkyBuff(MapleCharacter chr) {
- long what = Math.round(Math.random() * 4);
- int what1 = (int) what;
- int Buffs[] = {2022090, 2022091, 2022092, 2022093};
- int buffToGive = Buffs[what1];
- MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance();
- MapleStatEffect statEffect = mii.getItemEffect(buffToGive);
- //for (MapleMapObject mmo = this.getParty()) {
- MapleCharacter character = (MapleCharacter) chr;
- statEffect.applyTo(character);
- //}
- }
- public void WarpTo(String player) {
- MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(player);
- MapleMap target = victim.getMap();
- c.getPlayer().changeMap(target, target.findClosestSpawnpoint(victim.getPosition()));
- }
- public void resetStats() {
- List<Pair<MapleStat, Integer>> statup = new ArrayList<Pair<MapleStat, Integer>>(5);
- int totAp = getPlayer().getRemainingAp() + getPlayer().getStr() + getPlayer().getDex() + getPlayer().getInt() + getPlayer().getLuk();
- getPlayer().setStr(4);
- getPlayer().setDex(4);
- getPlayer().setInt(4);
- getPlayer().setLuk(4);
- getPlayer().setRemainingAp(totAp - 16);
- statup.add(new Pair<MapleStat, Integer>(MapleStat.STR, Integer.valueOf(4)));
- statup.add(new Pair<MapleStat, Integer>(MapleStat.DEX, Integer.valueOf(4)));
- statup.add(new Pair<MapleStat, Integer>(MapleStat.LUK, Integer.valueOf(4)));
- statup.add(new Pair<MapleStat, Integer>(MapleStat.INT, Integer.valueOf(4)));
- statup.add(new Pair<MapleStat, Integer>(MapleStat.AVAILABLEAP, Integer.valueOf(getPlayer().getRemainingAp())));
- getPlayer().getClient().getSession().write(MaplePacketCreator.updatePlayerStats(statup));
- }
- public void changeSex() {
- getPlayer().setGender(1 - getPlayer().getGender());
- getClient().getSession().write(MaplePacketCreator.updateCharLook(getPlayer()));
- }
- public boolean eventOn() {
- return getPlayer().getClient().getChannelServer().eventOn;
- }
- public void doEvent() {
- if (eventOn()) {
- this.warp(getPlayer().getClient().getChannelServer().eventMap);
- getClient().getSession().write(MaplePacketCreator.serverNotice(5, "You have been warped to the event map!"));
- }
- }
- public int getPetLevel() {
- for (MaplePet pet : getPlayer().getPets()) {
- return pet.getLevel();
- }
- return 0;
- }
- public int getFullness() {
- for (MaplePet pet : getPlayer().getPets()) {
- return pet.getFullness();
- }
- return 0;
- }
- public String getPetName() {
- for (MaplePet pet : getPlayer().getPets()) {
- return pet.getName();
- }
- return "";
- }
- public void setPetName(String petname) {
- for (MaplePet pet : getPlayer().getPets()) {
- pet.setName(petname);
- }
- }
- public ChannelServer getChannelServer() {
- return cserv;
- }
- public void startQuest(int id, MapleClient cg) {
- MapleQuest.getInstance(id).start(cg.getPlayer(), npc);
- }
- public void completeQuest(int id, MapleClient cg) {
- MapleQuest.getInstance(id).complete(cg.getPlayer(), npc);
- }
- public void modifyNx(int amount) {
- getPlayer().modifyCSPoints(1, amount);
- if (amount > 0) {
- getPlayer().dropMessage(5, "You have gained " + amount + " NX points.");
- } else {
- getPlayer().dropMessage(5, "You have lost " + amount + " NX points.");
- }
- }
- public void voteMSG(){
- sendOk("你好啊!");
- }
- public int getJobId(){
- return getJob().getId();
- }
- public void ZreHylvl() {
- MapleGuild.ZreHylvl(getClient(), npc);
- }
- public void ZreHyfame() {
- MapleGuild.ZreHyfame(getClient(), npc);
- }
- public void gainvip(int amount) {
- getPlayer().gainvip(amount);
- MaplePacket packet = MaplePacketCreator.serverNotice(6, "[VIP升级公告]" + getPlayer().getName() + "成为本服的正式VIP会员,它的等级为:[" + getPlayer().getVip() + "]会员.");
- }
- public void makeVip() {
- getPlayer().makeVip();
- }
- public void makeVip2()
- {
- getPlayer().makeVip2();
- }
- public void makeVip3() {
- getPlayer().makeVip3();
- }
- public void makeVip4() {
- getPlayer().makeVip4();
- }
- public void unVip() {
- getPlayer().unVip();
- }
- public MapleJob getJobName(int id) {
- return MapleJob.getById(id);
- }
- public void charNotice(String Text) {
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, Text));
- }
- public void spawnMonster(int mobid, String name, int HP, int MP, int level, int EXP, int boss, int undead, int amount, int x, int y) {
- int i;
- MapleMonsterStats newStats = new MapleMonsterStats();
- Point spawnPos = new Point(x, y);
- if (!(name.equals("0")))
- newStats.setName(name);
- if (HP >= 0)
- newStats.setHp(HP);
- if (MP >= 0)
- newStats.setMp(MP);
- if (level >= 0)
- newStats.setLevel(level);
- if (EXP >= 0)
- newStats.setExp(EXP);
- if (boss == 1)
- newStats.setBoss(true);
- if (undead == 1)
- newStats.setUndead(true);
- if (amount == 1) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- npcmob.setMp(npcmob.getMaxMp());
- getPlayer().getMap().spawnMonsterOnGroundBelow(npcmob, spawnPos);
- } else {
- for (i = 0; i < amount; ++i) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- npcmob.setMp(npcmob.getMaxMp());
- getPlayer().getMap().spawnMonsterOnGroundBelow(npcmob, spawnPos);
- }
- }
- }
- public String getRankings(String job) {
- try {
- int int1 = 0;
- int int2 = 0;
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE job >= ? AND job <= ? AND gm = 0 ORDER BY level,reborns DESC LIMIT 10");
- if (job.equals("warrior")) {
- int1 = 100;
- int2 = 132;
- } else if (job.equals("magician")) {
- int1 = 200;
- int2 = 232;
- } else if (job.equals("bowman")) {
- int1 = 300;
- int2 = 322;
- } else if (job.equals("thief")) {
- int1 = 400;
- int2 = 422;
- } else if (job.equals("pirate")) {
- int1 = 500;
- int2 = 522;
- } else if (job.equals("beginner")) {
- int1 = 0;
- int2 = 0;
- } else if (job.equals("me")) {
- PreparedStatement ps2 = con.prepareStatement("SELECT name FROM characters ORDER BY level,reborns DESC");
- ResultSet rs = ps2.executeQuery();
- int i = 0;
- int lol = 0;
- while (rs.next()) {
- i++;
- if (rs.getString("name").equals(c.getPlayer().getName())) {
- lol = i;
- break;
- }
- }
- rs.close();
- ps2.close();
- ps.close();
- return ("Your current rank is: " + lol);
- } else {
- ps.close();
- return "";
- }
- ps.setInt(1, int1);
- ps.setInt(2, int2);
- ResultSet rs = ps.executeQuery();
- int i = 0;
- StringBuffer buf = new StringBuffer();
- buf.append("");
- while (rs.next()) {
- i++;
- buf.append(i + ") " + rs.getString("name") + ", level: " + rs.getInt("level") + ", reborns: " + rs.getInt("reborns") + "rn");
- }
- rs.close();
- ps.close();
- return buf.toString();
- } catch (SQLException e) {
- return "管理员脚本";
- }
- }
- public void ZreHymeso() {
- MapleGuild.ZreHymeso(getClient(), npc);
- }
- public void ZreHyzs() {
- MapleGuild.ZreHyzs(getClient(), npc);
- }
- public void ZreHypvpkills() {
- MapleGuild.ZreHypvpkills(getClient(), npc);
- }
- public void ZreHypvpdeaths() {
- MapleGuild.ZreHypvpdeaths(getClient(), npc);
- }
- public void forfeitQuest(int id, MapleClient cg) {
- MapleQuest.getInstance(id).forfeit(cg.getPlayer());
- }
- @Override
- public MapleParty getParty() {
- return getPlayer().getParty();
- }
- @Override
- public void changeMusic(String songName) {
- getPlayer().getMap().broadcastMessage(MaplePacketCreator.musicChange(songName));
- }
- public void levelUp() {
- getPlayer().levelUp();
- int newexp = getPlayer().getExp();
- if (newexp < 0) {
- getPlayer().gainExp(-newexp, false, false);
- }
- }
- public void setAP(int AP) {
- getPlayer().setRemainingAp(AP);
- getPlayer().updateSingleStat(MapleStat.AVAILABLEAP, Integer.valueOf(AP));
- }
- public void gainAP(int g) {
- getPlayer().setRemainingAp(g + getPlayer().getRemainingAp());
- getPlayer().updateSingleStat(MapleStat.AVAILABLEAP, Integer.valueOf(g + getPlayer().getRemainingAp()));
- }
- public void setStr(int str) {
- getPlayer().setStr(str);
- getPlayer().updateSingleStat(MapleStat.STR, Integer.valueOf(str));
- }
- public void setDex(int dex) {
- getPlayer().setDex(dex);
- getPlayer().updateSingleStat(MapleStat.DEX, Integer.valueOf(dex));
- }
- public void setInt(int inte) {
- getPlayer().setInt(inte);
- getPlayer().updateSingleStat(MapleStat.INT, Integer.valueOf(inte));
- }
- public void setLuk(int luk) {
- getPlayer().setLuk(luk);
- getPlayer().updateSingleStat(MapleStat.LUK, Integer.valueOf(luk));
- }
- public boolean isPartyLeader() {
- return getPlayer().isPartyLeader();
- }
- public void setFame(int fame) {
- getPlayer().setFame(fame);
- getPlayer().updateSingleStat(MapleStat.FAME, Integer.valueOf(fame));
- }
- public void setExp(int exp) {
- getPlayer().updateSingleStat(MapleStat.EXP, Integer.valueOf(exp));
- }
- public void resetMap(int mapid) {
- ChannelServer cserv = getClient().getChannelServer();
- MapleMap map = cserv.getMapFactory().getMap(mapid);
- map.resetReactors();
- }
- public void environmentChange(String env, int mode) {
- getPlayer().getMap().broadcastMessage(MaplePacketCreator.environmentChange(env, mode));
- }
- public int getCharsOnMap() {
- return getPlayer().getMap().getCharacters().size();
- }
- public int getHour() {
- Calendar cal = Calendar.getInstance();
- int hour = cal.get(Calendar.HOUR_OF_DAY);
- return hour;
- }
- public int getMin() {
- Calendar cal = Calendar.getInstance();
- int min = cal.get(Calendar.MINUTE);
- return min;
- }
- public int getSec() {
- Calendar cal = Calendar.getInstance();
- int sec = cal.get(Calendar.SECOND);
- return sec;
- }
- public void giveBuff(int buff, int level) {
- SkillFactory.getSkill(buff).getEffect(level).applyTo(getPlayer());
- }
- public int getDay() {
- Calendar cal = Calendar.getInstance();
- int day = cal.get(Calendar.DAY_OF_WEEK);
- return day;
- }
- public int getDonatorPoints() {
- return getPlayer().getDonatorPoints();
- }
- public void gainDonatorPoints(int gain) {
- getPlayer().gainDonatorPoints(gain);
- }
- public void setGMLevel(int l) {
- getPlayer().setGMLevel(l);
- }
- public void reloadChar() {
- getPlayer().getClient().getSession().write(MaplePacketCreator.getCharInfo(getPlayer()));
- getPlayer().getMap().removePlayer(getPlayer());
- getPlayer().getMap().addPlayer(getPlayer());
- }
- public boolean isMorphed() {
- boolean morph = false;
- Integer morphed = getPlayer().getBuffedValue(MapleBuffStat.MORPH);
- if (morphed != null) {
- morph = true;
- }
- return morph;
- }
- public int getMorphValue() { // 1= mushroom, 2= pig, 3= alien, 4= cornian, 5= arab retard
- try {
- int morphid = getPlayer().getBuffedValue(MapleBuffStat.MORPH).intValue();
- return morphid;
- } catch (NullPointerException n) {
- return -1;
- }
- }
- public MapleSquad getSquad(MapleSquadType Type) {
- return c.getChannelServer().getMapleSquad(Type);
- }
- public void setHp(int hp) {
- c.getPlayer().setHp(hp);
- }
- public void setMp(int mp) {
- c.getPlayer().setMp(mp);
- }
- public void killPlayer() {
- c.getPlayer().setHp(0);
- }
- public void addHp(int hp) {
- c.getPlayer().addHP(hp);
- }
- public void addMp(int mp) {
- c.getPlayer().addMP(mp);
- }
- public boolean flwBTitem(int id, int hardcore) {
- MapleItemInformationProvider ii =
- MapleItemInformationProvider.getInstance();
- IItem item = ii.getEquipById(id);
- MapleInventoryType type = ii.getInventoryType(id);
- if (type.equals(MapleInventoryType.EQUIP)) {
- MapleInventoryManipulator.addFromDrop(c, ii.hardcoreItem((Equip)
- item, (short) hardcore));
- return true;
- } else {
- return false;
- }
- }
- public void addCloseness(int increase) {
- MaplePet pet = c.getPlayer().getPet(0);
- if (pet.getCloseness() < 30000) {
- int newCloseness = pet.getCloseness() + increase;
- if (newCloseness > 30000) {
- newCloseness = 30000;
- }
- pet.setCloseness(newCloseness);
- if (newCloseness >= ExpTable.getClosenessNeededForLevel(pet.getLevel() + 1)) {
- pet.setLevel(pet.getLevel() + 1);
- c.getSession().write(MaplePacketCreator.showPetLevelUp(c.getPlayer(), 0));
- }
- c.getSession().write(MaplePacketCreator.updatePet(pet, true));
- }
- }
- public int countReactor() {
- List<MapleMapObject> reactors = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.REACTOR));
- return reactors.size();
- }
- public void giveNPCBuff(MapleCharacter chr, int itemID) {
- MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance();
- MapleStatEffect statEffect = mii.getItemEffect(itemID);
- statEffect.applyTo(chr);
- }
- public int getjuankuan() {
- return getPlayer().getjuankuan();
- }
- public int getDropmeso() {
- return getPlayer().getDropmeso();
- }
- public int getPvpKills() {
- return getPlayer().getPvpKills();
- }
- public int getPvpDeaths() {
- return getPlayer().getPvpDeaths();
- }
- public void MapleMSlvl() {
- MapleGuild.MapleMSlvl(getClient(), npc);
- }
- public void MapleMSfame() {
- MapleGuild.MapleMSfame(getClient(), npc);
- } public void MapleMSmeso() {
- MapleGuild.MapleMSmeso(getClient(), npc);
- }
- public void MapleMSzs() {
- MapleGuild.MapleMSzs(getClient(), npc);
- }
- public void MapleMSjk() {
- MapleGuild.MapleMSjk(getClient(), npc);
- }
- public void MapleMSpvpkills() {
- MapleGuild.MapleMSpvpkills(getClient(), npc);
- } public void MapleMSpvpdeaths() {
- MapleGuild.MapleMSpvpdeaths(getClient(), npc);
- }
- public void setSP(int SP) {
- getPlayer().setRemainingSp(SP);
- getPlayer().updateSingleStat(MapleStat.AVAILABLESP, Integer.valueOf(SP));
- }
- public NPCConversationManager(MapleClient c, int npc, MapleCharacter chr, String fileName) {
- super(c);
- this.c = c;
- this.npc = npc;
- this.chr = chr;
- this.fileName = fileName;
- }
- public void dispose() {
- NPCScriptManager.getInstance().dispose(this);
- }
- public void sendNext(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 0, text, "00 01"));
- }
- public void sendPrev(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 0, text, "01 00"));
- }
- public void sendNextPrev(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 0, text, "01 01"));
- }
- public void sendOk(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 0, text, "00 00"));
- }
- public void sendYesNo(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 1, text, ""));
- }
- public void sendAcceptDecline(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 0x0C, text, ""));
- }
- public void sendSimple(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalk(npc, (byte) 4, text, ""));
- }
- public void sendStyle(String text, int styles[]) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalkStyle(npc, text, styles));
- }
- public void sendGetNumber(String text, int def, int min, int max) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalkNum(npc, text, def, min, max));
- }
- public void sendGetText(String text) {
- getClient().getSession().write(MaplePacketCreator.getNPCTalkText(npc, text));
- }
- public void setGetText(String text) {
- this.getText = text;
- }
- public String getText() {
- return this.getText;
- }
- public void openShop(int id) {
- MapleShopFactory.getInstance().getShop(id).sendShop(getClient());
- }
- @Override
- public void openNpc(int id) {
- dispose();
- NPCScriptManager.getInstance().start(getClient(), id, null, null);
- }
- public void changeJob(MapleJob job) {
- getPlayer().changeJob(job);
- }
- public MapleJob getJob() {
- return getPlayer().getJob();
- }
- public void startQuest(int id) {
- MapleQuest.getInstance(id).start(getPlayer(), npc);
- }
- public void completeQuest(int id) {
- MapleQuest.getInstance(id).complete(getPlayer(), npc);
- }
- public void forfeitQuest(int id) {
- MapleQuest.getInstance(id).forfeit(getPlayer());
- }
- public int getpaypalNX() {
- return getPlayer().getpaypalNX();
- }
- /**
- * use getPlayer().getMeso() instead
- * @return
- */
- @Deprecated
- public int getMeso() {
- return getPlayer().getMeso();
- }
- public int getmPoints() {
- return getPlayer().getmPoints();
- }
- public void gainMeso(int gain) {
- getPlayer().gainMeso(gain, true, false, true);
- }
- public void gainExp(int gain) {
- getPlayer().gainExp(gain, true, true);
- }
- public void gainup(int gain) {
- getPlayer().levelUp();
- int newexp = getPlayer().getExp();
- if (newexp < 0) {
- getPlayer().gainExp(-newexp, false, false);
- }
- }
- public int getNpc() {
- return npc;
- }
- public String getFileName() {
- return fileName;
- }
- /**
- * use getPlayer().getLevel() instead
- * @return
- */
- @Deprecated
- public int getLevel() {
- return getPlayer().getLevel();
- }
- public void unequipEverything() {
- getPlayer().unequipEverything();
- }
- public void teachSkill(int id, int level, int masterlevel) {
- getPlayer().changeSkillLevel(SkillFactory.getSkill(id), level, masterlevel);
- }
- public void clearSkills() {
- Map<ISkill, MapleCharacter.SkillEntry> skills = getPlayer().getSkills();
- for (Entry<ISkill, MapleCharacter.SkillEntry> skill : skills.entrySet()) {
- getPlayer().changeSkillLevel(skill.getKey(), 0, 0);
- }
- }
- /**
- * Use getPlayer() instead (for consistency with MapleClient)
- * @return
- */
- @Deprecated
- public MapleCharacter getChar() {
- return getPlayer();
- }
- public MapleClient getC() {
- return getClient();
- }
- public void rechargeStars() {
- MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
- IItem stars = getChar().getInventory(MapleInventoryType.USE).getItem((byte) 1);
- if (ii.isThrowingStar(stars.getItemId()) || ii.isBullet(stars.getItemId())) {
- stars.setQuantity(ii.getSlotMax(getClient(), stars.getItemId()));
- getC().getSession().write(MaplePacketCreator.updateInventorySlot(MapleInventoryType.USE, (Item) stars));
- }
- }
- public EventManager getEventManager(String event) {
- return getClient().getChannelServer().getEventSM().getEventManager(event);
- }
- public void showEffect(String effect) {
- getPlayer().getMap().broadcastMessage(MaplePacketCreator.showEffect(effect));
- }
- public void playSound(String sound) {
- getPlayer().getMap().broadcastMessage(MaplePacketCreator.playSound(sound));
- }
- @Override
- public String toString() {
- return "Conversation with NPC: " + npc;
- }
- public void updateBuddyCapacity(int capacity) {
- getPlayer().setBuddyCapacity(capacity);
- }
- public int getBuddyCapacity() {
- return getPlayer().getBuddyCapacity();
- }
- public void setHair(int hair) {
- getPlayer().setHair(hair);
- getPlayer().updateSingleStat(MapleStat.HAIR, hair);
- getPlayer().equipChanged();
- }
- public void setFace(int face) {
- getPlayer().setFace(face);
- getPlayer().updateSingleStat(MapleStat.FACE, face);
- getPlayer().equipChanged();
- }
- @SuppressWarnings("static-access")
- public void setSkin(int color) {
- getPlayer().setSkinColor(c.getPlayer().getSkinColor().getById(color));
- getPlayer().updateSingleStat(MapleStat.SKIN, color);
- getPlayer().equipChanged();
- }
- public void warpParty(int mapId) {
- warpParty(mapId, 0, 0);
- }
- public void warpParty(int mapId, int exp, int meso) {
- for (MaplePartyCharacter chr_ : getPlayer().getParty().getMembers()) {
- MapleCharacter curChar = c.getChannelServer().getPlayerStorage().getCharacterByName(chr_.getName());
- if ((curChar.getEventInstance() == null && c.getPlayer().getEventInstance() == null) || curChar.getEventInstance() == getPlayer().getEventInstance()) {
- curChar.changeMap(mapId);
- if (exp > 0) {
- curChar.gainExp(exp, true, false, true);
- }
- if (meso > 0) {
- curChar.gainMeso(meso, true);
- }
- }
- }
- }
- public void warpRandom(int mapid) {
- MapleMap target = c.getChannelServer().getMapFactory().getMap(mapid);
- Random rand = new Random();
- MaplePortal portal = target.getPortal(rand.nextInt(target.getPortals().size())); //generate random portal
- getPlayer().changeMap(target, portal);
- }
- public int itemQuantity(int itemid) {
- int possesed = getPlayer().getItemQuantity(itemid, false);
- return possesed;
- }
- public MapleSquad createMapleSquad(MapleSquadType type) {
- MapleSquad squad = new MapleSquad(c.getChannel(), getPlayer());
- if (getSquadState(type) == 0) {
- c.getChannelServer().addMapleSquad(squad, type);
- } else {
- return null;
- }
- return squad;
- }
- public MapleCharacter getSquadMember(MapleSquadType type, int index) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- MapleCharacter ret = null;
- if (squad != null) {
- ret = squad.getMembers().get(index);
- }
- return ret;
- }
- public int getSquadState(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- return squad.getStatus();
- } else {
- return 0;
- }
- }
- public void setSquadState(MapleSquadType type, int state) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- squad.setStatus(state);
- }
- }
- public boolean checkSquadLeader(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- if (squad.getLeader().getId() == getPlayer().getId()) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- public int getzb() {
- int money = 0;
- try {
- int cid = getPlayer().getAccountID();
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement limitCheck = con.prepareStatement("SELECT * FROM accounts WHERE id=" + cid + "");
- ResultSet rs = limitCheck.executeQuery();
- if (rs.next())
- {
- money = rs.getInt("money");
- }
- limitCheck.close();
- rs.close();
- } catch (SQLException ex) {
- }
- return money;
- }
- public void setzb(int slot) {
- try {
- int cid = getPlayer().getAccountID();
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("UPDATE accounts SET money =money+ " + slot + " WHERE id = " + cid + "");
- ps.executeUpdate();
- ps.close(); } catch (SQLException ex) {
- }
- }
- public void removeMapleSquad(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- if (squad.getLeader().getId() == getPlayer().getId()) {
- squad.clear();
- c.getChannelServer().removeMapleSquad(squad, type);
- }
- }
- }
- public int numSquadMembers(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- int ret = 0;
- if (squad != null) {
- ret = squad.getSquadSize();
- }
- return ret;
- }
- public boolean isSquadMember(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- boolean ret = false;
- if (squad.containsMember(getPlayer())) {
- ret = true;
- }
- return ret;
- }
- public void addSquadMember(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- squad.addMember(getPlayer());
- }
- }
- public void removeSquadMember(MapleSquadType type, MapleCharacter chr, boolean ban) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- squad.banMember(chr, ban);
- }
- }
- public void removeSquadMember(MapleSquadType type, int index, boolean ban) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- MapleCharacter chr = squad.getMembers().get(index);
- squad.banMember(chr, ban);
- }
- }
- public boolean canAddSquadMember(MapleSquadType type) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- if (squad != null) {
- if (squad.isBanned(getPlayer())) {
- return false;
- } else {
- return true;
- }
- }
- return false;
- }
- public void warpSquadMembers(MapleSquadType type, int mapId) {
- MapleSquad squad = c.getChannelServer().getMapleSquad(type);
- MapleMap map = c.getChannelServer().getMapFactory().getMap(mapId);
- if (squad != null) {
- if (checkSquadLeader(type)) {
- for (MapleCharacter chr : squad.getMembers()) {
- chr.changeMap(map, map.getPortal(0));
- }
- }
- }
- }
- public String searchItem(String item) {
- StringBuilder message = new StringBuilder("Choose the item you want:");
- getPlayer().getMap().broadcastMessage(getPlayer(), MaplePacketCreator.showJobChange(getPlayer().getId()), false);
- for (Pair<Integer, String> itemPair : MapleItemInformationProvider.getInstance().getAllItems()) {
- if (itemPair.getRight().toLowerCase().contains(item.toLowerCase())) {
- message.append("rn#L" + itemPair.getLeft() + "##i" + itemPair.getLeft() + "# - #b" + itemPair.getRight() + "#k#l");
- }
- }
- if (!message.toString().contains("#L")) {
- return "没有找到此物品!";
- }
- return message.toString();
- }
- public int makeRing(String partner, int ringId) {
- return makeRing(getCharByName(partner), ringId);
- }
- public int makeRing(MapleCharacter partner, int ringId) {
- int ret = net.sf.odinms.client.MapleRing.createRing(ringId, getPlayer(), partner);
- return ret;
- }
- public void resetReactors() {
- getPlayer().getMap().resetReactors();
- }
- public void displayGuildRanks() {
- MapleGuild.displayGuildRanks(getClient(), npc);
- }
- public boolean sendMessage(String recipient, String message) {
- MapleCharacter chr_ = getCharByName(recipient);
- if (chr_ != null) {
- chr_.dropMessage(6, getPlayer().getName() + ": " + message);
- return true;
- }
- return false;
- }
- public void gainFame(int amount) {
- getPlayer().addFame(amount);
- if (amount > 0) {
- getPlayer().dropMessage(1, "你获得了 " + amount + " 点人气值.");
- } else {
- getPlayer().dropMessage(1, "你失去了 " + amount + " 点人气值.");
- }
- }
- public void maxSkills() {
- getPlayer().maxAllSkills();
- }
- public int getSkillLevel(int skillid) {
- int skilllevel = getPlayer().getSkillLevel(SkillFactory.getSkill(skillid));
- return skilllevel;
- }
- public int getVip() {
- return getPlayer().getVip();
- }
- public int getGm() {
- return getPlayer().getGm();
- }
- public void gainVip(int amount) {
- getPlayer().gainVip(amount);
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, "你的VIP等级提升了:" + amount));
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, "你现在的VIP等级为:" + getPlayer().getVip()));
- }
- public void setVip(int amount) {
- getPlayer().setVip(amount);
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, "你现在的VIP等级为:" + getPlayer().getVip()));
- }
- public void giveBuff(int skillid) {
- MapleItemInformationProvider mii = MapleItemInformationProvider.getInstance();
- MapleStatEffect statEffect = mii.getItemEffect(skillid);
- statEffect.applyTo(getPlayer());
- }
- public int partyMembersInMap() {
- int inMap = 0;
- for (MapleCharacter char2 : getPlayer().getMap().getCharacters()) {
- if (char2.getParty() == getPlayer().getParty()) {
- inMap++;
- }
- }
- return inMap;
- }
- public void modifyNX(int amount, int type) {
- getPlayer().modifyCSPoints(type, amount);
- if (amount > 0) {
- getClient().getSession().write(MaplePacketCreator.serverNotice(5, "你获得了点卷 (+" + amount + ")."));
- } else {
- getClient().getSession().write(MaplePacketCreator.serverNotice(5, "你失去了点卷 (" + (amount) + ")."));
- }
- }
- public void gainNX(int nxcash) {
- getPlayer().gainNX(nxcash);
- }
- public int getReborns() {
- return getPlayer().getReborns();
- }
- public void gainReborns(int amount) {
- getPlayer().gainReborns(amount);
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, "恭喜你转生了:" + getPlayer().getReborns() + "次!"));
- }
- public void setReborns(int amount) {
- getPlayer().setReborns(amount);
- getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(6, "你现在已经转生的次数为: " + amount));
- }
- public int getTime(String type) {
- Calendar cal = Calendar.getInstance();
- if (type.startsWith("d")) {
- return cal.get(Calendar.DAY_OF_WEEK);
- } else if (type.startsWith("h")) {
- return cal.get(Calendar.HOUR_OF_DAY);
- } else if (type.startsWith("m")) {
- return cal.get(Calendar.MINUTE);
- } else if (type.startsWith("s")) {
- return cal.get(Calendar.SECOND);
- }
- return -1; // wrong input
- }
- public void addBuddyCapacity(int capacity) {
- getPlayer().addBuddyCapacity(capacity);
- }
- public void clearKeys() {
- getPlayer().setDefaultKeyMap();
- }
- public void scheduleWarp(int delay, int mapid) {
- final int fmapid = mapid;
- TimerManager.getInstance().schedule(new Runnable() {
- public void run() {
- getPlayer().changeMap(fmapid);
- }
- }, delay * 1000);
- }
- public void startClock(int limit, int endMap) {
- getPlayer().getMap().addMapTimer(limit, endMap);
- }
- public MapleCharacter getCharByName(String name) {
- try {
- return c.getChannelServer().getPlayerStorage().getCharacterByName(name);
- } catch (Exception e) {
- return null;
- }
- }
- public void warpAllInMap(int mapid) {
- warpAllInMap(mapid, 0);
- }
- public void warpAllInMap(int mapid, int portal) {
- for (MapleCharacter mch : getPlayer().getMap().getCharacters()) {
- if (mch.getEventInstance() != null) {
- mch.getEventInstance().unregisterPlayer(mch);
- }
- mch.changeMap(mapid, portal);
- }
- }
- public boolean createMarriage(String partner_) { //声明变量
- MapleCharacter partner = getCharByName(partner_); //名字
- if (partner == null) {
- return false;
- }
- partner.setMarried(true);
- getPlayer().setMarried(true);
- partner.setPartnerId(getPlayer().getId());
- getPlayer().setPartnerId(partner.getId());
- if (partner.getGender() > 0) {
- Marriage.createMarriage(getPlayer(), partner);
- } else {
- Marriage.createMarriage(partner, getPlayer());
- }
- return true;
- }
- public boolean createEngagement(String partner_) {
- MapleCharacter partner = getCharByName(partner_);
- if (partner == null) {
- return false;
- }
- if (partner.getGender() > 0) {
- Marriage.createEngagement(getPlayer(), partner);
- } else {
- Marriage.createEngagement(partner, getPlayer());
- }
- return true;
- }
- public void divorceMarriage() {
- getPlayer().setPartnerId(0);
- getPlayer().setMarried(false);
- Marriage.divorceMarriage(getPlayer());
- }
- public void changeKeyBinding(int key, byte type, int action) {
- MapleKeyBinding newbinding = new MapleKeyBinding(type, action);
- getPlayer().changeKeybinding(key, newbinding);
- }
- public Equip getEquipById(int id) { // we can do getEquipById(2349823).setStr(545); etc.
- MapleInventoryType type = MapleItemInformationProvider.getInstance().getInventoryType(id);
- return (Equip) getPlayer().getInventory(type).findById(id);
- }
- public int getNpcTalkTimes() {
- return NPCScriptManager.getInstance().getNpcTalkTimes(getPlayer().getId(), npc);
- }
- public void setNpcTalkTimes(int amount) {
- NPCScriptManager.getInstance().setNpcTalkTimes(getPlayer().getId(), npc, amount);
- }
- public NPCConversationManager(MapleClient c, int npc, List<MaplePartyCharacter> otherParty, int b) {
- super(c);
- this.c = c;
- this.npc = npc;
- this.otherParty = otherParty;
- }
- public int talkedTimesByNpc() {
- return NPCScriptManager.getInstance().talkedTimesByNpc(npc);
- }
- public boolean makeProItem(int id, int hardcore) {
- MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
- IItem item = ii.getEquipById(id);
- MapleInventoryType type = ii.getInventoryType(id);
- if (type.equals(MapleInventoryType.EQUIP)) {
- MapleInventoryManipulator.addFromDrop(c, ii.hardcoreItem((Equip) item, (short) hardcore));
- return true;
- } else {
- return false;
- }
- }
- public boolean isGuest() {
- if (c.isGuest()) {
- return true;
- }
- return false;
- }
- public void broadcastMessage(int type, String message) {
- try {
- getPlayer().getClient().getChannelServer().getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(type, message).getBytes());
- } catch (RemoteException e) {
- c.getChannelServer().reconnectWorld();
- }
- }
- public void setClan(int set) {
- getPlayer().setClan(set);
- try {
- getPlayer().getClient().getChannelServer().getWorldInterface().broadcastToClan((getPlayer().getName() + " 进入了家族 ! 大家欢迎.").getBytes(), set);
- } catch (RemoteException e) {
- c.getChannelServer().reconnectWorld();
- }
- c.getChannelServer().addToClan(getPlayer());
- }
- public String getAllOnlineNamesFromClan(int set) {
- StringBuilder sb = new StringBuilder();
- for (MapleCharacter names : c.getChannelServer().getClanHolder().getAllOnlinePlayersFromClan(set)) {
- sb.append(names.getName() + "rn");
- }
- return sb.toString();
- }
- public String getAllOfflineNamesFromClan(int set) {
- StringBuilder sb = new StringBuilder();
- for (String names : c.getChannelServer().getClanHolder().getAllOfflinePlayersFromClan(set)) {
- sb.append(names + "rn");
- }
- return sb.toString();
- }
- public void superlaba(String Text)
- {
- if (Text.isEmpty())
- {
- chr.dropMessage("[注意]文字过长,不能发送,最长为20个字!");
- return;
- }
- for (Iterator n$ = ChannelServer.getAllInstances().iterator(); n$.hasNext();)
- {
- ChannelServer cservs = (ChannelServer)n$.next();
- Iterator i$ = cservs.getPlayerStorage().getAllCharacters().iterator();
- while (i$.hasNext())
- {
- MapleCharacter players = (MapleCharacter)i$.next();
- if (players.getGMLevel() < 10)
- players.getClient().getSession().write(MaplePacketCreator.startMapEffect((new StringBuilder()).append("ら超级喇巴ら玩家[").append(c.getPlayer().getName()).append("] 吼道:").append(Text).toString(), 0x4e2006, true));
- }
- }
- }
- public void superlaba(String Text, int idk)
- {
- if (Text.isEmpty())
- {
- chr.dropMessage("[注意]文字过长,不能发送,最长为20个字!");
- return;
- }
- for (Iterator n$ = ChannelServer.getAllInstances().iterator(); n$.hasNext();)
- {
- ChannelServer cservs = (ChannelServer)n$.next();
- Iterator i$ = cservs.getPlayerStorage().getAllCharacters().iterator();
- while (i$.hasNext())
- {
- MapleCharacter players = (MapleCharacter)i$.next();
- if (players.getGMLevel() < 10)
- players.getClient().getSession().write(MaplePacketCreator.startMapEffect((new StringBuilder()).append("ら超级喇巴ら玩家[").append(c.getPlayer().getName()).append("] 吼道:").append(Text).toString(), idk, true));
- }
- }
- }
- public void setLevel(int level) {
- getPlayer().setLevel(level);
- getPlayer().updateSingleStat(MapleStat.LEVEL, Integer.valueOf(level));
- }
- public void summonMobid(int mobid) {
- getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(mobid), getPlayer().getPosition());
- }
- public void summonMobid2(int mobid) {
- getPlayer().getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(mobid), getNPCPosition());
- }
- public void summonMob(int mobid, int customHP, int customEXP, int amount) {
- MapleMonsterStats newStats = new MapleMonsterStats();
- if (customHP > 0) {
- newStats.setHp(customHP);
- }
- if (customEXP >= 0) {
- newStats.setExp(customEXP);
- }
- if (amount <= 1) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition());
- } else {
- for (int i = 0; i < amount; i++) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition());
- }
- }
- }
- public void spawnMonster(int id, int hp, int mp,int level,int exp, int qty) {
- MapleMonsterStats overrideStats = new MapleMonsterStats();
- overrideStats.setHp(hp);
- overrideStats.setMp(mp);
- overrideStats.setLevel(level);
- overrideStats.setExp(exp);
- MapleMonster mob = MapleLifeFactory.getMonster(id);
- mob.setOverrideStats(overrideStats);
- spawnMonster(id,qty,mob);
- }
- public void spawnMonster(int id, int qty, int hp,int exp) {
- MapleMonsterStats overrideStats = new MapleMonsterStats();
- overrideStats.setHp(hp);
- overrideStats.setExp(exp);
- MapleMonster mob = MapleLifeFactory.getMonster(id);
- mob.setOverrideStats(overrideStats);
- spawnMonster(id,qty,mob);
- }
- private void spawnMonster(int id, int qty,MapleMonster mob ) {
- for (int i = 0; i < qty; i++) {
- mob = MapleLifeFactory.getMonster(id);
- getPlayer().getMap().spawnMonsterOnGroudBelow(mob, getPosition());
- }
- }
- public void spawnMonster(int mobid, int HP, int MP, int level, int EXP, int boss, int undead, int amount, int x, int y) {
- MapleMonsterStats newStats = new MapleMonsterStats();
- Point spawnPos = new Point(x, y);
- if (HP >= 0) {
- newStats.setHp(HP);
- }
- if (MP >= 0) {
- newStats.setMp(MP);
- }
- if (level >= 0) {
- newStats.setLevel(level);
- }
- if (EXP >= 0) {
- newStats.setExp(EXP);
- }
- if (boss == 1) {
- newStats.setBoss(true);
- }
- if (undead == 1) {
- newStats.setUndead(true);
- }
- for (int i = 0; i < amount; i++) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- npcmob.setMp(npcmob.getMaxMp());
- getPlayer().getMap().spawnMonsterOnGroundBelow(npcmob, spawnPos);
- }
- }
- public void summonMobAtPosition(int mobid, int customHP, int customEXP, int amount, int posx, int posy) {
- MapleMonsterStats newStats = new MapleMonsterStats();
- if (customHP > 0) {
- newStats.setHp(customHP);
- }
- if (customEXP >= 0) {
- newStats.setExp(customEXP);
- }
- if (amount <= 1) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
- } else {
- for (int i = 0; i < amount; i++) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setOverrideStats(newStats);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
- }
- }
- }
- private void spawnMonster(int id, int qty, Point pos) {
- for (int i = 0; i < qty; i++) {
- MapleMonster mob = MapleLifeFactory.getMonster(id);
- getPlayer().getMap().spawnMonsterOnGroudBelow(mob, pos);
- }
- }
- public void spawnMonster(int id) {
- spawnMonster(id, 1, getPosition());
- }
- public void spawnMonster(int id, int qty) {
- spawnMonster(id, qty, getPosition());
- }
- public void spawnMob(int mapid, int mid, int xpos, int ypos) {
- ChannelServer cserv = getClient().getChannelServer();
- MapleMap map = cserv.getMapFactory().getMap(mapid);
- MapleMonster mob = MapleLifeFactory.getMonster(mid);
- Point spawnpoint = new Point(xpos, ypos);
- map.spawnMonsterOnGroudBelow(mob, spawnpoint);
- }
- public void summonMobAtPosition(int mobid, int amount, int posx, int posy) {
- if (amount <= 1) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
- } else {
- for (int i = 0; i < amount; i++) {
- MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
- npcmob.setHp(npcmob.getMaxHp());
- getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, new Point(posx, posy));
- }
- }
- }
- public void killAllMobs() {
- MapleMap map = getPlayer().getMap();
- double range = Double.POSITIVE_INFINITY;
- List<MapleMapObject> monsters = map.getMapObjectsInRange(getPlayer().getPosition(), range, Arrays.asList(MapleMapObjectType.MONSTER));
- for (MapleMapObject monstermo : monsters) {
- MapleMonster monster = (MapleMonster) monstermo;
- map.killMonster(monster, getPlayer(), false);
- }
- }
- public int getOfflineClanCount(int clan) {
- return ClanHolder.countOfflineByClan(clan);
- }
- public int getOnlineClanCount(int clan) {
- try {
- return c.getChannelServer().getWorldInterface().onlineClanMembers(clan);
- } catch (RemoteException re) {
- c.getChannelServer().reconnectWorld();
- }
- return -1;
- }
- public String getJobById(int id) {
- return MapleJob.getJobName(id);
- }
- public List<MapleCharacter> getPartyMembers() {
- if (getPlayer().getParty() == null) {
- return null;
- }
- List<MapleCharacter> chars = new LinkedList<MapleCharacter>(); // creates an empty array full of shit..
- for (ChannelServer channel : ChannelServer.getAllInstances()) {
- for (MapleCharacter chr : channel.getPartyMembers(getPlayer().getParty())) {
- if (chr != null) { // double check <3
- chars.add(chr);
- }
- }
- }
- return chars;
- }
- public MapleCharacter getSender() {
- return this.chr;
- }
- public void removeHiredMerchantItem(int id) {
- Connection con = DatabaseConnection.getConnection();
- try {
- PreparedStatement ps = con.prepareStatement("DELETE FROM hiredmerchant WHERE id = ?");
- ps.setInt(1, id);
- ps.executeUpdate();
- ps.close();
- } catch (SQLException se) {
- }
- }
- public int getHiredMerchantMesos() {
- Connection con = DatabaseConnection.getConnection();
- int mesos;
- try {
- PreparedStatement ps = con.prepareStatement("SELECT MerchantMesos FROM characters WHERE id = ?");
- ps.setInt(1, getPlayer().getId());
- ResultSet rs = ps.executeQuery();
- rs.next();
- mesos = rs.getInt("MerchantMesos");
- rs.close();
- ps.close();
- } catch (SQLException se) {
- return 0;
- }
- return mesos;
- }
- public void zeroMerchantMesos() {
- try {
- PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET MerchantMesos = 0 WHERE id = ?");
- ps.setInt(1, getPlayer().getId());
- ps.executeUpdate();
- ps.close();
- } catch (Exception e) {
- }
- }
- public void setHiredMerchantMesos(int set) {
- Connection con = DatabaseConnection.getConnection();
- try {
- PreparedStatement ps = con.prepareStatement("UPDATE characters SET MerchantMesos = ? WHERE id = ?");
- ps.setInt(1, set);
- ps.setInt(2, getPlayer().getId());
- ps.executeUpdate();
- ps.close();
- } catch (SQLException se) {
- }
- }
- public String getPvpRoom(int ismap, int sel) {
- MapleMap map = c.getChannelServer().getMapFactory().getMap(ismap) ;
- double range = Double.POSITIVE_INFINITY;
- List<MapleMapObject> players = map.getMapObjectsInRange(c.getPlayer().getPosition (), range, Arrays.asList(MapleMapObjectType.PLAYER));
- if (players.size() <= 0) {return "#L"+sel+"#"+sel+". #r创建一个房间#k#l";
- } else if (players.size() == 1) {return "#L"+sel+"#"+sel+". #b进入等待房间#k#l";
- } else if (players.size() >= 2) {return "#L"+sel+"#"+sel+". #d正在pk中k#l";
- } else {return "";}
- }
- public void setluck(String bossid, int id)
- {
- Connection con1 = DatabaseConnection.getConnection();
- try
- {
- PreparedStatement ps = con1.prepareStatement("insert into fslucklog (characterid, bossid,eventid) values (?,?)");
- ps.setInt(1, getPlayer().getId());
- ps.setString(2, bossid);
- ps.setInt(3, id);
- ps.executeUpdate();
- ps.close();
- }
- catch (Exception Ex) { }
- }
- public int getluck(int id)
- {
- int money = 0;
- try
- {
- Connection con = DatabaseConnection.getConnection();
- int cid = getPlayer().getId();
- PreparedStatement limitCheck = con.prepareStatement((new StringBuilder()).append("SELECT * FROM fslucklog WHERE characterid=").append(cid).append(" and eventid=").append(id).append("").toString());
- ResultSet rs = limitCheck.executeQuery();
- if (rs.next())
- money = rs.getInt("bossid");
- limitCheck.close();
- rs.close();
- }
- catch (SQLException ex) { }
- return money;
- }
- public void delluck(int id)
- {
- Connection con1 = DatabaseConnection.getConnection();
- try
- {
- PreparedStatement ps = con1.prepareStatement("DELETE FROM fslucklog WHERE characterid = ? and eventid = ?");
- ps.setInt(1, getPlayer().getId());
- ps.setInt(2, id);
- ps.executeUpdate();
- ps.close();
- }
- catch (Exception Ex) { }
- }
- public int getnumluck(int id)
- {
- int money = 0;
- try
- {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement limitCheck = con.prepareStatement((new StringBuilder()).append("SELECT * FROM fsevent WHERE id=").append(id).append("").toString());
- ResultSet rs = limitCheck.executeQuery();
- if (rs.next())
- money = rs.getInt("num");
- limitCheck.close();
- rs.close();
- }
- catch (SQLException ex) { }
- return money;
- }
- public String equipList(int slot)
- {
- StringBuilder str = new StringBuilder();
- MapleInventory equip = c.getPlayer().getInventory(MapleInventoryType.USE);
- if (slot == 1)
- equip = c.getPlayer().getInventory(MapleInventoryType.EQUIP);
- else
- if (slot == 2)
- equip = c.getPlayer().getInventory(MapleInventoryType.ETC);
- else
- if (slot == 3)
- equip = c.getPlayer().getInventory(MapleInventoryType.CASH);
- java.util.List stra = new LinkedList();
- IItem item;
- for (Iterator i$ = equip.list().iterator(); i$.hasNext(); stra.add((new StringBuilder()).append("#L").append(item.getPosition()).append("##v").append(item.getItemId()).append("##l").toString()))
- item = (IItem)i$.next();
- String strb;
- for (Iterator i$ = stra.iterator(); i$.hasNext(); str.append(strb))
- strb = (String)i$.next();
- return str.toString();
- }
- public List<Pair<Integer, IItem>> getHiredMerchantItems() {
- Connection con = DatabaseConnection.getConnection();
- List<Pair<Integer, IItem>> items = new ArrayList<Pair<Integer, IItem>>();
- try {
- PreparedStatement ps = con.prepareStatement("SELECT * FROM hiredmerchant WHERE ownerid = ?");
- ps.setInt(1, getPlayer().getId());
- ResultSet rs = ps.executeQuery();
- while (rs.next()) {
- if (rs.getInt("type") == 1) {
- Equip eq = new Equip(rs.getInt("itemid"), (byte) 0, -1);
- eq.setUpgradeSlots((byte) rs.getInt("upgradeslots"));
- eq.setLevel((byte) rs.getInt("level"));
- eq.setStr((short) rs.getInt("str"));
- eq.setDex((short) rs.getInt("dex"));
- eq.setInt((short) rs.getInt("int"));
- eq.setLuk((short) rs.getInt("luk"));
- eq.setHp((short) rs.getInt("hp"));
- eq.setMp((short) rs.getInt("mp"));
- eq.setWatk((short) rs.getInt("watk"));
- eq.setMatk((short) rs.getInt("matk"));
- eq.setWdef((short) rs.getInt("wdef"));
- eq.setMdef((short) rs.getInt("mdef"));
- eq.setAcc((short) rs.getInt("acc"));
- eq.setAvoid((short) rs.getInt("avoid"));
- eq.setHands((short) rs.getInt("hands"));
- eq.setSpeed((short) rs.getInt("speed"));
- eq.setJump((short) rs.getInt("jump"));
- eq.setOwner(rs.getString("owner"));
- items.add(new Pair<Integer, IItem>(rs.getInt("id"), eq));
- } else if (rs.getInt("type") == 2) {
- Item newItem = new Item(rs.getInt("itemid"), (byte) 0, (short) rs.getInt("quantity"));
- newItem.setOwner(rs.getString("owner"));
- items.add(new Pair<Integer, IItem>(rs.getInt("id"), newItem));
- }
- }
- ps.close();
- rs.close();
- } catch (SQLException se) {
- se.printStackTrace();
- return null;
- }
- return items;
- }
- public void changeJobById(int a) {
- getPlayer().changeJob(MapleJob.getById(a));
- }
- public void gainCloseness(int closeness) {
- for (MaplePet pet : getPlayer().getPets()) {
- if (pet.getCloseness() < 30000 || pet.getLevel() < 30) {
- if ((pet.getCloseness() + closeness) > 30000) {
- pet.setCloseness(30000);
- } else {
- pet.setCloseness(pet.getCloseness() + closeness);
- }
- while (pet.getCloseness() > ExpTable.getClosenessNeededForLevel(pet.getLevel() + 1)) {
- pet.setLevel(pet.getLevel() + 1);
- getClient().getSession().write(MaplePacketCreator.showOwnPetLevelUp(getPlayer().getPetIndex(pet)));
- }
- getPlayer().getClient().getSession().write(MaplePacketCreator.updatePet(pet, true));
- }
- }
- }
- public void doReborn() {
- getPlayer().setReborns(getPlayer().getReborns() + 1);
- List<Pair<MapleStat, Integer>> reborn = new ArrayList<Pair<MapleStat, Integer>>(4);
- getPlayer().setLevel(1);
- getPlayer().setExp(0);
- getPlayer().setJob(MapleJob.BEGINNER);
- reborn.add(new Pair<MapleStat, Integer>(MapleStat.LEVEL, Integer.valueOf(1)));
- reborn.add(new Pair<MapleStat, Integer>(MapleStat.EXP, Integer.valueOf(0)));
- reborn.add(new Pair<MapleStat, Integer>(MapleStat.JOB, Integer.valueOf(0)));
- getPlayer().getClient().getSession().write(MaplePacketCreator.updatePlayerStats(reborn));
- }
- public Point getPosition() {
- return getPlayer().getPosition();
- }
- public Point getNPCPosition() {
- MapleNPC thenpc = MapleLifeFactory.getNPC(this.npc);
- return thenpc.getPosition();
- }
- public int getgxd()
- {
- int money = 0;
- try
- {
- int cid = getPlayer().getAccountID();
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement limitCheck = con.prepareStatement((new StringBuilder()).append("SELECT * FROM fsbtgy WHERE charid=").append(cid).append("").toString());
- ResultSet rs = limitCheck.executeQuery();
- if (rs.next())
- money = rs.getInt("money");
- limitCheck.close();
- rs.close();
- }
- catch (SQLException ex) { }
- return money;
- }
- public void setgxd(int slot)
- {
- Connection con = DatabaseConnection.getConnection();
- try
- {
- int cid = getPlayer().getAccountID();
- PreparedStatement ps = con.prepareStatement((new StringBuilder()).append("UPDATE fsbtgy SET money =money+ ").append(slot).append(" WHERE charid = ").append(cid).append("").toString());
- ps.executeUpdate();
- ps.close();
- }
- catch (Exception Ex) { }
- }
- public void addgxd(int cid)
- {
- try
- {
- int money = 0;
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("select * from fsbtgy where charid=?");
- ps.setInt(1, cid);
- ResultSet rs = ps.executeQuery();
- if (rs.next())
- {
- money = rs.getInt("money");
- ps = con.prepareStatement((new StringBuilder()).append("UPDATE fsbtgy SET money =money+ ").append(money).append(" WHERE charid = ").append(cid).append("").toString());
- ps.executeUpdate();
- } else
- {
- ps = con.prepareStatement("insert into fsbtgy (charid,money) values (?,1)");
- ps.setInt(1, cid);
- ps.executeUpdate();
- }
- rs.close();
- ps.close();
- }
- catch (SQLException ex) { }
- }
- public void setgxded(String bossid)
- {
- Connection con1 = DatabaseConnection.getConnection();
- try
- {
- PreparedStatement ps = con1.prepareStatement("insert into fsbtgyed (characterid, bossid) values (?,?)");
- ps.setInt(1, getPlayer().getId());
- ps.setString(2, bossid);
- ps.executeUpdate();
- ps.close();
- }
- catch (Exception Ex) { }
- }
- public int getgxded(String bossid)
- {
- Connection con1 = DatabaseConnection.getConnection();
- try{
- int ret_count;
- ret_count = 0;
- PreparedStatement ps = con1.prepareStatement("select count(*) from fsbtgyed where characterid = ? and bossid = ?");
- ps.setInt(1, getPlayer().getId());
- ps.setString(2, bossid);
- ResultSet rs = ps.executeQuery();
- if (rs.next())
- ret_count = rs.getInt(1);
- else
- ret_count = -1;
- rs.close();
- ps.close();
- return ret_count;
- } catch (Exception Ex) { }
- return -1;
- }
- public String paiMing()
- {
- String result="";
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("select * from characters order by rebirth desc limit 0, 10");
- ResultSet rs = ps.executeQuery();
- while(rs.next())
- {
- result = result+rs.getString("name")+" 转生次数:"+rs.getInt("Reborns")+"rn";
- }
- } catch (SQLException ex) {
- return "";
- }
- return result;
- }
- public void giveItemBuff(int itemId) {
- getPlayer().setItemEffect(itemId);
- }
- public String getName() {
- return getPlayer().getName();
- }
- public int getGender() {
- return getPlayer().getGender();
- }
- public int countMonster() {
- return getPlayer().getMap().getMapObjectsInRange(getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER)).size();
- }
- public int getDayOfWeek() {
- return Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
- }
- //getBossLog
- public int getBossLog(String bossid) {
- return getPlayer().getBossLog(bossid);
- }
- public MapleCharacter getP() {
- return getPlayer();
- }
- public void MakeGMItem (byte slot, MapleCharacter player) {
- MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP);
- Equip eu = (Equip) equip.getItem(slot);
- int item = equip.getItem(slot).getItemId();
- MapleJob job = eu.getJob();
- short hand = eu.getHands();
- byte level = eu.getLevel();
- Equip nItem = new Equip(item, equip.getNextFreeSlot());
- nItem.setStr((short) 32000); // STR
- nItem.setDex((short) 32000); // DEX
- nItem.setInt((short) 32000); // INT
- nItem.setLuk((short) 32000); //LUK
- nItem.setHp((short) 32000); // HP
- nItem.setMp((short) 32000); // MP
- nItem.setWatk((short) 32000); //WATK
- nItem.setMatk((short) 32000); //MATK
- nItem.setWdef((short) 32000); //WDEF
- nItem.setMdef((short) 32000); //MDEF
- nItem.setAcc((short) 32000); // ACC
- nItem.setAvoid((short) 32000); // AVOID
- nItem.setSpeed((short) 40); // SPEED ( 140% is max speed )
- nItem.setJump((short) 30); //JUMP ( 130% is max jump )
- nItem.setUpgradeSlots((byte) 10); // 可升级次�?
- nItem.setJob(job);
- nItem.setHands(hand);
- nItem.setLevel(level);
- nItem.setRingId(-1);
- player.getInventory(MapleInventoryType.EQUIP).addFromDB(nItem);
- equip.removeItem(slot); // 原始物品删除
- }
- public String EquipList(MapleClient c) {
- StringBuilder str = new StringBuilder();
- MapleInventory equip = c.getPlayer().getInventory(MapleInventoryType.EQUIP);
- List<String> stra = new LinkedList<String>();
- for (IItem item : equip.list()) {
- stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
- }
- for (String strb : stra) {
- str.append(strb);
- }
- return str.toString();
- }
- public void gainjuankuan(int amount) {
- getPlayer().gainjuankuan(amount);
- }
- public void setDropmeso(int dropmeso) {
- getPlayer().setDropmeso(dropmeso);
- }
- //setBossLog
- public void setBossLog(String bossid) {
- getPlayer().setBossLog(bossid);
- }
- public void serverNotice(String Text) {
- getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, Text));
- }
- public void showlvl() {
- MapleGuild.displayTops(getClient(), npc);
- }
- public void killAllMonster(int mapid){
- getClient().getChannelServer().getMapFactory().getMap(mapid).killAllmonster(getClient());
- }
- public int getMoney()
- {
- int money=0;
- try {
- int cid = getPlayer().getId();
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement limitCheck = con.prepareStatement("SELECT * FROM Bank WHERE charid="+cid+"");
- ResultSet rs = limitCheck.executeQuery();
- if(rs.next())
- {
- money=rs.getInt("money");
- }
- limitCheck.close();
- rs.close();
- } catch (SQLException ex) {
- }
- return money;
- }
- public int addMoney(int money,int type)
- {
- try {
- int cid = getPlayer().getId();
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("select * from bank where charid=?");
- ps.setInt(1, cid);
- ResultSet rs=ps.executeQuery();
- if(rs.next())
- {
- if(type==1)
- {
- if(money>rs.getInt("money"))
- {
- return -1;
- }
- }
- ps = con.prepareStatement("UPDATE Bank SET money =money+ " + money + " WHERE charid = " + cid + "");
- return ps.executeUpdate();
- }
- } catch (SQLException ex) {
- }
- return 0;
- }
- public int addBank()
- {
- int r=0;
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("insert into bank (charid,money) values (?,0)");
- ps.setInt(1, getPlayer().getId());
- r=ps.executeUpdate();
- ps.close();
- } catch (SQLException ex) {
- r=0;
- }
- return r;
- }
- public void deleteItem(int inventorytype) {
- try {
- Connection con = DatabaseConnection.getConnection();
- PreparedStatement ps = con.prepareStatement("Select * from inventoryitems where characterid=? and inventorytype=?");
- ps.setInt(1, getPlayer().getId());
- ps.setInt(2, inventorytype);
- ResultSet re = ps.executeQuery();
- MapleInventoryType type = null;
- switch (inventorytype) {
- case 1:
- type=MapleInventoryType.EQUIP;
- break;
- case 2:
- type=MapleInventoryType.USE;
- break;
- case 3:
- type=MapleInventoryType.SETUP;
- break;
- case 4:
- type=MapleInventoryType.ETC;
- break;
- case 5:
- type=MapleInventoryType.CASH;
- break;
- }
- while (re.next()) {
- MapleInventoryManipulator.removeById(getC(),type, re.getInt("itemid"),1,true, true);
- }
- re.close();
- ps.close();
- } catch (SQLException ex) {
- // Logger.getLogger(NPCConversationManager.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- public MapleCharacter getV1() {
- return getPlayer();
- }
- public void MakeVIP1Item (byte slot, MapleCharacter player) {
- MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP);
- Equip eu = (Equip) equip.getItem(slot);
- int item = equip.getItem(slot).getItemId();
- MapleJob job = eu.getJob();
- short hand = eu.getHands();
- byte level = eu.getLevel();
- Equip nItem = new Equip(item, equip.getNextFreeSlot());
- nItem.setStr((short) 9999); // STR
- nItem.setDex((short) 9999); // DEX
- nItem.setInt((short) 9999); // INT
- nItem.setLuk((short) 9999); //LUK
- nItem.setHp((short) 9999); // HP
- nItem.setMp((short) 9999); // MP
- nItem.setWatk((short) 9999); //WATK
- nItem.setMatk((short) 9999); //MATK
- nItem.setWdef((short) 9999); //WDEF
- nItem.setMdef((short) 9999); //MDEF
- nItem.setAcc((short) 9999); // ACC
- nItem.setAvoid((short) 9999); // AVOID
- nItem.setSpeed((short) 40); // SPEED ( 140% is max speed )
- nItem.setJump((short) 30); //JUMP ( 130% is max jump )
- nItem.setUpgradeSlots((byte) 7); // 可升级次数
- nItem.setJob(job);
- nItem.setHands(hand);
- nItem.setLevel(level);
- nItem.setRingId(-1);
- player.getInventory(MapleInventoryType.EQUIP).addFromDB(nItem);
- equip.removeItem(slot); // 原始物品删除
- }
- public String EquipList1(MapleClient c) {
- StringBuilder str = new StringBuilder();
- MapleInventory equip = c.getPlayer().getInventory(MapleInventoryType.EQUIP);
- List<String> stra = new LinkedList<String>();
- for (IItem item : equip.list()) {
- stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
- }
- for (String strb : stra) {
- str.append(strb);
- }
- return str.toString();
- }
- public int getExt(String bossid)
- {
- return getPlayer().getExt(bossid);
- }
- }