-
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.
Added Factions, refactored to use it. Readbility styling Working on #12
- Loading branch information
Showing
6 changed files
with
506 additions
and
19 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
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,52 @@ | ||
import React, { Component } from 'react'; | ||
//import rewardsCont from '../rewardsobj'; | ||
import Rewards from './Rewards'; | ||
const bestFriends = [1273, 1275, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1975, 1358]; //IDs for NPCs that have "Friend" levels rather than reputations | ||
const friendLevels = ["Stranger","Acquantaince", "Buddy", "Friend", "Good Friend", "Best Friend"]; | ||
const repTitles = ["Hated", "Hostile", "Unfriendly", "Neutral", "Friendly", "Honored", "Revered", "Exalted"]; // Reputation levels | ||
//Rep 1204 should be in cata not mists | ||
|
||
|
||
class Faction extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
isHidden: true | ||
} | ||
this.repLevel = this.repLevel.bind(this); | ||
this.showHidden = this.showHidden.bind(this); | ||
} | ||
|
||
repLevel(rep) { | ||
if(bestFriends.includes(rep.id)) { | ||
return friendLevels[rep.standing]; | ||
} else { | ||
return repTitles[rep.standing]; | ||
} | ||
} | ||
|
||
showHidden(e) { | ||
this.setState((prevState => ({ | ||
isHidden: !prevState.isHidden | ||
}))) | ||
} | ||
|
||
render() { | ||
let rep = this.props.rep; | ||
let isHidden = this.state.isHidden; | ||
return ( | ||
<div key={rep.name} className="rep"> | ||
<div onClick={this.showHidden} className="repName"> | ||
<h3>{rep.name}</h3> | ||
<p>{this.repLevel(rep)}</p> | ||
<i className={`fas fa-caret-${isHidden ? "down" : "up"}`}></i> | ||
</div> | ||
<div className={`rewards ${isHidden ? "hidden" : ""}`}> | ||
<Rewards rep={rep.id} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Faction; |
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
Oops, something went wrong.