Some preliminary code for the questlog system (clif packet functions and basic data structures).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12544 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
5b63319859
commit
6391d7b687
@ -3,6 +3,8 @@ Date Added
|
||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2008/04/09
|
||||
* Clif functions and basic data structures for questlog system. (r12544) [Kevin]
|
||||
2008/04/08
|
||||
* Fixed party invitation ack messages not displaying (bugreport:1308)
|
||||
* Modified PACKETVER for recent clients to use a YYYYMMDD date format
|
||||
|
@ -50,6 +50,8 @@
|
||||
#define MAX_GUILDCASTLE 34 // Updated to include new entries for WoE:SE. [L0ne_W0lf]
|
||||
#define MAX_GUILDLEVEL 50
|
||||
#define MAX_GUARDIANS 46 //Local max per castle. [Skotlex]
|
||||
#define MAX_QUEST 25 //Max quests for a PC
|
||||
#define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest
|
||||
|
||||
#define MIN_HAIR_STYLE battle_config.min_hair_style
|
||||
#define MAX_HAIR_STYLE battle_config.max_hair_style
|
||||
@ -123,6 +125,27 @@ enum item_types {
|
||||
IT_MAX
|
||||
};
|
||||
|
||||
|
||||
//Questlog system [Kevin]
|
||||
typedef enum quest_state { Q_NONE, Q_ACTIVE, Q_INACTIVE } quest_state;
|
||||
|
||||
struct quest_objective {
|
||||
|
||||
char * name;
|
||||
int count;
|
||||
|
||||
};
|
||||
|
||||
struct quest {
|
||||
|
||||
int quest_id;
|
||||
quest_state state;
|
||||
int num_objectives;
|
||||
int time;
|
||||
struct quest_objective objectives[MAX_QUEST_OBJECTIVES];
|
||||
|
||||
};
|
||||
|
||||
struct item {
|
||||
int id;
|
||||
short nameid;
|
||||
@ -248,6 +271,7 @@ struct mmo_charstatus {
|
||||
struct point last_point,save_point,memo_point[MAX_MEMOPOINTS];
|
||||
struct item inventory[MAX_INVENTORY],cart[MAX_CART];
|
||||
struct skill skill[MAX_SKILL];
|
||||
struct quest quest_log[MAX_QUEST];
|
||||
|
||||
struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex]
|
||||
#ifdef HOTKEY_SAVING
|
||||
|
125
src/map/clif.c
125
src/map/clif.c
@ -7968,6 +7968,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
|
||||
mail_clear(sd);
|
||||
#endif
|
||||
|
||||
//Send quest log [Kevin]
|
||||
clif_send_questlog(sd);
|
||||
|
||||
if(map[sd->bl.m].flag.loadevent) // Lance
|
||||
npc_script_event(sd, NPCE_LOADMAP);
|
||||
|
||||
@ -12132,6 +12135,128 @@ void clif_parse_EquipTick(int fd, struct map_session_data* sd)
|
||||
clif_equiptickack(sd, flag);
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Questlog System [Kevin]
|
||||
* 02B5 <packet_len>.W <ignored>.L { }.10B* <-- UNKOWN PACKET
|
||||
* 02B7 <quest_id>.L <state>.B
|
||||
*------------------------------------------*/
|
||||
|
||||
void clif_parse_questStateAck(int fd, struct map_session_data * sd)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Send simple list of quests upon login
|
||||
//* 02B1 <packet_len>.W <ignored>.L { <quest_id>.L <state>.B }.5B*
|
||||
void clif_send_questlog(struct map_session_data * sd)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
int i;
|
||||
|
||||
WFIFOHEAD(fd,sd->num_quests*5+8);
|
||||
WFIFOW(fd, 0) = 0x02B1;
|
||||
WFIFOW(fd, 2) = sd->num_quests*5+8;
|
||||
|
||||
for(i=0; i<MAX_QUEST; i++)
|
||||
{
|
||||
if(!sd->quest_log[i].quest_id)
|
||||
continue;
|
||||
|
||||
|
||||
WFIFOL(fd, i*5+8) = sd->quest_log[i].quest_id;
|
||||
WFIFOB(fd, i*5+12) = sd->quest_log[i].state;
|
||||
|
||||
}
|
||||
|
||||
WFIFOSET(fd, WFIFOW(fd, 2));
|
||||
|
||||
}
|
||||
|
||||
//Send objective info on login
|
||||
//* 02B2 <packet_len>.W <ignored>.L { <quest_id>.L <ignored>.L <time>.L <num mobs>.W {<ignored>.L <mob count>.W <Mob Name>.24B}.30B[3] }.104B*
|
||||
void clif_send_questlog_info(struct map_session_data * sd)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
int i, j;
|
||||
|
||||
WFIFOHEAD(fd,sd->num_quests*104+8);
|
||||
WFIFOW(fd, 0) = 0x02B2;
|
||||
WFIFOW(fd, 2) = sd->num_quests*104+8;
|
||||
|
||||
for(i=0; i<MAX_QUEST; i++)
|
||||
{
|
||||
if(!sd->quest_log[i].quest_id)
|
||||
continue;
|
||||
|
||||
WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id;
|
||||
|
||||
// I have no idea what the time field does [Kevin]
|
||||
WFIFOL(fd, i*104+16) = 0;
|
||||
WFIFOW(fd, i*104+20) = sd->quest_log[i].num_objectives;
|
||||
|
||||
for(j=0; j<sd->quest_log[i].num_objectives; j++)
|
||||
{
|
||||
WFIFOW(fd, i*104+26+j*30) = sd->quest_log[i].objectives[j].count;
|
||||
memcpy(WFIFOP(fd, i*104+28+j*30), sd->quest_log[i].objectives[j].name, NAME_LENGTH);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WFIFOSET(fd, WFIFOW(fd, 2));
|
||||
}
|
||||
|
||||
//Send info when objective info needs an update
|
||||
//* 02B3 <quest_id>.L <state>.B <ignored>.L <time>.L <num mobs>.W {<ignored>.L <mob count>.W <Mob Name>.24B}.30B[3]
|
||||
void clif_send_quest_info(struct map_session_data * sd, struct quest * qd)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
int i;
|
||||
|
||||
WFIFOHEAD(fd,qd->num_objectives*30+17);
|
||||
WFIFOW(fd, 0) = 0x02B3;
|
||||
WFIFOL(fd, 2) = qd->quest_id;
|
||||
WFIFOB(fd, 6) = qd->state;
|
||||
|
||||
//Same time value thing
|
||||
WFIFOW(fd, 11) = 0;
|
||||
WFIFOW(fd, 15) = qd->num_objectives;
|
||||
|
||||
for(i=0; i<qd->num_objectives; i++)
|
||||
{
|
||||
WFIFOW(fd, i*30+21) = qd->objectives[i].count;
|
||||
memcpy(WFIFOP(fd, i*30+23), qd->objectives[i].name, NAME_LENGTH);
|
||||
}
|
||||
|
||||
WFIFOSET(fd, qd->num_objectives*30+17);
|
||||
}
|
||||
|
||||
//Send delete msg
|
||||
//* 02B4 <quest_id>.L
|
||||
void clif_send_quest_delete(struct map_session_data * sd, int quest_id)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
|
||||
WFIFOHEAD(fd, 6);
|
||||
WFIFOW(fd, 0) = 0x02B4;
|
||||
WFIFOL(fd, 2) = quest_id;
|
||||
WFIFOSET(fd, 6);
|
||||
|
||||
}
|
||||
|
||||
//Change active state of the quest
|
||||
//* 02B6 <quest_id>.L <state_to>.B
|
||||
void clif_send_quest_status(struct map_session_data * sd, int quest_id, bool active)
|
||||
{
|
||||
int fd = sd->fd;
|
||||
|
||||
WFIFOHEAD(fd, 7);
|
||||
WFIFOW(fd, 0) = 0x02B4;
|
||||
WFIFOL(fd, 2) = quest_id;
|
||||
WFIFOB(fd, 6) = active?1:0;
|
||||
WFIFOSET(fd, 7);
|
||||
}
|
||||
|
||||
|
||||
/*==========================================
|
||||
* パケットデバッグ
|
||||
*------------------------------------------*/
|
||||
|
@ -394,6 +394,9 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
|
||||
void clif_viewequip_fail(struct map_session_data* sd);
|
||||
void clif_equipcheckbox(struct map_session_data* sd);
|
||||
|
||||
//quest system [Kevin]
|
||||
void clif_send_questlog(struct map_session_data * sd);
|
||||
|
||||
int clif_foreachclient(int (*)(struct map_session_data*,va_list),...);
|
||||
int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type);
|
||||
int do_final_clif(void);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "status.h" // OPTION_*, struct weapon_atk
|
||||
#include "unit.h" // unit_stop_attack(), unit_stop_walking()
|
||||
#include "vending.h" // struct s_vending
|
||||
#include "mob.h"
|
||||
|
||||
#define MAX_PC_BONUS 10
|
||||
|
||||
@ -349,6 +350,10 @@ struct map_session_data {
|
||||
struct mail_data inbox;
|
||||
} mail;
|
||||
|
||||
//Quest log system [Kevin]
|
||||
int num_quests;
|
||||
struct quest quest_log[MAX_QUEST];
|
||||
|
||||
// temporary debug [flaviojs]
|
||||
const char* debug_file;
|
||||
int debug_line;
|
||||
|
Loading…
x
Reference in New Issue
Block a user