diff options
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/fishing.txt | 9 | ||||
-rw-r--r-- | npc/functions/refine.txt | 173 |
2 files changed, 176 insertions, 6 deletions
diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt index c87935fff..33f746c9d 100644 --- a/npc/functions/fishing.txt +++ b/npc/functions/fishing.txt @@ -246,21 +246,18 @@ function script fishing { .@bait = requestitem(); .@bait_c = false; - if (.@bait < 1) - { + if (.@bait < 1) { narrator S_FIRST_BLANK_LINE, l("You take your fishing rod and leave."); return -6; } - if (countitem(.@bait) < 1) - { + if (countitem(.@bait) < 1) { return -6; } - for (.@i = 0; .@i < .@baits; .@i += 2) - { + for (.@i = 0; .@i < .@baits; .@i += 2) { if (getvariableofnpc(.bait_ids[.@i], .@npc$) == .@bait) { .@bait_c = true; diff --git a/npc/functions/refine.txt b/npc/functions/refine.txt new file mode 100644 index 000000000..65f88e092 --- /dev/null +++ b/npc/functions/refine.txt @@ -0,0 +1,173 @@ +// TMW2 Script +// Author: +// Jesusalva +// Description: +// Refine functions + +// (No arguments) +function script refineMaster { + mesn; + mesq l("Ah, hello there, funny face! Do you want to refine items?"); + mesc l("There's always some chance that THE ITEM WILL BREAK, beware!"); + next; + mesn; + mesq l("First - item must be equipped."); + mesq l("If you succeed, the defense and/or attack will raise. If you fail, refine level goes down."); + //mesq l("And if the item breaks, that is definitive - no repair is possible. What to refine?"); + mesq l("And if the item breaks, that's your loss. What to refine?"); + next; + + // Dark magic from hercules used, take care + menuint + l("Nothing, thanks"), 0, + rif(getequipisequiped(EQI_ARMOR), l("My chestplate, @@", getequipname(EQI_ARMOR))), EQI_ARMOR, + rif(getequipisequiped(EQI_HAND_R), l("My weapon, @@", getequipname(EQI_HAND_R))), EQI_HAND_R, + l("Definitive item break? Too dangerous! I don't want it!!"), 0; + + + if (@menuret == 0) { + mesn; + //mesq l("Wait a moment - you are naked! YOU WILL DIE IN THE FREEZE! o.o"); + mesq l("Well... we'll see around!"); + close; + } + .@it=@menuret; + .@item=getequipid(.@it); + + /* + mes "##B" + l("Drag and drop an item from your inventory.") + "##b"; + .@item = requestitem(); + + // Check if we received an item + if (.@item < 1) { + mesn; + mesq l("Well, no risk, no gain."); + close; + return; + } + */ + + // Not all items are refinable + if (!getequipisenableref(.@item)) { + mesn; + mesq l("Well, sorry, but only weapons and body armor can be refined."); + mesq l("There may be some exceptions. Anyway, this item clearly cannot be refined."); + return; + } + + // Max refining level: 10 + if (getequiprefinerycnt(.@it) >= 10) { + mesn; + mesq l("This item cannot be refined further."); + return; + } + + .@rlv=getequiprefinerycnt(.@it); + .@price=(.@rlv+1)*1000; + .@amount=(.@rlv/2)+1; + // required item + switch (.@rlv) { + case 0: + case 1: + case 2: + .@rg=IronIngot; break; + case 3: + case 4: + .@rg=TitaniumIngot; break; + case 5: + case 6: + .@rg=LeadIngot; break; + case 7: + case 8: + .@rg=Bloodstone; break; + default: + .@rg=BlueManaPearl; break; + } + mesn; + mesq l("This @@ is a nice stuff. I can refine it for @@ GP and @@ @@.", getitemlink(.@item), .@price, .@amount, getitemlink(.@rg)); + mesc l("Success ratio is of aprox. @@ %%" % (100-(.@rlv*10))); + next; + if (askyesno() != ASK_YES) + close; + + // Anti-Crazyfefe™ System + // Item is gone, 100% warranted cheater + if (countitem(.@item) < 1) { + mesn; + mesc l("All cheaters must die."), 1; + percentheal -100, -100; + close; + } + // No money + if (Zeny < .@price) { + mesn; + mesq l("Where's the money? Go away."); + close; + } + // No reagents + if (countitem(.@rg) < .@amount) { + mesn; + mesq l("Where's the reagent? You don't expect me to find it, right? Go bring them!"); + close; + } + // Item removed + if (getequipisequiped(.@it) == 0) { + mesn; + mesc l("All cheaters must die."), 1; + percentheal -100, -100; + close; + } + // Item changed + if (getequiprefinerycnt(.@it) != .@rlv || getequipid(.@it) != .@item) { + mesn; + mesc l("All cheaters must die."), 1; + percentheal -100, -100; + close; + } + ///// This should cover most of Crazyfefe tricks ¬.¬ I hope ¬.¬ + mesn; + mesq l("HA, HA, HA! The blacksmiths from the Land of Fire are the best from the world! There's no challenge too big for us!"); + mesq l("It's time to show this shiny @@ who is the boss! HAHAHAHAHAHAHAH!", getitemlink(.@item)); + next; + // If you cheat somewhere along the way, the script will explode + Zeny=Zeny-.@price; + delitem .@rg, .@amount; + // Cheater should be locked for eternity. + if (getequiprefinerycnt(.@it) != .@rlv || getequipid(.@it) != .@item || getequipisequiped(.@it) == 0) { + atcommand "@jail "+strcharinfo(0); + close; + } + + // Were we successful? + if (getequippercentrefinery(.@it) > rand(100)) { + successrefitem .@it; + mesn; + mesq l("HAHAHAHAH! Shiny as new, and stronger than ever! Have fun!"); + next; + // Perhaps the item has broken? + } else if (rand(100) < .@rvl*2) { + failedrefitem .@it; + mesc l("*CRASH*"); + next; + mesn; + mesq l("Ops... I hammered this stuff too hard... It's junk now."); + next; + mesn; + mesq l("Well, you were warned. Do you have any other stuff for me?"); + next; + // Item is weakened. + } else { + downrefitem .@it, 1; + mesn; + mesq l("A masterpiece!... Whaaaat, this stuff got ##Bweaker##b??"); + next; + mesn; + mesq l("Well, I did my best, but this had been so refined, that it was difficult to find my way."); + next; + mesn; + mesq l("I'm sure I could refine this again, if you bring me the payment and the reagents again."); + next; + } + return; +} + |