summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-25 21:59:55 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-03-25 21:59:55 +0000
commit7d88aa25325ec2013323a31b606525edc02553ef (patch)
tree49111b5c11e3bf4cf3d464631d7506aa14a3c5b3 /src/map
parentdbf2fd23c69608ead75e968d5ede7e5ebf9fcea9 (diff)
downloadhercules-7d88aa25325ec2013323a31b606525edc02553ef.tar.gz
hercules-7d88aa25325ec2013323a31b606525edc02553ef.tar.bz2
hercules-7d88aa25325ec2013323a31b606525edc02553ef.tar.xz
hercules-7d88aa25325ec2013323a31b606525edc02553ef.zip
Added correct packets for the food item creation window.
Added script command 'cooking' to activate this window and applied it to the 5 cooking kit items. Renamed the cooking quest variable to cooking_q to avoid a naming collision with the new script command. (You need to manually rename all occurences of this variable in your txt-savefile/sql-database if you want to preserve player progress.) The code still relies on the messy skill_produce_mix logic and still uses completely custom equations. To be fixed in a separate commit. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13628 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c61
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/script.c17
3 files changed, 78 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 131d870bc..51ca50264 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4507,6 +4507,47 @@ int clif_skill_produce_mix_list(struct map_session_data *sd, int trigger)
}
/*==========================================
+ *
+ *------------------------------------------*/
+void clif_cooking_list(struct map_session_data *sd, int trigger)
+{
+ int fd;
+ int i, c;
+ int view;
+
+ nullpo_retv(sd);
+ fd = sd->fd;
+
+ WFIFOHEAD(fd, 6 + 2*MAX_SKILL_PRODUCE_DB);
+ WFIFOW(fd,0) = 0x25a;
+ WFIFOW(fd,4) = 1; // list type
+
+ c = 0;
+ for( i = 0; i < MAX_SKILL_PRODUCE_DB; i++ )
+ {
+ if( !skill_can_produce_mix(sd,skill_produce_db[i].nameid,trigger, 1) )
+ continue;
+
+ if( (view = itemdb_viewid(skill_produce_db[i].nameid)) > 0 )
+ WFIFOW(fd, 6+2*c)= view;
+ else
+ WFIFOW(fd, 6+2*c)= skill_produce_db[i].nameid;
+
+ c++;
+ }
+
+ WFIFOW(fd,2) = 6 + 2*c;
+ WFIFOSET(fd,WFIFOW(fd,2));
+
+ //TODO: replace with proper solution
+ if( c > 0 )
+ {
+ sd->menuskill_id = AM_PHARMACY;
+ sd->menuskill_val = trigger;
+ }
+}
+
+/*==========================================
* Sends a status change packet to the object only, used for loading status changes. [Skotlex]
*------------------------------------------*/
int clif_status_load(struct block_list *bl,int type, int flag)
@@ -9698,6 +9739,23 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd)
sd->menuskill_val = sd->menuskill_id = 0;
}
/*==========================================
+ *
+ *------------------------------------------*/
+void clif_parse_Cooking(int fd,struct map_session_data *sd)
+{
+ int type = RFIFOW(fd,2); // '1' for cooking
+ int nameid = RFIFOW(fd,4);
+
+ if (pc_istrading(sd)) {
+ //Make it fail to avoid shop exploits where you sell something different than you see.
+ clif_skill_fail(sd,sd->ud.skillid,0,0);
+ sd->menuskill_val = sd->menuskill_id = 0;
+ return;
+ }
+ skill_produce_mix(sd,0,nameid,0,0,0,1);
+ sd->menuskill_val = sd->menuskill_id = 0;
+}
+/*==========================================
* •ŠíC—
*------------------------------------------*/
void clif_parse_RepairItem(int fd, struct map_session_data *sd)
@@ -13371,7 +13429,7 @@ static int packetdb_readdb(void)
12, 26, 9, 11, -1, -1, 10, 2, 282, 11, 4, 36, -1, -1, 4, 2,
//#0x0240
-1, -1, -1, -1, -1, 3, 4, 8, -1, 3, 70, 4, 8, 12, 4, 10,
- 3, 32, -1, 3, 3, 5, 5, 8, 2, 3, -1, -1, 4, -1, 4, 0,
+ 3, 32, -1, 3, 3, 5, 5, 8, 2, 3, -1, 6, 4, -1, 4, 0,
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x0280
@@ -13438,6 +13496,7 @@ static int packetdb_readdb(void)
{clif_parse_UseSkillMap,"useskillmap"},
{clif_parse_RequestMemo,"requestmemo"},
{clif_parse_ProduceMix,"producemix"},
+ {clif_parse_Cooking,"cooking"},
{clif_parse_NpcSelectMenu,"npcselectmenu"},
{clif_parse_NpcNextClicked,"npcnextclicked"},
{clif_parse_NpcAmountInput,"npcamountinput"},
diff --git a/src/map/clif.h b/src/map/clif.h
index 7d866a801..ad00176b6 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -232,6 +232,7 @@ void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short sk
void clif_skill_memomessage(struct map_session_data* sd, int type);
void clif_skill_teleportmessage(struct map_session_data* sd, int type);
int clif_skill_produce_mix_list(struct map_session_data *sd, int trigger);
+void clif_cooking_list(struct map_session_data *sd, int trigger);
int clif_produceeffect(struct map_session_data* sd,int flag,int nameid);
diff --git a/src/map/script.c b/src/map/script.c
index 82c8079d1..8e2d54f3b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7246,6 +7246,22 @@ BUILDIN_FUNC(produce)
return 0;
}
/*==========================================
+ *
+ *------------------------------------------*/
+BUILDIN_FUNC(cooking)
+{
+ int trigger;
+ TBL_PC* sd;
+
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 0;
+
+ trigger=script_getnum(st,2);
+ clif_cooking_list(sd, trigger);
+ return 0;
+}
+/*==========================================
* NPC‚Ńyƒbƒgì‚é
*------------------------------------------*/
BUILDIN_FUNC(makepet)
@@ -13716,6 +13732,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(guildopenstorage,"*"),
BUILDIN_DEF(itemskill,"vi"),
BUILDIN_DEF(produce,"i"),
+ BUILDIN_DEF(cooking,"i"),
BUILDIN_DEF(monster,"siisii*"),
BUILDIN_DEF(getmobdrops,"i"),
BUILDIN_DEF(areamonster,"siiiisii*"),