Advertisement
Capuche

sell_a_item_in_my_inventory

May 8th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. /*
  2. - For rAthena svn
  3. - By Capuche
  4. - Version 1.0
  5. ---- Description ----
  6. -> Sell a specific Item in my inventory vs some Items
  7. */
  8.  
  9. - shop costume_shop -1,501:-1
  10.  
  11. prontera,150,180,5 script bghjkl 58,{
  12.  
  13. mes "Hi Good Day! Do you have spare costumes !";
  14. mes "that you wanna get rid of?";
  15. next;
  16.  
  17. set .@s, select( "No ! Goood bye.", "Trade", "More informations" );
  18. if( .@s == 1 )
  19. mes "Okay have a nice day.";
  20. else if( .@s == 3 ) {
  21. mes "blabla more informations.";
  22. }
  23.  
  24. getinventorylist;
  25. for( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 )
  26. if( !@inventorylist_expire[.@i] ) {
  27. while( getd( ".costume_id"+ .@k +"[0]" ) ) {
  28. while( .@j < getd( ".size_costume"+ .@k ) && @inventorylist_id[.@i] != getd( ".costume_id"+ .@k +"["+ .@j +"]" ) ) set .@j, .@j + 1;
  29. if( .@j != getd( ".size_costume"+ .@k ) ) {
  30. for( set .@h, 0; .@h < @inventorylist_amount[.@i]; set .@h, .@h + 1 ) {
  31. set .@list_id[ .@size_shop ], @inventorylist_id[.@i];
  32. set .@size_shop, .@size_shop + 1;
  33. }
  34. break;
  35. }
  36. set .@j, 0;
  37. set .@k, .@k + 1;
  38. }
  39. set .@k, 0;
  40.  
  41. }
  42.  
  43. if( !.@size_shop )
  44. mes "Hmm I don't see any costumes on your inventory. Please check your inventory.";
  45. else {
  46. mes "Okay, here's a list of the costumes in your inventory.";
  47. next;
  48. npcshopitem "costume_shop",501,-1;
  49. for( set .@i, 0; .@i < .@size_shop; set .@i, .@i + 1 )
  50. npcshopadditem "costume_shop",.@list_id[.@i],0;
  51. npcshopdelitem "costume_shop",501;
  52. callshop "costume_shop", 1;
  53. npcshopattach "costume_shop";
  54. }
  55. close;
  56.  
  57. OnBuyItem:
  58. // if( !checkweight2( .item_exchangeID,.item_count ) ) {
  59. // message strcharinfo(0),"You need additional weight capacity to complete this trade.";
  60. // close;
  61. // }
  62. set .@count, getarraysize( @bought_nameid );
  63. for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) {
  64. set .@check, .item_count[.@i] * .@count;
  65. if( .@check > 30000) {
  66. message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[.@i] ) +".";
  67. end;
  68. }
  69. set .@gain$, .@gain$ + ( getstrlen( .@gain$ ) ? ", " : "" ) + .@check +" "+ getitemname( .item_exchangeID[.@i] );
  70. }
  71. mes "Sell the costume for "+ .@gain$ +"?";
  72. next;
  73. if( select( "Yes, I sell", "No" ) -1 ) close;
  74. for( set .@i, 0; .@i < .@count; set .@i, .@i + 1 )
  75. delitem @bought_nameid[.@i], @bought_quantity[.@i];
  76. for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 )
  77. getitem .item_exchangeID[.@i], .item_count[.@i] * .@count;
  78. mes "good bye.";
  79. close;
  80. OnInit:
  81. // Item gained
  82. // -----------
  83. setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,...
  84. setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID )
  85. set .size_count, getarraysize( .item_count );
  86.  
  87. // Costume trade ID
  88. // size array must be < 128
  89. // use the synthaxe .costume_idX for adding news array
  90. // ------------------------------------------------
  91. setarray .costume_id0, 20000, 20001;
  92. setarray .costume_id1, 20002, 20003;
  93.  
  94. while( getd( ".costume_id"+ .@i +"[0]" ) ) {
  95. setd ".size_costume"+ .@i, getarraysize( getd( ".costume_id"+ .@i ) );
  96. set .@i, .@i +1;
  97. }
  98. end;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement