diff options
-rw-r--r-- | sql-files/upgrade_svn12559.sql | 48 | ||||
-rw-r--r-- | src/map/quest.c | 284 | ||||
-rw-r--r-- | src/map/quest.h | 30 |
3 files changed, 181 insertions, 181 deletions
diff --git a/sql-files/upgrade_svn12559.sql b/sql-files/upgrade_svn12559.sql index 66f36a468..302493e1b 100644 --- a/sql-files/upgrade_svn12559.sql +++ b/sql-files/upgrade_svn12559.sql @@ -1,24 +1,24 @@ ---
--- Table structure for table `quest`
---
-
-DROP TABLE IF EXISTS `quest`;
-CREATE TABLE `quest` (
- `char_id` int(11) unsigned NOT NULL default '0',
- `quest_id` int(10) unsigned NOT NULL,
- `state` enum('1','0') NOT NULL default '0',
- PRIMARY KEY USING BTREE (`char_id`,`quest_id`)
-) ENGINE=MyISAM;
-
---
--- Table structure for table `quest_mob`
---
-
-DROP TABLE IF EXISTS `quest_objective`;
-CREATE TABLE `quest_objective` (
- `quest_id` int(11) unsigned NOT NULL,
- `count` mediumint(8) unsigned NOT NULL default '0',
- `name` varchar(255) NOT NULL default '',
- `num` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY USING BTREE (`quest_id`,`num`)
-) ENGINE=MyISAM;
+-- +-- Table structure for table `quest` +-- + +DROP TABLE IF EXISTS `quest`; +CREATE TABLE `quest` ( + `char_id` int(11) unsigned NOT NULL default '0', + `quest_id` int(10) unsigned NOT NULL, + `state` enum('1','0') NOT NULL default '0', + PRIMARY KEY USING BTREE (`char_id`,`quest_id`) +) ENGINE=MyISAM; + +-- +-- Table structure for table `quest_mob` +-- + +DROP TABLE IF EXISTS `quest_objective`; +CREATE TABLE `quest_objective` ( + `quest_id` int(11) unsigned NOT NULL, + `count` mediumint(8) unsigned NOT NULL default '0', + `name` varchar(255) NOT NULL default '', + `num` tinyint(3) unsigned NOT NULL, + PRIMARY KEY USING BTREE (`quest_id`,`num`) +) ENGINE=MyISAM; diff --git a/src/map/quest.c b/src/map/quest.c index 9ce8a0251..997ff2abd 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -1,142 +1,142 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include "../common/cbasetypes.h"
-#include "../common/socket.h"
-#include "../common/timer.h"
-#include "../common/malloc.h"
-#include "../common/version.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
-
-#include "map.h"
-#include "chrif.h"
-#include "pc.h"
-#include "npc.h"
-#include "itemdb.h"
-#include "script.h"
-#include "intif.h"
-#include "battle.h"
-#include "mob.h"
-#include "party.h"
-#include "unit.h"
-#include "log.h"
-#include "clif.h"
-#include "quest.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-//Send quest info on login
-int quest_pc_login(TBL_PC * sd)
-{
-
- if(sd->num_quests == 0)
- return 1;
-
- clif_send_questlog(sd);
- clif_send_questlog_info(sd);
- return 0;
-}
-
-int quest_add(TBL_PC * sd, struct quest * qd)
-{
-
- int i;
-
- //Search to see if this quest exists
- ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == qd->quest_id);
-
- //Already have this quest
- if(i!=MAX_QUEST)
- return 1;
-
- //Find empty quest log spot
- ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == 0);
-
- //Quest log is full
- if(i == MAX_QUEST)
- return -1;
-
- //Copy over quest data
- memcpy(&sd->quest_log[i], qd, sizeof(struct quest));
- sd->num_quests++;
-
- //Notify client
- clif_send_quest_info(sd, &sd->quest_log[i]);
-
- return 0;
-
-}
-
-int quest_delete(TBL_PC * sd, int quest_id)
-{
-
- int i;
-
- //Search for quest
- ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id);
-
- //Quest not found
- if(i != MAX_QUEST)
- return -1;
-
- //Zero quest
- memset(&sd->quest_log[i], 0, sizeof(struct quest));
-
- //Notify client
- clif_send_quest_delete(sd, quest_id);
-
- return 0;
-
-}
-
-int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const char * name, int count)
-{
-
- int i;
-
- //Search for quest
- ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id);
-
- //Quest not found
- if(i != MAX_QUEST)
- return -1;
-
- memcpy(&sd->quest_log[i].objectives[objective_num].name, name, NAME_LENGTH);
- sd->quest_log[i].objectives[objective_num].count = count;
-
- //Notify client
- clif_send_quest_info(sd, &sd->quest_log[i]);
-
- return 0;
-
-}
-
-int quest_update_status(TBL_PC * sd, int quest_id, bool status)
-{
-
- return 0;
-}
-
-int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st)
-{
- sd->num_quests = st->num_quests;
- memcpy(sd->quest_log, st->quest_log, sizeof(st->quest_log));
-
- return 0;
-}
-
-int quest_make_savedata(TBL_PC * sd)
-{
- sd->status.num_quests = sd->num_quests;
- memcpy(sd->status.quest_log, sd->quest_log, sizeof(sd->quest_log));
-
- return 0;
-}
-
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL +// For more information, see LICENCE in the main folder + +#include "../common/cbasetypes.h" +#include "../common/socket.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/version.h" +#include "../common/nullpo.h" +#include "../common/showmsg.h" +#include "../common/strlib.h" +#include "../common/utils.h" + +#include "map.h" +#include "chrif.h" +#include "pc.h" +#include "npc.h" +#include "itemdb.h" +#include "script.h" +#include "intif.h" +#include "battle.h" +#include "mob.h" +#include "party.h" +#include "unit.h" +#include "log.h" +#include "clif.h" +#include "quest.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <time.h> + +//Send quest info on login +int quest_pc_login(TBL_PC * sd) +{ + + if(sd->num_quests == 0) + return 1; + + clif_send_questlog(sd); + clif_send_questlog_info(sd); + return 0; +} + +int quest_add(TBL_PC * sd, struct quest * qd) +{ + + int i; + + //Search to see if this quest exists + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == qd->quest_id); + + //Already have this quest + if(i!=MAX_QUEST) + return 1; + + //Find empty quest log spot + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == 0); + + //Quest log is full + if(i == MAX_QUEST) + return -1; + + //Copy over quest data + memcpy(&sd->quest_log[i], qd, sizeof(struct quest)); + sd->num_quests++; + + //Notify client + clif_send_quest_info(sd, &sd->quest_log[i]); + + return 0; + +} + +int quest_delete(TBL_PC * sd, int quest_id) +{ + + int i; + + //Search for quest + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id); + + //Quest not found + if(i != MAX_QUEST) + return -1; + + //Zero quest + memset(&sd->quest_log[i], 0, sizeof(struct quest)); + + //Notify client + clif_send_quest_delete(sd, quest_id); + + return 0; + +} + +int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const char * name, int count) +{ + + int i; + + //Search for quest + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id); + + //Quest not found + if(i != MAX_QUEST) + return -1; + + memcpy(&sd->quest_log[i].objectives[objective_num].name, name, NAME_LENGTH); + sd->quest_log[i].objectives[objective_num].count = count; + + //Notify client + clif_send_quest_info(sd, &sd->quest_log[i]); + + return 0; + +} + +int quest_update_status(TBL_PC * sd, int quest_id, bool status) +{ + + return 0; +} + +int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st) +{ + sd->num_quests = st->num_quests; + memcpy(sd->quest_log, st->quest_log, sizeof(st->quest_log)); + + return 0; +} + +int quest_make_savedata(TBL_PC * sd) +{ + sd->status.num_quests = sd->num_quests; + memcpy(sd->status.quest_log, sd->quest_log, sizeof(sd->quest_log)); + + return 0; +} + diff --git a/src/map/quest.h b/src/map/quest.h index 37ac357da..deda985ca 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -1,15 +1,15 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#ifndef _QUEST_H_
-#define _QUEST_H_
-
-int quest_pc_login(TBL_PC * sd);
-int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st);
-int quest_make_savedata(TBL_PC * sd);
-int quest_add(TBL_PC * sd, struct quest * qd);
-int quest_delete(TBL_PC * sd, int quest_id);
-int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const char * name, int count);
-int quest_update_status(TBL_PC * sd, int quest_id, bool status);
-
-#endif
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL +// For more information, see LICENCE in the main folder + +#ifndef _QUEST_H_ +#define _QUEST_H_ + +int quest_pc_login(TBL_PC * sd); +int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st); +int quest_make_savedata(TBL_PC * sd); +int quest_add(TBL_PC * sd, struct quest * qd); +int quest_delete(TBL_PC * sd, int quest_id); +int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const char * name, int count); +int quest_update_status(TBL_PC * sd, int quest_id, bool status); + +#endif |