Skip to content

Commit 776c7fd

Browse files
committed
change inventory items for fish and bow and arrow
1 parent a220009 commit 776c7fd

23 files changed

Lines changed: 197 additions & 197 deletions

assets/sprites/assets.png

6.12 KB
Loading

src/main/java/wagemaker/uk/freeworld/FreeWorldManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public static void grantFreeWorldItems(Inventory inventory) {
5252
inventory.setWoodStackCount(250);
5353
inventory.setPebbleCount(250);
5454
inventory.setPalmFiberCount(250);
55-
inventory.setLeftFenceCount(250);
55+
inventory.setFishCount(250);
5656
inventory.setFrontFenceCount(250);
5757
inventory.setBackFenceCount(250);
58-
inventory.setRightFenceCount(250);
58+
inventory.setBowAndArrowCount(250);
5959

6060
System.out.println("Granted 250 of each item type");
6161
}

src/main/java/wagemaker/uk/gdx/GameMessageHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,10 @@ protected void handleInventorySync(InventorySyncMessage message) {
413413
message.getWoodStackCount(),
414414
message.getPebbleCount(),
415415
message.getPalmFiberCount(),
416-
message.getLeftFenceCount(),
416+
message.getFishCount(),
417417
message.getFrontFenceCount(),
418418
message.getBackFenceCount(),
419-
message.getRightFenceCount()
419+
message.getBowAndArrowCount()
420420
);
421421
}
422422
}

src/main/java/wagemaker/uk/inventory/Inventory.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public class Inventory {
1616
private int woodStackCount;
1717
private int pebbleCount;
1818
private int palmFiberCount;
19-
private int leftFenceCount;
19+
private int fishCount;
2020
private int frontFenceCount;
2121
private int backFenceCount;
22-
private int rightFenceCount;
22+
private int bowAndArrowCount;
2323

2424
public Inventory() {
2525
this.appleCount = 0;
@@ -32,10 +32,10 @@ public Inventory() {
3232
this.woodStackCount = 0;
3333
this.pebbleCount = 0;
3434
this.palmFiberCount = 0;
35-
this.leftFenceCount = 0;
35+
this.fishCount = 0;
3636
this.frontFenceCount = 0;
3737
this.backFenceCount = 0;
38-
this.rightFenceCount = 0;
38+
this.bowAndArrowCount = 0;
3939
}
4040

4141
// Apple methods
@@ -248,22 +248,22 @@ public boolean removePalmFiber(int amount) {
248248
return false;
249249
}
250250

251-
// LeftFence methods
252-
public int getLeftFenceCount() {
253-
return leftFenceCount;
251+
// Fish methods
252+
public int getFishCount() {
253+
return fishCount;
254254
}
255255

256-
public void setLeftFenceCount(int count) {
257-
this.leftFenceCount = Math.max(0, count);
256+
public void setFishCount(int count) {
257+
this.fishCount = Math.max(0, count);
258258
}
259259

260-
public void addLeftFence(int amount) {
261-
this.leftFenceCount += amount;
260+
public void addFish(int amount) {
261+
this.fishCount += amount;
262262
}
263263

264-
public boolean removeLeftFence(int amount) {
265-
if (leftFenceCount >= amount) {
266-
leftFenceCount -= amount;
264+
public boolean removeFish(int amount) {
265+
if (fishCount >= amount) {
266+
fishCount -= amount;
267267
return true;
268268
}
269269
return false;
@@ -311,22 +311,22 @@ public boolean removeBackFence(int amount) {
311311
return false;
312312
}
313313

314-
// RightFence methods
315-
public int getRightFenceCount() {
316-
return rightFenceCount;
314+
// BowAndArrow methods
315+
public int getBowAndArrowCount() {
316+
return bowAndArrowCount;
317317
}
318318

319-
public void setRightFenceCount(int count) {
320-
this.rightFenceCount = Math.max(0, count);
319+
public void setBowAndArrowCount(int count) {
320+
this.bowAndArrowCount = Math.max(0, count);
321321
}
322322

323-
public void addRightFence(int amount) {
324-
this.rightFenceCount += amount;
323+
public void addBowAndArrow(int amount) {
324+
this.bowAndArrowCount += amount;
325325
}
326326

327-
public boolean removeRightFence(int amount) {
328-
if (rightFenceCount >= amount) {
329-
rightFenceCount -= amount;
327+
public boolean removeBowAndArrow(int amount) {
328+
if (bowAndArrowCount >= amount) {
329+
bowAndArrowCount -= amount;
330330
return true;
331331
}
332332
return false;
@@ -346,9 +346,9 @@ public void clear() {
346346
this.woodStackCount = 0;
347347
this.pebbleCount = 0;
348348
this.palmFiberCount = 0;
349-
this.leftFenceCount = 0;
349+
this.fishCount = 0;
350350
this.frontFenceCount = 0;
351351
this.backFenceCount = 0;
352-
this.rightFenceCount = 0;
352+
this.bowAndArrowCount = 0;
353353
}
354354
}

src/main/java/wagemaker/uk/inventory/InventoryManager.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ private void addItemToInventory(ItemType type, int amount) {
129129
case PALM_FIBER:
130130
inventory.addPalmFiber(amount);
131131
break;
132-
case LEFT_FENCE:
133-
inventory.addLeftFence(amount);
132+
case FISH:
133+
inventory.addFish(amount);
134134
break;
135135
case FRONT_FENCE:
136136
inventory.addFrontFence(amount);
137137
break;
138138
case BACK_FENCE:
139139
inventory.addBackFence(amount);
140140
break;
141-
case RIGHT_FENCE:
142-
inventory.addRightFence(amount);
141+
case BOW_AND_ARROW:
142+
inventory.addBowAndArrow(amount);
143143
break;
144144
}
145145

@@ -168,10 +168,10 @@ private void sendInventoryUpdate() {
168168
inventory.getWoodStackCount(),
169169
inventory.getPebbleCount(),
170170
inventory.getPalmFiberCount(),
171-
inventory.getLeftFenceCount(),
171+
inventory.getFishCount(),
172172
inventory.getFrontFenceCount(),
173173
inventory.getBackFenceCount(),
174-
inventory.getRightFenceCount()
174+
inventory.getBowAndArrowCount()
175175
);
176176

177177
gameClient.sendMessage(message);
@@ -201,14 +201,14 @@ public void sendInventoryUpdateToServer() {
201201
* @param woodStackCount The wood stack count from server
202202
* @param pebbleCount The pebble count from server
203203
* @param palmFiberCount The palm fiber count from server
204-
* @param leftFenceCount The left fence count from server
204+
* @param fishCount The fish count from server
205205
* @param frontFenceCount The front fence count from server
206206
* @param backFenceCount The back fence count from server
207-
* @param rightFenceCount The right fence count from server
207+
* @param bowAndArrowCount The bow and arrow count from server
208208
*/
209209
public void syncFromServer(int appleCount, int bananaCount, int appleSaplingCount, int bananaSaplingCount,
210210
int bambooSaplingCount, int bambooStackCount, int treeSaplingCount, int woodStackCount,
211-
int pebbleCount, int palmFiberCount, int leftFenceCount, int frontFenceCount, int backFenceCount, int rightFenceCount) {
211+
int pebbleCount, int palmFiberCount, int fishCount, int frontFenceCount, int backFenceCount, int bowAndArrowCount) {
212212
if (!isMultiplayerMode) {
213213
return; // Only sync in multiplayer mode
214214
}
@@ -224,10 +224,10 @@ public void syncFromServer(int appleCount, int bananaCount, int appleSaplingCoun
224224
inventory.setWoodStackCount(woodStackCount);
225225
inventory.setPebbleCount(pebbleCount);
226226
inventory.setPalmFiberCount(palmFiberCount);
227-
inventory.setLeftFenceCount(leftFenceCount);
227+
inventory.setFishCount(fishCount);
228228
inventory.setFrontFenceCount(frontFenceCount);
229229
inventory.setBackFenceCount(backFenceCount);
230-
inventory.setRightFenceCount(rightFenceCount);
230+
inventory.setBowAndArrowCount(bowAndArrowCount);
231231

232232
System.out.println("Inventory synced from server: Apples=" + appleCount +
233233
", Bananas=" + bananaCount +
@@ -239,10 +239,10 @@ public void syncFromServer(int appleCount, int bananaCount, int appleSaplingCoun
239239
", WoodStack=" + woodStackCount +
240240
", Pebbles=" + pebbleCount +
241241
", PalmFibers=" + palmFiberCount +
242-
", LeftFence=" + leftFenceCount +
242+
", Fish=" + fishCount +
243243
", FrontFence=" + frontFenceCount +
244244
", BackFence=" + backFenceCount +
245-
", RightFence=" + rightFenceCount);
245+
", BowAndArrow=" + bowAndArrowCount);
246246
}
247247

248248
/**
@@ -294,10 +294,10 @@ public ItemType getSelectedItemType() {
294294
case 7: return ItemType.PALM_FIBER;
295295
case 8: return ItemType.APPLE_SAPLING;
296296
case 9: return ItemType.BANANA_SAPLING;
297-
case 10: return ItemType.LEFT_FENCE;
297+
case 10: return ItemType.FISH;
298298
case 11: return ItemType.FRONT_FENCE;
299299
case 12: return ItemType.BACK_FENCE;
300-
case 13: return ItemType.RIGHT_FENCE;
300+
case 13: return ItemType.BOW_AND_ARROW;
301301
default: return null;
302302
}
303303
}
@@ -382,10 +382,10 @@ public void checkAndAutoDeselect() {
382382
case 7: itemCount = inventory.getPalmFiberCount(); break;
383383
case 8: itemCount = inventory.getAppleSaplingCount(); break;
384384
case 9: itemCount = inventory.getBananaSaplingCount(); break;
385-
case 10: itemCount = inventory.getLeftFenceCount(); break;
385+
case 10: itemCount = inventory.getFishCount(); break;
386386
case 11: itemCount = inventory.getFrontFenceCount(); break;
387387
case 12: itemCount = inventory.getBackFenceCount(); break;
388-
case 13: itemCount = inventory.getRightFenceCount(); break;
388+
case 13: itemCount = inventory.getBowAndArrowCount(); break;
389389
}
390390

391391
if (itemCount == 0) {

src/main/java/wagemaker/uk/inventory/ItemType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public enum ItemType {
99
APPLE_SAPLING(false, 0, false),
1010
BANANA(false, 0, true), // Reduces 5% hunger
1111
BANANA_SAPLING(false, 0, false),
12-
LEFT_FENCE(false, 0, false),
12+
FISH(false, 0, false),
1313
FRONT_FENCE(false, 0, false),
1414
BACK_FENCE(false, 0, false),
15-
RIGHT_FENCE(false, 0, false),
15+
BOW_AND_ARROW(false, 0, false),
1616
BABY_BAMBOO(false, 0, false),
1717
BAMBOO_STACK(false, 0, false),
1818
WOOD_STACK(false, 0, false),

src/main/java/wagemaker/uk/items/RightFence.java renamed to src/main/java/wagemaker/uk/items/BowAndArrow.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import com.badlogic.gdx.graphics.Pixmap;
44
import com.badlogic.gdx.graphics.Texture;
55

6-
public class RightFence {
6+
public class BowAndArrow {
77
private float x, y;
88
private Texture texture;
99

10-
public RightFence(float x, float y) {
10+
public BowAndArrow(float x, float y) {
1111
this.x = x;
1212
this.y = y;
1313
createTexture();
@@ -19,7 +19,7 @@ private void createTexture() {
1919
spriteSheet.getTextureData().prepare();
2020
Pixmap sheetPixmap = spriteSheet.getTextureData().consumePixmap();
2121

22-
// RightFence coordinates: 298 from left, 192 from top, 128x32 size
22+
// BowAndArrow coordinates: 298 from left, 192 from top, 22x128 size
2323
pixmap.drawPixmap(sheetPixmap, 0, 0, 298,192, 22,128);
2424

2525
texture = new Texture(pixmap);

src/main/java/wagemaker/uk/items/LeftFence.java renamed to src/main/java/wagemaker/uk/items/Fish.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import com.badlogic.gdx.graphics.Pixmap;
44
import com.badlogic.gdx.graphics.Texture;
55

6-
public class LeftFence {
6+
public class Fish {
77
private float x, y;
88
private Texture texture;
99

10-
public LeftFence(float x, float y) {
10+
public Fish(float x, float y) {
1111
this.x = x;
1212
this.y = y;
1313
createTexture();
@@ -19,7 +19,7 @@ private void createTexture() {
1919
spriteSheet.getTextureData().prepare();
2020
Pixmap sheetPixmap = spriteSheet.getTextureData().consumePixmap();
2121

22-
// LeftFence coordinates: 256 from left, 192 from top, 128x32 size
22+
// Fish coordinates: 256 from left, 256 from top, 32x64 size
2323
pixmap.drawPixmap(sheetPixmap, 0, 0, 256,256, 32,64);
2424

2525
texture = new Texture(pixmap);

src/main/java/wagemaker/uk/network/ClientConnection.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,8 @@ private void handleItemPickup(ItemPickupMessage message) {
931931
case PALM_FIBER:
932932
playerState.setPalmFiberCount(playerState.getPalmFiberCount() + 1);
933933
break;
934-
case LEFT_FENCE:
935-
playerState.setLeftFenceCount(playerState.getLeftFenceCount() + 1);
934+
case FISH:
935+
playerState.setFishCount(playerState.getFishCount() + 1);
936936
break;
937937
case FRONT_FENCE:
938938
playerState.setFrontFenceCount(playerState.getFrontFenceCount() + 1);
@@ -958,10 +958,10 @@ private void handleItemPickup(ItemPickupMessage message) {
958958
playerState.getWoodStackCount(),
959959
playerState.getPebbleCount(),
960960
playerState.getPalmFiberCount(),
961-
playerState.getLeftFenceCount(),
961+
playerState.getFishCount(),
962962
playerState.getFrontFenceCount(),
963963
playerState.getBackFenceCount(),
964-
playerState.getRightFenceCount()
964+
playerState.getBowAndArrowCount()
965965
);
966966
server.broadcastToAll(inventoryMsg);
967967

@@ -1126,10 +1126,10 @@ private void handleItemConsumption(ItemConsumptionMessage message) {
11261126
playerState.getWoodStackCount(),
11271127
playerState.getPebbleCount(),
11281128
playerState.getPalmFiberCount(),
1129-
playerState.getLeftFenceCount(),
1129+
playerState.getFishCount(),
11301130
playerState.getFrontFenceCount(),
11311131
playerState.getBackFenceCount(),
1132-
playerState.getRightFenceCount()
1132+
playerState.getBowAndArrowCount()
11331133
);
11341134
server.broadcastToAll(inventoryMsg);
11351135
}
@@ -1548,7 +1548,7 @@ private void handleInventoryUpdate(InventoryUpdateMessage message) {
15481548
!isValidInventoryCount(message.getWoodStackCount()) ||
15491549
!isValidInventoryCount(message.getPebbleCount()) ||
15501550
!isValidInventoryCount(message.getPalmFiberCount()) ||
1551-
!isValidInventoryCount(message.getLeftFenceCount()) ||
1551+
!isValidInventoryCount(message.getFishCount()) ||
15521552
!isValidInventoryCount(message.getFrontFenceCount())) {
15531553
System.err.println("Invalid inventory counts from " + clientId);
15541554
logSecurityViolation("Invalid inventory counts");
@@ -1566,7 +1566,7 @@ private void handleInventoryUpdate(InventoryUpdateMessage message) {
15661566
playerState.setWoodStackCount(message.getWoodStackCount());
15671567
playerState.setPebbleCount(message.getPebbleCount());
15681568
playerState.setPalmFiberCount(message.getPalmFiberCount());
1569-
playerState.setLeftFenceCount(message.getLeftFenceCount());
1569+
playerState.setFishCount(message.getFishCount());
15701570
playerState.setFrontFenceCount(message.getFrontFenceCount());
15711571

15721572
// Update in world state
@@ -1583,7 +1583,7 @@ private void handleInventoryUpdate(InventoryUpdateMessage message) {
15831583
", WoodStack=" + message.getWoodStackCount() +
15841584
", Pebbles=" + message.getPebbleCount() +
15851585
", PalmFiber=" + message.getPalmFiberCount() +
1586-
", LeftFence=" + message.getLeftFenceCount() +
1586+
", Fish=" + message.getFishCount() +
15871587
", FrontFence=" + message.getFrontFenceCount());
15881588
}
15891589

@@ -1614,10 +1614,10 @@ private void sendInventorySync() {
16141614
playerState.getWoodStackCount(),
16151615
playerState.getPebbleCount(),
16161616
playerState.getPalmFiberCount(),
1617-
playerState.getLeftFenceCount(),
1617+
playerState.getFishCount(),
16181618
playerState.getFrontFenceCount(),
16191619
playerState.getBackFenceCount(),
1620-
playerState.getRightFenceCount()
1620+
playerState.getBowAndArrowCount()
16211621
);
16221622
sendMessage(syncMsg);
16231623
}

0 commit comments

Comments
 (0)