Skip to content

Commit

Permalink
Merge pull request #44 from ataranlen/1.76-dev
Browse files Browse the repository at this point in the history
1.76 dev merge for 1.76.4
  • Loading branch information
ataranlen committed Mar 15, 2016
2 parents 935f7d1 + 160c89b commit 01e1ebf
Show file tree
Hide file tree
Showing 27 changed files with 104 additions and 58 deletions.
2 changes: 1 addition & 1 deletion civcraft/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<classpathentry kind="lib" path="D:/civcraftsvn/trunk/lib/craftbukkit-1.8.7.jar"/>
<classpathentry kind="lib" path="D:/civcraftsvn/trunk/lib/spigot-1.8.7.jar"/>
<classpathentry kind="lib" path="D:/civcraftsvn/trunk/lib/TitleAPI.jar"/>
<classpathentry kind="lib" path="D:/civcraftsvn/trunk/lib/iTag-1.1.4-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="D:/civcraftsvn/trunk/lib/iTag-1.1.5-SNAPSHOT.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/main/CivGlobal.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/object/Town.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/Farm.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/Mine.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/Museum.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/ResearchLab.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/Structure.class
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion civcraft/bin/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CivCraft
main: com.avrgaming.civcraft.main.CivCraft
softdepends: [TitleAPI]
version: 1.76.3
version: 1.76.4

commands:
town:
Expand Down
2 changes: 1 addition & 1 deletion civcraft/data/market.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ items:
- id: 31
name: 'Mossy Brick'
type_id: 98
data: 0
data: 1
value: 1

- id: 32
Expand Down
6 changes: 4 additions & 2 deletions civcraft/data/structures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ structures:
type: 'direct'
attribute: 'UNHAPPINESS'
value: '-2.0'
- name: 'AttributeStatic'
type: 'direct'
attribute: 'HAPPINESS'
value: '2.0'

Expand Down Expand Up @@ -877,7 +879,7 @@ structures:
value: '0.01'

- id: s_research_lab
template: school
template: research_lab
template_y_shift: 0
displayName: Research Lab
require_upgrade:
Expand Down Expand Up @@ -940,7 +942,7 @@ structures:
- name: 'AttributeStatic'
type: 'direct'
attribute: 'UNHAPPINESS'
value: '-3.0'
value: '3.0'
- name: 'AttributeStatic'
type: 'direct'
attribute: 'GROWTH'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,16 @@ public void rates_cmd() throws CivException {
Town town = getSelectedTown();

CivMessage.sendHeading(sender, town.getName()+" "+CivSettings.localize.localizedString("cmd_town_info_ratesHeading"));

DecimalFormat df = new DecimalFormat("#,###.#");

CivMessage.send(sender,
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoGrowth")+" "+CivColor.LightGreen+(town.getGrowthRate().total*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCulture")+" "+CivColor.LightGreen+(town.getCulture().total*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCottage")+" "+CivColor.LightGreen+(town.getCottageRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("Temple")+" "+CivColor.LightGreen+(town.getTempleRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoTrade")+" "+CivColor.LightGreen+(town.getTradeRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoBeaker")+" "+CivColor.LightGreen+(town.getBeakerRate().total*100)
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoGrowth")+" "+CivColor.LightGreen+df.format(town.getGrowthRate().total*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCulture")+" "+CivColor.LightGreen+df.format(town.getCultureRate().total*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoCottage")+" "+CivColor.LightGreen+df.format(town.getCottageRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("Temple")+" "+CivColor.LightGreen+df.format(town.getTempleRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoTrade")+" "+CivColor.LightGreen+df.format(town.getTradeRate()*100)+
CivColor.Green+" "+CivSettings.localize.localizedString("cmd_civ_gov_infoBeaker")+" "+CivColor.LightGreen+df.format(town.getBeakerRate().total*100)
);

}
Expand Down
11 changes: 10 additions & 1 deletion civcraft/src/com/avrgaming/civcraft/main/CivGlobal.java
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,12 @@ public static Date getNextHourlyTickDate() {
}

public static void removeFarmChunk(ChunkCoord coord) {
farmChunks.remove(coord);
FarmChunk fc = getFarmChunk(coord);
if (fc != null) {
CivGlobal.dequeueFarmChunk(fc);
farmGrowQueue.remove(fc);
}
farmChunks.remove(coord);
}

public static void addProtectedItemFrame(ItemFrameStorage framestore) {
Expand Down Expand Up @@ -2035,6 +2040,10 @@ public static Collection<Structure> getStructures() {
return structures.values();
}

public static void dequeueFarmChunk(FarmChunk fc) {
farmChunkUpdateQueue.remove(fc);
}

public static void queueFarmChunk(FarmChunk fc) {
farmChunkUpdateQueue.add(fc);
}
Expand Down
12 changes: 9 additions & 3 deletions civcraft/src/com/avrgaming/civcraft/object/Town.java
Original file line number Diff line number Diff line change
Expand Up @@ -611,10 +611,16 @@ public AttrSource getCultureRate() {
rates.put("Happiness", newRate - rate);
rate = newRate;

double additional = this.getBuffManager().getEffectiveDouble(Buff.FINE_ART);

double structures = 0;
if (this.getBuffManager().hasBuff("buff_art_appreciation")) {
additional += this.getBuffManager().getEffectiveDouble("buff_art_appreciation");
structures += this.getBuffManager().getEffectiveDouble("buff_art_appreciation");
}
rates.put("Great Works", structures);
rate += structures;

double additional = 0;
if (this.getBuffManager().hasBuff("buff_fine_art")) {
additional += this.getBuffManager().getEffectiveDouble(Buff.FINE_ART);
}
if (this.getBuffManager().hasBuff("buff_pyramid_culture")) {
additional += this.getBuffManager().getEffectiveDouble("buff_pyramid_culture");
Expand Down
14 changes: 0 additions & 14 deletions civcraft/src/com/avrgaming/civcraft/structure/BroadcastTower.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.bukkit.Location;

import com.avrgaming.civcraft.exception.CivException;
import com.avrgaming.civcraft.object.Civilization;
import com.avrgaming.civcraft.object.Town;

public class BroadcastTower extends Structure {
Expand Down Expand Up @@ -66,20 +65,7 @@ protected void addBuffToTown(Town town, String id) {
}
}

protected void addBuffToCiv(Civilization civ, String id) {
for (Town t : civ.getTowns()) {
addBuffToTown(t, id);
}
}

protected void removeBuffFromTown(Town town, String id) {
town.getBuffManager().removeBuff(id);
}

protected void removeBuffFromCiv(Civilization civ, String id) {
for (Town t : civ.getTowns()) {
removeBuffFromTown(t, id);
}
}

}
8 changes: 8 additions & 0 deletions civcraft/src/com/avrgaming/civcraft/structure/Farm.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public Farm(ResultSet rs) throws SQLException, CivException {
build_farm(this.getCorner().getLocation());
}

public void removeFarmChunk() throws SQLException {
if (this.getCorner() != null) {
ChunkCoord coord = new ChunkCoord(this.getCorner().getLocation());
CivGlobal.removeFarmChunk(coord);
CivGlobal.getSessionDB().delete_all(getSessionKey());
}
}

@Override
public void delete() throws SQLException {
if (this.getCorner() != null) {
Expand Down
6 changes: 5 additions & 1 deletion civcraft/src/com/avrgaming/civcraft/structure/Mine.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ public int getLevel() {

public double getHammersPerTile() {
AttributeBiomeRadiusPerLevel attrBiome = (AttributeBiomeRadiusPerLevel)this.getComponent("AttributeBiomeRadiusPerLevel");
double base = attrBiome.getBaseValue();
double base = 1.0;

if (attrBiome != null) {
base = attrBiome.getBaseValue();
}

double rate = 1;
rate += this.getTown().getBuffManager().getEffectiveDouble(Buff.ADVANCED_TOOLING);
Expand Down
27 changes: 7 additions & 20 deletions civcraft/src/com/avrgaming/civcraft/structure/Museum.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,28 @@
import org.bukkit.Location;

import com.avrgaming.civcraft.exception.CivException;
import com.avrgaming.civcraft.object.Civilization;
import com.avrgaming.civcraft.object.Town;

public class Museum extends Structure {

protected Museum(Location center, String id, Town town)
throws CivException {
protected Museum(Location center, String id, Town town) throws CivException {
super(center, id, town);
}

public Museum(ResultSet rs) throws SQLException, CivException {
super(rs);
}

@Override
public String getDynmapDescription() {
return null;
}

@Override
public String getMarkerIconName() {
return "flower";
}

@Override
public void loadSettings() {
super.loadSettings();
}

@Override
public void onLoad() {
if (this.isActive()) {
Expand Down Expand Up @@ -64,19 +63,7 @@ protected void addBuffToTown(Town town, String id) {
}
}

protected void addBuffToCiv(Civilization civ, String id) {
for (Town t : civ.getTowns()) {
addBuffToTown(t, id);
}
}

protected void removeBuffFromTown(Town town, String id) {
town.getBuffManager().removeBuff(id);
}

protected void removeBuffFromCiv(Civilization civ, String id) {
for (Town t : civ.getTowns()) {
removeBuffFromTown(t, id);
}
}
}
24 changes: 20 additions & 4 deletions civcraft/src/com/avrgaming/civcraft/structure/ResearchLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.avrgaming.civcraft.object.Town;

public class ResearchLab extends Structure {


protected ResearchLab(Location center, String id, Town town) throws CivException {
super(center, id, town);
Expand All @@ -19,16 +18,33 @@ protected ResearchLab(Location center, String id, Town town) throws CivException
public ResearchLab(ResultSet rs) throws SQLException, CivException {
super(rs);
}

@Override
public String getMarkerIconName() {
return "warning";
}

@Override
public void loadSettings() {
super.loadSettings();

}

@Override
public String getMarkerIconName() {
return "warning";
public void onLoad() {
if (this.isActive()) {
addBuffs();
}
}

@Override
public void onComplete() {
addBuffs();
}

@Override
public void onDestroy() {
super.onDestroy();
removeBuffs();
}

protected void removeBuffs() {
Expand Down
22 changes: 21 additions & 1 deletion civcraft/src/com/avrgaming/civcraft/structure/Structure.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@ private static Structure _newStructure(Location center, String id, Town town, Re
struct = (Structure) new Grocer(rs);
}
break;


case "s_broadcast_tower":
if (rs == null) {
struct = (BroadcastTower) new BroadcastTower(center, id, town);
} else {
struct = (BroadcastTower) new BroadcastTower(rs);
}
break;
case "s_library":
if (rs == null) {
struct = (Structure) new Library(center, id, town);
Expand Down Expand Up @@ -364,6 +371,13 @@ private static Structure _newStructure(Location center, String id, Town town, Re
struct = (Structure) new Windmill(rs);
}
break;
case "s_museum":
if (rs == null) {
struct = (Museum) new Museum(center, id, town);
} else {
struct = (Museum) new Museum(rs);
}
break;
case "s_market":
if (rs == null) {
struct = (Market) new Market(center, id, town);
Expand Down Expand Up @@ -553,6 +567,7 @@ public void deleteSkipUndo() throws SQLException {

if (!(this instanceof Wall || this instanceof FortifiedWall || this instanceof Road))
{
CivLog.debug("Delete with Undo! "+this.getDisplayName());
/* Remove StructureSigns */
for (StructureSign sign : this.getSigns()) {
sign.delete();
Expand All @@ -566,7 +581,12 @@ public void deleteSkipUndo() throws SQLException {
CivGlobal.removeStructure(this);
this.getTown().removeStructure(this);
this.unbindStructureBlocks();
if (this instanceof Farm) {
Farm farm = (Farm)this;
farm.removeFarmChunk();
}
} else {
CivLog.debug("Delete skip Undo! "+this.getDisplayName());
CivGlobal.removeStructure(this);
this.getTown().removeStructure(this);
this.unbindStructureBlocks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ private void showPlotMoveMessage() {
if (civilization == toCc.getCiv()) {
subTitle += CivSettings.localize.localizedString("var_civ_border_welcomeBack", player.getName());
} else {
subTitle += CivSettings.localize.localizedString("var_civ_border_relation",civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString());
String relationship = civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString();
if (relationship != null && relationship.length() >= 1) {
subTitle = CivSettings.localize.localizedString("var_civ_border_relation",relationship);
}
} }
onCultureEnter(toCc);
} else if (fromCc != null && toCc !=null && fromCc.getCiv() != toCc.getCiv()) {
Expand All @@ -187,7 +190,10 @@ private void showPlotMoveMessage() {
if (civilization == toCc.getCiv()) {
subTitle += CivSettings.localize.localizedString("var_civ_border_welcomeBack", player.getName());
} else {
subTitle += CivSettings.localize.localizedString("var_civ_border_relation",civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString());
String relationship = civilization.getDiplomacyManager().getRelation(toCc.getCiv()).toString();
if (relationship != null && relationship.length() >= 1) {
subTitle = CivSettings.localize.localizedString("var_civ_border_relation",relationship);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion civcraft/src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CivCraft
main: com.avrgaming.civcraft.main.CivCraft
softdepends: [TitleAPI]
version: 1.76.3
version: 1.76.4

commands:
town:
Expand Down

0 comments on commit 01e1ebf

Please sign in to comment.