Planeshift
pawsmerchantwindow.h
Go to the documentation of this file.
1
/*
2
* pawsmerchantwindow.cpp - Anders Reggestad <andersr@pvv.org>
3
* - PAWS version Andrew Craig <acraig@paqrat.com>
4
*
5
* Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
6
*
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation (version 2 of the License)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
*
19
*/
20
#ifndef PAWS_MERCHANT_WINDOW
21
#define PAWS_MERCHANT_WINDOW
22
23
#include <csutil/csstring.h>
24
25
#include "
net/cmdbase.h
"
26
#include "
paws/pawswidget.h
"
27
#include "
paws/pawslistbox.h
"
28
#include "
paws/pawsnumberpromptwindow.h
"
29
30
class
pawsListBox
;
31
34
class
pawsMerchantWindow
:
public
pawsWidget
,
public
psClientNetSubscriber
,
public
iOnNumberEnteredAction
35
{
36
public
:
37
pawsMerchantWindow
();
38
virtual
~pawsMerchantWindow
();
39
bool
PostSetup
();
40
41
void
HandleMessage
(
MsgEntry
* me );
42
void
OnListAction
(
pawsListBox
* listbox,
int
status );
43
44
bool
OnButtonPressed
(
int
mouseButton,
int
keyModifier,
pawsWidget
* widget );
45
void
Close
();
46
47
void
DoTrade
(
int
count,
const
char
* itemName,
const
char
* itemID);
48
49
void
OnNumberEntered
(
const
char
*
name
,
int
param,
int
value);
50
51
protected
:
52
// Handle messages from the server.
53
void
HandleMerchant
(
const
char
* data );
54
void
HandleCategories
(
const
char
* data );
55
void
HandleItems
(
const
char
* data );
56
void
HandleMoney
(
const
char
* data );
57
void
UpdateMoney
(
const
char
* moneyName,
const
char
* imageName,
int
value );
58
59
void
SetTradeMode
(
bool
buy );
60
69
void
TradeSelectedItem
(
bool
all =
false
,
bool
single =
false
);
70
71
int
merchantID
;
72
int
tradeCommand
;
73
int
selectedItem
;
74
75
pawsListBox
*
categoryBox
;
76
pawsListBox
*
itemsBox
;
77
pawsTextBox
*
trias
;
78
79
csString
currentItem
,
currentID
;
80
};
81
82
83
//--------------------------------------------------------------------------
84
CREATE_PAWS_FACTORY
(
pawsMerchantWindow
);
85
86
87
#endif
pawsMerchantWindow::HandleCategories
void HandleCategories(const char *data)
pawsMerchantWindow::itemsBox
pawsListBox * itemsBox
Definition:
pawsmerchantwindow.h:76
pawsMerchantWindow::UpdateMoney
void UpdateMoney(const char *moneyName, const char *imageName, int value)
pawsMerchantWindow::merchantID
int merchantID
Definition:
pawsmerchantwindow.h:71
pawsMerchantWindow
The window that deals with interacting with a NPC merchant.
Definition:
pawsmerchantwindow.h:34
pawsMerchantWindow::TradeSelectedItem
void TradeSelectedItem(bool all=false, bool single=false)
Handles the command of trading the item by interacting with the player.
pawsWidget
The main base widget that all other widgets should inherit from.
Definition:
pawswidget.h:116
pawsnumberpromptwindow.h
pawslistbox.h
pawsMerchantWindow::PostSetup
bool PostSetup()
This is called after the widget and all of it's children have been created.
pawsMerchantWindow::currentItem
csString currentItem
Definition:
pawsmerchantwindow.h:79
pawsMerchantWindow::SetTradeMode
void SetTradeMode(bool buy)
pawsWidget::name
csString name
The name of this widget.
Definition:
pawswidget.h:217
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
CREATE_PAWS_FACTORY
CREATE_PAWS_FACTORY(pawsMerchantWindow)
pawsMerchantWindow::categoryBox
pawsListBox * categoryBox
index of item, selected in the itemsBox
Definition:
pawsmerchantwindow.h:75
pawsMerchantWindow::tradeCommand
int tradeCommand
Definition:
pawsmerchantwindow.h:72
pawsMerchantWindow::HandleMoney
void HandleMoney(const char *data)
cmdbase.h
pawsMerchantWindow::selectedItem
int selectedItem
Definition:
pawsmerchantwindow.h:73
pawsListBox
A simple list box widget.
Definition:
pawslistbox.h:202
pawsMerchantWindow::pawsMerchantWindow
pawsMerchantWindow()
pawsMerchantWindow::DoTrade
void DoTrade(int count, const char *itemName, const char *itemID)
pawswidget.h
pawsMerchantWindow::OnListAction
void OnListAction(pawsListBox *listbox, int status)
Called whenever an item in a child list box is selected.
pawsMerchantWindow::trias
pawsTextBox * trias
Definition:
pawsmerchantwindow.h:77
pawsMerchantWindow::Close
void Close()
Simply calls Hide() unless overidden.
iOnNumberEnteredAction
Definition:
pawsnumberpromptwindow.h:35
pawsMerchantWindow::OnNumberEntered
void OnNumberEntered(const char *name, int param, int value)
pawsMerchantWindow::~pawsMerchantWindow
virtual ~pawsMerchantWindow()
pawsMerchantWindow::currentID
csString currentID
Definition:
pawsmerchantwindow.h:79
pawsMerchantWindow::HandleMerchant
void HandleMerchant(const char *data)
pawsMerchantWindow::HandleMessage
void HandleMessage(MsgEntry *me)
pawsMerchantWindow::OnButtonPressed
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
psClientNetSubscriber
Definition:
cmdbase.h:67
pawsTextBox
A basic text box widget.
Definition:
pawstextbox.h:42
pawsMerchantWindow::HandleItems
void HandleItems(const char *data)
client
gui
pawsmerchantwindow.h
Generated on Sat Jun 19 2021 05:00:22 for Planeshift by
1.8.11