Advertisement
Guest User

item failed

a guest
Apr 1st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. //Since most delay-consume items involve using a "skill-type" target cursor,
  2. //perform a skill-use check before going through. [Skotlex]
  3. //resurrection was picked as testing skill, as a non-offensive, generic skill, it will do.
  4. //FIXME: Is this really needed here? It'll be checked in unit.c after all and this prevents skill items using when silenced [Inkfish]
  5. if( id->flag.delay_consume && ( sd->ud.skilltimer != INVALID_TIMER /*|| !status_check_skilluse(&sd->bl, &sd->bl, ALL_RESURRECTION, 0)*/ ) )
  6. return 0;
  7.  
  8. if( id->delay > 0 && !pc_has_permission(sd,PC_PERM_ITEM_UNCONDITIONAL) ) {
  9. int i;
  10. ARR_FIND(0, MAX_ITEMDELAYS, i, sd->item_delay[i].nameid == nameid );
  11. if( i == MAX_ITEMDELAYS ) /* item not found. try first empty now */
  12. ARR_FIND(0, MAX_ITEMDELAYS, i, !sd->item_delay[i].nameid );
  13. if( i < MAX_ITEMDELAYS ) {
  14. if( sd->item_delay[i].nameid ) {// found
  15. if( DIFF_TICK(sd->item_delay[i].tick, tick) > 0 ) {
  16. int e_tick = DIFF_TICK(sd->item_delay[i].tick, tick)/1000;
  17. char e_msg[100];
  18. if( e_tick > 99 )
  19. sprintf(e_msg,msg_txt(sd,379), // Item Failed. [%s] is cooling down. Wait %.1f minutes.
  20. itemdb_jname(sd->item_delay[i].nameid), (double)e_tick / 60);
  21. else
  22. sprintf(e_msg,msg_txt(sd,380), // Item Failed. [%s] is cooling down. Wait %d seconds.
  23. itemdb_jname(sd->item_delay[i].nameid), e_tick+1);
  24. clif_colormes(sd,color_table[COLOR_YELLOW],e_msg);
  25. return 0; // Delay has not expired yet
  26. }
  27. } else {// not yet used item (all slots are initially empty)
  28. sd->item_delay[i].nameid = nameid;
  29. }
  30. if( !(nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) )
  31. sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay;
  32. } else {// should not happen
  33. ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%hu, char_id=%d)\n", nameid, sd->status.char_id);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement