RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.tradingpost.TradingPostListing Class Reference

Public Member Functions

void addQuantity (Player player, int amount)
void addToAmountSold (int amountSold)
void checkAndUpdate (Player player)
int getAmountLeft ()
int getAmountSold ()
int getInitialQuantity ()
int getItemId ()
int getPrice ()
String getSeller ()
void removeQuantity (Player player, int amount)
void setAmountSold (int amountSold)
void setInitialQuantity (int initialQuantity)
void setPrice (int price)
void setPrice (Player player, int price)
void setQuantity (Player player, int quantity)
 TradingPostListing (int itemId, String seller)

Private Attributes

int amountSold = 0
int initialQuantity = 1
final int itemId
int price
final String seller

Detailed Description

Definition at line 6 of file TradingPostListing.java.

Constructor & Destructor Documentation

◆ TradingPostListing()

com.runehive.content.tradingpost.TradingPostListing.TradingPostListing ( int itemId,
String seller )

Definition at line 13 of file TradingPostListing.java.

13 {
14 this.itemId = itemId;
15 this.seller = seller;
16 }

References itemId, and seller.

Member Function Documentation

◆ addQuantity()

void com.runehive.content.tradingpost.TradingPostListing.addQuantity ( Player player,
int amount )

Definition at line 60 of file TradingPostListing.java.

60 {
61 initialQuantity += amount;
62 checkAndUpdate(player);
63 }

References checkAndUpdate(), and initialQuantity.

Here is the call graph for this function:

◆ addToAmountSold()

void com.runehive.content.tradingpost.TradingPostListing.addToAmountSold ( int amountSold)

Definition at line 82 of file TradingPostListing.java.

82 {
83 this.amountSold += amountSold;
84 }

References amountSold.

◆ checkAndUpdate()

void com.runehive.content.tradingpost.TradingPostListing.checkAndUpdate ( Player player)

Definition at line 65 of file TradingPostListing.java.

65 {
66 int playerAmount = player.inventory.computeAmountForId(itemId);
67 if (initialQuantity > playerAmount) {
68 initialQuantity = playerAmount;
69 }
70 player.tradingPost.updateQuantityString();
71 player.tradingPost.updatePriceStrings();
72 }

References com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), initialQuantity, com.runehive.game.world.entity.mob.player.Player.inventory, itemId, com.runehive.game.world.entity.mob.player.Player.tradingPost, com.runehive.content.tradingpost.TradingPost.updatePriceStrings(), and com.runehive.content.tradingpost.TradingPost.updateQuantityString().

Referenced by addQuantity(), and setQuantity().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAmountLeft()

int com.runehive.content.tradingpost.TradingPostListing.getAmountLeft ( )

Definition at line 74 of file TradingPostListing.java.

74 {
75 return initialQuantity - amountSold;
76 }

References amountSold, and initialQuantity.

Referenced by com.runehive.content.tradingpost.TradingPost.handleDismissListingButton(), com.runehive.content.tradingpost.TradingPost.sort(), and com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets().

Here is the caller graph for this function:

◆ getAmountSold()

int com.runehive.content.tradingpost.TradingPostListing.getAmountSold ( )

Definition at line 78 of file TradingPostListing.java.

78 {
79 return amountSold;
80 }

References amountSold.

Referenced by com.runehive.content.tradingpost.TradingPost.updateExistingListingsWidgets().

Here is the caller graph for this function:

◆ getInitialQuantity()

int com.runehive.content.tradingpost.TradingPostListing.getInitialQuantity ( )

Definition at line 22 of file TradingPostListing.java.

22 {
23 return initialQuantity;
24 }

References initialQuantity.

Referenced by com.runehive.content.tradingpost.TradingPost.updateExistingListingsWidgets().

Here is the caller graph for this function:

◆ getItemId()

int com.runehive.content.tradingpost.TradingPostListing.getItemId ( )

Definition at line 18 of file TradingPostListing.java.

18 {
19 return itemId;
20 }

References itemId.

Referenced by com.runehive.content.tradingpost.TradingPost.handleDismissListingButton(), and com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets().

Here is the caller graph for this function:

◆ getPrice()

int com.runehive.content.tradingpost.TradingPostListing.getPrice ( )

Definition at line 34 of file TradingPostListing.java.

34 {
35 return price;
36 }

References price.

Referenced by com.runehive.content.tradingpost.TradingPost.sort(), and com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets().

Here is the caller graph for this function:

◆ getSeller()

String com.runehive.content.tradingpost.TradingPostListing.getSeller ( )

Definition at line 47 of file TradingPostListing.java.

47 {
48 return seller;
49 }

References seller.

Referenced by com.runehive.content.tradingpost.TradingPost.updateBuyingPageWidgets().

Here is the caller graph for this function:

◆ removeQuantity()

void com.runehive.content.tradingpost.TradingPostListing.removeQuantity ( Player player,
int amount )

Definition at line 51 of file TradingPostListing.java.

51 {
52 initialQuantity -= amount;
53 if (initialQuantity <= 0) {
54 initialQuantity = 1;
55 }
56 player.tradingPost.updateQuantityString();
57 player.tradingPost.updatePriceStrings();
58 }

References initialQuantity, com.runehive.game.world.entity.mob.player.Player.tradingPost, com.runehive.content.tradingpost.TradingPost.updatePriceStrings(), and com.runehive.content.tradingpost.TradingPost.updateQuantityString().

Here is the call graph for this function:

◆ setAmountSold()

void com.runehive.content.tradingpost.TradingPostListing.setAmountSold ( int amountSold)

Definition at line 86 of file TradingPostListing.java.

86 {
87 this.amountSold = amountSold;
88 }

References amountSold.

◆ setInitialQuantity()

void com.runehive.content.tradingpost.TradingPostListing.setInitialQuantity ( int initialQuantity)

Definition at line 94 of file TradingPostListing.java.

94 {
95 this.initialQuantity = initialQuantity;
96 }

References initialQuantity.

Referenced by com.runehive.content.tradingpost.TradingPost.testData().

Here is the caller graph for this function:

◆ setPrice() [1/2]

void com.runehive.content.tradingpost.TradingPostListing.setPrice ( int price)

Definition at line 90 of file TradingPostListing.java.

90 {
91 this.price = price;
92 }

References price.

◆ setPrice() [2/2]

void com.runehive.content.tradingpost.TradingPostListing.setPrice ( Player player,
int price )

Definition at line 38 of file TradingPostListing.java.

38 {
39 if ((long) price * initialQuantity > Integer.MAX_VALUE) {
40 player.send(new SendMessage("Unable to set this price to this quantity. reason: above max integer value."));
41 return;
42 }
43 this.price = price;
44 player.tradingPost.updatePriceStrings();
45 }

References initialQuantity, price, com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.game.world.entity.mob.player.Player.tradingPost, and com.runehive.content.tradingpost.TradingPost.updatePriceStrings().

Referenced by com.runehive.content.tradingpost.TradingPost.testData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuantity()

void com.runehive.content.tradingpost.TradingPostListing.setQuantity ( Player player,
int quantity )

Definition at line 26 of file TradingPostListing.java.

26 {
27 this.initialQuantity = quantity;
28 if (this.initialQuantity == 0) {
29 this.initialQuantity = 1;
30 }
31 checkAndUpdate(player);
32 }

References checkAndUpdate().

Here is the call graph for this function:

Member Data Documentation

◆ amountSold

int com.runehive.content.tradingpost.TradingPostListing.amountSold = 0
private

◆ initialQuantity

int com.runehive.content.tradingpost.TradingPostListing.initialQuantity = 1
private

◆ itemId

final int com.runehive.content.tradingpost.TradingPostListing.itemId
private

Definition at line 7 of file TradingPostListing.java.

Referenced by checkAndUpdate(), getItemId(), and TradingPostListing().

◆ price

int com.runehive.content.tradingpost.TradingPostListing.price
private

Definition at line 10 of file TradingPostListing.java.

Referenced by getPrice(), setPrice(), and setPrice().

◆ seller

final String com.runehive.content.tradingpost.TradingPostListing.seller
private

Definition at line 8 of file TradingPostListing.java.

Referenced by getSeller(), and TradingPostListing().


The documentation for this class was generated from the following file: