-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'John-B' of https://github.uconn.edu/gal11002/MerchantRP…
…GProject into John-B Conflicts: MerchantRPGCSE2102/src/model/Map.java
- Loading branch information
Showing
22 changed files
with
893 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
MerchantRPGCSE2102/src/exceptions/NotInInventoryException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package exceptions; | ||
|
||
@SuppressWarnings("serial") | ||
public class NotInInventoryException extends Exception | ||
{ | ||
public NotInInventoryException() | ||
{ | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package model; | ||
|
||
public class Character { | ||
private int _x, _y; | ||
protected Item[] _inventory; | ||
protected String _name; | ||
|
||
|
||
/** | ||
* Searches through the player's inventory for the item corresponding to the specified item name | ||
* | ||
* @param itemName string containing the name of the item | ||
* @return the item matching the specified item name | ||
*/ | ||
public Item getItem(String itemName) | ||
{ | ||
for(int i = 0; i < _inventory.length; i++) | ||
{ | ||
if(_inventory[i].getItemName().equals(itemName)) | ||
return _inventory[i]; | ||
} | ||
|
||
System.out.println("No such item exists"); // item was not found by searching the inventory | ||
return null; | ||
} | ||
|
||
/** | ||
* Returns the merchant's item inventory | ||
* @return item inventory array | ||
*/ | ||
public Item[] getInventory() | ||
{ | ||
return _inventory; | ||
} | ||
|
||
/** | ||
* Returns a string containing the name of the merchant | ||
* | ||
* @return merchant name string | ||
*/ | ||
public String getName() | ||
{ | ||
return _name; | ||
} | ||
|
||
public int getX() { | ||
return _x; | ||
} | ||
|
||
public void setX(int x) { | ||
_x = x; | ||
} | ||
|
||
public int getY() { | ||
return _y; | ||
} | ||
|
||
public void setY(int y) { | ||
_y = y; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.