Skip to content

Commit

Permalink
Fix some Issues
Browse files Browse the repository at this point in the history
Mossy Cobble in the market
Museum 20% culture Buff
Research Lab Buff
Broadcast Tower Buff
Town Info Command Decimal Formatting (And the culture Rate)
  • Loading branch information
ataranlen committed Mar 14, 2016
1 parent 41688c9 commit 160c89b
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 51 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/object/Town.class
Binary file not shown.
Binary file modified civcraft/bin/com/avrgaming/civcraft/structure/BroadcastTower.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.
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
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
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);
}
}

}
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
16 changes: 15 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

0 comments on commit 160c89b

Please sign in to comment.