Ver código fonte

* Fixed #387
* Replacing 'rand()' leftwover with 'rnd()' of mt19937ar
* Cleaned up script commands related with item group: 'groupranditem', 'getrandgroupitem', 'getgroupitem'
* Corrected item scripts that are using 'getrandgroupitem'
* Updated script command and item group doc

Signed-off-by: Cydh Ramdh <cydh@pservero.com>

Cydh Ramdh 10 anos atrás
pai
commit
27ba6c5002
9 arquivos alterados com 210 adições e 196 exclusões
  1. 50 50
      db/re/item_db.txt
  2. 69 29
      doc/item_group.txt
  3. 11 37
      doc/script_commands.txt
  4. 3 3
      src/map/battle.c
  5. 34 47
      src/map/itemdb.c
  6. 1 0
      src/map/itemdb.h
  7. 29 17
      src/map/script.c
  8. 9 9
      src/map/skill.c
  9. 4 4
      src/map/status.c

+ 50 - 50
db/re/item_db.txt

@@ -106,7 +106,7 @@
 //===================================================================
 601,Wing_Of_Fly,Fly Wing,11,60,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "AL_TELEPORT",1; },{},{}
 602,Wing_Of_Butterfly,Butterfly Wing,11,300,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "AL_TELEPORT",3; },{},{}
-603,Old_Blue_Box,Old Blue Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_BlueBox),1; },{},{}
+603,Old_Blue_Box,Old Blue Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_BlueBox,1); },{},{}
 604,Branch_Of_Dead_Tree,Dead Branch,2,50,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ monster "this",-1,-1,"--ja--",-1,1,""; },{},{}
 605,Anodyne,Anodyne,11,2000,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "SM_ENDURE",1; },{},{}
 606,Aloebera,Aloevera,11,1500,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "SM_SELFPROVOKE",1; },{},{}
@@ -119,8 +119,8 @@
 613,Iron_Hammer,Iron Hammer,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ produce 1; },{},{}
 614,Golden_Hammer,Golden Hammer,2,3000,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ produce 2; },{},{}
 615,Oridecon_Hammer,Oridecon Hammer,2,5000,,400,,,,,0xFFFFFFFF,63,2,,,,,,{ produce 3; },{},{}
-616,Old_Card_Album,Old Card Album,2,10000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum),1; },{},{}
-617,Old_Violet_Box,Old Purple Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_VioletBox),1; },{},{}
+616,Old_Card_Album,Old Card Album,2,10000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum,1); },{},{}
+617,Old_Violet_Box,Old Purple Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_VioletBox,1); },{},{}
 618,Worn_Out_Scroll,Worn Out Scroll,2,50,,20,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 619,Unripe_Apple,Unripe Apple,2,1000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1002; },{},{}
 620,Orange_Juice,Orange Juice,2,1500,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1113; },{},{}
@@ -147,7 +147,7 @@
 641,Contracts_In_Shadow,Contract in Shadow,2,100,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1109; },{},{}
 642,Book_Of_Devil,Book of the Devil,2,1800,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1101; },{},{}
 643,Pet_Incubator,Pet Incubator,2,3000,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ bpet; },{},{}
-644,Gift_Box,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox),1; },{},{}
+644,Gift_Box,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox,1); },{},{}
 //ASPD in RE they give a fixed +4/+6/+9 ASPD
 645,Center_Potion,Concentration Potion,2,800,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ASPDPOTION0,1800000,4; },{},{}
 656,Awakening_Potion,Awakening Potion,2,1500,,150,,,,,0xFFF7FEEF,63,2,,,40,,,{ sc_start SC_ASPDPOTION1,1800000,6; },{},{}
@@ -158,10 +158,10 @@
 661,Sway_Apron,Soft Apron,2,20000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1275; },{},{}
 662,Inspector_Certificate,Authoritative Badge,2,1450,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_SPEEDUP0,180000,25; },{},{}
 663,Korea_Rice_Cake,Korean Rice Cake,0,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 10,0; },{},{}
-664,Gift_Box_1,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_1),1; },{},{}
-665,Gift_Box_2,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_2),1; },{},{}
-666,Gift_Box_3,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_3),1; },{},{}
-667,Gift_Box_4,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_4),1; },{},{}
+664,Gift_Box_1,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_1,1); },{},{}
+665,Gift_Box_2,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_2,1); },{},{}
+666,Gift_Box_3,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_3,1); },{},{}
+667,Gift_Box_4,Gift Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBox_4,1); },{},{}
 668,Handsei,Red Envelope,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ set Zeny,Zeny+rand(1000,10000); },{},{}
 669,Rice_Cake_Soup,Tempting Rice-Cake Soup,0,500,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal -100,-100; },{},{}
 670,Gold_Coin_Moneybag,Bag of Gold Coins,3,100000,,400,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
@@ -5850,10 +5850,10 @@
 12020,Water_Of_Darkness,Cursed Water,11,2,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "ITEM_ENCHANTARMS",8; },{},{}
 12021,Pork_Belly,Pork,0,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemheal rand(70,99),0; },{},{}
 12022,Spareribs,Galbi,0,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemheal rand(70,99),0; },{},{}
-12023,Giftbox_China,Wrapped Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBoxChina),1; },{},{}
+12023,Giftbox_China,Wrapped Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GiftBoxChina,1); },{},{}
 12024,Red_Pouch_Of_Surprise,Red Pouch,2,50,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ monster "this",-1,-1,"--ja--",-4,1,""; },{},{}
-12025,Egg_Boy,Dano Festival Egg,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_EggBoy),1; },{},{}
-12026,Egg_Girl,Dano Festival Egg,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_EggGirl),1; },{},{}
+12025,Egg_Boy,Dano Festival Egg,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_EggBoy,1); },{},{}
+12026,Egg_Girl,Dano Festival Egg,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_EggGirl,1); },{},{}
 12027,Giggling_Box,Giggling Box,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 9,0; sc_start SC_CURSE,30000,0,3000,0; },{},{}
 12028,Box_Of_Thunder,Box of Thunder,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_SPEEDUP0,20000,25; },{},{}
 12029,Gloomy_Box,Box of Gloom,11,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "AC_CONCENTRATION",1; },{},{}
@@ -5862,11 +5862,11 @@
 12032,Box_Of_Storm,Box of Storms,11,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "ITEM_ENCHANTARMS",2; },{},{}
 12033,Box_Of_Sunlight,Box of Sunlight,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_Intravision,30000,0; },{},{}
 12034,Painting_Box,Box of Panting,2,1000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,9; sc_start SC_SILENCE,30000,0,3000,0; },{},{}
-12035,Lotto_Box01,Lotto Box 01,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox1),1; },{},{}
-12036,Lotto_Box02,Lotto Box 02,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox2),1; },{},{}
-12037,Lotto_Box03,Lotto Box 03,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox3),1; },{},{}
-12038,Lotto_Box04,Lotto Box 04,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox4),1; },{},{}
-12039,Lotto_Box05,Lotto Box 05,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox5),1; },{},{}
+12035,Lotto_Box01,Lotto Box 01,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox1,1); },{},{}
+12036,Lotto_Box02,Lotto Box 02,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox2,1); },{},{}
+12037,Lotto_Box03,Lotto Box 03,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox3,1); },{},{}
+12038,Lotto_Box04,Lotto Box 04,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox4,1); },{},{}
+12039,Lotto_Box05,Lotto Box 05,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_LottoBox5,1); },{},{}
 12040,Stone_Of_Intelligence_,Stone of Sage,2,100000,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ homevolution; },{},{}
 12041,Str_Dish01,Fried Grasshopper Legs,0,2000,,60,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_STRFOOD,1200000,1; percentheal 5,0; },{},{}
 12042,Str_Dish02,Seasoned Sticky Webfoot,0,4000,,500,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_STRFOOD,1200000,2; percentheal 5,0; },{},{}
@@ -5931,14 +5931,14 @@
 12101,Citron,Citron,0,20,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_FLEEFOOD,180000,30; },{},{}
 12102,Meat_Skewer,Grilled Skewer,0,20,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_HITFOOD,180000,30; },{},{}
 12103,Bloody_Dead_Branch,Bloody Branch,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ monster "this",-1,-1,"--ja--",-3,1,""; },{},{}
-12104,Random_Quiver,Random Quiver,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Quiver),1; },{},{}
-12105,Set_Of_Taiming_Item,Taming Gift Set,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Taming),1; getrandgroupitem(IG_Taming),1; getrandgroupitem(IG_Taming),1; },{},{}
-12106,Accessory_Box,Jewelry Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Accesory),1; },{},{}
-12107,Wrapped_Mask,Wrapped Mask,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Mask),1; },{},{}
-12108,Bundle_Of_Magic_Scroll,Scroll Package,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Scroll),1; getrandgroupitem(IG_Scroll),1; getrandgroupitem(IG_Scroll),1; getrandgroupitem(IG_Scroll),1; getrandgroupitem(IG_Scroll),1; },{},{}
+12104,Random_Quiver,Random Quiver,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Quiver,1); },{},{}
+12105,Set_Of_Taiming_Item,Taming Gift Set,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Taming,1); getrandgroupitem(IG_Taming,1); getrandgroupitem(IG_Taming,1); },{},{}
+12106,Accessory_Box,Jewelry Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Accesory,1); },{},{}
+12107,Wrapped_Mask,Wrapped Mask,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Mask,1); },{},{}
+12108,Bundle_Of_Magic_Scroll,Scroll Package,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Scroll,1); getrandgroupitem(IG_Scroll,1); getrandgroupitem(IG_Scroll,1); getrandgroupitem(IG_Scroll,1); getrandgroupitem(IG_Scroll,1); },{},{}
 12109,Poring_Box,Poring Box,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ monster "this",-1,-1,"--ja--",-2,1,""; },{},{}
-12110,First_Aid_Kit,First Aid Kit,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; },{},{}
-12111,Food_Package,Bundle of Food,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FoodBag),1; getrandgroupitem(IG_FoodBag),1; getrandgroupitem(IG_FoodBag),1; },{},{}
+12110,First_Aid_Kit,First Aid Kit,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); },{},{}
+12111,Food_Package,Bundle of Food,2,10000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FoodBag,1); getrandgroupitem(IG_FoodBag,1); getrandgroupitem(IG_FoodBag,1); },{},{}
 12112,Tropical_Sograt,Tropical Sograt,2,1000,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_CURSE,10000,1; },{},{}
 12113,Vermilion_The_Beach,Vermilion on the Beach,2,1000,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_STUN,10000,1; },{},{}
 12114,Elemental_Fire,Elemental Converter,11,2,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "ITEM_ENCHANTARMS",4; },{},{}
@@ -5957,7 +5957,7 @@
 12127,High_end_Cooking_Kits,Professional Cooking Kit,2,2000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ cooking 13; },{},{}
 12128,Imperial_Cooking_Kits,Royal Cooking Kit,2,5000,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ cooking 14; },{},{}
 12129,Fantastic_Cooking_Kits,Fantastic Cooking Kit,2,10000,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ cooking 15; },{},{}
-12130,Cookie_Bag,Cookie Bag,2,2,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CookieBag),1; getrandgroupitem(IG_CookieBag),1; getrandgroupitem(IG_CookieBag),1; },{},{}
+12130,Cookie_Bag,Cookie Bag,2,2,,70,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CookieBag,1); getrandgroupitem(IG_CookieBag,1); getrandgroupitem(IG_CookieBag,1); },{},{}
 12131,Lucky_Potion,Lucky Potion,0,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ /* sc_start SC_LUKFOOD,180000,15; */ },{},{}
 12132,Red_Bag,Santa's Bag,2,0,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_XMAS,600000,0; sc_start SC_SPEEDUP0,600000,25; },{},{}
 12133,Ice_Cream_,McDonald's Ice Cone,0,0,,80,,,,,0xFFFFFFFF,63,2,,,,,,{ if(gettime(5)!=MDiceCone) { set MDiceCone,gettime(5); percentheal 50,50; } },{},{}
@@ -6013,15 +6013,15 @@
 12183,Holy_Arrow_Quiver,Holy Arrow Quiver,2,2,,250,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 1772,500; },{},{}
 12184,Mercenary_Red_Potion,Mercenary Red Potion,2,500,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_heal 1000,0; },{},{}
 12185,Mercenary_Blue_Potion,Mercenary Blue Potion,2,1000,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_heal 0,100; },{},{}
-12186,Red_Box,Old Red Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_RedBox),1; },{},{}
-12187,Green_Box,Old Green Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GreenBox),1; },{},{}
+12186,Red_Box,Old Red Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_RedBox,1); },{},{}
+12187,Green_Box,Old Green Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_GreenBox,1); },{},{}
 12188,Magical_Moon_Cake,Grace Moon Cake,0,20,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 50,50; },{},{}
-12189,Red_Box_,Old Red Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_RedBox_2),1; },{},{}
+12189,Red_Box_,Old Red Box,2,50000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_RedBox_2,1); },{},{}
 12190,Moon_Cake,Moon Cake,2,2,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_SPEEDUP0,180000,25; },{},{}
 12191,Special_Moon_Cake,Special Moon Cake,2,2,,500,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ASPDPOTION0,600000,4; sc_start SC_SPEEDUP0,600000,25; },{},{}
 12192,Pumpkin_Pie,Pumpkin Pie,0,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 5,5; },{},{}
 12193,Brezel,Pretzel,2,20,,20,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-12194,Hometown_Gift,Hometown Gift,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_HometownGift),1; getrandgroupitem(IG_HometownGift),1; getrandgroupitem(IG_HometownGift),1; },{},{}
+12194,Hometown_Gift,Hometown Gift,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_HometownGift,1); getrandgroupitem(IG_HometownGift,1); getrandgroupitem(IG_HometownGift,1); },{},{}
 12195,Plain_Rice_Cake,Plain Rice Cake,0,20,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,20; },{},{}
 12196,Hearty_Rice_Cake,Hearty Rice Cake,0,20,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 50,0; },{},{}
 12197,Salty_Rice_Cake,Salty Rice Cake,0,20,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 10,10; },{},{}
@@ -6065,15 +6065,15 @@
 12237,Choco_Lump,Junky Chocolate,2,0,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,5; sc_start SC_POISON,18000,0; sc_start SC_BLEEDING,18000,0; },{},{}
 12238,New_Year_Rice_Cake_1,New Year Rice Cake,2,20,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_DPOISON,10000,0,1000,0; sc_start SC_POISON,50000,0; },{},{}
 12239,New_Year_Rice_Cake_2,New Year Rice Cake,2,20,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_DPOISON,10000,0,1000,0; sc_start SC_POISON,50000,0; },{},{}
-12240,Old_Yellow_Box,Old Yellow Box,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_YellowBox),1; },{},{}
+12240,Old_Yellow_Box,Old Yellow Box,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_YellowBox,1); },{},{}
 12241,M_Center_Potion,Mercenary Concentration Potion,2,800,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_sc_start SC_ASPDPOTION0,1800000,0; },{},{}
 12242,M_Awakening_Potion,Mercenary Awakening Potion,2,1500,,150,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_sc_start SC_ASPDPOTION1,1800000,0; },{},{}
 12243,M_Berserk_Potion,Mercenary Berserk Potion,2,3000,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_sc_start SC_ASPDPOTION2,1800000,0; },{},{}
-12244,Old_Gift_Box,Old Gift Box,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_OldGiftBox),1; },{},{}
+12244,Old_Gift_Box,Old Gift Box,2,20,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_OldGiftBox,1); },{},{}
 12245,Green_Ale_US,Green Ale,0,5000,,500,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 100,0; },{},{}
-12246,Magic_Card_Album,Mystical Card Album,2,10000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_MagicCardAlbum),1; },{},{}
+12246,Magic_Card_Album,Mystical Card Album,2,10000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_MagicCardAlbum,1); },{},{}
 12247,Halohalo,Halo-Halo,2,2,,100,,,,,0xFFFFFFFF,63,2,,,20,,,{ sc_start SC_INCALLSTATUS,600000,3; },{},{}
-12248,Masquerade_Ball_Box,Fancy Ball Box,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Masquerade),1; },{},{}
+12248,Masquerade_Ball_Box,Fancy Ball Box,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Masquerade,1); },{},{}
 12249,Payroll_Of_Kafra_,Payment Statement for Kafra Employee,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12250,Str_Dish10_M,Steamed Tongue,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_STRFOOD,3600000,10; percentheal 20,20; },{},{}
 12251,Agi_Dish10_M,Steamed Desert Scorpions,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_AGIFOOD,3600000,10; percentheal 15,5; },{},{}
@@ -6111,7 +6111,7 @@
 12283,Internet_Cafe2,Internet Cafe2,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INCSTR,5400000,8; sc_start SC_INCDEX,5400000,4; sc_start SC_INCAGI,5400000,6; sc_start SC_ATKPOTION,5400000,32; sc_start SC_INCFLEE,5400000,5; },{},{}
 12284,Internet_Cafe3,Internet Cafe3,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INCINT,5400000,8; sc_start SC_INCVIT,5400000,4; sc_start SC_INCDEX,5400000,6; sc_start SC_MATKPOTION,5400000,40; },{},{}
 12285,Internet_Cafe4,Internet Cafe4,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INCDEX,5400000,8; sc_start SC_INCLUK,5400000,4; sc_start SC_INCAGI,5400000,6; sc_start SC_ATKPOTION,5400000,24; sc_start SC_MATKPOTION,5400000,24; },{},{}
-12286,Masquerade_Ball_Box2,Masquerade Ball Box2,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Masquerade_2),1; },{},{}
+12286,Masquerade_Ball_Box2,Masquerade Ball Box2,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Masquerade_2,1); },{},{}
 12287,Love_Angel,Love Angel Magic Powder,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ setfont 1; },{},{}
 12288,Squirrel,Squirrel Magic Powder,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ setfont 2; },{},{}
 12289,Gogo,Gogo Magic Powder,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ setfont 3; },{},{}
@@ -6159,12 +6159,12 @@
 12331,Ginseng,Ginseng,0,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 6,0; },{},{}
 12332,Fruit_Juice,Fruit Juice,0,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,6; },{},{}
 12333,Ansila,Ancilla,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,15; },{},{}
-12334,Cherish_Box,Treasure Edition Helm Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Cherish_Box),1; },{},{}
+12334,Cherish_Box,Treasure Edition Helm Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Cherish_Box,1); },{},{}
 12335,Yummy_Skewered_Dish,Grilled Delicious Skewer,0,1000,,350,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 60,60; },{},{}
 12336,Baked_Mushroom,Grilled Mushroom,0,500,,300,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 30,30; },{},{}
 12337,Grilled_Sausage,Grilled Sausages,0,300,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 20,20; },{},{}
 12338,Grilled_Corn,Grilled Corn,2,100,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INCSTR,180000,2; sc_start SC_INCINT,180000,2; sc_start SC_INCAGI,180000,2; },{},{}
-12339,Cherish_Box_Ori,Treasure Edition Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Cherish_Box_Ori),1; },{},{}
+12339,Cherish_Box_Ori,Treasure Edition Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Cherish_Box_Ori,1); },{},{}
 12340,Mysterious_Rice_Powder,Chewy Rice Powder,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1815; },{},{}
 12341,Special_Alloy_Trap_Box,Special Alloy Trap Box,2,30000,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 7940,100; },{},{}
 12342,Manuk's_Opportunity,Manuk's Opportunity,2,0,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ specialeffect2 EF_POTION_BERSERK; sc_start SC_MANU_ATK,600000,10; },{},{}
@@ -6180,8 +6180,8 @@
 12352,Dun_Tele_Scroll3,Dungeon Teleport Scroll 3,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc "F_CashDungeon",3; },{},{}
 12353,Tiny_Waterbottle,Small Bottle,2,800,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_WATERWEAPON,90000,1; },{},{}
 12354,Buche_De_Noel,Buche De Noel,2,2,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ specialeffect2 EF_ANGELUS; bonus_script "{ bonus bHPrecovRate,3; bonus bSPrecovRate,3; bonus bHit,3; bonus bCritical,7; }",600,0,0,SI_BUCHEDENOEL; },{},{}
-12355,Xmas_Gift,Xmas Gift,2,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Xmas_Gift),1; },{},{}
-12356,Louise_Costume_Box,Louise Costume Box,2,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Louise_Costume_Box),1; },{},{}
+12355,Xmas_Gift,Xmas Gift,2,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Xmas_Gift,1); },{},{}
+12356,Louise_Costume_Box,Louise Costume Box,2,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Louise_Costume_Box,1); },{},{}
 12357,Shiny_Wing_Gown,Shiny Wing Gown,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1630; },{},{}
 12358,Fan_Of_Wind,Fan Of Wind,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1513; },{},{}
 12359,Very_Soft_Plant,Very Soft Plant,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 1586; },{},{}
@@ -6396,7 +6396,7 @@
 12570,Cheer_Scarf8_Box,Cheer Scarf8 Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12571,Cheer_Scarf10_Box,Cheer Scarf10 Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12572,Cheer_Scarf10_Box2,Cheer Scarf10 Box2,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-12573,Fruit_Basket,Fruit Basket,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Fruit_Basket),1; getrandgroupitem(IG_Fruit_Basket),1; getrandgroupitem(IG_Fruit_Basket),1; },{},{}
+12573,Fruit_Basket,Fruit Basket,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Fruit_Basket,1); getrandgroupitem(IG_Fruit_Basket,1); getrandgroupitem(IG_Fruit_Basket,1); },{},{}
 12574,Mora_Berry,Mora Berry,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ itemheal 0,rand(50,65); specialeffect2 EF_GUARD; bonus_script "{ bonus2 bAddDefMonster,2137,50; bonus2 bAddDefMonster,2136,50; bonus2 bAddDefMonster,2134,50; bonus2 bAddDefMonster,2133,50; bonus2 bAddDefMonster,2132,50; }",120; },{},{}
 12575,Arrow_Of_Elf_Cntr,Arrow Of Elf Cntr,2,500,,250,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 1773,500; },{},{}
 12576,Hunting_Arrow_Cntr,Hunting Arrow Cntr,2,500,,250,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 1774,500; },{},{}
@@ -6444,7 +6444,7 @@
 12620,Dgrade_Pocket,D Grade Coin Bag,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getgroupitem(IG_Dgrade_Pocket); },{},{}
 12621,Egrade_Pocket,E Grade Coin Bag,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getgroupitem(IG_Egrade_Pocket); },{},{}
 12622,Boarding_Halter,Reins Of Mount,11,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ALL_RIDING,-1,1; },{},{}
-12623,High_Weapon_Box,Advanced Weapons Box,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Advanced_Weapons_Box),1; },{},{}
+12623,High_Weapon_Box,Advanced Weapons Box,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Advanced_Weapons_Box,1); },{},{}
 12624,Delicious_Jelly,Delicious Jelly,0,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 3,3; },{},{}
 12625,Sapa_Feat_Cert_Pack,Sapa Feat Cert Pack,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12626,Wander_Man_Scroll,Wander Man Scroll,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ mercenary_create 2213,1800000; },{},{}
@@ -6511,19 +6511,19 @@
 12687,Int_Dish20,Int Dish20,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12688,Vit_Dish20,Vit Dish20,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12689,Dex_Dish20,Dex Dish20,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-12690,Old_C_Album_Helm,Headgear Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Helm),1; },{},{}
-12691,Old_C_Album_Armor,Armor Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Armor),1; },{},{}
-12692,Old_C_Album_Shield,Shield Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Shield),1; },{},{}
-12693,Old_C_Album_Garment,Garment Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Garment),1; },{},{}
-12694,Old_C_Album_Shoes,Shoes Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Shoes),1; },{},{}
-12695,Old_C_Album_Acc,Accessory Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Acc),1; },{},{}
+12690,Old_C_Album_Helm,Headgear Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Helm,1); },{},{}
+12691,Old_C_Album_Armor,Armor Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Armor,1); },{},{}
+12692,Old_C_Album_Shield,Shield Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Shield,1); },{},{}
+12693,Old_C_Album_Garment,Garment Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Garment,1); },{},{}
+12694,Old_C_Album_Shoes,Shoes Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Shoes,1); },{},{}
+12695,Old_C_Album_Acc,Accessory Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Acc,1); },{},{}
 12696,RWC_Cele_Fire,RWC Celebration Firecracker,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bAllStats,3; bonus2 bAddClass,Class_All,5; bonus2 bMagicAddClass,Class_All,5; bonus bMatkRate,5; }",10,0,0,SI_2011RWC; },{},{}
 12697,RWC_Cele_Fire2,RWC Celebration Firecracker,2,0,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bAllStats,3; bonus2 bAddClass,Class_All,5; bonus2 bMagicAddClass,Class_All,5; bonus bMatkRate,5; }",10,0,0,SI_2011RWC; },{},{}
-12698,Old_C_Album_Weapon,Weapon Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Weapon),1; },{},{}
+12698,Old_C_Album_Weapon,Weapon Card Album,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_CardAlbum_Weapon,1); },{},{}
 12699,Tikbalang_Belt,Tikbalang Harness,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ pet 2313; },{},{}
 12700,Insideout_Shirt,Inside-out Shirt,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "malaya",242,211; },{},{}
 12701,Old_Blue_Box_F,Old Blue Box,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-12702,Old_Bleu_Box,Old Navy Box,2,0,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_BleuBox),1; getrandgroupitem(IG_BleuBox),1; },{},{}
+12702,Old_Bleu_Box,Old Navy Box,2,0,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_BleuBox,1); getrandgroupitem(IG_BleuBox,1); },{},{}
 12703,Holy_Egg_2,Holy Egg,2,0,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Holy_Egg_2,1); },{},{}
 12704,Elixir_Of_Life,Elixir of Life,0,0,,10,,,,,0xFFFFFFFF,63,2,,,85,,,{ percentheal 100,0; },{},{}
 12705,Noble_Nameplate,Noble Nameplate,2,0,,100,,,,,0xFFFFFFFF,63,2,,,90,,,{ sc_start SC_EXPBOOST,1800000,100; },{},{}
@@ -6535,7 +6535,7 @@
 12711,Pretzel,Pretzel,0,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ itemheal rand(50,90),0; },{},{}
 12712,Green_Beer,Green Beer,2,2,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ percentheal 0,50; },{},{}
 12713,Monster_Extract,Monster Extract,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-12714,Easter_Scroll,Easter Scroll,2,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Easter_Scroll),1; },{},{}
+12714,Easter_Scroll,Easter Scroll,2,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Easter_Scroll,1); },{},{}
 12715,Black_Treasure_Box,Black Treasure Box,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 12716,Indian_Rice_Cake,Indian Rice Cake,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 // Guillotine Cross Poisons
@@ -8103,7 +8103,7 @@
 14593,Magic_Power_Scroll,Mystical Amplification Scroll,11,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "HW_MAGICPOWER",10; },{},{}
 14594,Quagmire_Scroll,Quagmire Scroll,11,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WZ_QUAGMIRE",5; },{},{}
 14595,Unsealed_Magic_Spell,Unsealed Magic Spell,2,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "yuno_fild09",255,127; },{},{}
-14596,Pierre_Treasurebox,Pierre's Treasure Box,2,0,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Pierre_Treasurebox),1; getrandgroupitem(IG_Pierre_Treasurebox),1; getrandgroupitem(IG_Pierre_Treasurebox),1; getrandgroupitem(IG_Pierre_Treasurebox),1; getrandgroupitem(IG_Pierre_Treasurebox),1; getrandgroupitem(IG_Pierre_Treasurebox),1; },{},{}
+14596,Pierre_Treasurebox,Pierre's Treasure Box,2,0,,100,,,,,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_Pierre_Treasurebox,1); getrandgroupitem(IG_Pierre_Treasurebox,1); getrandgroupitem(IG_Pierre_Treasurebox,1); getrandgroupitem(IG_Pierre_Treasurebox,1); getrandgroupitem(IG_Pierre_Treasurebox,1); getrandgroupitem(IG_Pierre_Treasurebox,1); },{},{}
 14597,PhreeoniS,Phreeoni Scroll,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start2 SC_ITEMSCRIPT,180000,4121,SI_FOODHIT; },{},{}
 14598,GhostringS,Ghostring Scroll,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start2 SC_ITEMSCRIPT,60000,4047,SI_ARMOR_PROPERTY; },{},{}
 14599,Greed_Scroll_C,Greed Scroll,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "BS_GREED",1; },{},{}
@@ -9777,7 +9777,7 @@
 22551,Teacake,Teacake,2,10,,70,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}
 22552,Fried_Pastry,Fried Pastry,2,10,,70,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}
 22553,Rainbow_Bread,Rainbow Bread,2,10,,70,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}
-22554,First_Aid_Box,First Aid Box,18,10,,200,,,,0,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; getrandgroupitem(IG_FirstAid),1; },{},{}
+22554,First_Aid_Box,First Aid Box,18,10,,200,,,,0,0xFFFFFFFF,63,2,,,,,,{ getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); getrandgroupitem(IG_FirstAid,1); },{},{}
 22555,Gourmet_Chocolate,Gourmet Chocolate,0,10,,10,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}
 22556,Luxury_Chocolate,Luxury Chocolate,0,10,,10,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}
 22557,Masterpieces_of_Artisan_Chocolate,Masterpieces of Artisan Chocolate,0,10,,10,,,,0,0xFFFFFFFF,63,2,,,,,,{},{},{}

+ 69 - 29
doc/item_group.txt

@@ -8,33 +8,33 @@
 //= Explanation of the item_group.txt file and structure.
 //============================================================
 
-Items within an item group can be retrieved through the 'getrandgroupitem'
-and 'getgroupitem' script commands. The table below explains which fields are
-accessed in each.
-
-+===============+====================+================+
-| Field         | 'getrandgroupitem' | 'getgroupitem' |
-+===============+====================+================+
-| GroupID       |       YES          |      YES       |
-+===============+====================+================+
-| ItemID        |       YES          |      YES       |
-+===============+====================+================+
-| Rate          |       YES          |      YES       |
-+===============+====================+================+
-| Amount        |       no           |      YES       |
-+===============+====================+================+
-| Random        |       no           |      YES       |
-+===============+====================+================+
-| isAnnounced   |       no           |      YES       |
-+===============+====================+================+
-| Duration      |       no           |      YES       |
-+===============+====================+================+
-| GUID          |       no           |      YES       |
-+===============+====================+================+
-| isBound       |       no           |      YES       |
-+===============+====================+================+
-| isNamed       |       no           |      YES       |
-+===============+====================+================+
+Items within an item group can be retrieved through the 'groupranditem',
+'getrandgroupitem', and 'getgroupitem' script commands.
+The table below explains which fields are accessed in each.
+
++===============+=================+====================+================+
+| Field         | 'groupranditem' | 'getrandgroupitem' | 'getgroupitem' |
++===============+=================+====================+================+
+| GroupID       |       YES       |        YES         |      YES       |
++===============+=================+====================+================+
+| ItemID        |       YES       |        YES         |      YES       |
++===============+=================+====================+================+
+| Rate          |       YES       |        YES         |      YES       |
++===============+=================+====================+================+
+| Amount        |       no        |     OPTIONAL       |      YES       |
++===============+=================+====================+================+
+| Random        |    OPTIONAL     |     OPTIONAL       |      YES       |
++===============+=================+====================+================+
+| isAnnounced   |       no        |        no          |      YES       |
++===============+=================+====================+================+
+| Duration      |       no        |        no          |      YES       |
++===============+=================+====================+================+
+| GUID          |       no        |        no          |      YES       |
++===============+=================+====================+================+
+| isBound       |       no        |        no          |      YES       |
++===============+=================+====================+================+
+| isNamed       |       no        |        no          |      YES       |
++===============+=================+====================+================+
 
 ---------------------------------------
 
@@ -67,7 +67,7 @@ Random: Set this to '0' and the item will always be obtained ("must" item).
 		Random value will allocates where the item will be stored at random group.
 		(max. random group is 4, defined as MAX_ITEMGROUP_RANDGROUP in 'src/map/itemdb.c'.)
 
-	Example:
+	Item Group:
 		IG_MyItemGroup,Knife,0,1,0		//a "must" item
 		IG_MyItemGroup,Dagger,0,1,0		//a "must" item
 		IG_MyItemGroup,Stiletto,5,1,1	//random at group 1
@@ -75,13 +75,53 @@ Random: Set this to '0' and the item will always be obtained ("must" item).
 		IG_MyItemGroup,Stiletto,5,1,2	//random at group 2
 		IG_MyItemGroup,Dagger_,4,1,2	//random at group 2
 
-	-> usage: 'getgroupitem(IG_MyItemGroup);'
+	Usages:
+	getgroupitem(<group_id>)
+	------------
+	-> 'getgroupitem(IG_MyItemGroup);'
 		- Player always gets 1x Knife and 1x Dagger
 		- Player has chance to get 1x Stiletto by chance 5/7 from group 1
 		- Player has chance to get 1x Stiletto_ by chance 2/7 from group 1
 		- Player has chance to get 1x Stiletto by chance 5/9 from group 2
 		- Player has chance to get 1x Dagger_ by chance 4/9 from group 2
 
+	getrandgroupitem(<group_id>{,<quantity>{,<sub_group>}})
+	------------
+	-> 'getrandgroupitem(IG_MyItemGroup);'
+		- Random Group: 1, Amount: [Based on list]
+		- Equals to: getrandgroupitem(IG_MyItemGroup,0) and getrandgroupitem(IG_MyItemGroup,0,1)
+		- Player has chance to get 1x Stiletto by chance 5/7 from group 1
+		- Player has chance to get 1x Stiletto_ by chance 2/7 from group 1
+		- 'must' and 'group 2' are ignored
+
+	-> 'getrandgroupitem(IG_MyItemGroup,1);'
+		- Random Group: 1, Amount: 2, ignore 'amount' on the list
+		- Equals to: getrandgroupitem(IG_MyItemGroup,1,1)
+		- Player has chance to get 2x Stiletto by chance 5/7 from group 1
+		- Player has chance to get 2x Stiletto_ by chance 2/7 from group 1
+		- 'must' and 'group 2' are ignored
+
+	-> 'getrandgroupitem(IG_MyItemGroup,3,0);'
+		- Random Group: 'must', Amount: 2, ignore 'amount' on the list
+		- Player has chance to get 3x Knife by chance 1/2 from 'must' group
+		- Player has chance to get 3x Dagger by chance 1/2 from 'must' group
+		- 'group 1' and 'group 2' are ignored
+
+	groupranditem(<group id>{,<sub_group>})
+	------------
+	This command only returns an Item ID from random group. Combine with 'getitem'
+	to retrieve the items.
+	-> 'groupranditem(IG_MyItemGroup);'
+		- Random Group: 1
+		- Returns Item ID of Stiletto by chance 5/7 from group 1
+		- Returns Item ID of Stiletto_ by chance 2/7 from group 1
+		- 'must' and 'group 2' are ignored
+	-> 'groupranditem(IG_MyItemGroup,0);'
+		- Random Group: 0
+		- Returns Item ID of Knife by chance 5/7 from 'must' group
+		- Returns Item ID of Dagger by chance 2/7 from 'must' group
+		- 'group 1' and 'group 2' are ignored
+
 	-----------------------------------------
 
 		If the 'Rate' for random '0' is not 0 (more than 0), that means this item

+ 11 - 37
doc/script_commands.txt

@@ -4635,53 +4635,27 @@ different groups and their group number are specified in 'db/(pre-)re/item_group
 When used in conjunction with other functions, you can get a random item. For
 example, for a random pet lure:
 
-getitem groupranditem(15),1;
+getitem groupranditem(IG_Taming),1;
 
 'sub_group' is used to get the available random items of item group from specified random
-group. More info, just like the explanation below.
+group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
+
+More info, see doc/item_group.txt.
 
 ---------------------------------------
 
-*getrandgroupitem <group id>,<quantity>{,<sub_group>};
+*getrandgroupitem <group_id>{,<quantity>{,<sub_group>}};
 
 Similar to the above example, this command allows players to obtain the specified
 quantity of a random item from the group "<group id>". The different groups and 
 their group number are specified in db/(pre-)re/item_group_db.txt
 
-For example, obtaining three of the same random item from Old Blue Box:
-
-getrandgroupitem(1,3);
-getrandgroupitem(IG_BlueBox,3); //see const.txt at 'Item Group ID' section
-
-If quantity is 0, and if the item(s) at specified IG_ has defined amount, the amount of
-the item that will be obtained, will according to the amount on that IG_ data.
-
-By default, if getrandgroupitem is used to get random item from IG_ which has more than
-defined random group, it always read random group 1, other item that as random item at
-random group > 2 never been touched. Use 'sub_group' to choose which random group will be
-obtained.
-
-Example:
-
-	IG_ExGetGroupItem,Coat,2,2,1
-	IG_ExGetGroupItem,Muffler,2,3,1
-	IG_ExGetGroupItem,Yggdrasilberry,10,7,1
-
-	IG_ExGetGroupItem,Yggdrasilberry,10,7,2
-	IG_ExGetGroupItem,Seed_Of_Yggdrasil,5,15,2
-
-	1. 'getrandgroupitem(IG_ExGetGroupItem,1)'
-	   Player has chance to get 1x Coat or 1x Muffler or 1x Yggdrasilberry. Player never
-	   has chance to get Seed_of_Yggdrasil because it is in different random group.
+If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
 
-	2. 'getrandgroupitem(IG_ExGetGroupItem,0)'
-	   Player has chance to get 2x Coat or 3x Muffler or 7x Yggdrasilberry. Player never
-	   has chance to get Seed_of_Yggdrasil because it is in different random group.
+If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
+'must' item group).
 
-	3. 'getrandgroupitem(IG_ExGetGroupItem,0,2)'
-	   Player has chance to get 10x Yggdrasilberry or 15x Seed_of_Yggdrasil. Player never
-	   has chance to get Coat, Muffler, and Seed_of_Yggdrasil because it is in different
-	   random group. 
+More info, see doc/item_group.txt.
 
 ---------------------------------------
 
@@ -4689,9 +4663,9 @@ Example:
 
 Gives item(s) to the attached player based on item group contents.
 This is not working like 'getrandgroupitem' which only give 1 item for specified
-item group.
+item group & sub_group.
 
-For contants, see the "Item Group ID" section in 'db/const.txt'.
+More info, see doc/item_group.txt.
 
 ---------------------------------------
 

+ 3 - 3
src/map/battle.c

@@ -1206,7 +1206,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
 				status_change_end(bl, SC_KYRIE, INVALID_TIMER);
 		}
 
-		if( sc->data[SC_MEIKYOUSISUI] && rand()%100 < 40 ) // custom value
+		if( sc->data[SC_MEIKYOUSISUI] && rnd()%100 < 40 ) // custom value
 			damage = 0;
 
 
@@ -4872,7 +4872,7 @@ static struct Damage initialize_weapon_data(struct block_list *src, struct block
 struct block_list *battle_check_devotion(struct block_list *bl) {
 	struct block_list *d_bl = NULL;
 
-	if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rand()%100) {
+	if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rnd()%100) {
 		struct status_change *sc = status_get_sc(bl);
 		if (sc && sc->data[SC_DEVOTION])
 			d_bl = map_id2bl(sc->data[SC_DEVOTION]->val1);
@@ -5639,7 +5639,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 							c = 0;
 							memset (p_sd, 0, sizeof(p_sd));
 							party_foreachsamemap(skill_check_condition_char_sub, sd, 3, &sd->bl, &c, &p_sd, skill_id);
-							c = ( c > 1 ? rand()%c : 0 );
+							c = ( c > 1 ? rnd()%c : 0 );
 
 							if( (psd = map_id2sd(p_sd[c])) && pc_checkskill(psd,WL_COMET) > 0 ){
 								skillratio = skill_lv * 400; //MATK [{( Skill Level x 400 ) x ( Caster's Base Level / 120 )} + 2500 ] %

+ 34 - 47
src/map/itemdb.c

@@ -109,61 +109,48 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str)
 }
 
 /**
-* Return a random item id from group. (takes into account % chance giving/tot group)
-* NOTE: Sub group 0 will be set to default 1, since 0 isn't random group
+* Return a random group entry from Item Group
 * @param group_id
-* @param sub_group: Default is 1
-* @return nameid
+* @param sub_group: 0 is 'must' item group, random groups start from 1 to MAX_ITEMGROUP_RANDGROUP+1
+* @return Item group entry or NULL on fail
 */
-unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group)
-{
+struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_group) {
 	struct s_item_group_db *group = (struct s_item_group_db *) uidb_get(itemdb_group, group_id);
-	if (sub_group)
-		sub_group -= 1;
+	struct s_item_group_entry *list = NULL;
+	uint16 qty = 0;
+
 	if (!group) {
-		ShowError("itemdb_searchrandomid: Invalid group id %d\n", group_id);
-		return UNKNOWN_ITEM_ID;
+		ShowError("itemdb_get_randgroupitem: Invalid group id %d\n", group_id);
+		return NULL;
 	}
-	if (sub_group > MAX_ITEMGROUP_RANDGROUP) {
-		ShowError("itemdb_searchrandomid: Invalid sub_group %d\n", sub_group+1);
-		return UNKNOWN_ITEM_ID;
+	if (sub_group > MAX_ITEMGROUP_RANDGROUP+1) {
+		ShowError("itemdb_get_randgroupitem: Invalid sub_group %d\n", sub_group);
+		return NULL;
 	}
-	if (&group->random[sub_group] && group->random[sub_group].data_qty)
-		return group->random[sub_group].data[rand()%group->random[sub_group].data_qty].nameid;
-
-	ShowError("itemdb_searchrandomid: No item entries for group id %d and sub group %d\n", group_id, sub_group+1);
-	return UNKNOWN_ITEM_ID;
+	if (sub_group == 0) {
+		list = group->must;
+		qty = group->must_qty;
+	}
+	else {
+		list = group->random[sub_group-1].data;
+		qty = group->random[sub_group-1].data_qty;
+	}
+	if (!qty) {
+		ShowError("itemdb_get_randgroupitem: No item entries for group id %d and sub group %d\n", group_id, sub_group);
+		return NULL;
+	}
+	return &list[rnd()%qty];
 }
 
-/** [Cydh]
-* Return a number of item's amount that will be obtained for 'getrandgroupitem id,1;'
-* NOTE: Sub group 0 will be set to default 1, since 0 isn't random group
+/**
+* Return a random Item ID from from Item Group
 * @param group_id
-* @param sub_group
-* @param nameid: The target item will be found
-* @return amount
+* @param sub_group: 0 is 'must' item group, random groups start from 1 to MAX_ITEMGROUP_RANDGROUP+1
+* @return Item ID or UNKNOWN_ITEM_ID on fail
 */
-uint16 itemdb_get_randgroupitem_count(uint16 group_id, uint8 sub_group, unsigned short nameid) {
-	uint16 i, amt = 1;
-	struct s_item_group_db *group = (struct s_item_group_db *) uidb_get(itemdb_group, group_id);
-	
-	if (sub_group)
-		sub_group -= 1;
-	if (!group) {
-		ShowError("itemdb_get_randgroupitem_count: Invalid group id %d\n", group_id);
-		return amt;
-	}
-	if (sub_group > MAX_ITEMGROUP_RANDGROUP) {
-		ShowError("itemdb_get_randgroupitem_count: Invalid sub_group id %d\n", group_id+1);
-		return amt;
-	}
-	if (!(&group->random[sub_group]) || !group->random[sub_group].data_qty)
-		return amt;
-	for (i = 0; i < group->random[sub_group].data_qty; i++) {
-		if (group->random[sub_group].data[i].nameid == nameid)
-			return group->random[sub_group].data[i].amount;
-	}
-	return amt;
+unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group) {
+	struct s_item_group_entry *entry = itemdb_get_randgroupitem(group_id, sub_group);
+	return entry ? entry->nameid : UNKNOWN_ITEM_ID;
 }
 
 /** [Cydh]
@@ -370,7 +357,7 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
 }
 
 /**
-* Create dummy item data
+* Create dummy item_data as dummy_item and dummy item group entry as dummy_itemgroup
 */
 static void itemdb_create_dummy(void) {
 	CREATE(dummy_item, struct item_data, 1);
@@ -1660,6 +1647,6 @@ void do_init_itemdb(void) {
 	itemdb = uidb_alloc(DB_OPT_BASE);
 	itemdb_combo = uidb_alloc(DB_OPT_BASE);
 	itemdb_group = uidb_alloc(DB_OPT_BASE);
-	itemdb_create_dummy(); //Dummy data item.	
+	itemdb_create_dummy();
 	itemdb_read();
 }

+ 1 - 0
src/map/itemdb.h

@@ -473,6 +473,7 @@ const char* itemdb_typename(enum item_types type);
 const char *itemdb_typename_ammo (enum e_item_ammo ammo);
 bool itemdb_is_spellbook2(unsigned short nameid);
 
+struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_group);
 unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group);
 
 #define itemdb_value_buy(n) itemdb_search(n)->value_buy

+ 29 - 17
src/map/script.c

@@ -6952,9 +6952,18 @@ BUILDIN_FUNC(getnameditem)
  * gets a random item ID from an item group [Skotlex]
  * groupranditem <group_num>{,<sub_group>};
  *------------------------------------------*/
-BUILDIN_FUNC(grouprandomitem)
-{
-	script_pushint(st,itemdb_searchrandomid(script_getnum(st,2),script_getnum(st,3)));
+BUILDIN_FUNC(grouprandomitem) {
+	struct s_item_group_entry *entry = NULL;
+	int sub_group = 1;
+
+	FETCH(3, sub_group);
+	entry = itemdb_get_randgroupitem(script_getnum(st,2),sub_group);
+	if (!entry) {
+		ShowError("buildin_grouprandomitem: Invalid item group with group_id '%d', sub_group '%d'.\n", script_getnum(st,2), sub_group);
+		script_pushint(st,UNKNOWN_ITEM_ID);
+		return SCRIPT_CMD_FAILURE;
+	}
+	script_pushint(st,entry->nameid);
 	return SCRIPT_CMD_SUCCESS;
 }
 
@@ -19032,36 +19041,39 @@ BUILDIN_FUNC(checkre)
 	return SCRIPT_CMD_SUCCESS;
 }
 
-/* getrandgroupitem <group_id>,<quantity>{,<sub_group>} */
+/* getrandgroupitem <group_id>{,<quantity>{,<sub_group>}} */
 BUILDIN_FUNC(getrandgroupitem) {
 	TBL_PC* sd;
 	int i, get_count = 0;
-	unsigned short nameid;
-	uint16 group = script_getnum(st,2), qty = script_getnum(st,3);
-	uint8 sub_group = script_getnum(st,4);
+	uint16 group = script_getnum(st,2), qty = 0;
+	uint8 sub_group = 1;
 	struct item item_tmp;
+	struct s_item_group_entry *entry = NULL;
 
-	if (!( sd = script_rid2sd(st)))
+	if (!(sd = script_rid2sd(st)))
 		return SCRIPT_CMD_SUCCESS;
 
 	if (!group) {
-		ShowError("getrandgroupitem: Invalid group id (%d)!\n",script_getnum(st,2));
+		ShowError("buildin_getrandgroupitem: Invalid group id (%d)!\n",script_getnum(st,2));
 		return SCRIPT_CMD_FAILURE;
 	}
 
-	if ((nameid = itemdb_searchrandomid(group,sub_group)) == UNKNOWN_ITEM_ID) {
+	FETCH(3, qty);
+	FETCH(4, sub_group);
+
+	entry = itemdb_get_randgroupitem(group,sub_group);
+	if (!entry)
 		return SCRIPT_CMD_FAILURE; //ensure valid itemid
-	}
 
 	memset(&item_tmp,0,sizeof(item_tmp));
-	item_tmp.nameid   = nameid;
-	item_tmp.identify = itemdb_isidentified(nameid);
+	item_tmp.nameid   = entry->nameid;
+	item_tmp.identify = itemdb_isidentified(entry->nameid);
 
 	if (!qty)
-		qty = itemdb_get_randgroupitem_count(group,sub_group,nameid);
+		qty = entry->amount;
 
 	//Check if it's stackable.
-	if (!itemdb_isstackable(nameid)) {
+	if (!itemdb_isstackable(entry->nameid)) {
 		item_tmp.amount = 1;
 		get_count = qty;
 	}
@@ -19072,7 +19084,7 @@ BUILDIN_FUNC(getrandgroupitem) {
 
 	for (i = 0; i < get_count; i++) {
 		// if not pet egg
-		if (!pet_create_egg(sd, nameid)) {
+		if (!pet_create_egg(sd, entry->nameid)) {
 			unsigned char flag = 0;
 			if ((flag = pc_additem(sd,&item_tmp,item_tmp.amount,LOG_TYPE_SCRIPT))) {
 				clif_additem(sd,0,0,flag);
@@ -20582,7 +20594,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(get_revision,""),
 	BUILDIN_DEF(get_githash,""),
 	BUILDIN_DEF(freeloop,"?"),
-	BUILDIN_DEF(getrandgroupitem,"ii?"),
+	BUILDIN_DEF(getrandgroupitem,"i??"),
 	BUILDIN_DEF(cleanmap,"s"),
 	BUILDIN_DEF2(cleanmap,"cleanarea","siiii"),
 	BUILDIN_DEF(npcskill,"viii"),

+ 9 - 9
src/map/skill.c

@@ -2812,7 +2812,7 @@ void skill_attack_blow(struct block_list *src, struct block_list *dsrc, struct b
 		// This ensures the storm randomly pushes instead of exactly a cell backwards per official mechanics.
 		case WZ_STORMGUST:
 			if(!battle_config.stormgust_knockback)
-				dir = rand()%8;
+				dir = rnd()%8;
 			break;
 		case WL_CRIMSONROCK:
 			dir = map_calc_dir(target,skill_area_temp[4],skill_area_temp[5]);
@@ -3036,7 +3036,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 				sp = sp/((skill_lv|1)*(skill_lv|1)); //Estimate SP cost of a single water-ball
 			status_heal(bl, 0, sp, 2);
 		}
-		if( (dmg.damage || dmg.damage2) && tsc && tsc->data[SC_HALLUCINATIONWALK] && rand()%100 < tsc->data[SC_HALLUCINATIONWALK]->val3 ) {
+		if( (dmg.damage || dmg.damage2) && tsc && tsc->data[SC_HALLUCINATIONWALK] && rnd()%100 < tsc->data[SC_HALLUCINATIONWALK]->val3 ) {
 			dmg.damage = dmg.damage2 = 0;
 			dmg.dmg_lv = ATK_MISS;
 		}
@@ -3282,7 +3282,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 				status_fix_damage(NULL,d_bl, damage, 0);
 			} else {
 				bool isDevotRdamage = false;
-				if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rand()%100)
+				if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rnd()%100)
 					isDevotRdamage = true;
 				// If !isDevotRdamage, reflected magics are done directly on the target not on paladin
 				// This check is only for magical skill.
@@ -4583,7 +4583,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 				if(idb_exists(bowling_db, bl->id))
 					break;
 				// Random direction
-				dir = rand()%8;
+				dir = rnd()%8;
 			} else {
 				// Create an empty list of already hit targets
 				db_clear(bowling_db);
@@ -5037,7 +5037,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 				if ( s == 0 )
 					break;
 
-				i = spell[s==1?0:rand()%s];// Random select of spell to be released.
+				i = spell[s==1?0:rnd()%s];// Random select of spell to be released.
 				if(sc->data[i] ){// Now extract the data from the preserved spell
 					pres_skill_id = sc->data[i]->val1;
 					pres_skill_lv = sc->data[i]->val2;
@@ -10010,7 +10010,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 					clif_skill_nodamage(src,src,skill_id,skill_lv,1);
 					clif_skill_damage(src, ( skill_id == EL_GUST || skill_id == EL_BLAST || skill_id == EL_WILD_STORM )?src:bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
 					if( skill_id == EL_WIND_STEP )	// There aren't teleport, just push the master away.
-						skill_blown(src,bl,(rnd()%skill_get_blewcount(skill_id,skill_lv))+1,rand()%8,0);
+						skill_blown(src,bl,(rnd()%skill_get_blewcount(skill_id,skill_lv))+1,rnd()%8,0);
 					sc_start(src,src,type2,100,skill_lv,skill_get_time(skill_id,skill_lv));
 					sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv));
 				}
@@ -10077,7 +10077,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		}
 		break;
 	case KO_KYOUGAKU:
-		if( dstsd && tsc && !tsc->data[type] && rand()%100 < tstatus->int_/2 ){
+		if( dstsd && tsc && !tsc->data[type] && rnd()%100 < tstatus->int_/2 ){
 			clif_skill_nodamage(src,bl,skill_id,skill_lv,
 				sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)));
 		}else if( sd )
@@ -10085,7 +10085,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		break;
 	case KO_JYUSATSU:
 		if( dstsd && tsc && !tsc->data[type] &&
-			rand()%100 < ((45+5*skill_lv) + skill_lv*5 - status_get_int(bl)/2) ){//[(Base chance of success) + (Skill Level x 5) - (int / 2)]%.
+			rnd()%100 < ((45+5*skill_lv) + skill_lv*5 - status_get_int(bl)/2) ){//[(Base chance of success) + (Skill Level x 5) - (int / 2)]%.
 			clif_skill_nodamage(src,bl,skill_id,skill_lv,
 				status_change_start(src,bl,type,10000,skill_lv,0,0,0,skill_get_time(skill_id,skill_lv),SCSTART_NOAVOID));
 			status_zap(bl, tstatus->max_hp*skill_lv*5/100 , 0);
@@ -14715,7 +14715,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 			break;
 		case LG_REFLECTDAMAGE:
 		case CR_REFLECTSHIELD:
-			if( sc && sc->data[SC_KYOMU] && rand()%100 < 30){
+			if( sc && sc->data[SC_KYOMU] && rnd()%100 < 30){
 				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
 				return false;
 			}

+ 4 - 4
src/map/status.c

@@ -9613,7 +9613,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC__UNLUCKY:
 		{
 			sc_type rand_eff; 
-			switch(rand() % 3) {
+			switch(rnd() % 3) {
 				case 1: rand_eff = SC_BLIND; break;
 				case 2: rand_eff = SC_SILENCE; break;
 				default: rand_eff = SC_POISON; break;
@@ -9704,7 +9704,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC_GLOOMYDAY:
 			val2 = 20 + 5 * val1; // Flee reduction.
 			val3 = 15 + 5 * val1; // ASPD reduction.
-			if( sd && rand()%100 < val1 ) { // (Skill Lv) %
+			if( sd && rnd()%100 < val1 ) { // (Skill Lv) %
 				val4 = 1; // Reduce walk speed by half.
 				if( pc_isriding(sd) ) pc_setriding(sd, 0);
 				if( pc_isridingdragon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
@@ -9712,7 +9712,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			break;
 		case SC_GLOOMYDAY_SK:
 			// Random number between [15 ~ (Voice Lesson Skill Level x 5) + (Skill Level x 10)] %.
-			val2 = 15 + rand()%( (sd?pc_checkskill(sd, WM_LESSON)*5:0) + val1*10 );
+			val2 = 15 + rnd()%( (sd?pc_checkskill(sd, WM_LESSON)*5:0) + val1*10 );
 			break;
 		case SC_SITDOWN_FORCE:
 		case SC_BANANA_BOMB_SITDOWN:
@@ -9938,7 +9938,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			tick_time = 10000; // [GodLesZ] tick time
 			break;
 		case SC_KYOUGAKU:
-			val2 = 2*val1 + rand()%val1;
+			val2 = 2*val1 + rnd()%val1;
 			clif_status_change(bl,SI_ACTIVE_MONSTER_TRANSFORM,1,0,1002,0,0);
 			break;
 		case SC_KAGEMUSYA: