Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong displayed name for equipped item #52

Closed
projectdelphai opened this issue Jan 5, 2014 · 8 comments
Closed

Wrong displayed name for equipped item #52

projectdelphai opened this issue Jan 5, 2014 · 8 comments
Labels

Comments

@projectdelphai
Copy link
Member

Difficulty: Easy

Equipped items are displayed as the item ID instead of the item name. You just need to initialize the item, grab the item name, and then display that instead.

@pthayer3
Copy link
Contributor

pthayer3 commented Jan 5, 2014

Can I tackle this one also as I'm new to java and I feel comfortable going after it?

@shkesar
Copy link
Contributor

shkesar commented Jan 5, 2014

Hell yeah!
Just push your changes.

@pthayer3
Copy link
Contributor

pthayer3 commented Jan 6, 2014

I think a solved this, but before I push my changes I am going to try to tweak some other stuff, such as confirmation of performed actions via printing, etc. We also need to add "hands" as an item in the json file, I'll fix that also.

@projectdelphai
Copy link
Member Author

Hands isn't really an item, just a placeholder in the absence of anything else. It should automatically default to hands if there is no item. It shouldn't be an item.

And this may be a pain, but I'm going to have to ask you to update your fork fully. And I mean FULLY. There was a ton of changes with the pull requests and I don't want to have to turn down your pull request because of the recent issues I've been having. It may not be a problem, but just check before making your pull request.

Thanks!

@pthayer3
Copy link
Contributor

pthayer3 commented Jan 6, 2014

The reason why we need to add hands to the items.json file is that I pull the name of the item to display when equipped from the json file. When it gets to hands, it pulls a 'null' because hands doesn't have a name. See below.

public void getStats(){
    Item weapon = new Item(getWeapon());

    System.out.println("Player name: " + getName() +
                        "\nCurrent weapon: " + weapon.getName() +
                        "\nGold: " + player.getGold() +
                        "\nHealth/Max: " + getHealth() + "/" + getHealthMax() +
                        "\nDamage/Armour: " + getDamage() + "/" + getArmour() +
                        "\n" + getName() + "'s level: " + getLevel());
}

We also may want to change the getStats to display the equiped armour while we are at it and therefore the setArmour() method needs to be expanded similar to the setWeapon() method and allow to multiple pieces of armour to be set for different body parts.

I may take a stab at equiping various pieces of armour before I push my changes back.

@projectdelphai
Copy link
Member Author

Can't you also do player.getWeapon()? That should be set to "hands".

@pthayer3
Copy link
Contributor

pthayer3 commented Jan 6, 2014

That would work if the weapon equipped was "hands". When I called player.getWeapon() on the stat line when the player had a shiv equipped it displayed the itemID. I assume the getWeapon() method when called on a weapon that is a class item displays the first value which is the itemID. When "hands" is equipped, it isn't an Item class, it is a string so it just returns hands. I guess that I can put a condition in that if the string is equal to "null", display hands. That would prob get around it without adding "hands" to the json file.

EDIT: I got it working without adding to the json file

@pthayer3
Copy link
Contributor

pthayer3 commented Jan 6, 2014

references #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants