diff options
author | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 17:37:28 +0000 |
---|---|---|
committer | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 17:37:28 +0000 |
commit | bbaf3dff1287cba348b047998a632fc000114c3d (patch) | |
tree | 6e360d0d0f034b51b5974bf9c00455f142cf9b3e /src | |
parent | 022d432c3cbe83d41731c36ce8c735cea5ece4da (diff) | |
download | mana-bbaf3dff1287cba348b047998a632fc000114c3d.tar.gz mana-bbaf3dff1287cba348b047998a632fc000114c3d.tar.bz2 mana-bbaf3dff1287cba348b047998a632fc000114c3d.tar.xz mana-bbaf3dff1287cba348b047998a632fc000114c3d.zip |
Choose amunt in buy (npc shop).
Diffstat (limited to 'src')
-rw-r--r-- | src/graphic/graphic.cpp | 16 | ||||
-rw-r--r-- | src/gui/shop.cpp | 10 | ||||
-rw-r--r-- | src/gui/shop.h | 2 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 98882f22..7390d283 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -74,11 +74,13 @@ DIALOG buy_sell_dialog[] = { DIALOG buy_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ - { tmw_dialog_proc, 300, 200, 260, 150, 0, 0, 0, 0, 0, 0, (char *)"Buy", NULL, NULL }, - { tmw_button_proc, 450, 326, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL }, - { tmw_button_proc, 508, 326, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL }, + { tmw_dialog_proc, 300, 200, 260, 175, 0, 0, 0, 0, 0, 0, (char *)"Buy", NULL, NULL }, + { tmw_button_proc, 450, 326+25, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL }, + { tmw_button_proc, 508, 326+25, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL }, { tmw_list_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, (char *)shop_list, NULL, NULL }, - { tmw_text_proc, 304, 326, 180, 100, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, + { tmw_text_proc, 304, 326+25, 180, 100, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, + { tmw_slider_proc, 304, 326, 200, 20, 255, 0, 0, 0, 10, 0, NULL, (void *)changeQ, NULL }, + { tmw_text_proc, 514, 326, 40, 100, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; @@ -296,13 +298,15 @@ void do_graphic(void) { char money[20]; sprintf(money, "%i gp", char_info->zeny); buy_dialog[4].dp = &money; + buy_dialog[5].d1 = (int)(char_info->zeny/get_item_price(buy_dialog[6].d1)); dialog_message(buy_dialog, MSG_DRAW, 0, 0); if(!gui_update(buy_player)) { show_npc_dialog = shutdown_dialog(buy_player); + buy_dialog[5].d1 = 0; if(show_npc_dialog==1) { WFIFOW(0) = net_w_value(0x00c8); WFIFOW(2) = net_w_value(8); - WFIFOW(4) = net_w_value(1); + WFIFOW(4) = net_w_value(buy_dialog[5].d2); WFIFOW(6) = net_w_value(get_item_id(buy_dialog[3].d1)); WFIFOSET(8); } @@ -320,7 +324,7 @@ void do_graphic(void) { dialog_message(sell_dialog, MSG_DRAW, 0, 0); if(!gui_update(sell_player)) { show_npc_dialog = shutdown_dialog(sell_player); - + sell_dialog[3].d1 = 0; if(show_npc_dialog==1) { WFIFOW(0) = net_w_value(0x00c9); WFIFOW(2) = net_w_value(8); diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 487465b6..7104c586 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -129,7 +129,15 @@ int get_item_index(int index) { } return item_shop->index; } - +int get_item_price(int index) { + int iterator = 0; + ITEM_SHOP *item_shop = shop; + while(iterator<index) { + item_shop = item_shop->next; + iterator++; + } + return item_shop->price; +} void changeQ(void *dp3, int d2) { sprintf(itemCurrenyQ,"%i",d2); diff --git a/src/gui/shop.h b/src/gui/shop.h index 8c3869d0..fd4667e9 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -54,4 +54,6 @@ void close_shop(); short get_item_id(int index); int get_item_quantity(int index); int get_item_index(int index); +int get_item_price(int index); + #endif |