Jump to content

Lighta

Members
  • Posts

    737
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by Lighta

  1. hope no mob can use this skill on your server otherwise you may get a segmentation fault. better to check sd before atempting to use it on pc_checkskill. Here quick security fix and also the kro formula if you want [/font] md.damage = sstatus->int_ * 4 * skill_lv * (10 / (10 - (sd?pc_checkskill(sd,AM_CANNIBALIZE):5)); //[{( Hell Plant Skill Level x Caster?s Base Level ) x 10 } + {( Caster?s INT x 7 ) / 2 } x { 18 + ( Caster?s Job Level / 4 )] x ( 5 / ( 10 - Summon Flora Skill Level ) //md.damage = (sd?pc_checkskill(sd,GN_HELLS_PLANT):5) * s_level * 10 + sstatus->int_ * 7/2 * (18 + (sd?sd->status.job_level:s_level)/4)) * 5/(10-(sd?pc_checkskill(sd,AM_CANNIBALIZE):5)); //kro formula [lighta]
  2. Well I hope you did set a passeword for your root acces, I didn't think that was even possibly not too. Anyway about folder they should be create by the configure file, perhaps we should update it to prevent those errors.
  3. *getstatus <effect type>{,<type>}; Retrieve information about a specific status effect when called. Depending on <type> specified the function will return different information. Possible <type> values: - 0 or undefined: whether the status is active - 1: the val1 of the status - 2: the val2 of the status - 3: the val3 of the status - 4: the val4 of the status - 5: the amount of time in milliseconds that the status has remaining If <type> is not defined or is set to 0, then the script function will either return 1 if the status is active, or 0 if the status is not active. If the status is not active when any of the <type> fields are provided, this script function will always return 0. This could be found at doc/script_command.txt, wich is really the place you should look if a command exist or no, you could also take a look at script.c if you can read.
  4. ok I edited the second codebox so you should be fine now. perhaps I'll resume all on 1st one
  5. Ah right indeed, I'll change this later, you just need to point on storage instead inventory. I'll sending after class.
  6. ? you mean, countstorageitem, cause ofc if it's coutitemstorage that won't work.
  7. Ah sorry for mistunderstanding then. Hopefully I already did what u asked but I found my script quite lame here, so do as you want. Here the patch for countstorageitem. (how to use it is in description) # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and n newlines. Index: src/map/script.c --- Base (BASE) +++ Locally Modified (Based On LOCAL) @@ -15982,6 +15982,84 @@ return 0; } + +/*========================================== + * Countstorageitem,type,item{,"<Nick Name>"} [Lighta] + * type : 0 inventory, 1 guildinventory + * item : itemid or itemname + *------------------------------------------*/ +BUILDIN_FUNC(countstorageitem) +{ + int i, type; + short int nameid; + int count = 0; + struct script_data* data; + struct item_data* item_data; + struct guild_storage *gstor; + struct storage_data *stor; + + TBL_PC * sd = ((script_hasdata(st,4)) ? map_nick2sd(script_getstr(st,4)) : script_rid2sd(st)); + if (!sd) { + script_pushint(st,0); + return 0; + } + + type = script_getnum(st,2); + data = script_getdata(st,3); + get_val(st,data); + if( data_isstring(data) ) { + const char* name = conv_str(st,data); + if((item_data = itemdb_searchname(name)) != NULL) { + nameid = item_data->nameid; + } + else { + nameid = 0; + } + } else + nameid = conv_num(st,data); + + if(nameid<=0){ + ShowError("Invalid item specified in countstorageitem"); + script_pushint(st,-1); + return -1; + } + + switch(type){ + case 0 : + stor=&sd->status.storage; + for(i = 0; i < MAX_STORAGE; i++) { + if(&stor->items[i] != NULL && stor->items[i].nameid > 0 && + stor->items[i].amount > 0 && stor->items[i].nameid == nameid + ) + count += stor->items[i].amount; + } + break; + + case 1: + if (sd->status.guild_id && (gstor=guild2storage2(sd->status.guild_id))) { + for(i = 0; i < MAX_GUILD_STORAGE; i++) { + if(&gstor->items[i] != NULL && gstor->items[i].nameid > 0 && + gstor->items[i].amount > 0 && gstor->items[i].nameid == nameid + ) + count += gstor->items[i].amount; + } + } + else { + script_pushint(st,-1); //ShowInfo("Charactere not related to a guild"); + return -1; + } + break; + + default : + ShowError("Invalid type specified in countstorageitem"); + script_pushint(st,-1); + return -1; + } + + script_pushint(st,count); + return 0; +} + // declarations that were supposed to be exported from npc_chat.c #ifdef PCRE_SUPPORT BUILDIN_FUNC(defpattern); @@ -16417,5 +16495,7 @@ BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "ii"), + + BUILDIN_DEF(countstorageitem,"iv"), {NULL,NULL,NULL}, }; </nick>
  8. I add the index manually, the 2 other one are in storage.h and storage.c
  9. Better use a while loop if you wanna do this check, since it may not finish on 5s. http://pastebin.com/jR91fv1U Also you check it's quite overkill with ps -ax, juste like the one in stop in fact instead using pkill. (btw stop quite annoying if you have multiple server running with same name). http://mywiki.wooledge.org/ProcessManagement Oh and little note I said to update this thing a month ago at least..
  10. bump !, I think we should also had some propriety like (not dispelable), (doesn't affect boss) etc.. I don't know if we should had those in flag value or with a new colum.
  11. Oh right there some eamod in that i'm sorry. I change the 1st post to put the proper patch.
  12. From old forum and a bit of my own edit. # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and n newlines. Index: src/map/script.c =================================================================== --- src/map/script.c (revision 15409) +++ src/map/script.c (working copy) @@ -16023,6 +16023,160 @@ return 0; } + +/* ========================================= +* - GetStorageItem <item_id>,<amount>{,"<Nick Name>"}; +* Carlos H. +* Max ammount = 30k +* ----------------------------------------- */ +BUILDIN_FUNC(getstorageitem){ + TBL_PC * sd = ((script_hasdata(st,4)) ? map_nick2sd(script_getstr(st,4)) : script_rid2sd(st)); + struct item_data * item_data; + struct item item_tmp; + int amount = script_getnum(st,3); + int x; + if((item_data = itemdb_exists(script_getnum(st,2))) != NULL && sd != NULL){ + if(amount <= 0 || (!itemdb_isstackable2(item_data)) || (itemdb_isstackable2(item_data) && amount > MAX_AMOUNT)) + amount = 1; + memset(&item_tmp,0,sizeof(item_tmp)); + item_tmp.nameid = item_data->nameid; + item_tmp.identify = 1; + if(!itemdb_isstackable2(item_data) && amount > 1){ + for(x = 0; x < amount; x++) + storage_additem(sd,&item_tmp,amount); + }else { + storage_additem(sd,&item_tmp,amount); + clif_storageclose(sd); + sd->state.storage_flag = 0; + } + + log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, amount, &item_tmp); + } + return 0; +} + +/* ========================================= +* getStorageItem2 <item id>,<amount>,,<refine>,<attribut>,<c1>,<c2>,<c3>,<c3>{,<account ID>}; +* getStorageItem2 "<item name>",<amount>,,<refine>,<attribut>,<c1>,<c2>,<c3>,<c3>{,<account ID>}; +* [Lighta] +* ----------------------------------------- */ +BUILDIN_FUNC(getstorageitem2){ + TBL_PC * sd; + int nameid,amount,i; + int ref,attr,c1,c2,c3,c4; + struct script_data *data; + struct item_data * item_data; + struct item item_tmp; + + data=script_getdata(st,2); + get_val(st,data); + if( data_isstring(data) ) + {// "<item name>" + const char *name=conv_str(st,data); + struct item_data *item_data = itemdb_searchname(name); + if( item_data == NULL ){ + ShowError("buildin_getstorageitem2: Nonexistant item %s requested.n", name); + return 1; //No item created. + } + nameid=item_data->nameid; + } else if( data_isint(data) ) + {// <item id> + nameid=conv_num(st,data); + //Violet Box, Blue Box, etc - random item pick + if( nameid < 0 ) { + nameid=itemdb_searchrandomid(-nameid); + } + if( nameid <= 0 || !itemdb_exists(nameid) ){ + ShowError("buildin getstorageitem2: Nonexistant item %d requested.n", nameid); + return 1; //No item created. + } + } + amount=script_getnum(st,3); + ref=script_getnum(st,4); + attr=script_getnum(st,5); + c1=(short)script_getnum(st,6); + c2=(short)script_getnum(st,7); + c3=(short)script_getnum(st,8); + c4=(short)script_getnum(st,9); + + if( script_hasdata(st,10) ) + sd=map_id2sd(script_getnum(st,10)); // <Account ID> + else + sd=script_rid2sd(st); // Attached player + + if( sd == NULL ) // no target + return 0; + + if((item_data = itemdb_exists(script_getnum(st,2))) != NULL && sd != NULL){ + item_data=itemdb_exists(nameid); + if (item_data == NULL) + return -1; + if(item_data->type==IT_WEAPON || item_data->type==IT_ARMOR){ + if(ref > MAX_REFINE) ref = MAX_REFINE; + } + else if(item_data->type==IT_PETEGG) { + ref = 0; + } + else { + ref = attr = 0; + } + memset(&item_tmp,0,sizeof(item_tmp)); + item_tmp.nameid=nameid; + item_tmp.identify = 1; + item_tmp.refine=ref; + item_tmp.attribute=attr; + item_tmp.card[0]=(short)c1; + item_tmp.card[1]=(short)c2; + item_tmp.card[2]=(short)c3; + item_tmp.card[3]=(short)c4; + + if(amount <= 0 || (!itemdb_isstackable2(item_data) && amount > 10) || (itemdb_isstackable2(item_data) && amount > MAX_AMOUNT)) + amount = 1; + if(!itemdb_isstackable2(item_data) && amount > 1){ + for(i = 0; i < amount; i++) + storage_additem(sd,&item_tmp,amount); + } else { + storage_additem(sd,&item_tmp,amount); + clif_storageclose(sd); + sd->state.storage_flag = 0; + } + log_pick_pc(sd, LOG_TYPE_SCRIPT, nameid, amount, &item_tmp); + } + return 0; +} + +/*========================================== +* delstorageitem [Lighta] +* * - setStorageItem <item_id>,<amount>{,"<Nick Name>"}; +*------------------------------------------*/ +BUILDIN_FUNC(delstorageitem) +{ + TBL_PC * sd = ((script_hasdata(st,4)) ? map_nick2sd(script_getstr(st,4)) : script_rid2sd(st)); + struct item_data * item_data; + int amount = script_getnum(st,3); + struct item item_tmp; + int i; + + if((item_data = itemdb_exists(script_getnum(st,2))) != NULL && sd != NULL){ + if(amount <= 0 || (!itemdb_isstackable2(item_data)) || (itemdb_isstackable2(item_data) && amount > MAX_AMOUNT)) + amount = 1; + + //search item in storage + ARR_FIND( 0, MAX_STORAGE, i, sd->status.storage.items[i].nameid == item_data->nameid); + if( i >= MAX_STORAGE ) + return -1; //item not found + + item_tmp=sd->status.storage.items[i]; //memo for log + storage_delitem(sd,i,amount); + + clif_storageclose(sd); + sd->state.storage_flag = 0; + + log_pick_pc(sd, LOG_TYPE_SCRIPT, item_tmp.nameid, -amount, &item_tmp); + } + return 0; +} + // declarations that were supposed to be exported from npc_chat.c #ifdef PCRE_SUPPORT BUILDIN_FUNC(defpattern); @@ -16458,5 +16612,10 @@ BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "ii"), + + BUILDIN_DEF(getstorageitem,"ii*"), + BUILDIN_DEF(getstorageitem2,"viiiiiii?"), + BUILDIN_DEF(delstorageitem,"ii*"), + {NULL,NULL,NULL}, }; Index: src/map/storage.c =================================================================== --- src/map/storage.c (revision 15409) +++ src/map/storage.c (working copy) @@ -127,7 +127,7 @@ /*========================================== * Internal add-item function. *------------------------------------------*/ -static int storage_additem(struct map_session_data* sd, struct item* item_data, int amount) +int storage_additem(struct map_session_data* sd, struct item* item_data, int amount) { struct storage_data* stor = &sd->status.storage; struct item_data *data; Index: src/map/storage.h =================================================================== --- src/map/storage.h (revision 15409) +++ src/map/storage.h (working copy) @@ -37,4 +37,5 @@ int storage_guild_storagesave(int account_id, int guild_id, int flag); int storage_guild_storagesaved(int guild_id); //Ack from char server that guild store was saved. +int storage_additem(struct map_session_data* sd, struct item* item_data, int amount); #endif /* _STORAGE_H_ */ [/codeBOX]
  13. Otherwise the cli solution is : svn resolve --accept theirs-conflit path/to/your/folder/or/file //will take svn version conflit svn resolve --accept mine-conflit path/to/your/folder/or/file //will take your version conflit svn resolve --accept theirs-full path/to/your/folder/or/file //will take svn version (all file) svn resolve --accept mine-full path/to/your/folder/or/file //will take your version (all file) That should be the main one. More option could be found on svn help resolve.
  14. I don't see why you need tool to edit sql db. Or you count a basic sql client like one but it's quite same as counting notepad for txt... Commad line good enough. About loading I doubt it's longer to start then txt, (except the setup) but if I recall yes some function was less godd written than txt version. Actually that my really CON here, it,s probably gonna be harder to edit those sql function instead txt one since there way much option. Also we already saw some pretty long/lame request in the past. So I wont put too much faith on this. About configuration file on SQL I don't really see the use since there not so much option but well why not. About commenary they could be moved on doc or wiki so doesn't really matter.
  15. Yeah I had that socket error once too. That was because I had LAMP and original mysql installed, (wich enter in conflict for socket). Is it your case too ? If so open /etc/mysql/my.cnf and change socket path for the one you want to use. From what I'm seen you probably want something like /var/run/mysqld/mysqld.sock. (Just do a locate or find on mysqld.sock to found out your path otherwise)
  16. He already anwsered that issue : http://www.eathena.ws/board/index.php?showtopic=165462&view=findpost&p=915910
  17. just put #include <math.h> and that should fix it. It should compile with -lm option by default anyway. Oops this anwser is based on your title error message, if you wan't the script function then yes add JayPeeMateo snipet.
  18. Yes I know it was regen, that why I said it was already there, didn't understand he wanted to block item one too. If so he could just copy that cond into status_heal as you said or maybe pc_isuseitem perhaps, so he wont wasted is item in vain ?
  19. Shouldn't this status already there but juste commented ? case MO_EXTREMITYFIST: // if(sc && sc->data[sC_EXTREMITYFIST]) //To disable Asura during the 5 min skill block uncomment this... This status being use status_calc_regen_rate() so I guess it is right. As for element, it's currently keep under hold into weapon_atk struct more precisely the rhw one, I think the workaround would be to check this value even if they do not carry arm, or do something more cleaner like adding a s_ele field into status_data struct, wich could be check only if there no weapon.
  20. This is a little statistics module devellop by Luxation and me for "Legend of Fea" back in the days. It's goal is to record, dammages, skills, kills, heal, items used during woe. This code is working but not currently maintained and probably need improvment. I suggest you'll consider it as an example to do your, still if you did good improvment and want to share it I'd be glad to update topic. statslof.c : [http://pastebin.com/aNyGFuQ7 statslof.h http://pastebin.com/DCMVmVEw atcommand.c : http://pastebin.com/mARm7DFB now the calls : http://pastebin.com/aT4ZvFsr http://pastebin.com/mARm7DFB sql-tables http://pastebin.com/rmXxzWpB makefile.in : http://pastebin.com/tyVsRShz Reconfigure remake and should be ok ./configure && make clean && make sql
  21. Since there no much content right now, isn't the time to list all released script in a pinned topic, so people will see what already posted and may avoid posting it again. Also it's much easier to do it now and addind little by little, (moderator keep a track at this), then wait it's too crowdy with lame scripts..
  22. Yes totally agree, I think there way too much hardcode in src atm, I mean not totally hardcoded since using enum but we should change thing for more database oriented or group instead a big swicth(case x: case y:.. function()), like dispelable check. ac_vulture effect and etc..
  23. +1 also if I may suggest one little addon of the same kind
  24. Lighta

    Pay2Play

    Beside Law and monney I think that systeme could be hack for other use, so won't be bad to implement it. But as everyone state, people won't like nuch to pay to play in your server, unless yes unless it is very attractive, have special feature etc.. In other word your server should be much better then other Ra Ea emulator... I'll resume this like that it's something who will disencourage sharing. All in all I'd say no.
×
×
  • Create New...