mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 05:27:37 +00:00
Only Party Quest fix for Location Quests
This commit is contained in:
1 parent
1484cca7de
commit
46b9ec0c7e
1 file changed
+56
-53
@@ -17,34 +17,34 @@ import java.util.List;
|
||||
|
||||
public class TileWaypoint extends TileEntity {
|
||||
|
||||
public String name = "";
|
||||
public String name = "";
|
||||
|
||||
private int ticks = 10;
|
||||
private List<EntityPlayer> recentlyChecked = new ArrayList<EntityPlayer>();
|
||||
private List<EntityPlayer> toCheck;
|
||||
public int range = 10;
|
||||
private int ticks = 10;
|
||||
private List<EntityPlayer> recentlyChecked = new ArrayList<EntityPlayer>();
|
||||
private List<EntityPlayer> toCheck;
|
||||
public int range = 10;
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(worldObj.isRemote || name.isEmpty())
|
||||
return;
|
||||
ticks--;
|
||||
if(ticks > 0)
|
||||
return;
|
||||
ticks = 10;
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(worldObj.isRemote || name.isEmpty())
|
||||
return;
|
||||
ticks--;
|
||||
if(ticks > 0)
|
||||
return;
|
||||
ticks = 10;
|
||||
|
||||
toCheck = getPlayerList(range, range, range);
|
||||
toCheck.removeAll(recentlyChecked);
|
||||
toCheck = getPlayerList(range, range, range);
|
||||
toCheck.removeAll(recentlyChecked);
|
||||
|
||||
List<EntityPlayer> listMax = getPlayerList(range + 10, range + 10, range + 10);
|
||||
recentlyChecked.retainAll(listMax);
|
||||
recentlyChecked.addAll(toCheck);
|
||||
List<EntityPlayer> listMax = getPlayerList(range + 10, range + 10, range + 10);
|
||||
recentlyChecked.retainAll(listMax);
|
||||
recentlyChecked.addAll(toCheck);
|
||||
|
||||
if(toCheck.isEmpty())
|
||||
return;
|
||||
for(EntityPlayer player : toCheck){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
if(toCheck.isEmpty())
|
||||
return;
|
||||
for(EntityPlayer player : toCheck){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
Party party = playerData.getPlayerParty();
|
||||
Quest partyQuest = null;
|
||||
if(party != null && party.getQuestData() != null && party.getQuestData().quest != null && party.getQuestData().quest.type == EnumQuestType.Location){
|
||||
@@ -58,41 +58,44 @@ public class TileWaypoint extends TileEntity {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||
for(QuestData data : activeQuestValues){
|
||||
if(data.quest.type != EnumQuestType.Location)
|
||||
continue;
|
||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||
for(QuestData data : activeQuestValues){
|
||||
if(data.quest.type != EnumQuestType.Location)
|
||||
continue;
|
||||
|
||||
if(partyQuest != null && partyQuest.id == data.quest.getId())
|
||||
continue;
|
||||
|
||||
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
||||
if(quest.setFound(data, name)){
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.quest.partyOptions.allowParty && data.quest.partyOptions.onlyParty)
|
||||
continue;
|
||||
|
||||
private List<EntityPlayer> getPlayerList(int x, int y, int z){
|
||||
return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z));
|
||||
}
|
||||
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
||||
if(quest.setFound(data, name)){
|
||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
name = compound.getString("LocationName");
|
||||
range = compound.getInteger("LocationRange");
|
||||
if(range < 2)
|
||||
range = 2;
|
||||
}
|
||||
private List<EntityPlayer> getPlayerList(int x, int y, int z){
|
||||
return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
if(!name.isEmpty())
|
||||
compound.setString("LocationName", name);
|
||||
compound.setInteger("LocationRange", range);
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
name = compound.getString("LocationName");
|
||||
range = compound.getInteger("LocationRange");
|
||||
if(range < 2)
|
||||
range = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
if(!name.isEmpty())
|
||||
compound.setString("LocationName", name);
|
||||
compound.setInteger("LocationRange", range);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user