Advertisement
Angst

TStone [Catalyst+20]

Dec 11th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.63 KB | None | 0 0
  1. //================================================================
  2. //  Tier Stone Refining ( Up to +20 ver)
  3. // Written By Angst, equipment menu snippet taken from refiner.txt.
  4. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5. //  Using 'Catalyst' items, in this case Enhancement Stone; requires the
  6. //  player to have at least 10 in inventory to get the full chance to refine.
  7. //  Support Stone prevents item breaking should the refinement process fail.
  8. //
  9. // 'Tier Stone' 1-4 + 'Enhancement Stone' x10 = 100%
  10. // 'Tier Stone' 5-6 + 'Enhancement Stone' x10 = 95%
  11. // 'Tier Stone' 7-8 + 'Enhancement Stone' x10 = 85%
  12. // 'Tier Stone' 9-10 + 'Enhancement Stone' x10 = 75%
  13. // 'Tier Stone' 11-12 + 'Enhancement Stone' x10 = 65%
  14. // 'Tier Stone' 13-14 + 'Enhancement Stone' x10 = 55%
  15. // 'Tier Stone' 15-16 + 'Enhancement Stone' x10 = 45%
  16. // 'Tier Stone' 17-18 + 'Enhancement Stone' x10 = 35%
  17. // 'Tier Stone' 19-20 + 'Enhancement Stone' x10 = 25%
  18. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19. // v1.3
  20. //
  21. //  Item Db2 Inserts:
  22. //  If you change the id' of these then be sure to change them in the Settings below, too.
  23. //
  24. //32098,Support_Stone,Support Stone,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
  25. //32099,Enhancement_Stone,Enhancement Stone,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
  26. //
  27. /*
  28. 32111,Amra_Stone,Amra Stone 11,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32111; },{},{}
  29. 32112,Amra_Stone,Amra Stone 12,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32112; },{},{}
  30. 32113,Amra_Stone,Amra Stone 13,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32113; },{},{}
  31. 32114,Amra_Stone,Amra Stone 14,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32114; },{},{}
  32. 32115,Amra_Stone,Amra Stone 15,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32115; },{},{}
  33. 32116,Amra_Stone,Amra Stone 16,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32116; },{},{}
  34. 32117,Amra_Stone,Amra Stone 17,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32117; },{},{}
  35. 32118,Amra_Stone,Amra Stone 18,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32118; },{},{}
  36. 32119,Amra_Stone,Amra Stone 19,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32119; },{},{}
  37. 32120,Amra_Stone,Amra Stone 20,11,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "AMRA", 32120; },{},{}
  38. */
  39. //================================================================
  40.  
  41.  
  42. function    script  AMRA    {
  43. //------ SETTINGS ---------------------------------------------------------------------
  44. // Enhancement Stone Item_ID
  45. set .enstid, 32099;
  46.  
  47. // Support Stone Item_ID
  48. set .sustid, 32098;
  49.  
  50. //Tier Stone ID's 1-20
  51. set .ts0, 32100;
  52. set .ts1, 32101;
  53. set .ts2, 32102;
  54. set .ts3, 32103;
  55. set .ts4, 32104;
  56. set .ts5, 32105;
  57. set .ts6, 32106;
  58. set .ts7, 32107;
  59. set .ts8, 32108;
  60. set .ts9, 32109;
  61. set .ts10, 32110;
  62. set .ts11, 32111;
  63. set .ts12, 32112;
  64. set .ts13, 32113;
  65. set .ts14, 32114;
  66. set .ts15, 32115;
  67. set .ts16, 32116;
  68. set .ts17, 32117;
  69. set .ts18, 32118;
  70. set .ts19, 32119;
  71. set .ts20, 32120;
  72. //============================================================
  73.     set .@id, getarg(0);
  74.     if (.@id == .ts0) {
  75.         if (countitem(.@id) > 2) {
  76.             set .@del, ((countitem(.@id)/3)*3);
  77.             getitem (1 + .@id), (countitem(.@id)/3);
  78.             delitem .@id, .@del;
  79.         }
  80.         end;
  81.     }
  82.     if (.@id >= .ts1 && .@id <= .ts19) {
  83.         prompt "Merge 3 "+getitemname(.@id)+"'s","Apply "+getitemname(.@id)+" to Equipment";
  84.         if (@menu == 1) {
  85.             if (countitem(.@id) == 2) {
  86.                 message strcharinfo(0), "Merge Failed: "+(3 - countitem(.@id))+" more "+getitemname(.@id)+" is needed to merge.";
  87.                 close;
  88.             }
  89.             if (countitem(.@id) == 1) {
  90.                 message strcharinfo(0), "Merge Failed: "+(3 - countitem(.@id))+" more "+getitemname(.@id)+"'s are needed to merge.";
  91.                 close;
  92.             } else {
  93.                 set .@del, ((countitem(.@id)/3)*3);
  94.                 getitem (1 + .@id), (countitem(.@id)/3);
  95.                 delitem .@id, .@del;
  96.                 if (countitem(.@id) == 1)   dispbottom "One "+getitemname(.@id)+" could not merge.";
  97.                 if (countitem(.@id) == 2)   dispbottom "Two "+getitemname(.@id)+"'s could not merge.";
  98.             }
  99.             close;
  100.         }
  101.         if (@menu == 2) goto AMRACOMB;
  102.         if (@menu == 255)   close;
  103.     }
  104.     if (.@id == .ts20) {
  105.         prompt "Apply to Equipment";
  106.         if (@menu == 1) goto AMRACOMB;
  107.     }
  108. AMRACOMB:
  109.     set .@id, getarg(0);
  110.     mes "Select what you wish to refine.";
  111.     mes " ";
  112.     mes "You can refine an item up to +"+(.@id - .ts0)+" using this stone.";
  113.     setarray .@position$[1], "Head (Upper)","Armor","Left hand","Right hand","Robe","Shoes","Accessory (Left)","Accessory (Right)","Head (Mid)","Head (Lower)";
  114.     set .@menu$,"";
  115.     for (set .@i, 1; .@i <= 10; set .@i, .@i + 1) {
  116.         if (getequipisequiped(.@i))
  117.             if (getequiprefinerycnt(.@i) > 0) {
  118.                 set .@menu$, .@menu$ + .@position$[.@i] + " - " + "[+" + getequiprefinerycnt(.@i) + " " + getequipname(.@i) + " [" + getitemslots(.@i) + "] ]";
  119.             } else {
  120.                 set .@menu$, .@menu$ + .@position$[.@i] + " - " + "[" + getequipname(.@i) + " [" + getitemslots(.@i) + "] ]";
  121.             }
  122.         set .@menu$, .@menu$ + ":";
  123.     }
  124.     set .@part, select(.@menu$);
  125.     if (!getequipisequiped(.@part)) {
  126.         next;
  127.         mes "Nothing equipped in that slot.";
  128.         close;
  129.     }
  130.     if (!getequipisenableref(.@part)) {
  131.         next;
  132.         mes "This item is not refineable.";
  133.         close;
  134.     }
  135.     if (!getequipisidentify(.@part)) {
  136.         next;
  137.         mes "This has not been identified. Please identify it before attempting to refine.";
  138.         close;
  139.     }
  140.     if (getequiprefinerycnt(.@part) >= 20) {
  141.         next;
  142.         mes "Max level reached, the process has failed.";
  143.         close;
  144.     }
  145. close2;
  146.     if (.@id >= 1) {
  147.         set .@tlevel, (.@id - .ts0);
  148.         set .@currefine, getequiprefinerycnt(.@part);
  149.         if (getequiprefinerycnt(.@part) > 0) {
  150.             if (.@currefine == .@tlevel) {
  151.                 mes "You cannot use this stone on your " + getequipname(.@part) + ".";
  152.                 mes "Current equipment's refinement is equal to the stone's power.";
  153.                 close;
  154.             }
  155.             if (.@currefine > .@tlevel) {
  156.                 mes "You cannot use this stone on your " + getequipname(.@part) + ".";
  157.                 mes "Current equipment's refinement is higher than the stone's power.";
  158.                 close;
  159.             }
  160.             if (.@currefine < .@tlevel) {
  161.                 set .@sust, (countitem(.sustid) > 0 ? 1 : 0);
  162.                 switch(.@id) {
  163.                     case 32101: case 32102: case 32103: case 32104:
  164.                                 set .@rate, 10; break;
  165.                     case 32105: case 32106: set .@rate, 9;  break;
  166.                     case 32107: case 32108: set .@rate, 8;  break;
  167.                     case 32109: case 32110: set .@rate, 7;  break;
  168.                     case 32111: case 32112: set .@rate, 6;  break;
  169.                     case 32113: case 32114: set .@rate, 5;  break;
  170.                     case 32115: case 32116: set .@rate, 4;  break;
  171.                     case 32117: case 32118: set .@rate, 3;  break;
  172.                     case 32119: case 32120: set .@rate, 2;  break;                 
  173.                 }
  174.                 set .@p, (countitem(.enstid) >= 10) ? (10 * .@rate) + 5 >= rand(100) : (countitem(.enstid) * .@rate) + 5 >= rand(100);
  175.                 if (.@p == 1) {
  176.                     delitem .@id, 1;
  177.                     if (.@id > .ts4) {
  178.                         delitem .enstid, (countitem(.enstid) >= 10 ? 10 : countitem(.enstid));
  179.                         delitem .sustid, (.@sust == 1 ? 1 : 0);
  180.                     }
  181.                     set .@r, 1;
  182.                     set .@diff, .@tlevel - .@currefine;
  183.                     while(.@r <= .@diff) {
  184.                         successrefitem .@part;
  185.                         set .@r, .@r + 1;
  186.                     }
  187.                     close;
  188.                 }
  189.                 if (.@p == 0) {
  190.                     mes "Sorry, the merging failed.";
  191.                     delitem .@id, 1;
  192.                     delitem .enstid, (countitem(.enstid) >= 10 ? 10 : countitem(.enstid));
  193.                     delitem .sustid, (.@sust == 1 ? 1 : 0);
  194.                     if(.@sust == 0) {
  195.                         failedrefitem .@part;
  196.                     }
  197.                     close;
  198.                 }              
  199.             }
  200.         }
  201.         if (getequiprefinerycnt(.@part) == 0) {
  202.             delitem .@id, 1;
  203.             if (.@id > .ts4) {
  204.                 delitem .enstid, (countitem(.enstid) >= 10 ? 10 : countitem(.enstid));
  205.                 delitem .sustid, (.@sust == 1 ? 1 : 0);
  206.             }
  207.             set .@r, 1;
  208.             while(.@r <= .@tlevel) {
  209.                 successrefitem .@part;
  210.                 set .@r, .@r + 1;
  211.             }
  212.         }
  213.     }
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement