Browse Source

- Starting preparatives for Auctions System.
- Added the @auction command to open the auctions. Just to start working on it and if someone wants to help.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12270 54d463be-8e91-2dee-dedb-b68131a5f0ec

zephyrus 17 years ago
parent
commit
48ba5004a6
7 changed files with 92 additions and 0 deletions
  1. 3 0
      conf/atcommand_athena.conf
  2. 32 0
      src/char_sql/int_auction.c
  3. 8 0
      src/char_sql/int_auction.h
  4. 16 0
      src/common/mmo.h
  5. 12 0
      src/map/atcommand.c
  6. 18 0
      src/map/clif.c
  7. 3 0
      src/map/clif.h

+ 3 - 0
conf/atcommand_athena.conf

@@ -104,6 +104,9 @@ storage: 1
 // Opens your mailbox.
 // Opens your mailbox.
 mail: 1
 mail: 1
 
 
+// Opens auctions window.
+auctions: 1
+
 // Locate someone on a map, returns your coordinates if the person isn't on.
 // Locate someone on a map, returns your coordinates if the person isn't on.
 where: 1
 where: 1
 
 

+ 32 - 0
src/char_sql/int_auction.c

@@ -0,0 +1,32 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#include "../common/mmo.h"
+#include "../common/malloc.h"
+#include "../common/db.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/strlib.h"
+#include "../common/sql.h"
+#include "char.h"
+#include "inter.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static DBMap* auction_db = NULL; // int auction_id -> struct auction*
+
+int inter_auction_sql_init(void)
+{
+	auction_db = idb_alloc(DB_OPT_RELEASE_DATA);
+	
+	return 0;
+}
+
+void inter_auction_sql_final(void)
+{
+	auction_db->destroy(auction_db,NULL);
+
+	return;
+}

+ 8 - 0
src/char_sql/int_auction.h

@@ -0,0 +1,8 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _INT_AUCTION_SQL_H_
+#define _INT_AUCTION_SQL_H_
+
+
+#endif /* _INT_AUCTION_SQL_H_ */

+ 16 - 0
src/common/mmo.h

@@ -272,6 +272,22 @@ struct mail_data {
 	struct mail_message msg[MAIL_MAX_INBOX];
 	struct mail_message msg[MAIL_MAX_INBOX];
 };
 };
 
 
+struct auction_data {
+	unsigned int auction_id;
+	int seller_id;
+	char seller_name[NAME_LENGTH];
+	int buyer_id;
+	char buyer_name[NAME_LENGTH];
+	
+	struct item item;
+
+	unsigned short hours;
+	unsigned int price, buynow;
+	unsigned int timestamp;
+
+	bool changed; // To know if data have been changed for save
+};
+
 struct registry {
 struct registry {
 	int global_num;
 	int global_num;
 	struct global_reg global[GLOBAL_REG_NUM];
 	struct global_reg global[GLOBAL_REG_NUM];

+ 12 - 0
src/map/atcommand.c

@@ -8169,6 +8169,17 @@ int atcommand_feelreset(const int fd, struct map_session_data* sd, const char* c
 	return 0;
 	return 0;
 }
 }
 
 
+/*==========================================
+ * AUCTION SYSTEM
+ *------------------------------------------*/
+int atcommand_auction(const int fd, struct map_session_data *sd, const char *command, const char *message)
+{
+	nullpo_retr(0,sd);
+
+	clif_Auction_openwindow(sd);
+	return 0;
+}
+
 /*==========================================
 /*==========================================
  * Kill Steal Protection
  * Kill Steal Protection
  *------------------------------------------*/
  *------------------------------------------*/
@@ -8509,6 +8520,7 @@ AtCommandInfo atcommand_info[] = {
 	{ "homshuffle",        60,     atcommand_homshuffle },
 	{ "homshuffle",        60,     atcommand_homshuffle },
 	{ "showmobs",          10,     atcommand_showmobs },
 	{ "showmobs",          10,     atcommand_showmobs },
 	{ "feelreset",         10,     atcommand_feelreset },
 	{ "feelreset",         10,     atcommand_feelreset },
+	{ "auction",           60,     atcommand_auction },
 	{ "mail",               1,     atcommand_mail },
 	{ "mail",               1,     atcommand_mail },
 	{ "noks",               0,     atcommand_ksprotection },
 	{ "noks",               0,     atcommand_ksprotection },
 	{ "allowks",            6,     atcommand_allowks },
 	{ "allowks",            6,     atcommand_allowks },

+ 18 - 0
src/map/clif.c

@@ -11752,6 +11752,24 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd)
 	WFIFOSET(fd,12);
 	WFIFOSET(fd,12);
 }
 }
 
 
+/*==========================================
+ * AUCTIONS SYSTEM
+ *==========================================*/
+void clif_Auction_openwindow(struct map_session_data *sd)
+{
+	int fd = sd->fd;
+
+	WFIFOHEAD(fd,12);
+	WFIFOW(fd,0) = 0x25f;
+	WFIFOL(fd,2) = 0;
+	WFIFOB(fd,6) = 0xb6;
+	WFIFOB(fd,7) = 0x00;
+	WFIFOB(fd,8) = 0xa6;
+	WFIFOB(fd,9) = 0xde;
+	WFIFOW(fd,10) = 0;
+	WFIFOSET(fd,12);
+}
+
 /*==========================================
 /*==========================================
  * Requesting equip of a player
  * Requesting equip of a player
  *------------------------------------------*/
  *------------------------------------------*/

+ 3 - 0
src/map/clif.h

@@ -413,4 +413,7 @@ void clif_Mail_getattachment(int fd, uint8 flag);
 
 
 void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd);
 void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd);
 
 
+// AUCTION SYSTEM
+void clif_Auction_openwindow(struct map_session_data *sd);
+
 #endif /* _CLIF_H_ */
 #endif /* _CLIF_H_ */