Rename and clean up MapleCarnivalFactory
This commit is contained in:
@@ -30,8 +30,8 @@ import net.server.world.Party;
|
|||||||
import net.server.world.PartyCharacter;
|
import net.server.world.PartyCharacter;
|
||||||
import server.life.LifeFactory;
|
import server.life.LifeFactory;
|
||||||
import server.life.Monster;
|
import server.life.Monster;
|
||||||
import server.partyquest.MapleCarnivalFactory;
|
import server.partyquest.CarnivalFactory;
|
||||||
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
import server.partyquest.CarnivalFactory.MCSkill;
|
||||||
import server.partyquest.MonsterCarnival;
|
import server.partyquest.MonsterCarnival;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
@@ -93,7 +93,7 @@ public final class MonsterCarnivalHandler extends AbstractPacketHandler {
|
|||||||
c.sendPacket(PacketCreator.enableActions());
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getSkill(skillid.get(num)); //ugh wtf
|
final MCSkill skill = CarnivalFactory.getInstance().getSkill(skillid.get(num)); //ugh wtf
|
||||||
if (skill == null || c.getPlayer().getCP() < skill.cpLoss) {
|
if (skill == null || c.getPlayer().getCP() < skill.cpLoss) {
|
||||||
c.sendPacket(PacketCreator.CPQMessage((byte) 1));
|
c.sendPacket(PacketCreator.CPQMessage((byte) 1));
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
@@ -133,7 +133,7 @@ public final class MonsterCarnivalHandler extends AbstractPacketHandler {
|
|||||||
neededCP = skill.cpLoss;
|
neededCP = skill.cpLoss;
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
} else if (tab == 2) { //protectors
|
} else if (tab == 2) { //protectors
|
||||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getGuardian(num);
|
final MCSkill skill = CarnivalFactory.getInstance().getGuardian(num);
|
||||||
if (skill == null || c.getPlayer().getCP() < skill.cpLoss) {
|
if (skill == null || c.getPlayer().getCP() < skill.cpLoss) {
|
||||||
c.sendPacket(PacketCreator.CPQMessage((byte) 1));
|
c.sendPacket(PacketCreator.CPQMessage((byte) 1));
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ import server.maps.MapMonitor;
|
|||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
import server.maps.Reactor;
|
import server.maps.Reactor;
|
||||||
import server.maps.ReactorDropEntry;
|
import server.maps.ReactorDropEntry;
|
||||||
import server.partyquest.MapleCarnivalFactory;
|
import server.partyquest.CarnivalFactory;
|
||||||
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
import server.partyquest.CarnivalFactory.MCSkill;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
|
|
||||||
import javax.script.Invocable;
|
import javax.script.Invocable;
|
||||||
@@ -324,7 +324,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dispelAllMonsters(int num, int team) { //dispels all mobs, cpq
|
public void dispelAllMonsters(int num, int team) { //dispels all mobs, cpq
|
||||||
final MCSkill skil = MapleCarnivalFactory.getInstance().getGuardian(num);
|
final MCSkill skil = CarnivalFactory.getInstance().getGuardian(num);
|
||||||
if (skil != null) {
|
if (skil != null) {
|
||||||
for (Monster mons : getMap().getAllMonsters()) {
|
for (Monster mons : getMap().getAllMonsters()) {
|
||||||
if(mons.getTeam() == team) {
|
if(mons.getTeam() == team) {
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ import server.life.MobSkill;
|
|||||||
import server.life.MobSkillFactory;
|
import server.life.MobSkillFactory;
|
||||||
import server.life.Monster;
|
import server.life.Monster;
|
||||||
import server.maps.*;
|
import server.maps.*;
|
||||||
import server.partyquest.MapleCarnivalFactory;
|
import server.partyquest.CarnivalFactory;
|
||||||
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
import server.partyquest.CarnivalFactory.MCSkill;
|
||||||
import tools.ArrayMap;
|
import tools.ArrayMap;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
@@ -1033,7 +1033,7 @@ public class StatEffect {
|
|||||||
} else if (cp != 0 && applyto.getMonsterCarnival() != null) {
|
} else if (cp != 0 && applyto.getMonsterCarnival() != null) {
|
||||||
applyto.gainCP(cp);
|
applyto.gainCP(cp);
|
||||||
} else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) { // added by Drago (Dragohe4rt)
|
} else if (nuffSkill != 0 && applyto.getParty() != null && applyto.getMap().isCPQMap()) { // added by Drago (Dragohe4rt)
|
||||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getSkill(nuffSkill);
|
final MCSkill skill = CarnivalFactory.getInstance().getSkill(nuffSkill);
|
||||||
if (skill != null) {
|
if (skill != null) {
|
||||||
final Disease dis = skill.getDisease();
|
final Disease dis = skill.getDisease();
|
||||||
Party opposition = applyfrom.getParty().getEnemy();
|
Party opposition = applyfrom.getParty().getEnemy();
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ import server.TimerManager;
|
|||||||
import server.events.gm.*;
|
import server.events.gm.*;
|
||||||
import server.life.*;
|
import server.life.*;
|
||||||
import server.life.LifeFactory.selfDestruction;
|
import server.life.LifeFactory.selfDestruction;
|
||||||
|
import server.partyquest.CarnivalFactory;
|
||||||
|
import server.partyquest.CarnivalFactory.MCSkill;
|
||||||
import server.partyquest.GuardianSpawnPoint;
|
import server.partyquest.GuardianSpawnPoint;
|
||||||
import server.partyquest.MapleCarnivalFactory;
|
|
||||||
import server.partyquest.MapleCarnivalFactory.MCSkill;
|
|
||||||
import tools.FilePrinter;
|
import tools.FilePrinter;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
@@ -4288,7 +4288,7 @@ public class MapleMap {
|
|||||||
if (team == 0 && redTeamBuffs.size() >= 4 || team == 1 && blueTeamBuffs.size() >= 4) {
|
if (team == 0 && redTeamBuffs.size() >= 4 || team == 1 && blueTeamBuffs.size() >= 4) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
final MCSkill skill = MapleCarnivalFactory.getInstance().getGuardian(num);
|
final MCSkill skill = CarnivalFactory.getInstance().getGuardian(num);
|
||||||
if (team == 0 && redTeamBuffs.contains(skill)) {
|
if (team == 0 && redTeamBuffs.contains(skill)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (team == 1 && blueTeamBuffs.contains(skill)) {
|
} else if (team == 1 && blueTeamBuffs.contains(skill)) {
|
||||||
|
|||||||
@@ -15,24 +15,24 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@author Drago (Dragohe4rt)
|
* @author Drago (Dragohe4rt)
|
||||||
*/
|
*/
|
||||||
public class MapleCarnivalFactory {
|
public class CarnivalFactory {
|
||||||
|
|
||||||
private final static MapleCarnivalFactory instance = new MapleCarnivalFactory();
|
private final static CarnivalFactory instance = new CarnivalFactory();
|
||||||
private final Map<Integer, MCSkill> skills = new HashMap<>();
|
private final Map<Integer, MCSkill> skills = new HashMap<>();
|
||||||
private final Map<Integer, MCSkill> guardians = new HashMap<>();
|
private final Map<Integer, MCSkill> guardians = new HashMap<>();
|
||||||
private final DataProvider dataRoot = DataProviderFactory.getDataProvider(WZFiles.SKILL);
|
private final DataProvider dataRoot = DataProviderFactory.getDataProvider(WZFiles.SKILL);
|
||||||
|
|
||||||
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
||||||
private final List<Integer> multiTargetedSkills = new ArrayList<>();
|
private final List<Integer> multiTargetedSkills = new ArrayList<>();
|
||||||
|
|
||||||
public MapleCarnivalFactory() {
|
public CarnivalFactory() {
|
||||||
//whoosh
|
//whoosh
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final MapleCarnivalFactory getInstance() {
|
public static final CarnivalFactory getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public class MapleCarnivalFactory {
|
|||||||
for (Data z : dataRoot.getData("MCSkill.img")) {
|
for (Data z : dataRoot.getData("MCSkill.img")) {
|
||||||
Integer id = Integer.parseInt(z.getName());
|
Integer id = Integer.parseInt(z.getName());
|
||||||
MCSkill ms = new MCSkill(DataTool.getInt("spendCP", z, 0), DataTool.getInt("mobSkillID", z, 0), DataTool.getInt("level", z, 0), DataTool.getInt("target", z, 1) > 1);
|
MCSkill ms = new MCSkill(DataTool.getInt("spendCP", z, 0), DataTool.getInt("mobSkillID", z, 0), DataTool.getInt("level", z, 0), DataTool.getInt("target", z, 1) > 1);
|
||||||
|
|
||||||
skills.put(id, ms);
|
skills.put(id, ms);
|
||||||
if (ms.targetsAll) {
|
if (ms.targetsAll) {
|
||||||
multiTargetedSkills.add(id);
|
multiTargetedSkills.add(id);
|
||||||
@@ -63,7 +63,7 @@ public class MapleCarnivalFactory {
|
|||||||
return skills.get(singleTargetedSkills.get((int) (Math.random() * singleTargetedSkills.size())));
|
return skills.get(singleTargetedSkills.get((int) (Math.random() * singleTargetedSkills.size())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MCSkill getSkill(final int id) {
|
public MCSkill getSkill(final int id) {
|
||||||
MCSkill skill = skills.get(id);
|
MCSkill skill = skills.get(id);
|
||||||
if (skill != null && skill.skillid <= 0) {
|
if (skill != null && skill.skillid <= 0) {
|
||||||
@@ -92,7 +92,7 @@ public class MapleCarnivalFactory {
|
|||||||
public MobSkill getSkill() {
|
public MobSkill getSkill() {
|
||||||
return getMobSkill(skillid, level);
|
return getMobSkill(skillid, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobSkill getMobSkill(int skillid, int level) {
|
public static MobSkill getMobSkill(int skillid, int level) {
|
||||||
return MobSkillFactory.getMobSkill(skillid, level);
|
return MobSkillFactory.getMobSkill(skillid, level);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user