mrlongshen 22 Posted November 11, 2013 Request an autopot for auto heal when player have hp < then 30. it will @autopot itemid, the item must have on their inventory, so it can be use to autopot. Is that possible to be a plugin ? Quote Share this post Link to post Share on other sites
0 quesoph 105 Posted November 11, 2013 Where is the actual source code for this @autopot? Quote Share this post Link to post Share on other sites
0 kyeme 71 Posted November 11, 2013 Here http://rathena.org/board/topic/78975-autopots/?hl=autopots Quote Share this post Link to post Share on other sites
0 kyeme 71 Posted November 24, 2013 Can anyone convert this? Thanks in advance goddameit autopots: @autopots_3.patch Index: src/map/atcommand.c===================================================================--- src/map/atcommand.c (revision 17132)+++ src/map/atcommand.c (working copy)@@ -8533,6 +8533,105 @@ return; } +//+void autoatpots_clean(struct map_session_data *sd)+{+ if( sd )+ {+ sd->sc.option &= ~OPTION_AUTOPOTS;+ sd->autopots.hp_nameid = 0;+ sd->autopots.hp_rate = 0;+ sd->autopots.sp_nameid = 0;+ sd->autopots.sp_rate = 0;+ clif_changeoption(&sd->bl);+ }+ return;+}+int autoatpots_timer(int tid, unsigned int tick, int id, intptr_t data)+{+ struct map_session_data *sd=NULL;+ struct item_data* item = NULL;+ int index;+ sd=map_id2sd(id);+ if( sd == NULL )+ return 0;+ if(sd->sc.option & OPTION_AUTOPOTS)+ {+ int hp_rate = sd->autopots.hp_rate;+ int sp_rate = sd->autopots.sp_rate;+ int hp_nameid = sd->autopots.hp_nameid;+ int sp_nameid = sd->autopots.sp_nameid;+ if( ( !sp_rate && !hp_rate ) || pc_isdead(sd) )+ {+ clif_displaymessage(sd->fd, "Auto-pots : OFF_");+ autoatpots_clean(sd);+ return 0;+ }+ if( ( sd->battle_status.hp*100/sd->battle_status.max_hp ) < hp_rate && hp_nameid && hp_rate )+ {+ ARR_FIND(0, MAX_INVENTORY, index, sd->status.inventory[index].nameid == hp_nameid);+ if( sd->status.inventory[index].nameid == hp_nameid )+ pc_useitem(sd,index);+ }+ if( ( sd->battle_status.sp*100/sd->battle_status.max_sp ) < sp_rate && sp_nameid && sp_rate )+ {+ ARR_FIND(0, MAX_INVENTORY, index, sd->status.inventory[index].nameid == sp_nameid);+ if( sd->status.inventory[index].nameid == sp_nameid )+ pc_useitem(sd,index);+ }+ add_timer(gettick()+500,autoatpots_timer,sd->bl.id,0);+ }+ return 0;+}+ACMD_FUNC(autopots)+{+ int hp_rate=0, hp_nameid=0, sp_rate=0, sp_nameid=0, type=0;+ nullpo_retr(-1, sd);++ if (!message || !*message || + sscanf(message, "%d %d %d %d %d", &type, &hp_rate, &hp_nameid, &sp_rate, &sp_nameid) < 5 ||+ ( type <= 0 || type > 1 ) ||+ ( hp_rate < 0 || hp_rate > 99 ) ||+ ( sp_rate < 0 || sp_rate > 99 ) )+ {+ clif_displaymessage(fd, "@autopots <type> <hp_rate> <hp_item id> <sp_rate> <sp_item id>");+ clif_displaymessage(fd, "Auto-pots : OFF");+ autoatpots_clean(sd);+ return 0;+ }++ if (sd->sc.option & OPTION_AUTOPOTS)+ {+ autoatpots_clean(sd);+ }+ if( hp_rate == 0 ) hp_nameid = 0;+ if( sp_rate == 0 ) sp_nameid = 0;+ if( hp_nameid == 0 ) hp_rate = 0;+ if( sp_nameid == 0 ) sp_rate = 0;+ if( itemdb_exists(hp_nameid) == NULL && hp_nameid )+ {+ hp_nameid = 0;+ hp_rate = 0;+ clif_displaymessage(fd, "Auto-pots : Invalid item for HP");+ }+ if( itemdb_exists(sp_nameid) == NULL && sp_nameid )+ {+ sp_nameid = 0;+ sp_rate = 0;+ clif_displaymessage(fd, "Auto-pots : Invalid item for SP");+ }+ clif_displaymessage(fd, "Auto-pots : ON");+ sd->sc.option |= OPTION_AUTOPOTS;+ sd->autopots.hp_nameid = hp_nameid;+ sd->autopots.hp_rate = hp_rate;+ sd->autopots.sp_nameid = sp_nameid;+ sd->autopots.sp_rate = sp_rate;+ add_timer(gettick()+200,autoatpots_timer,sd->bl.id,0);++ clif_changeoption(&sd->bl);+ return 0;+}+ /*========================================== * @commands Lists available @ commands to you *------------------------------------------*/@@ -8828,6 +8927,8 @@ * Command reference list, place the base of your commands here **/ AtCommandInfo atcommand_base[] = {+ ACMD_DEF(autopots),+ // ACMD_DEF2("warp", mapmove), ACMD_DEF(where), ACMD_DEF(jumpto),Index: src/map/pc.h===================================================================--- src/map/pc.h (revision 17132)+++ src/map/pc.h (working copy)@@ -87,6 +87,10 @@ unsigned short pos; }; +struct autopots {+ int hp_rate, sp_rate, hp_nameid, sp_nameid;+};+ struct map_session_data { struct block_list bl; struct unit_data ud;@@ -184,6 +188,8 @@ unsigned int chatID; time_t idletime; + struct autopots autopots;+ struct{ int npc_id; unsigned int timeout;Index: src/map/status.h===================================================================--- src/map/status.h (revision 17132)+++ src/map/status.h (working copy)@@ -1489,6 +1489,7 @@ // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, OPTION_MASK = ~OPTION_INVISIBLE,+ OPTION_AUTOPOTS = 0x40000000, }; //Defines for the manner system [Skotlex] Quote Share this post Link to post Share on other sites
0 Mhalicot 392 Posted November 25, 2013 ^ Release Autopots Plugins Leave vote 1 mrlongshen reacted to this Quote Share this post Link to post Share on other sites
0 kyeme 71 Posted November 25, 2013 ^ Release Autopots Plugins Leave vote Ohh thank you very much @edit Can you convert this to not be a plugin? Quote Share this post Link to post Share on other sites
Request an autopot for auto heal when player have hp < then 30.
it will @autopot itemid, the item must have on their inventory, so it can be use to autopot.
Is that possible to be a plugin ?
Share this post
Link to post
Share on other sites