void main() { object oSelf = OBJECT_SELF; if (GetLocalInt(oSelf,"iAmOpen") != 0) return; SetLocalInt(oSelf,"iAmOpen",99); object oPC = GetLastOpenedBy(); int iHitDice = GetHitDice(oPC); int iGoldValue = d10(1)*iHitDice; int iOtherChance = iHitDice*15; CreateItemOnObject("nw_it_gold001",OBJECT_SELF,iGoldValue); string sItem = ""; int iCounter = iHitDice/2; int iStackSize = 0; // Chance of a potion if (Random(1000) <= iOtherChance) { switch (d6(1)) { case 1:{sItem = "nw_it_mpotion021"; break;} case 2:{sItem = "nw_it_mpotion022"; break;} case 3:{sItem = "nw_it_mpotion023"; break;} case 4:{sItem = "nw_it_mpotion001"; break;} case 5:{sItem = "nw_it_mpotion005"; break;} default:{sItem = "nw_it_mpotion016"; break;} } if (iHitDice > 5) { switch (d6(1)) { case 1:{sItem = "nw_it_mpotion020"; break;} case 2:{sItem = "nw_it_mpotion011"; break;} case 3:{sItem = "nw_it_mpotion015"; break;} case 4:{sItem = "nw_it_mpotion016"; break;} case 5:{sItem = "nw_it_mpotion008"; break;} default:{sItem = "nw_it_mpotion019"; break;} } } if (iHitDice > 10) { switch (d6(1)) { case 1:{sItem = "nw_it_mpotion002"; break;} case 2:{sItem = "nw_it_mpotion006"; break;} case 3:{sItem = "nw_it_mpotion009"; break;} case 4:{sItem = "nw_it_mpotion012"; break;} case 5:{sItem = "nw_it_mpotion004"; break;} default:{sItem = "nw_it_mpotion015"; break;} } } if (iHitDice > 15) { switch (d6(1)) { case 1:{sItem = "nw_it_mpotion003"; break;} case 2:{sItem = "nw_it_mpotion009"; break;} case 3:{sItem = "nw_it_mpotion004"; break;} case 4:{sItem = "nw_it_mpotion011"; break;} case 5:{sItem = "nw_it_mpotion008"; break;} default:{sItem = "nw_it_mpotion015"; break;} } } CreateItemOnObject(sItem,oSelf,1); } // Chance of a resource if (Random(1000) <= iOtherChance) { for (iCounter; iCounter>0; iCounter--) { switch (d6(1)) { case 1:{sItem = "beeswax"; break;} case 2: { sItem = "cured0"+GetStringRight("00"+IntToString(Random(30)+1),2); break; } case 3: { sItem = "ore0"+GetStringRight("00"+IntToString(Random(12)+1),2); break; } case 4: { sItem = "ingot0"+GetStringRight("00"+IntToString(Random(12)+1),2); break; } case 5:{sItem = "glassbottle"; break;} case 6:{sItem = "sandbag"; break;} case 7: { sItem = "wood0"+GetStringRight("00"+IntToString(Random(19)+1),2); break; } case 8:{sItem = "glassingot"; break;} case 9:{sItem = "glassvial"; break;} case 10:{sItem = "tannicacid"; break;} case 11:{sItem = "tanningoil"; break;} case 12: { sItem = "dye0"+GetStringRight("00"+IntToString(Random(30)+1),2); break; } case 13: { sItem = "seed0"+GetStringRight("00"+IntToString(Random(69)+1),2); break; } case 14: { sItem = "pelt0"+GetStringRight("00"+IntToString(Random(28)+1),2); break; } case 15: { sItem = "tanned0"+GetStringRight("00"+IntToString(Random(15)+1),2); break; } case 16: { sItem = "softleather0"+GetStringRight("00"+IntToString(Random(15)+1),2); break; } case 17: { sItem = "hardleather0"+GetStringRight("00"+IntToString(Random(15)+1),2); break; } case 18:{sItem = "glassingot"; break;} case 19:{sItem = "tanningsalt"; break;} default:{sItem = "clay"; break;} } CreateItemOnObject(sItem,oSelf,1); } } // Chance of gem/jewel if (Random(1000) <= iOtherChance) { for (iCounter; iCounter>0; iCounter--) { sItem = "nw_it_gem0"; switch (d6(1)+(iHitDice/2)) { case 2:{sItem = sItem+"02";break;} case 3:{sItem = sItem+"03";break;} case 4:{sItem = sItem+"04";break;} case 5:{sItem = sItem+"07";break;} case 6:{sItem = sItem+"15";break;} case 7:{sItem = sItem+"11";break;} case 8:{sItem = sItem+"14";break;} case 9:{sItem = sItem+"05";break;} case 10:{sItem = sItem+"03";break;} case 11:{sItem = sItem+"09";break;} case 12:{sItem = sItem+"12";break;} case 13:{sItem = sItem+"08";break;} case 14:{sItem = sItem+"06";break;} case 15:{sItem = sItem+"05";break;} case 16:{sItem = sItem+"10";break;} default:{sItem = sItem+"01";break;} } CreateItemOnObject(sItem,oSelf,1); } } // Chance of a magic item or armor if (Random(1000) <= iOtherChance) { if (Random(1000)<300) { if (iHitDice < 11) { if (iHitDice <6) { // lvl 1-5 magic switch(Random(89)) { case 1:{sItem = "nw_maarcl046";break;} // chain shirt +1 case 2:{sItem = "nw_maarcl044";break;} // leather armor +1 case 3:{sItem = "nw_maarcl043";break;} // padded armor +1 case 4:{sItem = "nw_maarcl045";break;} // studded leather armor +1 case 5:{sItem = "nw_maarcl035";break;} // chainmail +1 case 6:{sItem = "nw_waxmgr002";break;} // greataxe +1 case 7:{sItem = "nw_waxmhn002";break;} // handaxe+1 case 8:{sItem = "nw_waxmbt002";break;} // battleaxe +1 case 9:{sItem = "nw_it_mbelt018";break;} // belt of agility+1 case 10:{sItem = "nw_it_mbelt010";break;} // brawlers belt case 11:{sItem = "nw_it_mbelt009";break;} // swordsman belt case 12:{sItem = "nw_it_mboots015";break;} // boots of hardiness+1 case 13:{sItem = "nw_it_mboots010";break;} // boots of reflexes+1 case 14:{sItem = "nw_it_mboots001";break;} // boots of striding+1 case 15:{sItem = "nw_it_mboots018";break;} // boots of the sun soul+1 case 16:{sItem = "nw_it_mbracer002";break;} // bracers of armor+1 case 17:{sItem = "nw_it_mbracer001";break;} // bracers of dexterity+1 case 18:{sItem = "nw_maarcl057";break;} // cloak of elvenkind case 19:{sItem = "nw_maarcl104";break;} // cloak of fortification+1 case 20:{sItem = "nw_maarcl055";break;} // cloak of protection+1 case 21:{sItem = "nw_maarcl031";break;} // nymph cloak+1 case 22:{sItem = "nw_mcloth018";break;} // robes of the shining hand+1 case 23:{sItem = "nw_mcloth006";break;} // robe of light case 24:{sItem = "nw_wblmcl002";break;} // club+1 case 25:{sItem = "nw_wbwmxl002";break;} // Light Crossbow+1 case 26:{sItem = "nw_wbwmxh002";break;} // heavy xbow+1 case 27:{sItem = "nw_wswmdg002";break;} // dagger+1 case 28:{sItem = "nw_wdbmqs002";break;} // quarterstaff+1 case 29:{sItem = "nw_wspmka002";break;} // kama+1 case 30:{sItem = "nw_wspmku002";break;} // kukri+1 case 31:{sItem = "nw_wspmsc002";break;} // sickle+1 case 32:{sItem = "nw_wmgwn003";break;} // wand of fear case 33:{sItem = "nw_wmgwn004";break;} // wand of missiles case 34:{sItem = "nw_wmgwn012";break;} // wand of sleep case 35:{sItem = "nw_wmgwn013";break;} // wand of lesser summoning case 36:{sItem = "nw_wblmfh002";break;} // heavy flail +1 case 37:{sItem = "nw_wblmfl002";break;} // light flail+1 case 38:{sItem = "nw_it_mglove016";break;} // gloves of the hin fist+1 case 39:{sItem = "nw_it_mglove021";break;} // gloves of the long death+1 case 40:{sItem = "nw_it_mglove026";break;} // gloves of the yellow rose +1 case 41:{sItem = "nw_it_mbracer012";break;} // lesser gauntlets of ogre power case 42:{sItem = "nw_it_mglove009";break;} // gloves of swordplay case 43:{sItem = "nw_it_mglove006";break;} // gloves of animal handling case 44:{sItem = "nw_wblmhl002";break;} // light hammer +1 case 45:{sItem = "nw_wblmhw002";break;} // warhammer +1 case 46:{sItem = "nw_wbwmln002";break;} // longbow +1 case 47:{sItem = "nw_wblmml002";break;} // mace+1 case 48:{sItem = "nw_wblmms002";break;} // morningstar+1 case 49:{sItem = "nw_wspmnn002";break;} // nunchaku +1 case 50:{sItem = "nw_it_picks001";iStackSize = Random(iHitDice/4)+1;break;} // thieves picks +1 case 51:{sItem = "nw_it_medkit001";iStackSize = Random(iHitDice/4)+1;break;} // healers kit +1 case 52:{sItem = "nw_wswmka002";break;} // katana +1 case 53:{sItem = "nw_wswmrp002";break;} // rapier +1 case 54:{sItem = "nw_wswmsc002";break;} // scimitar+1 case 55:{sItem = "nw_wplmhb002";break;} // halberd +1 case 56:{sItem = "nw_wplmsc002";break;} // scythe+1 case 57:{sItem = "nw_wplmss002";break;} // spear+1 case 58:{sItem = "nw_it_mneck001";break;} // amulet of natural armor+1 case 59:{sItem = "nw_it_mneck024";break;} // amulet of will +1 case 60:{sItem = "nw_it_mneck007";break;} // periapt of wisdom+1 case 61:{sItem = "nw_it_mring006";break;} // ring of clear thought+1 case 62:{sItem = "nw_it_mring010";break;} // ring of crimson case 63:{sItem = "nw_it_mring009";break;} // ring of cyan case 64:{sItem = "nw_it_mring024";break;} // ring of fortitude+1 case 65:{sItem = "nw_it_mring012";break;} // ring of insight case 66:{sItem = "nw_it_mring011";break;} // ring of jade case 67:{sItem = "nw_it_mring001";break;} // ring of protection+1 case 68:{sItem = "nw_it_mring031";break;} // ring of resistance +1 case 69:{sItem = "nw_it_mneck006";break;} // scarab of protection+1 case 70:{sItem = "nw_ashmlw002";break;} // large shield +1 case 71:{sItem = "nw_ashmsw002";break;} // small shield+1 case 72:{sItem = "nw_ashmto002";break;} // tower shield+1 case 73:{sItem = "nw_wbwmsh002";break;} // shortbow+1 case 74:{sItem = "nw_wthmdt002";iStackSize = d20(2)+10;break;} // dart+1 case 75:{sItem = "nw_wthmsh002";iStackSize = d20(2)+10;break;} // shuriken+1 case 76:{sItem = "nw_wbwmsl001";break;} // sling+1 case 77:{sItem = "nw_wthmax002";iStackSize = d20(2)+10;break;} // throwing axe+1 case 78:{sItem = "nw_wswmbs002";break;} // bastard sword +1 case 79:{sItem = "nw_wswmgs002";break;} // greatsword+1 case 80:{sItem = "nw_wswmls002";break;} // longsword+1 case 81:{sItem = "nw_wswmss002";break;} // shortsword+1 case 82:{sItem = "nw_wammar003";iStackSize = d20(iHitDice);break;} // acid arrows case 83:{sItem = "nw_wammar002";iStackSize = d20(iHitDice);break;} // fire arrows case 84:{sItem = "nw_wammar005";iStackSize = d20(iHitDice);break;} // ice arrow case 85:{sItem = "nw_wammar007";iStackSize = d20(iHitDice);break;} // mild poison arrow case 86:{sItem = "nw_wammbo005";iStackSize = d20(iHitDice);break;} // bolt of fire case 87:{sItem = "nw_wammbo001";iStackSize = d20(iHitDice);break;} // bolt of frostbite case 88:{sItem = "nw_wammbu005";iStackSize = d20(iHitDice);break;} // fire bullet default:{sItem = "nw_wammbu006";iStackSize = d20(iHitDice);break;} // ice bullet } } else { // level 6-10 magic } } else { if (iHitDice <16) { // level 11-15 magic } else { // level 16-20 magic } } } else { if (Random(1000)<500) { if (Random(1000)<400) { // normal ammo *or* shields switch (d4(1)+(iHitDice/4)) { case 3:{sItem = "nw_wamar001";iStackSize = Random(99)+1;break;} // arrow case 4:{sItem = "nw_wambo001";iStackSize = Random(99)+1;break;} // bolt case 5:{sItem = "nw_wambu001";iStackSize = Random(99)+1;break;} // bullet case 7:{sItem = "nw_ashlw001";break;} // large shield case 8:{sItem = "nw_ashto001";break;} // tower shield default:{sItem = "nw_ashsw001";break;} // small shield } } else { switch (Random(37)+1) { case 1:{sItem = "nw_waxgr001";break;} // great axe case 2:{sItem = "nw_waxhn001";break;} // handaxe case 3:{sItem = "nw_waxbt001";break;} // battle axe case 4:{sItem = "nw_wblcl001";break;} // club case 5:{sItem = "nw_wbwxh001";break;} // heavy crossbow case 6:{sItem = "nw_wbwxl001";break;} // Light Crossbow case 7:{sItem = "nw_wswdg001";break;} // dagger case 8:{sItem = "nw_wdbma001";break;} // dire mace case 9:{sItem = "nw_wdbax001";break;} // Double Axe case 10:{sItem = "nw_wdbqs001";break;} // quarterstaff case 11:{sItem = "nw_wdbsw001";break;} // two-bladed sword case 12:{sItem = "nw_wspka001";break;} // kama case 13:{sItem = "nw_wspku001";break;} // kukri case 14:{sItem = "nw_wspsc001";break;} // sickle case 15:{sItem = "nw_wblfh001";break;} // heavy flail case 16:{sItem = "nw_wblfl001";break;} // light flail case 17:{sItem = "nw_wblhl001";break;} // light hammer case 18:{sItem = "nw_wblhw001";break;} // warhammer case 19:{sItem = "nw_wbwln001";break;} // Longbow case 20:{sItem = "nw_wblml001";break;} // mace case 21:{sItem = "nw_wblms001";break;} // morning star case 22:{sItem = "nw_wspnn001";break;} // nunchaku case 23:{sItem = "nw_wswka001";break;} // katana case 24:{sItem = "nw_wswrp001";break;} // rapier case 25:{sItem = "nw_wswsc001";break;} // scimitar case 26:{sItem = "nw_wplhb001";break;} // halberd case 27:{sItem = "nw_wplsc001";break;} // scythe case 28:{sItem = "nw_wplss001";break;} // spear case 29:{sItem = "nw_wbwsh001";break;} // shortbow case 30:{sItem = "nw_wthdt001";iStackSize = d20(2)+10;break;} // dart case 31:{sItem = "nw_wthsh001";iStackSize = d20(2)+10;break;} // shuriken case 32:{sItem = "nw_wthax001";iStackSize = d20(2)+10;break;} // throwing axe case 33:{sItem = "nw_wbwsl001";break;} // sling case 34:{sItem = "nw_wswbs001";break;} // bastard sword case 35:{sItem = "nw_wswgs001";break;} // great sword case 36:{sItem = "nw_wswls001";break;} // longsword default:{sItem = "nw_wswss001";break;} // shortsword } } } else { switch (d8(1)+(iHitDice/2)) { case 3:{sItem = "nw_aarcl009";break;} //padded armor case 4:{sItem = "nw_aarcl001";break;} // leather armor case 5:{sItem = "nw_aarcl002";break;} // studded Leather case 6:{sItem = "nw_arhe004";break;} // horsehair helmet case 7:{sItem = "nw_aarcl008";break;} // Hide armor case 8:{sItem = "nw_arhe001";break;} // Pot Helmet case 9:{sItem = "nwaarcl012";break;} // chain shirt case 10:{sItem = "nw_aarcl004";break;} // chainmail case 11:{sItem = "nw_arhe005";break;} // stag helmet case 12:{sItem = "nw_aarcl003";break;} // Scale mail case 13:{sItem = "nw_aarcl005";break;} // splint mail case 14:{sItem = "nw_arhe002";break;} // spike helmet case 15:{sItem = "nw_aarcl011";break;} // banded mail case 16:{sItem = "nw_aarcl006";break;} // half plate case 17:{sItem = "nw_aarcl010";break;} // breastplate case 18:{sItem = "nw_aarcl007";break;} // Full plate default:{sItem = "nw_arhe003";break;} // winged helmet } } } if (iStackSize == 0) { CreateItemOnObject(sItem,oSelf,1); } else { CreateItemOnObject(sItem,oSelf,1); } } }