Advertisement
dreamunreal

rentitem2

Apr 29th, 2011
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.22 KB | None | 0 0
  1. script.c
  2.  
  3. find:
  4. // declarations that were supposed to be exported from npc_chat.c
  5. #ifdef PCRE_SUPPORT
  6. BUILDIN_FUNC(defpattern);
  7. BUILDIN_FUNC(activatepset);
  8. BUILDIN_FUNC(deactivatepset);
  9. BUILDIN_FUNC(deletepset);
  10. #endif
  11.  
  12.  
  13. add before:
  14.  
  15. // rentitem2 ID, refine,attrib, card1, card2, card3, card4, seconds, { account_id }
  16. // rentitem2 name, refine, attrib, card1, card2, card3, card4, seconds, { account_id }
  17. // added by [黑白照]
  18. BUILDIN_FUNC(rentitem2) // added by [黑白照]
  19. {
  20.     int nameid,ref,attr,c1,c2,c3,c4,seconds,flag;  // 名字id,精炼,属性,卡1,卡2,卡3,卡4,时间,标记
  21.     //struct item_data *item_data;
  22.     struct item it;
  23.     TBL_PC *sd;
  24.     struct script_data *data;
  25.     if( script_hasdata(st,10) )
  26.         sd=map_id2sd(script_getnum(st,10)); // <Account ID>
  27.     else
  28.         sd=script_rid2sd(st); // Attached player
  29.  
  30.     if( sd == NULL ) // no target
  31.         return 0;
  32.  
  33.     data=script_getdata(st,2);
  34.     get_val(st,data);
  35.     if( data_isstring(data) ){
  36.         const char *name=conv_str(st,data);
  37.         struct item_data *item_data = itemdb_searchname(name);
  38.         if( item_data )
  39.             nameid=item_data->nameid;
  40.         else
  41.             nameid=UNKNOWN_ITEM_ID;
  42.     }else
  43.         nameid=conv_num(st,data);
  44.  
  45.     ref = script_getnum(st,3);
  46.     attr = script_getnum(st,4);
  47.     c1=(short)script_getnum(st,5);
  48.     c2=(short)script_getnum(st,6);
  49.     c3=(short)script_getnum(st,7);
  50.     c4=(short)script_getnum(st,8);
  51.     seconds = script_getnum(st,9);
  52.  
  53.     memset(&it, 0, sizeof(it));
  54.     it.nameid = nameid;
  55.     it.identify = 1;
  56.     it.attribute = attr;
  57.     it.refine = ref;
  58.     it.card[0] = (short)c1;
  59.     it.card[1] = (short)c2;
  60.     it.card[2] = (short)c3;
  61.     it.card[3] = (short)c4;
  62.    
  63.     it.expire_time = (unsigned int)(time(NULL) + seconds);
  64.  
  65.     if( (flag = pc_additem(sd, &it, 1)) )
  66.     {
  67.         clif_additem(sd, 0, 0, flag);
  68.         return 1;
  69.     }
  70.  
  71.     clif_rental_time(sd->fd, nameid, seconds);
  72.     pc_inventory_rental_add(sd, seconds);
  73.  
  74.     if( log_config.enable_logs&LOG_SCRIPT_TRANSACTIONS )
  75.         log_pick_pc(sd, "N", nameid, 1, NULL);
  76.    
  77.     return 0;
  78. }
  79.  
  80. find:
  81. //Quest Log System [Inkfish]
  82.     BUILDIN_DEF(setquest, "i"),
  83.     BUILDIN_DEF(erasequest, "i"),
  84.     BUILDIN_DEF(completequest, "i"),
  85.     BUILDIN_DEF(checkquest, "i?"),
  86.     BUILDIN_DEF(changequest, "ii"),
  87.     BUILDIN_DEF(showevent, "ii"),
  88.  
  89.  
  90. add after:
  91. BUILDIN_DEF(rentitem2,"viiiiiii?"),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement